| 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,11 +94,11 @@ const SourceLocationIndex = enum(u32) { |
| 94 | _, | 94 | _, |
| 95 | 95 | ||
| 96 | fn haveCoverage(sli: SourceLocationIndex) bool { | 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 | fn ptr(sli: SourceLocationIndex) *Coverage.SourceLocation { | 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 | fn sourceLocationLinkHtml( | 104 | fn sourceLocationLinkHtml( |
| ... | @@ -114,7 +114,7 @@ const SourceLocationIndex = enum(u32) { | ... | @@ -114,7 +114,7 @@ const SourceLocationIndex = enum(u32) { |
| 114 | try out.print(gpa, ":{d}:{d} </code><button class=\"linkish\" onclick=\"wasm_exports.fuzzSelectSli({d});\">View</button>", .{ | 114 | try out.print(gpa, ":{d}:{d} </code><button class=\"linkish\" onclick=\"wasm_exports.fuzzSelectSli({d});\">View</button>", .{ |
| 115 | sl.line, | 115 | sl.line, |
| 116 | sl.column, | 116 | sl.column, |
| 117 | @intFromEnum(sli), | 117 | @backingInt(sli), |
| 118 | }); | 118 | }); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| ... | @@ -132,7 +132,7 @@ const SourceLocationIndex = enum(u32) { | ... | @@ -132,7 +132,7 @@ const SourceLocationIndex = enum(u32) { |
| 132 | var buf: std.ArrayList(u8) = .empty; | 132 | var buf: std.ArrayList(u8) = .empty; |
| 133 | defer buf.deinit(gpa); | 133 | defer buf.deinit(gpa); |
| 134 | sli.appendPath(&buf) catch @panic("OOM"); | 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 | fn fileHtml( | 138 | fn fileHtml( |
| ... | @@ -166,7 +166,7 @@ fn computeSourceAnnotations( | ... | @@ -166,7 +166,7 @@ fn computeSourceAnnotations( |
| 166 | 166 | ||
| 167 | for (source_locations, 0..) |sl, sli_usize| { | 167 | for (source_locations, 0..) |sl, sli_usize| { |
| 168 | if (sl.file != cov_file_index) continue; | 168 | if (sl.file != cov_file_index) continue; |
| 169 | const sli: SourceLocationIndex = @enumFromInt(sli_usize); | 169 | const sli: SourceLocationIndex = @fromBackingInt(@intCast(sli_usize)); |
| 170 | try locs.append(gpa, sli); | 170 | try locs.append(gpa, sli); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| ... | @@ -199,7 +199,7 @@ fn computeSourceAnnotations( | ... | @@ -199,7 +199,7 @@ fn computeSourceAnnotations( |
| 199 | if (next_sl.line > line or (next_sl.line == line and next_sl.column >= column)) break; | 199 | if (next_sl.line > line or (next_sl.line == line and next_sl.column >= column)) break; |
| 200 | try annotations.append(gpa, .{ | 200 | try annotations.append(gpa, .{ |
| 201 | .file_byte_offset = offset, | 201 | .file_byte_offset = offset, |
| 202 | .dom_id = @intFromEnum(next_sli), | 202 | .dom_id = @backingInt(next_sli), |
| 203 | }); | 203 | }); |
| 204 | next_loc_index += 1; | 204 | next_loc_index += 1; |
| 205 | } | 205 | } |
| ... | @@ -240,7 +240,7 @@ fn unpackSourcesInner(tar_bytes: []u8) !void { | ... | @@ -240,7 +240,7 @@ fn unpackSourcesInner(tar_bytes: []u8) !void { |
| 240 | break :p .{ "root", std.mem.endsWith(u8, file_name, "/root.zig") }; | 240 | break :p .{ "root", std.mem.endsWith(u8, file_name, "/root.zig") }; |
| 241 | }; | 241 | }; |
| 242 | const gop = try Walk.modules.getOrPut(gpa, mod_name); | 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 | if (!gop.found_existing or is_module_root) gop.value_ptr.* = file; | 244 | if (!gop.found_existing or is_module_root) gop.value_ptr.* = file; |
| 245 | const file_bytes = tar_reader.take(@intCast(tar_file.size)) catch unreachable; | 245 | const file_bytes = tar_reader.take(@intCast(tar_file.size)) catch unreachable; |
| 246 | it.unread_file_bytes = 0; // we have read the whole thing | 246 | it.unread_file_bytes = 0; // we have read the whole thing |
| ... | @@ -323,7 +323,7 @@ fn updateCoverage() error{OutOfMemory}!void { | ... | @@ -323,7 +323,7 @@ fn updateCoverage() error{OutOfMemory}!void { |
| 323 | u64, | 323 | u64, |
| 324 | recent_coverage_update.items[@sizeOf(abi.fuzz.CoverageUpdateHeader)..][0 .. n_bitset_elems * @sizeOf(u64)], | 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 | for (covered_bits) |elem| { | 327 | for (covered_bits) |elem| { |
| 328 | try covered.ensureUnusedCapacity(gpa, 64); | 328 | try covered.ensureUnusedCapacity(gpa, 64); |
| 329 | for (0..@bitSizeOf(u64)) |i| { | 329 | for (0..@bitSizeOf(u64)) |i| { |
| ... | @@ -332,7 +332,7 @@ fn updateCoverage() error{OutOfMemory}!void { | ... | @@ -332,7 +332,7 @@ fn updateCoverage() error{OutOfMemory}!void { |
| 332 | covered.appendAssumeCapacity(sli); | 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,7 +80,7 @@ export fn message_begin(len: usize) [*]u8 { |
| 80 | export fn message_end() void { | 80 | export fn message_end() void { |
| 81 | const msg_bytes = message_buffer.items; | 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 | switch (tag) { | 84 | switch (tag) { |
| 85 | _ => @panic("malformed message"), | 85 | _ => @panic("malformed message"), |
| 86 | 86 | ||
| ... | @@ -151,7 +151,7 @@ fn helloMessage(msg_bytes: []align(4) u8) Allocator.Error!void { | ... | @@ -151,7 +151,7 @@ fn helloMessage(msg_bytes: []align(4) u8) Allocator.Error!void { |
| 151 | for (steps, step_name_lens, 0..) |*step_out, name_len, step_idx| { | 151 | for (steps, step_name_lens, 0..) |*step_out, name_len, step_idx| { |
| 152 | step_out.* = .{ | 152 | step_out.* = .{ |
| 153 | .name = duped_step_name_data[name_off..][0..name_len], | 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 | name_off += name_len; | 156 | name_off += name_len; |
| 157 | } | 157 | } |
| ... | @@ -180,7 +180,7 @@ export fn stepName(idx: usize) String { | ... | @@ -180,7 +180,7 @@ export fn stepName(idx: usize) String { |
| 180 | return .init(step_list[idx].name); | 180 | return .init(step_list[idx].name); |
| 181 | } | 181 | } |
| 182 | export fn stepStatus(idx: usize) u8 { | 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 | export fn rebuild() void { | 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,8 +183,8 @@ fn memalign(alloc_alignment: usize, n: usize) callconv(.c) ?[*]align(alignment_b |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | fn posix_memalign(result: *?[*]align(alignment_bytes) u8, alloc_alignment: usize, n: usize) callconv(.c) c_int { | 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); | 186 | if (alloc_alignment < @sizeOf(*anyopaque)) return @backingInt(std.c.E.INVAL); |
| 187 | result.* = aligned_alloc_inner(alloc_alignment, n) orelse return @intFromEnum(std.c.E.NOMEM); | 187 | result.* = aligned_alloc_inner(alloc_alignment, n) orelse return @backingInt(std.c.E.NOMEM); |
| 188 | return 0; | 188 | return 0; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| ... | @@ -192,6 +192,6 @@ fn posix_memalign(result: *?[*]align(alignment_bytes) u8, alloc_alignment: usize | ... | @@ -192,6 +192,6 @@ fn posix_memalign(result: *?[*]align(alignment_bytes) u8, alloc_alignment: usize |
| 192 | /// `null`. | 192 | /// `null`. |
| 193 | fn nomem() ?[*]align(alignment_bytes) u8 { | 193 | fn nomem() ?[*]align(alignment_bytes) u8 { |
| 194 | @branchHint(.cold); | 194 | @branchHint(.cold); |
| 195 | std.c._errno().* = @intFromEnum(std.c.E.NOMEM); | 195 | std.c._errno().* = @backingInt(std.c.E.NOMEM); |
| 196 | return null; | 196 | return null; |
| 197 | } | 197 | } |
lib/c/pthread.zig+3-3| ... | @@ -17,7 +17,7 @@ comptime { | ... | @@ -17,7 +17,7 @@ comptime { |
| 17 | 17 | ||
| 18 | const SpinLock = enum(c.pthread_spinlock_t) { | 18 | const SpinLock = enum(c.pthread_spinlock_t) { |
| 19 | unlocked = if (builtin.target.isMinGW()) -1 else 0, | 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 | fn pthread_spin_init(s: *c.pthread_spinlock_t, pshared: c_int) callconv(.c) c_int { | 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,12 +35,12 @@ fn pthread_spin_destroy(s: *c.pthread_spinlock_t) callconv(.c) c_int { |
| 35 | 35 | ||
| 36 | fn pthread_spin_trylock(s: *c.pthread_spinlock_t) callconv(.c) c_int { | 36 | fn pthread_spin_trylock(s: *c.pthread_spinlock_t) callconv(.c) c_int { |
| 37 | const spin: *SpinLock = @ptrCast(s); | 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 | fn pthread_spin_lock(s: *c.pthread_spinlock_t) callconv(.c) c_int { | 41 | fn pthread_spin_lock(s: *c.pthread_spinlock_t) callconv(.c) c_int { |
| 42 | const spin: *SpinLock = @ptrCast(s); | 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 | while (@cmpxchgWeak(SpinLock, spin, .unlocked, .locked, .acquire, .monotonic)) |_| { | 45 | while (@cmpxchgWeak(SpinLock, spin, .unlocked, .locked, .acquire, .monotonic)) |_| { |
| 46 | std.atomic.spinLoopHint(); | 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,7 +138,7 @@ fn stringToInteger(comptime T: type, noalias buf: [*:0]const u8, noalias maybe_e |
| 138 | end.* = buf; | 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 | return 0; | 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,7 +192,7 @@ fn stringToInteger(comptime T: type, noalias buf: [*:0]const u8, noalias maybe_e |
| 192 | 192 | ||
| 193 | if (@typeInfo(T).int.signedness == .unsigned) { | 193 | if (@typeInfo(T).int.signedness == .unsigned) { |
| 194 | const result = parseDigitsWithSignGenericCharacter(T, u8, digits, maybe_end, real_base, .pos) catch { | 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 | return std.math.maxInt(T); | 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,12 +200,12 @@ fn stringToInteger(comptime T: type, noalias buf: [*:0]const u8, noalias maybe_e |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | if (negative) return parseDigitsWithSignGenericCharacter(T, u8, digits, maybe_end, real_base, .neg) catch blk: { | 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 | break :blk std.math.minInt(T); | 204 | break :blk std.math.minInt(T); |
| 205 | }; | 205 | }; |
| 206 | 206 | ||
| 207 | return parseDigitsWithSignGenericCharacter(T, u8, digits, maybe_end, real_base, .pos) catch blk: { | 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 | break :blk std.math.maxInt(T); | 209 | break :blk std.math.maxInt(T); |
| 210 | }; | 210 | }; |
| 211 | } | 211 | } |
lib/c/sys/reboot.zig+1-1| ... | @@ -12,5 +12,5 @@ comptime { | ... | @@ -12,5 +12,5 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | fn rebootLinux(cmd: c_int) callconv(.c) c_int { | 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,26 +105,26 @@ fn dupLinux(fd: c_int) callconv(.c) c_int { |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | fn dup2Linux(old: c_int, new: c_int) callconv(.c) c_int { | 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 | var res = busy; | 109 | var res = busy; |
| 110 | while (res == busy) res = linux.dup2(old, new); | 110 | while (res == busy) res = linux.dup2(old, new); |
| 111 | return errno(res); | 111 | return errno(res); |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | fn dup3Linux(old: c_int, new: c_int, flags: c_int) callconv(.c) c_int { | 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 | var res = busy; | 116 | var res = busy; |
| 117 | 117 | ||
| 118 | if (@hasField(linux.SYS, "dup3")) { | 118 | if (@hasField(linux.SYS, "dup3")) { |
| 119 | while (res == busy) res = linux.dup3(old, new, @intCast(flags)); | 119 | while (res == busy) res = linux.dup3(old, new, @intCast(flags)); |
| 120 | } else if (@hasField(linux.SYS, "dup2")) { | 120 | } else if (@hasField(linux.SYS, "dup2")) { |
| 121 | const cloexec: c_int = @bitCast(linux.O{ .CLOEXEC = true }); | 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 | if (old == new or (flags & ~cloexec != 0)) return errno(inval); | 123 | if (old == new or (flags & ~cloexec != 0)) return errno(inval); |
| 124 | while (res == busy) res = linux.dup2(old, new); | 124 | while (res == busy) res = linux.dup2(old, new); |
| 125 | _ = if (res >= 0 and (flags & cloexec == cloexec)) linux.fcntl(new, linux.F.SETFD, linux.FD_CLOEXEC); | 125 | _ = if (res >= 0 and (flags & cloexec == cloexec)) linux.fcntl(new, linux.F.SETFD, linux.FD_CLOEXEC); |
| 126 | } else { | 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 | return errno(res); | 129 | return errno(res); |
| 130 | } | 130 | } |
| ... | @@ -238,7 +238,7 @@ fn close(fd: std.c.fd_t) callconv(.c) c_int { | ... | @@ -238,7 +238,7 @@ fn close(fd: std.c.fd_t) callconv(.c) c_int { |
| 238 | const signed: isize = @bitCast(linux.close(fd)); | 238 | const signed: isize = @bitCast(linux.close(fd)); |
| 239 | if (signed < 0) { | 239 | if (signed < 0) { |
| 240 | @branchHint(.unlikely); | 240 | @branchHint(.unlikely); |
| 241 | if (-signed == @intFromEnum(linux.E.INTR)) return 0; | 241 | if (-signed == @backingInt(linux.E.INTR)) return 0; |
| 242 | std.c._errno().* = @intCast(-signed); | 242 | std.c._errno().* = @intCast(-signed); |
| 243 | return -1; | 243 | return -1; |
| 244 | } | 244 | } |
| ... | @@ -253,7 +253,7 @@ fn closeWasi(fd: std.c.fd_t) callconv(.c) c_int { | ... | @@ -253,7 +253,7 @@ fn closeWasi(fd: std.c.fd_t) callconv(.c) c_int { |
| 253 | switch (std.os.wasi.fd_close(fd)) { | 253 | switch (std.os.wasi.fd_close(fd)) { |
| 254 | .SUCCESS => return 0, | 254 | .SUCCESS => return 0, |
| 255 | else => |e| { | 255 | else => |e| { |
| 256 | std.c._errno().* = @intFromEnum(e); | 256 | std.c._errno().* = @backingInt(e); |
| 257 | return -1; | 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,10 +589,10 @@ pub fn main(init: process.Init.Minimal) !void { |
| 589 | graph.cache.addPrefix(graph.local_cache_root); | 589 | graph.cache.addPrefix(graph.local_cache_root); |
| 590 | graph.cache.addPrefix(global_cache_directory); | 590 | graph.cache.addPrefix(global_cache_directory); |
| 591 | graph.cache.addPrefix(graph.build_root_directory); | 591 | graph.cache.addPrefix(graph.build_root_directory); |
| 592 | comptime assert(0 == @intFromEnum(std.zig.Server.Message.PathPrefix.cwd)); | 592 | comptime assert(0 == @backingInt(std.zig.Server.Message.PathPrefix.cwd)); |
| 593 | comptime assert(1 == @intFromEnum(std.zig.Server.Message.PathPrefix.zig_lib)); | 593 | comptime assert(1 == @backingInt(std.zig.Server.Message.PathPrefix.zig_lib)); |
| 594 | comptime assert(2 == @intFromEnum(std.zig.Server.Message.PathPrefix.local_cache)); | 594 | comptime assert(2 == @backingInt(std.zig.Server.Message.PathPrefix.local_cache)); |
| 595 | comptime assert(3 == @intFromEnum(std.zig.Server.Message.PathPrefix.global_cache)); | 595 | comptime assert(3 == @backingInt(std.zig.Server.Message.PathPrefix.global_cache)); |
| 596 | 596 | ||
| 597 | graph.cache.hash.addBytes(builtin.zig_version_string); | 597 | graph.cache.hash.addBytes(builtin.zig_version_string); |
| 598 | 598 | ||
| ... | @@ -1406,7 +1406,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { | ... | @@ -1406,7 +1406,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig { |
| 1406 | var top_level_steps: std.array_hash_map.String(Configuration.Step.Index) = .empty; | 1406 | var top_level_steps: std.array_hash_map.String(Configuration.Step.Index) = .empty; |
| 1407 | for (configuration.steps, 0..) |*conf_step, step_index_usize| { | 1407 | for (configuration.steps, 0..) |*conf_step, step_index_usize| { |
| 1408 | if (conf_step.owner != .root) continue; | 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 | const flags = conf_step.flags(c); | 1410 | const flags = conf_step.flags(c); |
| 1411 | switch (flags.tag) { | 1411 | switch (flags.tag) { |
| 1412 | .top_level => { | 1412 | .top_level => { |
| ... | @@ -2017,7 +2017,7 @@ fn countSubProcesses(maker: *Maker) usize { | ... | @@ -2017,7 +2017,7 @@ fn countSubProcesses(maker: *Maker) usize { |
| 2017 | } | 2017 | } |
| 2018 | 2018 | ||
| 2019 | pub fn stepByIndex(maker: *const Maker, i: Configuration.Step.Index) *Step { | 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 | fn prepare(maker: *Maker, step_names: []const []const u8) !void { | 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,7 +2029,7 @@ fn prepare(maker: *Maker, step_names: []const []const u8) !void { |
| 2029 | const c = &maker.scanned_config.configuration; | 2029 | const c = &maker.scanned_config.configuration; |
| 2030 | 2030 | ||
| 2031 | for (maker.steps, 0..) |*step, step_index_usize| { | 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 | step.* = .{ .extended = .init(step_index.ptr(c).flags(c).tag) }; | 2033 | step.* = .{ .extended = .init(step_index.ptr(c).flags(c).tag) }; |
| 2034 | } | 2034 | } |
| 2035 | 2035 | ||
| ... | @@ -3060,7 +3060,7 @@ pub fn resolveLazyPathIndexAbs( | ... | @@ -3060,7 +3060,7 @@ pub fn resolveLazyPathIndexAbs( |
| 3060 | } | 3060 | } |
| 3061 | 3061 | ||
| 3062 | pub fn generatedPath(maker: *const Maker, index: Configuration.GeneratedFileIndex) *Path { | 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 | pub fn packagePath( | 3066 | pub fn packagePath( |
lib/compiler/Maker/Fetch.zig+6-6| ... | @@ -826,7 +826,7 @@ fn runResource( | ... | @@ -826,7 +826,7 @@ fn runResource( |
| 826 | .notes_len = notes_len, | 826 | .notes_len = notes_len, |
| 827 | }); | 827 | }); |
| 828 | const notes_start = try eb.reserveNotes(notes_len); | 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 | .msg = try eb.printString("expected .hash = {q},", .{computed_package_hash.toSlice()}), | 830 | .msg = try eb.printString("expected .hash = {q},", .{computed_package_hash.toSlice()}), |
| 831 | })); | 831 | })); |
| 832 | return error.FetchFailed; | 832 | return error.FetchFailed; |
| ... | @@ -1297,7 +1297,7 @@ fn initResource(f: *Fetch, uri: std.Uri, resource: *Resource, reader_buffer: []u | ... | @@ -1297,7 +1297,7 @@ fn initResource(f: *Fetch, uri: std.Uri, resource: *Resource, reader_buffer: []u |
| 1297 | .notes_len = notes_len, | 1297 | .notes_len = notes_len, |
| 1298 | }); | 1298 | }); |
| 1299 | const notes_start = try eb.reserveNotes(notes_len); | 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 | .msg = try eb.printString("try .url = \"{f}#{f}\",", .{ | 1301 | .msg = try eb.printString("try .url = \"{f}#{f}\",", .{ |
| 1302 | uri.fmt(.{ .scheme = true, .authority = true, .path = true }), | 1302 | uri.fmt(.{ .scheme = true, .authority = true, .path = true }), |
| 1303 | want_oid, | 1303 | want_oid, |
| ... | @@ -1472,7 +1472,7 @@ fn unpackTarball(f: *Fetch, out_dir: Io.Dir, reader: *Io.Reader) RunError!Unpack | ... | @@ -1472,7 +1472,7 @@ fn unpackTarball(f: *Fetch, out_dir: Io.Dir, reader: *Io.Reader) RunError!Unpack |
| 1472 | switch (item) { | 1472 | switch (item) { |
| 1473 | .unable_to_create_file => |i| res.unableToCreateFile(stripRoot(i.file_name, res.root_dir), i.code), | 1473 | .unable_to_create_file => |i| res.unableToCreateFile(stripRoot(i.file_name, res.root_dir), i.code), |
| 1474 | .unable_to_create_sym_link => |i| res.unableToCreateSymLink(stripRoot(i.file_name, res.root_dir), i.link_name, i.code), | 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 | .components_outside_stripped_prefix => unreachable, // unreachable with strip_components = 0 | 1476 | .components_outside_stripped_prefix => unreachable, // unreachable with strip_components = 0 |
| 1477 | } | 1477 | } |
| 1478 | } | 1478 | } |
| ... | @@ -2205,21 +2205,21 @@ const UnpackResult = struct { | ... | @@ -2205,21 +2205,21 @@ const UnpackResult = struct { |
| 2205 | if (item.excluded(filter)) continue; | 2205 | if (item.excluded(filter)) continue; |
| 2206 | switch (item) { | 2206 | switch (item) { |
| 2207 | .unable_to_create_sym_link => |info| { | 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 | .msg = try eb.printString("unable to create symlink from '{s}' to '{s}': {s}", .{ | 2209 | .msg = try eb.printString("unable to create symlink from '{s}' to '{s}': {s}", .{ |
| 2210 | info.file_name, info.link_name, @errorName(info.code), | 2210 | info.file_name, info.link_name, @errorName(info.code), |
| 2211 | }), | 2211 | }), |
| 2212 | })); | 2212 | })); |
| 2213 | }, | 2213 | }, |
| 2214 | .unable_to_create_file => |info| { | 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 | .msg = try eb.printString("unable to create file '{s}': {s}", .{ | 2216 | .msg = try eb.printString("unable to create file '{s}': {s}", .{ |
| 2217 | info.file_name, @errorName(info.code), | 2217 | info.file_name, @errorName(info.code), |
| 2218 | }), | 2218 | }), |
| 2219 | })); | 2219 | })); |
| 2220 | }, | 2220 | }, |
| 2221 | .unsupported_file_type => |info| { | 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 | .msg = try eb.printString("file '{s}' has unsupported type '{c}'", .{ | 2223 | .msg = try eb.printString("file '{s}' has unsupported type '{c}'", .{ |
| 2224 | info.file_name, info.file_type, | 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,7 +1107,7 @@ pub const Session = struct { |
| 1107 | return error.ReadFailed; | 1107 | return error.ReadFailed; |
| 1108 | }) { | 1108 | }) { |
| 1109 | .flush => return error.EndOfStream, | 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 | .pack_data => { | 1111 | .pack_data => { |
| 1112 | input.toss(1); | 1112 | input.toss(1); |
| 1113 | fs.remaining_len = data.len - 1; | 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,11 +26,11 @@ pub fn print(sc: *const ScannedConfig, w: *Writer) Writer.Error!void { |
| 26 | try tf.end(); | 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 | var sf = try s.beginStructField("top_level_steps", .{}); | 31 | var sf = try s.beginStructField("top_level_steps", .{}); |
| 32 | for (sc.top_level_steps.keys(), sc.top_level_steps.values()) |name, step| { | 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 | try sf.end(); | 35 | try sf.end(); |
| 36 | } | 36 | } |
| ... | @@ -122,7 +122,7 @@ fn printValue(sc: *const ScannedConfig, s: *Serializer, comptime Field: type, fi | ... | @@ -122,7 +122,7 @@ fn printValue(sc: *const ScannedConfig, s: *Serializer, comptime Field: type, fi |
| 122 | } else if (std.enums.tagName(Field, field_value)) |name| { | 122 | } else if (std.enums.tagName(Field, field_value)) |name| { |
| 123 | try s.ident(name); | 123 | try s.ident(name); |
| 124 | } else { | 124 | } else { |
| 125 | try s.int(@intFromEnum(field_value)); | 125 | try s.int(@backingInt(field_value)); |
| 126 | } | 126 | } |
| 127 | }, | 127 | }, |
| 128 | .@"struct" => |info| switch (info.layout) { | 128 | .@"struct" => |info| switch (info.layout) { |
| ... | @@ -152,7 +152,7 @@ fn printValue(sc: *const ScannedConfig, s: *Serializer, comptime Field: type, fi | ... | @@ -152,7 +152,7 @@ fn printValue(sc: *const ScannedConfig, s: *Serializer, comptime Field: type, fi |
| 152 | inline else => |tag| { | 152 | inline else => |tag| { |
| 153 | var sub_struct = try s.beginStruct(.{}); | 153 | var sub_struct = try s.beginStruct(.{}); |
| 154 | try sub_struct.fieldPrefix(@tagName(tag)); | 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 | try sub_struct.end(); | 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,7 +610,7 @@ fn zigProcessUpdate(step_index: Configuration.Step.Index, maker: *Maker, zp: *Zi |
| 610 | const conf_step = step_index.ptr(conf); | 610 | const conf_step = step_index.ptr(conf); |
| 611 | var it = std.mem.splitScalar(u8, body, 0); | 611 | var it = std.mem.splitScalar(u8, body, 0); |
| 612 | while (it.next()) |prefixed_path| { | 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 | const sub_path = try arena.dupe(u8, prefixed_path[1..]); | 614 | const sub_path = try arena.dupe(u8, prefixed_path[1..]); |
| 615 | const sub_path_dirname = Dir.path.dirname(sub_path) orelse ""; | 615 | const sub_path_dirname = Dir.path.dirname(sub_path) orelse ""; |
| 616 | switch (prefix_index) { | 616 | switch (prefix_index) { |
lib/compiler/Maker/Step/Compile.zig+2-2| ... | @@ -132,7 +132,7 @@ const ModuleListContext = struct { | ... | @@ -132,7 +132,7 @@ const ModuleListContext = struct { |
| 132 | 132 | ||
| 133 | pub fn hash(ctx: @This(), key: ModuleList) u32 { | 133 | pub fn hash(ctx: @This(), key: ModuleList) u32 { |
| 134 | _ = ctx; | 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 | const Adapter = struct { | 138 | const Adapter = struct { |
| ... | @@ -144,7 +144,7 @@ const ModuleListContext = struct { | ... | @@ -144,7 +144,7 @@ const ModuleListContext = struct { |
| 144 | 144 | ||
| 145 | pub fn hash(ctx: @This(), key: Configuration.Module.Index) u32 { | 145 | pub fn hash(ctx: @This(), key: Configuration.Module.Index) u32 { |
| 146 | _ = ctx; | 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,7 +1380,7 @@ fn sendRunFuzzTestMessage( |
| 1380 | w.interface.writeStruct(header, .little) catch |err| switch (err) { | 1380 | w.interface.writeStruct(header, .little) catch |err| switch (err) { |
| 1381 | error.WriteFailed => return w.err.?, | 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 | error.WriteFailed => return w.err.?, | 1384 | error.WriteFailed => return w.err.?, |
| 1385 | }; | 1385 | }; |
| 1386 | w.interface.writeInt(u64, amount_or_instance, .little) catch |err| switch (err) { | 1386 | w.interface.writeInt(u64, amount_or_instance, .little) catch |err| switch (err) { |
| ... | @@ -2106,8 +2106,8 @@ fn runCommand( | ... | @@ -2106,8 +2106,8 @@ fn runCommand( |
| 2106 | if (conf_run.expect_term_value.value) |expected_term_value| { | 2106 | if (conf_run.expect_term_value.value) |expected_term_value| { |
| 2107 | const expected_term: process.Child.Term = switch (conf_run.flags2.expect_term_status) { | 2107 | const expected_term: process.Child.Term = switch (conf_run.flags2.expect_term_status) { |
| 2108 | .exited => .{ .exited = @intCast(expected_term_value) }, | 2108 | .exited => .{ .exited = @intCast(expected_term_value) }, |
| 2109 | .signal => .{ .signal = @enumFromInt(expected_term_value) }, | 2109 | .signal => .{ .signal = @fromBackingInt(@intCast(expected_term_value)) }, |
| 2110 | .stopped => .{ .stopped = @enumFromInt(expected_term_value) }, | 2110 | .stopped => .{ .stopped = @fromBackingInt(@intCast(expected_term_value)) }, |
| 2111 | .unknown => .{ .unknown = expected_term_value }, | 2111 | .unknown => .{ .unknown = expected_term_value }, |
| 2112 | }; | 2112 | }; |
| 2113 | if (!termMatches(expected_term, generic_result.term)) { | 2113 | if (!termMatches(expected_term, generic_result.term)) { |
lib/compiler/Maker/Watch.zig+1-1| ... | @@ -903,7 +903,7 @@ pub const Match = struct { | ... | @@ -903,7 +903,7 @@ pub const Match = struct { |
| 903 | pub const Context = struct { | 903 | pub const Context = struct { |
| 904 | pub fn hash(self: Context, a: Match) u32 { | 904 | pub fn hash(self: Context, a: Match) u32 { |
| 905 | _ = self; | 905 | _ = self; |
| 906 | var hasher = Hash.init(@intFromEnum(a.step_index)); | 906 | var hasher = Hash.init(@backingInt(a.step_index)); |
| 907 | hasher.update(a.basename); | 907 | hasher.update(a.basename); |
| 908 | return @truncate(hasher.final()); | 908 | return @truncate(hasher.final()); |
| 909 | } | 909 | } |
lib/compiler/Maker/WebServer.zig+10-10| ... | @@ -257,7 +257,7 @@ pub fn updateStepStatus( | ... | @@ -257,7 +257,7 @@ pub fn updateStepStatus( |
| 257 | const ptr = &configured.step_status_bits[step_idx / 4]; | 257 | const ptr = &configured.step_status_bits[step_idx / 4]; |
| 258 | const bit_offset: u3 = @intCast((step_idx % 4) * 2); | 258 | const bit_offset: u3 = @intCast((step_idx % 4) * 2); |
| 259 | const old_bits: u2 = @truncate(@atomicLoad(u8, ptr, .monotonic) >> bit_offset); | 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 | _ = @atomicRmw(u8, ptr, .Xor, mask, .monotonic); | 261 | _ = @atomicRmw(u8, ptr, .Xor, mask, .monotonic); |
| 262 | ws.notifyUpdate(); | 262 | ws.notifyUpdate(); |
| 263 | } | 263 | } |
| ... | @@ -426,16 +426,16 @@ fn serveWebSocket(ws: *WebServer, sock: *http.Server.WebSocket) !noreturn { | ... | @@ -426,16 +426,16 @@ fn serveWebSocket(ws: *WebServer, sock: *http.Server.WebSocket) !noreturn { |
| 426 | const cur_byte = @atomicLoad(u8, shared, .monotonic); | 426 | const cur_byte = @atomicLoad(u8, shared, .monotonic); |
| 427 | if (prev_byte.* == cur_byte) continue; | 427 | if (prev_byte.* == cur_byte) continue; |
| 428 | const cur: [4]abi.StepUpdate.Status = .{ | 428 | const cur: [4]abi.StepUpdate.Status = .{ |
| 429 | @enumFromInt(@as(u2, @truncate(cur_byte >> 0))), | 429 | @fromBackingInt(@intCast(@as(u2, @truncate(cur_byte >> 0)))), |
| 430 | @enumFromInt(@as(u2, @truncate(cur_byte >> 2))), | 430 | @fromBackingInt(@intCast(@as(u2, @truncate(cur_byte >> 2)))), |
| 431 | @enumFromInt(@as(u2, @truncate(cur_byte >> 4))), | 431 | @fromBackingInt(@intCast(@as(u2, @truncate(cur_byte >> 4)))), |
| 432 | @enumFromInt(@as(u2, @truncate(cur_byte >> 6))), | 432 | @fromBackingInt(@intCast(@as(u2, @truncate(cur_byte >> 6)))), |
| 433 | }; | 433 | }; |
| 434 | const prev: [4]abi.StepUpdate.Status = .{ | 434 | const prev: [4]abi.StepUpdate.Status = .{ |
| 435 | @enumFromInt(@as(u2, @truncate(prev_byte.* >> 0))), | 435 | @fromBackingInt(@intCast(@as(u2, @truncate(prev_byte.* >> 0)))), |
| 436 | @enumFromInt(@as(u2, @truncate(prev_byte.* >> 2))), | 436 | @fromBackingInt(@intCast(@as(u2, @truncate(prev_byte.* >> 2)))), |
| 437 | @enumFromInt(@as(u2, @truncate(prev_byte.* >> 4))), | 437 | @fromBackingInt(@intCast(@as(u2, @truncate(prev_byte.* >> 4)))), |
| 438 | @enumFromInt(@as(u2, @truncate(prev_byte.* >> 6))), | 438 | @fromBackingInt(@intCast(@as(u2, @truncate(prev_byte.* >> 6)))), |
| 439 | }; | 439 | }; |
| 440 | for (cur, prev, byte_idx * 4..) |cur_status, prev_status, step_idx| { | 440 | for (cur, prev, byte_idx * 4..) |cur_status, prev_status, step_idx| { |
| 441 | const msg: abi.StepUpdate = .{ .step_idx = @intCast(step_idx), .bits = .{ .status = cur_status } }; | 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,7 +469,7 @@ fn recvWebSocketMessages(ws: *WebServer, sock: *http.Server.WebSocket) void { |
| 469 | const msg = sock.readSmallMessage() catch return; | 469 | const msg = sock.readSmallMessage() catch return; |
| 470 | if (msg.opcode != .binary) continue; | 470 | if (msg.opcode != .binary) continue; |
| 471 | if (msg.data.len == 0) continue; | 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 | switch (tag) { | 473 | switch (tag) { |
| 474 | _ => continue, | 474 | _ => continue, |
| 475 | .rebuild => while (true) { | 475 | .rebuild => while (true) { |
lib/compiler/aro/aro/Attribute.zig+3-3| ... | @@ -154,7 +154,7 @@ pub const Formatting = struct { | ... | @@ -154,7 +154,7 @@ pub const Formatting = struct { |
| 154 | if (@typeInfo(Unwrapped) != .@"enum") unreachable; | 154 | if (@typeInfo(Unwrapped) != .@"enum") unreachable; |
| 155 | 155 | ||
| 156 | const enum_field_names = @typeInfo(Unwrapped).@"enum".field_names; | 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 | comptime var values: []const u8 = quote ++ enum_field_names[0] ++ quote; | 158 | comptime var values: []const u8 = quote ++ enum_field_names[0] ++ quote; |
| 159 | inline for (enum_field_names[1..]) |enum_field_name| { | 159 | inline for (enum_field_names[1..]) |enum_field_name| { |
| 160 | values = values ++ ", "; | 160 | values = values ++ ", "; |
| ... | @@ -344,7 +344,7 @@ fn diagnoseField( | ... | @@ -344,7 +344,7 @@ fn diagnoseField( |
| 344 | pub fn diagnose(attr: Tag, arguments: *Arguments, arg_idx: u32, res: Parser.Result, arg_start: TokenIndex, node: Tree.Node, p: *Parser) !bool { | 344 | pub fn diagnose(attr: Tag, arguments: *Arguments, arg_idx: u32, res: Parser.Result, arg_start: TokenIndex, node: Tree.Node, p: *Parser) !bool { |
| 345 | switch (attr) { | 345 | switch (attr) { |
| 346 | inline else => |tag| { | 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 | const max_arg_count = comptime maxArgCount(tag); | 348 | const max_arg_count = comptime maxArgCount(tag); |
| 349 | if (arg_idx >= max_arg_count) { | 349 | if (arg_idx >= max_arg_count) { |
| 350 | try p.err(arg_start, .attribute_too_many_args, .{ @tagName(attr), max_arg_count }); | 350 | try p.err(arg_start, .attribute_too_many_args, .{ @tagName(attr), max_arg_count }); |
| ... | @@ -735,7 +735,7 @@ pub const Arguments = blk: { | ... | @@ -735,7 +735,7 @@ pub const Arguments = blk: { |
| 735 | }; | 735 | }; |
| 736 | 736 | ||
| 737 | pub fn ArgumentsForTag(comptime tag: Tag) type { | 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 | return @field(attributes, decl_name); | 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,7 +360,7 @@ pub fn fromName(comp: *Compilation, name: []const u8) ?FromName { |
| 360 | fn fromNameExtra(name: []const u8, comptime arch: std.meta.Tag(Tag)) ?FromName { | 360 | fn fromNameExtra(name: []const u8, comptime arch: std.meta.Tag(Tag)) ?FromName { |
| 361 | const list = @field(@This(), @tagName(arch)); | 361 | const list = @field(@This(), @tagName(arch)); |
| 362 | const tag = list.tagFromName(name) orelse return null; | 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 | return .{ | 365 | return .{ |
| 366 | .tag = @unionInit(Tag, @tagName(arch), tag), | 366 | .tag = @unionInit(Tag, @tagName(arch), tag), |
| ... | @@ -392,7 +392,7 @@ test "all builtins" { | ... | @@ -392,7 +392,7 @@ test "all builtins" { |
| 392 | for (features) |valid_feature| { | 392 | for (features) |valid_feature| { |
| 393 | if (std.mem.eql(u8, feature, valid_feature.name)) continue :outer; | 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,7 +718,7 @@ fn genExpr(c: *CodeGen, node_index: Node.Index) Error!Ir.Ref { |
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | try c.builder.startBlock(then_label); | 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 | c.cond_dummy_ref = try c.addUn(.zext, c.cond_dummy_ref, cond_qt); | 722 | c.cond_dummy_ref = try c.addUn(.zext, c.cond_dummy_ref, cond_qt); |
| 723 | } | 723 | } |
| 724 | const then_val = try c.genExpr(conditional.then_expr); | 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,7 +895,7 @@ fn genLval(c: *CodeGen, node_index: Node.Index) Error!Ir.Ref { |
| 895 | } | 895 | } |
| 896 | 896 | ||
| 897 | const duped_name = try c.builder.arena.allocator().dupeSentinel(u8, slice, 0); | 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 | try c.builder.instructions.append(c.builder.gpa, .{ .tag = .symbol, .data = .{ .label = duped_name }, .ty = .ptr }); | 899 | try c.builder.instructions.append(c.builder.gpa, .{ .tag = .symbol, .data = .{ .label = duped_name }, .ty = .ptr }); |
| 900 | return ref; | 900 | return ref; |
| 901 | }, | 901 | }, |
| ... | @@ -1113,7 +1113,7 @@ fn genCall(c: *CodeGen, call: Node.Call) Error!Ir.Ref { | ... | @@ -1113,7 +1113,7 @@ fn genCall(c: *CodeGen, call: Node.Call) Error!Ir.Ref { |
| 1113 | } | 1113 | } |
| 1114 | 1114 | ||
| 1115 | const duped_name = try c.builder.arena.allocator().dupeSentinel(u8, slice, 0); | 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 | try c.builder.instructions.append(c.builder.gpa, .{ .tag = .symbol, .data = .{ .label = duped_name }, .ty = .ptr }); | 1117 | try c.builder.instructions.append(c.builder.gpa, .{ .tag = .symbol, .data = .{ .label = duped_name }, .ty = .ptr }); |
| 1118 | break :blk ref; | 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,7 +595,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { |
| 595 | 595 | ||
| 596 | .{ .mmx, "__MMX__" }, | 596 | .{ .mmx, "__MMX__" }, |
| 597 | }) |fs| { | 597 | }) |fs| { |
| 598 | if (features.isEnabled(@intFromEnum(fs[0]))) { | 598 | if (features.isEnabled(@backingInt(fs[0]))) { |
| 599 | try define(w, fs[1]); | 599 | try define(w, fs[1]); |
| 600 | } | 600 | } |
| 601 | } | 601 | } |
| ... | @@ -808,7 +808,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { | ... | @@ -808,7 +808,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { |
| 808 | .{ .d128, "SYSREG128" }, | 808 | .{ .d128, "SYSREG128" }, |
| 809 | .{ .gcs, "GCS" }, | 809 | .{ .gcs, "GCS" }, |
| 810 | }) |fs| { | 810 | }) |fs| { |
| 811 | if (features.isEnabled(@intFromEnum(fs[0]))) { | 811 | if (features.isEnabled(@backingInt(fs[0]))) { |
| 812 | try w.print("#define __ARM_FEATURE_{s} 1\n", .{fs[1]}); | 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,7 +1013,7 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { |
| 1013 | // TODO: clang treats __FLT_EVAL_METHOD__ as a special-cased macro because evaluating it within a scope | 1013 | // TODO: clang treats __FLT_EVAL_METHOD__ as a special-cased macro because evaluating it within a scope |
| 1014 | // where `#pragma clang fp eval_method(X)` has been called produces an error diagnostic. | 1014 | // where `#pragma clang fp eval_method(X)` has been called produces an error diagnostic. |
| 1015 | const flt_eval_method = comp.langopts.fp_eval_method orelse target.defaultFpEvalMethod(); | 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 | try w.writeAll( | 1018 | try w.writeAll( |
| 1019 | \\#define __FLT_RADIX__ 2 | 1019 | \\#define __FLT_RADIX__ 2 |
| ... | @@ -1028,13 +1028,13 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { | ... | @@ -1028,13 +1028,13 @@ fn generateSystemDefines(comp: *Compilation, w: *Io.Writer) !void { |
| 1028 | \\#define __pic__ {0d} | 1028 | \\#define __pic__ {0d} |
| 1029 | \\#define __PIC__ {0d} | 1029 | \\#define __PIC__ {0d} |
| 1030 | \\ | 1030 | \\ |
| 1031 | , .{@intFromEnum(comp.code_gen_options.pic_level)}); | 1031 | , .{@backingInt(comp.code_gen_options.pic_level)}); |
| 1032 | if (comp.code_gen_options.is_pie) { | 1032 | if (comp.code_gen_options.is_pie) { |
| 1033 | try w.print( | 1033 | try w.print( |
| 1034 | \\#define __pie__ {0d} | 1034 | \\#define __pie__ {0d} |
| 1035 | \\#define __PIE__ {0d} | 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,7 +1459,7 @@ pub fn hasClangStyleBoundsSafety(comp: *const Compilation) bool { |
| 1459 | 1459 | ||
| 1460 | pub fn getSource(comp: *const Compilation, id: Source.Id) Source { | 1460 | pub fn getSource(comp: *const Compilation, id: Source.Id) Source { |
| 1461 | if (id.alias) { | 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 | if (id.index == .generated) return .{ | 1464 | if (id.index == .generated) return .{ |
| 1465 | .path = "<scratch space>", | 1465 | .path = "<scratch space>", |
| ... | @@ -1468,7 +1468,7 @@ pub fn getSource(comp: *const Compilation, id: Source.Id) Source { | ... | @@ -1468,7 +1468,7 @@ pub fn getSource(comp: *const Compilation, id: Source.Id) Source { |
| 1468 | .splice_locs = &.{}, | 1468 | .splice_locs = &.{}, |
| 1469 | .kind = .user, | 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 | /// Creates a Source from `buf` and adds it to the Compilation | 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,7 +1488,7 @@ pub fn addSourceFromOwnedBuffer(comp: *Compilation, path: []const u8, buf: []u8, |
| 1488 | var splice_list: std.ArrayList(u32) = .empty; | 1488 | var splice_list: std.ArrayList(u32) = .empty; |
| 1489 | defer splice_list.deinit(comp.gpa); | 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 | var i: u32 = 0; | 1493 | var i: u32 = 0; |
| 1494 | var backslash_loc: u32 = undefined; | 1494 | var backslash_loc: u32 = undefined; |
| ... | @@ -1690,7 +1690,7 @@ pub fn addSourceFromFile(comp: *Compilation, file: std.Io.File, path: []const u8 | ... | @@ -1690,7 +1690,7 @@ pub fn addSourceFromFile(comp: *Compilation, file: std.Io.File, path: []const u8 |
| 1690 | pub fn addSourceAlias(comp: *Compilation, source: Source.Id, new_path: []const u8, new_kind: Source.Kind) !Source.Id { | 1690 | pub fn addSourceAlias(comp: *Compilation, source: Source.Id, new_path: []const u8, new_kind: Source.Kind) !Source.Id { |
| 1691 | var aliased_source = comp.getSource(source); | 1691 | var aliased_source = comp.getSource(source); |
| 1692 | aliased_source.path = new_path; | 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 | aliased_source.kind = new_kind; | 1694 | aliased_source.kind = new_kind; |
| 1695 | try comp.source_aliases.append(comp.gpa, aliased_source); | 1695 | try comp.source_aliases.append(comp.gpa, aliased_source); |
| 1696 | return aliased_source.id; | 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,7 +405,7 @@ pub fn effectiveKind(d: *Diagnostics, message: anytype) Message.Kind { |
| 405 | 405 | ||
| 406 | // Use extension diagnostic behavior if not set explicitly. | 406 | // Use extension diagnostic behavior if not set explicitly. |
| 407 | if (message.extension and !set_explicit) { | 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 | // Make diagnostic a warning if -Weverything is set. | 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,8 +67,8 @@ const Iterator = struct { |
| 67 | 67 | ||
| 68 | fn next(self: *Iterator) ?Identifier { | 68 | fn next(self: *Iterator) ?Identifier { |
| 69 | if (self.i == .none) return null; | 69 | if (self.i == .none) return null; |
| 70 | defer self.i = self.slice.items(.next)[@intFromEnum(self.i)]; | 70 | defer self.i = self.slice.items(.next)[@backingInt(self.i)]; |
| 71 | return self.slice.items(.identifier)[@intFromEnum(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,14 +118,14 @@ fn createNodeAssumeCapacity(self: *Hideset, identifier: Identifier) Index { |
| 118 | fn createNodeAssumeCapacityExtra(self: *Hideset, identifier: Identifier, next: Index) Index { | 118 | fn createNodeAssumeCapacityExtra(self: *Hideset, identifier: Identifier, next: Index) Index { |
| 119 | const next_idx = self.linked_list.len; | 119 | const next_idx = self.linked_list.len; |
| 120 | self.linked_list.appendAssumeCapacity(.{ .identifier = identifier, .next = next }); | 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 | /// Create a new list with `identifier` at the front followed by `tail` | 124 | /// Create a new list with `identifier` at the front followed by `tail` |
| 125 | pub fn prepend(self: *Hideset, loc: Source.Location, tail: Index) !Index { | 125 | pub fn prepend(self: *Hideset, loc: Source.Location, tail: Index) !Index { |
| 126 | const new_idx = self.linked_list.len; | 126 | const new_idx = self.linked_list.len; |
| 127 | try self.linked_list.append(self.comp.gpa, .{ .identifier = Identifier.fromLocation(loc), .next = tail }); | 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 | /// Attach elements of `b` to the front of `a` (if they're not in `a`) | 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,7 +163,7 @@ fn len(self: *const Hideset, list: Index) usize { |
| 163 | var cur = list; | 163 | var cur = list; |
| 164 | var count: usize = 0; | 164 | var count: usize = 0; |
| 165 | while (cur != .none) : (count += 1) { | 165 | while (cur != .none) : (count += 1) { |
| 166 | cur = nexts[@intFromEnum(cur)]; | 166 | cur = nexts[@backingInt(cur)]; |
| 167 | } | 167 | } |
| 168 | return count; | 168 | return count; |
| 169 | } | 169 | } |
| ... | @@ -189,7 +189,7 @@ pub fn intersection(self: *Hideset, a: Index, b: Index) !Index { | ... | @@ -189,7 +189,7 @@ pub fn intersection(self: *Hideset, a: Index, b: Index) !Index { |
| 189 | head = new_idx; | 189 | head = new_idx; |
| 190 | } | 190 | } |
| 191 | if (cur != .none) { | 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 | cur = new_idx; | 194 | cur = new_idx; |
| 195 | } | 195 | } |
lib/compiler/aro/aro/LangOpts.zig+1-1| ... | @@ -75,7 +75,7 @@ pub const Standard = enum { | ... | @@ -75,7 +75,7 @@ pub const Standard = enum { |
| 75 | }); | 75 | }); |
| 76 | 76 | ||
| 77 | pub fn atLeast(self: Standard, other: Standard) bool { | 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 | pub fn isGNU(standard: Standard) bool { | 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,7 +316,7 @@ fn validateExtendedIdentifier(p: *Parser) !bool { |
| 316 | // Check NFC normalization. | 316 | // Check NFC normalization. |
| 317 | if (!normalized) continue; | 317 | if (!normalized) continue; |
| 318 | const canonical_class = char_info.getCanonicalClass(codepoint); | 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 | canonical_class != .not_reordered) | 320 | canonical_class != .not_reordered) |
| 321 | { | 321 | { |
| 322 | normalized = false; | 322 | normalized = false; |
| ... | @@ -515,7 +515,7 @@ fn formatResult(p: *Parser, w: *std.Io.Writer, fmt: []const u8, res: Result) !us | ... | @@ -515,7 +515,7 @@ fn formatResult(p: *Parser, w: *std.Io.Writer, fmt: []const u8, res: Result) !us |
| 515 | .null => try w.writeAll("nullptr_t"), | 515 | .null => try w.writeAll("nullptr_t"), |
| 516 | else => if (try res.val.print(res.qt, p.comp, w)) |nested| switch (nested) { | 516 | else => if (try res.val.print(res.qt, p.comp, w)) |nested| switch (nested) { |
| 517 | .pointer => |ptr| { | 517 | .pointer => |ptr| { |
| 518 | const ptr_node: Node.Index = @enumFromInt(ptr.node); | 518 | const ptr_node: Node.Index = @fromBackingInt(@intCast(ptr.node)); |
| 519 | const decl_name = p.tree.tokSlice(ptr_node.tok(&p.tree)); | 519 | const decl_name = p.tree.tokSlice(ptr_node.tok(&p.tree)); |
| 520 | try ptr.offset.printPointer(decl_name, p.comp, w); | 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,16 +666,16 @@ fn addList(p: *Parser, nodes: []const Node.Index) Allocator.Error!Tree.Node.Rang |
| 666 | 666 | ||
| 667 | /// Recursively sets the defintion field of `tentative_decl` to `definition`. | 667 | /// Recursively sets the defintion field of `tentative_decl` to `definition`. |
| 668 | pub fn setTentativeDeclDefinition(p: *Parser, tentative_decl: Node.Index, definition: Node.Index) void { | 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)]; | 669 | const node_data = &p.tree.nodes.items(.data)[@backingInt(tentative_decl)]; |
| 670 | switch (p.tree.nodes.items(.tag)[@intFromEnum(tentative_decl)]) { | 670 | switch (p.tree.nodes.items(.tag)[@backingInt(tentative_decl)]) { |
| 671 | .fn_proto => {}, | 671 | .fn_proto => {}, |
| 672 | .variable => {}, | 672 | .variable => {}, |
| 673 | else => return, | 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 | if (prev.unpack()) |some| { | 679 | if (prev.unpack()) |some| { |
| 680 | p.setTentativeDeclDefinition(some, definition); | 680 | p.setTentativeDeclDefinition(some, definition); |
| 681 | } | 681 | } |
| ... | @@ -687,20 +687,20 @@ fn clearNonTentativeDefinitions(p: *Parser) void { | ... | @@ -687,20 +687,20 @@ fn clearNonTentativeDefinitions(p: *Parser) void { |
| 687 | const tags = p.tree.nodes.items(.tag); | 687 | const tags = p.tree.nodes.items(.tag); |
| 688 | const data = p.tree.nodes.items(.data); | 688 | const data = p.tree.nodes.items(.data); |
| 689 | for (p.tree.root_decls.items) |root_decl| { | 689 | for (p.tree.root_decls.items) |root_decl| { |
| 690 | switch (tags[@intFromEnum(root_decl)]) { | 690 | switch (tags[@backingInt(root_decl)]) { |
| 691 | .fn_proto => { | 691 | .fn_proto => { |
| 692 | const node_data = &data[@intFromEnum(root_decl)]; | 692 | const node_data = &data[@backingInt(root_decl)]; |
| 693 | if (node_data[2] != @intFromEnum(Node.OptIndex.null)) { | 693 | if (node_data[2] != @backingInt(Node.OptIndex.null)) { |
| 694 | if (tags[node_data[2]] != .fn_def) { | 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 | .variable => { | 699 | .variable => { |
| 700 | const node_data = &data[@intFromEnum(root_decl)]; | 700 | const node_data = &data[@backingInt(root_decl)]; |
| 701 | if (node_data[2] != @intFromEnum(Node.OptIndex.null)) { | 701 | if (node_data[2] != @backingInt(Node.OptIndex.null)) { |
| 702 | if (tags[node_data[2]] != .variable_def) { | 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,7 +1326,7 @@ fn decl(p: *Parser) Error!bool { |
| 1326 | .qt = p.func.qt.?, | 1326 | .qt = p.func.qt.?, |
| 1327 | .body = body, | 1327 | .body = body, |
| 1328 | .definition = null, | 1328 | .definition = null, |
| 1329 | } }, @intFromEnum(decl_node)); | 1329 | } }, @backingInt(decl_node)); |
| 1330 | 1330 | ||
| 1331 | try p.decl_buf.append(gpa, decl_node); | 1331 | try p.decl_buf.append(gpa, decl_node); |
| 1332 | 1332 | ||
| ... | @@ -1358,7 +1358,7 @@ fn decl(p: *Parser) Error!bool { | ... | @@ -1358,7 +1358,7 @@ fn decl(p: *Parser) Error!bool { |
| 1358 | .name_tok = init_d.d.name, | 1358 | .name_tok = init_d.d.name, |
| 1359 | .qt = init_d.d.qt, | 1359 | .qt = init_d.d.qt, |
| 1360 | .implicit = false, | 1360 | .implicit = false, |
| 1361 | } }, @intFromEnum(decl_node)); | 1361 | } }, @backingInt(decl_node)); |
| 1362 | } else if (init_d.d.declarator_type == .func or init_d.d.qt.is(p.comp, .func)) { | 1362 | } else if (init_d.d.declarator_type == .func or init_d.d.qt.is(p.comp, .func)) { |
| 1363 | try decl_spec.validateFnDecl(p); | 1363 | try decl_spec.validateFnDecl(p); |
| 1364 | try p.tree.setNode(.{ .function = .{ | 1364 | try p.tree.setNode(.{ .function = .{ |
| ... | @@ -1368,7 +1368,7 @@ fn decl(p: *Parser) Error!bool { | ... | @@ -1368,7 +1368,7 @@ fn decl(p: *Parser) Error!bool { |
| 1368 | .@"inline" = decl_spec.@"inline" != null, | 1368 | .@"inline" = decl_spec.@"inline" != null, |
| 1369 | .body = null, | 1369 | .body = null, |
| 1370 | .definition = null, | 1370 | .definition = null, |
| 1371 | } }, @intFromEnum(decl_node)); | 1371 | } }, @backingInt(decl_node)); |
| 1372 | } else { | 1372 | } else { |
| 1373 | try decl_spec.validateDecl(p, init_d.asm_label); | 1373 | try decl_spec.validateDecl(p, init_d.asm_label); |
| 1374 | var node_qt = init_d.d.qt; | 1374 | var node_qt = init_d.d.qt; |
| ... | @@ -1400,7 +1400,7 @@ fn decl(p: *Parser) Error!bool { | ... | @@ -1400,7 +1400,7 @@ fn decl(p: *Parser) Error!bool { |
| 1400 | .initializer = if (init_d.initializer) |some| some.node else null, | 1400 | .initializer = if (init_d.initializer) |some| some.node else null, |
| 1401 | .definition = null, | 1401 | .definition = null, |
| 1402 | }, | 1402 | }, |
| 1403 | }, @intFromEnum(decl_node)); | 1403 | }, @backingInt(decl_node)); |
| 1404 | } | 1404 | } |
| 1405 | try p.decl_buf.append(gpa, decl_node); | 1405 | try p.decl_buf.append(gpa, decl_node); |
| 1406 | 1406 | ||
| ... | @@ -2425,7 +2425,7 @@ fn recordSpec(p: *Parser) Error!QualType { | ... | @@ -2425,7 +2425,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2425 | const record_ty: Type.Record = .{ | 2425 | const record_ty: Type.Record = .{ |
| 2426 | .name = interned_name, | 2426 | .name = interned_name, |
| 2427 | .layout = null, | 2427 | .layout = null, |
| 2428 | .decl_node = @enumFromInt(reserved_index), | 2428 | .decl_node = @fromBackingInt(@intCast(reserved_index)), |
| 2429 | .fields = &.{}, | 2429 | .fields = &.{}, |
| 2430 | }; | 2430 | }; |
| 2431 | const record_qt = try p.comp.type_store.put(gpa, if (is_struct) | 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,7 +2451,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2451 | .{ .struct_forward_decl = fw } | 2451 | .{ .struct_forward_decl = fw } |
| 2452 | else | 2452 | else |
| 2453 | .{ .union_forward_decl = fw }, reserved_index); | 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 | return attributed_qt; | 2455 | return attributed_qt; |
| 2456 | } | 2456 | } |
| 2457 | }; | 2457 | }; |
| ... | @@ -2481,7 +2481,7 @@ fn recordSpec(p: *Parser) Error!QualType { | ... | @@ -2481,7 +2481,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2481 | // can be specified after the closing rbrace, which we haven't encountered yet. | 2481 | // can be specified after the closing rbrace, which we haven't encountered yet. |
| 2482 | const record_ty: Type.Record = .{ | 2482 | const record_ty: Type.Record = .{ |
| 2483 | .name = interned_name, | 2483 | .name = interned_name, |
| 2484 | .decl_node = @enumFromInt(reserved_index), | 2484 | .decl_node = @fromBackingInt(@intCast(reserved_index)), |
| 2485 | .layout = null, | 2485 | .layout = null, |
| 2486 | .fields = &.{}, | 2486 | .fields = &.{}, |
| 2487 | }; | 2487 | }; |
| ... | @@ -2505,7 +2505,7 @@ fn recordSpec(p: *Parser) Error!QualType { | ... | @@ -2505,7 +2505,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2505 | break :blk .{ record_ty, record_qt }; | 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 | const decl_buf_top = p.decl_buf.items.len; | 2509 | const decl_buf_top = p.decl_buf.items.len; |
| 2510 | const record_buf_top = p.record_buf.items.len; | 2510 | const record_buf_top = p.record_buf.items.len; |
| 2511 | errdefer p.decl_buf.items.len = decl_buf_top - 1; | 2511 | errdefer p.decl_buf.items.len = decl_buf_top - 1; |
| ... | @@ -2557,15 +2557,15 @@ fn recordSpec(p: *Parser) Error!QualType { | ... | @@ -2557,15 +2557,15 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2557 | .pointer_alignment_bits = 8, | 2557 | .pointer_alignment_bits = 8, |
| 2558 | .required_alignment_bits = 8, | 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 | const base_type = qt.base(p.comp); | 2562 | const base_type = qt.base(p.comp); |
| 2563 | if (is_struct) { | 2563 | if (is_struct) { |
| 2564 | std.debug.assert(base_type.type.@"struct".name == record_ty.name); | 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 | } else { | 2566 | } else { |
| 2567 | std.debug.assert(base_type.type.@"union".name == record_ty.name); | 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 | break :blk false; | 2570 | break :blk false; |
| 2571 | }; | 2571 | }; |
| ... | @@ -2597,7 +2597,7 @@ fn recordSpec(p: *Parser) Error!QualType { | ... | @@ -2597,7 +2597,7 @@ fn recordSpec(p: *Parser) Error!QualType { |
| 2597 | // Override previous incomplete layout and fields. | 2597 | // Override previous incomplete layout and fields. |
| 2598 | const base_qt = qt.base(p.comp).qt; | 2598 | const base_qt = qt.base(p.comp).qt; |
| 2599 | const ts = &p.comp.type_store; | 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 | const layout_size = 5; | 2602 | const layout_size = 5; |
| 2603 | comptime std.debug.assert(@sizeOf(Type.Record.Layout) == @sizeOf(u32) * layout_size); | 2603 | comptime std.debug.assert(@sizeOf(Type.Record.Layout) == @sizeOf(u32) * layout_size); |
| ... | @@ -2804,7 +2804,7 @@ fn recordDecl(p: *Parser) Error!bool { | ... | @@ -2804,7 +2804,7 @@ fn recordDecl(p: *Parser) Error!bool { |
| 2804 | .name = interned_name, | 2804 | .name = interned_name, |
| 2805 | .qt = qt, | 2805 | .qt = qt, |
| 2806 | .name_tok = name_tok, | 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 | ._attr_index = attr_index, | 2808 | ._attr_index = attr_index, |
| 2809 | ._attr_len = attr_len, | 2809 | ._attr_len = attr_len, |
| 2810 | }); | 2810 | }); |
| ... | @@ -2951,7 +2951,7 @@ fn enumSpec(p: *Parser) Error!QualType { | ... | @@ -2951,7 +2951,7 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 2951 | .tag = fixed_qt, | 2951 | .tag = fixed_qt, |
| 2952 | .fixed = fixed_qt != null, | 2952 | .fixed = fixed_qt != null, |
| 2953 | .incomplete = true, | 2953 | .incomplete = true, |
| 2954 | .decl_node = @enumFromInt(reserved_index), | 2954 | .decl_node = @fromBackingInt(@intCast(reserved_index)), |
| 2955 | .fields = &.{}, | 2955 | .fields = &.{}, |
| 2956 | } }); | 2956 | } }); |
| 2957 | 2957 | ||
| ... | @@ -3001,7 +3001,7 @@ fn enumSpec(p: *Parser) Error!QualType { | ... | @@ -3001,7 +3001,7 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 3001 | // can be specified after the closing rbrace, which we haven't encountered yet. | 3001 | // can be specified after the closing rbrace, which we haven't encountered yet. |
| 3002 | const enum_ty: Type.Enum = .{ | 3002 | const enum_ty: Type.Enum = .{ |
| 3003 | .name = interned_name, | 3003 | .name = interned_name, |
| 3004 | .decl_node = @enumFromInt(reserved_index), | 3004 | .decl_node = @fromBackingInt(@intCast(reserved_index)), |
| 3005 | .tag = fixed_qt, | 3005 | .tag = fixed_qt, |
| 3006 | .incomplete = true, | 3006 | .incomplete = true, |
| 3007 | .fixed = fixed_qt != null, | 3007 | .fixed = fixed_qt != null, |
| ... | @@ -3012,7 +3012,7 @@ fn enumSpec(p: *Parser) Error!QualType { | ... | @@ -3012,7 +3012,7 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 3012 | }; | 3012 | }; |
| 3013 | 3013 | ||
| 3014 | // reserve space for this enum | 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 | const decl_buf_top = p.decl_buf.items.len; | 3016 | const decl_buf_top = p.decl_buf.items.len; |
| 3017 | const list_buf_top = p.list_buf.items.len; | 3017 | const list_buf_top = p.list_buf.items.len; |
| 3018 | const enum_buf_top = p.enum_buf.items.len; | 3018 | const enum_buf_top = p.enum_buf.items.len; |
| ... | @@ -3076,17 +3076,17 @@ fn enumSpec(p: *Parser) Error!QualType { | ... | @@ -3076,17 +3076,17 @@ fn enumSpec(p: *Parser) Error!QualType { |
| 3076 | new_field_node.enum_field.init = res.node; | 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 | { // Override previous incomplete type | 3083 | { // Override previous incomplete type |
| 3084 | enum_ty.fields = enum_fields; | 3084 | enum_ty.fields = enum_fields; |
| 3085 | enum_ty.incomplete = false; | 3085 | enum_ty.incomplete = false; |
| 3086 | enum_ty.decl_node = @enumFromInt(reserved_index); | 3086 | enum_ty.decl_node = @fromBackingInt(@intCast(reserved_index)); |
| 3087 | const base_type = attributed_qt.base(p.comp); | 3087 | const base_type = attributed_qt.base(p.comp); |
| 3088 | std.debug.assert(base_type.type.@"enum".name == enum_ty.name); | 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 | // declare a symbol for the type | 3092 | // declare a symbol for the type |
| ... | @@ -3619,7 +3619,7 @@ fn declarator( | ... | @@ -3619,7 +3619,7 @@ fn declarator( |
| 3619 | else => unreachable, | 3619 | else => unreachable, |
| 3620 | } | 3620 | } |
| 3621 | // Child type is always stored in repr.data[0] | 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 | break; | 3623 | break; |
| 3624 | } | 3624 | } |
| 3625 | } | 3625 | } |
| ... | @@ -5565,7 +5565,7 @@ fn pointerValue(p: *Parser, node: Node.Index, offset: Value) !Value { | ... | @@ -5565,7 +5565,7 @@ fn pointerValue(p: *Parser, node: Node.Index, offset: Value) !Value { |
| 5565 | const var_name = try p.comp.internString(p.tokSlice(decl_ref.name_tok)); | 5565 | const var_name = try p.comp.internString(p.tokSlice(decl_ref.name_tok)); |
| 5566 | const sym = p.syms.findSymbol(var_name) orelse return .{}; | 5566 | const sym = p.syms.findSymbol(var_name) orelse return .{}; |
| 5567 | const sym_node = sym.node.unpack() orelse return .{}; | 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 | .string_literal_expr => return p.tree.value_map.get(node).?, | 5570 | .string_literal_expr => return p.tree.value_map.get(node).?, |
| 5571 | else => return .{}, | 5571 | else => return .{}, |
| ... | @@ -10066,7 +10066,7 @@ fn stringLiteral(p: *Parser) Error!Result { | ... | @@ -10066,7 +10066,7 @@ fn stringLiteral(p: *Parser) Error!Result { |
| 10066 | const strings_top = p.strings.items.len; | 10066 | const strings_top = p.strings.items.len; |
| 10067 | defer p.strings.items.len = strings_top; | 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 | try p.strings.resize(gpa, literal_start); | 10070 | try p.strings.resize(gpa, literal_start); |
| 10071 | 10071 | ||
| 10072 | while (p.tok_i < string_end) : (p.tok_i += 1) { | 10072 | while (p.tok_i < string_end) : (p.tok_i += 1) { |
| ... | @@ -10082,7 +10082,7 @@ fn stringLiteral(p: *Parser) Error!Result { | ... | @@ -10082,7 +10082,7 @@ fn stringLiteral(p: *Parser) Error!Result { |
| 10082 | .incorrect_encoding_is_error = count > 1, | 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 | while (try char_literal_parser.next()) |item| switch (item) { | 10086 | while (try char_literal_parser.next()) |item| switch (item) { |
| 10087 | .value => |v| { | 10087 | .value => |v| { |
| 10088 | switch (char_width) { | 10088 | switch (char_width) { |
| ... | @@ -10143,7 +10143,7 @@ fn stringLiteral(p: *Parser) Error!Result { | ... | @@ -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 | const slice = p.strings.items[literal_start..]; | 10147 | const slice = p.strings.items[literal_start..]; |
| 10148 | 10148 | ||
| 10149 | // TODO this won't do anything if there is a cache hit | 10149 | // TODO this won't do anything if there is a cache hit |
| ... | @@ -10158,7 +10158,7 @@ fn stringLiteral(p: *Parser) Error!Result { | ... | @@ -10158,7 +10158,7 @@ fn stringLiteral(p: *Parser) Error!Result { |
| 10158 | 10158 | ||
| 10159 | const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{ | 10159 | const array_qt = try p.comp.type_store.put(gpa, .{ .array = .{ |
| 10160 | .elem = string_kind.elementType(p.comp), | 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 | const res: Result = .{ | 10163 | const res: Result = .{ |
| 10164 | .qt = array_qt, | 10164 | .qt = array_qt, |
| ... | @@ -10503,7 +10503,7 @@ fn parseInt(p: *Parser, prefix: NumberPrefix, buf: []const u8, suffix: NumberSuf | ... | @@ -10503,7 +10503,7 @@ fn parseInt(p: *Parser, prefix: NumberPrefix, buf: []const u8, suffix: NumberSuf |
| 10503 | if (prefix == .binary) { | 10503 | if (prefix == .binary) { |
| 10504 | try p.err(tok_i, .binary_integer_literal, .{}); | 10504 | try p.err(tok_i, .binary_integer_literal, .{}); |
| 10505 | } | 10505 | } |
| 10506 | const base = @intFromEnum(prefix); | 10506 | const base = @backingInt(prefix); |
| 10507 | var res = if (suffix.isBitInt()) | 10507 | var res = if (suffix.isBitInt()) |
| 10508 | try p.bitInt(base, buf, suffix, tok_i) | 10508 | try p.bitInt(base, buf, suffix, tok_i) |
| 10509 | else | 10509 | else |
lib/compiler/aro/aro/Preprocessor.zig+2-2| ... | @@ -45,11 +45,11 @@ const IfContext = struct { | ... | @@ -45,11 +45,11 @@ const IfContext = struct { |
| 45 | level: u8, | 45 | level: u8, |
| 46 | 46 | ||
| 47 | fn get(self: *const IfContext) Nesting { | 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 | fn set(self: *IfContext, context: Nesting) void { | 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 | fn increment(self: *IfContext) bool { | 55 | fn increment(self: *IfContext) bool { |
lib/compiler/aro/aro/StringInterner.zig+3-3| ... | @@ -10,12 +10,12 @@ pub const StringId = enum(u32) { | ... | @@ -10,12 +10,12 @@ pub const StringId = enum(u32) { |
| 10 | 10 | ||
| 11 | pub fn lookup(id: StringId, comp: *const Compilation) []const u8 { | 11 | pub fn lookup(id: StringId, comp: *const Compilation) []const u8 { |
| 12 | if (id == .empty) return ""; | 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 | pub fn lookupExtra(id: StringId, si: StringInterner) []const u8 { | 16 | pub fn lookupExtra(id: StringId, si: StringInterner) []const u8 { |
| 17 | if (id == .empty) return ""; | 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,5 +31,5 @@ pub fn intern(si: *StringInterner, allocator: mem.Allocator, str: []const u8) !S |
| 31 | if (str.len == 0) return .empty; | 31 | if (str.len == 0) return .empty; |
| 32 | 32 | ||
| 33 | const gop = try si.table.getOrPut(allocator, str); | 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,14 +104,14 @@ pub const SubArch = enum { |
| 104 | 104 | ||
| 105 | pub fn toFeature(sub: SubArch, arch: Cpu.Arch) ?std.Target.Cpu.Feature.Set.Index { | 105 | pub fn toFeature(sub: SubArch, arch: Cpu.Arch) ?std.Target.Cpu.Feature.Set.Index { |
| 106 | if (arch.isPowerPC()) { | 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 | } else if (arch.isMIPS32()) { | 108 | } else if (arch.isMIPS32()) { |
| 109 | return @intFromEnum(std.Target.mips.Feature.mips32r6); | 109 | return @backingInt(std.Target.mips.Feature.mips32r6); |
| 110 | } else if (arch.isMIPS64()) { | 110 | } else if (arch.isMIPS64()) { |
| 111 | return @intFromEnum(std.Target.mips.Feature.mips64r6); | 111 | return @backingInt(std.Target.mips.Feature.mips64r6); |
| 112 | } else if (arch.isSpirV()) { | 112 | } else if (arch.isSpirV()) { |
| 113 | const spirv = std.Target.spirv.Feature; | 113 | const spirv = std.Target.spirv.Feature; |
| 114 | return @intFromEnum(switch (sub) { | 114 | return @backingInt(switch (sub) { |
| 115 | .spirv_v10 => spirv.v1_0, | 115 | .spirv_v10 => spirv.v1_0, |
| 116 | .spirv_v11 => spirv.v1_1, | 116 | .spirv_v11 => spirv.v1_1, |
| 117 | .spirv_v12 => spirv.v1_2, | 117 | .spirv_v12 => spirv.v1_2, |
| ... | @@ -123,7 +123,7 @@ pub const SubArch = enum { | ... | @@ -123,7 +123,7 @@ pub const SubArch = enum { |
| 123 | }); | 123 | }); |
| 124 | } else if (arch.isAARCH64()) { | 124 | } else if (arch.isAARCH64()) { |
| 125 | const aarch64 = std.Target.aarch64.Feature; | 125 | const aarch64 = std.Target.aarch64.Feature; |
| 126 | return @intFromEnum(switch (sub) { | 126 | return @backingInt(switch (sub) { |
| 127 | .arm_v8_1a => aarch64.v8_1a, | 127 | .arm_v8_1a => aarch64.v8_1a, |
| 128 | .arm_v8_2a => aarch64.v8_2a, | 128 | .arm_v8_2a => aarch64.v8_2a, |
| 129 | .arm_v8_3a => aarch64.v8_3a, | 129 | .arm_v8_3a => aarch64.v8_3a, |
| ... | @@ -149,7 +149,7 @@ pub const SubArch = enum { | ... | @@ -149,7 +149,7 @@ pub const SubArch = enum { |
| 149 | }); | 149 | }); |
| 150 | } else if (arch.isArm()) { | 150 | } else if (arch.isArm()) { |
| 151 | const arm = std.Target.arm.Feature; | 151 | const arm = std.Target.arm.Feature; |
| 152 | return @intFromEnum(switch (sub) { | 152 | return @backingInt(switch (sub) { |
| 153 | .arm_v4t => arm.v4t, | 153 | .arm_v4t => arm.v4t, |
| 154 | .arm_v5 => arm.v5t, | 154 | .arm_v5 => arm.v5t, |
| 155 | .arm_v5te => arm.v5te, | 155 | .arm_v5te => arm.v5te, |
lib/compiler/aro/aro/Tokenizer.zig+2-2| ... | @@ -1218,7 +1218,7 @@ pub fn next(self: *Tokenizer) Token { | ... | @@ -1218,7 +1218,7 @@ pub fn next(self: *Tokenizer) Token { |
| 1218 | break; | 1218 | break; |
| 1219 | }, | 1219 | }, |
| 1220 | .hex4, .hex8 => { | 1220 | .hex4, .hex8 => { |
| 1221 | self.index += @intFromEnum(ucn_kind); | 1221 | self.index += @backingInt(ucn_kind); |
| 1222 | id = .extended_identifier; | 1222 | id = .extended_identifier; |
| 1223 | state = .extended_identifier; | 1223 | state = .extended_identifier; |
| 1224 | }, | 1224 | }, |
| ... | @@ -1458,7 +1458,7 @@ pub fn next(self: *Tokenizer) Token { | ... | @@ -1458,7 +1458,7 @@ pub fn next(self: *Tokenizer) Token { |
| 1458 | }, | 1458 | }, |
| 1459 | .hex4, .hex8 => { | 1459 | .hex4, .hex8 => { |
| 1460 | state = .extended_identifier; | 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,9 +732,9 @@ pub const Node = union(enum) { |
| 732 | _, | 732 | _, |
| 733 | 733 | ||
| 734 | pub fn get(index: Index, tree: *const Tree) Node { | 734 | pub fn get(index: Index, tree: *const Tree) Node { |
| 735 | const node_tok = tree.nodes.items(.tok)[@intFromEnum(index)]; | 735 | const node_tok = tree.nodes.items(.tok)[@backingInt(index)]; |
| 736 | const node_data = &tree.nodes.items(.data)[@intFromEnum(index)]; | 736 | const node_data = &tree.nodes.items(.data)[@backingInt(index)]; |
| 737 | return switch (tree.nodes.items(.tag)[@intFromEnum(index)]) { | 737 | return switch (tree.nodes.items(.tag)[@backingInt(index)]) { |
| 738 | .empty_decl => .{ | 738 | .empty_decl => .{ |
| 739 | .empty_decl = .{ | 739 | .empty_decl = .{ |
| 740 | .semicolon = node_tok, | 740 | .semicolon = node_tok, |
| ... | @@ -743,7 +743,7 @@ pub const Node = union(enum) { | ... | @@ -743,7 +743,7 @@ pub const Node = union(enum) { |
| 743 | .static_assert => .{ | 743 | .static_assert => .{ |
| 744 | .static_assert = .{ | 744 | .static_assert = .{ |
| 745 | .assert_tok = node_tok, | 745 | .assert_tok = node_tok, |
| 746 | .cond = @enumFromInt(node_data[0]), | 746 | .cond = @fromBackingInt(@intCast(node_data[0])), |
| 747 | .message = unpackOptIndex(node_data[1]), | 747 | .message = unpackOptIndex(node_data[1]), |
| 748 | }, | 748 | }, |
| 749 | }, | 749 | }, |
| ... | @@ -768,7 +768,7 @@ pub const Node = union(enum) { | ... | @@ -768,7 +768,7 @@ pub const Node = union(enum) { |
| 768 | .qt = @bitCast(node_data[0]), | 768 | .qt = @bitCast(node_data[0]), |
| 769 | .static = attr.static, | 769 | .static = attr.static, |
| 770 | .@"inline" = attr.@"inline", | 770 | .@"inline" = attr.@"inline", |
| 771 | .body = @enumFromInt(node_data[2]), | 771 | .body = @fromBackingInt(@intCast(node_data[2])), |
| 772 | .definition = null, | 772 | .definition = null, |
| 773 | }, | 773 | }, |
| 774 | }; | 774 | }; |
| ... | @@ -838,7 +838,7 @@ pub const Node = union(enum) { | ... | @@ -838,7 +838,7 @@ pub const Node = union(enum) { |
| 838 | .global_asm => .{ | 838 | .global_asm => .{ |
| 839 | .global_asm = .{ | 839 | .global_asm = .{ |
| 840 | .asm_tok = node_tok, | 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 | .struct_decl => .{ | 844 | .struct_decl => .{ |
| ... | @@ -922,7 +922,7 @@ pub const Node = union(enum) { | ... | @@ -922,7 +922,7 @@ pub const Node = union(enum) { |
| 922 | .labeled_stmt = .{ | 922 | .labeled_stmt = .{ |
| 923 | .label_tok = node_tok, | 923 | .label_tok = node_tok, |
| 924 | .qt = @bitCast(node_data[0]), | 924 | .qt = @bitCast(node_data[0]), |
| 925 | .body = @enumFromInt(node_data[1]), | 925 | .body = @fromBackingInt(@intCast(node_data[1])), |
| 926 | }, | 926 | }, |
| 927 | }, | 927 | }, |
| 928 | .compound_stmt => .{ | 928 | .compound_stmt => .{ |
| ... | @@ -940,44 +940,44 @@ pub const Node = union(enum) { | ... | @@ -940,44 +940,44 @@ pub const Node = union(enum) { |
| 940 | .if_stmt => .{ | 940 | .if_stmt => .{ |
| 941 | .if_stmt = .{ | 941 | .if_stmt = .{ |
| 942 | .if_tok = node_tok, | 942 | .if_tok = node_tok, |
| 943 | .cond = @enumFromInt(node_data[0]), | 943 | .cond = @fromBackingInt(@intCast(node_data[0])), |
| 944 | .then_body = @enumFromInt(node_data[1]), | 944 | .then_body = @fromBackingInt(@intCast(node_data[1])), |
| 945 | .else_body = unpackOptIndex(node_data[2]), | 945 | .else_body = unpackOptIndex(node_data[2]), |
| 946 | }, | 946 | }, |
| 947 | }, | 947 | }, |
| 948 | .switch_stmt => .{ | 948 | .switch_stmt => .{ |
| 949 | .switch_stmt = .{ | 949 | .switch_stmt = .{ |
| 950 | .switch_tok = node_tok, | 950 | .switch_tok = node_tok, |
| 951 | .cond = @enumFromInt(node_data[0]), | 951 | .cond = @fromBackingInt(@intCast(node_data[0])), |
| 952 | .body = @enumFromInt(node_data[1]), | 952 | .body = @fromBackingInt(@intCast(node_data[1])), |
| 953 | }, | 953 | }, |
| 954 | }, | 954 | }, |
| 955 | .case_stmt => .{ | 955 | .case_stmt => .{ |
| 956 | .case_stmt = .{ | 956 | .case_stmt = .{ |
| 957 | .case_tok = node_tok, | 957 | .case_tok = node_tok, |
| 958 | .start = @enumFromInt(node_data[0]), | 958 | .start = @fromBackingInt(@intCast(node_data[0])), |
| 959 | .end = unpackOptIndex(node_data[1]), | 959 | .end = unpackOptIndex(node_data[1]), |
| 960 | .body = @enumFromInt(node_data[2]), | 960 | .body = @fromBackingInt(@intCast(node_data[2])), |
| 961 | }, | 961 | }, |
| 962 | }, | 962 | }, |
| 963 | .default_stmt => .{ | 963 | .default_stmt => .{ |
| 964 | .default_stmt = .{ | 964 | .default_stmt = .{ |
| 965 | .default_tok = node_tok, | 965 | .default_tok = node_tok, |
| 966 | .body = @enumFromInt(node_data[0]), | 966 | .body = @fromBackingInt(@intCast(node_data[0])), |
| 967 | }, | 967 | }, |
| 968 | }, | 968 | }, |
| 969 | .while_stmt => .{ | 969 | .while_stmt => .{ |
| 970 | .while_stmt = .{ | 970 | .while_stmt = .{ |
| 971 | .while_tok = node_tok, | 971 | .while_tok = node_tok, |
| 972 | .cond = @enumFromInt(node_data[0]), | 972 | .cond = @fromBackingInt(@intCast(node_data[0])), |
| 973 | .body = @enumFromInt(node_data[1]), | 973 | .body = @fromBackingInt(@intCast(node_data[1])), |
| 974 | }, | 974 | }, |
| 975 | }, | 975 | }, |
| 976 | .do_while_stmt => .{ | 976 | .do_while_stmt => .{ |
| 977 | .do_while_stmt = .{ | 977 | .do_while_stmt = .{ |
| 978 | .do_tok = node_tok, | 978 | .do_tok = node_tok, |
| 979 | .cond = @enumFromInt(node_data[0]), | 979 | .cond = @fromBackingInt(@intCast(node_data[0])), |
| 980 | .body = @enumFromInt(node_data[1]), | 980 | .body = @fromBackingInt(@intCast(node_data[1])), |
| 981 | }, | 981 | }, |
| 982 | }, | 982 | }, |
| 983 | .for_decl => .{ | 983 | .for_decl => .{ |
| ... | @@ -986,7 +986,7 @@ pub const Node = union(enum) { | ... | @@ -986,7 +986,7 @@ pub const Node = union(enum) { |
| 986 | .init = .{ .decls = @ptrCast(tree.extra.items[node_data[0]..][0 .. node_data[1] - 2]) }, | 986 | .init = .{ .decls = @ptrCast(tree.extra.items[node_data[0]..][0 .. node_data[1] - 2]) }, |
| 987 | .cond = unpackOptIndex(tree.extra.items[node_data[0] + node_data[1] - 2]), | 987 | .cond = unpackOptIndex(tree.extra.items[node_data[0] + node_data[1] - 2]), |
| 988 | .incr = unpackOptIndex(tree.extra.items[node_data[0] + node_data[1] - 1]), | 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 | .for_expr => .{ | 992 | .for_expr => .{ |
| ... | @@ -995,7 +995,7 @@ pub const Node = union(enum) { | ... | @@ -995,7 +995,7 @@ pub const Node = union(enum) { |
| 995 | .init = .{ .expr = unpackOptIndex(node_data[0]) }, | 995 | .init = .{ .expr = unpackOptIndex(node_data[0]) }, |
| 996 | .cond = unpackOptIndex(tree.extra.items[node_data[1]]), | 996 | .cond = unpackOptIndex(tree.extra.items[node_data[1]]), |
| 997 | .incr = unpackOptIndex(tree.extra.items[node_data[1] + 1]), | 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 | .goto_stmt => .{ | 1001 | .goto_stmt => .{ |
| ... | @@ -1006,7 +1006,7 @@ pub const Node = union(enum) { | ... | @@ -1006,7 +1006,7 @@ pub const Node = union(enum) { |
| 1006 | .computed_goto_stmt => .{ | 1006 | .computed_goto_stmt => .{ |
| 1007 | .computed_goto_stmt = .{ | 1007 | .computed_goto_stmt = .{ |
| 1008 | .goto_tok = node_tok, | 1008 | .goto_tok = node_tok, |
| 1009 | .expr = @enumFromInt(node_data[0]), | 1009 | .expr = @fromBackingInt(@intCast(node_data[0])), |
| 1010 | }, | 1010 | }, |
| 1011 | }, | 1011 | }, |
| 1012 | .continue_stmt => .{ | 1012 | .continue_stmt => .{ |
| ... | @@ -1030,7 +1030,7 @@ pub const Node = union(enum) { | ... | @@ -1030,7 +1030,7 @@ pub const Node = union(enum) { |
| 1030 | .return_tok = node_tok, | 1030 | .return_tok = node_tok, |
| 1031 | .return_qt = @bitCast(node_data[0]), | 1031 | .return_qt = @bitCast(node_data[0]), |
| 1032 | .operand = .{ | 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,7 +1082,7 @@ pub const Node = union(enum) { |
| 1082 | return .{ | 1082 | return .{ |
| 1083 | .asm_stmt = .{ | 1083 | .asm_stmt = .{ |
| 1084 | .asm_tok = node_tok, | 1084 | .asm_tok = node_tok, |
| 1085 | .asm_str = @enumFromInt(node_data[0]), | 1085 | .asm_str = @fromBackingInt(@intCast(node_data[0])), |
| 1086 | .outputs = @ptrCast(outputs), | 1086 | .outputs = @ptrCast(outputs), |
| 1087 | .inputs = @ptrCast(inputs), | 1087 | .inputs = @ptrCast(inputs), |
| 1088 | .clobbers = @ptrCast(clobbers), | 1088 | .clobbers = @ptrCast(clobbers), |
| ... | @@ -1094,7 +1094,7 @@ pub const Node = union(enum) { | ... | @@ -1094,7 +1094,7 @@ pub const Node = union(enum) { |
| 1094 | .asm_stmt_simple => .{ | 1094 | .asm_stmt_simple => .{ |
| 1095 | .asm_stmt = .{ | 1095 | .asm_stmt = .{ |
| 1096 | .asm_tok = node_tok, | 1096 | .asm_tok = node_tok, |
| 1097 | .asm_str = @enumFromInt(node_data[0]), | 1097 | .asm_str = @fromBackingInt(@intCast(node_data[0])), |
| 1098 | .outputs = &.{}, | 1098 | .outputs = &.{}, |
| 1099 | .inputs = &.{}, | 1099 | .inputs = &.{}, |
| 1100 | .clobbers = &.{}, | 1100 | .clobbers = &.{}, |
| ... | @@ -1106,255 +1106,255 @@ pub const Node = union(enum) { | ... | @@ -1106,255 +1106,255 @@ pub const Node = union(enum) { |
| 1106 | .assign_expr = .{ | 1106 | .assign_expr = .{ |
| 1107 | .op_tok = node_tok, | 1107 | .op_tok = node_tok, |
| 1108 | .qt = @bitCast(node_data[0]), | 1108 | .qt = @bitCast(node_data[0]), |
| 1109 | .lhs = @enumFromInt(node_data[1]), | 1109 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1110 | .rhs = @enumFromInt(node_data[2]), | 1110 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1111 | }, | 1111 | }, |
| 1112 | }, | 1112 | }, |
| 1113 | .mul_assign_expr => .{ | 1113 | .mul_assign_expr => .{ |
| 1114 | .mul_assign_expr = .{ | 1114 | .mul_assign_expr = .{ |
| 1115 | .op_tok = node_tok, | 1115 | .op_tok = node_tok, |
| 1116 | .qt = @bitCast(node_data[0]), | 1116 | .qt = @bitCast(node_data[0]), |
| 1117 | .lhs = @enumFromInt(node_data[1]), | 1117 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1118 | .rhs = @enumFromInt(node_data[2]), | 1118 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1119 | }, | 1119 | }, |
| 1120 | }, | 1120 | }, |
| 1121 | .div_assign_expr => .{ | 1121 | .div_assign_expr => .{ |
| 1122 | .div_assign_expr = .{ | 1122 | .div_assign_expr = .{ |
| 1123 | .op_tok = node_tok, | 1123 | .op_tok = node_tok, |
| 1124 | .qt = @bitCast(node_data[0]), | 1124 | .qt = @bitCast(node_data[0]), |
| 1125 | .lhs = @enumFromInt(node_data[1]), | 1125 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1126 | .rhs = @enumFromInt(node_data[2]), | 1126 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1127 | }, | 1127 | }, |
| 1128 | }, | 1128 | }, |
| 1129 | .mod_assign_expr => .{ | 1129 | .mod_assign_expr => .{ |
| 1130 | .mod_assign_expr = .{ | 1130 | .mod_assign_expr = .{ |
| 1131 | .op_tok = node_tok, | 1131 | .op_tok = node_tok, |
| 1132 | .qt = @bitCast(node_data[0]), | 1132 | .qt = @bitCast(node_data[0]), |
| 1133 | .lhs = @enumFromInt(node_data[1]), | 1133 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1134 | .rhs = @enumFromInt(node_data[2]), | 1134 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1135 | }, | 1135 | }, |
| 1136 | }, | 1136 | }, |
| 1137 | .add_assign_expr => .{ | 1137 | .add_assign_expr => .{ |
| 1138 | .add_assign_expr = .{ | 1138 | .add_assign_expr = .{ |
| 1139 | .op_tok = node_tok, | 1139 | .op_tok = node_tok, |
| 1140 | .qt = @bitCast(node_data[0]), | 1140 | .qt = @bitCast(node_data[0]), |
| 1141 | .lhs = @enumFromInt(node_data[1]), | 1141 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1142 | .rhs = @enumFromInt(node_data[2]), | 1142 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1143 | }, | 1143 | }, |
| 1144 | }, | 1144 | }, |
| 1145 | .sub_assign_expr => .{ | 1145 | .sub_assign_expr => .{ |
| 1146 | .sub_assign_expr = .{ | 1146 | .sub_assign_expr = .{ |
| 1147 | .op_tok = node_tok, | 1147 | .op_tok = node_tok, |
| 1148 | .qt = @bitCast(node_data[0]), | 1148 | .qt = @bitCast(node_data[0]), |
| 1149 | .lhs = @enumFromInt(node_data[1]), | 1149 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1150 | .rhs = @enumFromInt(node_data[2]), | 1150 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1151 | }, | 1151 | }, |
| 1152 | }, | 1152 | }, |
| 1153 | .shl_assign_expr => .{ | 1153 | .shl_assign_expr => .{ |
| 1154 | .shl_assign_expr = .{ | 1154 | .shl_assign_expr = .{ |
| 1155 | .op_tok = node_tok, | 1155 | .op_tok = node_tok, |
| 1156 | .qt = @bitCast(node_data[0]), | 1156 | .qt = @bitCast(node_data[0]), |
| 1157 | .lhs = @enumFromInt(node_data[1]), | 1157 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1158 | .rhs = @enumFromInt(node_data[2]), | 1158 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1159 | }, | 1159 | }, |
| 1160 | }, | 1160 | }, |
| 1161 | .shr_assign_expr => .{ | 1161 | .shr_assign_expr => .{ |
| 1162 | .shr_assign_expr = .{ | 1162 | .shr_assign_expr = .{ |
| 1163 | .op_tok = node_tok, | 1163 | .op_tok = node_tok, |
| 1164 | .qt = @bitCast(node_data[0]), | 1164 | .qt = @bitCast(node_data[0]), |
| 1165 | .lhs = @enumFromInt(node_data[1]), | 1165 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1166 | .rhs = @enumFromInt(node_data[2]), | 1166 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1167 | }, | 1167 | }, |
| 1168 | }, | 1168 | }, |
| 1169 | .bit_and_assign_expr => .{ | 1169 | .bit_and_assign_expr => .{ |
| 1170 | .bit_and_assign_expr = .{ | 1170 | .bit_and_assign_expr = .{ |
| 1171 | .op_tok = node_tok, | 1171 | .op_tok = node_tok, |
| 1172 | .qt = @bitCast(node_data[0]), | 1172 | .qt = @bitCast(node_data[0]), |
| 1173 | .lhs = @enumFromInt(node_data[1]), | 1173 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1174 | .rhs = @enumFromInt(node_data[2]), | 1174 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1175 | }, | 1175 | }, |
| 1176 | }, | 1176 | }, |
| 1177 | .bit_xor_assign_expr => .{ | 1177 | .bit_xor_assign_expr => .{ |
| 1178 | .bit_xor_assign_expr = .{ | 1178 | .bit_xor_assign_expr = .{ |
| 1179 | .op_tok = node_tok, | 1179 | .op_tok = node_tok, |
| 1180 | .qt = @bitCast(node_data[0]), | 1180 | .qt = @bitCast(node_data[0]), |
| 1181 | .lhs = @enumFromInt(node_data[1]), | 1181 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1182 | .rhs = @enumFromInt(node_data[2]), | 1182 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1183 | }, | 1183 | }, |
| 1184 | }, | 1184 | }, |
| 1185 | .bit_or_assign_expr => .{ | 1185 | .bit_or_assign_expr => .{ |
| 1186 | .bit_or_assign_expr = .{ | 1186 | .bit_or_assign_expr = .{ |
| 1187 | .op_tok = node_tok, | 1187 | .op_tok = node_tok, |
| 1188 | .qt = @bitCast(node_data[0]), | 1188 | .qt = @bitCast(node_data[0]), |
| 1189 | .lhs = @enumFromInt(node_data[1]), | 1189 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1190 | .rhs = @enumFromInt(node_data[2]), | 1190 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1191 | }, | 1191 | }, |
| 1192 | }, | 1192 | }, |
| 1193 | .compound_assign_dummy_expr => .{ | 1193 | .compound_assign_dummy_expr => .{ |
| 1194 | .compound_assign_dummy_expr = .{ | 1194 | .compound_assign_dummy_expr = .{ |
| 1195 | .op_tok = node_tok, | 1195 | .op_tok = node_tok, |
| 1196 | .qt = @bitCast(node_data[0]), | 1196 | .qt = @bitCast(node_data[0]), |
| 1197 | .operand = @enumFromInt(node_data[1]), | 1197 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1198 | }, | 1198 | }, |
| 1199 | }, | 1199 | }, |
| 1200 | .comma_expr => .{ | 1200 | .comma_expr => .{ |
| 1201 | .comma_expr = .{ | 1201 | .comma_expr = .{ |
| 1202 | .op_tok = node_tok, | 1202 | .op_tok = node_tok, |
| 1203 | .qt = @bitCast(node_data[0]), | 1203 | .qt = @bitCast(node_data[0]), |
| 1204 | .lhs = @enumFromInt(node_data[1]), | 1204 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1205 | .rhs = @enumFromInt(node_data[2]), | 1205 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1206 | }, | 1206 | }, |
| 1207 | }, | 1207 | }, |
| 1208 | .bool_or_expr => .{ | 1208 | .bool_or_expr => .{ |
| 1209 | .bool_or_expr = .{ | 1209 | .bool_or_expr = .{ |
| 1210 | .op_tok = node_tok, | 1210 | .op_tok = node_tok, |
| 1211 | .qt = @bitCast(node_data[0]), | 1211 | .qt = @bitCast(node_data[0]), |
| 1212 | .lhs = @enumFromInt(node_data[1]), | 1212 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1213 | .rhs = @enumFromInt(node_data[2]), | 1213 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1214 | }, | 1214 | }, |
| 1215 | }, | 1215 | }, |
| 1216 | .bool_and_expr => .{ | 1216 | .bool_and_expr => .{ |
| 1217 | .bool_and_expr = .{ | 1217 | .bool_and_expr = .{ |
| 1218 | .op_tok = node_tok, | 1218 | .op_tok = node_tok, |
| 1219 | .qt = @bitCast(node_data[0]), | 1219 | .qt = @bitCast(node_data[0]), |
| 1220 | .lhs = @enumFromInt(node_data[1]), | 1220 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1221 | .rhs = @enumFromInt(node_data[2]), | 1221 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1222 | }, | 1222 | }, |
| 1223 | }, | 1223 | }, |
| 1224 | .bit_or_expr => .{ | 1224 | .bit_or_expr => .{ |
| 1225 | .bit_or_expr = .{ | 1225 | .bit_or_expr = .{ |
| 1226 | .op_tok = node_tok, | 1226 | .op_tok = node_tok, |
| 1227 | .qt = @bitCast(node_data[0]), | 1227 | .qt = @bitCast(node_data[0]), |
| 1228 | .lhs = @enumFromInt(node_data[1]), | 1228 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1229 | .rhs = @enumFromInt(node_data[2]), | 1229 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1230 | }, | 1230 | }, |
| 1231 | }, | 1231 | }, |
| 1232 | .bit_xor_expr => .{ | 1232 | .bit_xor_expr => .{ |
| 1233 | .bit_xor_expr = .{ | 1233 | .bit_xor_expr = .{ |
| 1234 | .op_tok = node_tok, | 1234 | .op_tok = node_tok, |
| 1235 | .qt = @bitCast(node_data[0]), | 1235 | .qt = @bitCast(node_data[0]), |
| 1236 | .lhs = @enumFromInt(node_data[1]), | 1236 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1237 | .rhs = @enumFromInt(node_data[2]), | 1237 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1238 | }, | 1238 | }, |
| 1239 | }, | 1239 | }, |
| 1240 | .bit_and_expr => .{ | 1240 | .bit_and_expr => .{ |
| 1241 | .bit_and_expr = .{ | 1241 | .bit_and_expr = .{ |
| 1242 | .op_tok = node_tok, | 1242 | .op_tok = node_tok, |
| 1243 | .qt = @bitCast(node_data[0]), | 1243 | .qt = @bitCast(node_data[0]), |
| 1244 | .lhs = @enumFromInt(node_data[1]), | 1244 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1245 | .rhs = @enumFromInt(node_data[2]), | 1245 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1246 | }, | 1246 | }, |
| 1247 | }, | 1247 | }, |
| 1248 | .equal_expr => .{ | 1248 | .equal_expr => .{ |
| 1249 | .equal_expr = .{ | 1249 | .equal_expr = .{ |
| 1250 | .op_tok = node_tok, | 1250 | .op_tok = node_tok, |
| 1251 | .qt = @bitCast(node_data[0]), | 1251 | .qt = @bitCast(node_data[0]), |
| 1252 | .lhs = @enumFromInt(node_data[1]), | 1252 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1253 | .rhs = @enumFromInt(node_data[2]), | 1253 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1254 | }, | 1254 | }, |
| 1255 | }, | 1255 | }, |
| 1256 | .not_equal_expr => .{ | 1256 | .not_equal_expr => .{ |
| 1257 | .not_equal_expr = .{ | 1257 | .not_equal_expr = .{ |
| 1258 | .op_tok = node_tok, | 1258 | .op_tok = node_tok, |
| 1259 | .qt = @bitCast(node_data[0]), | 1259 | .qt = @bitCast(node_data[0]), |
| 1260 | .lhs = @enumFromInt(node_data[1]), | 1260 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1261 | .rhs = @enumFromInt(node_data[2]), | 1261 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1262 | }, | 1262 | }, |
| 1263 | }, | 1263 | }, |
| 1264 | .less_than_expr => .{ | 1264 | .less_than_expr => .{ |
| 1265 | .less_than_expr = .{ | 1265 | .less_than_expr = .{ |
| 1266 | .op_tok = node_tok, | 1266 | .op_tok = node_tok, |
| 1267 | .qt = @bitCast(node_data[0]), | 1267 | .qt = @bitCast(node_data[0]), |
| 1268 | .lhs = @enumFromInt(node_data[1]), | 1268 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1269 | .rhs = @enumFromInt(node_data[2]), | 1269 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1270 | }, | 1270 | }, |
| 1271 | }, | 1271 | }, |
| 1272 | .less_than_equal_expr => .{ | 1272 | .less_than_equal_expr => .{ |
| 1273 | .less_than_equal_expr = .{ | 1273 | .less_than_equal_expr = .{ |
| 1274 | .op_tok = node_tok, | 1274 | .op_tok = node_tok, |
| 1275 | .qt = @bitCast(node_data[0]), | 1275 | .qt = @bitCast(node_data[0]), |
| 1276 | .lhs = @enumFromInt(node_data[1]), | 1276 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1277 | .rhs = @enumFromInt(node_data[2]), | 1277 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1278 | }, | 1278 | }, |
| 1279 | }, | 1279 | }, |
| 1280 | .greater_than_expr => .{ | 1280 | .greater_than_expr => .{ |
| 1281 | .greater_than_expr = .{ | 1281 | .greater_than_expr = .{ |
| 1282 | .op_tok = node_tok, | 1282 | .op_tok = node_tok, |
| 1283 | .qt = @bitCast(node_data[0]), | 1283 | .qt = @bitCast(node_data[0]), |
| 1284 | .lhs = @enumFromInt(node_data[1]), | 1284 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1285 | .rhs = @enumFromInt(node_data[2]), | 1285 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1286 | }, | 1286 | }, |
| 1287 | }, | 1287 | }, |
| 1288 | .greater_than_equal_expr => .{ | 1288 | .greater_than_equal_expr => .{ |
| 1289 | .greater_than_equal_expr = .{ | 1289 | .greater_than_equal_expr = .{ |
| 1290 | .op_tok = node_tok, | 1290 | .op_tok = node_tok, |
| 1291 | .qt = @bitCast(node_data[0]), | 1291 | .qt = @bitCast(node_data[0]), |
| 1292 | .lhs = @enumFromInt(node_data[1]), | 1292 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1293 | .rhs = @enumFromInt(node_data[2]), | 1293 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1294 | }, | 1294 | }, |
| 1295 | }, | 1295 | }, |
| 1296 | .shl_expr => .{ | 1296 | .shl_expr => .{ |
| 1297 | .shl_expr = .{ | 1297 | .shl_expr = .{ |
| 1298 | .op_tok = node_tok, | 1298 | .op_tok = node_tok, |
| 1299 | .qt = @bitCast(node_data[0]), | 1299 | .qt = @bitCast(node_data[0]), |
| 1300 | .lhs = @enumFromInt(node_data[1]), | 1300 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1301 | .rhs = @enumFromInt(node_data[2]), | 1301 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1302 | }, | 1302 | }, |
| 1303 | }, | 1303 | }, |
| 1304 | .shr_expr => .{ | 1304 | .shr_expr => .{ |
| 1305 | .shr_expr = .{ | 1305 | .shr_expr = .{ |
| 1306 | .op_tok = node_tok, | 1306 | .op_tok = node_tok, |
| 1307 | .qt = @bitCast(node_data[0]), | 1307 | .qt = @bitCast(node_data[0]), |
| 1308 | .lhs = @enumFromInt(node_data[1]), | 1308 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1309 | .rhs = @enumFromInt(node_data[2]), | 1309 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1310 | }, | 1310 | }, |
| 1311 | }, | 1311 | }, |
| 1312 | .add_expr => .{ | 1312 | .add_expr => .{ |
| 1313 | .add_expr = .{ | 1313 | .add_expr = .{ |
| 1314 | .op_tok = node_tok, | 1314 | .op_tok = node_tok, |
| 1315 | .qt = @bitCast(node_data[0]), | 1315 | .qt = @bitCast(node_data[0]), |
| 1316 | .lhs = @enumFromInt(node_data[1]), | 1316 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1317 | .rhs = @enumFromInt(node_data[2]), | 1317 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1318 | }, | 1318 | }, |
| 1319 | }, | 1319 | }, |
| 1320 | .sub_expr => .{ | 1320 | .sub_expr => .{ |
| 1321 | .sub_expr = .{ | 1321 | .sub_expr = .{ |
| 1322 | .op_tok = node_tok, | 1322 | .op_tok = node_tok, |
| 1323 | .qt = @bitCast(node_data[0]), | 1323 | .qt = @bitCast(node_data[0]), |
| 1324 | .lhs = @enumFromInt(node_data[1]), | 1324 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1325 | .rhs = @enumFromInt(node_data[2]), | 1325 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1326 | }, | 1326 | }, |
| 1327 | }, | 1327 | }, |
| 1328 | .mul_expr => .{ | 1328 | .mul_expr => .{ |
| 1329 | .mul_expr = .{ | 1329 | .mul_expr = .{ |
| 1330 | .op_tok = node_tok, | 1330 | .op_tok = node_tok, |
| 1331 | .qt = @bitCast(node_data[0]), | 1331 | .qt = @bitCast(node_data[0]), |
| 1332 | .lhs = @enumFromInt(node_data[1]), | 1332 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1333 | .rhs = @enumFromInt(node_data[2]), | 1333 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1334 | }, | 1334 | }, |
| 1335 | }, | 1335 | }, |
| 1336 | .div_expr => .{ | 1336 | .div_expr => .{ |
| 1337 | .div_expr = .{ | 1337 | .div_expr = .{ |
| 1338 | .op_tok = node_tok, | 1338 | .op_tok = node_tok, |
| 1339 | .qt = @bitCast(node_data[0]), | 1339 | .qt = @bitCast(node_data[0]), |
| 1340 | .lhs = @enumFromInt(node_data[1]), | 1340 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1341 | .rhs = @enumFromInt(node_data[2]), | 1341 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1342 | }, | 1342 | }, |
| 1343 | }, | 1343 | }, |
| 1344 | .mod_expr => .{ | 1344 | .mod_expr => .{ |
| 1345 | .mod_expr = .{ | 1345 | .mod_expr = .{ |
| 1346 | .op_tok = node_tok, | 1346 | .op_tok = node_tok, |
| 1347 | .qt = @bitCast(node_data[0]), | 1347 | .qt = @bitCast(node_data[0]), |
| 1348 | .lhs = @enumFromInt(node_data[1]), | 1348 | .lhs = @fromBackingInt(@intCast(node_data[1])), |
| 1349 | .rhs = @enumFromInt(node_data[2]), | 1349 | .rhs = @fromBackingInt(@intCast(node_data[2])), |
| 1350 | }, | 1350 | }, |
| 1351 | }, | 1351 | }, |
| 1352 | .explicit_cast => .{ | 1352 | .explicit_cast => .{ |
| 1353 | .cast = .{ | 1353 | .cast = .{ |
| 1354 | .l_paren = node_tok, | 1354 | .l_paren = node_tok, |
| 1355 | .qt = @bitCast(node_data[0]), | 1355 | .qt = @bitCast(node_data[0]), |
| 1356 | .kind = @enumFromInt(node_data[1]), | 1356 | .kind = @fromBackingInt(@intCast(node_data[1])), |
| 1357 | .operand = @enumFromInt(node_data[2]), | 1357 | .operand = @fromBackingInt(@intCast(node_data[2])), |
| 1358 | .implicit = false, | 1358 | .implicit = false, |
| 1359 | }, | 1359 | }, |
| 1360 | }, | 1360 | }, |
| ... | @@ -1362,8 +1362,8 @@ pub const Node = union(enum) { | ... | @@ -1362,8 +1362,8 @@ pub const Node = union(enum) { |
| 1362 | .cast = .{ | 1362 | .cast = .{ |
| 1363 | .l_paren = node_tok, | 1363 | .l_paren = node_tok, |
| 1364 | .qt = @bitCast(node_data[0]), | 1364 | .qt = @bitCast(node_data[0]), |
| 1365 | .kind = @enumFromInt(node_data[1]), | 1365 | .kind = @fromBackingInt(@intCast(node_data[1])), |
| 1366 | .operand = @enumFromInt(node_data[2]), | 1366 | .operand = @fromBackingInt(@intCast(node_data[2])), |
| 1367 | .implicit = true, | 1367 | .implicit = true, |
| 1368 | }, | 1368 | }, |
| 1369 | }, | 1369 | }, |
| ... | @@ -1371,105 +1371,105 @@ pub const Node = union(enum) { | ... | @@ -1371,105 +1371,105 @@ pub const Node = union(enum) { |
| 1371 | .addr_of_expr = .{ | 1371 | .addr_of_expr = .{ |
| 1372 | .op_tok = node_tok, | 1372 | .op_tok = node_tok, |
| 1373 | .qt = @bitCast(node_data[0]), | 1373 | .qt = @bitCast(node_data[0]), |
| 1374 | .operand = @enumFromInt(node_data[1]), | 1374 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1375 | }, | 1375 | }, |
| 1376 | }, | 1376 | }, |
| 1377 | .deref_expr => .{ | 1377 | .deref_expr => .{ |
| 1378 | .deref_expr = .{ | 1378 | .deref_expr = .{ |
| 1379 | .op_tok = node_tok, | 1379 | .op_tok = node_tok, |
| 1380 | .qt = @bitCast(node_data[0]), | 1380 | .qt = @bitCast(node_data[0]), |
| 1381 | .operand = @enumFromInt(node_data[1]), | 1381 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1382 | }, | 1382 | }, |
| 1383 | }, | 1383 | }, |
| 1384 | .plus_expr => .{ | 1384 | .plus_expr => .{ |
| 1385 | .plus_expr = .{ | 1385 | .plus_expr = .{ |
| 1386 | .op_tok = node_tok, | 1386 | .op_tok = node_tok, |
| 1387 | .qt = @bitCast(node_data[0]), | 1387 | .qt = @bitCast(node_data[0]), |
| 1388 | .operand = @enumFromInt(node_data[1]), | 1388 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1389 | }, | 1389 | }, |
| 1390 | }, | 1390 | }, |
| 1391 | .negate_expr => .{ | 1391 | .negate_expr => .{ |
| 1392 | .negate_expr = .{ | 1392 | .negate_expr = .{ |
| 1393 | .op_tok = node_tok, | 1393 | .op_tok = node_tok, |
| 1394 | .qt = @bitCast(node_data[0]), | 1394 | .qt = @bitCast(node_data[0]), |
| 1395 | .operand = @enumFromInt(node_data[1]), | 1395 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1396 | }, | 1396 | }, |
| 1397 | }, | 1397 | }, |
| 1398 | .bit_not_expr => .{ | 1398 | .bit_not_expr => .{ |
| 1399 | .bit_not_expr = .{ | 1399 | .bit_not_expr = .{ |
| 1400 | .op_tok = node_tok, | 1400 | .op_tok = node_tok, |
| 1401 | .qt = @bitCast(node_data[0]), | 1401 | .qt = @bitCast(node_data[0]), |
| 1402 | .operand = @enumFromInt(node_data[1]), | 1402 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1403 | }, | 1403 | }, |
| 1404 | }, | 1404 | }, |
| 1405 | .bool_not_expr => .{ | 1405 | .bool_not_expr => .{ |
| 1406 | .bool_not_expr = .{ | 1406 | .bool_not_expr = .{ |
| 1407 | .op_tok = node_tok, | 1407 | .op_tok = node_tok, |
| 1408 | .qt = @bitCast(node_data[0]), | 1408 | .qt = @bitCast(node_data[0]), |
| 1409 | .operand = @enumFromInt(node_data[1]), | 1409 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1410 | }, | 1410 | }, |
| 1411 | }, | 1411 | }, |
| 1412 | .pre_inc_expr => .{ | 1412 | .pre_inc_expr => .{ |
| 1413 | .pre_inc_expr = .{ | 1413 | .pre_inc_expr = .{ |
| 1414 | .op_tok = node_tok, | 1414 | .op_tok = node_tok, |
| 1415 | .qt = @bitCast(node_data[0]), | 1415 | .qt = @bitCast(node_data[0]), |
| 1416 | .operand = @enumFromInt(node_data[1]), | 1416 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1417 | }, | 1417 | }, |
| 1418 | }, | 1418 | }, |
| 1419 | .pre_dec_expr => .{ | 1419 | .pre_dec_expr => .{ |
| 1420 | .pre_dec_expr = .{ | 1420 | .pre_dec_expr = .{ |
| 1421 | .op_tok = node_tok, | 1421 | .op_tok = node_tok, |
| 1422 | .qt = @bitCast(node_data[0]), | 1422 | .qt = @bitCast(node_data[0]), |
| 1423 | .operand = @enumFromInt(node_data[1]), | 1423 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1424 | }, | 1424 | }, |
| 1425 | }, | 1425 | }, |
| 1426 | .imag_expr => .{ | 1426 | .imag_expr => .{ |
| 1427 | .imag_expr = .{ | 1427 | .imag_expr = .{ |
| 1428 | .op_tok = node_tok, | 1428 | .op_tok = node_tok, |
| 1429 | .qt = @bitCast(node_data[0]), | 1429 | .qt = @bitCast(node_data[0]), |
| 1430 | .operand = @enumFromInt(node_data[1]), | 1430 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1431 | }, | 1431 | }, |
| 1432 | }, | 1432 | }, |
| 1433 | .real_expr => .{ | 1433 | .real_expr => .{ |
| 1434 | .real_expr = .{ | 1434 | .real_expr = .{ |
| 1435 | .op_tok = node_tok, | 1435 | .op_tok = node_tok, |
| 1436 | .qt = @bitCast(node_data[0]), | 1436 | .qt = @bitCast(node_data[0]), |
| 1437 | .operand = @enumFromInt(node_data[1]), | 1437 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1438 | }, | 1438 | }, |
| 1439 | }, | 1439 | }, |
| 1440 | .post_inc_expr => .{ | 1440 | .post_inc_expr => .{ |
| 1441 | .post_inc_expr = .{ | 1441 | .post_inc_expr = .{ |
| 1442 | .op_tok = node_tok, | 1442 | .op_tok = node_tok, |
| 1443 | .qt = @bitCast(node_data[0]), | 1443 | .qt = @bitCast(node_data[0]), |
| 1444 | .operand = @enumFromInt(node_data[1]), | 1444 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1445 | }, | 1445 | }, |
| 1446 | }, | 1446 | }, |
| 1447 | .post_dec_expr => .{ | 1447 | .post_dec_expr => .{ |
| 1448 | .post_dec_expr = .{ | 1448 | .post_dec_expr = .{ |
| 1449 | .op_tok = node_tok, | 1449 | .op_tok = node_tok, |
| 1450 | .qt = @bitCast(node_data[0]), | 1450 | .qt = @bitCast(node_data[0]), |
| 1451 | .operand = @enumFromInt(node_data[1]), | 1451 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1452 | }, | 1452 | }, |
| 1453 | }, | 1453 | }, |
| 1454 | .paren_expr => .{ | 1454 | .paren_expr => .{ |
| 1455 | .paren_expr = .{ | 1455 | .paren_expr = .{ |
| 1456 | .op_tok = node_tok, | 1456 | .op_tok = node_tok, |
| 1457 | .qt = @bitCast(node_data[0]), | 1457 | .qt = @bitCast(node_data[0]), |
| 1458 | .operand = @enumFromInt(node_data[1]), | 1458 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1459 | }, | 1459 | }, |
| 1460 | }, | 1460 | }, |
| 1461 | .stmt_expr => .{ | 1461 | .stmt_expr => .{ |
| 1462 | .stmt_expr = .{ | 1462 | .stmt_expr = .{ |
| 1463 | .op_tok = node_tok, | 1463 | .op_tok = node_tok, |
| 1464 | .qt = @bitCast(node_data[0]), | 1464 | .qt = @bitCast(node_data[0]), |
| 1465 | .operand = @enumFromInt(node_data[1]), | 1465 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1466 | }, | 1466 | }, |
| 1467 | }, | 1467 | }, |
| 1468 | .cond_dummy_expr => .{ | 1468 | .cond_dummy_expr => .{ |
| 1469 | .cond_dummy_expr = .{ | 1469 | .cond_dummy_expr = .{ |
| 1470 | .op_tok = node_tok, | 1470 | .op_tok = node_tok, |
| 1471 | .qt = @bitCast(node_data[0]), | 1471 | .qt = @bitCast(node_data[0]), |
| 1472 | .operand = @enumFromInt(node_data[1]), | 1472 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1473 | }, | 1473 | }, |
| 1474 | }, | 1474 | }, |
| 1475 | .addr_of_label => .{ | 1475 | .addr_of_label => .{ |
| ... | @@ -1482,15 +1482,15 @@ pub const Node = union(enum) { | ... | @@ -1482,15 +1482,15 @@ pub const Node = union(enum) { |
| 1482 | .array_access_expr = .{ | 1482 | .array_access_expr = .{ |
| 1483 | .l_bracket_tok = node_tok, | 1483 | .l_bracket_tok = node_tok, |
| 1484 | .qt = @bitCast(node_data[0]), | 1484 | .qt = @bitCast(node_data[0]), |
| 1485 | .base = @enumFromInt(node_data[1]), | 1485 | .base = @fromBackingInt(@intCast(node_data[1])), |
| 1486 | .index = @enumFromInt(node_data[2]), | 1486 | .index = @fromBackingInt(@intCast(node_data[2])), |
| 1487 | }, | 1487 | }, |
| 1488 | }, | 1488 | }, |
| 1489 | .call_expr => .{ | 1489 | .call_expr => .{ |
| 1490 | .call_expr = .{ | 1490 | .call_expr = .{ |
| 1491 | .l_paren_tok = node_tok, | 1491 | .l_paren_tok = node_tok, |
| 1492 | .qt = @bitCast(node_data[0]), | 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 | .args = @ptrCast(tree.extra.items[node_data[1] + 1 ..][0 .. node_data[2] - 1]), | 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,7 +1498,7 @@ pub const Node = union(enum) { |
| 1498 | .call_expr = .{ | 1498 | .call_expr = .{ |
| 1499 | .l_paren_tok = node_tok, | 1499 | .l_paren_tok = node_tok, |
| 1500 | .qt = @bitCast(node_data[0]), | 1500 | .qt = @bitCast(node_data[0]), |
| 1501 | .callee = @enumFromInt(node_data[1]), | 1501 | .callee = @fromBackingInt(@intCast(node_data[1])), |
| 1502 | .args = unPackElems(node_data[2..]), | 1502 | .args = unPackElems(node_data[2..]), |
| 1503 | }, | 1503 | }, |
| 1504 | }, | 1504 | }, |
| ... | @@ -1520,7 +1520,7 @@ pub const Node = union(enum) { | ... | @@ -1520,7 +1520,7 @@ pub const Node = union(enum) { |
| 1520 | .member_access_expr = .{ | 1520 | .member_access_expr = .{ |
| 1521 | .access_tok = node_tok, | 1521 | .access_tok = node_tok, |
| 1522 | .qt = @bitCast(node_data[0]), | 1522 | .qt = @bitCast(node_data[0]), |
| 1523 | .base = @enumFromInt(node_data[1]), | 1523 | .base = @fromBackingInt(@intCast(node_data[1])), |
| 1524 | .member_index = node_data[2], | 1524 | .member_index = node_data[2], |
| 1525 | }, | 1525 | }, |
| 1526 | }, | 1526 | }, |
| ... | @@ -1528,7 +1528,7 @@ pub const Node = union(enum) { | ... | @@ -1528,7 +1528,7 @@ pub const Node = union(enum) { |
| 1528 | .member_access_ptr_expr = .{ | 1528 | .member_access_ptr_expr = .{ |
| 1529 | .access_tok = node_tok, | 1529 | .access_tok = node_tok, |
| 1530 | .qt = @bitCast(node_data[0]), | 1530 | .qt = @bitCast(node_data[0]), |
| 1531 | .base = @enumFromInt(node_data[1]), | 1531 | .base = @fromBackingInt(@intCast(node_data[1])), |
| 1532 | .member_index = node_data[2], | 1532 | .member_index = node_data[2], |
| 1533 | }, | 1533 | }, |
| 1534 | }, | 1534 | }, |
| ... | @@ -1536,14 +1536,14 @@ pub const Node = union(enum) { | ... | @@ -1536,14 +1536,14 @@ pub const Node = union(enum) { |
| 1536 | .decl_ref_expr = .{ | 1536 | .decl_ref_expr = .{ |
| 1537 | .name_tok = node_tok, | 1537 | .name_tok = node_tok, |
| 1538 | .qt = @bitCast(node_data[0]), | 1538 | .qt = @bitCast(node_data[0]), |
| 1539 | .decl = @enumFromInt(node_data[1]), | 1539 | .decl = @fromBackingInt(@intCast(node_data[1])), |
| 1540 | }, | 1540 | }, |
| 1541 | }, | 1541 | }, |
| 1542 | .enumeration_ref => .{ | 1542 | .enumeration_ref => .{ |
| 1543 | .enumeration_ref = .{ | 1543 | .enumeration_ref = .{ |
| 1544 | .name_tok = node_tok, | 1544 | .name_tok = node_tok, |
| 1545 | .qt = @bitCast(node_data[0]), | 1545 | .qt = @bitCast(node_data[0]), |
| 1546 | .decl = @enumFromInt(node_data[1]), | 1546 | .decl = @fromBackingInt(@intCast(node_data[1])), |
| 1547 | }, | 1547 | }, |
| 1548 | }, | 1548 | }, |
| 1549 | .builtin_ref => .{ | 1549 | .builtin_ref => .{ |
| ... | @@ -1574,7 +1574,7 @@ pub const Node = union(enum) { | ... | @@ -1574,7 +1574,7 @@ pub const Node = union(enum) { |
| 1574 | .char_literal = .{ | 1574 | .char_literal = .{ |
| 1575 | .literal_tok = node_tok, | 1575 | .literal_tok = node_tok, |
| 1576 | .qt = @bitCast(node_data[0]), | 1576 | .qt = @bitCast(node_data[0]), |
| 1577 | .kind = @enumFromInt(node_data[1]), | 1577 | .kind = @fromBackingInt(@intCast(node_data[1])), |
| 1578 | }, | 1578 | }, |
| 1579 | }, | 1579 | }, |
| 1580 | .float_literal => .{ | 1580 | .float_literal => .{ |
| ... | @@ -1587,14 +1587,14 @@ pub const Node = union(enum) { | ... | @@ -1587,14 +1587,14 @@ pub const Node = union(enum) { |
| 1587 | .string_literal_expr = .{ | 1587 | .string_literal_expr = .{ |
| 1588 | .literal_tok = node_tok, | 1588 | .literal_tok = node_tok, |
| 1589 | .qt = @bitCast(node_data[0]), | 1589 | .qt = @bitCast(node_data[0]), |
| 1590 | .kind = @enumFromInt(node_data[1]), | 1590 | .kind = @fromBackingInt(@intCast(node_data[1])), |
| 1591 | }, | 1591 | }, |
| 1592 | }, | 1592 | }, |
| 1593 | .imaginary_literal => .{ | 1593 | .imaginary_literal => .{ |
| 1594 | .imaginary_literal = .{ | 1594 | .imaginary_literal = .{ |
| 1595 | .op_tok = node_tok, | 1595 | .op_tok = node_tok, |
| 1596 | .qt = @bitCast(node_data[0]), | 1596 | .qt = @bitCast(node_data[0]), |
| 1597 | .operand = @enumFromInt(node_data[1]), | 1597 | .operand = @fromBackingInt(@intCast(node_data[1])), |
| 1598 | }, | 1598 | }, |
| 1599 | }, | 1599 | }, |
| 1600 | .sizeof_expr => .{ | 1600 | .sizeof_expr => .{ |
| ... | @@ -1618,8 +1618,8 @@ pub const Node = union(enum) { | ... | @@ -1618,8 +1618,8 @@ pub const Node = union(enum) { |
| 1618 | .generic_expr = .{ | 1618 | .generic_expr = .{ |
| 1619 | .generic_tok = node_tok, | 1619 | .generic_tok = node_tok, |
| 1620 | .qt = @bitCast(node_data[0]), | 1620 | .qt = @bitCast(node_data[0]), |
| 1621 | .controlling = @enumFromInt(node_data[1]), | 1621 | .controlling = @fromBackingInt(@intCast(node_data[1])), |
| 1622 | .chosen = @enumFromInt(node_data[2]), | 1622 | .chosen = @fromBackingInt(@intCast(node_data[2])), |
| 1623 | .rest = &.{}, | 1623 | .rest = &.{}, |
| 1624 | }, | 1624 | }, |
| 1625 | }, | 1625 | }, |
| ... | @@ -1627,8 +1627,8 @@ pub const Node = union(enum) { | ... | @@ -1627,8 +1627,8 @@ pub const Node = union(enum) { |
| 1627 | .generic_expr = .{ | 1627 | .generic_expr = .{ |
| 1628 | .generic_tok = node_tok, | 1628 | .generic_tok = node_tok, |
| 1629 | .qt = @bitCast(node_data[0]), | 1629 | .qt = @bitCast(node_data[0]), |
| 1630 | .controlling = @enumFromInt(tree.extra.items[node_data[1]]), | 1630 | .controlling = @fromBackingInt(@intCast(tree.extra.items[node_data[1]])), |
| 1631 | .chosen = @enumFromInt(tree.extra.items[node_data[1] + 1]), | 1631 | .chosen = @fromBackingInt(@intCast(tree.extra.items[node_data[1] + 1])), |
| 1632 | .rest = @ptrCast(tree.extra.items[node_data[1] + 2 ..][0 .. node_data[2] - 2]), | 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,40 +1636,40 @@ pub const Node = union(enum) { |
| 1636 | .generic_association_expr = .{ | 1636 | .generic_association_expr = .{ |
| 1637 | .colon_tok = node_tok, | 1637 | .colon_tok = node_tok, |
| 1638 | .association_qt = @bitCast(node_data[0]), | 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 | .generic_default_expr => .{ | 1642 | .generic_default_expr => .{ |
| 1643 | .generic_default_expr = .{ | 1643 | .generic_default_expr = .{ |
| 1644 | .default_tok = node_tok, | 1644 | .default_tok = node_tok, |
| 1645 | .expr = @enumFromInt(node_data[0]), | 1645 | .expr = @fromBackingInt(@intCast(node_data[0])), |
| 1646 | }, | 1646 | }, |
| 1647 | }, | 1647 | }, |
| 1648 | .binary_cond_expr => .{ | 1648 | .binary_cond_expr => .{ |
| 1649 | .binary_cond_expr = .{ | 1649 | .binary_cond_expr = .{ |
| 1650 | .cond_tok = node_tok, | 1650 | .cond_tok = node_tok, |
| 1651 | .qt = @bitCast(node_data[0]), | 1651 | .qt = @bitCast(node_data[0]), |
| 1652 | .cond = @enumFromInt(node_data[1]), | 1652 | .cond = @fromBackingInt(@intCast(node_data[1])), |
| 1653 | .then_expr = @enumFromInt(tree.extra.items[node_data[2]]), | 1653 | .then_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2]])), |
| 1654 | .else_expr = @enumFromInt(tree.extra.items[node_data[2] + 1]), | 1654 | .else_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2] + 1])), |
| 1655 | }, | 1655 | }, |
| 1656 | }, | 1656 | }, |
| 1657 | .cond_expr => .{ | 1657 | .cond_expr => .{ |
| 1658 | .cond_expr = .{ | 1658 | .cond_expr = .{ |
| 1659 | .cond_tok = node_tok, | 1659 | .cond_tok = node_tok, |
| 1660 | .qt = @bitCast(node_data[0]), | 1660 | .qt = @bitCast(node_data[0]), |
| 1661 | .cond = @enumFromInt(node_data[1]), | 1661 | .cond = @fromBackingInt(@intCast(node_data[1])), |
| 1662 | .then_expr = @enumFromInt(tree.extra.items[node_data[2]]), | 1662 | .then_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2]])), |
| 1663 | .else_expr = @enumFromInt(tree.extra.items[node_data[2] + 1]), | 1663 | .else_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2] + 1])), |
| 1664 | }, | 1664 | }, |
| 1665 | }, | 1665 | }, |
| 1666 | .builtin_choose_expr => .{ | 1666 | .builtin_choose_expr => .{ |
| 1667 | .builtin_choose_expr = .{ | 1667 | .builtin_choose_expr = .{ |
| 1668 | .cond_tok = node_tok, | 1668 | .cond_tok = node_tok, |
| 1669 | .qt = @bitCast(node_data[0]), | 1669 | .qt = @bitCast(node_data[0]), |
| 1670 | .cond = @enumFromInt(node_data[1]), | 1670 | .cond = @fromBackingInt(@intCast(node_data[1])), |
| 1671 | .then_expr = @enumFromInt(tree.extra.items[node_data[2]]), | 1671 | .then_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2]])), |
| 1672 | .else_expr = @enumFromInt(tree.extra.items[node_data[2] + 1]), | 1672 | .else_expr = @fromBackingInt(@intCast(tree.extra.items[node_data[2] + 1])), |
| 1673 | }, | 1673 | }, |
| 1674 | }, | 1674 | }, |
| 1675 | .builtin_types_compatible_p => .{ | 1675 | .builtin_types_compatible_p => .{ |
| ... | @@ -1683,15 +1683,15 @@ pub const Node = union(enum) { | ... | @@ -1683,15 +1683,15 @@ pub const Node = union(enum) { |
| 1683 | .builtin_convertvector = .{ | 1683 | .builtin_convertvector = .{ |
| 1684 | .builtin_tok = node_tok, | 1684 | .builtin_tok = node_tok, |
| 1685 | .dest_qt = @bitCast(node_data[0]), | 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 | .builtin_shufflevector => .{ | 1689 | .builtin_shufflevector => .{ |
| 1690 | .builtin_shufflevector = .{ | 1690 | .builtin_shufflevector = .{ |
| 1691 | .builtin_tok = node_tok, | 1691 | .builtin_tok = node_tok, |
| 1692 | .qt = @bitCast(node_data[0]), | 1692 | .qt = @bitCast(node_data[0]), |
| 1693 | .lhs = @enumFromInt(tree.extra.items[node_data[1]]), | 1693 | .lhs = @fromBackingInt(@intCast(tree.extra.items[node_data[1]])), |
| 1694 | .rhs = @enumFromInt(tree.extra.items[node_data[1] + 1]), | 1694 | .rhs = @fromBackingInt(@intCast(tree.extra.items[node_data[1] + 1])), |
| 1695 | .indexes = @ptrCast(tree.extra.items[node_data[1] + 2 ..][0..node_data[2]]), | 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,7 +1767,7 @@ pub const Node = union(enum) { |
| 1767 | else | 1767 | else |
| 1768 | .auto, | 1768 | .auto, |
| 1769 | .thread_local = attr.thread_local, | 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,7 +1775,7 @@ pub const Node = union(enum) { |
| 1775 | } | 1775 | } |
| 1776 | 1776 | ||
| 1777 | pub fn tok(index: Index, tree: *const Tree) TokenIndex { | 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 | pub fn loc(index: Index, tree: *const Tree) Source.Location { | 1781 | pub fn loc(index: Index, tree: *const Tree) Source.Location { |
| ... | @@ -1788,7 +1788,7 @@ pub const Node = union(enum) { | ... | @@ -1788,7 +1788,7 @@ pub const Node = union(enum) { |
| 1788 | } | 1788 | } |
| 1789 | 1789 | ||
| 1790 | pub fn qtOrNull(index: Index, tree: *const Tree) ?QualType { | 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 | .empty_decl, | 1792 | .empty_decl, |
| 1793 | .static_assert, | 1793 | .static_assert, |
| 1794 | .compound_stmt, | 1794 | .compound_stmt, |
| ... | @@ -1819,7 +1819,7 @@ pub const Node = union(enum) { | ... | @@ -1819,7 +1819,7 @@ pub const Node = union(enum) { |
| 1819 | .builtin_types_compatible_p => .int, | 1819 | .builtin_types_compatible_p => .int, |
| 1820 | else => { | 1820 | else => { |
| 1821 | // If a node is typed the type is stored in data[0]. | 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,15 +1830,15 @@ pub const Node = union(enum) { |
| 1830 | _, | 1830 | _, |
| 1831 | 1831 | ||
| 1832 | pub fn unpack(opt: OptIndex) ?Index { | 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 | pub fn pack(index: Index) OptIndex { | 1836 | pub fn pack(index: Index) OptIndex { |
| 1837 | return @enumFromInt(@intFromEnum(index)); | 1837 | return @fromBackingInt(@intCast(@backingInt(index))); |
| 1838 | } | 1838 | } |
| 1839 | 1839 | ||
| 1840 | pub fn packOpt(optional: ?Index) OptIndex { | 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,7 +2013,7 @@ pub const Node = union(enum) { |
| 2013 | pub fn addNode(tree: *Tree, node: Node) !Node.Index { | 2013 | pub fn addNode(tree: *Tree, node: Node) !Node.Index { |
| 2014 | const index = try tree.nodes.addOne(tree.comp.gpa); | 2014 | const index = try tree.nodes.addOne(tree.comp.gpa); |
| 2015 | try tree.setNode(node, index); | 2015 | try tree.setNode(node, index); |
| 2016 | return @enumFromInt(index); | 2016 | return @fromBackingInt(@intCast(index)); |
| 2017 | } | 2017 | } |
| 2018 | 2018 | ||
| 2019 | pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | 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,7 +2025,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2025 | }, | 2025 | }, |
| 2026 | .static_assert => |assert| { | 2026 | .static_assert => |assert| { |
| 2027 | repr.tag = .static_assert; | 2027 | repr.tag = .static_assert; |
| 2028 | repr.data[0] = @intFromEnum(assert.cond); | 2028 | repr.data[0] = @backingInt(assert.cond); |
| 2029 | repr.data[1] = packOptIndex(assert.message); | 2029 | repr.data[1] = packOptIndex(assert.message); |
| 2030 | repr.tok = assert.assert_tok; | 2030 | repr.tok = assert.assert_tok; |
| 2031 | }, | 2031 | }, |
| ... | @@ -2037,7 +2037,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2037,7 +2037,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2037 | .@"inline" = function.@"inline", | 2037 | .@"inline" = function.@"inline", |
| 2038 | }); | 2038 | }); |
| 2039 | if (function.body) |some| { | 2039 | if (function.body) |some| { |
| 2040 | repr.data[2] = @intFromEnum(some); | 2040 | repr.data[2] = @backingInt(some); |
| 2041 | } else { | 2041 | } else { |
| 2042 | repr.data[2] = packOptIndex(function.definition); | 2042 | repr.data[2] = packOptIndex(function.definition); |
| 2043 | } | 2043 | } |
| ... | @@ -2062,7 +2062,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2062,7 +2062,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2062 | .register = variable.storage_class == .register, | 2062 | .register = variable.storage_class == .register, |
| 2063 | }); | 2063 | }); |
| 2064 | if (variable.initializer) |some| { | 2064 | if (variable.initializer) |some| { |
| 2065 | repr.data[2] = @intFromEnum(some); | 2065 | repr.data[2] = @backingInt(some); |
| 2066 | } else { | 2066 | } else { |
| 2067 | repr.data[2] = packOptIndex(variable.definition); | 2067 | repr.data[2] = packOptIndex(variable.definition); |
| 2068 | } | 2068 | } |
| ... | @@ -2076,7 +2076,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2076,7 +2076,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2076 | }, | 2076 | }, |
| 2077 | .global_asm => |global_asm| { | 2077 | .global_asm => |global_asm| { |
| 2078 | repr.tag = .global_asm; | 2078 | repr.tag = .global_asm; |
| 2079 | repr.data[0] = @intFromEnum(global_asm.asm_str); | 2079 | repr.data[0] = @backingInt(global_asm.asm_str); |
| 2080 | repr.tok = global_asm.asm_tok; | 2080 | repr.tok = global_asm.asm_tok; |
| 2081 | }, | 2081 | }, |
| 2082 | .struct_decl => |decl| { | 2082 | .struct_decl => |decl| { |
| ... | @@ -2151,7 +2151,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2151,7 +2151,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2151 | .labeled_stmt => |labeled| { | 2151 | .labeled_stmt => |labeled| { |
| 2152 | repr.tag = .labeled_stmt; | 2152 | repr.tag = .labeled_stmt; |
| 2153 | repr.data[0] = @bitCast(labeled.qt); | 2153 | repr.data[0] = @bitCast(labeled.qt); |
| 2154 | repr.data[1] = @intFromEnum(labeled.body); | 2154 | repr.data[1] = @backingInt(labeled.body); |
| 2155 | repr.tok = labeled.label_tok; | 2155 | repr.tok = labeled.label_tok; |
| 2156 | }, | 2156 | }, |
| 2157 | .compound_stmt => |compound| { | 2157 | .compound_stmt => |compound| { |
| ... | @@ -2167,39 +2167,39 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2167,39 +2167,39 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2167 | }, | 2167 | }, |
| 2168 | .if_stmt => |@"if"| { | 2168 | .if_stmt => |@"if"| { |
| 2169 | repr.tag = .if_stmt; | 2169 | repr.tag = .if_stmt; |
| 2170 | repr.data[0] = @intFromEnum(@"if".cond); | 2170 | repr.data[0] = @backingInt(@"if".cond); |
| 2171 | repr.data[1] = @intFromEnum(@"if".then_body); | 2171 | repr.data[1] = @backingInt(@"if".then_body); |
| 2172 | repr.data[2] = packOptIndex(@"if".else_body); | 2172 | repr.data[2] = packOptIndex(@"if".else_body); |
| 2173 | repr.tok = @"if".if_tok; | 2173 | repr.tok = @"if".if_tok; |
| 2174 | }, | 2174 | }, |
| 2175 | .switch_stmt => |@"switch"| { | 2175 | .switch_stmt => |@"switch"| { |
| 2176 | repr.tag = .switch_stmt; | 2176 | repr.tag = .switch_stmt; |
| 2177 | repr.data[0] = @intFromEnum(@"switch".cond); | 2177 | repr.data[0] = @backingInt(@"switch".cond); |
| 2178 | repr.data[1] = @intFromEnum(@"switch".body); | 2178 | repr.data[1] = @backingInt(@"switch".body); |
| 2179 | repr.tok = @"switch".switch_tok; | 2179 | repr.tok = @"switch".switch_tok; |
| 2180 | }, | 2180 | }, |
| 2181 | .case_stmt => |case| { | 2181 | .case_stmt => |case| { |
| 2182 | repr.tag = .case_stmt; | 2182 | repr.tag = .case_stmt; |
| 2183 | repr.data[0] = @intFromEnum(case.start); | 2183 | repr.data[0] = @backingInt(case.start); |
| 2184 | repr.data[1] = packOptIndex(case.end); | 2184 | repr.data[1] = packOptIndex(case.end); |
| 2185 | repr.data[2] = packOptIndex(case.body); | 2185 | repr.data[2] = packOptIndex(case.body); |
| 2186 | repr.tok = case.case_tok; | 2186 | repr.tok = case.case_tok; |
| 2187 | }, | 2187 | }, |
| 2188 | .default_stmt => |default| { | 2188 | .default_stmt => |default| { |
| 2189 | repr.tag = .default_stmt; | 2189 | repr.tag = .default_stmt; |
| 2190 | repr.data[0] = @intFromEnum(default.body); | 2190 | repr.data[0] = @backingInt(default.body); |
| 2191 | repr.tok = default.default_tok; | 2191 | repr.tok = default.default_tok; |
| 2192 | }, | 2192 | }, |
| 2193 | .while_stmt => |@"while"| { | 2193 | .while_stmt => |@"while"| { |
| 2194 | repr.tag = .while_stmt; | 2194 | repr.tag = .while_stmt; |
| 2195 | repr.data[0] = @intFromEnum(@"while".cond); | 2195 | repr.data[0] = @backingInt(@"while".cond); |
| 2196 | repr.data[1] = @intFromEnum(@"while".body); | 2196 | repr.data[1] = @backingInt(@"while".body); |
| 2197 | repr.tok = @"while".while_tok; | 2197 | repr.tok = @"while".while_tok; |
| 2198 | }, | 2198 | }, |
| 2199 | .do_while_stmt => |do_while| { | 2199 | .do_while_stmt => |do_while| { |
| 2200 | repr.tag = .do_while_stmt; | 2200 | repr.tag = .do_while_stmt; |
| 2201 | repr.data[0] = @intFromEnum(do_while.cond); | 2201 | repr.data[0] = @backingInt(do_while.cond); |
| 2202 | repr.data[1] = @intFromEnum(do_while.body); | 2202 | repr.data[1] = @backingInt(do_while.body); |
| 2203 | repr.tok = do_while.do_tok; | 2203 | repr.tok = do_while.do_tok; |
| 2204 | }, | 2204 | }, |
| 2205 | .for_stmt => |@"for"| { | 2205 | .for_stmt => |@"for"| { |
| ... | @@ -2223,7 +2223,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2223,7 +2223,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2223 | tree.extra.appendAssumeCapacity(packOptIndex(@"for".incr)); | 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 | repr.tok = @"for".for_tok; | 2227 | repr.tok = @"for".for_tok; |
| 2228 | }, | 2228 | }, |
| 2229 | .goto_stmt => |goto| { | 2229 | .goto_stmt => |goto| { |
| ... | @@ -2232,7 +2232,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2232,7 +2232,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2232 | }, | 2232 | }, |
| 2233 | .computed_goto_stmt => |computed_goto| { | 2233 | .computed_goto_stmt => |computed_goto| { |
| 2234 | repr.tag = .computed_goto_stmt; | 2234 | repr.tag = .computed_goto_stmt; |
| 2235 | repr.data[0] = @intFromEnum(computed_goto.expr); | 2235 | repr.data[0] = @backingInt(computed_goto.expr); |
| 2236 | repr.tok = computed_goto.goto_tok; | 2236 | repr.tok = computed_goto.goto_tok; |
| 2237 | }, | 2237 | }, |
| 2238 | .continue_stmt => |@"continue"| { | 2238 | .continue_stmt => |@"continue"| { |
| ... | @@ -2253,7 +2253,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2253,7 +2253,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2253 | switch (@"return".operand) { | 2253 | switch (@"return".operand) { |
| 2254 | .expr => |expr| { | 2254 | .expr => |expr| { |
| 2255 | repr.tag = .return_stmt; | 2255 | repr.tag = .return_stmt; |
| 2256 | repr.data[1] = @intFromEnum(expr); | 2256 | repr.data[1] = @backingInt(expr); |
| 2257 | }, | 2257 | }, |
| 2258 | .none => { | 2258 | .none => { |
| 2259 | repr.tag = .return_none_stmt; | 2259 | repr.tag = .return_none_stmt; |
| ... | @@ -2267,7 +2267,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2267,7 +2267,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2267 | }, | 2267 | }, |
| 2268 | .asm_stmt => |asm_stmt| { | 2268 | .asm_stmt => |asm_stmt| { |
| 2269 | repr.tok = asm_stmt.asm_tok; | 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 | if (asm_stmt.outputs.len == 0 and asm_stmt.inputs.len == 0 and asm_stmt.clobbers.len == 0 and asm_stmt.labels.len == 0) { | 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 | repr.tag = .asm_stmt_simple; | 2272 | repr.tag = .asm_stmt_simple; |
| 2273 | repr.data[1] = @bitCast(asm_stmt.quals); | 2273 | repr.data[1] = @bitCast(asm_stmt.quals); |
| ... | @@ -2302,314 +2302,314 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2302,314 +2302,314 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2302 | .assign_expr => |bin| { | 2302 | .assign_expr => |bin| { |
| 2303 | repr.tag = .assign_expr; | 2303 | repr.tag = .assign_expr; |
| 2304 | repr.data[0] = @bitCast(bin.qt); | 2304 | repr.data[0] = @bitCast(bin.qt); |
| 2305 | repr.data[1] = @intFromEnum(bin.lhs); | 2305 | repr.data[1] = @backingInt(bin.lhs); |
| 2306 | repr.data[2] = @intFromEnum(bin.rhs); | 2306 | repr.data[2] = @backingInt(bin.rhs); |
| 2307 | repr.tok = bin.op_tok; | 2307 | repr.tok = bin.op_tok; |
| 2308 | }, | 2308 | }, |
| 2309 | .mul_assign_expr => |bin| { | 2309 | .mul_assign_expr => |bin| { |
| 2310 | repr.tag = .mul_assign_expr; | 2310 | repr.tag = .mul_assign_expr; |
| 2311 | repr.data[0] = @bitCast(bin.qt); | 2311 | repr.data[0] = @bitCast(bin.qt); |
| 2312 | repr.data[1] = @intFromEnum(bin.lhs); | 2312 | repr.data[1] = @backingInt(bin.lhs); |
| 2313 | repr.data[2] = @intFromEnum(bin.rhs); | 2313 | repr.data[2] = @backingInt(bin.rhs); |
| 2314 | repr.tok = bin.op_tok; | 2314 | repr.tok = bin.op_tok; |
| 2315 | }, | 2315 | }, |
| 2316 | .div_assign_expr => |bin| { | 2316 | .div_assign_expr => |bin| { |
| 2317 | repr.tag = .div_assign_expr; | 2317 | repr.tag = .div_assign_expr; |
| 2318 | repr.data[0] = @bitCast(bin.qt); | 2318 | repr.data[0] = @bitCast(bin.qt); |
| 2319 | repr.data[1] = @intFromEnum(bin.lhs); | 2319 | repr.data[1] = @backingInt(bin.lhs); |
| 2320 | repr.data[2] = @intFromEnum(bin.rhs); | 2320 | repr.data[2] = @backingInt(bin.rhs); |
| 2321 | repr.tok = bin.op_tok; | 2321 | repr.tok = bin.op_tok; |
| 2322 | }, | 2322 | }, |
| 2323 | .mod_assign_expr => |bin| { | 2323 | .mod_assign_expr => |bin| { |
| 2324 | repr.tag = .mod_assign_expr; | 2324 | repr.tag = .mod_assign_expr; |
| 2325 | repr.data[0] = @bitCast(bin.qt); | 2325 | repr.data[0] = @bitCast(bin.qt); |
| 2326 | repr.data[1] = @intFromEnum(bin.lhs); | 2326 | repr.data[1] = @backingInt(bin.lhs); |
| 2327 | repr.data[2] = @intFromEnum(bin.rhs); | 2327 | repr.data[2] = @backingInt(bin.rhs); |
| 2328 | repr.tok = bin.op_tok; | 2328 | repr.tok = bin.op_tok; |
| 2329 | }, | 2329 | }, |
| 2330 | .add_assign_expr => |bin| { | 2330 | .add_assign_expr => |bin| { |
| 2331 | repr.tag = .add_assign_expr; | 2331 | repr.tag = .add_assign_expr; |
| 2332 | repr.data[0] = @bitCast(bin.qt); | 2332 | repr.data[0] = @bitCast(bin.qt); |
| 2333 | repr.data[1] = @intFromEnum(bin.lhs); | 2333 | repr.data[1] = @backingInt(bin.lhs); |
| 2334 | repr.data[2] = @intFromEnum(bin.rhs); | 2334 | repr.data[2] = @backingInt(bin.rhs); |
| 2335 | repr.tok = bin.op_tok; | 2335 | repr.tok = bin.op_tok; |
| 2336 | }, | 2336 | }, |
| 2337 | .sub_assign_expr => |bin| { | 2337 | .sub_assign_expr => |bin| { |
| 2338 | repr.tag = .sub_assign_expr; | 2338 | repr.tag = .sub_assign_expr; |
| 2339 | repr.data[0] = @bitCast(bin.qt); | 2339 | repr.data[0] = @bitCast(bin.qt); |
| 2340 | repr.data[1] = @intFromEnum(bin.lhs); | 2340 | repr.data[1] = @backingInt(bin.lhs); |
| 2341 | repr.data[2] = @intFromEnum(bin.rhs); | 2341 | repr.data[2] = @backingInt(bin.rhs); |
| 2342 | repr.tok = bin.op_tok; | 2342 | repr.tok = bin.op_tok; |
| 2343 | }, | 2343 | }, |
| 2344 | .shl_assign_expr => |bin| { | 2344 | .shl_assign_expr => |bin| { |
| 2345 | repr.tag = .shl_assign_expr; | 2345 | repr.tag = .shl_assign_expr; |
| 2346 | repr.data[0] = @bitCast(bin.qt); | 2346 | repr.data[0] = @bitCast(bin.qt); |
| 2347 | repr.data[1] = @intFromEnum(bin.lhs); | 2347 | repr.data[1] = @backingInt(bin.lhs); |
| 2348 | repr.data[2] = @intFromEnum(bin.rhs); | 2348 | repr.data[2] = @backingInt(bin.rhs); |
| 2349 | repr.tok = bin.op_tok; | 2349 | repr.tok = bin.op_tok; |
| 2350 | }, | 2350 | }, |
| 2351 | .shr_assign_expr => |bin| { | 2351 | .shr_assign_expr => |bin| { |
| 2352 | repr.tag = .shr_assign_expr; | 2352 | repr.tag = .shr_assign_expr; |
| 2353 | repr.data[0] = @bitCast(bin.qt); | 2353 | repr.data[0] = @bitCast(bin.qt); |
| 2354 | repr.data[1] = @intFromEnum(bin.lhs); | 2354 | repr.data[1] = @backingInt(bin.lhs); |
| 2355 | repr.data[2] = @intFromEnum(bin.rhs); | 2355 | repr.data[2] = @backingInt(bin.rhs); |
| 2356 | repr.tok = bin.op_tok; | 2356 | repr.tok = bin.op_tok; |
| 2357 | }, | 2357 | }, |
| 2358 | .bit_and_assign_expr => |bin| { | 2358 | .bit_and_assign_expr => |bin| { |
| 2359 | repr.tag = .bit_and_assign_expr; | 2359 | repr.tag = .bit_and_assign_expr; |
| 2360 | repr.data[0] = @bitCast(bin.qt); | 2360 | repr.data[0] = @bitCast(bin.qt); |
| 2361 | repr.data[1] = @intFromEnum(bin.lhs); | 2361 | repr.data[1] = @backingInt(bin.lhs); |
| 2362 | repr.data[2] = @intFromEnum(bin.rhs); | 2362 | repr.data[2] = @backingInt(bin.rhs); |
| 2363 | repr.tok = bin.op_tok; | 2363 | repr.tok = bin.op_tok; |
| 2364 | }, | 2364 | }, |
| 2365 | .bit_xor_assign_expr => |bin| { | 2365 | .bit_xor_assign_expr => |bin| { |
| 2366 | repr.tag = .bit_xor_assign_expr; | 2366 | repr.tag = .bit_xor_assign_expr; |
| 2367 | repr.data[0] = @bitCast(bin.qt); | 2367 | repr.data[0] = @bitCast(bin.qt); |
| 2368 | repr.data[1] = @intFromEnum(bin.lhs); | 2368 | repr.data[1] = @backingInt(bin.lhs); |
| 2369 | repr.data[2] = @intFromEnum(bin.rhs); | 2369 | repr.data[2] = @backingInt(bin.rhs); |
| 2370 | repr.tok = bin.op_tok; | 2370 | repr.tok = bin.op_tok; |
| 2371 | }, | 2371 | }, |
| 2372 | .bit_or_assign_expr => |bin| { | 2372 | .bit_or_assign_expr => |bin| { |
| 2373 | repr.tag = .bit_or_assign_expr; | 2373 | repr.tag = .bit_or_assign_expr; |
| 2374 | repr.data[0] = @bitCast(bin.qt); | 2374 | repr.data[0] = @bitCast(bin.qt); |
| 2375 | repr.data[1] = @intFromEnum(bin.lhs); | 2375 | repr.data[1] = @backingInt(bin.lhs); |
| 2376 | repr.data[2] = @intFromEnum(bin.rhs); | 2376 | repr.data[2] = @backingInt(bin.rhs); |
| 2377 | repr.tok = bin.op_tok; | 2377 | repr.tok = bin.op_tok; |
| 2378 | }, | 2378 | }, |
| 2379 | .compound_assign_dummy_expr => |un| { | 2379 | .compound_assign_dummy_expr => |un| { |
| 2380 | repr.tag = .compound_assign_dummy_expr; | 2380 | repr.tag = .compound_assign_dummy_expr; |
| 2381 | repr.data[0] = @bitCast(un.qt); | 2381 | repr.data[0] = @bitCast(un.qt); |
| 2382 | repr.data[1] = @intFromEnum(un.operand); | 2382 | repr.data[1] = @backingInt(un.operand); |
| 2383 | repr.tok = un.op_tok; | 2383 | repr.tok = un.op_tok; |
| 2384 | }, | 2384 | }, |
| 2385 | .comma_expr => |bin| { | 2385 | .comma_expr => |bin| { |
| 2386 | repr.tag = .comma_expr; | 2386 | repr.tag = .comma_expr; |
| 2387 | repr.data[0] = @bitCast(bin.qt); | 2387 | repr.data[0] = @bitCast(bin.qt); |
| 2388 | repr.data[1] = @intFromEnum(bin.lhs); | 2388 | repr.data[1] = @backingInt(bin.lhs); |
| 2389 | repr.data[2] = @intFromEnum(bin.rhs); | 2389 | repr.data[2] = @backingInt(bin.rhs); |
| 2390 | repr.tok = bin.op_tok; | 2390 | repr.tok = bin.op_tok; |
| 2391 | }, | 2391 | }, |
| 2392 | .bool_or_expr => |bin| { | 2392 | .bool_or_expr => |bin| { |
| 2393 | repr.tag = .bool_or_expr; | 2393 | repr.tag = .bool_or_expr; |
| 2394 | repr.data[0] = @bitCast(bin.qt); | 2394 | repr.data[0] = @bitCast(bin.qt); |
| 2395 | repr.data[1] = @intFromEnum(bin.lhs); | 2395 | repr.data[1] = @backingInt(bin.lhs); |
| 2396 | repr.data[2] = @intFromEnum(bin.rhs); | 2396 | repr.data[2] = @backingInt(bin.rhs); |
| 2397 | repr.tok = bin.op_tok; | 2397 | repr.tok = bin.op_tok; |
| 2398 | }, | 2398 | }, |
| 2399 | .bool_and_expr => |bin| { | 2399 | .bool_and_expr => |bin| { |
| 2400 | repr.tag = .bool_and_expr; | 2400 | repr.tag = .bool_and_expr; |
| 2401 | repr.data[0] = @bitCast(bin.qt); | 2401 | repr.data[0] = @bitCast(bin.qt); |
| 2402 | repr.data[1] = @intFromEnum(bin.lhs); | 2402 | repr.data[1] = @backingInt(bin.lhs); |
| 2403 | repr.data[2] = @intFromEnum(bin.rhs); | 2403 | repr.data[2] = @backingInt(bin.rhs); |
| 2404 | repr.tok = bin.op_tok; | 2404 | repr.tok = bin.op_tok; |
| 2405 | }, | 2405 | }, |
| 2406 | .bit_or_expr => |bin| { | 2406 | .bit_or_expr => |bin| { |
| 2407 | repr.tag = .bit_or_expr; | 2407 | repr.tag = .bit_or_expr; |
| 2408 | repr.data[0] = @bitCast(bin.qt); | 2408 | repr.data[0] = @bitCast(bin.qt); |
| 2409 | repr.data[1] = @intFromEnum(bin.lhs); | 2409 | repr.data[1] = @backingInt(bin.lhs); |
| 2410 | repr.data[2] = @intFromEnum(bin.rhs); | 2410 | repr.data[2] = @backingInt(bin.rhs); |
| 2411 | repr.tok = bin.op_tok; | 2411 | repr.tok = bin.op_tok; |
| 2412 | }, | 2412 | }, |
| 2413 | .bit_xor_expr => |bin| { | 2413 | .bit_xor_expr => |bin| { |
| 2414 | repr.tag = .bit_xor_expr; | 2414 | repr.tag = .bit_xor_expr; |
| 2415 | repr.data[0] = @bitCast(bin.qt); | 2415 | repr.data[0] = @bitCast(bin.qt); |
| 2416 | repr.data[1] = @intFromEnum(bin.lhs); | 2416 | repr.data[1] = @backingInt(bin.lhs); |
| 2417 | repr.data[2] = @intFromEnum(bin.rhs); | 2417 | repr.data[2] = @backingInt(bin.rhs); |
| 2418 | repr.tok = bin.op_tok; | 2418 | repr.tok = bin.op_tok; |
| 2419 | }, | 2419 | }, |
| 2420 | .bit_and_expr => |bin| { | 2420 | .bit_and_expr => |bin| { |
| 2421 | repr.tag = .bit_and_expr; | 2421 | repr.tag = .bit_and_expr; |
| 2422 | repr.data[0] = @bitCast(bin.qt); | 2422 | repr.data[0] = @bitCast(bin.qt); |
| 2423 | repr.data[1] = @intFromEnum(bin.lhs); | 2423 | repr.data[1] = @backingInt(bin.lhs); |
| 2424 | repr.data[2] = @intFromEnum(bin.rhs); | 2424 | repr.data[2] = @backingInt(bin.rhs); |
| 2425 | repr.tok = bin.op_tok; | 2425 | repr.tok = bin.op_tok; |
| 2426 | }, | 2426 | }, |
| 2427 | .equal_expr => |bin| { | 2427 | .equal_expr => |bin| { |
| 2428 | repr.tag = .equal_expr; | 2428 | repr.tag = .equal_expr; |
| 2429 | repr.data[0] = @bitCast(bin.qt); | 2429 | repr.data[0] = @bitCast(bin.qt); |
| 2430 | repr.data[1] = @intFromEnum(bin.lhs); | 2430 | repr.data[1] = @backingInt(bin.lhs); |
| 2431 | repr.data[2] = @intFromEnum(bin.rhs); | 2431 | repr.data[2] = @backingInt(bin.rhs); |
| 2432 | repr.tok = bin.op_tok; | 2432 | repr.tok = bin.op_tok; |
| 2433 | }, | 2433 | }, |
| 2434 | .not_equal_expr => |bin| { | 2434 | .not_equal_expr => |bin| { |
| 2435 | repr.tag = .not_equal_expr; | 2435 | repr.tag = .not_equal_expr; |
| 2436 | repr.data[0] = @bitCast(bin.qt); | 2436 | repr.data[0] = @bitCast(bin.qt); |
| 2437 | repr.data[1] = @intFromEnum(bin.lhs); | 2437 | repr.data[1] = @backingInt(bin.lhs); |
| 2438 | repr.data[2] = @intFromEnum(bin.rhs); | 2438 | repr.data[2] = @backingInt(bin.rhs); |
| 2439 | repr.tok = bin.op_tok; | 2439 | repr.tok = bin.op_tok; |
| 2440 | }, | 2440 | }, |
| 2441 | .less_than_expr => |bin| { | 2441 | .less_than_expr => |bin| { |
| 2442 | repr.tag = .less_than_expr; | 2442 | repr.tag = .less_than_expr; |
| 2443 | repr.data[0] = @bitCast(bin.qt); | 2443 | repr.data[0] = @bitCast(bin.qt); |
| 2444 | repr.data[1] = @intFromEnum(bin.lhs); | 2444 | repr.data[1] = @backingInt(bin.lhs); |
| 2445 | repr.data[2] = @intFromEnum(bin.rhs); | 2445 | repr.data[2] = @backingInt(bin.rhs); |
| 2446 | repr.tok = bin.op_tok; | 2446 | repr.tok = bin.op_tok; |
| 2447 | }, | 2447 | }, |
| 2448 | .less_than_equal_expr => |bin| { | 2448 | .less_than_equal_expr => |bin| { |
| 2449 | repr.tag = .less_than_equal_expr; | 2449 | repr.tag = .less_than_equal_expr; |
| 2450 | repr.data[0] = @bitCast(bin.qt); | 2450 | repr.data[0] = @bitCast(bin.qt); |
| 2451 | repr.data[1] = @intFromEnum(bin.lhs); | 2451 | repr.data[1] = @backingInt(bin.lhs); |
| 2452 | repr.data[2] = @intFromEnum(bin.rhs); | 2452 | repr.data[2] = @backingInt(bin.rhs); |
| 2453 | repr.tok = bin.op_tok; | 2453 | repr.tok = bin.op_tok; |
| 2454 | }, | 2454 | }, |
| 2455 | .greater_than_expr => |bin| { | 2455 | .greater_than_expr => |bin| { |
| 2456 | repr.tag = .greater_than_expr; | 2456 | repr.tag = .greater_than_expr; |
| 2457 | repr.data[0] = @bitCast(bin.qt); | 2457 | repr.data[0] = @bitCast(bin.qt); |
| 2458 | repr.data[1] = @intFromEnum(bin.lhs); | 2458 | repr.data[1] = @backingInt(bin.lhs); |
| 2459 | repr.data[2] = @intFromEnum(bin.rhs); | 2459 | repr.data[2] = @backingInt(bin.rhs); |
| 2460 | repr.tok = bin.op_tok; | 2460 | repr.tok = bin.op_tok; |
| 2461 | }, | 2461 | }, |
| 2462 | .greater_than_equal_expr => |bin| { | 2462 | .greater_than_equal_expr => |bin| { |
| 2463 | repr.tag = .greater_than_equal_expr; | 2463 | repr.tag = .greater_than_equal_expr; |
| 2464 | repr.data[0] = @bitCast(bin.qt); | 2464 | repr.data[0] = @bitCast(bin.qt); |
| 2465 | repr.data[1] = @intFromEnum(bin.lhs); | 2465 | repr.data[1] = @backingInt(bin.lhs); |
| 2466 | repr.data[2] = @intFromEnum(bin.rhs); | 2466 | repr.data[2] = @backingInt(bin.rhs); |
| 2467 | repr.tok = bin.op_tok; | 2467 | repr.tok = bin.op_tok; |
| 2468 | }, | 2468 | }, |
| 2469 | .shl_expr => |bin| { | 2469 | .shl_expr => |bin| { |
| 2470 | repr.tag = .shl_expr; | 2470 | repr.tag = .shl_expr; |
| 2471 | repr.data[0] = @bitCast(bin.qt); | 2471 | repr.data[0] = @bitCast(bin.qt); |
| 2472 | repr.data[1] = @intFromEnum(bin.lhs); | 2472 | repr.data[1] = @backingInt(bin.lhs); |
| 2473 | repr.data[2] = @intFromEnum(bin.rhs); | 2473 | repr.data[2] = @backingInt(bin.rhs); |
| 2474 | repr.tok = bin.op_tok; | 2474 | repr.tok = bin.op_tok; |
| 2475 | }, | 2475 | }, |
| 2476 | .shr_expr => |bin| { | 2476 | .shr_expr => |bin| { |
| 2477 | repr.tag = .shr_expr; | 2477 | repr.tag = .shr_expr; |
| 2478 | repr.data[0] = @bitCast(bin.qt); | 2478 | repr.data[0] = @bitCast(bin.qt); |
| 2479 | repr.data[1] = @intFromEnum(bin.lhs); | 2479 | repr.data[1] = @backingInt(bin.lhs); |
| 2480 | repr.data[2] = @intFromEnum(bin.rhs); | 2480 | repr.data[2] = @backingInt(bin.rhs); |
| 2481 | repr.tok = bin.op_tok; | 2481 | repr.tok = bin.op_tok; |
| 2482 | }, | 2482 | }, |
| 2483 | .add_expr => |bin| { | 2483 | .add_expr => |bin| { |
| 2484 | repr.tag = .add_expr; | 2484 | repr.tag = .add_expr; |
| 2485 | repr.data[0] = @bitCast(bin.qt); | 2485 | repr.data[0] = @bitCast(bin.qt); |
| 2486 | repr.data[1] = @intFromEnum(bin.lhs); | 2486 | repr.data[1] = @backingInt(bin.lhs); |
| 2487 | repr.data[2] = @intFromEnum(bin.rhs); | 2487 | repr.data[2] = @backingInt(bin.rhs); |
| 2488 | repr.tok = bin.op_tok; | 2488 | repr.tok = bin.op_tok; |
| 2489 | }, | 2489 | }, |
| 2490 | .sub_expr => |bin| { | 2490 | .sub_expr => |bin| { |
| 2491 | repr.tag = .sub_expr; | 2491 | repr.tag = .sub_expr; |
| 2492 | repr.data[0] = @bitCast(bin.qt); | 2492 | repr.data[0] = @bitCast(bin.qt); |
| 2493 | repr.data[1] = @intFromEnum(bin.lhs); | 2493 | repr.data[1] = @backingInt(bin.lhs); |
| 2494 | repr.data[2] = @intFromEnum(bin.rhs); | 2494 | repr.data[2] = @backingInt(bin.rhs); |
| 2495 | repr.tok = bin.op_tok; | 2495 | repr.tok = bin.op_tok; |
| 2496 | }, | 2496 | }, |
| 2497 | .mul_expr => |bin| { | 2497 | .mul_expr => |bin| { |
| 2498 | repr.tag = .mul_expr; | 2498 | repr.tag = .mul_expr; |
| 2499 | repr.data[0] = @bitCast(bin.qt); | 2499 | repr.data[0] = @bitCast(bin.qt); |
| 2500 | repr.data[1] = @intFromEnum(bin.lhs); | 2500 | repr.data[1] = @backingInt(bin.lhs); |
| 2501 | repr.data[2] = @intFromEnum(bin.rhs); | 2501 | repr.data[2] = @backingInt(bin.rhs); |
| 2502 | repr.tok = bin.op_tok; | 2502 | repr.tok = bin.op_tok; |
| 2503 | }, | 2503 | }, |
| 2504 | .div_expr => |bin| { | 2504 | .div_expr => |bin| { |
| 2505 | repr.tag = .div_expr; | 2505 | repr.tag = .div_expr; |
| 2506 | repr.data[0] = @bitCast(bin.qt); | 2506 | repr.data[0] = @bitCast(bin.qt); |
| 2507 | repr.data[1] = @intFromEnum(bin.lhs); | 2507 | repr.data[1] = @backingInt(bin.lhs); |
| 2508 | repr.data[2] = @intFromEnum(bin.rhs); | 2508 | repr.data[2] = @backingInt(bin.rhs); |
| 2509 | repr.tok = bin.op_tok; | 2509 | repr.tok = bin.op_tok; |
| 2510 | }, | 2510 | }, |
| 2511 | .mod_expr => |bin| { | 2511 | .mod_expr => |bin| { |
| 2512 | repr.tag = .mod_expr; | 2512 | repr.tag = .mod_expr; |
| 2513 | repr.data[0] = @bitCast(bin.qt); | 2513 | repr.data[0] = @bitCast(bin.qt); |
| 2514 | repr.data[1] = @intFromEnum(bin.lhs); | 2514 | repr.data[1] = @backingInt(bin.lhs); |
| 2515 | repr.data[2] = @intFromEnum(bin.rhs); | 2515 | repr.data[2] = @backingInt(bin.rhs); |
| 2516 | repr.tok = bin.op_tok; | 2516 | repr.tok = bin.op_tok; |
| 2517 | }, | 2517 | }, |
| 2518 | .cast => |cast| { | 2518 | .cast => |cast| { |
| 2519 | repr.tag = if (cast.implicit) .implicit_cast else .explicit_cast; | 2519 | repr.tag = if (cast.implicit) .implicit_cast else .explicit_cast; |
| 2520 | repr.data[0] = @bitCast(cast.qt); | 2520 | repr.data[0] = @bitCast(cast.qt); |
| 2521 | repr.data[1] = @intFromEnum(cast.kind); | 2521 | repr.data[1] = @backingInt(cast.kind); |
| 2522 | repr.data[2] = @intFromEnum(cast.operand); | 2522 | repr.data[2] = @backingInt(cast.operand); |
| 2523 | repr.tok = cast.l_paren; | 2523 | repr.tok = cast.l_paren; |
| 2524 | }, | 2524 | }, |
| 2525 | .addr_of_expr => |un| { | 2525 | .addr_of_expr => |un| { |
| 2526 | repr.tag = .addr_of_expr; | 2526 | repr.tag = .addr_of_expr; |
| 2527 | repr.data[0] = @bitCast(un.qt); | 2527 | repr.data[0] = @bitCast(un.qt); |
| 2528 | repr.data[1] = @intFromEnum(un.operand); | 2528 | repr.data[1] = @backingInt(un.operand); |
| 2529 | repr.tok = un.op_tok; | 2529 | repr.tok = un.op_tok; |
| 2530 | }, | 2530 | }, |
| 2531 | .deref_expr => |un| { | 2531 | .deref_expr => |un| { |
| 2532 | repr.tag = .deref_expr; | 2532 | repr.tag = .deref_expr; |
| 2533 | repr.data[0] = @bitCast(un.qt); | 2533 | repr.data[0] = @bitCast(un.qt); |
| 2534 | repr.data[1] = @intFromEnum(un.operand); | 2534 | repr.data[1] = @backingInt(un.operand); |
| 2535 | repr.tok = un.op_tok; | 2535 | repr.tok = un.op_tok; |
| 2536 | }, | 2536 | }, |
| 2537 | .plus_expr => |un| { | 2537 | .plus_expr => |un| { |
| 2538 | repr.tag = .plus_expr; | 2538 | repr.tag = .plus_expr; |
| 2539 | repr.data[0] = @bitCast(un.qt); | 2539 | repr.data[0] = @bitCast(un.qt); |
| 2540 | repr.data[1] = @intFromEnum(un.operand); | 2540 | repr.data[1] = @backingInt(un.operand); |
| 2541 | repr.tok = un.op_tok; | 2541 | repr.tok = un.op_tok; |
| 2542 | }, | 2542 | }, |
| 2543 | .negate_expr => |un| { | 2543 | .negate_expr => |un| { |
| 2544 | repr.tag = .negate_expr; | 2544 | repr.tag = .negate_expr; |
| 2545 | repr.data[0] = @bitCast(un.qt); | 2545 | repr.data[0] = @bitCast(un.qt); |
| 2546 | repr.data[1] = @intFromEnum(un.operand); | 2546 | repr.data[1] = @backingInt(un.operand); |
| 2547 | repr.tok = un.op_tok; | 2547 | repr.tok = un.op_tok; |
| 2548 | }, | 2548 | }, |
| 2549 | .bit_not_expr => |un| { | 2549 | .bit_not_expr => |un| { |
| 2550 | repr.tag = .bit_not_expr; | 2550 | repr.tag = .bit_not_expr; |
| 2551 | repr.data[0] = @bitCast(un.qt); | 2551 | repr.data[0] = @bitCast(un.qt); |
| 2552 | repr.data[1] = @intFromEnum(un.operand); | 2552 | repr.data[1] = @backingInt(un.operand); |
| 2553 | repr.tok = un.op_tok; | 2553 | repr.tok = un.op_tok; |
| 2554 | }, | 2554 | }, |
| 2555 | .bool_not_expr => |un| { | 2555 | .bool_not_expr => |un| { |
| 2556 | repr.tag = .bool_not_expr; | 2556 | repr.tag = .bool_not_expr; |
| 2557 | repr.data[0] = @bitCast(un.qt); | 2557 | repr.data[0] = @bitCast(un.qt); |
| 2558 | repr.data[1] = @intFromEnum(un.operand); | 2558 | repr.data[1] = @backingInt(un.operand); |
| 2559 | repr.tok = un.op_tok; | 2559 | repr.tok = un.op_tok; |
| 2560 | }, | 2560 | }, |
| 2561 | .pre_inc_expr => |un| { | 2561 | .pre_inc_expr => |un| { |
| 2562 | repr.tag = .pre_inc_expr; | 2562 | repr.tag = .pre_inc_expr; |
| 2563 | repr.data[0] = @bitCast(un.qt); | 2563 | repr.data[0] = @bitCast(un.qt); |
| 2564 | repr.data[1] = @intFromEnum(un.operand); | 2564 | repr.data[1] = @backingInt(un.operand); |
| 2565 | repr.tok = un.op_tok; | 2565 | repr.tok = un.op_tok; |
| 2566 | }, | 2566 | }, |
| 2567 | .pre_dec_expr => |un| { | 2567 | .pre_dec_expr => |un| { |
| 2568 | repr.tag = .pre_dec_expr; | 2568 | repr.tag = .pre_dec_expr; |
| 2569 | repr.data[0] = @bitCast(un.qt); | 2569 | repr.data[0] = @bitCast(un.qt); |
| 2570 | repr.data[1] = @intFromEnum(un.operand); | 2570 | repr.data[1] = @backingInt(un.operand); |
| 2571 | repr.tok = un.op_tok; | 2571 | repr.tok = un.op_tok; |
| 2572 | }, | 2572 | }, |
| 2573 | .imag_expr => |un| { | 2573 | .imag_expr => |un| { |
| 2574 | repr.tag = .imag_expr; | 2574 | repr.tag = .imag_expr; |
| 2575 | repr.data[0] = @bitCast(un.qt); | 2575 | repr.data[0] = @bitCast(un.qt); |
| 2576 | repr.data[1] = @intFromEnum(un.operand); | 2576 | repr.data[1] = @backingInt(un.operand); |
| 2577 | repr.tok = un.op_tok; | 2577 | repr.tok = un.op_tok; |
| 2578 | }, | 2578 | }, |
| 2579 | .real_expr => |un| { | 2579 | .real_expr => |un| { |
| 2580 | repr.tag = .real_expr; | 2580 | repr.tag = .real_expr; |
| 2581 | repr.data[0] = @bitCast(un.qt); | 2581 | repr.data[0] = @bitCast(un.qt); |
| 2582 | repr.data[1] = @intFromEnum(un.operand); | 2582 | repr.data[1] = @backingInt(un.operand); |
| 2583 | repr.tok = un.op_tok; | 2583 | repr.tok = un.op_tok; |
| 2584 | }, | 2584 | }, |
| 2585 | .post_inc_expr => |un| { | 2585 | .post_inc_expr => |un| { |
| 2586 | repr.tag = .post_inc_expr; | 2586 | repr.tag = .post_inc_expr; |
| 2587 | repr.data[0] = @bitCast(un.qt); | 2587 | repr.data[0] = @bitCast(un.qt); |
| 2588 | repr.data[1] = @intFromEnum(un.operand); | 2588 | repr.data[1] = @backingInt(un.operand); |
| 2589 | repr.tok = un.op_tok; | 2589 | repr.tok = un.op_tok; |
| 2590 | }, | 2590 | }, |
| 2591 | .post_dec_expr => |un| { | 2591 | .post_dec_expr => |un| { |
| 2592 | repr.tag = .post_dec_expr; | 2592 | repr.tag = .post_dec_expr; |
| 2593 | repr.data[0] = @bitCast(un.qt); | 2593 | repr.data[0] = @bitCast(un.qt); |
| 2594 | repr.data[1] = @intFromEnum(un.operand); | 2594 | repr.data[1] = @backingInt(un.operand); |
| 2595 | repr.tok = un.op_tok; | 2595 | repr.tok = un.op_tok; |
| 2596 | }, | 2596 | }, |
| 2597 | .paren_expr => |un| { | 2597 | .paren_expr => |un| { |
| 2598 | repr.tag = .paren_expr; | 2598 | repr.tag = .paren_expr; |
| 2599 | repr.data[0] = @bitCast(un.qt); | 2599 | repr.data[0] = @bitCast(un.qt); |
| 2600 | repr.data[1] = @intFromEnum(un.operand); | 2600 | repr.data[1] = @backingInt(un.operand); |
| 2601 | repr.tok = un.op_tok; | 2601 | repr.tok = un.op_tok; |
| 2602 | }, | 2602 | }, |
| 2603 | .stmt_expr => |un| { | 2603 | .stmt_expr => |un| { |
| 2604 | repr.tag = .stmt_expr; | 2604 | repr.tag = .stmt_expr; |
| 2605 | repr.data[0] = @bitCast(un.qt); | 2605 | repr.data[0] = @bitCast(un.qt); |
| 2606 | repr.data[1] = @intFromEnum(un.operand); | 2606 | repr.data[1] = @backingInt(un.operand); |
| 2607 | repr.tok = un.op_tok; | 2607 | repr.tok = un.op_tok; |
| 2608 | }, | 2608 | }, |
| 2609 | .cond_dummy_expr => |un| { | 2609 | .cond_dummy_expr => |un| { |
| 2610 | repr.tag = .cond_dummy_expr; | 2610 | repr.tag = .cond_dummy_expr; |
| 2611 | repr.data[0] = @bitCast(un.qt); | 2611 | repr.data[0] = @bitCast(un.qt); |
| 2612 | repr.data[1] = @intFromEnum(un.operand); | 2612 | repr.data[1] = @backingInt(un.operand); |
| 2613 | repr.tok = un.op_tok; | 2613 | repr.tok = un.op_tok; |
| 2614 | }, | 2614 | }, |
| 2615 | .addr_of_label => |addr_of| { | 2615 | .addr_of_label => |addr_of| { |
| ... | @@ -2620,8 +2620,8 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2620,8 +2620,8 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2620 | .array_access_expr => |access| { | 2620 | .array_access_expr => |access| { |
| 2621 | repr.tag = .array_access_expr; | 2621 | repr.tag = .array_access_expr; |
| 2622 | repr.data[0] = @bitCast(access.qt); | 2622 | repr.data[0] = @bitCast(access.qt); |
| 2623 | repr.data[1] = @intFromEnum(access.base); | 2623 | repr.data[1] = @backingInt(access.base); |
| 2624 | repr.data[2] = @intFromEnum(access.index); | 2624 | repr.data[2] = @backingInt(access.index); |
| 2625 | repr.tok = access.l_bracket_tok; | 2625 | repr.tok = access.l_bracket_tok; |
| 2626 | }, | 2626 | }, |
| 2627 | .call_expr => |call| { | 2627 | .call_expr => |call| { |
| ... | @@ -2632,11 +2632,11 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2632,11 +2632,11 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2632 | const len: u32 = @intCast(call.args.len + 1); | 2632 | const len: u32 = @intCast(call.args.len + 1); |
| 2633 | repr.data[2] = len; | 2633 | repr.data[2] = len; |
| 2634 | try tree.extra.ensureUnusedCapacity(tree.comp.gpa, len); | 2634 | try tree.extra.ensureUnusedCapacity(tree.comp.gpa, len); |
| 2635 | tree.extra.appendAssumeCapacity(@intFromEnum(call.callee)); | 2635 | tree.extra.appendAssumeCapacity(@backingInt(call.callee)); |
| 2636 | tree.extra.appendSliceAssumeCapacity(@ptrCast(call.args)); | 2636 | tree.extra.appendSliceAssumeCapacity(@ptrCast(call.args)); |
| 2637 | } else { | 2637 | } else { |
| 2638 | repr.tag = .call_expr_one; | 2638 | repr.tag = .call_expr_one; |
| 2639 | repr.data[1] = @intFromEnum(call.callee); | 2639 | repr.data[1] = @backingInt(call.callee); |
| 2640 | repr.data[2] = packElem(call.args, 0); | 2640 | repr.data[2] = packElem(call.args, 0); |
| 2641 | } | 2641 | } |
| 2642 | repr.tok = call.l_paren_tok; | 2642 | repr.tok = call.l_paren_tok; |
| ... | @@ -2656,27 +2656,27 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2656,27 +2656,27 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2656 | .member_access_expr => |access| { | 2656 | .member_access_expr => |access| { |
| 2657 | repr.tag = .member_access_expr; | 2657 | repr.tag = .member_access_expr; |
| 2658 | repr.data[0] = @bitCast(access.qt); | 2658 | repr.data[0] = @bitCast(access.qt); |
| 2659 | repr.data[1] = @intFromEnum(access.base); | 2659 | repr.data[1] = @backingInt(access.base); |
| 2660 | repr.data[2] = access.member_index; | 2660 | repr.data[2] = access.member_index; |
| 2661 | repr.tok = access.access_tok; | 2661 | repr.tok = access.access_tok; |
| 2662 | }, | 2662 | }, |
| 2663 | .member_access_ptr_expr => |access| { | 2663 | .member_access_ptr_expr => |access| { |
| 2664 | repr.tag = .member_access_ptr_expr; | 2664 | repr.tag = .member_access_ptr_expr; |
| 2665 | repr.data[0] = @bitCast(access.qt); | 2665 | repr.data[0] = @bitCast(access.qt); |
| 2666 | repr.data[1] = @intFromEnum(access.base); | 2666 | repr.data[1] = @backingInt(access.base); |
| 2667 | repr.data[2] = access.member_index; | 2667 | repr.data[2] = access.member_index; |
| 2668 | repr.tok = access.access_tok; | 2668 | repr.tok = access.access_tok; |
| 2669 | }, | 2669 | }, |
| 2670 | .decl_ref_expr => |decl_ref| { | 2670 | .decl_ref_expr => |decl_ref| { |
| 2671 | repr.tag = .decl_ref_expr; | 2671 | repr.tag = .decl_ref_expr; |
| 2672 | repr.data[0] = @bitCast(decl_ref.qt); | 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 | repr.tok = decl_ref.name_tok; | 2674 | repr.tok = decl_ref.name_tok; |
| 2675 | }, | 2675 | }, |
| 2676 | .enumeration_ref => |enumeration_ref| { | 2676 | .enumeration_ref => |enumeration_ref| { |
| 2677 | repr.tag = .enumeration_ref; | 2677 | repr.tag = .enumeration_ref; |
| 2678 | repr.data[0] = @bitCast(enumeration_ref.qt); | 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 | repr.tok = enumeration_ref.name_tok; | 2680 | repr.tok = enumeration_ref.name_tok; |
| 2681 | }, | 2681 | }, |
| 2682 | .builtin_ref => |builtin_ref| { | 2682 | .builtin_ref => |builtin_ref| { |
| ... | @@ -2702,7 +2702,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2702,7 +2702,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2702 | .char_literal => |literal| { | 2702 | .char_literal => |literal| { |
| 2703 | repr.tag = .char_literal; | 2703 | repr.tag = .char_literal; |
| 2704 | repr.data[0] = @bitCast(literal.qt); | 2704 | repr.data[0] = @bitCast(literal.qt); |
| 2705 | repr.data[1] = @intFromEnum(literal.kind); | 2705 | repr.data[1] = @backingInt(literal.kind); |
| 2706 | repr.tok = literal.literal_tok; | 2706 | repr.tok = literal.literal_tok; |
| 2707 | }, | 2707 | }, |
| 2708 | .float_literal => |literal| { | 2708 | .float_literal => |literal| { |
| ... | @@ -2713,13 +2713,13 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2713,13 +2713,13 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2713 | .string_literal_expr => |literal| { | 2713 | .string_literal_expr => |literal| { |
| 2714 | repr.tag = .string_literal_expr; | 2714 | repr.tag = .string_literal_expr; |
| 2715 | repr.data[0] = @bitCast(literal.qt); | 2715 | repr.data[0] = @bitCast(literal.qt); |
| 2716 | repr.data[1] = @intFromEnum(literal.kind); | 2716 | repr.data[1] = @backingInt(literal.kind); |
| 2717 | repr.tok = literal.literal_tok; | 2717 | repr.tok = literal.literal_tok; |
| 2718 | }, | 2718 | }, |
| 2719 | .imaginary_literal => |un| { | 2719 | .imaginary_literal => |un| { |
| 2720 | repr.tag = .imaginary_literal; | 2720 | repr.tag = .imaginary_literal; |
| 2721 | repr.data[0] = @bitCast(un.qt); | 2721 | repr.data[0] = @bitCast(un.qt); |
| 2722 | repr.data[1] = @intFromEnum(un.operand); | 2722 | repr.data[1] = @backingInt(un.operand); |
| 2723 | repr.tok = un.op_tok; | 2723 | repr.tok = un.op_tok; |
| 2724 | }, | 2724 | }, |
| 2725 | .sizeof_expr => |type_info| { | 2725 | .sizeof_expr => |type_info| { |
| ... | @@ -2744,45 +2744,45 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2744,45 +2744,45 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2744 | const len: u32 = @intCast(generic.rest.len + 2); | 2744 | const len: u32 = @intCast(generic.rest.len + 2); |
| 2745 | repr.data[2] = len; | 2745 | repr.data[2] = len; |
| 2746 | try tree.extra.ensureUnusedCapacity(tree.comp.gpa, len); | 2746 | try tree.extra.ensureUnusedCapacity(tree.comp.gpa, len); |
| 2747 | tree.extra.appendAssumeCapacity(@intFromEnum(generic.controlling)); | 2747 | tree.extra.appendAssumeCapacity(@backingInt(generic.controlling)); |
| 2748 | tree.extra.appendAssumeCapacity(@intFromEnum(generic.chosen)); | 2748 | tree.extra.appendAssumeCapacity(@backingInt(generic.chosen)); |
| 2749 | tree.extra.appendSliceAssumeCapacity(@ptrCast(generic.rest)); | 2749 | tree.extra.appendSliceAssumeCapacity(@ptrCast(generic.rest)); |
| 2750 | } else { | 2750 | } else { |
| 2751 | repr.tag = .generic_expr_zero; | 2751 | repr.tag = .generic_expr_zero; |
| 2752 | repr.data[1] = @intFromEnum(generic.controlling); | 2752 | repr.data[1] = @backingInt(generic.controlling); |
| 2753 | repr.data[2] = @intFromEnum(generic.chosen); | 2753 | repr.data[2] = @backingInt(generic.chosen); |
| 2754 | } | 2754 | } |
| 2755 | repr.tok = generic.generic_tok; | 2755 | repr.tok = generic.generic_tok; |
| 2756 | }, | 2756 | }, |
| 2757 | .generic_association_expr => |association| { | 2757 | .generic_association_expr => |association| { |
| 2758 | repr.tag = .generic_association_expr; | 2758 | repr.tag = .generic_association_expr; |
| 2759 | repr.data[0] = @bitCast(association.association_qt); | 2759 | repr.data[0] = @bitCast(association.association_qt); |
| 2760 | repr.data[1] = @intFromEnum(association.expr); | 2760 | repr.data[1] = @backingInt(association.expr); |
| 2761 | repr.tok = association.colon_tok; | 2761 | repr.tok = association.colon_tok; |
| 2762 | }, | 2762 | }, |
| 2763 | .generic_default_expr => |default| { | 2763 | .generic_default_expr => |default| { |
| 2764 | repr.tag = .generic_default_expr; | 2764 | repr.tag = .generic_default_expr; |
| 2765 | repr.data[0] = @intFromEnum(default.expr); | 2765 | repr.data[0] = @backingInt(default.expr); |
| 2766 | repr.tok = default.default_tok; | 2766 | repr.tok = default.default_tok; |
| 2767 | }, | 2767 | }, |
| 2768 | .binary_cond_expr => |cond| { | 2768 | .binary_cond_expr => |cond| { |
| 2769 | repr.tag = .binary_cond_expr; | 2769 | repr.tag = .binary_cond_expr; |
| 2770 | repr.data[0] = @bitCast(cond.qt); | 2770 | repr.data[0] = @bitCast(cond.qt); |
| 2771 | repr.data[1] = @intFromEnum(cond.cond); | 2771 | repr.data[1] = @backingInt(cond.cond); |
| 2772 | repr.data[2], _ = try tree.addExtra(&.{ cond.then_expr, cond.else_expr }); | 2772 | repr.data[2], _ = try tree.addExtra(&.{ cond.then_expr, cond.else_expr }); |
| 2773 | repr.tok = cond.cond_tok; | 2773 | repr.tok = cond.cond_tok; |
| 2774 | }, | 2774 | }, |
| 2775 | .cond_expr => |cond| { | 2775 | .cond_expr => |cond| { |
| 2776 | repr.tag = .cond_expr; | 2776 | repr.tag = .cond_expr; |
| 2777 | repr.data[0] = @bitCast(cond.qt); | 2777 | repr.data[0] = @bitCast(cond.qt); |
| 2778 | repr.data[1] = @intFromEnum(cond.cond); | 2778 | repr.data[1] = @backingInt(cond.cond); |
| 2779 | repr.data[2], _ = try tree.addExtra(&.{ cond.then_expr, cond.else_expr }); | 2779 | repr.data[2], _ = try tree.addExtra(&.{ cond.then_expr, cond.else_expr }); |
| 2780 | repr.tok = cond.cond_tok; | 2780 | repr.tok = cond.cond_tok; |
| 2781 | }, | 2781 | }, |
| 2782 | .builtin_choose_expr => |cond| { | 2782 | .builtin_choose_expr => |cond| { |
| 2783 | repr.tag = .builtin_choose_expr; | 2783 | repr.tag = .builtin_choose_expr; |
| 2784 | repr.data[0] = @bitCast(cond.qt); | 2784 | repr.data[0] = @bitCast(cond.qt); |
| 2785 | repr.data[1] = @intFromEnum(cond.cond); | 2785 | repr.data[1] = @backingInt(cond.cond); |
| 2786 | repr.data[2], _ = try tree.addExtra(&.{ cond.then_expr, cond.else_expr }); | 2786 | repr.data[2], _ = try tree.addExtra(&.{ cond.then_expr, cond.else_expr }); |
| 2787 | repr.tok = cond.cond_tok; | 2787 | repr.tok = cond.cond_tok; |
| 2788 | }, | 2788 | }, |
| ... | @@ -2795,7 +2795,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2795,7 +2795,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2795 | .builtin_convertvector => |builtin| { | 2795 | .builtin_convertvector => |builtin| { |
| 2796 | repr.tag = .builtin_convertvector; | 2796 | repr.tag = .builtin_convertvector; |
| 2797 | repr.data[0] = @bitCast(builtin.dest_qt); | 2797 | repr.data[0] = @bitCast(builtin.dest_qt); |
| 2798 | repr.data[1] = @intFromEnum(builtin.operand); | 2798 | repr.data[1] = @backingInt(builtin.operand); |
| 2799 | repr.tok = builtin.builtin_tok; | 2799 | repr.tok = builtin.builtin_tok; |
| 2800 | }, | 2800 | }, |
| 2801 | .builtin_shufflevector => |builtin| { | 2801 | .builtin_shufflevector => |builtin| { |
| ... | @@ -2805,8 +2805,8 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2805,8 +2805,8 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2805 | repr.data[2] = @intCast(builtin.indexes.len); | 2805 | repr.data[2] = @intCast(builtin.indexes.len); |
| 2806 | repr.tok = builtin.builtin_tok; | 2806 | repr.tok = builtin.builtin_tok; |
| 2807 | try tree.extra.ensureUnusedCapacity(tree.comp.gpa, builtin.indexes.len + 2); | 2807 | try tree.extra.ensureUnusedCapacity(tree.comp.gpa, builtin.indexes.len + 2); |
| 2808 | tree.extra.appendAssumeCapacity(@intFromEnum(builtin.lhs)); | 2808 | tree.extra.appendAssumeCapacity(@backingInt(builtin.lhs)); |
| 2809 | tree.extra.appendAssumeCapacity(@intFromEnum(builtin.rhs)); | 2809 | tree.extra.appendAssumeCapacity(@backingInt(builtin.rhs)); |
| 2810 | tree.extra.appendSliceAssumeCapacity(@ptrCast(builtin.indexes)); | 2810 | tree.extra.appendSliceAssumeCapacity(@ptrCast(builtin.indexes)); |
| 2811 | }, | 2811 | }, |
| 2812 | .builtin_va_arg_pack => |builtin| { | 2812 | .builtin_va_arg_pack => |builtin| { |
| ... | @@ -2867,7 +2867,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { | ... | @@ -2867,7 +2867,7 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2867 | .register = literal.storage_class == .register, | 2867 | .register = literal.storage_class == .register, |
| 2868 | .thread_local = literal.thread_local, | 2868 | .thread_local = literal.thread_local, |
| 2869 | }); | 2869 | }); |
| 2870 | repr.data[2] = @intFromEnum(literal.initializer); | 2870 | repr.data[2] = @backingInt(literal.initializer); |
| 2871 | repr.tok = literal.l_paren_tok; | 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,19 +2875,19 @@ pub fn setNode(tree: *Tree, node: Node, index: usize) !void { |
| 2875 | } | 2875 | } |
| 2876 | 2876 | ||
| 2877 | fn packOptIndex(opt: ?Node.Index) u32 { | 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 | fn unpackOptIndex(idx: u32) ?Node.Index { | 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 | fn packElem(nodes: []const Node.Index, index: usize) u32 { | 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 | fn unPackElems(data: []const u32) []const Node.Index { | 2889 | fn unPackElems(data: []const u32) []const Node.Index { |
| 2890 | const sentinel = @intFromEnum(Node.OptIndex.null); | 2890 | const sentinel = @backingInt(Node.OptIndex.null); |
| 2891 | for (data, 0..) |item, i| { | 2891 | for (data, 0..) |item, i| { |
| 2892 | if (item == sentinel) return @ptrCast(data[0..i]); | 2892 | if (item == sentinel) return @ptrCast(data[0..i]); |
| 2893 | } | 2893 | } |
| ... | @@ -3146,7 +3146,7 @@ fn dumpNode( | ... | @@ -3146,7 +3146,7 @@ fn dumpNode( |
| 3146 | _ = try ptr.offset.print(tree.comp.type_store.ptrdiff, tree.comp, w); | 3146 | _ = try ptr.offset.print(tree.comp.type_store.ptrdiff, tree.comp, w); |
| 3147 | }, | 3147 | }, |
| 3148 | else => { | 3148 | else => { |
| 3149 | const ptr_node: Node.Index = @enumFromInt(ptr.node); | 3149 | const ptr_node: Node.Index = @fromBackingInt(@intCast(ptr.node)); |
| 3150 | const decl_name = tree.tokSlice(ptr_node.tok(tree)); | 3150 | const decl_name = tree.tokSlice(ptr_node.tok(tree)); |
| 3151 | try ptr.offset.printPointer(decl_name, tree.comp, w); | 3151 | try ptr.offset.printPointer(decl_name, tree.comp, w); |
| 3152 | }, | 3152 | }, |
| ... | @@ -3212,7 +3212,7 @@ fn dumpNode( | ... | @@ -3212,7 +3212,7 @@ fn dumpNode( |
| 3212 | try w.splatByteAll(' ', level + half); | 3212 | try w.splatByteAll(' ', level + half); |
| 3213 | try w.writeAll("definition: "); | 3213 | try w.writeAll("definition: "); |
| 3214 | try term.setColor(NAME); | 3214 | try term.setColor(NAME); |
| 3215 | try w.print("0x{X}\n", .{@intFromEnum(definition)}); | 3215 | try w.print("0x{X}\n", .{@backingInt(definition)}); |
| 3216 | try term.setColor(.reset); | 3216 | try term.setColor(.reset); |
| 3217 | } | 3217 | } |
| 3218 | }, | 3218 | }, |
| ... | @@ -3268,7 +3268,7 @@ fn dumpNode( | ... | @@ -3268,7 +3268,7 @@ fn dumpNode( |
| 3268 | try w.splatByteAll(' ', level + half); | 3268 | try w.splatByteAll(' ', level + half); |
| 3269 | try w.writeAll("definition: "); | 3269 | try w.writeAll("definition: "); |
| 3270 | try term.setColor(NAME); | 3270 | try term.setColor(NAME); |
| 3271 | try w.print("0x{X}\n", .{@intFromEnum(definition)}); | 3271 | try w.print("0x{X}\n", .{@backingInt(definition)}); |
| 3272 | try term.setColor(.reset); | 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,13 +226,13 @@ pub const QualType = packed struct(u32) { |
| 226 | else => {}, | 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 | return switch (repr.tag) { | 230 | return switch (repr.tag) { |
| 231 | .complex => .{ .complex = @bitCast(repr.data[0]) }, | 231 | .complex => .{ .complex = @bitCast(repr.data[0]) }, |
| 232 | .atomic => .{ .atomic = @bitCast(repr.data[0]) }, | 232 | .atomic => .{ .atomic = @bitCast(repr.data[0]) }, |
| 233 | .bit_int => .{ .bit_int = .{ | 233 | .bit_int => .{ .bit_int = .{ |
| 234 | .bits = @intCast(repr.data[0]), | 234 | .bits = @intCast(repr.data[0]), |
| 235 | .signedness = @enumFromInt(repr.data[1]), | 235 | .signedness = @fromBackingInt(@intCast(repr.data[1])), |
| 236 | } }, | 236 | } }, |
| 237 | .func_zero => .{ .func = .{ | 237 | .func_zero => .{ .func = .{ |
| 238 | .return_type = @bitCast(repr.data[0]), | 238 | .return_type = @bitCast(repr.data[0]), |
| ... | @@ -280,7 +280,7 @@ pub const QualType = packed struct(u32) { | ... | @@ -280,7 +280,7 @@ pub const QualType = packed struct(u32) { |
| 280 | }, | 280 | }, |
| 281 | .pointer => .{ .pointer = .{ | 281 | .pointer => .{ .pointer = .{ |
| 282 | .child = @bitCast(repr.data[0]), | 282 | .child = @bitCast(repr.data[0]), |
| 283 | .bounds = @enumFromInt(repr.data[1]), | 283 | .bounds = @fromBackingInt(@intCast(repr.data[1])), |
| 284 | } }, | 284 | } }, |
| 285 | .pointer_decayed => .{ .pointer = .{ | 285 | .pointer_decayed => .{ .pointer = .{ |
| 286 | .child = @bitCast(repr.data[0]), | 286 | .child = @bitCast(repr.data[0]), |
| ... | @@ -300,7 +300,7 @@ pub const QualType = packed struct(u32) { | ... | @@ -300,7 +300,7 @@ pub const QualType = packed struct(u32) { |
| 300 | } }, | 300 | } }, |
| 301 | .array_variable => .{ .array = .{ | 301 | .array_variable => .{ .array = .{ |
| 302 | .elem = @bitCast(repr.data[0]), | 302 | .elem = @bitCast(repr.data[0]), |
| 303 | .len = .{ .variable = @enumFromInt(repr.data[1]) }, | 303 | .len = .{ .variable = @fromBackingInt(@intCast(repr.data[1])) }, |
| 304 | } }, | 304 | } }, |
| 305 | .array_unspecified_variable => .{ .array = .{ | 305 | .array_unspecified_variable => .{ .array = .{ |
| 306 | .elem = @bitCast(repr.data[0]), | 306 | .elem = @bitCast(repr.data[0]), |
| ... | @@ -322,8 +322,8 @@ pub const QualType = packed struct(u32) { | ... | @@ -322,8 +322,8 @@ pub const QualType = packed struct(u32) { |
| 322 | const extra_fields = extra[repr.data[1] + layout_size + 2 ..][0 .. fields_len * field_size]; | 322 | const extra_fields = extra[repr.data[1] + layout_size + 2 ..][0 .. fields_len * field_size]; |
| 323 | 323 | ||
| 324 | const record: Type.Record = .{ | 324 | const record: Type.Record = .{ |
| 325 | .name = @enumFromInt(repr.data[0]), | 325 | .name = @fromBackingInt(@intCast(repr.data[0])), |
| 326 | .decl_node = @enumFromInt(extra[repr.data[1]]), | 326 | .decl_node = @fromBackingInt(@intCast(extra[repr.data[1]])), |
| 327 | .layout = layout, | 327 | .layout = layout, |
| 328 | .fields = std.mem.bytesAsSlice(Type.Record.Field, std.mem.sliceAsBytes(extra_fields)), | 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,14 +334,14 @@ pub const QualType = packed struct(u32) { |
| 334 | }; | 334 | }; |
| 335 | }, | 335 | }, |
| 336 | .struct_incomplete => .{ .@"struct" = .{ | 336 | .struct_incomplete => .{ .@"struct" = .{ |
| 337 | .name = @enumFromInt(repr.data[0]), | 337 | .name = @fromBackingInt(@intCast(repr.data[0])), |
| 338 | .decl_node = @enumFromInt(repr.data[1]), | 338 | .decl_node = @fromBackingInt(@intCast(repr.data[1])), |
| 339 | .layout = null, | 339 | .layout = null, |
| 340 | .fields = &.{}, | 340 | .fields = &.{}, |
| 341 | } }, | 341 | } }, |
| 342 | .union_incomplete => .{ .@"union" = .{ | 342 | .union_incomplete => .{ .@"union" = .{ |
| 343 | .name = @enumFromInt(repr.data[0]), | 343 | .name = @fromBackingInt(@intCast(repr.data[0])), |
| 344 | .decl_node = @enumFromInt(repr.data[1]), | 344 | .decl_node = @fromBackingInt(@intCast(repr.data[1])), |
| 345 | .layout = null, | 345 | .layout = null, |
| 346 | .fields = &.{}, | 346 | .fields = &.{}, |
| 347 | } }, | 347 | } }, |
| ... | @@ -354,8 +354,8 @@ pub const QualType = packed struct(u32) { | ... | @@ -354,8 +354,8 @@ pub const QualType = packed struct(u32) { |
| 354 | const extra_fields = extra[repr.data[1] + 3 ..][0 .. fields_len * field_size]; | 354 | const extra_fields = extra[repr.data[1] + 3 ..][0 .. fields_len * field_size]; |
| 355 | 355 | ||
| 356 | return .{ .@"enum" = .{ | 356 | return .{ .@"enum" = .{ |
| 357 | .name = @enumFromInt(extra[repr.data[1]]), | 357 | .name = @fromBackingInt(@intCast(extra[repr.data[1]])), |
| 358 | .decl_node = @enumFromInt(extra[repr.data[1] + 1]), | 358 | .decl_node = @fromBackingInt(@intCast(extra[repr.data[1] + 1])), |
| 359 | .tag = @bitCast(repr.data[0]), | 359 | .tag = @bitCast(repr.data[0]), |
| 360 | .incomplete = false, | 360 | .incomplete = false, |
| 361 | .fixed = repr.tag == .enum_fixed, | 361 | .fixed = repr.tag == .enum_fixed, |
| ... | @@ -365,8 +365,8 @@ pub const QualType = packed struct(u32) { | ... | @@ -365,8 +365,8 @@ pub const QualType = packed struct(u32) { |
| 365 | .enum_incomplete => .{ | 365 | .enum_incomplete => .{ |
| 366 | .@"enum" = .{ | 366 | .@"enum" = .{ |
| 367 | .tag = null, | 367 | .tag = null, |
| 368 | .name = @enumFromInt(repr.data[0]), | 368 | .name = @fromBackingInt(@intCast(repr.data[0])), |
| 369 | .decl_node = @enumFromInt(repr.data[1]), | 369 | .decl_node = @fromBackingInt(@intCast(repr.data[1])), |
| 370 | .incomplete = true, | 370 | .incomplete = true, |
| 371 | .fixed = false, | 371 | .fixed = false, |
| 372 | .fields = &.{}, | 372 | .fields = &.{}, |
| ... | @@ -375,8 +375,8 @@ pub const QualType = packed struct(u32) { | ... | @@ -375,8 +375,8 @@ pub const QualType = packed struct(u32) { |
| 375 | .enum_incomplete_fixed => .{ | 375 | .enum_incomplete_fixed => .{ |
| 376 | .@"enum" = .{ | 376 | .@"enum" = .{ |
| 377 | .tag = @bitCast(repr.data[0]), | 377 | .tag = @bitCast(repr.data[0]), |
| 378 | .name = @enumFromInt(comp.type_store.extra.items[repr.data[1]]), | 378 | .name = @fromBackingInt(@intCast(comp.type_store.extra.items[repr.data[1]])), |
| 379 | .decl_node = @enumFromInt(comp.type_store.extra.items[repr.data[1] + 1]), | 379 | .decl_node = @fromBackingInt(@intCast(comp.type_store.extra.items[repr.data[1] + 1])), |
| 380 | .incomplete = true, | 380 | .incomplete = true, |
| 381 | .fixed = true, | 381 | .fixed = true, |
| 382 | .fields = &.{}, | 382 | .fields = &.{}, |
| ... | @@ -388,12 +388,12 @@ pub const QualType = packed struct(u32) { | ... | @@ -388,12 +388,12 @@ pub const QualType = packed struct(u32) { |
| 388 | } }, | 388 | } }, |
| 389 | .typeof_expr => .{ .typeof = .{ | 389 | .typeof_expr => .{ .typeof = .{ |
| 390 | .base = @bitCast(repr.data[0]), | 390 | .base = @bitCast(repr.data[0]), |
| 391 | .expr = @enumFromInt(repr.data[1]), | 391 | .expr = @fromBackingInt(@intCast(repr.data[1])), |
| 392 | } }, | 392 | } }, |
| 393 | .typedef => .{ .typedef = .{ | 393 | .typedef => .{ .typedef = .{ |
| 394 | .base = @bitCast(repr.data[0]), | 394 | .base = @bitCast(repr.data[0]), |
| 395 | .name = @enumFromInt(comp.type_store.extra.items[repr.data[1]]), | 395 | .name = @fromBackingInt(@intCast(comp.type_store.extra.items[repr.data[1]])), |
| 396 | .decl_node = @enumFromInt(comp.type_store.extra.items[repr.data[1] + 1]), | 396 | .decl_node = @fromBackingInt(@intCast(comp.type_store.extra.items[repr.data[1] + 1])), |
| 397 | } }, | 397 | } }, |
| 398 | .attributed => { | 398 | .attributed => { |
| 399 | const extra = comp.type_store.extra.items; | 399 | const extra = comp.type_store.extra.items; |
| ... | @@ -1694,7 +1694,7 @@ pub const Type = union(enum) { | ... | @@ -1694,7 +1694,7 @@ pub const Type = union(enum) { |
| 1694 | 1694 | ||
| 1695 | pub fn unpack(width: @This()) ?u32 { | 1695 | pub fn unpack(width: @This()) ?u32 { |
| 1696 | if (width == .null) return null; | 1696 | if (width == .null) return null; |
| 1697 | return @intFromEnum(width); | 1697 | return @backingInt(width); |
| 1698 | } | 1698 | } |
| 1699 | } = .null, | 1699 | } = .null, |
| 1700 | layout: Field.Layout = .{ | 1700 | layout: Field.Layout = .{ |
| ... | @@ -1881,7 +1881,7 @@ pub fn putExtra(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type) !Index { | ... | @@ -1881,7 +1881,7 @@ pub fn putExtra(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type) !Index { |
| 1881 | } | 1881 | } |
| 1882 | const index = try ts.types.addOne(gpa); | 1882 | const index = try ts.types.addOne(gpa); |
| 1883 | try ts.set(gpa, ty, index); | 1883 | try ts.set(gpa, ty, index); |
| 1884 | return @enumFromInt(index); | 1884 | return @fromBackingInt(@intCast(index)); |
| 1885 | } | 1885 | } |
| 1886 | 1886 | ||
| 1887 | pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void { | 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,7 +1899,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 1899 | .bit_int => |bit_int| { | 1899 | .bit_int => |bit_int| { |
| 1900 | repr.tag = .bit_int; | 1900 | repr.tag = .bit_int; |
| 1901 | repr.data[0] = bit_int.bits; | 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 | .atomic => |atomic| { | 1904 | .atomic => |atomic| { |
| 1905 | repr.tag = .atomic; | 1905 | repr.tag = .atomic; |
| ... | @@ -1950,7 +1950,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void | ... | @@ -1950,7 +1950,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 1950 | repr.data[1] = @bitCast(array); | 1950 | repr.data[1] = @bitCast(array); |
| 1951 | } else { | 1951 | } else { |
| 1952 | repr.tag = .pointer; | 1952 | repr.tag = .pointer; |
| 1953 | repr.data[1] = @intFromEnum(pointer.bounds); | 1953 | repr.data[1] = @backingInt(pointer.bounds); |
| 1954 | } | 1954 | } |
| 1955 | }, | 1955 | }, |
| 1956 | .array => |array| { | 1956 | .array => |array| { |
| ... | @@ -1973,7 +1973,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void | ... | @@ -1973,7 +1973,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 1973 | }, | 1973 | }, |
| 1974 | .variable => |expr| { | 1974 | .variable => |expr| { |
| 1975 | repr.tag = .array_variable; | 1975 | repr.tag = .array_variable; |
| 1976 | repr.data[1] = @intFromEnum(expr); | 1976 | repr.data[1] = @backingInt(expr); |
| 1977 | }, | 1977 | }, |
| 1978 | .unspecified_variable => { | 1978 | .unspecified_variable => { |
| 1979 | repr.tag = .array_unspecified_variable; | 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,7 +1986,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 1986 | repr.data[1] = vector.len; | 1986 | repr.data[1] = vector.len; |
| 1987 | }, | 1987 | }, |
| 1988 | .@"struct", .@"union" => |record| record: { | 1988 | .@"struct", .@"union" => |record| record: { |
| 1989 | repr.data[0] = @intFromEnum(record.name); | 1989 | repr.data[0] = @backingInt(record.name); |
| 1990 | const layout = record.layout orelse { | 1990 | const layout = record.layout orelse { |
| 1991 | std.debug.assert(record.fields.len == 0); | 1991 | std.debug.assert(record.fields.len == 0); |
| 1992 | repr.tag = switch (ty) { | 1992 | repr.tag = switch (ty) { |
| ... | @@ -1994,7 +1994,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void | ... | @@ -1994,7 +1994,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 1994 | .@"union" => .union_incomplete, | 1994 | .@"union" => .union_incomplete, |
| 1995 | else => unreachable, | 1995 | else => unreachable, |
| 1996 | }; | 1996 | }; |
| 1997 | repr.data[1] = @intFromEnum(record.decl_node); | 1997 | repr.data[1] = @backingInt(record.decl_node); |
| 1998 | break :record; | 1998 | break :record; |
| 1999 | }; | 1999 | }; |
| 2000 | repr.tag = switch (ty) { | 2000 | repr.tag = switch (ty) { |
| ... | @@ -2012,7 +2012,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void | ... | @@ -2012,7 +2012,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 2012 | comptime std.debug.assert(@sizeOf(Type.Record.Field) == @sizeOf(u32) * field_size); | 2012 | comptime std.debug.assert(@sizeOf(Type.Record.Field) == @sizeOf(u32) * field_size); |
| 2013 | try ts.extra.ensureUnusedCapacity(gpa, record.fields.len * field_size + layout_size + 2); | 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 | const casted_layout: *const [layout_size]u32 = @ptrCast(&layout); | 2016 | const casted_layout: *const [layout_size]u32 = @ptrCast(&layout); |
| 2017 | ts.extra.appendSliceAssumeCapacity(casted_layout); | 2017 | ts.extra.appendSliceAssumeCapacity(casted_layout); |
| 2018 | ts.extra.appendAssumeCapacity(@intCast(record.fields.len)); | 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,13 +2030,13 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 2030 | repr.data[0] = @bitCast(@"enum".tag.?); | 2030 | repr.data[0] = @bitCast(@"enum".tag.?); |
| 2031 | repr.data[1] = @intCast(ts.extra.items.len); | 2031 | repr.data[1] = @intCast(ts.extra.items.len); |
| 2032 | try ts.extra.appendSlice(gpa, &.{ | 2032 | try ts.extra.appendSlice(gpa, &.{ |
| 2033 | @intFromEnum(@"enum".name), | 2033 | @backingInt(@"enum".name), |
| 2034 | @intFromEnum(@"enum".decl_node), | 2034 | @backingInt(@"enum".decl_node), |
| 2035 | }); | 2035 | }); |
| 2036 | } else { | 2036 | } else { |
| 2037 | repr.tag = .enum_incomplete; | 2037 | repr.tag = .enum_incomplete; |
| 2038 | repr.data[0] = @intFromEnum(@"enum".name); | 2038 | repr.data[0] = @backingInt(@"enum".name); |
| 2039 | repr.data[1] = @intFromEnum(@"enum".decl_node); | 2039 | repr.data[1] = @backingInt(@"enum".decl_node); |
| 2040 | } | 2040 | } |
| 2041 | break :@"enum"; | 2041 | break :@"enum"; |
| 2042 | } | 2042 | } |
| ... | @@ -2050,8 +2050,8 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void | ... | @@ -2050,8 +2050,8 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 2050 | comptime std.debug.assert(@sizeOf(Type.Enum.Field) == @sizeOf(u32) * field_size); | 2050 | comptime std.debug.assert(@sizeOf(Type.Enum.Field) == @sizeOf(u32) * field_size); |
| 2051 | try ts.extra.ensureUnusedCapacity(gpa, @"enum".fields.len * field_size + 3); | 2051 | try ts.extra.ensureUnusedCapacity(gpa, @"enum".fields.len * field_size + 3); |
| 2052 | 2052 | ||
| 2053 | ts.extra.appendAssumeCapacity(@intFromEnum(@"enum".name)); | 2053 | ts.extra.appendAssumeCapacity(@backingInt(@"enum".name)); |
| 2054 | ts.extra.appendAssumeCapacity(@intFromEnum(@"enum".decl_node)); | 2054 | ts.extra.appendAssumeCapacity(@backingInt(@"enum".decl_node)); |
| 2055 | ts.extra.appendAssumeCapacity(@intCast(@"enum".fields.len)); | 2055 | ts.extra.appendAssumeCapacity(@intCast(@"enum".fields.len)); |
| 2056 | 2056 | ||
| 2057 | for (@"enum".fields) |*field| { | 2057 | for (@"enum".fields) |*field| { |
| ... | @@ -2063,7 +2063,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void | ... | @@ -2063,7 +2063,7 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 2063 | repr.data[0] = @bitCast(typeof.base); | 2063 | repr.data[0] = @bitCast(typeof.base); |
| 2064 | if (typeof.expr) |some| { | 2064 | if (typeof.expr) |some| { |
| 2065 | repr.tag = .typeof_expr; | 2065 | repr.tag = .typeof_expr; |
| 2066 | repr.data[1] = @intFromEnum(some); | 2066 | repr.data[1] = @backingInt(some); |
| 2067 | } else { | 2067 | } else { |
| 2068 | repr.tag = .typeof; | 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,8 +2073,8 @@ pub fn set(ts: *TypeStore, gpa: std.mem.Allocator, ty: Type, index: usize) !void |
| 2073 | repr.data[0] = @bitCast(typedef.base); | 2073 | repr.data[0] = @bitCast(typedef.base); |
| 2074 | repr.data[1] = @intCast(ts.extra.items.len); | 2074 | repr.data[1] = @intCast(ts.extra.items.len); |
| 2075 | try ts.extra.appendSlice(gpa, &.{ | 2075 | try ts.extra.appendSlice(gpa, &.{ |
| 2076 | @intFromEnum(typedef.name), | 2076 | @backingInt(typedef.name), |
| 2077 | @intFromEnum(typedef.decl_node), | 2077 | @backingInt(typedef.decl_node), |
| 2078 | }); | 2078 | }); |
| 2079 | }, | 2079 | }, |
| 2080 | .attributed => |attributed| { | 2080 | .attributed => |attributed| { |
| ... | @@ -2194,7 +2194,7 @@ fn generateNsConstantStringType(ts: *TypeStore, comp: *Compilation) !QualType { | ... | @@ -2194,7 +2194,7 @@ fn generateNsConstantStringType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2194 | }; | 2194 | }; |
| 2195 | record.fields = &fields; | 2195 | record.fields = &fields; |
| 2196 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; | 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 | return qt; | 2199 | return qt; |
| 2200 | } | 2200 | } |
| ... | @@ -2282,7 +2282,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { | ... | @@ -2282,7 +2282,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2282 | }; | 2282 | }; |
| 2283 | record.fields = &fields; | 2283 | record.fields = &fields; |
| 2284 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; | 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 | return qt; | 2287 | return qt; |
| 2288 | }, | 2288 | }, |
| ... | @@ -2300,7 +2300,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { | ... | @@ -2300,7 +2300,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2300 | }; | 2300 | }; |
| 2301 | record.fields = &fields; | 2301 | record.fields = &fields; |
| 2302 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; | 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 | return qt; | 2305 | return qt; |
| 2306 | }, | 2306 | }, |
| ... | @@ -2321,7 +2321,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { | ... | @@ -2321,7 +2321,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2321 | }; | 2321 | }; |
| 2322 | record.fields = &fields; | 2322 | record.fields = &fields; |
| 2323 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; | 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 | break :blk qt; | 2326 | break :blk qt; |
| 2327 | }, | 2327 | }, |
| ... | @@ -2343,7 +2343,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { | ... | @@ -2343,7 +2343,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2343 | }; | 2343 | }; |
| 2344 | record.fields = &fields; | 2344 | record.fields = &fields; |
| 2345 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; | 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 | break :blk qt; | 2348 | break :blk qt; |
| 2349 | }, | 2349 | }, |
| ... | @@ -2363,7 +2363,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { | ... | @@ -2363,7 +2363,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2363 | }; | 2363 | }; |
| 2364 | record.fields = &fields; | 2364 | record.fields = &fields; |
| 2365 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; | 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 | break :blk qt; | 2368 | break :blk qt; |
| 2369 | }, | 2369 | }, |
| ... | @@ -2384,7 +2384,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { | ... | @@ -2384,7 +2384,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2384 | }; | 2384 | }; |
| 2385 | record.fields = &fields; | 2385 | record.fields = &fields; |
| 2386 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; | 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 | break :blk qt; | 2389 | break :blk qt; |
| 2390 | }, | 2390 | }, |
| ... | @@ -2404,7 +2404,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { | ... | @@ -2404,7 +2404,7 @@ fn generateVaListType(ts: *TypeStore, comp: *Compilation) !QualType { |
| 2404 | }; | 2404 | }; |
| 2405 | record.fields = &fields; | 2405 | record.fields = &fields; |
| 2406 | record.layout = record_layout.compute(&fields, qt, comp, null) catch unreachable; | 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 | return qt; | 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,7 +21,7 @@ pub const @"null" = Value{ .opt_ref = .null }; |
| 21 | 21 | ||
| 22 | pub fn intern(comp: *Compilation, k: Interner.Key) !Value { | 22 | pub fn intern(comp: *Compilation, k: Interner.Key) !Value { |
| 23 | const r = try comp.interner.put(comp.gpa, k); | 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 | pub fn int(i: anytype, comp: *Compilation) !Value { | 27 | pub fn int(i: anytype, comp: *Compilation) !Value { |
| ... | @@ -39,11 +39,11 @@ pub fn pointer(r: Interner.Key.Pointer, comp: *Compilation) !Value { | ... | @@ -39,11 +39,11 @@ pub fn pointer(r: Interner.Key.Pointer, comp: *Compilation) !Value { |
| 39 | 39 | ||
| 40 | pub fn ref(v: Value) Interner.Ref { | 40 | pub fn ref(v: Value) Interner.Ref { |
| 41 | std.debug.assert(v.opt_ref != .none); | 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 | pub fn fromRef(r: Interner.Ref) Value { | 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 | pub fn is(v: Value, tag: std.meta.Tag(Interner.Key), comp: *const Compilation) bool { | 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,8 +1114,8 @@ pub fn print(v: Value, qt: QualType, comp: *const Compilation, w: *std.Io.Writer |
| 1114 | } | 1114 | } |
| 1115 | 1115 | ||
| 1116 | pub fn printString(bytes: []const u8, qt: QualType, comp: *const Compilation, w: *std.Io.Writer) std.Io.Writer.Error!void { | 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)); | 1117 | const size: Compilation.CharUnitSize = @fromBackingInt(@intCast(qt.childType(comp).sizeof(comp))); |
| 1118 | const without_null = bytes[0 .. bytes.len - @intFromEnum(size)]; | 1118 | const without_null = bytes[0 .. bytes.len - @backingInt(size)]; |
| 1119 | try w.writeByte('"'); | 1119 | try w.writeByte('"'); |
| 1120 | switch (size) { | 1120 | switch (size) { |
| 1121 | .@"1" => try std.zig.stringEscape(without_null, w), | 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,7 +508,7 @@ pub const Parser = struct { |
| 508 | }, | 508 | }, |
| 509 | }; | 509 | }; |
| 510 | for (slice) |c| { | 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 | val, const overflow = @shlWithOverflow(val, base.log2()); | 512 | val, const overflow = @shlWithOverflow(val, base.log2()); |
| 513 | if (overflow != 0) overflowed = true; | 513 | if (overflow != 0) overflowed = true; |
| 514 | val += char; | 514 | val += char; |
lib/compiler/aro/assembly_backend/x86_64.zig+1-1| ... | @@ -166,7 +166,7 @@ fn genDecls(c: *AsmCodeGen) !void { | ... | @@ -166,7 +166,7 @@ fn genDecls(c: *AsmCodeGen) !void { |
| 166 | if (c.tree.comp.code_gen_options.debug != .strip) { | 166 | if (c.tree.comp.code_gen_options.debug != .strip) { |
| 167 | const sources = c.tree.comp.sources.values(); | 167 | const sources = c.tree.comp.sources.values(); |
| 168 | for (sources) |source| { | 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,7 +22,7 @@ const KeyAdapter = struct { |
| 22 | 22 | ||
| 23 | pub fn eql(adapter: KeyAdapter, a: Key, b_void: void, b_map_index: usize) bool { | 23 | pub fn eql(adapter: KeyAdapter, a: Key, b_void: void, b_map_index: usize) bool { |
| 24 | _ = b_void; | 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 | pub fn hash(adapter: KeyAdapter, a: Key) u32 { | 28 | pub fn hash(adapter: KeyAdapter, a: Key) u32 { |
| ... | @@ -582,7 +582,7 @@ pub fn put(i: *Interner, gpa: Allocator, key: Key) !Ref { | ... | @@ -582,7 +582,7 @@ pub fn put(i: *Interner, gpa: Allocator, key: Key) !Ref { |
| 582 | if (key.toRef()) |some| return some; | 582 | if (key.toRef()) |some| return some; |
| 583 | const adapter: KeyAdapter = .{ .interner = i }; | 583 | const adapter: KeyAdapter = .{ .interner = i }; |
| 584 | const gop = try i.map.getOrPutAdapted(gpa, key, adapter); | 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 | try i.items.ensureUnusedCapacity(gpa, 1); | 586 | try i.items.ensureUnusedCapacity(gpa, 1); |
| 587 | 587 | ||
| 588 | switch (key) { | 588 | switch (key) { |
| ... | @@ -751,7 +751,7 @@ pub fn put(i: *Interner, gpa: Allocator, key: Key) !Ref { | ... | @@ -751,7 +751,7 @@ pub fn put(i: *Interner, gpa: Allocator, key: Key) !Ref { |
| 751 | => unreachable, | 751 | => unreachable, |
| 752 | } | 752 | } |
| 753 | 753 | ||
| 754 | return @enumFromInt(gop.index); | 754 | return @fromBackingInt(@intCast(gop.index)); |
| 755 | } | 755 | } |
| 756 | 756 | ||
| 757 | fn addExtra(i: *Interner, gpa: Allocator, extra: anytype) Allocator.Error!u32 { | 757 | fn addExtra(i: *Interner, gpa: Allocator, extra: anytype) Allocator.Error!u32 { |
| ... | @@ -765,7 +765,7 @@ fn addExtraAssumeCapacity(i: *Interner, extra: anytype) u32 { | ... | @@ -765,7 +765,7 @@ fn addExtraAssumeCapacity(i: *Interner, extra: anytype) u32 { |
| 765 | const info = @typeInfo(@TypeOf(extra)).@"struct"; | 765 | const info = @typeInfo(@TypeOf(extra)).@"struct"; |
| 766 | inline for (info.field_names, info.field_types) |field_name, field_type| { | 766 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 767 | i.extra.appendAssumeCapacity(switch (field_type) { | 767 | i.extra.appendAssumeCapacity(switch (field_type) { |
| 768 | Ref => @intFromEnum(@field(extra, field_name)), | 768 | Ref => @backingInt(@field(extra, field_name)), |
| 769 | u32 => @field(extra, field_name), | 769 | u32 => @field(extra, field_name), |
| 770 | else => @compileError("bad field type: " ++ @typeName(field_type)), | 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,7 +800,7 @@ pub fn get(i: *const Interner, ref: Ref) Key { |
| 800 | else => {}, | 800 | else => {}, |
| 801 | } | 801 | } |
| 802 | 802 | ||
| 803 | const item = i.items.get(@intFromEnum(ref)); | 803 | const item = i.items.get(@backingInt(ref)); |
| 804 | const data = item.data; | 804 | const data = item.data; |
| 805 | return switch (item.tag) { | 805 | return switch (item.tag) { |
| 806 | .int_ty => .{ .int_ty = @intCast(data) }, | 806 | .int_ty => .{ .int_ty = @intCast(data) }, |
| ... | @@ -896,7 +896,7 @@ fn extraDataTrail(i: *const Interner, comptime T: type, index: usize) struct { d | ... | @@ -896,7 +896,7 @@ fn extraDataTrail(i: *const Interner, comptime T: type, index: usize) struct { d |
| 896 | inline for (info.field_names, info.field_types, 0..) |field_name, field_type, field_i| { | 896 | inline for (info.field_names, info.field_types, 0..) |field_name, field_type, field_i| { |
| 897 | const int32 = i.extra.items[field_i + index]; | 897 | const int32 = i.extra.items[field_i + index]; |
| 898 | @field(result, field_name) = switch (field_type) { | 898 | @field(result, field_name) = switch (field_type) { |
| 899 | Ref => @enumFromInt(int32), | 899 | Ref => @fromBackingInt(@intCast(int32)), |
| 900 | u32 => int32, | 900 | u32 => int32, |
| 901 | else => @compileError("bad field type: " ++ @typeName(field_type)), | 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,7 +81,7 @@ pub const Builder = struct { |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | pub fn addArg(b: *Builder, ty: Interner.Ref) Allocator.Error!Ref { | 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 | try b.instructions.append(b.gpa, .{ .tag = .arg, .data = .{ .none = {} }, .ty = ty }); | 85 | try b.instructions.append(b.gpa, .{ .tag = .arg, .data = .{ .none = {} }, .ty = ty }); |
| 86 | try b.body.insert(b.gpa, b.arg_count, ref); | 86 | try b.body.insert(b.gpa, b.arg_count, ref); |
| 87 | b.arg_count += 1; | 87 | b.arg_count += 1; |
| ... | @@ -89,7 +89,7 @@ pub const Builder = struct { | ... | @@ -89,7 +89,7 @@ pub const Builder = struct { |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | pub fn addAlloc(b: *Builder, size: u32, @"align": u32) Allocator.Error!Ref { | 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 | try b.instructions.append(b.gpa, .{ | 93 | try b.instructions.append(b.gpa, .{ |
| 94 | .tag = .alloc, | 94 | .tag = .alloc, |
| 95 | .data = .{ .alloc = .{ .size = size, .@"align" = @"align" } }, | 95 | .data = .{ .alloc = .{ .size = size, .@"align" = @"align" } }, |
| ... | @@ -101,14 +101,14 @@ pub const Builder = struct { | ... | @@ -101,14 +101,14 @@ pub const Builder = struct { |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | pub fn addInst(b: *Builder, tag: Ir.Inst.Tag, data: Ir.Inst.Data, ty: Interner.Ref) Allocator.Error!Ref { | 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 | try b.instructions.append(b.gpa, .{ .tag = tag, .data = data, .ty = ty }); | 105 | try b.instructions.append(b.gpa, .{ .tag = tag, .data = data, .ty = ty }); |
| 106 | try b.body.append(b.gpa, ref); | 106 | try b.body.append(b.gpa, ref); |
| 107 | return ref; | 107 | return ref; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | pub fn makeLabel(b: *Builder, name: [*:0]const u8) Allocator.Error!Ref { | 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 | try b.instructions.append(b.gpa, .{ .tag = .label, .data = .{ .label = name }, .ty = .void }); | 112 | try b.instructions.append(b.gpa, .{ .tag = .label, .data = .{ .label = name }, .ty = .void }); |
| 113 | return ref; | 113 | return ref; |
| 114 | } | 114 | } |
| ... | @@ -146,7 +146,7 @@ pub const Builder = struct { | ... | @@ -146,7 +146,7 @@ pub const Builder = struct { |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | pub fn addConstant(b: *Builder, val: Interner.Ref, ty: Interner.Ref) Allocator.Error!Ref { | 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 | try b.instructions.append(b.gpa, .{ | 150 | try b.instructions.append(b.gpa, .{ |
| 151 | .tag = .constant, | 151 | .tag = .constant, |
| 152 | .data = .{ .constant = val }, | 152 | .data = .{ .constant = val }, |
| ... | @@ -158,7 +158,7 @@ pub const Builder = struct { | ... | @@ -158,7 +158,7 @@ pub const Builder = struct { |
| 158 | pub fn addPhi(b: *Builder, inputs: []const Inst.Phi.Input, ty: Interner.Ref) Allocator.Error!Ref { | 158 | pub fn addPhi(b: *Builder, inputs: []const Inst.Phi.Input, ty: Interner.Ref) Allocator.Error!Ref { |
| 159 | const a = b.arena.allocator(); | 159 | const a = b.arena.allocator(); |
| 160 | const input_refs = try a.alloc(Ref, inputs.len * 2 + 1); | 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 | @memcpy(input_refs[1..], std.mem.bytesAsSlice(Ref, std.mem.sliceAsBytes(inputs))); | 162 | @memcpy(input_refs[1..], std.mem.bytesAsSlice(Ref, std.mem.sliceAsBytes(inputs))); |
| 163 | 163 | ||
| 164 | return b.addInst(.phi, .{ .phi = .{ .ptr = input_refs.ptr } }, ty); | 164 | return b.addInst(.phi, .{ .phi = .{ .ptr = input_refs.ptr } }, ty); |
| ... | @@ -359,7 +359,7 @@ pub const Inst = struct { | ... | @@ -359,7 +359,7 @@ pub const Inst = struct { |
| 359 | }; | 359 | }; |
| 360 | 360 | ||
| 361 | pub fn inputs(p: Phi) []Input { | 361 | pub fn inputs(p: Phi) []Input { |
| 362 | const len = @intFromEnum(p.ptr[0]) * 2; | 362 | const len = @backingInt(p.ptr[0]) * 2; |
| 363 | const slice = (p.ptr + 1)[0..len]; | 363 | const slice = (p.ptr + 1)[0..len]; |
| 364 | return std.mem.bytesAsSlice(Input, std.mem.sliceAsBytes(slice)); | 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,8 +403,8 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 403 | defer label_map.deinit(gpa); | 403 | defer label_map.deinit(gpa); |
| 404 | 404 | ||
| 405 | const ret_inst = decl.body.items[decl.body.items.len - 1]; | 405 | const ret_inst = decl.body.items[decl.body.items.len - 1]; |
| 406 | const ret_operand = data[@intFromEnum(ret_inst)].un; | 406 | const ret_operand = data[@backingInt(ret_inst)].un; |
| 407 | const ret_ty = decl.instructions.items(.ty)[@intFromEnum(ret_operand)]; | 407 | const ret_ty = decl.instructions.items(.ty)[@backingInt(ret_operand)]; |
| 408 | try ir.writeType(ret_ty, term); | 408 | try ir.writeType(ret_ty, term); |
| 409 | try term.setColor(REF); | 409 | try term.setColor(REF); |
| 410 | try w.print(" @{s}", .{name}); | 410 | try w.print(" @{s}", .{name}); |
| ... | @@ -414,7 +414,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, | ... | @@ -414,7 +414,7 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 414 | var arg_count: u32 = 0; | 414 | var arg_count: u32 = 0; |
| 415 | while (true) : (arg_count += 1) { | 415 | while (true) : (arg_count += 1) { |
| 416 | const ref = decl.body.items[arg_count]; | 416 | const ref = decl.body.items[arg_count]; |
| 417 | if (tags[@intFromEnum(ref)] != .arg) break; | 417 | if (tags[@backingInt(ref)] != .arg) break; |
| 418 | if (arg_count != 0) try w.writeAll(", "); | 418 | if (arg_count != 0) try w.writeAll(", "); |
| 419 | try ref_map.put(gpa, ref, {}); | 419 | try ref_map.put(gpa, ref, {}); |
| 420 | try ir.writeRef(decl, &ref_map, ref, term); | 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,14 +422,14 @@ fn dumpDecl(ir: *const Ir, decl: *const Decl, gpa: Allocator, name: []const u8, |
| 422 | } | 422 | } |
| 423 | try w.writeAll(") {\n"); | 423 | try w.writeAll(") {\n"); |
| 424 | for (decl.body.items[arg_count..]) |ref| { | 424 | for (decl.body.items[arg_count..]) |ref| { |
| 425 | switch (tags[@intFromEnum(ref)]) { | 425 | switch (tags[@backingInt(ref)]) { |
| 426 | .label => try label_map.put(gpa, ref, {}), | 426 | .label => try label_map.put(gpa, ref, {}), |
| 427 | else => {}, | 427 | else => {}, |
| 428 | } | 428 | } |
| 429 | } | 429 | } |
| 430 | 430 | ||
| 431 | for (decl.body.items[arg_count..]) |ref| { | 431 | for (decl.body.items[arg_count..]) |ref| { |
| 432 | const i = @intFromEnum(ref); | 432 | const i = @backingInt(ref); |
| 433 | const tag = tags[i]; | 433 | const tag = tags[i]; |
| 434 | switch (tag) { | 434 | switch (tag) { |
| 435 | .arg, .constant, .symbol => unreachable, | 435 | .arg, .constant, .symbol => unreachable, |
| ... | @@ -664,7 +664,7 @@ fn writeValue(ir: Ir, val: Interner.Ref, term: std.Io.Terminal) !void { | ... | @@ -664,7 +664,7 @@ fn writeValue(ir: Ir, val: Interner.Ref, term: std.Io.Terminal) !void { |
| 664 | fn writeRef(ir: Ir, decl: *const Decl, ref_map: *RefMap, ref: Ref, term: std.Io.Terminal) !void { | 664 | fn writeRef(ir: Ir, decl: *const Decl, ref_map: *RefMap, ref: Ref, term: std.Io.Terminal) !void { |
| 665 | const w = term.writer; | 665 | const w = term.writer; |
| 666 | assert(ref != .none); | 666 | assert(ref != .none); |
| 667 | const index = @intFromEnum(ref); | 667 | const index = @backingInt(ref); |
| 668 | const ty_ref = decl.instructions.items(.ty)[index]; | 668 | const ty_ref = decl.instructions.items(.ty)[index]; |
| 669 | if (decl.instructions.items(.tag)[index] == .constant) { | 669 | if (decl.instructions.items(.tag)[index] == .constant) { |
| 670 | try ir.writeType(ty_ref, term); | 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,7 +698,7 @@ fn writeNewRef(ir: Ir, gpa: Allocator, decl: *const Decl, ref_map: *RefMap, ref: |
| 698 | fn writeLabel(decl: *const Decl, label_map: *RefMap, ref: Ref, term: std.Io.Terminal) !void { | 698 | fn writeLabel(decl: *const Decl, label_map: *RefMap, ref: Ref, term: std.Io.Terminal) !void { |
| 699 | const w = term.writer; | 699 | const w = term.writer; |
| 700 | assert(ref != .none); | 700 | assert(ref != .none); |
| 701 | const index = @intFromEnum(ref); | 701 | const index = @backingInt(ref); |
| 702 | const label = decl.instructions.items(.data)[index].label; | 702 | const label = decl.instructions.items(.data)[index].label; |
| 703 | try term.setColor(REF); | 703 | try term.setColor(REF); |
| 704 | const label_index = label_map.getIndex(ref).?; | 704 | const label_index = label_map.getIndex(ref).?; |
lib/compiler/objcopy.zig+2-2| ... | @@ -600,7 +600,7 @@ const HexWriter = struct { | ... | @@ -600,7 +600,7 @@ const HexWriter = struct { |
| 600 | const parts = addressParts(self.address); | 600 | const parts = addressParts(self.address); |
| 601 | sum +%= parts[0]; | 601 | sum +%= parts[0]; |
| 602 | sum +%= parts[1]; | 602 | sum +%= parts[1]; |
| 603 | sum +%= @intFromEnum(self.payload); | 603 | sum +%= @backingInt(self.payload); |
| 604 | for (payload_bytes) |byte| { | 604 | for (payload_bytes) |byte| { |
| 605 | sum +%= byte; | 605 | sum +%= byte; |
| 606 | } | 606 | } |
| ... | @@ -618,7 +618,7 @@ const HexWriter = struct { | ... | @@ -618,7 +618,7 @@ const HexWriter = struct { |
| 618 | const line = try std.fmt.bufPrint(&outbuf, ":{0X:0>2}{1X:0>4}{2X:0>2}{3X}{4X:0>2}" ++ linesep, .{ | 618 | const line = try std.fmt.bufPrint(&outbuf, ":{0X:0>2}{1X:0>4}{2X:0>2}{3X}{4X:0>2}" ++ linesep, .{ |
| 619 | @as(u8, @intCast(payload_bytes.len)), | 619 | @as(u8, @intCast(payload_bytes.len)), |
| 620 | self.address, | 620 | self.address, |
| 621 | @intFromEnum(self.payload), | 621 | @backingInt(self.payload), |
| 622 | payload_bytes, | 622 | payload_bytes, |
| 623 | self.checksum(), | 623 | self.checksum(), |
| 624 | }); | 624 | }); |
lib/compiler/objdump.zig+12-12| ... | @@ -594,7 +594,7 @@ const coff = struct { | ... | @@ -594,7 +594,7 @@ const coff = struct { |
| 594 | 594 | ||
| 595 | const member_sig = try r.peek(4); | 595 | const member_sig = try r.peek(4); |
| 596 | const machine: std.coff.IMAGE.FILE.MACHINE = | 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 | const sig = std.mem.readInt(u16, member_sig[2..4], .little); | 598 | const sig = std.mem.readInt(u16, member_sig[2..4], .little); |
| 599 | 599 | ||
| 600 | const is_imp_lib = machine == std.coff.IMAGE.FILE.MACHINE.UNKNOWN and sig == 0xffff; | 600 | const is_imp_lib = machine == std.coff.IMAGE.FILE.MACHINE.UNKNOWN and sig == 0xffff; |
| ... | @@ -723,7 +723,7 @@ const coff = struct { | ... | @@ -723,7 +723,7 @@ const coff = struct { |
| 723 | if (d.opts.file_headers and d.element(.@"header-name")) | 723 | if (d.opts.file_headers and d.element(.@"header-name")) |
| 724 | try w.writeAll("COFF Optional Header:\n"); | 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 | const num_directory_entries, const image_base = switch (magic) { | 727 | const num_directory_entries, const image_base = switch (magic) { |
| 728 | inline .PE32, .@"PE32+" => |v| num_data_dirs: { | 728 | inline .PE32, .@"PE32+" => |v| num_data_dirs: { |
| 729 | const OptionalHeader = if (v == .PE32) | 729 | const OptionalHeader = if (v == .PE32) |
| ... | @@ -795,7 +795,7 @@ const coff = struct { | ... | @@ -795,7 +795,7 @@ const coff = struct { |
| 795 | if (d.opts.file_headers) | 795 | if (d.opts.file_headers) |
| 796 | try w.print( | 796 | try w.print( |
| 797 | "{x: >16} {x: >8} {t}\n", | 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 | if (d.opts.file_headers and d.element(.newlines)) try w.writeByte('\n'); | 801 | if (d.opts.file_headers and d.element(.newlines)) try w.writeByte('\n'); |
| ... | @@ -980,7 +980,7 @@ const coff = struct { | ... | @@ -980,7 +980,7 @@ const coff = struct { |
| 980 | .ABSOLUTE => w.writeAll(" ABS"), | 980 | .ABSOLUTE => w.writeAll(" ABS"), |
| 981 | .DEBUG => w.writeAll("DEBUG"), | 981 | .DEBUG => w.writeAll("DEBUG"), |
| 982 | else => |v| { | 982 | else => |v| { |
| 983 | const backing = @intFromEnum(v); | 983 | const backing = @backingInt(v); |
| 984 | const fmt = "{x: >5}"; | 984 | const fmt = "{x: >5}"; |
| 985 | if (backing >= 0) | 985 | if (backing >= 0) |
| 986 | try w.print(fmt, .{@as(u15, @intCast(backing))}) | 986 | try w.print(fmt, .{@as(u15, @intCast(backing))}) |
| ... | @@ -1009,7 +1009,7 @@ const coff = struct { | ... | @@ -1009,7 +1009,7 @@ const coff = struct { |
| 1009 | .complex_type = .FUNCTION, | 1009 | .complex_type = .FUNCTION, |
| 1010 | .base_type = .NULL, | 1010 | .base_type = .NULL, |
| 1011 | } and | 1011 | } and |
| 1012 | @intFromEnum(symbol.section_number) > 0) | 1012 | @backingInt(symbol.section_number) > 0) |
| 1013 | { | 1013 | { |
| 1014 | try w.writeAll("TODO function aux symbol"); | 1014 | try w.writeAll("TODO function aux symbol"); |
| 1015 | } else if (symbol.type == std.coff.SymType{ | 1015 | } else if (symbol.type == std.coff.SymType{ |
| ... | @@ -1064,10 +1064,10 @@ const coff = struct { | ... | @@ -1064,10 +1064,10 @@ const coff = struct { |
| 1064 | symbol.value == 0 and | 1064 | symbol.value == 0 and |
| 1065 | switch (symbol.section_number) { | 1065 | switch (symbol.section_number) { |
| 1066 | .UNDEFINED, .DEBUG, .ABSOLUTE => false, | 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 | try w.writeAll(" Section "); | 1071 | try w.writeAll(" Section "); |
| 1072 | 1072 | ||
| 1073 | if (section_i >= sections.items.len) { | 1073 | if (section_i >= sections.items.len) { |
| ... | @@ -1160,7 +1160,7 @@ const coff = struct { | ... | @@ -1160,7 +1160,7 @@ const coff = struct { |
| 1160 | void => try w.writeAll("(unknown arch)"), | 1160 | void => try w.writeAll("(unknown arch)"), |
| 1161 | else => |RelocationType| try w.print( | 1161 | else => |RelocationType| try w.print( |
| 1162 | "{t: <17} ", | 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,7 +1263,7 @@ const coff = struct { |
| 1263 | 1263 | ||
| 1264 | // All the variable length fields should be contained within this directory. | 1264 | // All the variable length fields should be contained within this directory. |
| 1265 | // Read it entirely to avoid needing to seek per-name when iterating. | 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 | const dir_end_rva = dir.virtual_address + dir.size; | 1267 | const dir_end_rva = dir.virtual_address + dir.size; |
| 1268 | const dir_loc = fr.logicalPos(); | 1268 | const dir_loc = fr.logicalPos(); |
| 1269 | const dir_slice = try r.readAlloc(gpa, dir.size); | 1269 | const dir_slice = try r.readAlloc(gpa, dir.size); |
| ... | @@ -1533,8 +1533,8 @@ const coff = struct { | ... | @@ -1533,8 +1533,8 @@ const coff = struct { |
| 1533 | data_dirs: []const std.coff.ImageDataDirectory, | 1533 | data_dirs: []const std.coff.ImageDataDirectory, |
| 1534 | entry: DIRECTORY_ENTRY, | 1534 | entry: DIRECTORY_ENTRY, |
| 1535 | ) !?u16 { | 1535 | ) !?u16 { |
| 1536 | if (@intFromEnum(entry) < data_dirs.len) blk: { | 1536 | if (@backingInt(entry) < data_dirs.len) blk: { |
| 1537 | const rva = data_dirs[@intFromEnum(entry)].virtual_address; | 1537 | const rva = data_dirs[@backingInt(entry)].virtual_address; |
| 1538 | if (rva == 0) break :blk; | 1538 | if (rva == 0) break :blk; |
| 1539 | 1539 | ||
| 1540 | const section_index = sectionContainingRva(rva_index, sections, rva) orelse | 1540 | const section_index = sectionContainingRva(rva_index, sections, rva) orelse |
| ... | @@ -1603,7 +1603,7 @@ const coff = struct { | ... | @@ -1603,7 +1603,7 @@ const coff = struct { |
| 1603 | .ABSOLUTE => w.writeAll(" ABS"), | 1603 | .ABSOLUTE => w.writeAll(" ABS"), |
| 1604 | .DEBUG => w.writeAll("DEBUG"), | 1604 | .DEBUG => w.writeAll("DEBUG"), |
| 1605 | else => |v| { | 1605 | else => |v| { |
| 1606 | const backing = @intFromEnum(v); | 1606 | const backing = @backingInt(v); |
| 1607 | const fmt = "{x: >5}"; | 1607 | const fmt = "{x: >5}"; |
| 1608 | if (backing >= 0) | 1608 | if (backing >= 0) |
| 1609 | try w.print(fmt, .{@as(u15, @intCast(backing))}) | 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,7 +198,7 @@ pub fn main(init: std.process.Init) !void { |
| 198 | 198 | ||
| 199 | if (zir.hasCompileErrors()) { | 199 | if (zir.hasCompileErrors()) { |
| 200 | more_fixups.clearRetainingCapacity(); | 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 | assert(payload_index != 0); | 202 | assert(payload_index != 0); |
| 203 | const header = zir.extraData(Zir.Inst.CompileErrors, payload_index); | 203 | const header = zir.extraData(Zir.Inst.CompileErrors, payload_index); |
| 204 | var extra_index = header.end; | 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,7 +124,7 @@ pub fn read(reader: *std.Io.Reader, max_size: u64) ReadError!BitmapInfo { |
| 124 | 124 | ||
| 125 | bitmap_info.colors_in_palette = try dib_header.numColorsInTable(); | 125 | bitmap_info.colors_in_palette = try dib_header.numColorsInTable(); |
| 126 | bitmap_info.bytes_per_color_palette_element = 4; | 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 | if (bitmap_info.getByteLenBetweenHeadersAndPixels() < bitmap_info.getBitmasksByteLen()) { | 129 | if (bitmap_info.getByteLenBetweenHeadersAndPixels() < bitmap_info.getBitmasksByteLen()) { |
| 130 | return error.MissingBitfieldMasks; | 130 | return error.MissingBitfieldMasks; |
lib/compiler/resinator/cli.zig+1-1| ... | @@ -369,7 +369,7 @@ pub const Options = struct { | ... | @@ -369,7 +369,7 @@ pub const Options = struct { |
| 369 | try writer.print("Default language: {s} (id=0x{x})\n", .{ language_name, language_id }); | 369 | try writer.print("Default language: {s} (id=0x{x})\n", .{ language_name, language_id }); |
| 370 | 370 | ||
| 371 | const code_page = self.default_code_page orelse .windows1252; | 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,7 +191,7 @@ pub const CodePage = blk: { |
| 191 | 191 | ||
| 192 | pub fn isSupported(code_page: CodePage) bool { | 192 | pub fn isSupported(code_page: CodePage) bool { |
| 193 | inline for (@typeInfo(SupportedCodePage).@"enum".field_names) |field_name| { | 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 | return true; | 195 | return true; |
| 196 | } | 196 | } |
| 197 | } | 197 | } |
| ... | @@ -213,7 +213,7 @@ pub fn getByIdentifier(identifier: u16) !CodePage { | ... | @@ -213,7 +213,7 @@ pub fn getByIdentifier(identifier: u16) !CodePage { |
| 213 | pub fn getByIdentifierEnsureSupported(identifier: u16) !SupportedCodePage { | 213 | pub fn getByIdentifierEnsureSupported(identifier: u16) !SupportedCodePage { |
| 214 | const code_page = try getByIdentifier(identifier); | 214 | const code_page = try getByIdentifier(identifier); |
| 215 | return if (isSupported(code_page)) | 215 | return if (isSupported(code_page)) |
| 216 | @enumFromInt(@intFromEnum(code_page)) | 216 | @fromBackingInt(@intCast(@backingInt(code_page))) |
| 217 | else | 217 | else |
| 218 | error.UnsupportedCodePage; | 218 | error.UnsupportedCodePage; |
| 219 | } | 219 | } |
lib/compiler/resinator/compile.zig+8-8| ... | @@ -606,7 +606,7 @@ pub const Compiler = struct { | ... | @@ -606,7 +606,7 @@ pub const Compiler = struct { |
| 606 | .GROUP_CURSOR => .ANICURSOR, | 606 | .GROUP_CURSOR => .ANICURSOR, |
| 607 | else => unreachable, | 607 | else => unreachable, |
| 608 | }; | 608 | }; |
| 609 | header.type_value.ordinal = @intFromEnum(new_predefined_type); | 609 | header.type_value.ordinal = @backingInt(new_predefined_type); |
| 610 | header.memory_flags = MemoryFlags.defaults(new_predefined_type); | 610 | header.memory_flags = MemoryFlags.defaults(new_predefined_type); |
| 611 | header.applyMemoryFlags(node.common_resource_attributes, self.source); | 611 | header.applyMemoryFlags(node.common_resource_attributes, self.source); |
| 612 | header.data_size = std.math.cast(u32, try file_reader.getSize()) orelse { | 612 | header.data_size = std.math.cast(u32, try file_reader.getSize()) orelse { |
| ... | @@ -668,7 +668,7 @@ pub const Compiler = struct { | ... | @@ -668,7 +668,7 @@ pub const Compiler = struct { |
| 668 | applyToGroupMemoryFlags(&header.memory_flags, node.common_resource_attributes, self.source); | 668 | applyToGroupMemoryFlags(&header.memory_flags, node.common_resource_attributes, self.source); |
| 669 | 669 | ||
| 670 | const first_icon_id = self.state.icon_id; | 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 | for (icon_dir.entries, 0..) |*entry, entry_i_usize| { | 672 | for (icon_dir.entries, 0..) |*entry, entry_i_usize| { |
| 673 | // We know that the entry index must fit within a u16, so | 673 | // We know that the entry index must fit within a u16, so |
| 674 | // cast it here to simplify usage sites. | 674 | // cast it here to simplify usage sites. |
| ... | @@ -1909,7 +1909,7 @@ pub const Compiler = struct { | ... | @@ -1909,7 +1909,7 @@ pub const Compiler = struct { |
| 1909 | } | 1909 | } |
| 1910 | 1910 | ||
| 1911 | if (res.ControlClass.fromControl(control_type)) |control_class| { | 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 | try ordinal.write(data_writer); | 1913 | try ordinal.write(data_writer); |
| 1914 | } else { | 1914 | } else { |
| 1915 | const class_node = control.class.?; | 1915 | const class_node = control.class.?; |
| ... | @@ -1944,7 +1944,7 @@ pub const Compiler = struct { | ... | @@ -1944,7 +1944,7 @@ pub const Compiler = struct { |
| 1944 | const parsed = try self.parseQuotedStringAsWideString(literal_node.token); | 1944 | const parsed = try self.parseQuotedStringAsWideString(literal_node.token); |
| 1945 | defer self.allocator.free(parsed); | 1945 | defer self.allocator.free(parsed); |
| 1946 | if (rc.ControlClass.fromWideString(parsed)) |control_class| { | 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 | try ordinal.write(data_writer); | 1948 | try ordinal.write(data_writer); |
| 1949 | } else { | 1949 | } else { |
| 1950 | // NUL acts as a terminator | 1950 | // NUL acts as a terminator |
| ... | @@ -1959,7 +1959,7 @@ pub const Compiler = struct { | ... | @@ -1959,7 +1959,7 @@ pub const Compiler = struct { |
| 1959 | const literal_slice = literal_node.token.slice(self.source); | 1959 | const literal_slice = literal_node.token.slice(self.source); |
| 1960 | // This succeeding is guaranteed by the parser | 1960 | // This succeeding is guaranteed by the parser |
| 1961 | const control_class = rc.ControlClass.map.get(literal_slice) orelse unreachable; | 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 | try ordinal.write(data_writer); | 1963 | try ordinal.write(data_writer); |
| 1964 | } | 1964 | } |
| 1965 | } | 1965 | } |
| ... | @@ -2620,7 +2620,7 @@ pub const Compiler = struct { | ... | @@ -2620,7 +2620,7 @@ pub const Compiler = struct { |
| 2620 | const type_value = type: { | 2620 | const type_value = type: { |
| 2621 | const resource_type = ResourceType.fromString(type_bytes); | 2621 | const resource_type = ResourceType.fromString(type_bytes); |
| 2622 | if (res.RT.fromResource(resource_type)) |rt_constant| { | 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 | } else { | 2624 | } else { |
| 2625 | break :type try NameOrOrdinal.fromString(allocator, type_bytes); | 2625 | break :type try NameOrOrdinal.fromString(allocator, type_bytes); |
| 2626 | } | 2626 | } |
| ... | @@ -2974,7 +2974,7 @@ pub const FontDir = struct { | ... | @@ -2974,7 +2974,7 @@ pub const FontDir = struct { |
| 2974 | 2974 | ||
| 2975 | var header = Compiler.ResourceHeader{ | 2975 | var header = Compiler.ResourceHeader{ |
| 2976 | .name_value = try NameOrOrdinal.nameFromString(compiler.allocator, .{ .slice = "FONTDIR", .code_page = .windows1252 }), | 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 | .memory_flags = res.MemoryFlags.defaults(res.RT.FONTDIR), | 2978 | .memory_flags = res.MemoryFlags.defaults(res.RT.FONTDIR), |
| 2979 | .language = compiler.state.language, | 2979 | .language = compiler.state.language, |
| 2980 | .version = compiler.state.version, | 2980 | .version = compiler.state.version, |
| ... | @@ -3230,7 +3230,7 @@ pub const StringTable = struct { | ... | @@ -3230,7 +3230,7 @@ pub const StringTable = struct { |
| 3230 | 3230 | ||
| 3231 | const header = Compiler.ResourceHeader{ | 3231 | const header = Compiler.ResourceHeader{ |
| 3232 | .name_value = .{ .ordinal = block_id }, | 3232 | .name_value = .{ .ordinal = block_id }, |
| 3233 | .type_value = .{ .ordinal = @intFromEnum(res.RT.STRING) }, | 3233 | .type_value = .{ .ordinal = @backingInt(res.RT.STRING) }, |
| 3234 | .memory_flags = self.memory_flags, | 3234 | .memory_flags = self.memory_flags, |
| 3235 | .language = language, | 3235 | .language = language, |
| 3236 | .version = self.version, | 3236 | .version = self.version, |
lib/compiler/resinator/cvtres.zig+15-15| ... | @@ -40,7 +40,7 @@ pub const Resource = struct { | ... | @@ -40,7 +40,7 @@ pub const Resource = struct { |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | pub fn isDlgInclude(resource: Resource) bool { | 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,7 +306,7 @@ pub fn writeCoff( |
| 306 | try writeSymbol(writer, .{ | 306 | try writeSymbol(writer, .{ |
| 307 | .name = ".rsrc$01".*, | 307 | .name = ".rsrc$01".*, |
| 308 | .value = 0, | 308 | .value = 0, |
| 309 | .section_number = @enumFromInt(1), | 309 | .section_number = @fromBackingInt(@intCast(1)), |
| 310 | .type = .{ | 310 | .type = .{ |
| 311 | .base_type = .NULL, | 311 | .base_type = .NULL, |
| 312 | .complex_type = .NULL, | 312 | .complex_type = .NULL, |
| ... | @@ -327,7 +327,7 @@ pub fn writeCoff( | ... | @@ -327,7 +327,7 @@ pub fn writeCoff( |
| 327 | try writeSymbol(writer, .{ | 327 | try writeSymbol(writer, .{ |
| 328 | .name = ".rsrc$02".*, | 328 | .name = ".rsrc$02".*, |
| 329 | .value = 0, | 329 | .value = 0, |
| 330 | .section_number = @enumFromInt(2), | 330 | .section_number = @fromBackingInt(@intCast(2)), |
| 331 | .type = .{ | 331 | .type = .{ |
| 332 | .base_type = .NULL, | 332 | .base_type = .NULL, |
| 333 | .complex_type = .NULL, | 333 | .complex_type = .NULL, |
| ... | @@ -383,10 +383,10 @@ pub fn writeCoff( | ... | @@ -383,10 +383,10 @@ pub fn writeCoff( |
| 383 | fn writeSymbol(writer: *std.Io.Writer, symbol: std.coff.Symbol) !void { | 383 | fn writeSymbol(writer: *std.Io.Writer, symbol: std.coff.Symbol) !void { |
| 384 | try writer.writeAll(&symbol.name); | 384 | try writer.writeAll(&symbol.name); |
| 385 | try writer.writeInt(u32, symbol.value, .little); | 385 | try writer.writeInt(u32, symbol.value, .little); |
| 386 | try writer.writeInt(i16, @intFromEnum(symbol.section_number), .little); | 386 | try writer.writeInt(i16, @backingInt(symbol.section_number), .little); |
| 387 | try writer.writeInt(u8, @intFromEnum(symbol.type.base_type), .little); | 387 | try writer.writeInt(u8, @backingInt(symbol.type.base_type), .little); |
| 388 | try writer.writeInt(u8, @intFromEnum(symbol.type.complex_type), .little); | 388 | try writer.writeInt(u8, @backingInt(symbol.type.complex_type), .little); |
| 389 | try writer.writeInt(u8, @intFromEnum(symbol.storage_class), .little); | 389 | try writer.writeInt(u8, @backingInt(symbol.storage_class), .little); |
| 390 | try writer.writeInt(u8, symbol.number_of_aux_symbols, .little); | 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,7 +396,7 @@ fn writeSectionDefinition(writer: *std.Io.Writer, def: std.coff.SectionDefinitio |
| 396 | try writer.writeInt(u16, def.number_of_linenumbers, .little); | 396 | try writer.writeInt(u16, def.number_of_linenumbers, .little); |
| 397 | try writer.writeInt(u32, def.checksum, .little); | 397 | try writer.writeInt(u32, def.checksum, .little); |
| 398 | try writer.writeInt(u16, def.number, .little); | 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 | try writer.writeAll(&def.unused); | 400 | try writer.writeAll(&def.unused); |
| 401 | } | 401 | } |
| 402 | 402 | ||
| ... | @@ -890,7 +890,7 @@ const ResourceTree = struct { | ... | @@ -890,7 +890,7 @@ const ResourceTree = struct { |
| 890 | symbols[i] = .{ | 890 | symbols[i] = .{ |
| 891 | .name = name_buf, | 891 | .name = name_buf, |
| 892 | .value = relocation.data_offset, | 892 | .value = relocation.data_offset, |
| 893 | .section_number = @enumFromInt(2), | 893 | .section_number = @fromBackingInt(@intCast(2)), |
| 894 | .type = .{ | 894 | .type = .{ |
| 895 | .base_type = .NULL, | 895 | .base_type = .NULL, |
| 896 | .complex_type = .NULL, | 896 | .complex_type = .NULL, |
| ... | @@ -1056,7 +1056,7 @@ pub const supported_targets = struct { | ... | @@ -1056,7 +1056,7 @@ pub const supported_targets = struct { |
| 1056 | comptime { | 1056 | comptime { |
| 1057 | const info = @typeInfo(Arch).@"enum"; | 1057 | const info = @typeInfo(Arch).@"enum"; |
| 1058 | for (info.field_names, info.field_values) |field_name, field_value| { | 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 | @compileError(std.fmt.comptimePrint("'{s}' missing from ordered_for_display", .{field_name})); | 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,11 +1089,11 @@ pub const supported_targets = struct { |
| 1089 | // https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#type-indicators | 1089 | // https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#type-indicators |
| 1090 | pub fn rvaRelocationTypeIndicator(target: std.coff.IMAGE.FILE.MACHINE) ?u16 { | 1090 | pub fn rvaRelocationTypeIndicator(target: std.coff.IMAGE.FILE.MACHINE) ?u16 { |
| 1091 | return switch (target) { | 1091 | return switch (target) { |
| 1092 | .AMD64 => @intFromEnum(std.coff.IMAGE.REL.AMD64.ADDR32NB), | 1092 | .AMD64 => @backingInt(std.coff.IMAGE.REL.AMD64.ADDR32NB), |
| 1093 | .I386 => @intFromEnum(std.coff.IMAGE.REL.I386.DIR32NB), | 1093 | .I386 => @backingInt(std.coff.IMAGE.REL.I386.DIR32NB), |
| 1094 | .ARMNT => @intFromEnum(std.coff.IMAGE.REL.ARM.ADDR32NB), | 1094 | .ARMNT => @backingInt(std.coff.IMAGE.REL.ARM.ADDR32NB), |
| 1095 | .ARM64, .ARM64EC, .ARM64X => @intFromEnum(std.coff.IMAGE.REL.ARM64.ADDR32NB), | 1095 | .ARM64, .ARM64EC, .ARM64X => @backingInt(std.coff.IMAGE.REL.ARM64.ADDR32NB), |
| 1096 | .IA64 => @intFromEnum(std.coff.IMAGE.REL.IA64.DIR32NB), | 1096 | .IA64 => @backingInt(std.coff.IMAGE.REL.IA64.DIR32NB), |
| 1097 | .EBC => 0x1, // This is what cvtres.exe writes for this target, unsure where it comes from | 1097 | .EBC => 0x1, // This is what cvtres.exe writes for this target, unsure where it comes from |
| 1098 | else => null, | 1098 | else => null, |
| 1099 | }; | 1099 | }; |
lib/compiler/resinator/ico.zig+1-1| ... | @@ -123,7 +123,7 @@ pub const IconDir = struct { | ... | @@ -123,7 +123,7 @@ pub const IconDir = struct { |
| 123 | 123 | ||
| 124 | pub fn writeResData(self: IconDir, writer: *std.Io.Writer, first_image_id: u16) !void { | 124 | pub fn writeResData(self: IconDir, writer: *std.Io.Writer, first_image_id: u16) !void { |
| 125 | try writer.writeInt(u16, 0, .little); | 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 | // We know that entries.len must fit into a u16 | 127 | // We know that entries.len must fit into a u16 |
| 128 | try writer.writeInt(u16, @as(u16, @intCast(self.entries.len)), .little); | 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,7 +74,7 @@ test parseInt { |
| 74 | pub fn tagToInt(tag: []const u8) error{InvalidLanguageTag}!u16 { | 74 | pub fn tagToInt(tag: []const u8) error{InvalidLanguageTag}!u16 { |
| 75 | const maybe_id = try tagToId(tag); | 75 | const maybe_id = try tagToId(tag); |
| 76 | if (maybe_id) |id| { | 76 | if (maybe_id) |id| { |
| 77 | return @intFromEnum(id); | 77 | return @backingInt(id); |
| 78 | } else { | 78 | } else { |
| 79 | return LOCALE_CUSTOM_UNSPECIFIED; | 79 | return LOCALE_CUSTOM_UNSPECIFIED; |
| 80 | } | 80 | } |
lib/compiler/resinator/parse.zig+4-4| ... | @@ -151,7 +151,7 @@ pub const Parser = struct { | ... | @@ -151,7 +151,7 @@ pub const Parser = struct { |
| 151 | }; | 151 | }; |
| 152 | try self.nextToken(.normal); | 152 | try self.nextToken(.normal); |
| 153 | 153 | ||
| 154 | const type_i = @intFromEnum(optional_statement_type); | 154 | const type_i = @backingInt(optional_statement_type); |
| 155 | if (last_statement_per_type[type_i] != null) { | 155 | if (last_statement_per_type[type_i] != null) { |
| 156 | statement_type_has_duplicates[type_i] = true; | 156 | statement_type_has_duplicates[type_i] = true; |
| 157 | } | 157 | } |
| ... | @@ -300,13 +300,13 @@ pub const Parser = struct { | ... | @@ -300,13 +300,13 @@ pub const Parser = struct { |
| 300 | const slice = statement_identifier.slice(self.lexer.buffer); | 300 | const slice = statement_identifier.slice(self.lexer.buffer); |
| 301 | const optional_statement_type = rc.OptionalStatements.map.get(slice) orelse | 301 | const optional_statement_type = rc.OptionalStatements.map.get(slice) orelse |
| 302 | rc.OptionalStatements.dialog_map.get(slice).?; | 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 | .font_statement => { | 305 | .font_statement => { |
| 306 | break :type_i @intFromEnum(rc.OptionalStatements.font); | 306 | break :type_i @backingInt(rc.OptionalStatements.font); |
| 307 | }, | 307 | }, |
| 308 | .language_statement => { | 308 | .language_statement => { |
| 309 | break :type_i @intFromEnum(rc.OptionalStatements.language); | 309 | break :type_i @backingInt(rc.OptionalStatements.language); |
| 310 | }, | 310 | }, |
| 311 | else => unreachable, | 311 | else => unreachable, |
| 312 | } | 312 | } |
lib/compiler/resinator/rc.zig+8-8| ... | @@ -76,7 +76,7 @@ pub const ResourceType = enum { | ... | @@ -76,7 +76,7 @@ pub const ResourceType = enum { |
| 76 | const maybe_ordinal = res.NameOrOrdinal.maybeOrdinalFromString(bytes); | 76 | const maybe_ordinal = res.NameOrOrdinal.maybeOrdinalFromString(bytes); |
| 77 | if (maybe_ordinal) |ordinal| { | 77 | if (maybe_ordinal) |ordinal| { |
| 78 | if (ordinal.ordinal >= 256) return .user_defined; | 78 | if (ordinal.ordinal >= 256) return .user_defined; |
| 79 | return fromRT(@enumFromInt(ordinal.ordinal)); | 79 | return fromRT(@fromBackingInt(@intCast(ordinal.ordinal))); |
| 80 | } | 80 | } |
| 81 | return map.get(bytes.slice) orelse .user_defined; | 81 | return map.get(bytes.slice) orelse .user_defined; |
| 82 | } | 82 | } |
| ... | @@ -133,13 +133,13 @@ pub const ResourceType = enum { | ... | @@ -133,13 +133,13 @@ pub const ResourceType = enum { |
| 133 | .toolbar, .versioninfo, .vxd => @tagName(resource), | 133 | .toolbar, .versioninfo, .vxd => @tagName(resource), |
| 134 | // zig fmt: on | 134 | // zig fmt: on |
| 135 | .user_defined => "user-defined", | 135 | .user_defined => "user-defined", |
| 136 | .cursor_num => std.fmt.comptimePrint("{d} (cursor)", .{@intFromEnum(res.RT.CURSOR)}), | 136 | .cursor_num => std.fmt.comptimePrint("{d} (cursor)", .{@backingInt(res.RT.CURSOR)}), |
| 137 | .icon_num => std.fmt.comptimePrint("{d} (icon)", .{@intFromEnum(res.RT.ICON)}), | 137 | .icon_num => std.fmt.comptimePrint("{d} (icon)", .{@backingInt(res.RT.ICON)}), |
| 138 | .string_num => std.fmt.comptimePrint("{d} (string)", .{@intFromEnum(res.RT.STRING)}), | 138 | .string_num => std.fmt.comptimePrint("{d} (string)", .{@backingInt(res.RT.STRING)}), |
| 139 | .anicursor_num => std.fmt.comptimePrint("{d} (anicursor)", .{@intFromEnum(res.RT.ANICURSOR)}), | 139 | .anicursor_num => std.fmt.comptimePrint("{d} (anicursor)", .{@backingInt(res.RT.ANICURSOR)}), |
| 140 | .aniicon_num => std.fmt.comptimePrint("{d} (aniicon)", .{@intFromEnum(res.RT.ANIICON)}), | 140 | .aniicon_num => std.fmt.comptimePrint("{d} (aniicon)", .{@backingInt(res.RT.ANIICON)}), |
| 141 | .fontdir_num => std.fmt.comptimePrint("{d} (fontdir)", .{@intFromEnum(res.RT.FONTDIR)}), | 141 | .fontdir_num => std.fmt.comptimePrint("{d} (fontdir)", .{@backingInt(res.RT.FONTDIR)}), |
| 142 | .manifest_num => std.fmt.comptimePrint("{d} (manifest)", .{@intFromEnum(res.RT.MANIFEST)}), | 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,7 +407,7 @@ pub const NameOrOrdinal = union(enum) { |
| 407 | switch (self) { | 407 | switch (self) { |
| 408 | .ordinal => |ordinal| { | 408 | .ordinal => |ordinal| { |
| 409 | if (ordinal >= 256) return null; | 409 | if (ordinal >= 256) return null; |
| 410 | switch (@as(RT, @enumFromInt(ordinal))) { | 410 | switch (@as(RT, @fromBackingInt(@intCast(ordinal)))) { |
| 411 | .ACCELERATOR, | 411 | .ACCELERATOR, |
| 412 | .ANICURSOR, | 412 | .ANICURSOR, |
| 413 | .ANIICON, | 413 | .ANIICON, |
| ... | @@ -456,7 +456,7 @@ pub const NameOrOrdinal = union(enum) { | ... | @@ -456,7 +456,7 @@ pub const NameOrOrdinal = union(enum) { |
| 456 | try w.print("{f}", .{std.unicode.fmtUtf16Le(name)}); | 456 | try w.print("{f}", .{std.unicode.fmtUtf16Le(name)}); |
| 457 | }, | 457 | }, |
| 458 | .ordinal => |ordinal| { | 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 | try w.print("{s}", .{predefined_type_name}); | 460 | try w.print("{s}", .{predefined_type_name}); |
| 461 | } else { | 461 | } else { |
| 462 | try w.print("{d}", .{ordinal}); | 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,7 +187,7 @@ fn mainServer(init: std.process.Init.Minimal) !void { |
| 187 | defer io_instance.deinit(); | 187 | defer io_instance.deinit(); |
| 188 | const io = io_instance.io(); | 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 | const amount_or_instance = try server.receiveBody_u64(); | 191 | const amount_or_instance = try server.receiveBody_u64(); |
| 192 | const main_instance = mode == .iterations or amount_or_instance == 0; | 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,7 +249,7 @@ fn mainServer(init: std.process.Init.Minimal) !void { |
| 249 | }, | 249 | }, |
| 250 | 250 | ||
| 251 | else => { | 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 | std.process.exit(1); | 253 | std.process.exit(1); |
| 254 | }, | 254 | }, |
| 255 | } | 255 | } |
| ... | @@ -351,10 +351,10 @@ pub fn log( | ... | @@ -351,10 +351,10 @@ pub fn log( |
| 351 | args: anytype, | 351 | args: anytype, |
| 352 | ) void { | 352 | ) void { |
| 353 | @disableInstrumentation(); | 353 | @disableInstrumentation(); |
| 354 | if (@intFromEnum(message_level) <= @intFromEnum(std.log.Level.err)) { | 354 | if (@backingInt(message_level) <= @backingInt(std.log.Level.err)) { |
| 355 | log_err_count +|= 1; | 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 | std.debug.print( | 358 | std.debug.print( |
| 359 | "[" ++ @tagName(scope) ++ "] (" ++ @tagName(message_level) ++ "): " ++ format ++ "\n", | 359 | "[" ++ @tagName(scope) ++ "] (" ++ @tagName(message_level) ++ "): " ++ format ++ "\n", |
| 360 | args, | 360 | args, |
| ... | @@ -513,7 +513,7 @@ var fuzz_runner: if (builtin.fuzz) struct { | ... | @@ -513,7 +513,7 @@ var fuzz_runner: if (builtin.fuzz) struct { |
| 513 | while (true) { | 513 | while (true) { |
| 514 | const hdr = try server.receiveMessage(); | 514 | const hdr = try server.receiveMessage(); |
| 515 | if (hdr.tag != .new_fuzz_input) { | 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 | const test_i = try server.receiveBody_u32(); | 518 | const test_i = try server.receiveBody_u32(); |
| 519 | const input_len = hdr.bytes_len - 4; | 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,7 +252,7 @@ pub const Node = extern union { |
| 252 | root_ref, | 252 | root_ref, |
| 253 | 253 | ||
| 254 | pub const last_no_payload_tag = Tag.@"break"; | 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 | pub fn Type(comptime t: Tag) type { | 257 | pub fn Type(comptime t: Tag) type { |
| 258 | return switch (t) { | 258 | return switch (t) { |
| ... | @@ -416,8 +416,8 @@ pub const Node = extern union { | ... | @@ -416,8 +416,8 @@ pub const Node = extern union { |
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | pub fn init(comptime t: Tag) Node { | 418 | pub fn init(comptime t: Tag) Node { |
| 419 | comptime std.debug.assert(@intFromEnum(t) < Tag.no_payload_count); | 419 | comptime std.debug.assert(@backingInt(t) < Tag.no_payload_count); |
| 420 | return .{ .tag_if_small_enough = @intFromEnum(t) }; | 420 | return .{ .tag_if_small_enough = @backingInt(t) }; |
| 421 | } | 421 | } |
| 422 | 422 | ||
| 423 | pub fn create(comptime t: Tag, ally: Allocator, data: Data(t)) error{OutOfMemory}!Node { | 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,7 +436,7 @@ pub const Node = extern union { |
| 436 | 436 | ||
| 437 | pub fn tag(self: Node) Tag { | 437 | pub fn tag(self: Node) Tag { |
| 438 | if (self.tag_if_small_enough < Tag.no_payload_count) { | 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 | } else { | 440 | } else { |
| 441 | return self.ptr_otherwise.tag; | 441 | return self.ptr_otherwise.tag; |
| 442 | } | 442 | } |
| ... | @@ -453,7 +453,7 @@ pub const Node = extern union { | ... | @@ -453,7 +453,7 @@ pub const Node = extern union { |
| 453 | } | 453 | } |
| 454 | 454 | ||
| 455 | pub fn initPayload(payload: *Payload) Node { | 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 | return .{ .ptr_otherwise = payload }; | 457 | return .{ .ptr_otherwise = payload }; |
| 458 | } | 458 | } |
| 459 | 459 | ||
| ... | @@ -913,13 +913,13 @@ const Context = struct { | ... | @@ -913,13 +913,13 @@ const Context = struct { |
| 913 | fn listToSpan(c: *Context, list: []const NodeIndex) Allocator.Error!NodeSubRange { | 913 | fn listToSpan(c: *Context, list: []const NodeIndex) Allocator.Error!NodeSubRange { |
| 914 | try c.extra_data.appendSlice(c.gpa, @ptrCast(list)); | 914 | try c.extra_data.appendSlice(c.gpa, @ptrCast(list)); |
| 915 | return .{ | 915 | return .{ |
| 916 | .start = @enumFromInt(c.extra_data.items.len - list.len), | 916 | .start = @fromBackingInt(@intCast(c.extra_data.items.len - list.len)), |
| 917 | .end = @enumFromInt(c.extra_data.items.len), | 917 | .end = @fromBackingInt(@intCast(c.extra_data.items.len)), |
| 918 | }; | 918 | }; |
| 919 | } | 919 | } |
| 920 | 920 | ||
| 921 | fn addNode(c: *Context, elem: std.zig.Ast.Node) Allocator.Error!NodeIndex { | 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 | try c.nodes.append(c.gpa, elem); | 923 | try c.nodes.append(c.gpa, elem); |
| 924 | return result; | 924 | return result; |
| 925 | } | 925 | } |
| ... | @@ -927,14 +927,14 @@ const Context = struct { | ... | @@ -927,14 +927,14 @@ const Context = struct { |
| 927 | fn addExtra(c: *Context, extra: anytype) Allocator.Error!std.zig.Ast.ExtraIndex { | 927 | fn addExtra(c: *Context, extra: anytype) Allocator.Error!std.zig.Ast.ExtraIndex { |
| 928 | const info = @typeInfo(@TypeOf(extra)).@"struct"; | 928 | const info = @typeInfo(@TypeOf(extra)).@"struct"; |
| 929 | try c.extra_data.ensureUnusedCapacity(c.gpa, info.field_names.len); | 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 | inline for (info.field_names, info.field_types) |field_name, field_type| { | 931 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 932 | const data: u32 = switch (field_type) { | 932 | const data: u32 = switch (field_type) { |
| 933 | NodeIndex, | 933 | NodeIndex, |
| 934 | std.zig.Ast.Node.OptionalIndex, | 934 | std.zig.Ast.Node.OptionalIndex, |
| 935 | std.zig.Ast.OptionalTokenIndex, | 935 | std.zig.Ast.OptionalTokenIndex, |
| 936 | std.zig.Ast.ExtraIndex, | 936 | std.zig.Ast.ExtraIndex, |
| 937 | => @intFromEnum(@field(extra, field_name)), | 937 | => @backingInt(@field(extra, field_name)), |
| 938 | TokenIndex, | 938 | TokenIndex, |
| 939 | => @field(extra, field_name), | 939 | => @field(extra, field_name), |
| 940 | else => @compileError("unexpected field type"), | 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,7 +189,7 @@ fn translate(d: *aro.Driver, tc: *aro.Toolchain, args: []const [:0]const u8, zig |
| 189 | if (val_str.len != 1 or val_str[0] < '0' or val_str[0] > '3') { | 189 | if (val_str.len != 1 or val_str[0] < '0' or val_str[0] > '3') { |
| 190 | return d.fatal("-fstrict-flex-arrays= requires a value of '0', '1', '2', or '3'", .{}); | 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 | } else { | 193 | } else { |
| 194 | aro_args.appendAssumeCapacity(arg); | 194 | aro_args.appendAssumeCapacity(arg); |
| 195 | } | 195 | } |
lib/compiler_rt/cmpdf2.zig+1-1| ... | @@ -25,7 +25,7 @@ comptime { | ... | @@ -25,7 +25,7 @@ comptime { |
| 25 | /// Note that this matches the definition of `__ledf2`, `__eqdf2`, `__nedf2`, `__cmpdf2`, | 25 | /// Note that this matches the definition of `__ledf2`, `__eqdf2`, `__nedf2`, `__cmpdf2`, |
| 26 | /// and `__ltdf2`. | 26 | /// and `__ltdf2`. |
| 27 | fn __cmpdf2(a: f64, b: f64) callconv(.c) i32 { | 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 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | 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,7 +41,7 @@ comptime { |
| 41 | /// Note that this matches the definition of `__letf2`, `__eqtf2`, `__netf2`, `__cmptf2`, | 41 | /// Note that this matches the definition of `__letf2`, `__eqtf2`, `__netf2`, `__cmptf2`, |
| 42 | /// and `__lttf2`. | 42 | /// and `__lttf2`. |
| 43 | fn __cmptf2(a: f128, b: f128) callconv(.c) i32 { | 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 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | 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,68 +78,68 @@ const SparcFCMP = enum(i32) { |
| 78 | }; | 78 | }; |
| 79 | 79 | ||
| 80 | fn _Qp_cmp(a: *const f128, b: *const f128) callconv(.c) i32 { | 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 | fn _Qp_feq(a: *const f128, b: *const f128) callconv(.c) bool { | 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 | fn _Qp_fne(a: *const f128, b: *const f128) callconv(.c) bool { | 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 | fn _Qp_flt(a: *const f128, b: *const f128) callconv(.c) bool { | 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 | fn _Qp_fgt(a: *const f128, b: *const f128) callconv(.c) bool { | 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 | fn _Qp_fge(a: *const f128, b: *const f128) callconv(.c) bool { | 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 | .Equal, .Greater => true, | 102 | .Equal, .Greater => true, |
| 103 | .Less, .Unordered => false, | 103 | .Less, .Unordered => false, |
| 104 | }; | 104 | }; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | fn _Qp_fle(a: *const f128, b: *const f128) callconv(.c) bool { | 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 | .Equal, .Less => true, | 109 | .Equal, .Less => true, |
| 110 | .Greater, .Unordered => false, | 110 | .Greater, .Unordered => false, |
| 111 | }; | 111 | }; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | fn _Q_cmp(a: f128, b: f128) callconv(.c) i32 { | 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 | fn _Q_feq(a: f128, b: f128) callconv(.c) bool { | 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 | fn _Q_fne(a: f128, b: f128) callconv(.c) bool { | 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 | fn _Q_flt(a: f128, b: f128) callconv(.c) bool { | 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 | fn _Q_fgt(a: f128, b: f128) callconv(.c) bool { | 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 | fn _Q_fge(a: f128, b: f128) callconv(.c) bool { | 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 | .Equal, .Greater => true, | 136 | .Equal, .Greater => true, |
| 137 | .Less, .Unordered => false, | 137 | .Less, .Unordered => false, |
| 138 | }; | 138 | }; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | fn _Q_fle(a: f128, b: f128) callconv(.c) bool { | 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 | .Equal, .Less => true, | 143 | .Equal, .Less => true, |
| 144 | .Greater, .Unordered => false, | 144 | .Greater, .Unordered => false, |
| 145 | }; | 145 | }; |
lib/compiler_rt/cmpxf2.zig+1-1| ... | @@ -19,7 +19,7 @@ comptime { | ... | @@ -19,7 +19,7 @@ comptime { |
| 19 | /// Note that this matches the definition of `__lexf2`, `__eqxf2`, `__nexf2`, `__cmpxf2`, | 19 | /// Note that this matches the definition of `__lexf2`, `__eqxf2`, `__nexf2`, `__cmpxf2`, |
| 20 | /// and `__ltxf2`. | 20 | /// and `__ltxf2`. |
| 21 | fn __cmpxf2(a: f80, b: f80) callconv(.c) i32 { | 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 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | 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,7 +52,7 @@ pub fn __unordtf2(a: f128, b: f128) callconv(.c) i32 { |
| 52 | /// Note that this matches the definition of `__lesf2`, `__eqsf2`, `__nesf2`, `__cmpsf2`, | 52 | /// Note that this matches the definition of `__lesf2`, `__eqsf2`, `__nesf2`, `__cmpsf2`, |
| 53 | /// and `__ltsf2`. | 53 | /// and `__ltsf2`. |
| 54 | fn __cmpsf2(a: f32, b: f32) callconv(.c) i32 { | 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 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | 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,7 +100,7 @@ fn __aeabi_fcmple(a: f32, b: f32) callconv(.{ .arm_aapcs = .{} }) i32 { |
| 100 | /// Note that this matches the definition of `__lehf2`, `__eqhf2`, `__nehf2`, `__cmphf2`, | 100 | /// Note that this matches the definition of `__lehf2`, `__eqhf2`, `__nehf2`, `__cmphf2`, |
| 101 | /// and `__lthf2`. | 101 | /// and `__lthf2`. |
| 102 | fn __cmphf2(a: f16, b: f16) callconv(.c) i32 { | 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 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | 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,7 +17,7 @@ comptime { |
| 17 | /// "These functions return a value greater than or equal to zero if neither | 17 | /// "These functions return a value greater than or equal to zero if neither |
| 18 | /// argument is NaN, and a is greater than or equal to b." | 18 | /// argument is NaN, and a is greater than or equal to b." |
| 19 | pub fn __gedf2(a: f64, b: f64) callconv(.c) i32 { | 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 | /// "These functions return a value greater than zero if neither argument is NaN, | 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,7 +11,7 @@ comptime { |
| 11 | /// "These functions return a value greater than or equal to zero if neither | 11 | /// "These functions return a value greater than or equal to zero if neither |
| 12 | /// argument is NaN, and a is greater than or equal to b." | 12 | /// argument is NaN, and a is greater than or equal to b." |
| 13 | pub fn __gehf2(a: f16, b: f16) callconv(.c) i32 { | 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 | /// "These functions return a value greater than zero if neither argument is NaN, | 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,7 +17,7 @@ comptime { |
| 17 | /// "These functions return a value greater than or equal to zero if neither | 17 | /// "These functions return a value greater than or equal to zero if neither |
| 18 | /// argument is NaN, and a is greater than or equal to b." | 18 | /// argument is NaN, and a is greater than or equal to b." |
| 19 | pub fn __gesf2(a: f32, b: f32) callconv(.c) i32 { | 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 | /// "These functions return a value greater than zero if neither argument is NaN, | 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,7 +16,7 @@ comptime { |
| 16 | /// "These functions return a value greater than or equal to zero if neither | 16 | /// "These functions return a value greater than or equal to zero if neither |
| 17 | /// argument is NaN, and a is greater than or equal to b." | 17 | /// argument is NaN, and a is greater than or equal to b." |
| 18 | fn __getf2(a: f128, b: f128) callconv(.c) i32 { | 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 | /// "These functions return a value greater than zero if neither argument is NaN, | 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 +7,7 @@ comptime { |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | fn __gexf2(a: f80, b: f80) callconv(.c) i32 { | 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 | fn __gtxf2(a: f80, b: f80) callconv(.c) i32 { | 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,7 +24,7 @@ pub const Index = enum(u32) { |
| 24 | _, | 24 | _, |
| 25 | 25 | ||
| 26 | pub fn get(i: Index) *Decl { | 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,7 +130,7 @@ pub fn get_child(decl: *const Decl, name: []const u8) ?Decl.Index { |
| 130 | // Find a decl with this function as the parent, with a name matching `name` | 130 | // Find a decl with this function as the parent, with a name matching `name` |
| 131 | for (Walk.decls.items, 0..) |*candidate, i| { | 131 | for (Walk.decls.items, 0..) |*candidate, i| { |
| 132 | if (candidate.parent != .none and candidate.parent.get() == decl and std.mem.eql(u8, candidate.extra_info().name, name)) { | 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,13 +68,13 @@ pub const File = struct { |
| 68 | .file = i, | 68 | .file = i, |
| 69 | .parent = parent_decl, | 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 | try i.get().node_decls.put(gpa, node, decl_index); | 72 | try i.get().node_decls.put(gpa, node, decl_index); |
| 73 | return decl_index; | 73 | return decl_index; |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | pub fn get(i: File.Index) *File { | 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 | pub fn get_ast(i: File.Index) *Ast { | 80 | pub fn get_ast(i: File.Index) *Ast { |
| ... | @@ -82,7 +82,7 @@ pub const File = struct { | ... | @@ -82,7 +82,7 @@ pub const File = struct { |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | pub fn path(i: File.Index) []const u8 { | 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 | pub fn findRootDecl(file_index: File.Index) Decl.Index { | 88 | pub fn findRootDecl(file_index: File.Index) Decl.Index { |
| ... | @@ -329,7 +329,7 @@ pub const File = struct { | ... | @@ -329,7 +329,7 @@ pub const File = struct { |
| 329 | base_path, file_path, resolved_path, | 329 | base_path, file_path, resolved_path, |
| 330 | }); | 330 | }); |
| 331 | if (files.getIndex(resolved_path)) |imported_file_index| { | 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 | } else { | 333 | } else { |
| 334 | log.warn("import target '{s}' did not resolve to any file", .{resolved_path}); | 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,7 +388,7 @@ pub const ModuleIndex = enum(u32) { |
| 388 | pub fn add_file(file_name: []const u8, bytes: []u8) !File.Index { | 388 | pub fn add_file(file_name: []const u8, bytes: []u8) !File.Index { |
| 389 | const ast = try parse(file_name, bytes); | 389 | const ast = try parse(file_name, bytes); |
| 390 | assert(ast.errors.len == 0); | 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 | try files.put(gpa, file_name, .{ .ast = ast }); | 392 | try files.put(gpa, file_name, .{ .ast = ast }); |
| 393 | 393 | ||
| 394 | var w: Walk = .{ | 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,7 +90,7 @@ export fn query_exec(ignore_case: bool) [*]Decl.Index { |
| 90 | query_exec_fallible(query, ignore_case) catch |err| switch (err) { | 90 | query_exec_fallible(query, ignore_case) catch |err| switch (err) { |
| 91 | error.OutOfMemory => @panic("OOM"), | 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 | return query_results.items.ptr; | 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,7 +165,7 @@ fn query_exec_fallible(query: []const u8, ignore_case: bool) !void { |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | if (query_results.items.len < max_matched_items or bypass_limit) { | 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 | try g.scores.append(gpa, .{ | 169 | try g.scores.append(gpa, .{ |
| 170 | .points = points, | 170 | .points = points, |
| 171 | .segments = @intCast(count_scalar(g.full_path_search_text.items, '.')), | 171 | .segments = @intCast(count_scalar(g.full_path_search_text.items, '.')), |
| ... | @@ -717,8 +717,8 @@ fn render_docs( | ... | @@ -717,8 +717,8 @@ fn render_docs( |
| 717 | node: markdown.Document.Node.Index, | 717 | node: markdown.Document.Node.Index, |
| 718 | writer: *Writer, | 718 | writer: *Writer, |
| 719 | ) Writer.Error!void { | 719 | ) Writer.Error!void { |
| 720 | const data = doc.nodes.items(.data)[@intFromEnum(node)]; | 720 | const data = doc.nodes.items(.data)[@backingInt(node)]; |
| 721 | switch (doc.nodes.items(.tag)[@intFromEnum(node)]) { | 721 | switch (doc.nodes.items(.tag)[@backingInt(node)]) { |
| 722 | .code_span => { | 722 | .code_span => { |
| 723 | try writer.writeAll("<code>"); | 723 | try writer.writeAll("<code>"); |
| 724 | const content = doc.string(data.text.content); | 724 | const content = doc.string(data.text.content); |
| ... | @@ -806,7 +806,7 @@ fn unpackInner(tar_bytes: []u8) !void { | ... | @@ -806,7 +806,7 @@ fn unpackInner(tar_bytes: []u8) !void { |
| 806 | if (std.mem.indexOfScalar(u8, file_name, '/')) |pkg_name_end| { | 806 | if (std.mem.indexOfScalar(u8, file_name, '/')) |pkg_name_end| { |
| 807 | const pkg_name = file_name[0..pkg_name_end]; | 807 | const pkg_name = file_name[0..pkg_name_end]; |
| 808 | const gop = try Walk.modules.getOrPut(gpa, pkg_name); | 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 | if (!gop.found_existing or | 810 | if (!gop.found_existing or |
| 811 | std.mem.eql(u8, file_name[pkg_name_end..], "/root.zig") or | 811 | std.mem.eql(u8, file_name[pkg_name_end..], "/root.zig") or |
| 812 | std.mem.eql(u8, file_name[pkg_name_end + 1 .. file_name.len - ".zig".len], pkg_name)) | 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,7 +837,7 @@ export fn module_name(index: u32) String { |
| 837 | } | 837 | } |
| 838 | 838 | ||
| 839 | export fn find_module_root(pkg: Walk.ModuleIndex) Decl.Index { | 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 | const result = root_file.findRootDecl(); | 841 | const result = root_file.findRootDecl(); |
| 842 | assert(result != .none); | 842 | assert(result != .none); |
| 843 | return result; | 843 | return result; |
| ... | @@ -854,7 +854,7 @@ export fn set_input_string(len: usize) [*]u8 { | ... | @@ -854,7 +854,7 @@ export fn set_input_string(len: usize) [*]u8 { |
| 854 | /// Looks up the root struct decl corresponding to a file by path. | 854 | /// Looks up the root struct decl corresponding to a file by path. |
| 855 | /// Uses `input_string`. | 855 | /// Uses `input_string`. |
| 856 | export fn find_file_root() Decl.Index { | 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 | return file.findRootDecl(); | 858 | return file.findRootDecl(); |
| 859 | } | 859 | } |
| 860 | 860 | ||
| ... | @@ -874,7 +874,7 @@ export fn find_decl() Decl.Index { | ... | @@ -874,7 +874,7 @@ export fn find_decl() Decl.Index { |
| 874 | if (std.mem.eql(u8, g.match_fqn.items, input_string.items)) { | 874 | if (std.mem.eql(u8, g.match_fqn.items, input_string.items)) { |
| 875 | //const path = @as(Decl.Index, @enumFromInt(decl_index)).get().file.path(); | 875 | //const path = @as(Decl.Index, @enumFromInt(decl_index)).get().file.path(); |
| 876 | //log.debug("find_decl '{s}' found in {s}", .{ input_string.items, path }); | 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 | return .none; | 880 | return .none; |
| ... | @@ -930,7 +930,7 @@ export fn namespace_members(parent: Decl.Index, include_private: bool) Slice(Dec | ... | @@ -930,7 +930,7 @@ export fn namespace_members(parent: Decl.Index, include_private: bool) Slice(Dec |
| 930 | for (Walk.decls.items, 0..) |*decl, i| { | 930 | for (Walk.decls.items, 0..) |*decl, i| { |
| 931 | if (decl.parent == parent) { | 931 | if (decl.parent == parent) { |
| 932 | if (include_private or decl.is_pub()) { | 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,8 +126,8 @@ pub const Node = struct { |
| 126 | 126 | ||
| 127 | pub fn asNumber(start: ListStart) ?u30 { | 127 | pub fn asNumber(start: ListStart) ?u30 { |
| 128 | if (start == .unordered) return null; | 128 | if (start == .unordered) return null; |
| 129 | assert(@intFromEnum(start) <= 999_999_999); | 129 | assert(@backingInt(start) <= 999_999_999); |
| 130 | return @intFromEnum(start); | 130 | return @backingInt(start); |
| 131 | } | 131 | } |
| 132 | }; | 132 | }; |
| 133 | 133 | ||
| ... | @@ -171,7 +171,7 @@ pub fn ExtraData(comptime T: type) type { | ... | @@ -171,7 +171,7 @@ pub fn ExtraData(comptime T: type) type { |
| 171 | 171 | ||
| 172 | pub fn extraData(doc: Document, comptime T: type, index: ExtraIndex) ExtraData(T) { | 172 | pub fn extraData(doc: Document, comptime T: type, index: ExtraIndex) ExtraData(T) { |
| 173 | const info = @typeInfo(T).@"struct"; | 173 | const info = @typeInfo(T).@"struct"; |
| 174 | var i: usize = @intFromEnum(index); | 174 | var i: usize = @backingInt(index); |
| 175 | var result: T = undefined; | 175 | var result: T = undefined; |
| 176 | inline for (info.field_names, info.field_types) |field_name, field_type| { | 176 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 177 | @field(result, field_name) = switch (field_type) { | 177 | @field(result, field_name) = switch (field_type) { |
| ... | @@ -189,6 +189,6 @@ pub fn extraChildren(doc: Document, index: ExtraIndex) []const Node.Index { | ... | @@ -189,6 +189,6 @@ pub fn extraChildren(doc: Document, index: ExtraIndex) []const Node.Index { |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | pub fn string(doc: Document, index: StringIndex) [:0]const u8 { | 191 | pub fn string(doc: Document, index: StringIndex) [:0]const u8 { |
| 192 | const start = @intFromEnum(index); | 192 | const start = @backingInt(index); |
| 193 | return std.mem.span(@as([*:0]u8, @ptrCast(doc.string_bytes[start..].ptr))); | 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,7 +444,7 @@ fn appendBlockStart(p: *Parser, block_start: BlockStart) !void { |
| 444 | const header_data = datas[p.scratch_extra.getLast().?]; | 444 | const header_data = datas[p.scratch_extra.getLast().?]; |
| 445 | for (p.extraChildren(header_data.container.children), 0..) |header_cell, i| { | 445 | for (p.extraChildren(header_data.container.children), 0..) |header_cell, i| { |
| 446 | const alignment = if (i < alignments.len) alignments[i] else .unset; | 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 | cell_data.info.alignment = alignment; | 448 | cell_data.info.alignment = alignment; |
| 449 | cell_data.info.header = true; | 449 | cell_data.info.header = true; |
| 450 | } | 450 | } |
| ... | @@ -847,7 +847,7 @@ fn closeLastBlock(p: *Parser) !void { | ... | @@ -847,7 +847,7 @@ fn closeLastBlock(p: *Parser) !void { |
| 847 | .tag = .list, | 847 | .tag = .list, |
| 848 | .data = .{ .list = .{ | 848 | .data = .{ .list = .{ |
| 849 | .start = switch (b.data.list.marker) { | 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 | .@"-", .@"*", .@"+" => .unordered, | 851 | .@"-", .@"*", .@"+" => .unordered, |
| 852 | }, | 852 | }, |
| 853 | .children = children, | 853 | .children = children, |
| ... | @@ -1087,7 +1087,7 @@ const InlineParser = struct { | ... | @@ -1087,7 +1087,7 @@ const InlineParser = struct { |
| 1087 | } | 1087 | } |
| 1088 | } | 1088 | } |
| 1089 | try ip.parent.string_bytes.append(ip.parent.allocator, 0); | 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 | /// Parses an autolink, starting at the opening `<`. `ip.pos` is left at the | 1093 | /// Parses an autolink, starting at the opening `<`. `ip.pos` is left at the |
| ... | @@ -1478,7 +1478,7 @@ const InlineParser = struct { | ... | @@ -1478,7 +1478,7 @@ const InlineParser = struct { |
| 1478 | try ip.parent.addScratchExtraNode(try ip.parent.addNode(.{ | 1478 | try ip.parent.addScratchExtraNode(try ip.parent.addNode(.{ |
| 1479 | .tag = .text, | 1479 | .tag = .text, |
| 1480 | .data = .{ .text = .{ | 1480 | .data = .{ .text = .{ |
| 1481 | .content = @enumFromInt(string_start), | 1481 | .content = @fromBackingInt(@intCast(string_start)), |
| 1482 | } }, | 1482 | } }, |
| 1483 | })); | 1483 | })); |
| 1484 | string_start = ip.parent.string_bytes.items.len; | 1484 | string_start = ip.parent.string_bytes.items.len; |
| ... | @@ -1495,7 +1495,7 @@ const InlineParser = struct { | ... | @@ -1495,7 +1495,7 @@ const InlineParser = struct { |
| 1495 | try ip.parent.addScratchExtraNode(try ip.parent.addNode(.{ | 1495 | try ip.parent.addScratchExtraNode(try ip.parent.addNode(.{ |
| 1496 | .tag = .text, | 1496 | .tag = .text, |
| 1497 | .data = .{ .text = .{ | 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,7 +1575,7 @@ fn parseInlines(p: *Parser, content: []const u8) !ExtraIndex { |
| 1575 | 1575 | ||
| 1576 | pub fn extraData(p: Parser, comptime T: type, index: ExtraIndex) ExtraData(T) { | 1576 | pub fn extraData(p: Parser, comptime T: type, index: ExtraIndex) ExtraData(T) { |
| 1577 | const info = @typeInfo(T).@"struct"; | 1577 | const info = @typeInfo(T).@"struct"; |
| 1578 | var i: usize = @intFromEnum(index); | 1578 | var i: usize = @backingInt(index); |
| 1579 | var result: T = undefined; | 1579 | var result: T = undefined; |
| 1580 | inline for (info.field_names, info.field_types) |field_name, field_type| { | 1580 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 1581 | @field(result, field_name) = switch (field_type) { | 1581 | @field(result, field_name) = switch (field_type) { |
| ... | @@ -1593,7 +1593,7 @@ pub fn extraChildren(p: Parser, index: ExtraIndex) []const Node.Index { | ... | @@ -1593,7 +1593,7 @@ pub fn extraChildren(p: Parser, index: ExtraIndex) []const Node.Index { |
| 1593 | } | 1593 | } |
| 1594 | 1594 | ||
| 1595 | fn addNode(p: *Parser, node: Node) !Node.Index { | 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 | try p.nodes.append(p.allocator, node); | 1597 | try p.nodes.append(p.allocator, node); |
| 1598 | return index; | 1598 | return index; |
| 1599 | } | 1599 | } |
| ... | @@ -1601,7 +1601,7 @@ fn addNode(p: *Parser, node: Node) !Node.Index { | ... | @@ -1601,7 +1601,7 @@ fn addNode(p: *Parser, node: Node) !Node.Index { |
| 1601 | fn addString(p: *Parser, s: []const u8) !StringIndex { | 1601 | fn addString(p: *Parser, s: []const u8) !StringIndex { |
| 1602 | if (s.len == 0) return .empty; | 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 | try p.string_bytes.ensureUnusedCapacity(p.allocator, s.len + 1); | 1605 | try p.string_bytes.ensureUnusedCapacity(p.allocator, s.len + 1); |
| 1606 | p.string_bytes.appendSliceAssumeCapacity(s); | 1606 | p.string_bytes.appendSliceAssumeCapacity(s); |
| 1607 | p.string_bytes.appendAssumeCapacity(0); | 1607 | p.string_bytes.appendAssumeCapacity(0); |
| ... | @@ -1609,7 +1609,7 @@ fn addString(p: *Parser, s: []const u8) !StringIndex { | ... | @@ -1609,7 +1609,7 @@ fn addString(p: *Parser, s: []const u8) !StringIndex { |
| 1609 | } | 1609 | } |
| 1610 | 1610 | ||
| 1611 | fn addExtraChildren(p: *Parser, nodes: []const Node.Index) !ExtraIndex { | 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 | try p.extra.ensureUnusedCapacity(p.allocator, nodes.len + 1); | 1613 | try p.extra.ensureUnusedCapacity(p.allocator, nodes.len + 1); |
| 1614 | p.extra.appendAssumeCapacity(@intCast(nodes.len)); | 1614 | p.extra.appendAssumeCapacity(@intCast(nodes.len)); |
| 1615 | p.extra.appendSliceAssumeCapacity(@ptrCast(nodes)); | 1615 | p.extra.appendSliceAssumeCapacity(@ptrCast(nodes)); |
| ... | @@ -1617,7 +1617,7 @@ fn addExtraChildren(p: *Parser, nodes: []const Node.Index) !ExtraIndex { | ... | @@ -1617,7 +1617,7 @@ fn addExtraChildren(p: *Parser, nodes: []const Node.Index) !ExtraIndex { |
| 1617 | } | 1617 | } |
| 1618 | 1618 | ||
| 1619 | fn addScratchExtraNode(p: *Parser, node: Node.Index) !void { | 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 | fn addScratchStringLine(p: *Parser, line: []const u8) !void { | 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,8 +31,8 @@ pub fn Renderer(comptime Context: type) type { |
| 31 | node: Node.Index, | 31 | node: Node.Index, |
| 32 | writer: *Writer, | 32 | writer: *Writer, |
| 33 | ) Writer.Error!void { | 33 | ) Writer.Error!void { |
| 34 | const data = doc.nodes.items(.data)[@intFromEnum(node)]; | 34 | const data = doc.nodes.items(.data)[@backingInt(node)]; |
| 35 | switch (doc.nodes.items(.tag)[@intFromEnum(node)]) { | 35 | switch (doc.nodes.items(.tag)[@backingInt(node)]) { |
| 36 | .root => { | 36 | .root => { |
| 37 | for (doc.extraChildren(data.container.children)) |child| { | 37 | for (doc.extraChildren(data.container.children)) |child| { |
| 38 | try r.renderFn(r, doc, child, writer); | 38 | try r.renderFn(r, doc, child, writer); |
| ... | @@ -60,8 +60,8 @@ pub fn Renderer(comptime Context: type) type { | ... | @@ -60,8 +60,8 @@ pub fn Renderer(comptime Context: type) type { |
| 60 | .list_item => { | 60 | .list_item => { |
| 61 | try writer.writeAll("<li>"); | 61 | try writer.writeAll("<li>"); |
| 62 | for (doc.extraChildren(data.list_item.children)) |child| { | 62 | for (doc.extraChildren(data.list_item.children)) |child| { |
| 63 | if (data.list_item.tight and doc.nodes.items(.tag)[@intFromEnum(child)] == .paragraph) { | 63 | if (data.list_item.tight and doc.nodes.items(.tag)[@backingInt(child)] == .paragraph) { |
| 64 | const para_data = doc.nodes.items(.data)[@intFromEnum(child)]; | 64 | const para_data = doc.nodes.items(.data)[@backingInt(child)]; |
| 65 | for (doc.extraChildren(para_data.container.children)) |para_child| { | 65 | for (doc.extraChildren(para_data.container.children)) |para_child| { |
| 66 | try r.renderFn(r, doc, para_child, writer); | 66 | try r.renderFn(r, doc, para_child, writer); |
| 67 | } | 67 | } |
| ... | @@ -191,8 +191,8 @@ pub fn renderInlineNodeText( | ... | @@ -191,8 +191,8 @@ pub fn renderInlineNodeText( |
| 191 | node: Node.Index, | 191 | node: Node.Index, |
| 192 | writer: *Writer, | 192 | writer: *Writer, |
| 193 | ) Writer.Error!void { | 193 | ) Writer.Error!void { |
| 194 | const data = doc.nodes.items(.data)[@intFromEnum(node)]; | 194 | const data = doc.nodes.items(.data)[@backingInt(node)]; |
| 195 | switch (doc.nodes.items(.tag)[@intFromEnum(node)]) { | 195 | switch (doc.nodes.items(.tag)[@backingInt(node)]) { |
| 196 | .root, | 196 | .root, |
| 197 | .list, | 197 | .list, |
| 198 | .list_item, | 198 | .list_item, |
lib/fuzzer.zig+29-29| ... | @@ -830,7 +830,7 @@ const Fuzzer = struct { | ... | @@ -830,7 +830,7 @@ const Fuzzer = struct { |
| 830 | .seen_uids = .empty, | 830 | .seen_uids = .empty, |
| 831 | 831 | ||
| 832 | .corpus = .empty, | 832 | .corpus = .empty, |
| 833 | .corpus_pos = @enumFromInt(0), | 833 | .corpus_pos = @fromBackingInt(@intCast(0)), |
| 834 | .start_mut_corpus = math.maxInt(u32), | 834 | .start_mut_corpus = math.maxInt(u32), |
| 835 | .dirname = dirname, | 835 | .dirname = dirname, |
| 836 | .lock_file = lock_file, | 836 | .lock_file = lock_file, |
| ... | @@ -965,14 +965,14 @@ const Fuzzer = struct { | ... | @@ -965,14 +965,14 @@ const Fuzzer = struct { |
| 965 | var i: usize = t.start_mut_corpus; | 965 | var i: usize = t.start_mut_corpus; |
| 966 | while (i < t.corpus.len) { | 966 | while (i < t.corpus.len) { |
| 967 | if (ref[i].best_i_len == 0) { | 967 | if (ref[i].best_i_len == 0) { |
| 968 | f.removeInput(@enumFromInt(i)); | 968 | f.removeInput(@fromBackingInt(@intCast(i))); |
| 969 | } else { | 969 | } else { |
| 970 | i += 1; | 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 | const CorpusFileName = struct { | 978 | const CorpusFileName = struct { |
| ... | @@ -1084,12 +1084,12 @@ const Fuzzer = struct { | ... | @@ -1084,12 +1084,12 @@ const Fuzzer = struct { |
| 1084 | 1084 | ||
| 1085 | fn removeBest(f: *Fuzzer, i: Input.Index, best_i: u32) void { | 1085 | fn removeBest(f: *Fuzzer, i: Input.Index, best_i: u32) void { |
| 1086 | const t = &f.tests[f.test_i]; | 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 | const list_i = mem.indexOfScalar(u32, ref.best_i_buf[0..ref.best_i_len], best_i).?; | 1088 | const list_i = mem.indexOfScalar(u32, ref.best_i_buf[0..ref.best_i_len], best_i).?; |
| 1089 | ref.best_i_len -= 1; | 1089 | ref.best_i_len -= 1; |
| 1090 | ref.best_i_buf[list_i] = ref.best_i_buf[ref.best_i_len]; | 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 | // The input is no longer valuable, so remove it. | 1093 | // The input is no longer valuable, so remove it. |
| 1094 | f.removeInput(i); | 1094 | f.removeInput(i); |
| 1095 | } | 1095 | } |
| ... | @@ -1097,10 +1097,10 @@ const Fuzzer = struct { | ... | @@ -1097,10 +1097,10 @@ const Fuzzer = struct { |
| 1097 | 1097 | ||
| 1098 | fn removeInput(f: *Fuzzer, i: Input.Index) void { | 1098 | fn removeInput(f: *Fuzzer, i: Input.Index) void { |
| 1099 | const t = &f.tests[f.test_i]; | 1099 | const t = &f.tests[f.test_i]; |
| 1100 | const ref = &t.corpus.items(.ref)[@intFromEnum(i)]; | 1100 | const ref = &t.corpus.items(.ref)[@backingInt(i)]; |
| 1101 | assert(ref.best_i_len == 0 and @intFromEnum(i) >= t.start_mut_corpus); | 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 | for ( | 1104 | for ( |
| 1105 | removed_input.data.uid_slices.keys(), | 1105 | removed_input.data.uid_slices.keys(), |
| 1106 | removed_input.data.uid_slices.values(), | 1106 | removed_input.data.uid_slices.values(), |
| ... | @@ -1135,18 +1135,18 @@ const Fuzzer = struct { | ... | @@ -1135,18 +1135,18 @@ const Fuzzer = struct { |
| 1135 | } | 1135 | } |
| 1136 | } | 1136 | } |
| 1137 | removed_input.deinit(); | 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 | // The last item was moved so its refs need updated. | 1141 | // The last item was moved so its refs need updated. |
| 1142 | // `ref` can be reused since it was a swap remove. | 1142 | // `ref` can be reused since it was a swap remove. |
| 1143 | for (ref.best_i_buf[0..ref.best_i_len]) |update_pc_i| { | 1143 | for (ref.best_i_buf[0..ref.best_i_len]) |update_pc_i| { |
| 1144 | const best = &t.bests.input_buf[update_pc_i]; | 1144 | const best = &t.bests.input_buf[update_pc_i]; |
| 1145 | assert(@intFromEnum(best.min) == t.corpus.len or | 1145 | assert(@backingInt(best.min) == t.corpus.len or |
| 1146 | @intFromEnum(best.max) == t.corpus.len); | 1146 | @backingInt(best.max) == t.corpus.len); |
| 1147 | 1147 | ||
| 1148 | if (@intFromEnum(best.min) == t.corpus.len) best.min = i; | 1148 | if (@backingInt(best.min) == t.corpus.len) best.min = i; |
| 1149 | if (@intFromEnum(best.max) == t.corpus.len) best.max = 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,8 +1161,8 @@ const Fuzzer = struct { |
| 1161 | }) catch |e| panic("failed to open '{s}': {t}", .{ readlock_name, e }); | 1161 | }) catch |e| panic("failed to open '{s}': {t}", .{ readlock_name, e }); |
| 1162 | defer readlock_file.close(io); | 1162 | defer readlock_file.close(io); |
| 1163 | 1163 | ||
| 1164 | const removed_name = removed_cname.inputName(@intFromEnum(i) - t.start_mut_corpus); | 1164 | const removed_name = removed_cname.inputName(@backingInt(i) - t.start_mut_corpus); |
| 1165 | if (@intFromEnum(i) == t.corpus.len) { | 1165 | if (@backingInt(i) == t.corpus.len) { |
| 1166 | exec.cache_f.deleteFile(io, removed_name) catch |e| panic( | 1166 | exec.cache_f.deleteFile(io, removed_name) catch |e| panic( |
| 1167 | "failed to remove corpus file '{s}': {t}", | 1167 | "failed to remove corpus file '{s}': {t}", |
| 1168 | .{ removed_name, e }, | 1168 | .{ removed_name, e }, |
| ... | @@ -1201,7 +1201,7 @@ const Fuzzer = struct { | ... | @@ -1201,7 +1201,7 @@ const Fuzzer = struct { |
| 1201 | // omitted (i.e. test corpus inputs and filesystem inputs cannot be dropped) | 1201 | // omitted (i.e. test corpus inputs and filesystem inputs cannot be dropped) |
| 1202 | ) { | 1202 | ) { |
| 1203 | f.input_builder.reset(); | 1203 | f.input_builder.reset(); |
| 1204 | t.corpus_pos = @enumFromInt(0); | 1204 | t.corpus_pos = @fromBackingInt(@intCast(0)); |
| 1205 | return; | 1205 | return; |
| 1206 | } | 1206 | } |
| 1207 | 1207 | ||
| ... | @@ -1250,7 +1250,7 @@ const Fuzzer = struct { | ... | @@ -1250,7 +1250,7 @@ const Fuzzer = struct { |
| 1250 | } | 1250 | } |
| 1251 | 1251 | ||
| 1252 | // Must come after the above since some inputs may be removed | 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 | if (input_i == Input.Index.reserved_start) { | 1254 | if (input_i == Input.Index.reserved_start) { |
| 1255 | @panic("corpus size limit exceeded"); | 1255 | @panic("corpus size limit exceeded"); |
| 1256 | } | 1256 | } |
| ... | @@ -1295,7 +1295,7 @@ const Fuzzer = struct { | ... | @@ -1295,7 +1295,7 @@ const Fuzzer = struct { |
| 1295 | if (best_i_list.items.len == 0 and new_is_mut) { | 1295 | if (best_i_list.items.len == 0 and new_is_mut) { |
| 1296 | assert(best_i_list.capacity == 0); | 1296 | assert(best_i_list.capacity == 0); |
| 1297 | f.input_builder.reset(); | 1297 | f.input_builder.reset(); |
| 1298 | t.corpus_pos = @enumFromInt(0); | 1298 | t.corpus_pos = @fromBackingInt(@intCast(0)); |
| 1299 | return; | 1299 | return; |
| 1300 | } | 1300 | } |
| 1301 | 1301 | ||
| ... | @@ -1338,7 +1338,7 @@ const Fuzzer = struct { | ... | @@ -1338,7 +1338,7 @@ const Fuzzer = struct { |
| 1338 | _ = @atomicRmw(usize, &exec.seenPcsHeader().unique_runs, .Add, 1, .monotonic); | 1338 | _ = @atomicRmw(usize, &exec.seenPcsHeader().unique_runs, .Add, 1, .monotonic); |
| 1339 | // Write new input to the cache | 1339 | // Write new input to the cache |
| 1340 | var cname: CorpusFileName = .fromTest(t.dirname); | 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 | exec.cache_f.writeFile(io, .{ .sub_path = name, .data = bytes, .flags = .{ | 1342 | exec.cache_f.writeFile(io, .{ .sub_path = name, .data = bytes, .flags = .{ |
| 1343 | .exclusive = true, | 1343 | .exclusive = true, |
| 1344 | } }) catch |e| panic("failed to write corpus file '{s}': {t}", .{ name, e }); | 1344 | } }) catch |e| panic("failed to write corpus file '{s}': {t}", .{ name, e }); |
| ... | @@ -1377,7 +1377,7 @@ const Fuzzer = struct { | ... | @@ -1377,7 +1377,7 @@ const Fuzzer = struct { |
| 1377 | 1377 | ||
| 1378 | const t = &f.tests[f.test_i]; | 1378 | const t = &f.tests[f.test_i]; |
| 1379 | const corpus = t.corpus.slice(); | 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 | var small_entronopy: SmallEntronopy = .{ .bits = f.rngInt(u64) }; | 1382 | var small_entronopy: SmallEntronopy = .{ .bits = f.rngInt(u64) }; |
| 1383 | var n_mutate = mutCount(small_entronopy.take(u16)); | 1383 | var n_mutate = mutCount(small_entronopy.take(u16)); |
| ... | @@ -1436,8 +1436,8 @@ const Fuzzer = struct { | ... | @@ -1436,8 +1436,8 @@ const Fuzzer = struct { |
| 1436 | abi.runner_broadcast_input(f.test_i, .fromSlice(f.mmap_input.inputSlice())); | 1436 | abi.runner_broadcast_input(f.test_i, .fromSlice(f.mmap_input.inputSlice())); |
| 1437 | f.newInput(); | 1437 | f.newInput(); |
| 1438 | } else { | 1438 | } else { |
| 1439 | assert(@intFromEnum(t.corpus_pos) < t.corpus.len); | 1439 | assert(@backingInt(t.corpus_pos) < t.corpus.len); |
| 1440 | t.corpus_pos = @enumFromInt((@intFromEnum(t.corpus_pos) + 1) % t.corpus.len); | 1440 | t.corpus_pos = @fromBackingInt(@intCast((@backingInt(t.corpus_pos) + 1) % t.corpus.len)); |
| 1441 | } | 1441 | } |
| 1442 | f.mmap_input.clearRetainingCapacity(); | 1442 | f.mmap_input.clearRetainingCapacity(); |
| 1443 | } | 1443 | } |
| ... | @@ -1669,7 +1669,7 @@ const Fuzzer = struct { | ... | @@ -1669,7 +1669,7 @@ const Fuzzer = struct { |
| 1669 | } { | 1669 | } { |
| 1670 | const t = &f.tests[f.test_i]; | 1670 | const t = &f.tests[f.test_i]; |
| 1671 | const corpus = t.corpus.slice(); | 1671 | const corpus = t.corpus.slice(); |
| 1672 | const corpus_i = @intFromEnum(t.corpus_pos); | 1672 | const corpus_i = @backingInt(t.corpus_pos); |
| 1673 | const data = &corpus.items(.data)[corpus_i]; | 1673 | const data = &corpus.items(.data)[corpus_i]; |
| 1674 | var small_entronopy: SmallEntronopy = .{ .bits = f.rngInt(u64) }; | 1674 | var small_entronopy: SmallEntronopy = .{ .bits = f.rngInt(u64) }; |
| 1675 | 1675 | ||
| ... | @@ -1689,7 +1689,7 @@ const Fuzzer = struct { | ... | @@ -1689,7 +1689,7 @@ const Fuzzer = struct { |
| 1689 | f.uid_data_i.items[uid_i] += 1; | 1689 | f.uid_data_i.items[uid_i] += 1; |
| 1690 | const mut_i = std.simd.firstIndexOfValue( | 1690 | const mut_i = std.simd.firstIndexOfValue( |
| 1691 | @as(@Vector(4, u32), f.mut_data.i), | 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 | ) orelse { | 1693 | ) orelse { |
| 1694 | @branchHint(.likely); | 1694 | @branchHint(.likely); |
| 1695 | switch (uid.kind) { | 1695 | switch (uid.kind) { |
| ... | @@ -1918,7 +1918,7 @@ const Fuzzer = struct { | ... | @@ -1918,7 +1918,7 @@ const Fuzzer = struct { |
| 1918 | pub fn nextInt(f: *Fuzzer, uid: Uid, weights: []const abi.Weight) u64 { | 1918 | pub fn nextInt(f: *Fuzzer, uid: Uid, weights: []const abi.Weight) u64 { |
| 1919 | const t = &f.tests[f.test_i]; | 1919 | const t = &f.tests[f.test_i]; |
| 1920 | f.req_values += 1; | 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 | @branchHint(.unlikely); | 1922 | @branchHint(.unlikely); |
| 1923 | const int = f.bytes_input.valueWeightedWithHash(u64, weights, undefined); | 1923 | const int = f.bytes_input.valueWeightedWithHash(u64, weights, undefined); |
| 1924 | if (t.corpus_pos == .bytes_fresh) { | 1924 | if (t.corpus_pos == .bytes_fresh) { |
| ... | @@ -1942,7 +1942,7 @@ const Fuzzer = struct { | ... | @@ -1942,7 +1942,7 @@ const Fuzzer = struct { |
| 1942 | pub fn nextEos(f: *Fuzzer, uid: Uid, weights: []const abi.Weight) bool { | 1942 | pub fn nextEos(f: *Fuzzer, uid: Uid, weights: []const abi.Weight) bool { |
| 1943 | const t = &f.tests[f.test_i]; | 1943 | const t = &f.tests[f.test_i]; |
| 1944 | f.req_values += 1; | 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 | @branchHint(.unlikely); | 1946 | @branchHint(.unlikely); |
| 1947 | const eos = f.bytes_input.eosWeightedWithHash(weights, undefined); | 1947 | const eos = f.bytes_input.eosWeightedWithHash(weights, undefined); |
| 1948 | if (t.corpus_pos == .bytes_fresh) { | 1948 | if (t.corpus_pos == .bytes_fresh) { |
| ... | @@ -2059,7 +2059,7 @@ const Fuzzer = struct { | ... | @@ -2059,7 +2059,7 @@ const Fuzzer = struct { |
| 2059 | f.req_values += 1; | 2059 | f.req_values += 1; |
| 2060 | f.req_bytes +%= @truncate(out.len); // This function should panic since the 32-bit | 2060 | f.req_bytes +%= @truncate(out.len); // This function should panic since the 32-bit |
| 2061 | // data limit is exceeded, so wrapping is fine. | 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 | @branchHint(.unlikely); | 2063 | @branchHint(.unlikely); |
| 2064 | f.bytes_input.bytesWeightedWithHash(out, weights, undefined); | 2064 | f.bytes_input.bytesWeightedWithHash(out, weights, undefined); |
| 2065 | if (t.corpus_pos == .bytes_fresh) { | 2065 | if (t.corpus_pos == .bytes_fresh) { |
| ... | @@ -2149,7 +2149,7 @@ const Fuzzer = struct { | ... | @@ -2149,7 +2149,7 @@ const Fuzzer = struct { |
| 2149 | ) u32 { | 2149 | ) u32 { |
| 2150 | const t = &f.tests[f.test_i]; | 2150 | const t = &f.tests[f.test_i]; |
| 2151 | f.req_values += 1; | 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 | @branchHint(.unlikely); | 2153 | @branchHint(.unlikely); |
| 2154 | const n = f.bytes_input.sliceWeightedWithHash( | 2154 | const n = f.bytes_input.sliceWeightedWithHash( |
| 2155 | buf, | 2155 | buf, |
lib/std/Build.zig+2-2| ... | @@ -145,7 +145,7 @@ pub const Graph = struct { | ... | @@ -145,7 +145,7 @@ pub const Graph = struct { |
| 145 | 145 | ||
| 146 | pub fn addGeneratedFile(graph: *Graph, owner: *Step) Configuration.GeneratedFileIndex { | 146 | pub fn addGeneratedFile(graph: *Graph, owner: *Step) Configuration.GeneratedFileIndex { |
| 147 | graph.generated_files.append(graph.arena, owner) catch @panic("OOM"); | 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 | pub fn dupeString(graph: *const Graph, bytes: []const u8) []const u8 { | 151 | pub fn dupeString(graph: *const Graph, bytes: []const u8) []const u8 { |
| ... | @@ -2607,7 +2607,7 @@ pub const LazyPath = union(enum) { | ... | @@ -2607,7 +2607,7 @@ pub const LazyPath = union(enum) { |
| 2607 | .src_path, .cwd_relative, .relative, .dependency => {}, | 2607 | .src_path, .cwd_relative, .relative, .dependency => {}, |
| 2608 | .generated => |gen| { | 2608 | .generated => |gen| { |
| 2609 | const graph = other_step.owner.graph; | 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 | other_step.dependOn(generated_owner_step); | 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,7 +109,7 @@ pub const Wip = struct { |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | pub fn hash(ctx: @This(), key: String) u64 { | 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,7 +117,7 @@ pub const Wip = struct { |
| 117 | bytes: []const u8, | 117 | bytes: []const u8, |
| 118 | 118 | ||
| 119 | pub fn eql(ctx: @This(), a: []const u8, b: String) bool { | 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 | pub fn hash(_: @This(), adapted_key: []const u8) u64 { | 123 | pub fn hash(_: @This(), adapted_key: []const u8) u64 { |
| ... | @@ -192,7 +192,7 @@ pub const Wip = struct { | ... | @@ -192,7 +192,7 @@ pub const Wip = struct { |
| 192 | if (gop.found_existing) return gop.key_ptr.*; | 192 | if (gop.found_existing) return gop.key_ptr.*; |
| 193 | 193 | ||
| 194 | try wip.string_bytes.ensureUnusedCapacity(gpa, bytes.len + 1); | 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 | wip.string_bytes.appendSliceAssumeCapacity(bytes); | 197 | wip.string_bytes.appendSliceAssumeCapacity(bytes); |
| 198 | wip.string_bytes.appendAssumeCapacity(0); | 198 | wip.string_bytes.appendAssumeCapacity(0); |
| ... | @@ -213,7 +213,7 @@ pub const Wip = struct { | ... | @@ -213,7 +213,7 @@ pub const Wip = struct { |
| 213 | const revert_index: u32 = @intCast(wip.extra.items.len); | 213 | const revert_index: u32 = @intCast(wip.extra.items.len); |
| 214 | const added = try wip.extra.addManyAsSlice(gpa, list.len + 1); | 214 | const added = try wip.extra.addManyAsSlice(gpa, list.len + 1); |
| 215 | added[0] = @intCast(list.len); | 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 | const gop = try wip.dedupe_table.getOrPutContext(gpa, .{ | 217 | const gop = try wip.dedupe_table.getOrPutContext(gpa, .{ |
| 218 | .index = revert_index, | 218 | .index = revert_index, |
| 219 | .len = @intCast(added.len), | 219 | .len = @intCast(added.len), |
| ... | @@ -221,10 +221,10 @@ pub const Wip = struct { | ... | @@ -221,10 +221,10 @@ pub const Wip = struct { |
| 221 | 221 | ||
| 222 | if (gop.found_existing) { | 222 | if (gop.found_existing) { |
| 223 | wip.extra.items.len = revert_index; | 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 | pub fn addBytes(wip: *Wip, bytes: []const u8) Allocator.Error!Bytes { | 230 | pub fn addBytes(wip: *Wip, bytes: []const u8) Allocator.Error!Bytes { |
| ... | @@ -296,7 +296,7 @@ pub const Wip = struct { | ... | @@ -296,7 +296,7 @@ pub const Wip = struct { |
| 296 | .extra = wip.extra.items, | 296 | .extra = wip.extra.items, |
| 297 | })); | 297 | })); |
| 298 | if (gop.found_existing) { | 298 | if (gop.found_existing) { |
| 299 | wip.extra.items.len = @intFromEnum(result_index); | 299 | wip.extra.items.len = @backingInt(result_index); |
| 300 | return .init(gop.key_ptr.*); | 300 | return .init(gop.key_ptr.*); |
| 301 | } else { | 301 | } else { |
| 302 | return .init(result_index); | 302 | return .init(result_index); |
| ... | @@ -371,7 +371,7 @@ pub const Wip = struct { | ... | @@ -371,7 +371,7 @@ pub const Wip = struct { |
| 371 | .extra = wip.extra.items, | 371 | .extra = wip.extra.items, |
| 372 | })); | 372 | })); |
| 373 | if (gop.found_existing) { | 373 | if (gop.found_existing) { |
| 374 | wip.extra.items.len = @intFromEnum(result_index); | 374 | wip.extra.items.len = @backingInt(result_index); |
| 375 | return gop.key_ptr.*; | 375 | return gop.key_ptr.*; |
| 376 | } else { | 376 | } else { |
| 377 | return result_index; | 377 | return result_index; |
| ... | @@ -410,14 +410,14 @@ pub const Wip = struct { | ... | @@ -410,14 +410,14 @@ pub const Wip = struct { |
| 410 | 410 | ||
| 411 | if (gop.found_existing) { | 411 | if (gop.found_existing) { |
| 412 | wip.extra.items.len = revert_index; | 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 | pub fn addExtraReserved(wip: *Wip, comptime T: type, v: T) T.Index { | 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 | pub fn addExtraReservedErased(wip: *Wip, comptime T: type, v: T) u32 { | 423 | pub fn addExtraReservedErased(wip: *Wip, comptime T: type, v: T) u32 { |
| ... | @@ -428,17 +428,17 @@ pub const Wip = struct { | ... | @@ -428,17 +428,17 @@ pub const Wip = struct { |
| 428 | 428 | ||
| 429 | fn addExtraOptionalStringAssumeCapacity(wip: *Wip, optional_string: ?String) void { | 429 | fn addExtraOptionalStringAssumeCapacity(wip: *Wip, optional_string: ?String) void { |
| 430 | const string = optional_string orelse return; | 430 | const string = optional_string orelse return; |
| 431 | wip.extra.appendAssumeCapacity(@intFromEnum(string)); | 431 | wip.extra.appendAssumeCapacity(@backingInt(string)); |
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | pub fn addGeneratedFile(wip: *Wip) GeneratedFileIndex { | 434 | pub fn addGeneratedFile(wip: *Wip) GeneratedFileIndex { |
| 435 | defer wip.next_generated_file_index += 1; | 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 | /// Returned slice expires upon next append to the configuration. | 439 | /// Returned slice expires upon next append to the configuration. |
| 440 | pub fn stringSlice(wip: *const Wip, s: String) [:0]const u8 { | 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 | return start_slice[0..std.mem.indexOfScalar(u8, start_slice, 0).? :0]; | 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,7 +503,7 @@ pub const Step = extern struct { |
| 503 | _, | 503 | _, |
| 504 | 504 | ||
| 505 | pub fn ptr(i: Index, c: *const Configuration) *const Step { | 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,7 +1134,7 @@ pub const Step = extern struct { |
| 1134 | .undef => .undef, | 1134 | .undef => .undef, |
| 1135 | .defined => .defined, | 1135 | .defined => .defined, |
| 1136 | _ => { | 1136 | _ => { |
| 1137 | const value = extraData(c, Value, @intFromEnum(this)); | 1137 | const value = extraData(c, Value, @backingInt(this)); |
| 1138 | return switch (value.flags.tag) { | 1138 | return switch (value.flags.tag) { |
| 1139 | .ident => .{ .ident = value.ident.value.?.slice(c) }, | 1139 | .ident => .{ .ident = value.ident.value.?.slice(c) }, |
| 1140 | .string => .{ .string = value.string.value.?.slice(c) }, | 1140 | .string => .{ .string = value.string.value.?.slice(c) }, |
| ... | @@ -1457,7 +1457,7 @@ pub const Step = extern struct { | ... | @@ -1457,7 +1457,7 @@ pub const Step = extern struct { |
| 1457 | }; | 1457 | }; |
| 1458 | 1458 | ||
| 1459 | pub fn flags(s: *const Step, c: *const Configuration) Flags { | 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,12 +1466,12 @@ pub const MaxRss = enum(u32) { |
| 1466 | _, | 1466 | _, |
| 1467 | 1467 | ||
| 1468 | pub fn toBytes(mr: MaxRss) u64 { | 1468 | pub fn toBytes(mr: MaxRss) u64 { |
| 1469 | const x: usize = @intFromEnum(mr); | 1469 | const x: usize = @backingInt(mr); |
| 1470 | return x << 8; | 1470 | return x << 8; |
| 1471 | } | 1471 | } |
| 1472 | 1472 | ||
| 1473 | pub fn fromBytes(bytes: u64) MaxRss { | 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,7 +1499,7 @@ pub const LazyPath = union(@This().Tag) { |
| 1499 | _, | 1499 | _, |
| 1500 | 1500 | ||
| 1501 | pub fn get(this: @This(), c: *const Configuration) LazyPath { | 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,7 +1511,7 @@ pub const LazyPath = union(@This().Tag) { |
| 1511 | pub fn unwrap(this: @This()) ?Index { | 1511 | pub fn unwrap(this: @This()) ?Index { |
| 1512 | return switch (this) { | 1512 | return switch (this) { |
| 1513 | .none => null, | 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,13 +1578,13 @@ pub const OptionalGeneratedFileIndex = enum(u32) { |
| 1578 | _, | 1578 | _, |
| 1579 | 1579 | ||
| 1580 | pub fn init(i: ?GeneratedFileIndex) OptionalGeneratedFileIndex { | 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 | pub fn unwrap(this: @This()) ?GeneratedFileIndex { | 1584 | pub fn unwrap(this: @This()) ?GeneratedFileIndex { |
| 1585 | return switch (this) { | 1585 | return switch (this) { |
| 1586 | .none => null, | 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,7 +1601,7 @@ pub const Package = struct { |
| 1601 | /// Returns `null` for root package. | 1601 | /// Returns `null` for root package. |
| 1602 | pub fn get(i: @This(), c: *const Configuration) ?Package { | 1602 | pub fn get(i: @This(), c: *const Configuration) ?Package { |
| 1603 | if (i == .root) return null; | 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 | pub fn depPrefixSlice(i: @This(), c: *const Configuration) [:0]const u8 { | 1607 | pub fn depPrefixSlice(i: @This(), c: *const Configuration) [:0]const u8 { |
| ... | @@ -1616,7 +1616,7 @@ pub const Package = struct { | ... | @@ -1616,7 +1616,7 @@ pub const Package = struct { |
| 1616 | _, | 1616 | _, |
| 1617 | 1617 | ||
| 1618 | pub fn init(i: Index) OptionalIndex { | 1618 | pub fn init(i: Index) OptionalIndex { |
| 1619 | const result: OptionalIndex = @enumFromInt(@intFromEnum(i)); | 1619 | const result: OptionalIndex = @fromBackingInt(@intCast(@backingInt(i))); |
| 1620 | assert(result != .none); | 1620 | assert(result != .none); |
| 1621 | return result; | 1621 | return result; |
| 1622 | } | 1622 | } |
| ... | @@ -1625,7 +1625,7 @@ pub const Package = struct { | ... | @@ -1625,7 +1625,7 @@ pub const Package = struct { |
| 1625 | return switch (this) { | 1625 | return switch (this) { |
| 1626 | .none => null, | 1626 | .none => null, |
| 1627 | .root => .root, | 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,7 +1710,7 @@ pub const Module = struct { |
| 1710 | _, | 1710 | _, |
| 1711 | 1711 | ||
| 1712 | pub fn get(this: @This(), c: *const Configuration) Module { | 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,7 +1802,7 @@ pub const ImportTable = struct { |
| 1802 | pub fn get(this: @This(), c: *const Configuration) ImportTable { | 1802 | pub fn get(this: @This(), c: *const Configuration) ImportTable { |
| 1803 | return switch (this) { | 1803 | return switch (this) { |
| 1804 | .invalid => unreachable, | 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,7 +1815,7 @@ pub const Deps = struct { |
| 1815 | _, | 1815 | _, |
| 1816 | 1816 | ||
| 1817 | pub fn get(this: @This(), c: *const Configuration) Deps { | 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 | pub fn slice(this: @This(), c: *const Configuration) []const Step.Index { | 1821 | pub fn slice(this: @This(), c: *const Configuration) []const Step.Index { |
| ... | @@ -1839,8 +1839,8 @@ pub const StringList = enum(u32) { | ... | @@ -1839,8 +1839,8 @@ pub const StringList = enum(u32) { |
| 1839 | _, | 1839 | _, |
| 1840 | 1840 | ||
| 1841 | pub fn slice(this: @This(), c: *const Configuration) []const String { | 1841 | pub fn slice(this: @This(), c: *const Configuration) []const String { |
| 1842 | const len = c.extra[@intFromEnum(this)]; | 1842 | const len = c.extra[@backingInt(this)]; |
| 1843 | return @ptrCast(c.extra[@intFromEnum(this) + 1 ..][0..len]); | 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,14 +1850,14 @@ pub const OptionalStringList = enum(u32) { |
| 1850 | 1850 | ||
| 1851 | pub fn init(opt_string_list: ?StringList) OptionalStringList { | 1851 | pub fn init(opt_string_list: ?StringList) OptionalStringList { |
| 1852 | const sl = opt_string_list orelse return .none; | 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 | assert(result != .none); | 1854 | assert(result != .none); |
| 1855 | return result; | 1855 | return result; |
| 1856 | } | 1856 | } |
| 1857 | 1857 | ||
| 1858 | pub fn unwrap(this: @This()) ?StringList { | 1858 | pub fn unwrap(this: @This()) ?StringList { |
| 1859 | if (this == .none) return null; | 1859 | if (this == .none) return null; |
| 1860 | return @enumFromInt(@intFromEnum(this)); | 1860 | return @fromBackingInt(@intCast(@backingInt(this))); |
| 1861 | } | 1861 | } |
| 1862 | 1862 | ||
| 1863 | pub fn slice(this: @This(), c: *const Configuration) ?[]const String { | 1863 | pub fn slice(this: @This(), c: *const Configuration) ?[]const String { |
| ... | @@ -1889,8 +1889,8 @@ pub const InstallDestDir = enum(u32) { | ... | @@ -1889,8 +1889,8 @@ pub const InstallDestDir = enum(u32) { |
| 1889 | _, | 1889 | _, |
| 1890 | 1890 | ||
| 1891 | pub fn initCustom(sub_path: String) InstallDestDir { | 1891 | pub fn initCustom(sub_path: String) InstallDestDir { |
| 1892 | assert(@intFromEnum(sub_path) < @intFromEnum(InstallDestDir.none)); | 1892 | assert(@backingInt(sub_path) < @backingInt(InstallDestDir.none)); |
| 1893 | return @enumFromInt(@intFromEnum(sub_path)); | 1893 | return @fromBackingInt(@intCast(@backingInt(sub_path))); |
| 1894 | } | 1894 | } |
| 1895 | 1895 | ||
| 1896 | pub const Unpacked = union(enum) { | 1896 | pub const Unpacked = union(enum) { |
| ... | @@ -1908,7 +1908,7 @@ pub const InstallDestDir = enum(u32) { | ... | @@ -1908,7 +1908,7 @@ pub const InstallDestDir = enum(u32) { |
| 1908 | .lib => .lib, | 1908 | .lib => .lib, |
| 1909 | .bin => .bin, | 1909 | .bin => .bin, |
| 1910 | .header => .header, | 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,14 +1922,14 @@ pub const OptionalString = enum(u32) { |
| 1922 | _, | 1922 | _, |
| 1923 | 1923 | ||
| 1924 | pub fn init(s: String) OptionalString { | 1924 | pub fn init(s: String) OptionalString { |
| 1925 | const result: OptionalString = @enumFromInt(@intFromEnum(s)); | 1925 | const result: OptionalString = @fromBackingInt(@intCast(@backingInt(s))); |
| 1926 | assert(result != .none); | 1926 | assert(result != .none); |
| 1927 | return result; | 1927 | return result; |
| 1928 | } | 1928 | } |
| 1929 | 1929 | ||
| 1930 | pub fn unwrap(this: @This()) ?String { | 1930 | pub fn unwrap(this: @This()) ?String { |
| 1931 | if (this == .none) return null; | 1931 | if (this == .none) return null; |
| 1932 | return @enumFromInt(@intFromEnum(this)); | 1932 | return @fromBackingInt(@intCast(@backingInt(this))); |
| 1933 | } | 1933 | } |
| 1934 | 1934 | ||
| 1935 | pub fn slice(this: @This(), c: *const Configuration) ?[:0]const u8 { | 1935 | pub fn slice(this: @This(), c: *const Configuration) ?[:0]const u8 { |
| ... | @@ -1945,7 +1945,7 @@ pub const String = enum(u32) { | ... | @@ -1945,7 +1945,7 @@ pub const String = enum(u32) { |
| 1945 | _, | 1945 | _, |
| 1946 | 1946 | ||
| 1947 | pub fn slice(index: String, c: *const Configuration) [:0]const u8 { | 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 | return start_slice[0..std.mem.indexOfScalar(u8, start_slice, 0).? :0]; | 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,13 +1975,13 @@ pub const Alignment = enum(u6) { |
| 1975 | 1975 | ||
| 1976 | pub fn init(optional_alignment: ?std.mem.Alignment) @This() { | 1976 | pub fn init(optional_alignment: ?std.mem.Alignment) @This() { |
| 1977 | const a = optional_alignment orelse return .none; | 1977 | const a = optional_alignment orelse return .none; |
| 1978 | return @enumFromInt(@intFromEnum(a)); | 1978 | return @fromBackingInt(@intCast(@backingInt(a))); |
| 1979 | } | 1979 | } |
| 1980 | 1980 | ||
| 1981 | pub fn toBytes(a: @This()) ?u64 { | 1981 | pub fn toBytes(a: @This()) ?u64 { |
| 1982 | return switch (a) { | 1982 | return switch (a) { |
| 1983 | .none => null, | 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,7 +2015,7 @@ pub const SystemLib = struct { |
| 2015 | _, | 2015 | _, |
| 2016 | 2016 | ||
| 2017 | pub fn get(this: @This(), c: *const Configuration) SystemLib { | 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,7 +2054,7 @@ pub const CSourceFiles = struct { |
| 2054 | _, | 2054 | _, |
| 2055 | 2055 | ||
| 2056 | pub fn get(this: @This(), c: *const Configuration) CSourceFiles { | 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,7 +2074,7 @@ pub const CSourceFile = struct { |
| 2074 | _, | 2074 | _, |
| 2075 | 2075 | ||
| 2076 | pub fn get(this: @This(), c: *const Configuration) CSourceFile { | 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,7 +2095,7 @@ pub const RcSourceFile = struct { |
| 2095 | _, | 2095 | _, |
| 2096 | 2096 | ||
| 2097 | pub fn get(this: @This(), c: *const Configuration) RcSourceFile { | 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,7 +2149,7 @@ pub const ResolvedTarget = struct { |
| 2149 | _, | 2149 | _, |
| 2150 | 2150 | ||
| 2151 | pub fn get(this: @This(), c: *const Configuration) ResolvedTarget { | 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,7 +2158,7 @@ pub const ResolvedTarget = struct { |
| 2158 | _, | 2158 | _, |
| 2159 | 2159 | ||
| 2160 | pub fn init(i: Index) OptionalIndex { | 2160 | pub fn init(i: Index) OptionalIndex { |
| 2161 | const result: OptionalIndex = @enumFromInt(@intFromEnum(i)); | 2161 | const result: OptionalIndex = @fromBackingInt(@intCast(@backingInt(i))); |
| 2162 | assert(result != .none); | 2162 | assert(result != .none); |
| 2163 | return result; | 2163 | return result; |
| 2164 | } | 2164 | } |
| ... | @@ -2166,7 +2166,7 @@ pub const ResolvedTarget = struct { | ... | @@ -2166,7 +2166,7 @@ pub const ResolvedTarget = struct { |
| 2166 | pub fn unwrap(this: @This()) ?Index { | 2166 | pub fn unwrap(this: @This()) ?Index { |
| 2167 | return switch (this) { | 2167 | return switch (this) { |
| 2168 | .none => null, | 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,15 +2219,15 @@ pub const TargetQuery = struct { |
| 2219 | _, | 2219 | _, |
| 2220 | 2220 | ||
| 2221 | pub fn extraSlice(i: Index, extra: []const u32) []const u32 { | 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 | pub fn length(i: Index, extra: []const u32) usize { | 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 | pub fn get(this: @This(), c: *const Configuration) TargetQuery { | 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,7 +2236,7 @@ pub const TargetQuery = struct { |
| 2236 | _, | 2236 | _, |
| 2237 | 2237 | ||
| 2238 | pub fn init(i: Index) OptionalIndex { | 2238 | pub fn init(i: Index) OptionalIndex { |
| 2239 | const result: OptionalIndex = @enumFromInt(@intFromEnum(i)); | 2239 | const result: OptionalIndex = @fromBackingInt(@intCast(@backingInt(i))); |
| 2240 | assert(result != .none); | 2240 | assert(result != .none); |
| 2241 | return result; | 2241 | return result; |
| 2242 | } | 2242 | } |
| ... | @@ -2244,7 +2244,7 @@ pub const TargetQuery = struct { | ... | @@ -2244,7 +2244,7 @@ pub const TargetQuery = struct { |
| 2244 | pub fn unwrap(this: @This()) ?Index { | 2244 | pub fn unwrap(this: @This()) ?Index { |
| 2245 | return switch (this) { | 2245 | return switch (this) { |
| 2246 | .none => null, | 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,7 +2927,7 @@ pub const Storage = enum { |
| 2927 | pub const storage: Storage = .extended; | 2927 | pub const storage: Storage = .extended; |
| 2928 | 2928 | ||
| 2929 | pub fn tag(this: @This(), c: *const Configuration) @FieldType(BaseFlags, "tag") { | 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 | return base_flags.tag; | 2931 | return base_flags.tag; |
| 2932 | } | 2932 | } |
| 2933 | 2933 | ||
| ... | @@ -2936,14 +2936,14 @@ pub const Storage = enum { | ... | @@ -2936,14 +2936,14 @@ pub const Storage = enum { |
| 2936 | const info = @typeInfo(S.Flags).@"struct"; | 2936 | const info = @typeInfo(S.Flags).@"struct"; |
| 2937 | break :blk info.field_attrs[0].defaultValue(info.field_types[0]).?; | 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 | if (base_flags.tag != wanted_tag) return null; | 2940 | if (base_flags.tag != wanted_tag) return null; |
| 2941 | var i: usize = @intFromEnum(this); | 2941 | var i: usize = @backingInt(this); |
| 2942 | return data(c.extra, &i, S); | 2942 | return data(c.extra, &i, S); |
| 2943 | } | 2943 | } |
| 2944 | 2944 | ||
| 2945 | pub fn get(this: @This(), buffer: []const u32) U { | 2945 | pub fn get(this: @This(), buffer: []const u32) U { |
| 2946 | var i: usize = @intFromEnum(this); | 2946 | var i: usize = @backingInt(this); |
| 2947 | const base_flags: BaseFlags = @bitCast(buffer[i]); | 2947 | const base_flags: BaseFlags = @bitCast(buffer[i]); |
| 2948 | return switch (base_flags.tag) { | 2948 | return switch (base_flags.tag) { |
| 2949 | inline else => |t| @unionInit(U, @tagName(t), data(buffer, &i, @FieldType(U, @tagName(t)))), | 2949 | inline else => |t| @unionInit(U, @tagName(t), data(buffer, &i, @FieldType(U, @tagName(t)))), |
| ... | @@ -3071,7 +3071,7 @@ pub const Storage = enum { | ... | @@ -3071,7 +3071,7 @@ pub const Storage = enum { |
| 3071 | pub fn get(this: *const @This(), extra: []const u32, i: usize) Union { | 3071 | pub fn get(this: *const @This(), extra: []const u32, i: usize) Union { |
| 3072 | const elem = slice(this, extra)[i]; | 3072 | const elem = slice(this, extra)[i]; |
| 3073 | return switch (this.tag(extra, i)) { | 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,7 +3109,7 @@ pub const Storage = enum { |
| 3109 | inline else => |comptime_tag| @unionInit( | 3109 | inline else => |comptime_tag| @unionInit( |
| 3110 | T, | 3110 | T, |
| 3111 | @tagName(comptime_tag), | 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,7 +3133,7 @@ pub const Storage = enum { |
| 3133 | }, | 3133 | }, |
| 3134 | .@"enum" => { | 3134 | .@"enum" => { |
| 3135 | defer i.* += 1; | 3135 | defer i.* += 1; |
| 3136 | return @enumFromInt(buffer[i.*]); | 3136 | return @fromBackingInt(@intCast(buffer[i.*])); |
| 3137 | }, | 3137 | }, |
| 3138 | .@"struct" => |info| switch (info.layout) { | 3138 | .@"struct" => |info| switch (info.layout) { |
| 3139 | .@"packed" => switch (info.backing_integer.?) { | 3139 | .@"packed" => switch (info.backing_integer.?) { |
| ... | @@ -3176,7 +3176,7 @@ pub const Storage = enum { | ... | @@ -3176,7 +3176,7 @@ pub const Storage = enum { |
| 3176 | buffer, | 3176 | buffer, |
| 3177 | i, | 3177 | i, |
| 3178 | container, | 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,7 +3324,7 @@ pub const Storage = enum { |
| 3324 | else => comptime unreachable, | 3324 | else => comptime unreachable, |
| 3325 | }, | 3325 | }, |
| 3326 | .@"enum" => { | 3326 | .@"enum" => { |
| 3327 | buffer[i] = @intFromEnum(value); | 3327 | buffer[i] = @backingInt(value); |
| 3328 | return 1; | 3328 | return 1; |
| 3329 | }, | 3329 | }, |
| 3330 | .@"struct" => |info| switch (info.layout) { | 3330 | .@"struct" => |info| switch (info.layout) { |
| ... | @@ -3379,7 +3379,7 @@ pub const Storage = enum { | ... | @@ -3379,7 +3379,7 @@ pub const Storage = enum { |
| 3379 | const field_names = @typeInfo(Field.Elem).@"struct".field_names; | 3379 | const field_names = @typeInfo(Field.Elem).@"struct".field_names; |
| 3380 | inline for (0..field_names.len) |field_i| @memcpy( | 3380 | inline for (0..field_names.len) |field_i| @memcpy( |
| 3381 | buffer[i + 1 + field_i * len ..][0..len], | 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 | return 1 + field_names.len * len; | 3384 | return 1 + field_names.len * len; |
| 3385 | }, | 3385 | }, |
| ... | @@ -3429,7 +3429,7 @@ fn IndexType(comptime T: type) type { | ... | @@ -3429,7 +3429,7 @@ fn IndexType(comptime T: type) type { |
| 3429 | _, | 3429 | _, |
| 3430 | 3430 | ||
| 3431 | pub fn get(this: @This(), c: *const Configuration) T { | 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,7 +75,7 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi |
| 75 | // Add and then de-duplicate dependencies. | 75 | // Add and then de-duplicate dependencies. |
| 76 | const dep_steps = try arena.alloc(Configuration.Step.Index, step.dependencies.items.len); | 76 | const dep_steps = try arena.alloc(Configuration.Step.Index, step.dependencies.items.len); |
| 77 | for (dep_steps, step.dependencies.items) |*dest, src| | 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 | const deps: Configuration.Deps.Index = try wc.addDeduped(Configuration.Deps, .{ | 80 | const deps: Configuration.Deps.Index = try wc.addDeduped(Configuration.Deps, .{ |
| 81 | .steps = .{ .slice = dep_steps }, | 81 | .steps = .{ .slice = dep_steps }, |
| ... | @@ -87,7 +87,7 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi | ... | @@ -87,7 +87,7 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi |
| 87 | .owner = try s.builderToPackage(step.owner), | 87 | .owner = try s.builderToPackage(step.owner), |
| 88 | .deps = deps, | 88 | .deps = deps, |
| 89 | .max_rss = .fromBytes(step.max_rss), | 89 | .max_rss = .fromBytes(step.max_rss), |
| 90 | .extended = @enumFromInt(switch (step.tag) { | 90 | .extended = @fromBackingInt(@intCast(switch (step.tag) { |
| 91 | .top_level => e: { | 91 | .top_level => e: { |
| 92 | const top_level: *Step.TopLevel = @fieldParentPtr("step", step); | 92 | const top_level: *Step.TopLevel = @fieldParentPtr("step", step); |
| 93 | break :e try wc.addExtraErased(Configuration.Step.TopLevel, .{ | 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,8 +445,8 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi |
| 445 | }, | 445 | }, |
| 446 | .expect_term => |t| expect_term = switch (t) { | 446 | .expect_term => |t| expect_term = switch (t) { |
| 447 | .exited => |x| .{ .status = .exited, .value = x }, | 447 | .exited => |x| .{ .status = .exited, .value = x }, |
| 448 | .signal => |x| .{ .status = .signal, .value = @intFromEnum(x) }, | 448 | .signal => |x| .{ .status = .signal, .value = @backingInt(x) }, |
| 449 | .stopped => |x| .{ .status = .stopped, .value = @intFromEnum(x) }, | 449 | .stopped => |x| .{ .status = .stopped, .value = @backingInt(x) }, |
| 450 | .unknown => |x| .{ .status = .unknown, .value = x }, | 450 | .unknown => |x| .{ .status = .unknown, .value = x }, |
| 451 | }, | 451 | }, |
| 452 | .expect_stderr_snapshot => |path| expect_stderr_snapshot = try s.addLazyPath(path), | 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,7 +656,7 @@ pub fn write(b: *std.Build, wc: *Configuration.Wip, writer: *std.Io.Writer) !voi |
| 656 | .args = .{ .slice = args }, | 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,7 +734,7 @@ fn builderToPackage(s: *Serialize, b: *std.Build) !Configuration.Package.Index { |
| 734 | 734 | ||
| 735 | fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuration.LazyPath.OptionalIndex { | 735 | fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuration.LazyPath.OptionalIndex { |
| 736 | const wc = s.wc; | 736 | const wc = s.wc; |
| 737 | return @enumFromInt(switch (lp orelse return .none) { | 737 | return @fromBackingInt(@intCast(switch (lp orelse return .none) { |
| 738 | .src_path => |src_path| i: { | 738 | .src_path => |src_path| i: { |
| 739 | const sub_path = try wc.addString(src_path.sub_path); | 739 | const sub_path = try wc.addString(src_path.sub_path); |
| 740 | break :i try wc.addExtraErased(Configuration.LazyPath.SourcePath, .{ | 740 | break :i try wc.addExtraErased(Configuration.LazyPath.SourcePath, .{ |
| ... | @@ -770,7 +770,7 @@ fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuratio | ... | @@ -770,7 +770,7 @@ fn addOptionalLazyPathEnum(s: *Serialize, lp: ?std.Build.LazyPath) !Configuratio |
| 770 | .sub_path = sub_path, | 770 | .sub_path = sub_path, |
| 771 | }); | 771 | }); |
| 772 | }, | 772 | }, |
| 773 | }); | 773 | })); |
| 774 | } | 774 | } |
| 775 | 775 | ||
| 776 | fn addOptionalLazyPath(s: *Serialize, lp: ?std.Build.LazyPath) !?Configuration.LazyPath.Index { | 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,7 +778,7 @@ fn addOptionalLazyPath(s: *Serialize, lp: ?std.Build.LazyPath) !?Configuration.L |
| 778 | } | 778 | } |
| 779 | 779 | ||
| 780 | fn addLazyPath(s: *Serialize, lp: std.Build.LazyPath) !Configuration.LazyPath.Index { | 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 | fn addOptionalSemVer(s: *Serialize, sem_ver: ?std.SemanticVersion) !?Configuration.String { | 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,17 +1163,17 @@ fn addModule(s: *Serialize, m: *std.Build.Module) !Configuration.Module.Index { |
| 1163 | 1163 | ||
| 1164 | comptime assert(std.mem.eql(u8, @typeInfo(Configuration.Module).@"struct".field_names[2], "import_table")); | 1164 | comptime assert(std.mem.eql(u8, @typeInfo(Configuration.Module).@"struct".field_names[2], "import_table")); |
| 1165 | comptime assert(@typeInfo(Configuration.Module).@"struct".field_types[2] == Configuration.ImportTable.Index); | 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 | const import_table_index = try wc.addDeduped(Configuration.ImportTable, .{ | 1167 | const import_table_index = try wc.addDeduped(Configuration.ImportTable, .{ |
| 1168 | .imports = .{ .mal = imports }, | 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 | return module_index; | 1172 | return module_index; |
| 1173 | } | 1173 | } |
| 1174 | 1174 | ||
| 1175 | fn stepIndex(s: *const Serialize, step: *Step) Configuration.Step.Index { | 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 | fn addOptionalResolvedTarget( | 1179 | fn addOptionalResolvedTarget( |
lib/std/Build/abi.zig+1-1| ... | @@ -265,7 +265,7 @@ pub const fuzz = struct { | ... | @@ -265,7 +265,7 @@ pub const fuzz = struct { |
| 265 | return switch (@typeInfo(T)) { | 265 | return switch (@typeInfo(T)) { |
| 266 | .comptime_int => x, | 266 | .comptime_int => x, |
| 267 | .bool => @intFromBool(x), | 267 | .bool => @intFromBool(x), |
| 268 | .@"enum" => @intFromEnum(x), | 268 | .@"enum" => @backingInt(x), |
| 269 | else => @as(@Int(.unsigned, @bitSizeOf(T)), @bitCast(x)), | 269 | else => @as(@Int(.unsigned, @bitSizeOf(T)), @bitCast(x)), |
| 270 | 270 | ||
| 271 | .int => |i| x: { | 271 | .int => |i| x: { |
lib/std/Io.zig+15-15| ... | @@ -437,14 +437,14 @@ pub const Operation = union(enum) { | ... | @@ -437,14 +437,14 @@ pub const Operation = union(enum) { |
| 437 | _, | 437 | _, |
| 438 | 438 | ||
| 439 | pub fn fromIndex(i: usize) OptionalIndex { | 439 | pub fn fromIndex(i: usize) OptionalIndex { |
| 440 | const oi: OptionalIndex = @enumFromInt(i); | 440 | const oi: OptionalIndex = @fromBackingInt(@intCast(i)); |
| 441 | assert(oi != .none); | 441 | assert(oi != .none); |
| 442 | return oi; | 442 | return oi; |
| 443 | } | 443 | } |
| 444 | 444 | ||
| 445 | pub fn toIndex(oi: OptionalIndex) u32 { | 445 | pub fn toIndex(oi: OptionalIndex) u32 { |
| 446 | assert(oi != .none); | 446 | assert(oi != .none); |
| 447 | return @intFromEnum(oi); | 447 | return @backingInt(oi); |
| 448 | } | 448 | } |
| 449 | }; | 449 | }; |
| 450 | pub const List = struct { | 450 | pub const List = struct { |
| ... | @@ -640,13 +640,13 @@ pub const Limit = enum(usize) { | ... | @@ -640,13 +640,13 @@ pub const Limit = enum(usize) { |
| 640 | 640 | ||
| 641 | /// `math.maxInt(usize)` is interpreted to mean `.unlimited`. | 641 | /// `math.maxInt(usize)` is interpreted to mean `.unlimited`. |
| 642 | pub fn limited(n: usize) Limit { | 642 | pub fn limited(n: usize) Limit { |
| 643 | return @enumFromInt(n); | 643 | return @fromBackingInt(@intCast(n)); |
| 644 | } | 644 | } |
| 645 | 645 | ||
| 646 | /// Any value grater than `math.maxInt(usize)` is interpreted to mean | 646 | /// Any value grater than `math.maxInt(usize)` is interpreted to mean |
| 647 | /// `.unlimited`. | 647 | /// `.unlimited`. |
| 648 | pub fn limited64(n: u64) Limit { | 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 | pub fn countVec(data: []const []const u8) Limit { | 652 | pub fn countVec(data: []const []const u8) Limit { |
| ... | @@ -656,7 +656,7 @@ pub const Limit = enum(usize) { | ... | @@ -656,7 +656,7 @@ pub const Limit = enum(usize) { |
| 656 | } | 656 | } |
| 657 | 657 | ||
| 658 | pub fn min(a: Limit, b: Limit) Limit { | 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 | pub fn max(a: Limit, b: Limit) Limit { | 662 | pub fn max(a: Limit, b: Limit) Limit { |
| ... | @@ -664,15 +664,15 @@ pub const Limit = enum(usize) { | ... | @@ -664,15 +664,15 @@ pub const Limit = enum(usize) { |
| 664 | return .unlimited; | 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 | pub fn minInt(l: Limit, n: usize) usize { | 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 | pub fn minInt64(l: Limit, n: u64) usize { | 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 | pub fn slice(l: Limit, s: []u8) []u8 { | 678 | pub fn slice(l: Limit, s: []u8) []u8 { |
| ... | @@ -685,14 +685,14 @@ pub const Limit = enum(usize) { | ... | @@ -685,14 +685,14 @@ pub const Limit = enum(usize) { |
| 685 | 685 | ||
| 686 | pub fn toInt(l: Limit) ?usize { | 686 | pub fn toInt(l: Limit) ?usize { |
| 687 | return switch (l) { | 687 | return switch (l) { |
| 688 | else => @intFromEnum(l), | 688 | else => @backingInt(l), |
| 689 | .unlimited => null, | 689 | .unlimited => null, |
| 690 | }; | 690 | }; |
| 691 | } | 691 | } |
| 692 | 692 | ||
| 693 | pub fn toInt64(l: Limit) ?u64 { | 693 | pub fn toInt64(l: Limit) ?u64 { |
| 694 | return switch (l) { | 694 | return switch (l) { |
| 695 | else => @intFromEnum(l), | 695 | else => @backingInt(l), |
| 696 | .unlimited => null, | 696 | .unlimited => null, |
| 697 | }; | 697 | }; |
| 698 | } | 698 | } |
| ... | @@ -702,7 +702,7 @@ pub const Limit = enum(usize) { | ... | @@ -702,7 +702,7 @@ pub const Limit = enum(usize) { |
| 702 | /// between end-of-stream and reaching the limit. | 702 | /// between end-of-stream and reaching the limit. |
| 703 | pub fn slice1(l: Limit, non_empty_buffer: []u8) []u8 { | 703 | pub fn slice1(l: Limit, non_empty_buffer: []u8) []u8 { |
| 704 | assert(non_empty_buffer.len >= 1); | 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 | pub fn nonzero(l: Limit) bool { | 708 | pub fn nonzero(l: Limit) bool { |
| ... | @@ -713,8 +713,8 @@ pub const Limit = enum(usize) { | ... | @@ -713,8 +713,8 @@ pub const Limit = enum(usize) { |
| 713 | /// limit would be exceeded. | 713 | /// limit would be exceeded. |
| 714 | pub fn subtract(l: Limit, amount: usize) ?Limit { | 714 | pub fn subtract(l: Limit, amount: usize) ?Limit { |
| 715 | if (l == .unlimited) return .unlimited; | 715 | if (l == .unlimited) return .unlimited; |
| 716 | if (amount > @intFromEnum(l)) return null; | 716 | if (amount > @backingInt(l)) return null; |
| 717 | return @enumFromInt(@intFromEnum(l) - amount); | 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,7 +1583,7 @@ pub fn futexWait(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, e |
| 1583 | /// three possible wake-up reasons if necessary. | 1583 | /// three possible wake-up reasons if necessary. |
| 1584 | pub fn futexWaitTimeout(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, expected: T, timeout: Timeout) Cancelable!void { | 1584 | pub fn futexWaitTimeout(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, expected: T, timeout: Timeout) Cancelable!void { |
| 1585 | const expected_int: u32 = switch (@typeInfo(T)) { | 1585 | const expected_int: u32 = switch (@typeInfo(T)) { |
| 1586 | .@"enum" => @bitCast(@intFromEnum(expected)), | 1586 | .@"enum" => @bitCast(@backingInt(expected)), |
| 1587 | else => @bitCast(expected), | 1587 | else => @bitCast(expected), |
| 1588 | }; | 1588 | }; |
| 1589 | return io.vtable.futexWait(io.userdata, @ptrCast(ptr), expected_int, timeout); | 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,7 +1593,7 @@ pub fn futexWaitTimeout(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) con |
| 1593 | /// For a description of cancelation and cancelation points, see `Future.cancel`. | 1593 | /// For a description of cancelation and cancelation points, see `Future.cancel`. |
| 1594 | pub fn futexWaitUncancelable(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, expected: T) void { | 1594 | pub fn futexWaitUncancelable(io: Io, comptime T: type, ptr: *align(@alignOf(u32)) const T, expected: T) void { |
| 1595 | const expected_int: u32 = switch (@typeInfo(T)) { | 1595 | const expected_int: u32 = switch (@typeInfo(T)) { |
| 1596 | .@"enum" => @bitCast(@intFromEnum(expected)), | 1596 | .@"enum" => @bitCast(@backingInt(expected)), |
| 1597 | else => @bitCast(expected), | 1597 | else => @bitCast(expected), |
| 1598 | }; | 1598 | }; |
| 1599 | io.vtable.futexWaitUncancelable(io.userdata, @ptrCast(ptr), expected_int); | 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,15 +124,15 @@ const Fiber = struct { |
| 124 | const shift = 1; | 124 | const shift = 1; |
| 125 | 125 | ||
| 126 | fn subWrap(lhs: Awaiting, rhs: Awaiting) Awaiting { | 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 | fn fromCancelable(cancelable: *Cancelable) Awaiting { | 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 | fn toCancelable(awaiting: Awaiting) *Cancelable { | 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,7 +157,7 @@ const Fiber = struct { |
| 157 | const unblocked: CancelProtection = .{ .user = .unblocked, .acknowledged = false }; | 157 | const unblocked: CancelProtection = .{ .user = .unblocked, .acknowledged = false }; |
| 158 | 158 | ||
| 159 | fn check(cancel_protection: CancelProtection) Io.CancelProtection { | 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 | fn acknowledge(cancel_protection: *CancelProtection) void { | 163 | fn acknowledge(cancel_protection: *CancelProtection) void { |
| ... | @@ -1892,7 +1892,7 @@ fn deviceIoControl(o: *const Io.Operation.DeviceIoControl) Io.Cancelable!i32 { | ... | @@ -1892,7 +1892,7 @@ fn deviceIoControl(o: *const Io.Operation.DeviceIoControl) Io.Cancelable!i32 { |
| 1892 | switch (c.errno(rc)) { | 1892 | switch (c.errno(rc)) { |
| 1893 | .SUCCESS => return rc, | 1893 | .SUCCESS => return rc, |
| 1894 | .INTR => {}, | 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,7 +2805,7 @@ fn dirRealPathFile( |
| 2805 | assert(redundant_pointer == out_buffer.ptr); | 2805 | assert(redundant_pointer == out_buffer.ptr); |
| 2806 | return std.mem.indexOfScalar(u8, out_buffer, 0) orelse out_buffer.len; | 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 | switch (err) { | 2809 | switch (err) { |
| 2810 | .INTR => {}, | 2810 | .INTR => {}, |
| 2811 | .INVAL => return errnoBug(err), | 2811 | .INVAL => return errnoBug(err), |
| ... | @@ -3347,12 +3347,12 @@ fn fileWriteFileStreaming( | ... | @@ -3347,12 +3347,12 @@ fn fileWriteFileStreaming( |
| 3347 | ) File.Writer.WriteFileError!usize { | 3347 | ) File.Writer.WriteFileError!usize { |
| 3348 | const ev: *Evented = @ptrCast(@alignCast(userdata)); | 3348 | const ev: *Evented = @ptrCast(@alignCast(userdata)); |
| 3349 | const reader_buffered = file_reader.interface.buffered(); | 3349 | const reader_buffered = file_reader.interface.buffered(); |
| 3350 | if (reader_buffered.len >= @intFromEnum(limit)) { | 3350 | if (reader_buffered.len >= @backingInt(limit)) { |
| 3351 | const n = try fileWriteStreaming(ev, file, header, &.{limit.slice(reader_buffered)}, 1); | 3351 | const n = try fileWriteStreaming(ev, file, header, &.{limit.slice(reader_buffered)}, 1); |
| 3352 | file_reader.interface.toss(n -| header.len); | 3352 | file_reader.interface.toss(n -| header.len); |
| 3353 | return n; | 3353 | return n; |
| 3354 | } | 3354 | } |
| 3355 | const file_limit = @intFromEnum(limit) - reader_buffered.len; | 3355 | const file_limit = @backingInt(limit) - reader_buffered.len; |
| 3356 | const out_fd = file.handle; | 3356 | const out_fd = file.handle; |
| 3357 | const in_fd = file_reader.file.handle; | 3357 | const in_fd = file_reader.file.handle; |
| 3358 | 3358 | ||
| ... | @@ -3441,7 +3441,7 @@ fn fileWriteFilePositional( | ... | @@ -3441,7 +3441,7 @@ fn fileWriteFilePositional( |
| 3441 | ) File.WriteFilePositionalError!usize { | 3441 | ) File.WriteFilePositionalError!usize { |
| 3442 | const ev: *Evented = @ptrCast(@alignCast(userdata)); | 3442 | const ev: *Evented = @ptrCast(@alignCast(userdata)); |
| 3443 | const reader_buffered = file_reader.interface.buffered(); | 3443 | const reader_buffered = file_reader.interface.buffered(); |
| 3444 | if (reader_buffered.len >= @intFromEnum(limit)) { | 3444 | if (reader_buffered.len >= @backingInt(limit)) { |
| 3445 | const n = try fileWritePositional( | 3445 | const n = try fileWritePositional( |
| 3446 | ev, | 3446 | ev, |
| 3447 | file, | 3447 | file, |
| ... | @@ -3866,7 +3866,7 @@ fn fileMemoryMapCreate( | ... | @@ -3866,7 +3866,7 @@ fn fileMemoryMapCreate( |
| 3866 | const contents = while (true) { | 3866 | const contents = while (true) { |
| 3867 | const casted_offset = std.math.cast(i64, options.offset) orelse return error.Unseekable; | 3867 | const casted_offset = std.math.cast(i64, options.offset) orelse return error.Unseekable; |
| 3868 | const rc = c.mmap(null, options.len, prot, flags, file.handle, casted_offset); | 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 | switch (err) { | 3870 | switch (err) { |
| 3871 | .SUCCESS => break @as([*]align(page_align) u8, @ptrCast(@alignCast(rc)))[0..options.len], | 3871 | .SUCCESS => break @as([*]align(page_align) u8, @ptrCast(@alignCast(rc)))[0..options.len], |
| 3872 | .INTR => {}, | 3872 | .INTR => {}, |
| ... | @@ -4026,7 +4026,7 @@ fn unlockStderr(userdata: ?*anyopaque) void { | ... | @@ -4026,7 +4026,7 @@ fn unlockStderr(userdata: ?*anyopaque) void { |
| 4026 | fn processCurrentPath(userdata: ?*anyopaque, buffer: []u8) process.CurrentPathError!usize { | 4026 | fn processCurrentPath(userdata: ?*anyopaque, buffer: []u8) process.CurrentPathError!usize { |
| 4027 | const ev: *Evented = @ptrCast(@alignCast(userdata)); | 4027 | const ev: *Evented = @ptrCast(@alignCast(userdata)); |
| 4028 | _ = ev; | 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 | switch (err) { | 4030 | switch (err) { |
| 4031 | .SUCCESS => return std.mem.findScalar(u8, buffer, 0).?, | 4031 | .SUCCESS => return std.mem.findScalar(u8, buffer, 0).?, |
| 4032 | .NOENT => return error.CurrentDirUnlinked, | 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,7 +340,7 @@ pub const Permissions = std.Options.FilePermissions orelse if (is_windows) enum( |
| 340 | const windows = std.os.windows; | 340 | const windows = std.os.windows; |
| 341 | 341 | ||
| 342 | pub fn toAttributes(self: @This()) windows.FILE.ATTRIBUTE { | 342 | pub fn toAttributes(self: @This()) windows.FILE.ATTRIBUTE { |
| 343 | return @bitCast(@intFromEnum(self)); | 343 | return @bitCast(@backingInt(self)); |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | pub fn readOnly(self: @This()) bool { | 346 | pub fn readOnly(self: @This()) bool { |
| ... | @@ -350,10 +350,10 @@ pub const Permissions = std.Options.FilePermissions orelse if (is_windows) enum( | ... | @@ -350,10 +350,10 @@ pub const Permissions = std.Options.FilePermissions orelse if (is_windows) enum( |
| 350 | 350 | ||
| 351 | pub fn setReadOnly(self: @This(), read_only: bool) @This() { | 351 | pub fn setReadOnly(self: @This(), read_only: bool) @This() { |
| 352 | const attributes = toAttributes(self); | 352 | const attributes = toAttributes(self); |
| 353 | return @enumFromInt(if (read_only) | 353 | return @fromBackingInt(@intCast(if (read_only) |
| 354 | attributes | windows.FILE_ATTRIBUTE_READONLY | 354 | attributes | windows.FILE_ATTRIBUTE_READONLY |
| 355 | else | 355 | else |
| 356 | attributes & ~@as(windows.DWORD, windows.FILE_ATTRIBUTE_READONLY)); | 356 | attributes & ~@as(windows.DWORD, windows.FILE_ATTRIBUTE_READONLY))); |
| 357 | } | 357 | } |
| 358 | } else if (std.posix.mode_t != u0) enum(std.posix.mode_t) { | 358 | } else if (std.posix.mode_t != u0) enum(std.posix.mode_t) { |
| 359 | /// This is the default mode given to POSIX operating systems for creating | 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,11 +375,11 @@ pub const Permissions = std.Options.FilePermissions orelse if (is_windows) enum( |
| 375 | pub const executable_file: @This() = .default_dir; | 375 | pub const executable_file: @This() = .default_dir; |
| 376 | 376 | ||
| 377 | pub fn toMode(self: @This()) std.posix.mode_t { | 377 | pub fn toMode(self: @This()) std.posix.mode_t { |
| 378 | return @intFromEnum(self); | 378 | return @backingInt(self); |
| 379 | } | 379 | } |
| 380 | 380 | ||
| 381 | pub fn fromMode(mode: std.posix.mode_t) @This() { | 381 | pub fn fromMode(mode: std.posix.mode_t) @This() { |
| 382 | return @enumFromInt(mode); | 382 | return @fromBackingInt(@intCast(mode)); |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | /// Returns `true` if and only if no class has write permissions. | 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,7 +392,7 @@ pub const Permissions = std.Options.FilePermissions orelse if (is_windows) enum( |
| 392 | pub fn setReadOnly(self: @This(), read_only: bool) @This() { | 392 | pub fn setReadOnly(self: @This(), read_only: bool) @This() { |
| 393 | const mode = toMode(self); | 393 | const mode = toMode(self); |
| 394 | const o222 = @as(std.posix.mode_t, 0o222); | 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 | } else enum(u0) { | 397 | } else enum(u0) { |
| 398 | default_file = 0, | 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,7 +311,7 @@ fn discard(io_reader: *Io.Reader, limit: Io.Limit) Io.Reader.Error!usize { |
| 311 | const logical_pos = logicalPos(r); | 311 | const logical_pos = logicalPos(r); |
| 312 | const bytes_remaining = size - logical_pos; | 312 | const bytes_remaining = size - logical_pos; |
| 313 | if (bytes_remaining == 0) return error.EndOfStream; | 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 | setLogicalPos(r, logical_pos + delta); | 315 | setLogicalPos(r, logical_pos + delta); |
| 316 | return delta; | 316 | return delta; |
| 317 | }, | 317 | }, |
| ... | @@ -324,7 +324,7 @@ fn discard(io_reader: *Io.Reader, limit: Io.Limit) Io.Reader.Error!usize { | ... | @@ -324,7 +324,7 @@ fn discard(io_reader: *Io.Reader, limit: Io.Limit) Io.Reader.Error!usize { |
| 324 | if (r.size_err == null and r.seek_err == null) break :fallback; | 324 | if (r.size_err == null and r.seek_err == null) break :fallback; |
| 325 | 325 | ||
| 326 | const buffered_len = r.interface.bufferedLen(); | 326 | const buffered_len = r.interface.bufferedLen(); |
| 327 | var remaining = @intFromEnum(limit); | 327 | var remaining = @backingInt(limit); |
| 328 | if (remaining <= buffered_len) { | 328 | if (remaining <= buffered_len) { |
| 329 | r.interface.seek += remaining; | 329 | r.interface.seek += remaining; |
| 330 | return remaining; | 330 | return remaining; |
| ... | @@ -356,10 +356,10 @@ fn discard(io_reader: *Io.Reader, limit: Io.Limit) Io.Reader.Error!usize { | ... | @@ -356,10 +356,10 @@ fn discard(io_reader: *Io.Reader, limit: Io.Limit) Io.Reader.Error!usize { |
| 356 | } else { | 356 | } else { |
| 357 | remaining -= n; | 357 | remaining -= n; |
| 358 | } | 358 | } |
| 359 | return @intFromEnum(limit) - remaining; | 359 | return @backingInt(limit) - remaining; |
| 360 | } | 360 | } |
| 361 | const size = r.getSize() catch return 0; | 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 | io.vtable.fileSeekBy(io.userdata, file, n) catch |err| { | 363 | io.vtable.fileSeekBy(io.userdata, file, n) catch |err| { |
| 364 | r.seek_err = err; | 364 | r.seek_err = err; |
| 365 | return 0; | 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,7 +332,7 @@ fn schedule(k: *Kqueue, thread: *Thread, ready_queue: Fiber.Queue) void { |
| 332 | .flags = std.c.EV.ADD | std.c.EV.ONESHOT, | 332 | .flags = std.c.EV.ADD | std.c.EV.ONESHOT, |
| 333 | .fflags = std.c.NOTE.TRIGGER, | 333 | .fflags = std.c.NOTE.TRIGGER, |
| 334 | .data = 0, | 334 | .data = 0, |
| 335 | .udata = @intFromEnum(Completion.UserData.wakeup), | 335 | .udata = @backingInt(Completion.UserData.wakeup), |
| 336 | }, | 336 | }, |
| 337 | }; | 337 | }; |
| 338 | // If an error occurs it only pessimises scheduling. | 338 | // If an error occurs it only pessimises scheduling. |
| ... | @@ -439,7 +439,7 @@ fn idle(k: *Kqueue, thread: *Thread) void { | ... | @@ -439,7 +439,7 @@ fn idle(k: *Kqueue, thread: *Thread) void { |
| 439 | @panic(@errorName(err)); // TODO | 439 | @panic(@errorName(err)); // TODO |
| 440 | }; | 440 | }; |
| 441 | var maybe_ready_queue: ?Fiber.Queue = null; | 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 | .unused => unreachable, // bad submission queued? | 443 | .unused => unreachable, // bad submission queued? |
| 444 | .wakeup => {}, | 444 | .wakeup => {}, |
| 445 | .cleanup => @panic("failed to notify other threads that we are exiting"), | 445 | .cleanup => @panic("failed to notify other threads that we are exiting"), |
| ... | @@ -522,7 +522,7 @@ const SwitchMessage = struct { | ... | @@ -522,7 +522,7 @@ const SwitchMessage = struct { |
| 522 | .flags = std.c.EV.ADD | std.c.EV.ONESHOT, | 522 | .flags = std.c.EV.ADD | std.c.EV.ONESHOT, |
| 523 | .fflags = std.c.NOTE.TRIGGER, | 523 | .fflags = std.c.NOTE.TRIGGER, |
| 524 | .data = 0, | 524 | .data = 0, |
| 525 | .udata = @intFromEnum(Completion.UserData.exit), | 525 | .udata = @backingInt(Completion.UserData.exit), |
| 526 | }, | 526 | }, |
| 527 | }; | 527 | }; |
| 528 | _ = kevent(each_thread.kq_fd, &changes, &.{}, null) catch |err| { | 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,7 +174,7 @@ pub fn stream(r: *Reader, w: *Writer, limit: Limit) StreamError!usize { |
| 174 | return n; | 174 | return n; |
| 175 | } | 175 | } |
| 176 | const n = try r.vtable.stream(r, w, limit); | 176 | const n = try r.vtable.stream(r, w, limit); |
| 177 | assert(n <= @intFromEnum(limit)); | 177 | assert(n <= @backingInt(limit)); |
| 178 | return n; | 178 | return n; |
| 179 | } | 179 | } |
| 180 | 180 | ||
| ... | @@ -189,7 +189,7 @@ pub fn discard(r: *Reader, limit: Limit) Error!usize { | ... | @@ -189,7 +189,7 @@ pub fn discard(r: *Reader, limit: Limit) Error!usize { |
| 189 | } else .unlimited; | 189 | } else .unlimited; |
| 190 | r.seek = r.end; | 190 | r.seek = r.end; |
| 191 | const n = try r.vtable.discard(r, remaining); | 191 | const n = try r.vtable.discard(r, remaining); |
| 192 | assert(n <= @intFromEnum(remaining)); | 192 | assert(n <= @backingInt(remaining)); |
| 193 | return buffered_len + n; | 193 | return buffered_len + n; |
| 194 | } | 194 | } |
| 195 | 195 | ||
| ... | @@ -204,11 +204,11 @@ pub fn defaultDiscard(r: *Reader, limit: Limit) Error!usize { | ... | @@ -204,11 +204,11 @@ pub fn defaultDiscard(r: *Reader, limit: Limit) Error!usize { |
| 204 | }; | 204 | }; |
| 205 | // If `stream` wrote to `r.buffer` without going through the writer, | 205 | // If `stream` wrote to `r.buffer` without going through the writer, |
| 206 | // we need to discard as much of the buffered data as possible. | 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 | const buffered_n_to_discard = @min(remaining, r.end - r.seek); | 208 | const buffered_n_to_discard = @min(remaining, r.end - r.seek); |
| 209 | n += buffered_n_to_discard; | 209 | n += buffered_n_to_discard; |
| 210 | r.seek += buffered_n_to_discard; | 210 | r.seek += buffered_n_to_discard; |
| 211 | assert(n <= @intFromEnum(limit)); | 211 | assert(n <= @backingInt(limit)); |
| 212 | return n; | 212 | return n; |
| 213 | } | 213 | } |
| 214 | 214 | ||
| ... | @@ -1010,17 +1010,17 @@ pub fn streamDelimiterLimit( | ... | @@ -1010,17 +1010,17 @@ pub fn streamDelimiterLimit( |
| 1010 | delimiter: u8, | 1010 | delimiter: u8, |
| 1011 | limit: Limit, | 1011 | limit: Limit, |
| 1012 | ) StreamDelimiterLimitError!usize { | 1012 | ) StreamDelimiterLimitError!usize { |
| 1013 | var remaining = @intFromEnum(limit); | 1013 | var remaining = @backingInt(limit); |
| 1014 | while (remaining != 0) { | 1014 | while (remaining != 0) { |
| 1015 | const available = Limit.limited(remaining).slice(r.peekGreedy(1) catch |err| switch (err) { | 1015 | const available = Limit.limited(remaining).slice(r.peekGreedy(1) catch |err| switch (err) { |
| 1016 | error.ReadFailed => |e| return e, | 1016 | error.ReadFailed => |e| return e, |
| 1017 | error.EndOfStream => return @intFromEnum(limit) - remaining, | 1017 | error.EndOfStream => return @backingInt(limit) - remaining, |
| 1018 | }); | 1018 | }); |
| 1019 | if (std.mem.findScalar(u8, available, delimiter)) |delimiter_index| { | 1019 | if (std.mem.findScalar(u8, available, delimiter)) |delimiter_index| { |
| 1020 | try w.writeAll(available[0..delimiter_index]); | 1020 | try w.writeAll(available[0..delimiter_index]); |
| 1021 | r.toss(delimiter_index); | 1021 | r.toss(delimiter_index); |
| 1022 | remaining -= delimiter_index; | 1022 | remaining -= delimiter_index; |
| 1023 | return @intFromEnum(limit) - remaining; | 1023 | return @backingInt(limit) - remaining; |
| 1024 | } | 1024 | } |
| 1025 | try w.writeAll(available); | 1025 | try w.writeAll(available); |
| 1026 | r.toss(available.len); | 1026 | r.toss(available.len); |
| ... | @@ -1081,16 +1081,16 @@ pub const DiscardDelimiterLimitError = error{ | ... | @@ -1081,16 +1081,16 @@ pub const DiscardDelimiterLimitError = error{ |
| 1081 | /// Succeeds if stream ends before delimiter found. End of stream can be | 1081 | /// Succeeds if stream ends before delimiter found. End of stream can be |
| 1082 | /// detected by checking if the delimiter is buffered. | 1082 | /// detected by checking if the delimiter is buffered. |
| 1083 | pub fn discardDelimiterLimit(r: *Reader, delimiter: u8, limit: Limit) DiscardDelimiterLimitError!usize { | 1083 | pub fn discardDelimiterLimit(r: *Reader, delimiter: u8, limit: Limit) DiscardDelimiterLimitError!usize { |
| 1084 | var remaining = @intFromEnum(limit); | 1084 | var remaining = @backingInt(limit); |
| 1085 | while (remaining != 0) { | 1085 | while (remaining != 0) { |
| 1086 | const available = Limit.limited(remaining).slice(r.peekGreedy(1) catch |err| switch (err) { | 1086 | const available = Limit.limited(remaining).slice(r.peekGreedy(1) catch |err| switch (err) { |
| 1087 | error.ReadFailed => |e| return e, | 1087 | error.ReadFailed => |e| return e, |
| 1088 | error.EndOfStream => return @intFromEnum(limit) - remaining, | 1088 | error.EndOfStream => return @backingInt(limit) - remaining, |
| 1089 | }); | 1089 | }); |
| 1090 | if (std.mem.findScalar(u8, available, delimiter)) |delimiter_index| { | 1090 | if (std.mem.findScalar(u8, available, delimiter)) |delimiter_index| { |
| 1091 | r.toss(delimiter_index); | 1091 | r.toss(delimiter_index); |
| 1092 | remaining -= delimiter_index; | 1092 | remaining -= delimiter_index; |
| 1093 | return @intFromEnum(limit) - remaining; | 1093 | return @backingInt(limit) - remaining; |
| 1094 | } | 1094 | } |
| 1095 | r.toss(available.len); | 1095 | r.toss(available.len); |
| 1096 | remaining -= available.len; | 1096 | remaining -= available.len; |
| ... | @@ -1704,7 +1704,7 @@ test takeEnum { | ... | @@ -1704,7 +1704,7 @@ test takeEnum { |
| 1704 | const E1 = enum(u8) { a, b, c }; | 1704 | const E1 = enum(u8) { a, b, c }; |
| 1705 | const E2 = enum(u16) { _ }; | 1705 | const E2 = enum(u16) { _ }; |
| 1706 | try testing.expectEqual(E1.c, try r.takeEnum(E1, .little)); | 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 | test readSliceShort { | 1710 | test readSliceShort { |
lib/std/Io/Reader/Limited.zig+2-2| ... | @@ -40,11 +40,11 @@ test stream { | ... | @@ -40,11 +40,11 @@ test stream { |
| 40 | var fixed: std.Io.Reader = .fixed(&orig_buf); | 40 | var fixed: std.Io.Reader = .fixed(&orig_buf); |
| 41 | 41 | ||
| 42 | var limit_buf: [1]u8 = undefined; | 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 | var result_buf: [10]u8 = undefined; | 45 | var result_buf: [10]u8 = undefined; |
| 46 | var fixed_writer: std.Io.Writer = .fixed(&result_buf); | 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 | try std.testing.expect(streamed == 4); | 49 | try std.testing.expect(streamed == 4); |
| 50 | try std.testing.expectEqualStrings("test", result_buf[0..streamed]); | 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,7 +581,7 @@ const Group = struct { |
| 581 | var it = t.worker_threads.load(.acquire); // acquire `Thread` values | 581 | var it = t.worker_threads.load(.acquire); // acquire `Thread` values |
| 582 | while (it) |thread| : (it = thread.next) { | 582 | while (it) |thread| : (it = thread.next) { |
| 583 | // This non-mutating RMW exists for ordering reasons: see comment in `Group.Task.start` for reasons. | 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 | if (thread.cancelAwaitable(.fromGroup(g.ptr))) any_blocked = true; | 585 | if (thread.cancelAwaitable(.fromGroup(g.ptr))) any_blocked = true; |
| 586 | } | 586 | } |
| 587 | return any_blocked; | 587 | return any_blocked; |
| ... | @@ -1019,7 +1019,7 @@ const Thread = struct { | ... | @@ -1019,7 +1019,7 @@ const Thread = struct { |
| 1019 | }; | 1019 | }; |
| 1020 | syscall.finish(); | 1020 | syscall.finish(); |
| 1021 | if (status >= 0) return; | 1021 | if (status >= 0) return; |
| 1022 | switch (@as(c.E, @enumFromInt(-status))) { | 1022 | switch (@as(c.E, @fromBackingInt(@intCast(-status)))) { |
| 1023 | .INTR => {}, // spurious wake | 1023 | .INTR => {}, // spurious wake |
| 1024 | // Address of the futex was paged out. This is unlikely, but possible in theory, and | 1024 | // Address of the futex was paged out. This is unlikely, but possible in theory, and |
| 1025 | // pthread/libdispatch on darwin bother to handle it. In this case we'll return | 1025 | // pthread/libdispatch on darwin bother to handle it. In this case we'll return |
| ... | @@ -1030,7 +1030,7 @@ const Thread = struct { | ... | @@ -1030,7 +1030,7 @@ const Thread = struct { |
| 1030 | } | 1030 | } |
| 1031 | }, | 1031 | }, |
| 1032 | .freebsd => { | 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 | var tm_size: usize = 0; | 1034 | var tm_size: usize = 0; |
| 1035 | var tm: std.c._umtx_time = undefined; | 1035 | var tm: std.c._umtx_time = undefined; |
| 1036 | var tm_ptr: ?*const std.c._umtx_time = null; | 1036 | var tm_ptr: ?*const std.c._umtx_time = null; |
| ... | @@ -1147,7 +1147,7 @@ const Thread = struct { | ... | @@ -1147,7 +1147,7 @@ const Thread = struct { |
| 1147 | while (true) { | 1147 | while (true) { |
| 1148 | const status = c.__ulock_wake(flags, ptr, 0); | 1148 | const status = c.__ulock_wake(flags, ptr, 0); |
| 1149 | if (status >= 0) return; | 1149 | if (status >= 0) return; |
| 1150 | switch (@as(c.E, @enumFromInt(-status))) { | 1150 | switch (@as(c.E, @fromBackingInt(@intCast(-status)))) { |
| 1151 | .INTR, .CANCELED => continue, // spurious wake() | 1151 | .INTR, .CANCELED => continue, // spurious wake() |
| 1152 | .FAULT => unreachable, // __ulock_wake doesn't generate EFAULT according to darwin pthread_cond_t | 1152 | .FAULT => unreachable, // __ulock_wake doesn't generate EFAULT according to darwin pthread_cond_t |
| 1153 | .NOENT => return, // nothing was woken up | 1153 | .NOENT => return, // nothing was woken up |
| ... | @@ -1159,7 +1159,7 @@ const Thread = struct { | ... | @@ -1159,7 +1159,7 @@ const Thread = struct { |
| 1159 | .freebsd => { | 1159 | .freebsd => { |
| 1160 | const rc = std.c._umtx_op( | 1160 | const rc = std.c._umtx_op( |
| 1161 | @intFromPtr(ptr), | 1161 | @intFromPtr(ptr), |
| 1162 | @intFromEnum(std.c.UMTX_OP.WAKE_PRIVATE), | 1162 | @backingInt(std.c.UMTX_OP.WAKE_PRIVATE), |
| 1163 | @as(c_ulong, @min(max_waiters, std.math.maxInt(c_int))), | 1163 | @as(c_ulong, @min(max_waiters, std.math.maxInt(c_int))), |
| 1164 | 0, // there is no timeout struct | 1164 | 0, // there is no timeout struct |
| 1165 | 0, // there is no timeout struct pointer | 1165 | 0, // there is no timeout struct pointer |
| ... | @@ -1283,9 +1283,9 @@ const Thread = struct { | ... | @@ -1283,9 +1283,9 @@ const Thread = struct { |
| 1283 | .linux => { | 1283 | .linux => { |
| 1284 | const pid: posix.pid_t = pid: { | 1284 | const pid: posix.pid_t = pid: { |
| 1285 | const cached_pid = @atomicLoad(Pid, &t.pid, .monotonic); | 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 | const pid = std.os.linux.getpid(); | 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 | break :pid pid; | 1289 | break :pid pid; |
| 1290 | }; | 1290 | }; |
| 1291 | return switch (std.os.linux.tgkill(pid, @bitCast(thread.id), .IO)) { | 1291 | return switch (std.os.linux.tgkill(pid, @bitCast(thread.id), .IO)) { |
| ... | @@ -1352,7 +1352,7 @@ const Syscall = struct { | ... | @@ -1352,7 +1352,7 @@ const Syscall = struct { |
| 1352 | .unblocked => {}, | 1352 | .unblocked => {}, |
| 1353 | } | 1353 | } |
| 1354 | switch (thread.status.fetchOr(.{ | 1354 | switch (thread.status.fetchOr(.{ |
| 1355 | .cancelation = @enumFromInt(0b011), | 1355 | .cancelation = @fromBackingInt(@intCast(0b011)), |
| 1356 | .awaitable = .null, | 1356 | .awaitable = .null, |
| 1357 | }, .monotonic).cancelation) { | 1357 | }, .monotonic).cancelation) { |
| 1358 | .parked => unreachable, | 1358 | .parked => unreachable, |
| ... | @@ -1372,7 +1372,7 @@ const Syscall = struct { | ... | @@ -1372,7 +1372,7 @@ const Syscall = struct { |
| 1372 | fn checkCancel(s: Syscall) Io.Cancelable!void { | 1372 | fn checkCancel(s: Syscall) Io.Cancelable!void { |
| 1373 | const thread = s.thread orelse return; | 1373 | const thread = s.thread orelse return; |
| 1374 | switch (thread.status.fetchOr(.{ | 1374 | switch (thread.status.fetchOr(.{ |
| 1375 | .cancelation = @enumFromInt(0b010), | 1375 | .cancelation = @fromBackingInt(@intCast(0b010)), |
| 1376 | .awaitable = .null, | 1376 | .awaitable = .null, |
| 1377 | }, .monotonic).cancelation) { | 1377 | }, .monotonic).cancelation) { |
| 1378 | .none => unreachable, | 1378 | .none => unreachable, |
| ... | @@ -1389,7 +1389,7 @@ const Syscall = struct { | ... | @@ -1389,7 +1389,7 @@ const Syscall = struct { |
| 1389 | fn finish(s: Syscall) void { | 1389 | fn finish(s: Syscall) void { |
| 1390 | const thread = s.thread orelse return; | 1390 | const thread = s.thread orelse return; |
| 1391 | switch (thread.status.fetchXor(.{ | 1391 | switch (thread.status.fetchXor(.{ |
| 1392 | .cancelation = @enumFromInt(0b011), | 1392 | .cancelation = @fromBackingInt(@intCast(0b011)), |
| 1393 | .awaitable = .null, | 1393 | .awaitable = .null, |
| 1394 | }, .monotonic).cancelation) { | 1394 | }, .monotonic).cancelation) { |
| 1395 | .none => unreachable, | 1395 | .none => unreachable, |
| ... | @@ -1474,7 +1474,7 @@ const AlertableSyscall = struct { | ... | @@ -1474,7 +1474,7 @@ const AlertableSyscall = struct { |
| 1474 | .unblocked => {}, | 1474 | .unblocked => {}, |
| 1475 | } | 1475 | } |
| 1476 | const old_status = thread.status.fetchOr(.{ | 1476 | const old_status = thread.status.fetchOr(.{ |
| 1477 | .cancelation = @enumFromInt(0b010), | 1477 | .cancelation = @fromBackingInt(@intCast(0b010)), |
| 1478 | .awaitable = .null, | 1478 | .awaitable = .null, |
| 1479 | }, .monotonic); | 1479 | }, .monotonic); |
| 1480 | switch (old_status.cancelation) { | 1480 | switch (old_status.cancelation) { |
| ... | @@ -1497,7 +1497,7 @@ const AlertableSyscall = struct { | ... | @@ -1497,7 +1497,7 @@ const AlertableSyscall = struct { |
| 1497 | comptime assert(is_windows); | 1497 | comptime assert(is_windows); |
| 1498 | const thread = s.thread orelse return; | 1498 | const thread = s.thread orelse return; |
| 1499 | const old_status = thread.status.fetchOr(.{ | 1499 | const old_status = thread.status.fetchOr(.{ |
| 1500 | .cancelation = @enumFromInt(0b010), | 1500 | .cancelation = @fromBackingInt(@intCast(0b010)), |
| 1501 | .awaitable = .null, | 1501 | .awaitable = .null, |
| 1502 | }, .monotonic); | 1502 | }, .monotonic); |
| 1503 | switch (old_status.cancelation) { | 1503 | switch (old_status.cancelation) { |
| ... | @@ -1520,7 +1520,7 @@ const AlertableSyscall = struct { | ... | @@ -1520,7 +1520,7 @@ const AlertableSyscall = struct { |
| 1520 | comptime assert(is_windows); | 1520 | comptime assert(is_windows); |
| 1521 | const thread = s.thread orelse return; | 1521 | const thread = s.thread orelse return; |
| 1522 | switch (thread.status.fetchXor(.{ | 1522 | switch (thread.status.fetchXor(.{ |
| 1523 | .cancelation = @enumFromInt(0b010), | 1523 | .cancelation = @fromBackingInt(@intCast(0b010)), |
| 1524 | .awaitable = .null, | 1524 | .awaitable = .null, |
| 1525 | }, .monotonic).cancelation) { | 1525 | }, .monotonic).cancelation) { |
| 1526 | .none => unreachable, | 1526 | .none => unreachable, |
| ... | @@ -2094,7 +2094,7 @@ fn async( | ... | @@ -2094,7 +2094,7 @@ fn async( |
| 2094 | 2094 | ||
| 2095 | const busy_count = t.busy_count; | 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 | mutexUnlock(&t.mutex); | 2098 | mutexUnlock(&t.mutex); |
| 2099 | future.destroy(gpa); | 2099 | future.destroy(gpa); |
| 2100 | start(context.ptr, result.ptr); | 2100 | start(context.ptr, result.ptr); |
| ... | @@ -2147,7 +2147,7 @@ fn concurrent( | ... | @@ -2147,7 +2147,7 @@ fn concurrent( |
| 2147 | 2147 | ||
| 2148 | const busy_count = t.busy_count; | 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 | return error.ConcurrencyUnavailable; | 2151 | return error.ConcurrencyUnavailable; |
| 2152 | 2152 | ||
| 2153 | t.busy_count = busy_count + 1; | 2153 | t.busy_count = busy_count + 1; |
| ... | @@ -2191,7 +2191,7 @@ fn groupAsync( | ... | @@ -2191,7 +2191,7 @@ fn groupAsync( |
| 2191 | 2191 | ||
| 2192 | const busy_count = t.busy_count; | 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 | mutexUnlock(&t.mutex); | 2195 | mutexUnlock(&t.mutex); |
| 2196 | task.destroy(gpa); | 2196 | task.destroy(gpa); |
| 2197 | return groupAsyncEager(start, context.ptr); | 2197 | return groupAsyncEager(start, context.ptr); |
| ... | @@ -2255,7 +2255,7 @@ fn groupConcurrent( | ... | @@ -2255,7 +2255,7 @@ fn groupConcurrent( |
| 2255 | 2255 | ||
| 2256 | const busy_count = t.busy_count; | 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 | return error.ConcurrencyUnavailable; | 2259 | return error.ConcurrencyUnavailable; |
| 2260 | 2260 | ||
| 2261 | t.busy_count = busy_count + 1; | 2261 | t.busy_count = busy_count + 1; |
| ... | @@ -2382,7 +2382,7 @@ fn recancel(userdata: ?*anyopaque) void { | ... | @@ -2382,7 +2382,7 @@ fn recancel(userdata: ?*anyopaque) void { |
| 2382 | fn recancelInner() void { | 2382 | fn recancelInner() void { |
| 2383 | const thread = Thread.current.?; // called `recancel` but was not canceled | 2383 | const thread = Thread.current.?; // called `recancel` but was not canceled |
| 2384 | switch (thread.status.fetchXor(.{ | 2384 | switch (thread.status.fetchXor(.{ |
| 2385 | .cancelation = @enumFromInt(0b001), | 2385 | .cancelation = @fromBackingInt(@intCast(0b001)), |
| 2386 | .awaitable = .null, | 2386 | .awaitable = .null, |
| 2387 | }, .monotonic).cancelation) { | 2387 | }, .monotonic).cancelation) { |
| 2388 | .canceled => {}, | 2388 | .canceled => {}, |
| ... | @@ -5347,7 +5347,7 @@ fn dirOpenDirHaiku( | ... | @@ -5347,7 +5347,7 @@ fn dirOpenDirHaiku( |
| 5347 | syscall.finish(); | 5347 | syscall.finish(); |
| 5348 | return .{ .handle = rc }; | 5348 | return .{ .handle = rc }; |
| 5349 | } | 5349 | } |
| 5350 | switch (@as(posix.E, @enumFromInt(rc))) { | 5350 | switch (@as(posix.E, @fromBackingInt(@intCast(rc)))) { |
| 5351 | .INTR => { | 5351 | .INTR => { |
| 5352 | try syscall.checkCancel(); | 5352 | try syscall.checkCancel(); |
| 5353 | continue; | 5353 | continue; |
| ... | @@ -5826,7 +5826,7 @@ fn dirReadHaiku(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir | ... | @@ -5826,7 +5826,7 @@ fn dirReadHaiku(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir |
| 5826 | const syscall: Syscall = try .start(); | 5826 | const syscall: Syscall = try .start(); |
| 5827 | while (true) { | 5827 | while (true) { |
| 5828 | const rc = posix.system._kern_rewind_dir(dr.dir.handle); | 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 | .SUCCESS => { | 5830 | .SUCCESS => { |
| 5831 | syscall.finish(); | 5831 | syscall.finish(); |
| 5832 | break; | 5832 | break; |
| ... | @@ -5848,7 +5848,7 @@ fn dirReadHaiku(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir | ... | @@ -5848,7 +5848,7 @@ fn dirReadHaiku(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir |
| 5848 | const syscall: Syscall = try .start(); | 5848 | const syscall: Syscall = try .start(); |
| 5849 | const n: usize = while (true) { | 5849 | const n: usize = while (true) { |
| 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))); | 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 | .SUCCESS => { | 5852 | .SUCCESS => { |
| 5853 | syscall.finish(); | 5853 | syscall.finish(); |
| 5854 | break @intCast(rc); | 5854 | break @intCast(rc); |
| ... | @@ -5891,7 +5891,7 @@ fn dirReadHaiku(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir | ... | @@ -5891,7 +5891,7 @@ fn dirReadHaiku(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir |
| 5891 | const syscall: Syscall = try .start(); | 5891 | const syscall: Syscall = try .start(); |
| 5892 | while (true) { | 5892 | while (true) { |
| 5893 | const rc = posix.system._kern_read_stat(dr.dir.handle, name, false, &stat, @sizeOf(std.c.Stat)); | 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 | .SUCCESS => { | 5895 | .SUCCESS => { |
| 5896 | syscall.finish(); | 5896 | syscall.finish(); |
| 5897 | break; | 5897 | break; |
| ... | @@ -6819,7 +6819,7 @@ fn dirRealPathFilePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, o | ... | @@ -6819,7 +6819,7 @@ fn dirRealPathFilePosix(userdata: ?*anyopaque, dir: Dir, sub_path: []const u8, o |
| 6819 | assert(redundant_pointer == out_buffer.ptr); | 6819 | assert(redundant_pointer == out_buffer.ptr); |
| 6820 | return std.mem.indexOfScalar(u8, out_buffer, 0) orelse out_buffer.len; | 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 | if (err == .INTR) { | 6823 | if (err == .INTR) { |
| 6824 | try syscall.checkCancel(); | 6824 | try syscall.checkCancel(); |
| 6825 | continue; | 6825 | continue; |
| ... | @@ -10477,7 +10477,7 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) process.Execut | ... | @@ -10477,7 +10477,7 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) process.Execut |
| 10477 | if (std.c.realpath(argv0, &resolved_buf)) |p| { | 10477 | if (std.c.realpath(argv0, &resolved_buf)) |p| { |
| 10478 | assert(p == &resolved_buf); | 10478 | assert(p == &resolved_buf); |
| 10479 | break syscall.finish(); | 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 | .INTR => { | 10481 | .INTR => { |
| 10482 | try syscall.checkCancel(); | 10482 | try syscall.checkCancel(); |
| 10483 | continue; | 10483 | continue; |
| ... | @@ -10520,7 +10520,7 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) process.Execut | ... | @@ -10520,7 +10520,7 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) process.Execut |
| 10520 | if (std.c.realpath(resolved_path, &resolved_buf)) |p| { | 10520 | if (std.c.realpath(resolved_path, &resolved_buf)) |p| { |
| 10521 | assert(p == &resolved_buf); | 10521 | assert(p == &resolved_buf); |
| 10522 | break syscall.finish(); | 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 | .INTR => { | 10524 | .INTR => { |
| 10525 | try syscall.checkCancel(); | 10525 | try syscall.checkCancel(); |
| 10526 | continue; | 10526 | continue; |
| ... | @@ -10979,12 +10979,12 @@ fn fileWriteFileStreaming( | ... | @@ -10979,12 +10979,12 @@ fn fileWriteFileStreaming( |
| 10979 | ) File.Writer.WriteFileError!usize { | 10979 | ) File.Writer.WriteFileError!usize { |
| 10980 | const t: *Threaded = @ptrCast(@alignCast(userdata)); | 10980 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 10981 | const reader_buffered = file_reader.interface.buffered(); | 10981 | const reader_buffered = file_reader.interface.buffered(); |
| 10982 | if (reader_buffered.len >= @intFromEnum(limit)) { | 10982 | if (reader_buffered.len >= @backingInt(limit)) { |
| 10983 | const n = try fileWriteStreaming(t, file, header, &.{limit.slice(reader_buffered)}, 1); | 10983 | const n = try fileWriteStreaming(t, file, header, &.{limit.slice(reader_buffered)}, 1); |
| 10984 | file_reader.interface.toss(n -| header.len); | 10984 | file_reader.interface.toss(n -| header.len); |
| 10985 | return n; | 10985 | return n; |
| 10986 | } | 10986 | } |
| 10987 | const file_limit = @intFromEnum(limit) - reader_buffered.len; | 10987 | const file_limit = @backingInt(limit) - reader_buffered.len; |
| 10988 | const out_fd = file.handle; | 10988 | const out_fd = file.handle; |
| 10989 | const in_fd = file_reader.file.handle; | 10989 | const in_fd = file_reader.file.handle; |
| 10990 | 10990 | ||
| ... | @@ -11186,7 +11186,7 @@ fn fileWriteFileStreaming( | ... | @@ -11186,7 +11186,7 @@ fn fileWriteFileStreaming( |
| 11186 | .positional => o: { | 11186 | .positional => o: { |
| 11187 | const size = file_reader.getSize() catch return 0; | 11187 | const size = file_reader.getSize() catch return 0; |
| 11188 | off = std.math.cast(std.os.linux.off_t, file_reader.pos) orelse return error.ReadFailed; | 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 | .streaming => .{ null, limit.minInt(max_count) }, | 11191 | .streaming => .{ null, limit.minInt(max_count) }, |
| 11192 | .streaming_simple, .positional_simple => break :sf, | 11192 | .streaming_simple, .positional_simple => break :sf, |
| ... | @@ -11258,7 +11258,7 @@ fn fileWriteFileStreaming( | ... | @@ -11258,7 +11258,7 @@ fn fileWriteFileStreaming( |
| 11258 | file_reader.interface.toss(n -| header.len); | 11258 | file_reader.interface.toss(n -| header.len); |
| 11259 | return n; | 11259 | return n; |
| 11260 | } | 11260 | } |
| 11261 | var len: usize = @intFromEnum(limit); | 11261 | var len: usize = @backingInt(limit); |
| 11262 | var off_in: i64 = undefined; | 11262 | var off_in: i64 = undefined; |
| 11263 | const off_in_ptr: ?*i64 = switch (file_reader.mode) { | 11263 | const off_in_ptr: ?*i64 = switch (file_reader.mode) { |
| 11264 | .positional_simple, .streaming_simple => return error.Unimplemented, | 11264 | .positional_simple, .streaming_simple => return error.Unimplemented, |
| ... | @@ -11318,7 +11318,7 @@ fn fileWriteFileStreaming( | ... | @@ -11318,7 +11318,7 @@ fn fileWriteFileStreaming( |
| 11318 | .freebsd => n: { | 11318 | .freebsd => n: { |
| 11319 | const syscall: Syscall = try .start(); | 11319 | const syscall: Syscall = try .start(); |
| 11320 | while (true) { | 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 | switch (std.c.errno(rc)) { | 11322 | switch (std.c.errno(rc)) { |
| 11323 | .SUCCESS => { | 11323 | .SUCCESS => { |
| 11324 | syscall.finish(); | 11324 | syscall.finish(); |
| ... | @@ -11392,7 +11392,7 @@ fn fileWriteFilePositional( | ... | @@ -11392,7 +11392,7 @@ fn fileWriteFilePositional( |
| 11392 | ) File.WriteFilePositionalError!usize { | 11392 | ) File.WriteFilePositionalError!usize { |
| 11393 | const t: *Threaded = @ptrCast(@alignCast(userdata)); | 11393 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 11394 | const reader_buffered = file_reader.interface.buffered(); | 11394 | const reader_buffered = file_reader.interface.buffered(); |
| 11395 | if (reader_buffered.len >= @intFromEnum(limit)) { | 11395 | if (reader_buffered.len >= @backingInt(limit)) { |
| 11396 | const n = try fileWritePositional(t, file, header, &.{limit.slice(reader_buffered)}, 1, offset); | 11396 | const n = try fileWritePositional(t, file, header, &.{limit.slice(reader_buffered)}, 1, offset); |
| 11397 | file_reader.interface.toss(n -| header.len); | 11397 | file_reader.interface.toss(n -| header.len); |
| 11398 | return n; | 11398 | return n; |
| ... | @@ -11419,7 +11419,7 @@ fn fileWriteFilePositional( | ... | @@ -11419,7 +11419,7 @@ fn fileWriteFilePositional( |
| 11419 | file_reader.interface.toss(n -| header.len); | 11419 | file_reader.interface.toss(n -| header.len); |
| 11420 | return n; | 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 | var off_in: i64 = undefined; | 11423 | var off_in: i64 = undefined; |
| 11424 | const off_in_ptr: ?*i64 = switch (file_reader.mode) { | 11424 | const off_in_ptr: ?*i64 = switch (file_reader.mode) { |
| 11425 | .positional_simple, .streaming_simple => return error.Unimplemented, | 11425 | .positional_simple, .streaming_simple => return error.Unimplemented, |
| ... | @@ -11481,7 +11481,7 @@ fn fileWriteFilePositional( | ... | @@ -11481,7 +11481,7 @@ fn fileWriteFilePositional( |
| 11481 | .freebsd => n: { | 11481 | .freebsd => n: { |
| 11482 | const syscall: Syscall = try .start(); | 11482 | const syscall: Syscall = try .start(); |
| 11483 | while (true) { | 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 | switch (std.c.errno(rc)) { | 11485 | switch (std.c.errno(rc)) { |
| 11486 | .SUCCESS => { | 11486 | .SUCCESS => { |
| 11487 | syscall.finish(); | 11487 | syscall.finish(); |
| ... | @@ -11751,7 +11751,7 @@ fn sleepPosix(timeout: Io.Timeout) Io.Cancelable!void { | ... | @@ -11751,7 +11751,7 @@ fn sleepPosix(timeout: Io.Timeout) Io.Cancelable!void { |
| 11751 | .deadline => true, | 11751 | .deadline => true, |
| 11752 | } }, &timespec, &timespec); | 11752 | } }, &timespec, &timespec); |
| 11753 | // POSIX-standard libc clock_nanosleep() returns *positive* errno values directly | 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 | .INTR => { | 11755 | .INTR => { |
| 11756 | try syscall.checkCancel(); | 11756 | try syscall.checkCancel(); |
| 11757 | continue; | 11757 | continue; |
| ... | @@ -13525,7 +13525,7 @@ fn netInterfaceNameResolve( | ... | @@ -13525,7 +13525,7 @@ fn netInterfaceNameResolve( |
| 13525 | .INVALID_PARAMETER => unreachable, | 13525 | .INVALID_PARAMETER => unreachable, |
| 13526 | else => |err| return windows.unexpectedError(err), | 13526 | else => |err| return windows.unexpectedError(err), |
| 13527 | } | 13527 | } |
| 13528 | return .{ .index = @intFromEnum(index) }; | 13528 | return .{ .index = @backingInt(index) }; |
| 13529 | } | 13529 | } |
| 13530 | 13530 | ||
| 13531 | if (builtin.link_libc) { | 13531 | if (builtin.link_libc) { |
| ... | @@ -13588,7 +13588,7 @@ fn netInterfaceName(userdata: ?*anyopaque, interface: net.Interface) net.Interfa | ... | @@ -13588,7 +13588,7 @@ fn netInterfaceName(userdata: ?*anyopaque, interface: net.Interface) net.Interfa |
| 13588 | } | 13588 | } |
| 13589 | try Thread.checkCancel(); | 13589 | try Thread.checkCancel(); |
| 13590 | var luid: windows.NET.LUID = undefined; | 13590 | var luid: windows.NET.LUID = undefined; |
| 13591 | switch (ConvertInterfaceIndexToLuid.?(@enumFromInt(interface.index), &luid)) { | 13591 | switch (ConvertInterfaceIndexToLuid.?(@fromBackingInt(@intCast(interface.index)), &luid)) { |
| 13592 | .SUCCESS => {}, | 13592 | .SUCCESS => {}, |
| 13593 | .FILE_NOT_FOUND => return error.InterfaceNotFound, | 13593 | .FILE_NOT_FOUND => return error.InterfaceNotFound, |
| 13594 | .INVALID_PARAMETER => unreachable, | 13594 | .INVALID_PARAMETER => unreachable, |
| ... | @@ -13884,7 +13884,7 @@ fn netLookupFallible( | ... | @@ -13884,7 +13884,7 @@ fn netLookupFallible( |
| 13884 | const syscall: Syscall = try .start(); | 13884 | const syscall: Syscall = try .start(); |
| 13885 | while (true) { | 13885 | while (true) { |
| 13886 | switch (posix.system.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res)) { | 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 | syscall.finish(); | 13888 | syscall.finish(); |
| 13889 | break; | 13889 | break; |
| 13890 | }, | 13890 | }, |
| ... | @@ -14029,7 +14029,7 @@ fn processCurrentPath(userdata: ?*anyopaque, buffer: []u8) process.CurrentPathEr | ... | @@ -14029,7 +14029,7 @@ fn processCurrentPath(userdata: ?*anyopaque, buffer: []u8) process.CurrentPathEr |
| 14029 | 14029 | ||
| 14030 | const err: posix.E = if (builtin.link_libc) err: { | 14030 | const err: posix.E = if (builtin.link_libc) err: { |
| 14031 | const c_err = if (std.c.getcwd(buffer.ptr, buffer.len)) |_| 0 else std.c._errno().*; | 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 | } else err: { | 14033 | } else err: { |
| 14034 | break :err posix.errno(posix.system.getcwd(buffer.ptr, buffer.len)); | 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,12 +14223,12 @@ pub fn posixSocketModeProtocol(family: posix.sa_family_t, mode: net.Socket.Mode, |
| 14223 | .raw => posix.SOCK.RAW, | 14223 | .raw => posix.SOCK.RAW, |
| 14224 | .rdm => if (@hasDecl(posix.SOCK, "RDM")) posix.SOCK.RDM else return error.OptionUnsupported, | 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 | posix.AF.UNIX => switch (mode) { | 14227 | posix.AF.UNIX => switch (mode) { |
| 14228 | .stream => 0, | 14228 | .stream => 0, |
| 14229 | else => return error.ProtocolUnsupportedByAddressFamily, | 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 | .stream => .tcp, | 14232 | .stream => .tcp, |
| 14233 | .dgram => .udp, | 14233 | .dgram => .udp, |
| 14234 | else => return error.ProtocolUnsupportedByAddressFamily, | 14234 | else => return error.ProtocolUnsupportedByAddressFamily, |
| ... | @@ -14824,7 +14824,7 @@ fn writeResolutionQuery(q: *[280]u8, op: u4, dname: []const u8, class: u8, ty: H | ... | @@ -14824,7 +14824,7 @@ fn writeResolutionQuery(q: *[280]u8, op: u4, dname: []const u8, class: u8, ty: H |
| 14824 | if (j - i - 1 > 62) unreachable; | 14824 | if (j - i - 1 > 62) unreachable; |
| 14825 | q[i - 1] = @intCast(j - i); | 14825 | q[i - 1] = @intCast(j - i); |
| 14826 | } | 14826 | } |
| 14827 | q[i + 1] = @intFromEnum(ty); | 14827 | q[i + 1] = @backingInt(ty); |
| 14828 | q[i + 3] = class; | 14828 | q[i + 3] = class; |
| 14829 | return n; | 14829 | return n; |
| 14830 | } | 14830 | } |
| ... | @@ -15299,8 +15299,8 @@ fn childKill(userdata: ?*anyopaque, child: *process.Child) void { | ... | @@ -15299,8 +15299,8 @@ fn childKill(userdata: ?*anyopaque, child: *process.Child) void { |
| 15299 | fn childKillWindows(t: *Threaded, child: *process.Child, exit_code: windows.UINT) !void { | 15299 | fn childKillWindows(t: *Threaded, child: *process.Child, exit_code: windows.UINT) !void { |
| 15300 | _ = t; // TODO cancelation | 15300 | _ = t; // TODO cancelation |
| 15301 | const handle = child.id.?; | 15301 | const handle = child.id.?; |
| 15302 | _ = windows.ntdll.RtlReportSilentProcessExit(handle, @enumFromInt(exit_code)); | 15302 | _ = windows.ntdll.RtlReportSilentProcessExit(handle, @fromBackingInt(@intCast(exit_code))); |
| 15303 | switch (windows.ntdll.NtTerminateProcess(handle, @enumFromInt(exit_code))) { | 15303 | switch (windows.ntdll.NtTerminateProcess(handle, @fromBackingInt(@intCast(exit_code)))) { |
| 15304 | .SUCCESS, .PROCESS_IS_TERMINATING => { | 15304 | .SUCCESS, .PROCESS_IS_TERMINATING => { |
| 15305 | const infinite_timeout: windows.LARGE_INTEGER = std.math.minInt(windows.LARGE_INTEGER); | 15305 | const infinite_timeout: windows.LARGE_INTEGER = std.math.minInt(windows.LARGE_INTEGER); |
| 15306 | _ = windows.ntdll.NtWaitForSingleObject(handle, .FALSE, &infinite_timeout); | 15306 | _ = windows.ntdll.NtWaitForSingleObject(handle, .FALSE, &infinite_timeout); |
| ... | @@ -15344,7 +15344,7 @@ fn childWaitWindows(child: *process.Child) process.Child.WaitError!process.Child | ... | @@ -15344,7 +15344,7 @@ fn childWaitWindows(child: *process.Child) process.Child.WaitError!process.Child |
| 15344 | @sizeOf(windows.PROCESS.BASIC_INFORMATION), | 15344 | @sizeOf(windows.PROCESS.BASIC_INFORMATION), |
| 15345 | null, | 15345 | null, |
| 15346 | )) { | 15346 | )) { |
| 15347 | .SUCCESS => .{ .exited = @as(u8, @truncate(@intFromEnum(info.ExitStatus))) }, | 15347 | .SUCCESS => .{ .exited = @as(u8, @truncate(@backingInt(info.ExitStatus))) }, |
| 15348 | else => .{ .unknown = 0 }, | 15348 | else => .{ .unknown = 0 }, |
| 15349 | }; | 15349 | }; |
| 15350 | 15350 | ||
| ... | @@ -15424,11 +15424,11 @@ fn childWaitPosix(child: *process.Child) process.Child.WaitError!process.Child.T | ... | @@ -15424,11 +15424,11 @@ fn childWaitPosix(child: *process.Child) process.Child.WaitError!process.Child.T |
| 15424 | syscall.finish(); | 15424 | syscall.finish(); |
| 15425 | if (ru_ptr) |p| child.resource_usage_statistics.rusage = p.*; | 15425 | if (ru_ptr) |p| child.resource_usage_statistics.rusage = p.*; |
| 15426 | const status: u32 = @bitCast(info.fields.common.second.sigchld.status); | 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 | return switch (code) { | 15428 | return switch (code) { |
| 15429 | .EXITED => .{ .exited = @truncate(status) }, | 15429 | .EXITED => .{ .exited = @truncate(status) }, |
| 15430 | .KILLED, .DUMPED => .{ .signal = @enumFromInt(status) }, | 15430 | .KILLED, .DUMPED => .{ .signal = @fromBackingInt(@intCast(status)) }, |
| 15431 | .TRAPPED, .STOPPED => .{ .stopped = @enumFromInt(status) }, | 15431 | .TRAPPED, .STOPPED => .{ .stopped = @fromBackingInt(@intCast(status)) }, |
| 15432 | _, .CONTINUED => .{ .unknown = status }, | 15432 | _, .CONTINUED => .{ .unknown = status }, |
| 15433 | }; | 15433 | }; |
| 15434 | }, | 15434 | }, |
| ... | @@ -16254,7 +16254,7 @@ fn windowsCreateProcessPathExt( | ... | @@ -16254,7 +16254,7 @@ fn windowsCreateProcessPathExt( |
| 16254 | // fails to spawn, in which case we still want to try the PATHEXT appended versions. | 16254 | // fails to spawn, in which case we still want to try the PATHEXT appended versions. |
| 16255 | unappended_exists = true; | 16255 | unappended_exists = true; |
| 16256 | } else if (windowsCreateProcessSupportsExtension(filename[app_name_len..])) |pathext_ext| { | 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 | any_pathext_seen = true; | 16258 | any_pathext_seen = true; |
| 16259 | } | 16259 | } |
| 16260 | } | 16260 | } |
| ... | @@ -16327,7 +16327,7 @@ fn windowsCreateProcessPathExt( | ... | @@ -16327,7 +16327,7 @@ fn windowsCreateProcessPathExt( |
| 16327 | var ext_it = std.mem.tokenizeScalar(u16, pathext, ';'); | 16327 | var ext_it = std.mem.tokenizeScalar(u16, pathext, ';'); |
| 16328 | while (ext_it.next()) |ext| { | 16328 | while (ext_it.next()) |ext| { |
| 16329 | const ext_enum = windowsCreateProcessSupportsExtension(ext) orelse continue; | 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 | dir_buf.shrinkRetainingCapacity(dir_path_len); | 16332 | dir_buf.shrinkRetainingCapacity(dir_path_len); |
| 16333 | if (dir_path_len != 0) switch (dir_buf.items[dir_buf.items.len - 1]) { | 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,10 +16451,10 @@ fn windowsCreateProcessSupportsExtension(ext: []const u16) ?process.WindowsExten |
| 16451 | // Ensures keeping this function in sync with the enum. | 16451 | // Ensures keeping this function in sync with the enum. |
| 16452 | const field_names = @typeInfo(process.WindowsExtension).@"enum".field_names; | 16452 | const field_names = @typeInfo(process.WindowsExtension).@"enum".field_names; |
| 16453 | assert(field_names.len == 4); | 16453 | assert(field_names.len == 4); |
| 16454 | assert(@intFromEnum(process.WindowsExtension.bat) == 0); | 16454 | assert(@backingInt(process.WindowsExtension.bat) == 0); |
| 16455 | assert(@intFromEnum(process.WindowsExtension.cmd) == 1); | 16455 | assert(@backingInt(process.WindowsExtension.cmd) == 1); |
| 16456 | assert(@intFromEnum(process.WindowsExtension.com) == 2); | 16456 | assert(@backingInt(process.WindowsExtension.com) == 2); |
| 16457 | assert(@intFromEnum(process.WindowsExtension.exe) == 3); | 16457 | assert(@backingInt(process.WindowsExtension.exe) == 3); |
| 16458 | } | 16458 | } |
| 16459 | 16459 | ||
| 16460 | if (ext.len != 4) return null; | 16460 | if (ext.len != 4) return null; |
| ... | @@ -17509,7 +17509,7 @@ const parking_futex = struct { | ... | @@ -17509,7 +17509,7 @@ const parking_futex = struct { |
| 17509 | } | 17509 | } |
| 17510 | thread.futex_waiter = &waiter; | 17510 | thread.futex_waiter = &waiter; |
| 17511 | const old_status = thread.status.fetchOr( | 17511 | const old_status = thread.status.fetchOr( |
| 17512 | .{ .cancelation = @enumFromInt(0b001), .awaitable = .null }, | 17512 | .{ .cancelation = @fromBackingInt(@intCast(0b001)), .awaitable = .null }, |
| 17513 | .release, // release `thread.futex_waiter` | 17513 | .release, // release `thread.futex_waiter` |
| 17514 | ); | 17514 | ); |
| 17515 | switch (old_status.cancelation) { | 17515 | switch (old_status.cancelation) { |
| ... | @@ -17547,7 +17547,7 @@ const parking_futex = struct { | ... | @@ -17547,7 +17547,7 @@ const parking_futex = struct { |
| 17547 | error.Timeout => { | 17547 | error.Timeout => { |
| 17548 | // We're not out of the woods yet: an unpark could race with the timeout. | 17548 | // We're not out of the woods yet: an unpark could race with the timeout. |
| 17549 | const old_status = waiter.thread_status.fetchAnd( | 17549 | const old_status = waiter.thread_status.fetchAnd( |
| 17550 | .{ .cancelation = @enumFromInt(0b110), .awaitable = .all_ones }, | 17550 | .{ .cancelation = @fromBackingInt(@intCast(0b110)), .awaitable = .all_ones }, |
| 17551 | .monotonic, | 17551 | .monotonic, |
| 17552 | ); | 17552 | ); |
| 17553 | switch (old_status.cancelation) { | 17553 | switch (old_status.cancelation) { |
| ... | @@ -17604,7 +17604,7 @@ const parking_futex = struct { | ... | @@ -17604,7 +17604,7 @@ const parking_futex = struct { |
| 17604 | it = waiter.node.next; | 17604 | it = waiter.node.next; |
| 17605 | if (waiter.address != @intFromPtr(ptr)) continue; | 17605 | if (waiter.address != @intFromPtr(ptr)) continue; |
| 17606 | const old_status = waiter.thread_status.fetchAnd( | 17606 | const old_status = waiter.thread_status.fetchAnd( |
| 17607 | .{ .cancelation = @enumFromInt(0b110), .awaitable = .all_ones }, | 17607 | .{ .cancelation = @fromBackingInt(@intCast(0b110)), .awaitable = .all_ones }, |
| 17608 | .monotonic, | 17608 | .monotonic, |
| 17609 | ); | 17609 | ); |
| 17610 | switch (old_status.cancelation) { | 17610 | switch (old_status.cancelation) { |
| ... | @@ -17669,7 +17669,7 @@ const parking_sleep = struct { | ... | @@ -17669,7 +17669,7 @@ const parking_sleep = struct { |
| 17669 | thread.futex_waiter = null; | 17669 | thread.futex_waiter = null; |
| 17670 | { | 17670 | { |
| 17671 | const old_status = thread.status.fetchOr( | 17671 | const old_status = thread.status.fetchOr( |
| 17672 | .{ .cancelation = @enumFromInt(0b001), .awaitable = .null }, | 17672 | .{ .cancelation = @fromBackingInt(@intCast(0b001)), .awaitable = .null }, |
| 17673 | .release, // release `thread.futex_waiter` | 17673 | .release, // release `thread.futex_waiter` |
| 17674 | ); | 17674 | ); |
| 17675 | switch (old_status.cancelation) { | 17675 | switch (old_status.cancelation) { |
| ... | @@ -17696,7 +17696,7 @@ const parking_sleep = struct { | ... | @@ -17696,7 +17696,7 @@ const parking_sleep = struct { |
| 17696 | error.Timeout => { | 17696 | error.Timeout => { |
| 17697 | // We're not out of the woods yet: an unpark could race with the timeout. | 17697 | // We're not out of the woods yet: an unpark could race with the timeout. |
| 17698 | const old_status = thread.status.fetchAnd( | 17698 | const old_status = thread.status.fetchAnd( |
| 17699 | .{ .cancelation = @enumFromInt(0b110), .awaitable = .all_ones }, | 17699 | .{ .cancelation = @fromBackingInt(@intCast(0b110)), .awaitable = .all_ones }, |
| 17700 | .monotonic, | 17700 | .monotonic, |
| 17701 | ); | 17701 | ); |
| 17702 | switch (old_status.cancelation) { | 17702 | switch (old_status.cancelation) { |
| ... | @@ -17747,12 +17747,12 @@ const ParkingMutex = struct { | ... | @@ -17747,12 +17747,12 @@ const ParkingMutex = struct { |
| 17747 | _, | 17747 | _, |
| 17748 | /// Returns the head of the waiter list. Illegal to call if `s == .unlocked`. | 17748 | /// Returns the head of the waiter list. Illegal to call if `s == .unlocked`. |
| 17749 | fn waiter(s: State) ?*Waiter { | 17749 | fn waiter(s: State) ?*Waiter { |
| 17750 | return @ptrFromInt(@intFromEnum(s)); | 17750 | return @ptrFromInt(@backingInt(s)); |
| 17751 | } | 17751 | } |
| 17752 | /// Returns a locked state where `w` is contending the lock. | 17752 | /// Returns a locked state where `w` is contending the lock. |
| 17753 | /// If `w` is `null`, returns `.locked_once`. | 17753 | /// If `w` is `null`, returns `.locked_once`. |
| 17754 | fn fromWaiter(w: ?*Waiter) State { | 17754 | fn fromWaiter(w: ?*Waiter) State { |
| 17755 | return @enumFromInt(@intFromPtr(w)); | 17755 | return @fromBackingInt(@intCast(@intFromPtr(w))); |
| 17756 | } | 17756 | } |
| 17757 | }; | 17757 | }; |
| 17758 | const Waiter = struct { | 17758 | const Waiter = struct { |
| ... | @@ -18316,7 +18316,7 @@ fn createFileMap( | ... | @@ -18316,7 +18316,7 @@ fn createFileMap( |
| 18316 | if (rc != std.c.MAP_FAILED) { | 18316 | if (rc != std.c.MAP_FAILED) { |
| 18317 | break @as([*]align(page_align) u8, @ptrCast(@alignCast(rc)))[0..len]; | 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 | } else e: { | 18320 | } else e: { |
| 18321 | const err = posix.errno(rc); | 18321 | const err = posix.errno(rc); |
| 18322 | if (err == .SUCCESS) { | 18322 | if (err == .SUCCESS) { |
| ... | @@ -18409,7 +18409,7 @@ fn fileMemoryMapSetLength( | ... | @@ -18409,7 +18409,7 @@ fn fileMemoryMapSetLength( |
| 18409 | syscall.finish(); | 18409 | syscall.finish(); |
| 18410 | const err: posix.E = if (builtin.link_libc) e: { | 18410 | const err: posix.E = if (builtin.link_libc) e: { |
| 18411 | if (rc != std.c.MAP_FAILED) break @as([*]align(page_align) u8, @ptrCast(@alignCast(rc)))[0..new_len]; | 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 | } else e: { | 18413 | } else e: { |
| 18414 | const err = posix.errno(rc); | 18414 | const err = posix.errno(rc); |
| 18415 | if (err == .SUCCESS) break @as([*]align(page_align) u8, @ptrFromInt(rc))[0..new_len]; | 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,7 +18733,7 @@ fn deviceIoControl(o: *const Io.Operation.DeviceIoControl) Io.Cancelable!Io.Oper |
| 18733 | }, | 18733 | }, |
| 18734 | else => |err| { | 18734 | else => |err| { |
| 18735 | syscall.finish(); | 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,7 +18782,7 @@ fn eventWait(event: *Io.Event) void { |
| 18782 | .is_set => return, | 18782 | .is_set => return, |
| 18783 | }; | 18783 | }; |
| 18784 | while (true) { | 18784 | while (true) { |
| 18785 | Thread.futexWaitUncancelable(@ptrCast(event), @intFromEnum(Io.Event.waiting), null); | 18785 | Thread.futexWaitUncancelable(@ptrCast(event), @backingInt(Io.Event.waiting), null); |
| 18786 | switch (@atomicLoad(Io.Event, event, .acquire)) { | 18786 | switch (@atomicLoad(Io.Event, event, .acquire)) { |
| 18787 | .unset => unreachable, // `reset` called before pending `wait` returned | 18787 | .unset => unreachable, // `reset` called before pending `wait` returned |
| 18788 | .waiting => continue, | 18788 | .waiting => continue, |
| ... | @@ -18881,10 +18881,10 @@ pub fn mutexLock(m: *Io.Mutex) void { | ... | @@ -18881,10 +18881,10 @@ pub fn mutexLock(m: *Io.Mutex) void { |
| 18881 | return; | 18881 | return; |
| 18882 | }; | 18882 | }; |
| 18883 | if (initial_state == .contended) { | 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 | while (m.state.swap(.contended, .acquire) != .unlocked) { | 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,11 +177,11 @@ const Fiber = struct { |
| 177 | _, | 177 | _, |
| 178 | 178 | ||
| 179 | fn subWrap(lhs: Awaiting, rhs: Awaiting) Awaiting { | 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 | fn fromIoUringFd(fd: fd_t) Awaiting { | 183 | fn fromIoUringFd(fd: fd_t) Awaiting { |
| 184 | const awaiting: Awaiting = @enumFromInt(fd); | 184 | const awaiting: Awaiting = @fromBackingInt(@intCast(fd)); |
| 185 | switch (awaiting) { | 185 | switch (awaiting) { |
| 186 | .nothing, .group => unreachable, | 186 | .nothing, .group => unreachable, |
| 187 | _ => return awaiting, | 187 | _ => return awaiting, |
| ... | @@ -191,7 +191,7 @@ const Fiber = struct { | ... | @@ -191,7 +191,7 @@ const Fiber = struct { |
| 191 | fn toIoUringFd(awaiting: Awaiting) fd_t { | 191 | fn toIoUringFd(awaiting: Awaiting) fd_t { |
| 192 | switch (awaiting) { | 192 | switch (awaiting) { |
| 193 | .nothing, .group => unreachable, | 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,7 +217,7 @@ const Fiber = struct { |
| 217 | const unblocked: CancelProtection = .{ .user = .unblocked, .acknowledged = false }; | 217 | const unblocked: CancelProtection = .{ .user = .unblocked, .acknowledged = false }; |
| 218 | 218 | ||
| 219 | fn check(cancel_protection: CancelProtection) Io.CancelProtection { | 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 | fn acknowledge(cancel_protection: *CancelProtection) void { | 223 | fn acknowledge(cancel_protection: *CancelProtection) void { |
| ... | @@ -359,7 +359,7 @@ const Fiber = struct { | ... | @@ -359,7 +359,7 @@ const Fiber = struct { |
| 359 | Fiber.CancelStatus, | 359 | Fiber.CancelStatus, |
| 360 | &fiber.cancel_status, | 360 | &fiber.cancel_status, |
| 361 | .Or, | 361 | .Or, |
| 362 | .{ .requested = true, .awaiting = @enumFromInt(0) }, | 362 | .{ .requested = true, .awaiting = @fromBackingInt(@intCast(0)) }, |
| 363 | .acquire, | 363 | .acquire, |
| 364 | ); | 364 | ); |
| 365 | assert(!cancel_status.requested); | 365 | assert(!cancel_status.requested); |
| ... | @@ -385,7 +385,7 @@ const Fiber = struct { | ... | @@ -385,7 +385,7 @@ const Fiber = struct { |
| 385 | .addr = @intFromPtr(fiber), | 385 | .addr = @intFromPtr(fiber), |
| 386 | .len = 0, | 386 | .len = 0, |
| 387 | .rw_flags = 0, | 387 | .rw_flags = 0, |
| 388 | .user_data = @intFromEnum(Completion.Userdata.wakeup), | 388 | .user_data = @backingInt(Completion.Userdata.wakeup), |
| 389 | .buf_index = 0, | 389 | .buf_index = 0, |
| 390 | .personality = 0, | 390 | .personality = 0, |
| 391 | .splice_fd_in = 0, | 391 | .splice_fd_in = 0, |
| ... | @@ -397,10 +397,10 @@ const Fiber = struct { | ... | @@ -397,10 +397,10 @@ const Fiber = struct { |
| 397 | .ioprio = 0, | 397 | .ioprio = 0, |
| 398 | .fd = awaiting_io_uring_fd, | 398 | .fd = awaiting_io_uring_fd, |
| 399 | .off = @intFromPtr(fiber) | 0b01, | 399 | .off = @intFromPtr(fiber) | 0b01, |
| 400 | .addr = @intFromEnum(linux.IORING_MSG_RING_COMMAND.DATA), | 400 | .addr = @backingInt(linux.IORING_MSG_RING_COMMAND.DATA), |
| 401 | .len = 0, | 401 | .len = 0, |
| 402 | .rw_flags = 0, | 402 | .rw_flags = 0, |
| 403 | .user_data = @intFromEnum(Completion.Userdata.cleanup), | 403 | .user_data = @backingInt(Completion.Userdata.cleanup), |
| 404 | .buf_index = 0, | 404 | .buf_index = 0, |
| 405 | .personality = 0, | 405 | .personality = 0, |
| 406 | .splice_fd_in = 0, | 406 | .splice_fd_in = 0, |
| ... | @@ -537,11 +537,11 @@ const CachedFd = struct { | ... | @@ -537,11 +537,11 @@ const CachedFd = struct { |
| 537 | _, | 537 | _, |
| 538 | 538 | ||
| 539 | fn fromFd(fd: fd_t) Once { | 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 | fn toFd(once: Once) fd_t { | 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,8 +552,8 @@ const CachedFd = struct { |
| 552 | .uninitialized => {}, | 552 | .uninitialized => {}, |
| 553 | .initializing => unreachable, | 553 | .initializing => unreachable, |
| 554 | _ => |fd| { | 554 | _ => |fd| { |
| 555 | assert(@intFromEnum(fd) >= 0); | 555 | assert(@backingInt(fd) >= 0); |
| 556 | _ = linux.close(@intFromEnum(fd)); | 556 | _ = linux.close(@backingInt(fd)); |
| 557 | cached_fd.* = .init; | 557 | cached_fd.* = .init; |
| 558 | }, | 558 | }, |
| 559 | } | 559 | } |
| ... | @@ -573,7 +573,7 @@ const CachedFd = struct { | ... | @@ -573,7 +573,7 @@ const CachedFd = struct { |
| 573 | .initializing => try futexWait( | 573 | .initializing => try futexWait( |
| 574 | ev, | 574 | ev, |
| 575 | @ptrCast(&cached_fd.once), | 575 | @ptrCast(&cached_fd.once), |
| 576 | @bitCast(@intFromEnum(once)), | 576 | @bitCast(@backingInt(once)), |
| 577 | .none, | 577 | .none, |
| 578 | ), | 578 | ), |
| 579 | _ => |fd| { | 579 | _ => |fd| { |
| ... | @@ -997,11 +997,11 @@ fn schedule(ev: *Evented, thread: *Thread, ready_queue: Fiber.Queue) bool { | ... | @@ -997,11 +997,11 @@ fn schedule(ev: *Evented, thread: *Thread, ready_queue: Fiber.Queue) bool { |
| 997 | .flags = linux.IOSQE_CQE_SKIP_SUCCESS, | 997 | .flags = linux.IOSQE_CQE_SKIP_SUCCESS, |
| 998 | .ioprio = 0, | 998 | .ioprio = 0, |
| 999 | .fd = idle_search_thread.io_uring.fd, | 999 | .fd = idle_search_thread.io_uring.fd, |
| 1000 | .off = @intFromEnum(Completion.Userdata.wakeup), | 1000 | .off = @backingInt(Completion.Userdata.wakeup), |
| 1001 | .addr = @intFromEnum(linux.IORING_MSG_RING_COMMAND.DATA), | 1001 | .addr = @backingInt(linux.IORING_MSG_RING_COMMAND.DATA), |
| 1002 | .len = 0, | 1002 | .len = 0, |
| 1003 | .rw_flags = 0, | 1003 | .rw_flags = 0, |
| 1004 | .user_data = @intFromEnum(Completion.Userdata.wakeup), | 1004 | .user_data = @backingInt(Completion.Userdata.wakeup), |
| 1005 | .buf_index = 0, | 1005 | .buf_index = 0, |
| 1006 | .personality = 0, | 1006 | .personality = 0, |
| 1007 | .splice_fd_in = 0, | 1007 | .splice_fd_in = 0, |
| ... | @@ -1164,7 +1164,7 @@ fn idle(ev: *Evented, thread: *Thread) void { | ... | @@ -1164,7 +1164,7 @@ fn idle(ev: *Evented, thread: *Thread) void { |
| 1164 | if (cqes.len == 0) break; | 1164 | if (cqes.len == 0) break; |
| 1165 | for (cqes) |cqe| if (cqe.flags & linux.IORING_CQE_F_SKIP == 0) switch (@as( | 1165 | for (cqes) |cqe| if (cqe.flags & linux.IORING_CQE_F_SKIP == 0) switch (@as( |
| 1166 | Completion.Userdata, | 1166 | Completion.Userdata, |
| 1167 | @enumFromInt(cqe.user_data), | 1167 | @fromBackingInt(@intCast(cqe.user_data)), |
| 1168 | )) { | 1168 | )) { |
| 1169 | .unused => unreachable, // bad submission queued? | 1169 | .unused => unreachable, // bad submission queued? |
| 1170 | .wakeup => {}, | 1170 | .wakeup => {}, |
| ... | @@ -1204,7 +1204,7 @@ fn idle(ev: *Evented, thread: *Thread) void { | ... | @@ -1204,7 +1204,7 @@ fn idle(ev: *Evented, thread: *Thread) void { |
| 1204 | .addr = cqe.user_data & ~@as(usize, 0b11), | 1204 | .addr = cqe.user_data & ~@as(usize, 0b11), |
| 1205 | .len = 0, | 1205 | .len = 0, |
| 1206 | .rw_flags = 0, | 1206 | .rw_flags = 0, |
| 1207 | .user_data = @intFromEnum(Completion.Userdata.wakeup), | 1207 | .user_data = @backingInt(Completion.Userdata.wakeup), |
| 1208 | .buf_index = 0, | 1208 | .buf_index = 0, |
| 1209 | .personality = 0, | 1209 | .personality = 0, |
| 1210 | .splice_fd_in = 0, | 1210 | .splice_fd_in = 0, |
| ... | @@ -1337,11 +1337,11 @@ const SwitchMessage = struct { | ... | @@ -1337,11 +1337,11 @@ const SwitchMessage = struct { |
| 1337 | .flags = linux.IOSQE_CQE_SKIP_SUCCESS, | 1337 | .flags = linux.IOSQE_CQE_SKIP_SUCCESS, |
| 1338 | .ioprio = 0, | 1338 | .ioprio = 0, |
| 1339 | .fd = each_thread.io_uring.fd, | 1339 | .fd = each_thread.io_uring.fd, |
| 1340 | .off = @intFromEnum(Completion.Userdata.exit), | 1340 | .off = @backingInt(Completion.Userdata.exit), |
| 1341 | .addr = @intFromEnum(linux.IORING_MSG_RING_COMMAND.DATA), | 1341 | .addr = @backingInt(linux.IORING_MSG_RING_COMMAND.DATA), |
| 1342 | .len = 0, | 1342 | .len = 0, |
| 1343 | .rw_flags = 0, | 1343 | .rw_flags = 0, |
| 1344 | .user_data = @intFromEnum(Completion.Userdata.cleanup), | 1344 | .user_data = @backingInt(Completion.Userdata.cleanup), |
| 1345 | .buf_index = 0, | 1345 | .buf_index = 0, |
| 1346 | .personality = 0, | 1346 | .personality = 0, |
| 1347 | .splice_fd_in = 0, | 1347 | .splice_fd_in = 0, |
| ... | @@ -1986,7 +1986,7 @@ fn futexWait( | ... | @@ -1986,7 +1986,7 @@ fn futexWait( |
| 1986 | else => 0, | 1986 | else => 0, |
| 1987 | .boot => linux.IORING_TIMEOUT_BOOTTIME, | 1987 | .boot => linux.IORING_TIMEOUT_BOOTTIME, |
| 1988 | }), | 1988 | }), |
| 1989 | .user_data = @intFromEnum(Completion.Userdata.wakeup), | 1989 | .user_data = @backingInt(Completion.Userdata.wakeup), |
| 1990 | .buf_index = 0, | 1990 | .buf_index = 0, |
| 1991 | .personality = 0, | 1991 | .personality = 0, |
| 1992 | .splice_fd_in = 0, | 1992 | .splice_fd_in = 0, |
| ... | @@ -2052,7 +2052,7 @@ fn futexWake(userdata: ?*anyopaque, ptr: *const u32, max_waiters: u32) void { | ... | @@ -2052,7 +2052,7 @@ fn futexWake(userdata: ?*anyopaque, ptr: *const u32, max_waiters: u32) void { |
| 2052 | .addr = @intFromPtr(ptr), | 2052 | .addr = @intFromPtr(ptr), |
| 2053 | .len = 0, | 2053 | .len = 0, |
| 2054 | .rw_flags = 0, | 2054 | .rw_flags = 0, |
| 2055 | .user_data = @intFromEnum(Completion.Userdata.futex_wake), | 2055 | .user_data = @backingInt(Completion.Userdata.futex_wake), |
| 2056 | .buf_index = 0, | 2056 | .buf_index = 0, |
| 2057 | .personality = 0, | 2057 | .personality = 0, |
| 2058 | .splice_fd_in = 0, | 2058 | .splice_fd_in = 0, |
| ... | @@ -2188,7 +2188,7 @@ fn deviceIoControl( | ... | @@ -2188,7 +2188,7 @@ fn deviceIoControl( |
| 2188 | switch (linux.errno(rc)) { | 2188 | switch (linux.errno(rc)) { |
| 2189 | .SUCCESS => return @bitCast(@as(u32, @truncate(rc))), | 2189 | .SUCCESS => return @bitCast(@as(u32, @truncate(rc))), |
| 2190 | .INTR => {}, | 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,7 +2547,7 @@ fn batchCancel(userdata: ?*anyopaque, batch: *Io.Batch) void { |
| 2547 | .addr = @intFromPtr(&pending.userdata) | 0b10, | 2547 | .addr = @intFromPtr(&pending.userdata) | 0b10, |
| 2548 | .len = 0, | 2548 | .len = 0, |
| 2549 | .rw_flags = 0, | 2549 | .rw_flags = 0, |
| 2550 | .user_data = @intFromEnum(Completion.Userdata.wakeup), | 2550 | .user_data = @backingInt(Completion.Userdata.wakeup), |
| 2551 | .buf_index = 0, | 2551 | .buf_index = 0, |
| 2552 | .personality = 0, | 2552 | .personality = 0, |
| 2553 | .splice_fd_in = 0, | 2553 | .splice_fd_in = 0, |
| ... | @@ -4701,7 +4701,7 @@ fn childWait(userdata: ?*anyopaque, child: *process.Child) process.Child.WaitErr | ... | @@ -4701,7 +4701,7 @@ fn childWait(userdata: ?*anyopaque, child: *process.Child) process.Child.WaitErr |
| 4701 | .fd = pid, | 4701 | .fd = pid, |
| 4702 | .off = @intFromPtr(&info), | 4702 | .off = @intFromPtr(&info), |
| 4703 | .addr = 0, | 4703 | .addr = 0, |
| 4704 | .len = @intFromEnum(linux.P.PID), | 4704 | .len = @backingInt(linux.P.PID), |
| 4705 | .rw_flags = 0, | 4705 | .rw_flags = 0, |
| 4706 | .user_data = @intFromPtr(maybe_sync.cancel_region.fiber), | 4706 | .user_data = @intFromPtr(maybe_sync.cancel_region.fiber), |
| 4707 | .buf_index = 0, | 4707 | .buf_index = 0, |
| ... | @@ -4737,11 +4737,11 @@ fn childWait(userdata: ?*anyopaque, child: *process.Child) process.Child.WaitErr | ... | @@ -4737,11 +4737,11 @@ fn childWait(userdata: ?*anyopaque, child: *process.Child) process.Child.WaitErr |
| 4737 | } | 4737 | } |
| 4738 | } | 4738 | } |
| 4739 | const status: u32 = @bitCast(info.fields.common.second.sigchld.status); | 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 | return switch (code) { | 4741 | return switch (code) { |
| 4742 | .EXITED => .{ .exited = @truncate(status) }, | 4742 | .EXITED => .{ .exited = @truncate(status) }, |
| 4743 | .KILLED, .DUMPED => .{ .signal = @enumFromInt(status) }, | 4743 | .KILLED, .DUMPED => .{ .signal = @fromBackingInt(@intCast(status)) }, |
| 4744 | .TRAPPED, .STOPPED => .{ .stopped = @enumFromInt(status) }, | 4744 | .TRAPPED, .STOPPED => .{ .stopped = @fromBackingInt(@intCast(status)) }, |
| 4745 | _, .CONTINUED => .{ .unknown = status }, | 4745 | _, .CONTINUED => .{ .unknown = status }, |
| 4746 | }; | 4746 | }; |
| 4747 | }, | 4747 | }, |
| ... | @@ -4782,7 +4782,7 @@ fn childKill(userdata: ?*anyopaque, child: *process.Child) void { | ... | @@ -4782,7 +4782,7 @@ fn childKill(userdata: ?*anyopaque, child: *process.Child) void { |
| 4782 | .fd = pid, | 4782 | .fd = pid, |
| 4783 | .off = @intFromPtr(&info), | 4783 | .off = @intFromPtr(&info), |
| 4784 | .addr = 0, | 4784 | .addr = 0, |
| 4785 | .len = @intFromEnum(linux.P.PID), | 4785 | .len = @backingInt(linux.P.PID), |
| 4786 | .rw_flags = 0, | 4786 | .rw_flags = 0, |
| 4787 | .user_data = @intFromPtr(maybe_sync.cancel_region.fiber), | 4787 | .user_data = @intFromPtr(maybe_sync.cancel_region.fiber), |
| 4788 | .buf_index = 0, | 4788 | .buf_index = 0, |
| ... | @@ -5370,7 +5370,7 @@ fn closeAsync(ev: *Evented, fd: fd_t) void { | ... | @@ -5370,7 +5370,7 @@ fn closeAsync(ev: *Evented, fd: fd_t) void { |
| 5370 | .addr = 0, | 5370 | .addr = 0, |
| 5371 | .len = 0, | 5371 | .len = 0, |
| 5372 | .rw_flags = 0, | 5372 | .rw_flags = 0, |
| 5373 | .user_data = @intFromEnum(Completion.Userdata.close), | 5373 | .user_data = @backingInt(Completion.Userdata.close), |
| 5374 | .buf_index = 0, | 5374 | .buf_index = 0, |
| 5375 | .personality = 0, | 5375 | .personality = 0, |
| 5376 | .splice_fd_in = 0, | 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,7 +164,7 @@ pub fn countSplat(data: []const []const u8, splat: usize) usize { |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | pub fn countSendFileLowerBound(n: usize, file_reader: *File.Reader, limit: Limit) ?usize { | 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 | return std.math.lossyCast(usize, total + n); | 168 | return std.math.lossyCast(usize, total + n); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| ... | @@ -220,7 +220,7 @@ pub fn writeSplatHeaderLimit( | ... | @@ -220,7 +220,7 @@ pub fn writeSplatHeaderLimit( |
| 220 | splat: usize, | 220 | splat: usize, |
| 221 | limit: Limit, | 221 | limit: Limit, |
| 222 | ) Error!usize { | 222 | ) Error!usize { |
| 223 | var remaining = @intFromEnum(limit); | 223 | var remaining = @backingInt(limit); |
| 224 | { | 224 | { |
| 225 | const copy_len = @min(header.len, w.buffer.len - w.end, remaining); | 225 | const copy_len = @min(header.len, w.buffer.len - w.end, remaining); |
| 226 | if (header.len - copy_len != 0) return writeSplatHeaderLimitFinish(w, header, data, splat, remaining); | 226 | if (header.len - copy_len != 0) return writeSplatHeaderLimitFinish(w, header, data, splat, remaining); |
| ... | @@ -230,7 +230,7 @@ pub fn writeSplatHeaderLimit( | ... | @@ -230,7 +230,7 @@ pub fn writeSplatHeaderLimit( |
| 230 | } | 230 | } |
| 231 | for (data[0 .. data.len - 1], 0..) |buf, i| { | 231 | for (data[0 .. data.len - 1], 0..) |buf, i| { |
| 232 | const copy_len = @min(buf.len, w.buffer.len - w.end, remaining); | 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 | try writeSplatHeaderLimitFinish(w, &.{}, data[i..], splat, remaining); | 234 | try writeSplatHeaderLimitFinish(w, &.{}, data[i..], splat, remaining); |
| 235 | @memcpy(w.buffer[w.end..][0..copy_len], buf[0..copy_len]); | 235 | @memcpy(w.buffer[w.end..][0..copy_len], buf[0..copy_len]); |
| 236 | w.end += copy_len; | 236 | w.end += copy_len; |
| ... | @@ -239,7 +239,7 @@ pub fn writeSplatHeaderLimit( | ... | @@ -239,7 +239,7 @@ pub fn writeSplatHeaderLimit( |
| 239 | const pattern = data[data.len - 1]; | 239 | const pattern = data[data.len - 1]; |
| 240 | const splat_n = pattern.len * splat; | 240 | const splat_n = pattern.len * splat; |
| 241 | if (splat_n > @min(w.buffer.len - w.end, remaining)) { | 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 | const written = try writeSplatHeaderLimitFinish(w, &.{}, data[data.len - 1 ..][0..1], splat, remaining); | 243 | const written = try writeSplatHeaderLimitFinish(w, &.{}, data[data.len - 1 ..][0..1], splat, remaining); |
| 244 | return buffered_n + written; | 244 | return buffered_n + written; |
| 245 | } | 245 | } |
| ... | @@ -250,7 +250,7 @@ pub fn writeSplatHeaderLimit( | ... | @@ -250,7 +250,7 @@ pub fn writeSplatHeaderLimit( |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | remaining -= splat_n; | 252 | remaining -= splat_n; |
| 253 | return @intFromEnum(limit) - remaining; | 253 | return @backingInt(limit) - remaining; |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | fn writeSplatHeaderLimitFinish( | 256 | fn writeSplatHeaderLimitFinish( |
| ... | @@ -998,7 +998,7 @@ pub fn sendFileAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllE | ... | @@ -998,7 +998,7 @@ pub fn sendFileAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllE |
| 998 | // Explicitly assert it here as well to ensure the assert is hit even if | 998 | // Explicitly assert it here as well to ensure the assert is hit even if |
| 999 | // the fallback path is not taken. | 999 | // the fallback path is not taken. |
| 1000 | assert(w.buffer.len > 0); | 1000 | assert(w.buffer.len > 0); |
| 1001 | var remaining = @intFromEnum(limit); | 1001 | var remaining = @backingInt(limit); |
| 1002 | while (remaining > 0) { | 1002 | while (remaining > 0) { |
| 1003 | const n = sendFile(w, file_reader, .limited(remaining)) catch |err| switch (err) { | 1003 | const n = sendFile(w, file_reader, .limited(remaining)) catch |err| switch (err) { |
| 1004 | error.EndOfStream => break, | 1004 | error.EndOfStream => break, |
| ... | @@ -1011,7 +1011,7 @@ pub fn sendFileAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllE | ... | @@ -1011,7 +1011,7 @@ pub fn sendFileAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllE |
| 1011 | }; | 1011 | }; |
| 1012 | remaining -= n; | 1012 | remaining -= n; |
| 1013 | } | 1013 | } |
| 1014 | return @intFromEnum(limit) - remaining; | 1014 | return @backingInt(limit) - remaining; |
| 1015 | } | 1015 | } |
| 1016 | 1016 | ||
| 1017 | /// Equivalent to `sendFileAll` but uses direct `pread` and `read` calls on | 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,14 +1021,14 @@ pub fn sendFileAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllE |
| 1021 | /// | 1021 | /// |
| 1022 | /// Asserts nonzero buffer capacity. | 1022 | /// Asserts nonzero buffer capacity. |
| 1023 | pub fn sendFileReadingAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllError!usize { | 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 | while (remaining > 0) { | 1025 | while (remaining > 0) { |
| 1026 | remaining -= sendFileReading(w, file_reader, .limited(remaining)) catch |err| switch (err) { | 1026 | remaining -= sendFileReading(w, file_reader, .limited(remaining)) catch |err| switch (err) { |
| 1027 | error.EndOfStream => break, | 1027 | error.EndOfStream => break, |
| 1028 | else => |e| return e, | 1028 | else => |e| return e, |
| 1029 | }; | 1029 | }; |
| 1030 | } | 1030 | } |
| 1031 | return @intFromEnum(limit) - remaining; | 1031 | return @backingInt(limit) - remaining; |
| 1032 | } | 1032 | } |
| 1033 | 1033 | ||
| 1034 | pub fn alignBuffer( | 1034 | pub fn alignBuffer( |
| ... | @@ -1105,7 +1105,7 @@ pub fn printValue( | ... | @@ -1105,7 +1105,7 @@ pub fn printValue( |
| 1105 | .float, .comptime_float => return printFloat(w, value, options.toNumber(.decimal, .lower)), | 1105 | .float, .comptime_float => return printFloat(w, value, options.toNumber(.decimal, .lower)), |
| 1106 | .int, .comptime_int => return printInt(w, value, 10, .lower, options), | 1106 | .int, .comptime_int => return printInt(w, value, 10, .lower, options), |
| 1107 | .@"struct" => return value.formatNumber(w, options.toNumber(.decimal, .lower)), | 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 | .vector => return printVector(w, fmt, options, value, max_depth), | 1109 | .vector => return printVector(w, fmt, options, value, max_depth), |
| 1110 | else => invalidFmtError(fmt, value), | 1110 | else => invalidFmtError(fmt, value), |
| 1111 | }, | 1111 | }, |
| ... | @@ -1113,14 +1113,14 @@ pub fn printValue( | ... | @@ -1113,14 +1113,14 @@ pub fn printValue( |
| 1113 | 'u' => return w.printUnicodeCodepoint(value), | 1113 | 'u' => return w.printUnicodeCodepoint(value), |
| 1114 | 'b' => switch (@typeInfo(T)) { | 1114 | 'b' => switch (@typeInfo(T)) { |
| 1115 | .int, .comptime_int => return printInt(w, value, 2, .lower, options), | 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 | .@"struct" => return value.formatNumber(w, options.toNumber(.binary, .lower)), | 1117 | .@"struct" => return value.formatNumber(w, options.toNumber(.binary, .lower)), |
| 1118 | .vector => return printVector(w, fmt, options, value, max_depth), | 1118 | .vector => return printVector(w, fmt, options, value, max_depth), |
| 1119 | else => invalidFmtError(fmt, value), | 1119 | else => invalidFmtError(fmt, value), |
| 1120 | }, | 1120 | }, |
| 1121 | 'o' => switch (@typeInfo(T)) { | 1121 | 'o' => switch (@typeInfo(T)) { |
| 1122 | .int, .comptime_int => return printInt(w, value, 8, .lower, options), | 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 | .@"struct" => return value.formatNumber(w, options.toNumber(.octal, .lower)), | 1124 | .@"struct" => return value.formatNumber(w, options.toNumber(.octal, .lower)), |
| 1125 | .vector => return printVector(w, fmt, options, value, max_depth), | 1125 | .vector => return printVector(w, fmt, options, value, max_depth), |
| 1126 | else => invalidFmtError(fmt, value), | 1126 | else => invalidFmtError(fmt, value), |
| ... | @@ -1128,7 +1128,7 @@ pub fn printValue( | ... | @@ -1128,7 +1128,7 @@ pub fn printValue( |
| 1128 | 'x' => switch (@typeInfo(T)) { | 1128 | 'x' => switch (@typeInfo(T)) { |
| 1129 | .float, .comptime_float => return printFloatHexOptions(w, value, options.toNumber(.hex, .lower)), | 1129 | .float, .comptime_float => return printFloatHexOptions(w, value, options.toNumber(.hex, .lower)), |
| 1130 | .int, .comptime_int => return printInt(w, value, 16, .lower, options), | 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 | .@"struct" => return value.formatNumber(w, options.toNumber(.hex, .lower)), | 1132 | .@"struct" => return value.formatNumber(w, options.toNumber(.hex, .lower)), |
| 1133 | .pointer => |info| switch (info.size) { | 1133 | .pointer => |info| switch (info.size) { |
| 1134 | .one, .slice => { | 1134 | .one, .slice => { |
| ... | @@ -1153,7 +1153,7 @@ pub fn printValue( | ... | @@ -1153,7 +1153,7 @@ pub fn printValue( |
| 1153 | 'X' => switch (@typeInfo(T)) { | 1153 | 'X' => switch (@typeInfo(T)) { |
| 1154 | .float, .comptime_float => return printFloatHexOptions(w, value, options.toNumber(.hex, .upper)), | 1154 | .float, .comptime_float => return printFloatHexOptions(w, value, options.toNumber(.hex, .upper)), |
| 1155 | .int, .comptime_int => return printInt(w, value, 16, .upper, options), | 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 | .@"struct" => return value.formatNumber(w, options.toNumber(.hex, .upper)), | 1157 | .@"struct" => return value.formatNumber(w, options.toNumber(.hex, .upper)), |
| 1158 | .pointer => |info| switch (info.size) { | 1158 | .pointer => |info| switch (info.size) { |
| 1159 | .one, .slice => { | 1159 | .one, .slice => { |
| ... | @@ -1472,7 +1472,7 @@ fn printEnumNonexhaustive(w: *Writer, value: anytype) Error!void { | ... | @@ -1472,7 +1472,7 @@ fn printEnumNonexhaustive(w: *Writer, value: anytype) Error!void { |
| 1472 | return; | 1472 | return; |
| 1473 | } | 1473 | } |
| 1474 | try w.writeAll("@enumFromInt("); | 1474 | try w.writeAll("@enumFromInt("); |
| 1475 | try w.printInt(@intFromEnum(value), 10, .lower, .{}); | 1475 | try w.printInt(@backingInt(value), 10, .lower, .{}); |
| 1476 | try w.writeByte(')'); | 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,7 +277,7 @@ pub const DnsResponse = struct { |
| 277 | if (i + 10 + len > r.len) return error.InvalidDnsPacket; | 277 | if (i + 10 + len > r.len) return error.InvalidDnsPacket; |
| 278 | defer dr.bytes_index = i + 10 + len; | 278 | defer dr.bytes_index = i + 10 + len; |
| 279 | return .{ | 279 | return .{ |
| 280 | .rr = @enumFromInt(r[i + 1]), | 280 | .rr = @fromBackingInt(@intCast(r[i + 1])), |
| 281 | .packet = r, | 281 | .packet = r, |
| 282 | .data_off = i + 10, | 282 | .data_off = i + 10, |
| 283 | .data_len = len, | 283 | .data_len = len, |
lib/std/Progress.zig+41-41| ... | @@ -226,7 +226,7 @@ pub const Node = struct { | ... | @@ -226,7 +226,7 @@ pub const Node = struct { |
| 226 | fn unwrap(i: @This()) ?Index { | 226 | fn unwrap(i: @This()) ?Index { |
| 227 | return switch (i) { | 227 | return switch (i) { |
| 228 | .unused, .none => return null, | 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,12 +238,12 @@ pub const Node = struct { |
| 238 | 238 | ||
| 239 | pub fn unwrap(i: @This()) ?Index { | 239 | pub fn unwrap(i: @This()) ?Index { |
| 240 | if (i == .none) return null; | 240 | if (i == .none) return null; |
| 241 | return @enumFromInt(@intFromEnum(i)); | 241 | return @fromBackingInt(@intCast(@backingInt(i))); |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | fn toParent(i: @This()) Parent { | 244 | fn toParent(i: @This()) Parent { |
| 245 | assert(@intFromEnum(i) != @intFromEnum(Parent.unused)); | 245 | assert(@backingInt(i) != @backingInt(Parent.unused)); |
| 246 | return @enumFromInt(@intFromEnum(i)); | 246 | return @fromBackingInt(@intCast(@backingInt(i))); |
| 247 | } | 247 | } |
| 248 | }; | 248 | }; |
| 249 | 249 | ||
| ... | @@ -252,13 +252,13 @@ pub const Node = struct { | ... | @@ -252,13 +252,13 @@ pub const Node = struct { |
| 252 | _, | 252 | _, |
| 253 | 253 | ||
| 254 | fn toParent(i: @This()) Parent { | 254 | fn toParent(i: @This()) Parent { |
| 255 | assert(@intFromEnum(i) != @intFromEnum(Parent.unused)); | 255 | assert(@backingInt(i) != @backingInt(Parent.unused)); |
| 256 | assert(@intFromEnum(i) != @intFromEnum(Parent.none)); | 256 | assert(@backingInt(i) != @backingInt(Parent.none)); |
| 257 | return @enumFromInt(@intFromEnum(i)); | 257 | return @fromBackingInt(@intCast(@backingInt(i))); |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | pub fn toOptional(i: @This()) OptionalIndex { | 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,7 +303,7 @@ pub const Node = struct { |
| 303 | return Node.none; | 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 | pub fn startFmt(node: Node, estimated_total_items: usize, comptime format: []const u8, args: anytype) Node { | 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,19 +458,19 @@ pub const Node = struct { |
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | fn storageByIndex(index: Node.Index) *Node.Storage { | 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 | fn parentByIndex(index: Node.Index) *Node.Parent { | 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 | fn freelistNextByIndex(index: Node.Index) *Node.OptionalIndex { | 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 | fn init(free_index: Index, parent: Parent, name: []const u8, estimated_total_items: usize) Node { | 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 | const storage = storageByIndex(free_index); | 475 | const storage = storageByIndex(free_index); |
| 476 | @atomicStore(u32, &storage.completed_count, 0, .monotonic); | 476 | @atomicStore(u32, &storage.completed_count, 0, .monotonic); |
| ... | @@ -595,7 +595,7 @@ pub fn start(io: Io, options: Options) Node { | ... | @@ -595,7 +595,7 @@ pub fn start(io: Io, options: Options) Node { |
| 595 | 595 | ||
| 596 | @memset(&global_progress.node_parents, .unused); | 596 | @memset(&global_progress.node_parents, .unused); |
| 597 | @memset(&global_progress.ipc, .{ .locked = false, .valid = false, .generation = 0 }); | 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 | global_progress.node_end_index = 1; | 599 | global_progress.node_end_index = 1; |
| 600 | 600 | ||
| 601 | assert(options.draw_buffer.len >= 200); | 601 | assert(options.draw_buffer.len >= 200); |
| ... | @@ -1063,7 +1063,7 @@ fn serialize(io: Io, serialized_buffer: *Serialized.Buffer) !Serialized { | ... | @@ -1063,7 +1063,7 @@ fn serialize(io: Io, serialized_buffer: *Serialized.Buffer) !Serialized { |
| 1063 | dest_storage.completed_count = @atomicLoad(u32, &storage_ptr.completed_count, .monotonic); | 1063 | dest_storage.completed_count = @atomicLoad(u32, &storage_ptr.completed_count, .monotonic); |
| 1064 | 1064 | ||
| 1065 | serialized_buffer.parents[serialized_len] = parent; | 1065 | serialized_buffer.parents[serialized_len] = parent; |
| 1066 | map_entry.* = @enumFromInt(serialized_len); | 1066 | map_entry.* = @fromBackingInt(@intCast(serialized_len)); |
| 1067 | if (maybe_ipc_start == null and dest_storage.getIpcIndex() != null) maybe_ipc_start = serialized_len; | 1067 | if (maybe_ipc_start == null and dest_storage.getIpcIndex() != null) maybe_ipc_start = serialized_len; |
| 1068 | serialized_len += 1; | 1068 | serialized_len += 1; |
| 1069 | } | 1069 | } |
| ... | @@ -1073,7 +1073,7 @@ fn serialize(io: Io, serialized_buffer: *Serialized.Buffer) !Serialized { | ... | @@ -1073,7 +1073,7 @@ fn serialize(io: Io, serialized_buffer: *Serialized.Buffer) !Serialized { |
| 1073 | parent.* = switch (parent.*) { | 1073 | parent.* = switch (parent.*) { |
| 1074 | .unused => unreachable, | 1074 | .unused => unreachable, |
| 1075 | .none => .none, | 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,11 +1173,11 @@ fn serialize(io: Io, serialized_buffer: *Serialized.Buffer) !Serialized { |
| 1173 | prev_parents[serialized_len..][0..nodes_len], | 1173 | prev_parents[serialized_len..][0..nodes_len], |
| 1174 | ) |*parent, prev_parent| parent.* = switch (prev_parent) { | 1174 | ) |*parent, prev_parent| parent.* = switch (prev_parent) { |
| 1175 | .none, .unused => .none, | 1175 | .none, .unused => .none, |
| 1176 | _ => if (@intFromEnum(prev_parent) == ipc_data.main_index) | 1176 | _ => if (@backingInt(prev_parent) == ipc_data.main_index) |
| 1177 | @enumFromInt(main_index) | 1177 | @fromBackingInt(@intCast(main_index)) |
| 1178 | else if (@intFromEnum(prev_parent) >= start_index and | 1178 | else if (@backingInt(prev_parent) >= start_index and |
| 1179 | @intFromEnum(prev_parent) < start_index + nodes_len) | 1179 | @backingInt(prev_parent) < start_index + nodes_len) |
| 1180 | @enumFromInt(@intFromEnum(prev_parent) - start_index + serialized_len) | 1180 | @fromBackingInt(@intCast(@backingInt(prev_parent) - start_index + serialized_len)) |
| 1181 | else | 1181 | else |
| 1182 | .none, | 1182 | .none, |
| 1183 | }; | 1183 | }; |
| ... | @@ -1228,12 +1228,12 @@ fn serialize(io: Io, serialized_buffer: *Serialized.Buffer) !Serialized { | ... | @@ -1228,12 +1228,12 @@ fn serialize(io: Io, serialized_buffer: *Serialized.Buffer) !Serialized { |
| 1228 | // Fix bad data so the rest of the code does not see `unused`. | 1228 | // Fix bad data so the rest of the code does not see `unused`. |
| 1229 | .none, .unused => .none, | 1229 | .none, .unused => .none, |
| 1230 | // Root node is being mounted here. | 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 | // Other nodes mounted at the end. | 1232 | // Other nodes mounted at the end. |
| 1233 | // Don't trust child data; if the data is outside the expected range, | 1233 | // Don't trust child data; if the data is outside the expected range, |
| 1234 | // ignore the data. This also handles the case when data was truncated. | 1234 | // ignore the data. This also handles the case when data was truncated. |
| 1235 | _ => if (@intFromEnum(prev_parent) <= nodes_len) | 1235 | _ => if (@backingInt(prev_parent) <= nodes_len) |
| 1236 | @enumFromInt(@intFromEnum(prev_parent) - 1 + serialized_len) | 1236 | @fromBackingInt(@intCast(@backingInt(prev_parent) - 1 + serialized_len)) |
| 1237 | else | 1237 | else |
| 1238 | .none, | 1238 | .none, |
| 1239 | }; | 1239 | }; |
| ... | @@ -1290,13 +1290,13 @@ fn computeRedraw(io: Io, serialized_buffer: *Serialized.Buffer) !struct { []u8, | ... | @@ -1290,13 +1290,13 @@ fn computeRedraw(io: Io, serialized_buffer: *Serialized.Buffer) !struct { []u8, |
| 1290 | @memset(children, .{ .child = .none, .sibling = .none }); | 1290 | @memset(children, .{ .child = .none, .sibling = .none }); |
| 1291 | 1291 | ||
| 1292 | for (serialized.parents, 0..) |parent, child_index_usize| { | 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 | assert(parent != .unused); | 1294 | assert(parent != .unused); |
| 1295 | const parent_index = parent.unwrap() orelse continue; | 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 | if (children_node.child.unwrap()) |existing_child_index| { | 1297 | if (children_node.child.unwrap()) |existing_child_index| { |
| 1298 | const existing_child = &children[@intFromEnum(existing_child_index)]; | 1298 | const existing_child = &children[@backingInt(existing_child_index)]; |
| 1299 | children[@intFromEnum(child_index)].sibling = existing_child.sibling; | 1299 | children[@backingInt(child_index)].sibling = existing_child.sibling; |
| 1300 | existing_child.sibling = child_index.toOptional(); | 1300 | existing_child.sibling = child_index.toOptional(); |
| 1301 | } else { | 1301 | } else { |
| 1302 | children_node.child = child_index.toOptional(); | 1302 | children_node.child = child_index.toOptional(); |
| ... | @@ -1325,14 +1325,14 @@ fn computeRedraw(io: Io, serialized_buffer: *Serialized.Buffer) !struct { []u8, | ... | @@ -1325,14 +1325,14 @@ fn computeRedraw(io: Io, serialized_buffer: *Serialized.Buffer) !struct { []u8, |
| 1325 | .windows_api => {}, | 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 | i, const nl_n = computeNode(buf, i, 0, serialized, children, root_node_index); | 1329 | i, const nl_n = computeNode(buf, i, 0, serialized, children, root_node_index); |
| 1330 | 1330 | ||
| 1331 | if (global_progress.terminal_mode == .ansi_escape_codes) { | 1331 | if (global_progress.terminal_mode == .ansi_escape_codes) { |
| 1332 | { | 1332 | { |
| 1333 | // Set progress state https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC | 1333 | // Set progress state https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC |
| 1334 | const root_storage = &serialized.storage[0]; | 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 | const estimated_total = storage.estimated_total_count; | 1336 | const estimated_total = storage.estimated_total_count; |
| 1337 | const completed_items = storage.completed_count; | 1337 | const completed_items = storage.completed_count; |
| 1338 | const status = @atomicLoad(Status, &global_progress.status, .monotonic); | 1338 | const status = @atomicLoad(Status, &global_progress.status, .monotonic); |
| ... | @@ -1395,15 +1395,15 @@ fn computePrefix( | ... | @@ -1395,15 +1395,15 @@ fn computePrefix( |
| 1395 | node_index: Node.Index, | 1395 | node_index: Node.Index, |
| 1396 | ) usize { | 1396 | ) usize { |
| 1397 | var i = start_i; | 1397 | var i = start_i; |
| 1398 | const parent_index = serialized.parents[@intFromEnum(node_index)].unwrap() orelse return i; | 1398 | const parent_index = serialized.parents[@backingInt(node_index)].unwrap() orelse return i; |
| 1399 | if (serialized.parents[@intFromEnum(parent_index)] == .none) return i; | 1399 | if (serialized.parents[@backingInt(parent_index)] == .none) return i; |
| 1400 | if (@intFromEnum(serialized.parents[@intFromEnum(parent_index)]) == 0 and | 1400 | if (@backingInt(serialized.parents[@backingInt(parent_index)]) == 0 and |
| 1401 | serialized.storage[0].name[0] == 0) | 1401 | serialized.storage[0].name[0] == 0) |
| 1402 | { | 1402 | { |
| 1403 | return i; | 1403 | return i; |
| 1404 | } | 1404 | } |
| 1405 | i = computePrefix(buf, i, nl_n, serialized, children, parent_index); | 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 | const prefix = " "; | 1407 | const prefix = " "; |
| 1408 | const upper_bound_len = prefix.len + lineUpperBoundLen(nl_n); | 1408 | const upper_bound_len = prefix.len + lineUpperBoundLen(nl_n); |
| 1409 | if (i + upper_bound_len > buf.len) return buf.len; | 1409 | if (i + upper_bound_len > buf.len) return buf.len; |
| ... | @@ -1442,24 +1442,24 @@ fn computeNode( | ... | @@ -1442,24 +1442,24 @@ fn computeNode( |
| 1442 | if (i + lineUpperBoundLen(nl_n) > buf.len) | 1442 | if (i + lineUpperBoundLen(nl_n) > buf.len) |
| 1443 | return .{ start_i, start_nl_n }; | 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 | const estimated_total = storage.estimated_total_count; | 1446 | const estimated_total = storage.estimated_total_count; |
| 1447 | const completed_items = storage.completed_count; | 1447 | const completed_items = storage.completed_count; |
| 1448 | const name = if (std.mem.findScalar(u8, &storage.name, 0)) |end| storage.name[0..end] else &storage.name; | 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 | if (parent != .none) p: { | 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 | break :p; | 1453 | break :p; |
| 1454 | } | 1454 | } |
| 1455 | if (children[@intFromEnum(node_index)].sibling == .none) { | 1455 | if (children[@backingInt(node_index)].sibling == .none) { |
| 1456 | i = appendTreeSymbol(.langle, buf, i); | 1456 | i = appendTreeSymbol(.langle, buf, i); |
| 1457 | } else { | 1457 | } else { |
| 1458 | i = appendTreeSymbol(.tee, buf, i); | 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 | if (!is_empty_root) { | 1463 | if (!is_empty_root) { |
| 1464 | if (name.len != 0 or estimated_total > 0) { | 1464 | if (name.len != 0 or estimated_total > 0) { |
| 1465 | if (estimated_total > 0) { | 1465 | if (estimated_total > 0) { |
| ... | @@ -1492,13 +1492,13 @@ fn computeNode( | ... | @@ -1492,13 +1492,13 @@ fn computeNode( |
| 1492 | } | 1492 | } |
| 1493 | 1493 | ||
| 1494 | if (global_progress.withinRowLimit(nl_n)) { | 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 | i, nl_n = computeNode(buf, i, nl_n, serialized, children, child); | 1496 | i, nl_n = computeNode(buf, i, nl_n, serialized, children, child); |
| 1497 | } | 1497 | } |
| 1498 | } | 1498 | } |
| 1499 | 1499 | ||
| 1500 | if (global_progress.withinRowLimit(nl_n)) { | 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 | i, nl_n = computeNode(buf, i, nl_n, serialized, children, sibling); | 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,7 +286,7 @@ pub const Os = struct { |
| 286 | 286 | ||
| 287 | /// Returns whether the first version `ver` is newer (greater) than or equal to the second version `ver`. | 287 | /// Returns whether the first version `ver` is newer (greater) than or equal to the second version `ver`. |
| 288 | pub inline fn isAtLeast(ver: WindowsVersion, min_ver: WindowsVersion) bool { | 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 | pub const Range = struct { | 292 | pub const Range = struct { |
| ... | @@ -294,23 +294,23 @@ pub const Os = struct { | ... | @@ -294,23 +294,23 @@ pub const Os = struct { |
| 294 | max: WindowsVersion, | 294 | max: WindowsVersion, |
| 295 | 295 | ||
| 296 | pub inline fn includesVersion(range: Range, ver: WindowsVersion) bool { | 296 | pub inline fn includesVersion(range: Range, ver: WindowsVersion) bool { |
| 297 | return @intFromEnum(ver) >= @intFromEnum(range.min) and | 297 | return @backingInt(ver) >= @backingInt(range.min) and |
| 298 | @intFromEnum(ver) <= @intFromEnum(range.max); | 298 | @backingInt(ver) <= @backingInt(range.max); |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | /// Checks if system is guaranteed to be at least `version` or older than `version`. | 301 | /// Checks if system is guaranteed to be at least `version` or older than `version`. |
| 302 | /// Returns `null` if a runtime check is required. | 302 | /// Returns `null` if a runtime check is required. |
| 303 | pub inline fn isAtLeast(range: Range, min_ver: WindowsVersion) ?bool { | 303 | pub inline fn isAtLeast(range: Range, min_ver: WindowsVersion) ?bool { |
| 304 | if (@intFromEnum(range.min) >= @intFromEnum(min_ver)) return true; | 304 | if (@backingInt(range.min) >= @backingInt(min_ver)) return true; |
| 305 | if (@intFromEnum(range.max) < @intFromEnum(min_ver)) return false; | 305 | if (@backingInt(range.max) < @backingInt(min_ver)) return false; |
| 306 | return null; | 306 | return null; |
| 307 | } | 307 | } |
| 308 | }; | 308 | }; |
| 309 | 309 | ||
| 310 | pub fn parse(str: []const u8) !WindowsVersion { | 310 | pub fn parse(str: []const u8) !WindowsVersion { |
| 311 | return std.meta.stringToEnum(WindowsVersion, str) orelse | 311 | return std.meta.stringToEnum(WindowsVersion, str) orelse |
| 312 | @enumFromInt(std.fmt.parseInt(u32, str, 0) catch | 312 | @fromBackingInt(@intCast(std.fmt.parseInt(u32, str, 0) catch |
| 313 | return error.InvalidOperatingSystemVersion); | 313 | return error.InvalidOperatingSystemVersion)); |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | /// This function is defined to serialize a Zig source code representation of this | 316 | /// This function is defined to serialize a Zig source code representation of this |
| ... | @@ -1320,20 +1320,20 @@ pub const Cpu = struct { | ... | @@ -1320,20 +1320,20 @@ pub const Cpu = struct { |
| 1320 | pub fn featureSet(features: []const F) Set { | 1320 | pub fn featureSet(features: []const F) Set { |
| 1321 | var x = Set.empty; | 1321 | var x = Set.empty; |
| 1322 | for (features) |feature| { | 1322 | for (features) |feature| { |
| 1323 | x.addFeature(@intFromEnum(feature)); | 1323 | x.addFeature(@backingInt(feature)); |
| 1324 | } | 1324 | } |
| 1325 | return x; | 1325 | return x; |
| 1326 | } | 1326 | } |
| 1327 | 1327 | ||
| 1328 | /// Returns true if the specified feature is enabled. | 1328 | /// Returns true if the specified feature is enabled. |
| 1329 | pub fn featureSetHas(set: Set, feature: F) bool { | 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 | /// Returns true if any specified feature is enabled. | 1333 | /// Returns true if any specified feature is enabled. |
| 1334 | pub fn featureSetHasAny(set: Set, features: anytype) bool { | 1334 | pub fn featureSetHasAny(set: Set, features: anytype) bool { |
| 1335 | inline for (features) |feature| { | 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 | return false; | 1338 | return false; |
| 1339 | } | 1339 | } |
| ... | @@ -1341,7 +1341,7 @@ pub const Cpu = struct { | ... | @@ -1341,7 +1341,7 @@ pub const Cpu = struct { |
| 1341 | /// Returns true if every specified feature is enabled. | 1341 | /// Returns true if every specified feature is enabled. |
| 1342 | pub fn featureSetHasAll(set: Set, features: anytype) bool { | 1342 | pub fn featureSetHasAll(set: Set, features: anytype) bool { |
| 1343 | inline for (features) |feature| { | 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 | return true; | 1346 | return true; |
| 1347 | } | 1347 | } |
| ... | @@ -2119,14 +2119,14 @@ pub const Cpu = struct { | ... | @@ -2119,14 +2119,14 @@ pub const Cpu = struct { |
| 2119 | /// Returns true if `feature` is enabled. | 2119 | /// Returns true if `feature` is enabled. |
| 2120 | pub fn has(cpu: Cpu, comptime family: Arch.Family, feature: @field(Target, @tagName(family)).Feature) bool { | 2120 | pub fn has(cpu: Cpu, comptime family: Arch.Family, feature: @field(Target, @tagName(family)).Feature) bool { |
| 2121 | if (family != cpu.arch.family()) return false; | 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 | /// Returns true if any feature in `features` is enabled. | 2125 | /// Returns true if any feature in `features` is enabled. |
| 2126 | pub fn hasAny(cpu: Cpu, comptime family: Arch.Family, features: []const @field(Target, @tagName(family)).Feature) bool { | 2126 | pub fn hasAny(cpu: Cpu, comptime family: Arch.Family, features: []const @field(Target, @tagName(family)).Feature) bool { |
| 2127 | if (family != cpu.arch.family()) return false; | 2127 | if (family != cpu.arch.family()) return false; |
| 2128 | for (features) |feature| { | 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 | return false; | 2131 | return false; |
| 2132 | } | 2132 | } |
| ... | @@ -2135,7 +2135,7 @@ pub const Cpu = struct { | ... | @@ -2135,7 +2135,7 @@ pub const Cpu = struct { |
| 2135 | pub fn hasAll(cpu: Cpu, comptime family: Arch.Family, features: []const @field(Target, @tagName(family)).Feature) bool { | 2135 | pub fn hasAll(cpu: Cpu, comptime family: Arch.Family, features: []const @field(Target, @tagName(family)).Feature) bool { |
| 2136 | if (family != cpu.arch.family()) return false; | 2136 | if (family != cpu.arch.family()) return false; |
| 2137 | for (features) |feature| { | 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 | return true; | 2140 | return true; |
| 2141 | } | 2141 | } |
lib/std/Target/aarch64.zig+277-277| ... | @@ -294,7 +294,7 @@ pub const all_features = blk: { | ... | @@ -294,7 +294,7 @@ pub const all_features = blk: { |
| 294 | const len = @typeInfo(Feature).@"enum".field_names.len; | 294 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 295 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 295 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 296 | var result: [len]CpuFeature = undefined; | 296 | var result: [len]CpuFeature = undefined; |
| 297 | result[@intFromEnum(Feature.a320)] = .{ | 297 | result[@backingInt(Feature.a320)] = .{ |
| 298 | .llvm_name = "a320", | 298 | .llvm_name = "a320", |
| 299 | .description = "Cortex-A320 ARM processors", | 299 | .description = "Cortex-A320 ARM processors", |
| 300 | .dependencies = featureSet(&[_]Feature{ | 300 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -306,214 +306,214 @@ pub const all_features = blk: { | ... | @@ -306,214 +306,214 @@ pub const all_features = blk: { |
| 306 | .use_wzr_to_vec_move, | 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 | .llvm_name = "addr-lsl-slow-14", | 310 | .llvm_name = "addr-lsl-slow-14", |
| 311 | .description = "Address operands with shift amount of 1 or 4 are slow", | 311 | .description = "Address operands with shift amount of 1 or 4 are slow", |
| 312 | .dependencies = featureSet(&[_]Feature{}), | 312 | .dependencies = featureSet(&[_]Feature{}), |
| 313 | }; | 313 | }; |
| 314 | result[@intFromEnum(Feature.aes)] = .{ | 314 | result[@backingInt(Feature.aes)] = .{ |
| 315 | .llvm_name = "aes", | 315 | .llvm_name = "aes", |
| 316 | .description = "Enable AES support", | 316 | .description = "Enable AES support", |
| 317 | .dependencies = featureSet(&[_]Feature{ | 317 | .dependencies = featureSet(&[_]Feature{ |
| 318 | .neon, | 318 | .neon, |
| 319 | }), | 319 | }), |
| 320 | }; | 320 | }; |
| 321 | result[@intFromEnum(Feature.aggressive_fma)] = .{ | 321 | result[@backingInt(Feature.aggressive_fma)] = .{ |
| 322 | .llvm_name = "aggressive-fma", | 322 | .llvm_name = "aggressive-fma", |
| 323 | .description = "Enable Aggressive FMA for floating-point.", | 323 | .description = "Enable Aggressive FMA for floating-point.", |
| 324 | .dependencies = featureSet(&[_]Feature{}), | 324 | .dependencies = featureSet(&[_]Feature{}), |
| 325 | }; | 325 | }; |
| 326 | result[@intFromEnum(Feature.aggressive_interleaving)] = .{ | 326 | result[@backingInt(Feature.aggressive_interleaving)] = .{ |
| 327 | .llvm_name = "aggressive-interleaving", | 327 | .llvm_name = "aggressive-interleaving", |
| 328 | .description = "Make use of aggressive interleaving during vectorization", | 328 | .description = "Make use of aggressive interleaving during vectorization", |
| 329 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "alternate-sextload-cvt-f32-pattern", | 332 | .llvm_name = "alternate-sextload-cvt-f32-pattern", |
| 333 | .description = "Use alternative pattern for sextload convert to f32", | 333 | .description = "Use alternative pattern for sextload convert to f32", |
| 334 | .dependencies = featureSet(&[_]Feature{}), | 334 | .dependencies = featureSet(&[_]Feature{}), |
| 335 | }; | 335 | }; |
| 336 | result[@intFromEnum(Feature.altnzcv)] = .{ | 336 | result[@backingInt(Feature.altnzcv)] = .{ |
| 337 | .llvm_name = "altnzcv", | 337 | .llvm_name = "altnzcv", |
| 338 | .description = "Enable alternative NZCV format for floating point comparisons", | 338 | .description = "Enable alternative NZCV format for floating point comparisons", |
| 339 | .dependencies = featureSet(&[_]Feature{ | 339 | .dependencies = featureSet(&[_]Feature{ |
| 340 | .flagm, | 340 | .flagm, |
| 341 | }), | 341 | }), |
| 342 | }; | 342 | }; |
| 343 | result[@intFromEnum(Feature.alu_lsl_fast)] = .{ | 343 | result[@backingInt(Feature.alu_lsl_fast)] = .{ |
| 344 | .llvm_name = "alu-lsl-fast", | 344 | .llvm_name = "alu-lsl-fast", |
| 345 | .description = "Add/Sub operations with lsl shift <= 4 are cheap", | 345 | .description = "Add/Sub operations with lsl shift <= 4 are cheap", |
| 346 | .dependencies = featureSet(&[_]Feature{}), | 346 | .dependencies = featureSet(&[_]Feature{}), |
| 347 | }; | 347 | }; |
| 348 | result[@intFromEnum(Feature.am)] = .{ | 348 | result[@backingInt(Feature.am)] = .{ |
| 349 | .llvm_name = "am", | 349 | .llvm_name = "am", |
| 350 | .description = "Enable Armv8.4-A Activity Monitors extension", | 350 | .description = "Enable Armv8.4-A Activity Monitors extension", |
| 351 | .dependencies = featureSet(&[_]Feature{}), | 351 | .dependencies = featureSet(&[_]Feature{}), |
| 352 | }; | 352 | }; |
| 353 | result[@intFromEnum(Feature.amvs)] = .{ | 353 | result[@backingInt(Feature.amvs)] = .{ |
| 354 | .llvm_name = "amvs", | 354 | .llvm_name = "amvs", |
| 355 | .description = "Enable Armv8.6-A Activity Monitors Virtualization support", | 355 | .description = "Enable Armv8.6-A Activity Monitors Virtualization support", |
| 356 | .dependencies = featureSet(&[_]Feature{ | 356 | .dependencies = featureSet(&[_]Feature{ |
| 357 | .am, | 357 | .am, |
| 358 | }), | 358 | }), |
| 359 | }; | 359 | }; |
| 360 | result[@intFromEnum(Feature.arith_bcc_fusion)] = .{ | 360 | result[@backingInt(Feature.arith_bcc_fusion)] = .{ |
| 361 | .llvm_name = "arith-bcc-fusion", | 361 | .llvm_name = "arith-bcc-fusion", |
| 362 | .description = "CPU fuses arithmetic+bcc operations", | 362 | .description = "CPU fuses arithmetic+bcc operations", |
| 363 | .dependencies = featureSet(&[_]Feature{}), | 363 | .dependencies = featureSet(&[_]Feature{}), |
| 364 | }; | 364 | }; |
| 365 | result[@intFromEnum(Feature.arith_cbz_fusion)] = .{ | 365 | result[@backingInt(Feature.arith_cbz_fusion)] = .{ |
| 366 | .llvm_name = "arith-cbz-fusion", | 366 | .llvm_name = "arith-cbz-fusion", |
| 367 | .description = "CPU fuses arithmetic + cbz/cbnz operations", | 367 | .description = "CPU fuses arithmetic + cbz/cbnz operations", |
| 368 | .dependencies = featureSet(&[_]Feature{}), | 368 | .dependencies = featureSet(&[_]Feature{}), |
| 369 | }; | 369 | }; |
| 370 | result[@intFromEnum(Feature.ascend_store_address)] = .{ | 370 | result[@backingInt(Feature.ascend_store_address)] = .{ |
| 371 | .llvm_name = "ascend-store-address", | 371 | .llvm_name = "ascend-store-address", |
| 372 | .description = "Schedule vector stores by ascending address", | 372 | .description = "Schedule vector stores by ascending address", |
| 373 | .dependencies = featureSet(&[_]Feature{}), | 373 | .dependencies = featureSet(&[_]Feature{}), |
| 374 | }; | 374 | }; |
| 375 | result[@intFromEnum(Feature.avoid_ldapur)] = .{ | 375 | result[@backingInt(Feature.avoid_ldapur)] = .{ |
| 376 | .llvm_name = "avoid-ldapur", | 376 | .llvm_name = "avoid-ldapur", |
| 377 | .description = "Prefer add+ldapr to offset ldapur", | 377 | .description = "Prefer add+ldapr to offset ldapur", |
| 378 | .dependencies = featureSet(&[_]Feature{}), | 378 | .dependencies = featureSet(&[_]Feature{}), |
| 379 | }; | 379 | }; |
| 380 | result[@intFromEnum(Feature.balance_fp_ops)] = .{ | 380 | result[@backingInt(Feature.balance_fp_ops)] = .{ |
| 381 | .llvm_name = "balance-fp-ops", | 381 | .llvm_name = "balance-fp-ops", |
| 382 | .description = "balance mix of odd and even D-registers for fp multiply(-accumulate) ops", | 382 | .description = "balance mix of odd and even D-registers for fp multiply(-accumulate) ops", |
| 383 | .dependencies = featureSet(&[_]Feature{}), | 383 | .dependencies = featureSet(&[_]Feature{}), |
| 384 | }; | 384 | }; |
| 385 | result[@intFromEnum(Feature.bf16)] = .{ | 385 | result[@backingInt(Feature.bf16)] = .{ |
| 386 | .llvm_name = "bf16", | 386 | .llvm_name = "bf16", |
| 387 | .description = "Enable BFloat16 Extension", | 387 | .description = "Enable BFloat16 Extension", |
| 388 | .dependencies = featureSet(&[_]Feature{ | 388 | .dependencies = featureSet(&[_]Feature{ |
| 389 | .neon, | 389 | .neon, |
| 390 | }), | 390 | }), |
| 391 | }; | 391 | }; |
| 392 | result[@intFromEnum(Feature.brbe)] = .{ | 392 | result[@backingInt(Feature.brbe)] = .{ |
| 393 | .llvm_name = "brbe", | 393 | .llvm_name = "brbe", |
| 394 | .description = "Enable Branch Record Buffer Extension", | 394 | .description = "Enable Branch Record Buffer Extension", |
| 395 | .dependencies = featureSet(&[_]Feature{}), | 395 | .dependencies = featureSet(&[_]Feature{}), |
| 396 | }; | 396 | }; |
| 397 | result[@intFromEnum(Feature.bti)] = .{ | 397 | result[@backingInt(Feature.bti)] = .{ |
| 398 | .llvm_name = "bti", | 398 | .llvm_name = "bti", |
| 399 | .description = "Enable Branch Target Identification", | 399 | .description = "Enable Branch Target Identification", |
| 400 | .dependencies = featureSet(&[_]Feature{}), | 400 | .dependencies = featureSet(&[_]Feature{}), |
| 401 | }; | 401 | }; |
| 402 | result[@intFromEnum(Feature.btie)] = .{ | 402 | result[@backingInt(Feature.btie)] = .{ |
| 403 | .llvm_name = "btie", | 403 | .llvm_name = "btie", |
| 404 | .description = "Enable Enhanced Branch Target Identification extension", | 404 | .description = "Enable Enhanced Branch Target Identification extension", |
| 405 | .dependencies = featureSet(&[_]Feature{}), | 405 | .dependencies = featureSet(&[_]Feature{}), |
| 406 | }; | 406 | }; |
| 407 | result[@intFromEnum(Feature.call_saved_x10)] = .{ | 407 | result[@backingInt(Feature.call_saved_x10)] = .{ |
| 408 | .llvm_name = "call-saved-x10", | 408 | .llvm_name = "call-saved-x10", |
| 409 | .description = "Make X10 callee saved.", | 409 | .description = "Make X10 callee saved.", |
| 410 | .dependencies = featureSet(&[_]Feature{}), | 410 | .dependencies = featureSet(&[_]Feature{}), |
| 411 | }; | 411 | }; |
| 412 | result[@intFromEnum(Feature.call_saved_x11)] = .{ | 412 | result[@backingInt(Feature.call_saved_x11)] = .{ |
| 413 | .llvm_name = "call-saved-x11", | 413 | .llvm_name = "call-saved-x11", |
| 414 | .description = "Make X11 callee saved.", | 414 | .description = "Make X11 callee saved.", |
| 415 | .dependencies = featureSet(&[_]Feature{}), | 415 | .dependencies = featureSet(&[_]Feature{}), |
| 416 | }; | 416 | }; |
| 417 | result[@intFromEnum(Feature.call_saved_x12)] = .{ | 417 | result[@backingInt(Feature.call_saved_x12)] = .{ |
| 418 | .llvm_name = "call-saved-x12", | 418 | .llvm_name = "call-saved-x12", |
| 419 | .description = "Make X12 callee saved.", | 419 | .description = "Make X12 callee saved.", |
| 420 | .dependencies = featureSet(&[_]Feature{}), | 420 | .dependencies = featureSet(&[_]Feature{}), |
| 421 | }; | 421 | }; |
| 422 | result[@intFromEnum(Feature.call_saved_x13)] = .{ | 422 | result[@backingInt(Feature.call_saved_x13)] = .{ |
| 423 | .llvm_name = "call-saved-x13", | 423 | .llvm_name = "call-saved-x13", |
| 424 | .description = "Make X13 callee saved.", | 424 | .description = "Make X13 callee saved.", |
| 425 | .dependencies = featureSet(&[_]Feature{}), | 425 | .dependencies = featureSet(&[_]Feature{}), |
| 426 | }; | 426 | }; |
| 427 | result[@intFromEnum(Feature.call_saved_x14)] = .{ | 427 | result[@backingInt(Feature.call_saved_x14)] = .{ |
| 428 | .llvm_name = "call-saved-x14", | 428 | .llvm_name = "call-saved-x14", |
| 429 | .description = "Make X14 callee saved.", | 429 | .description = "Make X14 callee saved.", |
| 430 | .dependencies = featureSet(&[_]Feature{}), | 430 | .dependencies = featureSet(&[_]Feature{}), |
| 431 | }; | 431 | }; |
| 432 | result[@intFromEnum(Feature.call_saved_x15)] = .{ | 432 | result[@backingInt(Feature.call_saved_x15)] = .{ |
| 433 | .llvm_name = "call-saved-x15", | 433 | .llvm_name = "call-saved-x15", |
| 434 | .description = "Make X15 callee saved.", | 434 | .description = "Make X15 callee saved.", |
| 435 | .dependencies = featureSet(&[_]Feature{}), | 435 | .dependencies = featureSet(&[_]Feature{}), |
| 436 | }; | 436 | }; |
| 437 | result[@intFromEnum(Feature.call_saved_x18)] = .{ | 437 | result[@backingInt(Feature.call_saved_x18)] = .{ |
| 438 | .llvm_name = "call-saved-x18", | 438 | .llvm_name = "call-saved-x18", |
| 439 | .description = "Make X18 callee saved.", | 439 | .description = "Make X18 callee saved.", |
| 440 | .dependencies = featureSet(&[_]Feature{}), | 440 | .dependencies = featureSet(&[_]Feature{}), |
| 441 | }; | 441 | }; |
| 442 | result[@intFromEnum(Feature.call_saved_x8)] = .{ | 442 | result[@backingInt(Feature.call_saved_x8)] = .{ |
| 443 | .llvm_name = "call-saved-x8", | 443 | .llvm_name = "call-saved-x8", |
| 444 | .description = "Make X8 callee saved.", | 444 | .description = "Make X8 callee saved.", |
| 445 | .dependencies = featureSet(&[_]Feature{}), | 445 | .dependencies = featureSet(&[_]Feature{}), |
| 446 | }; | 446 | }; |
| 447 | result[@intFromEnum(Feature.call_saved_x9)] = .{ | 447 | result[@backingInt(Feature.call_saved_x9)] = .{ |
| 448 | .llvm_name = "call-saved-x9", | 448 | .llvm_name = "call-saved-x9", |
| 449 | .description = "Make X9 callee saved.", | 449 | .description = "Make X9 callee saved.", |
| 450 | .dependencies = featureSet(&[_]Feature{}), | 450 | .dependencies = featureSet(&[_]Feature{}), |
| 451 | }; | 451 | }; |
| 452 | result[@intFromEnum(Feature.ccdp)] = .{ | 452 | result[@backingInt(Feature.ccdp)] = .{ |
| 453 | .llvm_name = "ccdp", | 453 | .llvm_name = "ccdp", |
| 454 | .description = "Enable Armv8.5-A Cache Clean to Point of Deep Persistence", | 454 | .description = "Enable Armv8.5-A Cache Clean to Point of Deep Persistence", |
| 455 | .dependencies = featureSet(&[_]Feature{ | 455 | .dependencies = featureSet(&[_]Feature{ |
| 456 | .ccpp, | 456 | .ccpp, |
| 457 | }), | 457 | }), |
| 458 | }; | 458 | }; |
| 459 | result[@intFromEnum(Feature.ccidx)] = .{ | 459 | result[@backingInt(Feature.ccidx)] = .{ |
| 460 | .llvm_name = "ccidx", | 460 | .llvm_name = "ccidx", |
| 461 | .description = "Enable Armv8.3-A Extend of the CCSIDR number of sets", | 461 | .description = "Enable Armv8.3-A Extend of the CCSIDR number of sets", |
| 462 | .dependencies = featureSet(&[_]Feature{}), | 462 | .dependencies = featureSet(&[_]Feature{}), |
| 463 | }; | 463 | }; |
| 464 | result[@intFromEnum(Feature.ccpp)] = .{ | 464 | result[@backingInt(Feature.ccpp)] = .{ |
| 465 | .llvm_name = "ccpp", | 465 | .llvm_name = "ccpp", |
| 466 | .description = "Enable Armv8.2-A data Cache Clean to Point of Persistence", | 466 | .description = "Enable Armv8.2-A data Cache Clean to Point of Persistence", |
| 467 | .dependencies = featureSet(&[_]Feature{}), | 467 | .dependencies = featureSet(&[_]Feature{}), |
| 468 | }; | 468 | }; |
| 469 | result[@intFromEnum(Feature.chk)] = .{ | 469 | result[@backingInt(Feature.chk)] = .{ |
| 470 | .llvm_name = "chk", | 470 | .llvm_name = "chk", |
| 471 | .description = "Enable Armv8.0-A Check Feature Status Extension", | 471 | .description = "Enable Armv8.0-A Check Feature Status Extension", |
| 472 | .dependencies = featureSet(&[_]Feature{}), | 472 | .dependencies = featureSet(&[_]Feature{}), |
| 473 | }; | 473 | }; |
| 474 | result[@intFromEnum(Feature.clrbhb)] = .{ | 474 | result[@backingInt(Feature.clrbhb)] = .{ |
| 475 | .llvm_name = "clrbhb", | 475 | .llvm_name = "clrbhb", |
| 476 | .description = "Enable Clear BHB instruction", | 476 | .description = "Enable Clear BHB instruction", |
| 477 | .dependencies = featureSet(&[_]Feature{}), | 477 | .dependencies = featureSet(&[_]Feature{}), |
| 478 | }; | 478 | }; |
| 479 | result[@intFromEnum(Feature.cmh)] = .{ | 479 | result[@backingInt(Feature.cmh)] = .{ |
| 480 | .llvm_name = "cmh", | 480 | .llvm_name = "cmh", |
| 481 | .description = "Enable Armv9.7-A Contention Management Hints", | 481 | .description = "Enable Armv9.7-A Contention Management Hints", |
| 482 | .dependencies = featureSet(&[_]Feature{}), | 482 | .dependencies = featureSet(&[_]Feature{}), |
| 483 | }; | 483 | }; |
| 484 | result[@intFromEnum(Feature.cmp_bcc_fusion)] = .{ | 484 | result[@backingInt(Feature.cmp_bcc_fusion)] = .{ |
| 485 | .llvm_name = "cmp-bcc-fusion", | 485 | .llvm_name = "cmp-bcc-fusion", |
| 486 | .description = "CPU fuses cmp+bcc operations", | 486 | .description = "CPU fuses cmp+bcc operations", |
| 487 | .dependencies = featureSet(&[_]Feature{}), | 487 | .dependencies = featureSet(&[_]Feature{}), |
| 488 | }; | 488 | }; |
| 489 | result[@intFromEnum(Feature.cmpbr)] = .{ | 489 | result[@backingInt(Feature.cmpbr)] = .{ |
| 490 | .llvm_name = "cmpbr", | 490 | .llvm_name = "cmpbr", |
| 491 | .description = "Enable Armv9.6-A base compare and branch instructions", | 491 | .description = "Enable Armv9.6-A base compare and branch instructions", |
| 492 | .dependencies = featureSet(&[_]Feature{}), | 492 | .dependencies = featureSet(&[_]Feature{}), |
| 493 | }; | 493 | }; |
| 494 | result[@intFromEnum(Feature.complxnum)] = .{ | 494 | result[@backingInt(Feature.complxnum)] = .{ |
| 495 | .llvm_name = "complxnum", | 495 | .llvm_name = "complxnum", |
| 496 | .description = "Enable Armv8.3-A Floating-point complex number support", | 496 | .description = "Enable Armv8.3-A Floating-point complex number support", |
| 497 | .dependencies = featureSet(&[_]Feature{ | 497 | .dependencies = featureSet(&[_]Feature{ |
| 498 | .neon, | 498 | .neon, |
| 499 | }), | 499 | }), |
| 500 | }; | 500 | }; |
| 501 | result[@intFromEnum(Feature.contextidr_el2)] = .{ | 501 | result[@backingInt(Feature.contextidr_el2)] = .{ |
| 502 | .llvm_name = "CONTEXTIDREL2", | 502 | .llvm_name = "CONTEXTIDREL2", |
| 503 | .description = "Enable RW operand Context ID Register (EL2)", | 503 | .description = "Enable RW operand Context ID Register (EL2)", |
| 504 | .dependencies = featureSet(&[_]Feature{}), | 504 | .dependencies = featureSet(&[_]Feature{}), |
| 505 | }; | 505 | }; |
| 506 | result[@intFromEnum(Feature.cpa)] = .{ | 506 | result[@backingInt(Feature.cpa)] = .{ |
| 507 | .llvm_name = "cpa", | 507 | .llvm_name = "cpa", |
| 508 | .description = "Enable Armv9.5-A Checked Pointer Arithmetic", | 508 | .description = "Enable Armv9.5-A Checked Pointer Arithmetic", |
| 509 | .dependencies = featureSet(&[_]Feature{}), | 509 | .dependencies = featureSet(&[_]Feature{}), |
| 510 | }; | 510 | }; |
| 511 | result[@intFromEnum(Feature.crc)] = .{ | 511 | result[@backingInt(Feature.crc)] = .{ |
| 512 | .llvm_name = "crc", | 512 | .llvm_name = "crc", |
| 513 | .description = "Enable Armv8.0-A CRC-32 checksum instructions", | 513 | .description = "Enable Armv8.0-A CRC-32 checksum instructions", |
| 514 | .dependencies = featureSet(&[_]Feature{}), | 514 | .dependencies = featureSet(&[_]Feature{}), |
| 515 | }; | 515 | }; |
| 516 | result[@intFromEnum(Feature.crypto)] = .{ | 516 | result[@backingInt(Feature.crypto)] = .{ |
| 517 | .llvm_name = "crypto", | 517 | .llvm_name = "crypto", |
| 518 | .description = "Enable cryptographic instructions", | 518 | .description = "Enable cryptographic instructions", |
| 519 | .dependencies = featureSet(&[_]Feature{ | 519 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -521,98 +521,98 @@ pub const all_features = blk: { | ... | @@ -521,98 +521,98 @@ pub const all_features = blk: { |
| 521 | .sha2, | 521 | .sha2, |
| 522 | }), | 522 | }), |
| 523 | }; | 523 | }; |
| 524 | result[@intFromEnum(Feature.cssc)] = .{ | 524 | result[@backingInt(Feature.cssc)] = .{ |
| 525 | .llvm_name = "cssc", | 525 | .llvm_name = "cssc", |
| 526 | .description = "Enable Common Short Sequence Compression (CSSC) instructions", | 526 | .description = "Enable Common Short Sequence Compression (CSSC) instructions", |
| 527 | .dependencies = featureSet(&[_]Feature{}), | 527 | .dependencies = featureSet(&[_]Feature{}), |
| 528 | }; | 528 | }; |
| 529 | result[@intFromEnum(Feature.d128)] = .{ | 529 | result[@backingInt(Feature.d128)] = .{ |
| 530 | .llvm_name = "d128", | 530 | .llvm_name = "d128", |
| 531 | .description = "Enable Armv9.4-A 128-bit Page Table Descriptors, System Registers and instructions", | 531 | .description = "Enable Armv9.4-A 128-bit Page Table Descriptors, System Registers and instructions", |
| 532 | .dependencies = featureSet(&[_]Feature{ | 532 | .dependencies = featureSet(&[_]Feature{ |
| 533 | .lse128, | 533 | .lse128, |
| 534 | }), | 534 | }), |
| 535 | }; | 535 | }; |
| 536 | result[@intFromEnum(Feature.disable_fast_inc_vl)] = .{ | 536 | result[@backingInt(Feature.disable_fast_inc_vl)] = .{ |
| 537 | .llvm_name = "disable-fast-inc-vl", | 537 | .llvm_name = "disable-fast-inc-vl", |
| 538 | .description = "Do not prefer INC/DEC, ALL, { 1, 2, 4 } over ADDVL", | 538 | .description = "Do not prefer INC/DEC, ALL, { 1, 2, 4 } over ADDVL", |
| 539 | .dependencies = featureSet(&[_]Feature{}), | 539 | .dependencies = featureSet(&[_]Feature{}), |
| 540 | }; | 540 | }; |
| 541 | result[@intFromEnum(Feature.disable_latency_sched_heuristic)] = .{ | 541 | result[@backingInt(Feature.disable_latency_sched_heuristic)] = .{ |
| 542 | .llvm_name = "disable-latency-sched-heuristic", | 542 | .llvm_name = "disable-latency-sched-heuristic", |
| 543 | .description = "Disable latency scheduling heuristic", | 543 | .description = "Disable latency scheduling heuristic", |
| 544 | .dependencies = featureSet(&[_]Feature{}), | 544 | .dependencies = featureSet(&[_]Feature{}), |
| 545 | }; | 545 | }; |
| 546 | result[@intFromEnum(Feature.disable_ldp)] = .{ | 546 | result[@backingInt(Feature.disable_ldp)] = .{ |
| 547 | .llvm_name = "disable-ldp", | 547 | .llvm_name = "disable-ldp", |
| 548 | .description = "Do not emit ldp", | 548 | .description = "Do not emit ldp", |
| 549 | .dependencies = featureSet(&[_]Feature{}), | 549 | .dependencies = featureSet(&[_]Feature{}), |
| 550 | }; | 550 | }; |
| 551 | result[@intFromEnum(Feature.disable_maximize_scalable_bandwidth)] = .{ | 551 | result[@backingInt(Feature.disable_maximize_scalable_bandwidth)] = .{ |
| 552 | .llvm_name = "disable-maximize-scalable-bandwidth", | 552 | .llvm_name = "disable-maximize-scalable-bandwidth", |
| 553 | .description = "Determine the maximum scalable vector length for a loop by the largest scalar type rather than the smallest", | 553 | .description = "Determine the maximum scalable vector length for a loop by the largest scalar type rather than the smallest", |
| 554 | .dependencies = featureSet(&[_]Feature{}), | 554 | .dependencies = featureSet(&[_]Feature{}), |
| 555 | }; | 555 | }; |
| 556 | result[@intFromEnum(Feature.disable_stp)] = .{ | 556 | result[@backingInt(Feature.disable_stp)] = .{ |
| 557 | .llvm_name = "disable-stp", | 557 | .llvm_name = "disable-stp", |
| 558 | .description = "Do not emit stp", | 558 | .description = "Do not emit stp", |
| 559 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "disable-unpredicated-ld-st-lower", | 562 | .llvm_name = "disable-unpredicated-ld-st-lower", |
| 563 | .description = "Disable lowering unpredicated loads/stores as LDR/STR", | 563 | .description = "Disable lowering unpredicated loads/stores as LDR/STR", |
| 564 | .dependencies = featureSet(&[_]Feature{}), | 564 | .dependencies = featureSet(&[_]Feature{}), |
| 565 | }; | 565 | }; |
| 566 | result[@intFromEnum(Feature.dit)] = .{ | 566 | result[@backingInt(Feature.dit)] = .{ |
| 567 | .llvm_name = "dit", | 567 | .llvm_name = "dit", |
| 568 | .description = "Enable Armv8.4-A Data Independent Timing instructions", | 568 | .description = "Enable Armv8.4-A Data Independent Timing instructions", |
| 569 | .dependencies = featureSet(&[_]Feature{}), | 569 | .dependencies = featureSet(&[_]Feature{}), |
| 570 | }; | 570 | }; |
| 571 | result[@intFromEnum(Feature.dotprod)] = .{ | 571 | result[@backingInt(Feature.dotprod)] = .{ |
| 572 | .llvm_name = "dotprod", | 572 | .llvm_name = "dotprod", |
| 573 | .description = "Enable dot product support", | 573 | .description = "Enable dot product support", |
| 574 | .dependencies = featureSet(&[_]Feature{ | 574 | .dependencies = featureSet(&[_]Feature{ |
| 575 | .neon, | 575 | .neon, |
| 576 | }), | 576 | }), |
| 577 | }; | 577 | }; |
| 578 | result[@intFromEnum(Feature.ecv)] = .{ | 578 | result[@backingInt(Feature.ecv)] = .{ |
| 579 | .llvm_name = "ecv", | 579 | .llvm_name = "ecv", |
| 580 | .description = "Enable enhanced counter virtualization extension", | 580 | .description = "Enable enhanced counter virtualization extension", |
| 581 | .dependencies = featureSet(&[_]Feature{}), | 581 | .dependencies = featureSet(&[_]Feature{}), |
| 582 | }; | 582 | }; |
| 583 | result[@intFromEnum(Feature.el2vmsa)] = .{ | 583 | result[@backingInt(Feature.el2vmsa)] = .{ |
| 584 | .llvm_name = "el2vmsa", | 584 | .llvm_name = "el2vmsa", |
| 585 | .description = "Enable Exception Level 2 Virtual Memory System Architecture", | 585 | .description = "Enable Exception Level 2 Virtual Memory System Architecture", |
| 586 | .dependencies = featureSet(&[_]Feature{}), | 586 | .dependencies = featureSet(&[_]Feature{}), |
| 587 | }; | 587 | }; |
| 588 | result[@intFromEnum(Feature.el3)] = .{ | 588 | result[@backingInt(Feature.el3)] = .{ |
| 589 | .llvm_name = "el3", | 589 | .llvm_name = "el3", |
| 590 | .description = "Enable Exception Level 3", | 590 | .description = "Enable Exception Level 3", |
| 591 | .dependencies = featureSet(&[_]Feature{}), | 591 | .dependencies = featureSet(&[_]Feature{}), |
| 592 | }; | 592 | }; |
| 593 | result[@intFromEnum(Feature.enable_select_opt)] = .{ | 593 | result[@backingInt(Feature.enable_select_opt)] = .{ |
| 594 | .llvm_name = "enable-select-opt", | 594 | .llvm_name = "enable-select-opt", |
| 595 | .description = "Enable the select optimize pass for select loop heuristics", | 595 | .description = "Enable the select optimize pass for select loop heuristics", |
| 596 | .dependencies = featureSet(&[_]Feature{}), | 596 | .dependencies = featureSet(&[_]Feature{}), |
| 597 | }; | 597 | }; |
| 598 | result[@intFromEnum(Feature.ete)] = .{ | 598 | result[@backingInt(Feature.ete)] = .{ |
| 599 | .llvm_name = "ete", | 599 | .llvm_name = "ete", |
| 600 | .description = "Enable Embedded Trace Extension", | 600 | .description = "Enable Embedded Trace Extension", |
| 601 | .dependencies = featureSet(&[_]Feature{ | 601 | .dependencies = featureSet(&[_]Feature{ |
| 602 | .trbe, | 602 | .trbe, |
| 603 | }), | 603 | }), |
| 604 | }; | 604 | }; |
| 605 | result[@intFromEnum(Feature.execute_only)] = .{ | 605 | result[@backingInt(Feature.execute_only)] = .{ |
| 606 | .llvm_name = "execute-only", | 606 | .llvm_name = "execute-only", |
| 607 | .description = "Enable the generation of execute only code.", | 607 | .description = "Enable the generation of execute only code.", |
| 608 | .dependencies = featureSet(&[_]Feature{}), | 608 | .dependencies = featureSet(&[_]Feature{}), |
| 609 | }; | 609 | }; |
| 610 | result[@intFromEnum(Feature.exynos_cheap_as_move)] = .{ | 610 | result[@backingInt(Feature.exynos_cheap_as_move)] = .{ |
| 611 | .llvm_name = "exynos-cheap-as-move", | 611 | .llvm_name = "exynos-cheap-as-move", |
| 612 | .description = "Use Exynos specific handling of cheap instructions", | 612 | .description = "Use Exynos specific handling of cheap instructions", |
| 613 | .dependencies = featureSet(&[_]Feature{}), | 613 | .dependencies = featureSet(&[_]Feature{}), |
| 614 | }; | 614 | }; |
| 615 | result[@intFromEnum(Feature.f16f32dot)] = .{ | 615 | result[@backingInt(Feature.f16f32dot)] = .{ |
| 616 | .llvm_name = "f16f32dot", | 616 | .llvm_name = "f16f32dot", |
| 617 | .description = "Enable Armv9.7-A Advanced SIMD half-precision dot product accumulate to single-precision", | 617 | .description = "Enable Armv9.7-A Advanced SIMD half-precision dot product accumulate to single-precision", |
| 618 | .dependencies = featureSet(&[_]Feature{ | 618 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -620,7 +620,7 @@ pub const all_features = blk: { | ... | @@ -620,7 +620,7 @@ pub const all_features = blk: { |
| 620 | .neon, | 620 | .neon, |
| 621 | }), | 621 | }), |
| 622 | }; | 622 | }; |
| 623 | result[@intFromEnum(Feature.f16f32mm)] = .{ | 623 | result[@backingInt(Feature.f16f32mm)] = .{ |
| 624 | .llvm_name = "f16f32mm", | 624 | .llvm_name = "f16f32mm", |
| 625 | .description = "Enable Armv9.7-A Advanced SIMD half-precision matrix multiply-accumulate to single-precision", | 625 | .description = "Enable Armv9.7-A Advanced SIMD half-precision matrix multiply-accumulate to single-precision", |
| 626 | .dependencies = featureSet(&[_]Feature{ | 626 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -628,7 +628,7 @@ pub const all_features = blk: { | ... | @@ -628,7 +628,7 @@ pub const all_features = blk: { |
| 628 | .neon, | 628 | .neon, |
| 629 | }), | 629 | }), |
| 630 | }; | 630 | }; |
| 631 | result[@intFromEnum(Feature.f16mm)] = .{ | 631 | result[@backingInt(Feature.f16mm)] = .{ |
| 632 | .llvm_name = "f16mm", | 632 | .llvm_name = "f16mm", |
| 633 | .description = "Enable Armv9.7-A non-widening half-precision matrix multiply-accumulate", | 633 | .description = "Enable Armv9.7-A non-widening half-precision matrix multiply-accumulate", |
| 634 | .dependencies = featureSet(&[_]Feature{ | 634 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -636,67 +636,67 @@ pub const all_features = blk: { | ... | @@ -636,67 +636,67 @@ pub const all_features = blk: { |
| 636 | .neon, | 636 | .neon, |
| 637 | }), | 637 | }), |
| 638 | }; | 638 | }; |
| 639 | result[@intFromEnum(Feature.f32mm)] = .{ | 639 | result[@backingInt(Feature.f32mm)] = .{ |
| 640 | .llvm_name = "f32mm", | 640 | .llvm_name = "f32mm", |
| 641 | .description = "Enable Matrix Multiply FP32 Extension", | 641 | .description = "Enable Matrix Multiply FP32 Extension", |
| 642 | .dependencies = featureSet(&[_]Feature{ | 642 | .dependencies = featureSet(&[_]Feature{ |
| 643 | .sve, | 643 | .sve, |
| 644 | }), | 644 | }), |
| 645 | }; | 645 | }; |
| 646 | result[@intFromEnum(Feature.f64mm)] = .{ | 646 | result[@backingInt(Feature.f64mm)] = .{ |
| 647 | .llvm_name = "f64mm", | 647 | .llvm_name = "f64mm", |
| 648 | .description = "Enable Matrix Multiply FP64 Extension", | 648 | .description = "Enable Matrix Multiply FP64 Extension", |
| 649 | .dependencies = featureSet(&[_]Feature{ | 649 | .dependencies = featureSet(&[_]Feature{ |
| 650 | .sve, | 650 | .sve, |
| 651 | }), | 651 | }), |
| 652 | }; | 652 | }; |
| 653 | result[@intFromEnum(Feature.f8f16mm)] = .{ | 653 | result[@backingInt(Feature.f8f16mm)] = .{ |
| 654 | .llvm_name = "f8f16mm", | 654 | .llvm_name = "f8f16mm", |
| 655 | .description = "Enable Armv9.6-A FP8 to Half-Precision Matrix Multiplication", | 655 | .description = "Enable Armv9.6-A FP8 to Half-Precision Matrix Multiplication", |
| 656 | .dependencies = featureSet(&[_]Feature{ | 656 | .dependencies = featureSet(&[_]Feature{ |
| 657 | .fp8, | 657 | .fp8, |
| 658 | }), | 658 | }), |
| 659 | }; | 659 | }; |
| 660 | result[@intFromEnum(Feature.f8f32mm)] = .{ | 660 | result[@backingInt(Feature.f8f32mm)] = .{ |
| 661 | .llvm_name = "f8f32mm", | 661 | .llvm_name = "f8f32mm", |
| 662 | .description = "Enable Armv9.6-A FP8 to Single-Precision Matrix Multiplication", | 662 | .description = "Enable Armv9.6-A FP8 to Single-Precision Matrix Multiplication", |
| 663 | .dependencies = featureSet(&[_]Feature{ | 663 | .dependencies = featureSet(&[_]Feature{ |
| 664 | .fp8, | 664 | .fp8, |
| 665 | }), | 665 | }), |
| 666 | }; | 666 | }; |
| 667 | result[@intFromEnum(Feature.faminmax)] = .{ | 667 | result[@backingInt(Feature.faminmax)] = .{ |
| 668 | .llvm_name = "faminmax", | 668 | .llvm_name = "faminmax", |
| 669 | .description = "Enable FAMIN and FAMAX instructions", | 669 | .description = "Enable FAMIN and FAMAX instructions", |
| 670 | .dependencies = featureSet(&[_]Feature{ | 670 | .dependencies = featureSet(&[_]Feature{ |
| 671 | .neon, | 671 | .neon, |
| 672 | }), | 672 | }), |
| 673 | }; | 673 | }; |
| 674 | result[@intFromEnum(Feature.fgt)] = .{ | 674 | result[@backingInt(Feature.fgt)] = .{ |
| 675 | .llvm_name = "fgt", | 675 | .llvm_name = "fgt", |
| 676 | .description = "Enable fine grained virtualization traps extension", | 676 | .description = "Enable fine grained virtualization traps extension", |
| 677 | .dependencies = featureSet(&[_]Feature{}), | 677 | .dependencies = featureSet(&[_]Feature{}), |
| 678 | }; | 678 | }; |
| 679 | result[@intFromEnum(Feature.fix_cortex_a53_835769)] = .{ | 679 | result[@backingInt(Feature.fix_cortex_a53_835769)] = .{ |
| 680 | .llvm_name = "fix-cortex-a53-835769", | 680 | .llvm_name = "fix-cortex-a53-835769", |
| 681 | .description = "Mitigate Cortex-A53 Erratum 835769", | 681 | .description = "Mitigate Cortex-A53 Erratum 835769", |
| 682 | .dependencies = featureSet(&[_]Feature{}), | 682 | .dependencies = featureSet(&[_]Feature{}), |
| 683 | }; | 683 | }; |
| 684 | result[@intFromEnum(Feature.flagm)] = .{ | 684 | result[@backingInt(Feature.flagm)] = .{ |
| 685 | .llvm_name = "flagm", | 685 | .llvm_name = "flagm", |
| 686 | .description = "Enable Armv8.4-A Flag Manipulation instructions", | 686 | .description = "Enable Armv8.4-A Flag Manipulation instructions", |
| 687 | .dependencies = featureSet(&[_]Feature{}), | 687 | .dependencies = featureSet(&[_]Feature{}), |
| 688 | }; | 688 | }; |
| 689 | result[@intFromEnum(Feature.fmv)] = .{ | 689 | result[@backingInt(Feature.fmv)] = .{ |
| 690 | .llvm_name = "fmv", | 690 | .llvm_name = "fmv", |
| 691 | .description = "Enable Function Multi Versioning support.", | 691 | .description = "Enable Function Multi Versioning support.", |
| 692 | .dependencies = featureSet(&[_]Feature{}), | 692 | .dependencies = featureSet(&[_]Feature{}), |
| 693 | }; | 693 | }; |
| 694 | result[@intFromEnum(Feature.force_32bit_jump_tables)] = .{ | 694 | result[@backingInt(Feature.force_32bit_jump_tables)] = .{ |
| 695 | .llvm_name = "force-32bit-jump-tables", | 695 | .llvm_name = "force-32bit-jump-tables", |
| 696 | .description = "Force jump table entries to be 32-bits wide except at MinSize", | 696 | .description = "Force jump table entries to be 32-bits wide except at MinSize", |
| 697 | .dependencies = featureSet(&[_]Feature{}), | 697 | .dependencies = featureSet(&[_]Feature{}), |
| 698 | }; | 698 | }; |
| 699 | result[@intFromEnum(Feature.fp16fml)] = .{ | 699 | result[@backingInt(Feature.fp16fml)] = .{ |
| 700 | .llvm_name = "fp16fml", | 700 | .llvm_name = "fp16fml", |
| 701 | .description = "Enable FP16 FML instructions", | 701 | .description = "Enable FP16 FML instructions", |
| 702 | .dependencies = featureSet(&[_]Feature{ | 702 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -704,59 +704,59 @@ pub const all_features = blk: { | ... | @@ -704,59 +704,59 @@ pub const all_features = blk: { |
| 704 | .neon, | 704 | .neon, |
| 705 | }), | 705 | }), |
| 706 | }; | 706 | }; |
| 707 | result[@intFromEnum(Feature.fp8)] = .{ | 707 | result[@backingInt(Feature.fp8)] = .{ |
| 708 | .llvm_name = "fp8", | 708 | .llvm_name = "fp8", |
| 709 | .description = "Enable FP8 instructions", | 709 | .description = "Enable FP8 instructions", |
| 710 | .dependencies = featureSet(&[_]Feature{ | 710 | .dependencies = featureSet(&[_]Feature{ |
| 711 | .neon, | 711 | .neon, |
| 712 | }), | 712 | }), |
| 713 | }; | 713 | }; |
| 714 | result[@intFromEnum(Feature.fp8dot2)] = .{ | 714 | result[@backingInt(Feature.fp8dot2)] = .{ |
| 715 | .llvm_name = "fp8dot2", | 715 | .llvm_name = "fp8dot2", |
| 716 | .description = "Enable FP8 2-way dot instructions", | 716 | .description = "Enable FP8 2-way dot instructions", |
| 717 | .dependencies = featureSet(&[_]Feature{ | 717 | .dependencies = featureSet(&[_]Feature{ |
| 718 | .fp8, | 718 | .fp8, |
| 719 | }), | 719 | }), |
| 720 | }; | 720 | }; |
| 721 | result[@intFromEnum(Feature.fp8dot4)] = .{ | 721 | result[@backingInt(Feature.fp8dot4)] = .{ |
| 722 | .llvm_name = "fp8dot4", | 722 | .llvm_name = "fp8dot4", |
| 723 | .description = "Enable FP8 4-way dot instructions", | 723 | .description = "Enable FP8 4-way dot instructions", |
| 724 | .dependencies = featureSet(&[_]Feature{ | 724 | .dependencies = featureSet(&[_]Feature{ |
| 725 | .fp8, | 725 | .fp8, |
| 726 | }), | 726 | }), |
| 727 | }; | 727 | }; |
| 728 | result[@intFromEnum(Feature.fp8fma)] = .{ | 728 | result[@backingInt(Feature.fp8fma)] = .{ |
| 729 | .llvm_name = "fp8fma", | 729 | .llvm_name = "fp8fma", |
| 730 | .description = "Enable Armv9.5-A FP8 multiply-add instructions", | 730 | .description = "Enable Armv9.5-A FP8 multiply-add instructions", |
| 731 | .dependencies = featureSet(&[_]Feature{ | 731 | .dependencies = featureSet(&[_]Feature{ |
| 732 | .fp8, | 732 | .fp8, |
| 733 | }), | 733 | }), |
| 734 | }; | 734 | }; |
| 735 | result[@intFromEnum(Feature.fp_armv8)] = .{ | 735 | result[@backingInt(Feature.fp_armv8)] = .{ |
| 736 | .llvm_name = "fp-armv8", | 736 | .llvm_name = "fp-armv8", |
| 737 | .description = "Enable Armv8.0-A Floating Point Extensions", | 737 | .description = "Enable Armv8.0-A Floating Point Extensions", |
| 738 | .dependencies = featureSet(&[_]Feature{}), | 738 | .dependencies = featureSet(&[_]Feature{}), |
| 739 | }; | 739 | }; |
| 740 | result[@intFromEnum(Feature.fpac)] = .{ | 740 | result[@backingInt(Feature.fpac)] = .{ |
| 741 | .llvm_name = "fpac", | 741 | .llvm_name = "fpac", |
| 742 | .description = "Enable Armv8.3-A Pointer Authentication Faulting enhancement", | 742 | .description = "Enable Armv8.3-A Pointer Authentication Faulting enhancement", |
| 743 | .dependencies = featureSet(&[_]Feature{}), | 743 | .dependencies = featureSet(&[_]Feature{}), |
| 744 | }; | 744 | }; |
| 745 | result[@intFromEnum(Feature.fprcvt)] = .{ | 745 | result[@backingInt(Feature.fprcvt)] = .{ |
| 746 | .llvm_name = "fprcvt", | 746 | .llvm_name = "fprcvt", |
| 747 | .description = "Enable Armv9.6-A base convert instructions for SIMD&FP scalar register operands of different input and output sizes", | 747 | .description = "Enable Armv9.6-A base convert instructions for SIMD&FP scalar register operands of different input and output sizes", |
| 748 | .dependencies = featureSet(&[_]Feature{ | 748 | .dependencies = featureSet(&[_]Feature{ |
| 749 | .fp_armv8, | 749 | .fp_armv8, |
| 750 | }), | 750 | }), |
| 751 | }; | 751 | }; |
| 752 | result[@intFromEnum(Feature.fptoint)] = .{ | 752 | result[@backingInt(Feature.fptoint)] = .{ |
| 753 | .llvm_name = "fptoint", | 753 | .llvm_name = "fptoint", |
| 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", | 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 | .dependencies = featureSet(&[_]Feature{ | 755 | .dependencies = featureSet(&[_]Feature{ |
| 756 | .fp_armv8, | 756 | .fp_armv8, |
| 757 | }), | 757 | }), |
| 758 | }; | 758 | }; |
| 759 | result[@intFromEnum(Feature.fujitsu_monaka)] = .{ | 759 | result[@backingInt(Feature.fujitsu_monaka)] = .{ |
| 760 | .llvm_name = "fujitsu-monaka", | 760 | .llvm_name = "fujitsu-monaka", |
| 761 | .description = "Fujitsu FUJITSU-MONAKA processors", | 761 | .description = "Fujitsu FUJITSU-MONAKA processors", |
| 762 | .dependencies = featureSet(&[_]Feature{ | 762 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -766,190 +766,190 @@ pub const all_features = blk: { | ... | @@ -766,190 +766,190 @@ pub const all_features = blk: { |
| 766 | .use_postra_scheduler, | 766 | .use_postra_scheduler, |
| 767 | }), | 767 | }), |
| 768 | }; | 768 | }; |
| 769 | result[@intFromEnum(Feature.fullfp16)] = .{ | 769 | result[@backingInt(Feature.fullfp16)] = .{ |
| 770 | .llvm_name = "fullfp16", | 770 | .llvm_name = "fullfp16", |
| 771 | .description = "Enable half-precision floating-point data processing", | 771 | .description = "Enable half-precision floating-point data processing", |
| 772 | .dependencies = featureSet(&[_]Feature{ | 772 | .dependencies = featureSet(&[_]Feature{ |
| 773 | .fp_armv8, | 773 | .fp_armv8, |
| 774 | }), | 774 | }), |
| 775 | }; | 775 | }; |
| 776 | result[@intFromEnum(Feature.fuse_address)] = .{ | 776 | result[@backingInt(Feature.fuse_address)] = .{ |
| 777 | .llvm_name = "fuse-address", | 777 | .llvm_name = "fuse-address", |
| 778 | .description = "CPU fuses address generation and memory operations", | 778 | .description = "CPU fuses address generation and memory operations", |
| 779 | .dependencies = featureSet(&[_]Feature{}), | 779 | .dependencies = featureSet(&[_]Feature{}), |
| 780 | }; | 780 | }; |
| 781 | result[@intFromEnum(Feature.fuse_addsub_2reg_const1)] = .{ | 781 | result[@backingInt(Feature.fuse_addsub_2reg_const1)] = .{ |
| 782 | .llvm_name = "fuse-addsub-2reg-const1", | 782 | .llvm_name = "fuse-addsub-2reg-const1", |
| 783 | .description = "CPU fuses (a + b + 1) and (a - b - 1)", | 783 | .description = "CPU fuses (a + b + 1) and (a - b - 1)", |
| 784 | .dependencies = featureSet(&[_]Feature{}), | 784 | .dependencies = featureSet(&[_]Feature{}), |
| 785 | }; | 785 | }; |
| 786 | result[@intFromEnum(Feature.fuse_adrp_add)] = .{ | 786 | result[@backingInt(Feature.fuse_adrp_add)] = .{ |
| 787 | .llvm_name = "fuse-adrp-add", | 787 | .llvm_name = "fuse-adrp-add", |
| 788 | .description = "CPU fuses adrp+add operations", | 788 | .description = "CPU fuses adrp+add operations", |
| 789 | .dependencies = featureSet(&[_]Feature{}), | 789 | .dependencies = featureSet(&[_]Feature{}), |
| 790 | }; | 790 | }; |
| 791 | result[@intFromEnum(Feature.fuse_aes)] = .{ | 791 | result[@backingInt(Feature.fuse_aes)] = .{ |
| 792 | .llvm_name = "fuse-aes", | 792 | .llvm_name = "fuse-aes", |
| 793 | .description = "CPU fuses AES crypto operations", | 793 | .description = "CPU fuses AES crypto operations", |
| 794 | .dependencies = featureSet(&[_]Feature{}), | 794 | .dependencies = featureSet(&[_]Feature{}), |
| 795 | }; | 795 | }; |
| 796 | result[@intFromEnum(Feature.fuse_arith_logic)] = .{ | 796 | result[@backingInt(Feature.fuse_arith_logic)] = .{ |
| 797 | .llvm_name = "fuse-arith-logic", | 797 | .llvm_name = "fuse-arith-logic", |
| 798 | .description = "CPU fuses arithmetic and logic operations", | 798 | .description = "CPU fuses arithmetic and logic operations", |
| 799 | .dependencies = featureSet(&[_]Feature{}), | 799 | .dependencies = featureSet(&[_]Feature{}), |
| 800 | }; | 800 | }; |
| 801 | result[@intFromEnum(Feature.fuse_crypto_eor)] = .{ | 801 | result[@backingInt(Feature.fuse_crypto_eor)] = .{ |
| 802 | .llvm_name = "fuse-crypto-eor", | 802 | .llvm_name = "fuse-crypto-eor", |
| 803 | .description = "CPU fuses AES/PMULL and EOR operations", | 803 | .description = "CPU fuses AES/PMULL and EOR operations", |
| 804 | .dependencies = featureSet(&[_]Feature{}), | 804 | .dependencies = featureSet(&[_]Feature{}), |
| 805 | }; | 805 | }; |
| 806 | result[@intFromEnum(Feature.fuse_csel)] = .{ | 806 | result[@backingInt(Feature.fuse_csel)] = .{ |
| 807 | .llvm_name = "fuse-csel", | 807 | .llvm_name = "fuse-csel", |
| 808 | .description = "CPU can fuse CMP and CSEL operations", | 808 | .description = "CPU can fuse CMP and CSEL operations", |
| 809 | .dependencies = featureSet(&[_]Feature{}), | 809 | .dependencies = featureSet(&[_]Feature{}), |
| 810 | }; | 810 | }; |
| 811 | result[@intFromEnum(Feature.fuse_cset)] = .{ | 811 | result[@backingInt(Feature.fuse_cset)] = .{ |
| 812 | .llvm_name = "fuse-cset", | 812 | .llvm_name = "fuse-cset", |
| 813 | .description = "CPU can fuse CMP and CSET operations", | 813 | .description = "CPU can fuse CMP and CSET operations", |
| 814 | .dependencies = featureSet(&[_]Feature{}), | 814 | .dependencies = featureSet(&[_]Feature{}), |
| 815 | }; | 815 | }; |
| 816 | result[@intFromEnum(Feature.fuse_literals)] = .{ | 816 | result[@backingInt(Feature.fuse_literals)] = .{ |
| 817 | .llvm_name = "fuse-literals", | 817 | .llvm_name = "fuse-literals", |
| 818 | .description = "CPU fuses literal generation operations", | 818 | .description = "CPU fuses literal generation operations", |
| 819 | .dependencies = featureSet(&[_]Feature{}), | 819 | .dependencies = featureSet(&[_]Feature{}), |
| 820 | }; | 820 | }; |
| 821 | result[@intFromEnum(Feature.gcie)] = .{ | 821 | result[@backingInt(Feature.gcie)] = .{ |
| 822 | .llvm_name = "gcie", | 822 | .llvm_name = "gcie", |
| 823 | .description = "Enable GICv5 (Generic Interrupt Controller) CPU Interface Extension", | 823 | .description = "Enable GICv5 (Generic Interrupt Controller) CPU Interface Extension", |
| 824 | .dependencies = featureSet(&[_]Feature{}), | 824 | .dependencies = featureSet(&[_]Feature{}), |
| 825 | }; | 825 | }; |
| 826 | result[@intFromEnum(Feature.gcs)] = .{ | 826 | result[@backingInt(Feature.gcs)] = .{ |
| 827 | .llvm_name = "gcs", | 827 | .llvm_name = "gcs", |
| 828 | .description = "Enable Armv9.4-A Guarded Call Stack Extension", | 828 | .description = "Enable Armv9.4-A Guarded Call Stack Extension", |
| 829 | .dependencies = featureSet(&[_]Feature{ | 829 | .dependencies = featureSet(&[_]Feature{ |
| 830 | .chk, | 830 | .chk, |
| 831 | }), | 831 | }), |
| 832 | }; | 832 | }; |
| 833 | result[@intFromEnum(Feature.harden_sls_blr)] = .{ | 833 | result[@backingInt(Feature.harden_sls_blr)] = .{ |
| 834 | .llvm_name = "harden-sls-blr", | 834 | .llvm_name = "harden-sls-blr", |
| 835 | .description = "Harden against straight line speculation across BLR instructions", | 835 | .description = "Harden against straight line speculation across BLR instructions", |
| 836 | .dependencies = featureSet(&[_]Feature{}), | 836 | .dependencies = featureSet(&[_]Feature{}), |
| 837 | }; | 837 | }; |
| 838 | result[@intFromEnum(Feature.harden_sls_nocomdat)] = .{ | 838 | result[@backingInt(Feature.harden_sls_nocomdat)] = .{ |
| 839 | .llvm_name = "harden-sls-nocomdat", | 839 | .llvm_name = "harden-sls-nocomdat", |
| 840 | .description = "Generate thunk code for SLS mitigation in the normal text section", | 840 | .description = "Generate thunk code for SLS mitigation in the normal text section", |
| 841 | .dependencies = featureSet(&[_]Feature{}), | 841 | .dependencies = featureSet(&[_]Feature{}), |
| 842 | }; | 842 | }; |
| 843 | result[@intFromEnum(Feature.harden_sls_retbr)] = .{ | 843 | result[@backingInt(Feature.harden_sls_retbr)] = .{ |
| 844 | .llvm_name = "harden-sls-retbr", | 844 | .llvm_name = "harden-sls-retbr", |
| 845 | .description = "Harden against straight line speculation across RET and BR instructions", | 845 | .description = "Harden against straight line speculation across RET and BR instructions", |
| 846 | .dependencies = featureSet(&[_]Feature{}), | 846 | .dependencies = featureSet(&[_]Feature{}), |
| 847 | }; | 847 | }; |
| 848 | result[@intFromEnum(Feature.hbc)] = .{ | 848 | result[@backingInt(Feature.hbc)] = .{ |
| 849 | .llvm_name = "hbc", | 849 | .llvm_name = "hbc", |
| 850 | .description = "Enable Armv8.8-A Hinted Conditional Branches Extension", | 850 | .description = "Enable Armv8.8-A Hinted Conditional Branches Extension", |
| 851 | .dependencies = featureSet(&[_]Feature{}), | 851 | .dependencies = featureSet(&[_]Feature{}), |
| 852 | }; | 852 | }; |
| 853 | result[@intFromEnum(Feature.hcx)] = .{ | 853 | result[@backingInt(Feature.hcx)] = .{ |
| 854 | .llvm_name = "hcx", | 854 | .llvm_name = "hcx", |
| 855 | .description = "Enable Armv8.7-A HCRX_EL2 system register", | 855 | .description = "Enable Armv8.7-A HCRX_EL2 system register", |
| 856 | .dependencies = featureSet(&[_]Feature{}), | 856 | .dependencies = featureSet(&[_]Feature{}), |
| 857 | }; | 857 | }; |
| 858 | result[@intFromEnum(Feature.i8mm)] = .{ | 858 | result[@backingInt(Feature.i8mm)] = .{ |
| 859 | .llvm_name = "i8mm", | 859 | .llvm_name = "i8mm", |
| 860 | .description = "Enable Matrix Multiply Int8 Extension", | 860 | .description = "Enable Matrix Multiply Int8 Extension", |
| 861 | .dependencies = featureSet(&[_]Feature{ | 861 | .dependencies = featureSet(&[_]Feature{ |
| 862 | .neon, | 862 | .neon, |
| 863 | }), | 863 | }), |
| 864 | }; | 864 | }; |
| 865 | result[@intFromEnum(Feature.ite)] = .{ | 865 | result[@backingInt(Feature.ite)] = .{ |
| 866 | .llvm_name = "ite", | 866 | .llvm_name = "ite", |
| 867 | .description = "Enable Armv9.4-A Instrumentation Extension", | 867 | .description = "Enable Armv9.4-A Instrumentation Extension", |
| 868 | .dependencies = featureSet(&[_]Feature{ | 868 | .dependencies = featureSet(&[_]Feature{ |
| 869 | .ete, | 869 | .ete, |
| 870 | }), | 870 | }), |
| 871 | }; | 871 | }; |
| 872 | result[@intFromEnum(Feature.jsconv)] = .{ | 872 | result[@backingInt(Feature.jsconv)] = .{ |
| 873 | .llvm_name = "jsconv", | 873 | .llvm_name = "jsconv", |
| 874 | .description = "Enable Armv8.3-A JavaScript FP conversion instructions", | 874 | .description = "Enable Armv8.3-A JavaScript FP conversion instructions", |
| 875 | .dependencies = featureSet(&[_]Feature{ | 875 | .dependencies = featureSet(&[_]Feature{ |
| 876 | .fp_armv8, | 876 | .fp_armv8, |
| 877 | }), | 877 | }), |
| 878 | }; | 878 | }; |
| 879 | result[@intFromEnum(Feature.ldp_aligned_only)] = .{ | 879 | result[@backingInt(Feature.ldp_aligned_only)] = .{ |
| 880 | .llvm_name = "ldp-aligned-only", | 880 | .llvm_name = "ldp-aligned-only", |
| 881 | .description = "In order to emit ldp, first check if the load will be aligned to 2 * element_size", | 881 | .description = "In order to emit ldp, first check if the load will be aligned to 2 * element_size", |
| 882 | .dependencies = featureSet(&[_]Feature{}), | 882 | .dependencies = featureSet(&[_]Feature{}), |
| 883 | }; | 883 | }; |
| 884 | result[@intFromEnum(Feature.lor)] = .{ | 884 | result[@backingInt(Feature.lor)] = .{ |
| 885 | .llvm_name = "lor", | 885 | .llvm_name = "lor", |
| 886 | .description = "Enable Armv8.1-A Limited Ordering Regions extension", | 886 | .description = "Enable Armv8.1-A Limited Ordering Regions extension", |
| 887 | .dependencies = featureSet(&[_]Feature{}), | 887 | .dependencies = featureSet(&[_]Feature{}), |
| 888 | }; | 888 | }; |
| 889 | result[@intFromEnum(Feature.ls64)] = .{ | 889 | result[@backingInt(Feature.ls64)] = .{ |
| 890 | .llvm_name = "ls64", | 890 | .llvm_name = "ls64", |
| 891 | .description = "Enable Armv8.7-A LD64B/ST64B Accelerator Extension", | 891 | .description = "Enable Armv8.7-A LD64B/ST64B Accelerator Extension", |
| 892 | .dependencies = featureSet(&[_]Feature{}), | 892 | .dependencies = featureSet(&[_]Feature{}), |
| 893 | }; | 893 | }; |
| 894 | result[@intFromEnum(Feature.lscp)] = .{ | 894 | result[@backingInt(Feature.lscp)] = .{ |
| 895 | .llvm_name = "lscp", | 895 | .llvm_name = "lscp", |
| 896 | .description = "Enable Armv9.7-A Load-acquire and store-release pair extension", | 896 | .description = "Enable Armv9.7-A Load-acquire and store-release pair extension", |
| 897 | .dependencies = featureSet(&[_]Feature{}), | 897 | .dependencies = featureSet(&[_]Feature{}), |
| 898 | }; | 898 | }; |
| 899 | result[@intFromEnum(Feature.lse)] = .{ | 899 | result[@backingInt(Feature.lse)] = .{ |
| 900 | .llvm_name = "lse", | 900 | .llvm_name = "lse", |
| 901 | .description = "Enable Armv8.1-A Large System Extension (LSE) atomic instructions", | 901 | .description = "Enable Armv8.1-A Large System Extension (LSE) atomic instructions", |
| 902 | .dependencies = featureSet(&[_]Feature{}), | 902 | .dependencies = featureSet(&[_]Feature{}), |
| 903 | }; | 903 | }; |
| 904 | result[@intFromEnum(Feature.lse128)] = .{ | 904 | result[@backingInt(Feature.lse128)] = .{ |
| 905 | .llvm_name = "lse128", | 905 | .llvm_name = "lse128", |
| 906 | .description = "Enable Armv9.4-A 128-bit Atomic instructions", | 906 | .description = "Enable Armv9.4-A 128-bit Atomic instructions", |
| 907 | .dependencies = featureSet(&[_]Feature{ | 907 | .dependencies = featureSet(&[_]Feature{ |
| 908 | .lse, | 908 | .lse, |
| 909 | }), | 909 | }), |
| 910 | }; | 910 | }; |
| 911 | result[@intFromEnum(Feature.lse2)] = .{ | 911 | result[@backingInt(Feature.lse2)] = .{ |
| 912 | .llvm_name = "lse2", | 912 | .llvm_name = "lse2", |
| 913 | .description = "Enable Armv8.4-A Large System Extension 2 (LSE2) atomicity rules", | 913 | .description = "Enable Armv8.4-A Large System Extension 2 (LSE2) atomicity rules", |
| 914 | .dependencies = featureSet(&[_]Feature{}), | 914 | .dependencies = featureSet(&[_]Feature{}), |
| 915 | }; | 915 | }; |
| 916 | result[@intFromEnum(Feature.lsfe)] = .{ | 916 | result[@backingInt(Feature.lsfe)] = .{ |
| 917 | .llvm_name = "lsfe", | 917 | .llvm_name = "lsfe", |
| 918 | .description = "Enable Armv9.6-A base Atomic floating-point in-memory instructions", | 918 | .description = "Enable Armv9.6-A base Atomic floating-point in-memory instructions", |
| 919 | .dependencies = featureSet(&[_]Feature{ | 919 | .dependencies = featureSet(&[_]Feature{ |
| 920 | .fp_armv8, | 920 | .fp_armv8, |
| 921 | }), | 921 | }), |
| 922 | }; | 922 | }; |
| 923 | result[@intFromEnum(Feature.lsui)] = .{ | 923 | result[@backingInt(Feature.lsui)] = .{ |
| 924 | .llvm_name = "lsui", | 924 | .llvm_name = "lsui", |
| 925 | .description = "Enable Armv9.6-A unprivileged load/store instructions", | 925 | .description = "Enable Armv9.6-A unprivileged load/store instructions", |
| 926 | .dependencies = featureSet(&[_]Feature{}), | 926 | .dependencies = featureSet(&[_]Feature{}), |
| 927 | }; | 927 | }; |
| 928 | result[@intFromEnum(Feature.lut)] = .{ | 928 | result[@backingInt(Feature.lut)] = .{ |
| 929 | .llvm_name = "lut", | 929 | .llvm_name = "lut", |
| 930 | .description = "Enable Lookup Table instructions", | 930 | .description = "Enable Lookup Table instructions", |
| 931 | .dependencies = featureSet(&[_]Feature{ | 931 | .dependencies = featureSet(&[_]Feature{ |
| 932 | .neon, | 932 | .neon, |
| 933 | }), | 933 | }), |
| 934 | }; | 934 | }; |
| 935 | result[@intFromEnum(Feature.max_interleave_factor_4)] = .{ | 935 | result[@backingInt(Feature.max_interleave_factor_4)] = .{ |
| 936 | .llvm_name = "max-interleave-factor-4", | 936 | .llvm_name = "max-interleave-factor-4", |
| 937 | .description = "Set the MaxInterleaveFactor to 4 (from the default 2)", | 937 | .description = "Set the MaxInterleaveFactor to 4 (from the default 2)", |
| 938 | .dependencies = featureSet(&[_]Feature{}), | 938 | .dependencies = featureSet(&[_]Feature{}), |
| 939 | }; | 939 | }; |
| 940 | result[@intFromEnum(Feature.mec)] = .{ | 940 | result[@backingInt(Feature.mec)] = .{ |
| 941 | .llvm_name = "mec", | 941 | .llvm_name = "mec", |
| 942 | .description = "Enable Memory Encryption Contexts Extension", | 942 | .description = "Enable Memory Encryption Contexts Extension", |
| 943 | .dependencies = featureSet(&[_]Feature{ | 943 | .dependencies = featureSet(&[_]Feature{ |
| 944 | .rme, | 944 | .rme, |
| 945 | }), | 945 | }), |
| 946 | }; | 946 | }; |
| 947 | result[@intFromEnum(Feature.mops)] = .{ | 947 | result[@backingInt(Feature.mops)] = .{ |
| 948 | .llvm_name = "mops", | 948 | .llvm_name = "mops", |
| 949 | .description = "Enable Armv8.8-A memcpy and memset acceleration instructions", | 949 | .description = "Enable Armv8.8-A memcpy and memset acceleration instructions", |
| 950 | .dependencies = featureSet(&[_]Feature{}), | 950 | .dependencies = featureSet(&[_]Feature{}), |
| 951 | }; | 951 | }; |
| 952 | result[@intFromEnum(Feature.mops_go)] = .{ | 952 | result[@backingInt(Feature.mops_go)] = .{ |
| 953 | .llvm_name = "mops-go", | 953 | .llvm_name = "mops-go", |
| 954 | .description = "Enable memset acceleration granule only", | 954 | .description = "Enable memset acceleration granule only", |
| 955 | .dependencies = featureSet(&[_]Feature{ | 955 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -957,71 +957,71 @@ pub const all_features = blk: { | ... | @@ -957,71 +957,71 @@ pub const all_features = blk: { |
| 957 | .mte, | 957 | .mte, |
| 958 | }), | 958 | }), |
| 959 | }; | 959 | }; |
| 960 | result[@intFromEnum(Feature.mpam)] = .{ | 960 | result[@backingInt(Feature.mpam)] = .{ |
| 961 | .llvm_name = "mpam", | 961 | .llvm_name = "mpam", |
| 962 | .description = "Enable Armv8.4-A Memory system Partitioning and Monitoring extension", | 962 | .description = "Enable Armv8.4-A Memory system Partitioning and Monitoring extension", |
| 963 | .dependencies = featureSet(&[_]Feature{}), | 963 | .dependencies = featureSet(&[_]Feature{}), |
| 964 | }; | 964 | }; |
| 965 | result[@intFromEnum(Feature.mpamv2)] = .{ | 965 | result[@backingInt(Feature.mpamv2)] = .{ |
| 966 | .llvm_name = "mpamv2", | 966 | .llvm_name = "mpamv2", |
| 967 | .description = "Enable Armv9.7-A MPAMv2 Lookaside Buffer Invalidate instructions", | 967 | .description = "Enable Armv9.7-A MPAMv2 Lookaside Buffer Invalidate instructions", |
| 968 | .dependencies = featureSet(&[_]Feature{}), | 968 | .dependencies = featureSet(&[_]Feature{}), |
| 969 | }; | 969 | }; |
| 970 | result[@intFromEnum(Feature.mte)] = .{ | 970 | result[@backingInt(Feature.mte)] = .{ |
| 971 | .llvm_name = "mte", | 971 | .llvm_name = "mte", |
| 972 | .description = "Enable Memory Tagging Extension", | 972 | .description = "Enable Memory Tagging Extension", |
| 973 | .dependencies = featureSet(&[_]Feature{}), | 973 | .dependencies = featureSet(&[_]Feature{}), |
| 974 | }; | 974 | }; |
| 975 | result[@intFromEnum(Feature.mtetc)] = .{ | 975 | result[@backingInt(Feature.mtetc)] = .{ |
| 976 | .llvm_name = "mtetc", | 976 | .llvm_name = "mtetc", |
| 977 | .description = "Enable Virtual Memory Tagging Extension", | 977 | .description = "Enable Virtual Memory Tagging Extension", |
| 978 | .dependencies = featureSet(&[_]Feature{ | 978 | .dependencies = featureSet(&[_]Feature{ |
| 979 | .mte, | 979 | .mte, |
| 980 | }), | 980 | }), |
| 981 | }; | 981 | }; |
| 982 | result[@intFromEnum(Feature.neon)] = .{ | 982 | result[@backingInt(Feature.neon)] = .{ |
| 983 | .llvm_name = "neon", | 983 | .llvm_name = "neon", |
| 984 | .description = "Enable Advanced SIMD instructions", | 984 | .description = "Enable Advanced SIMD instructions", |
| 985 | .dependencies = featureSet(&[_]Feature{ | 985 | .dependencies = featureSet(&[_]Feature{ |
| 986 | .fp_armv8, | 986 | .fp_armv8, |
| 987 | }), | 987 | }), |
| 988 | }; | 988 | }; |
| 989 | result[@intFromEnum(Feature.nmi)] = .{ | 989 | result[@backingInt(Feature.nmi)] = .{ |
| 990 | .llvm_name = "nmi", | 990 | .llvm_name = "nmi", |
| 991 | .description = "Enable Armv8.8-A Non-maskable Interrupts", | 991 | .description = "Enable Armv8.8-A Non-maskable Interrupts", |
| 992 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "no-bti-at-return-twice", | 995 | .llvm_name = "no-bti-at-return-twice", |
| 996 | .description = "Don't place a BTI instruction after a return-twice", | 996 | .description = "Don't place a BTI instruction after a return-twice", |
| 997 | .dependencies = featureSet(&[_]Feature{}), | 997 | .dependencies = featureSet(&[_]Feature{}), |
| 998 | }; | 998 | }; |
| 999 | result[@intFromEnum(Feature.no_neg_immediates)] = .{ | 999 | result[@backingInt(Feature.no_neg_immediates)] = .{ |
| 1000 | .llvm_name = "no-neg-immediates", | 1000 | .llvm_name = "no-neg-immediates", |
| 1001 | .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.", | 1001 | .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.", |
| 1002 | .dependencies = featureSet(&[_]Feature{}), | 1002 | .dependencies = featureSet(&[_]Feature{}), |
| 1003 | }; | 1003 | }; |
| 1004 | result[@intFromEnum(Feature.no_sve_fp_ld1r)] = .{ | 1004 | result[@backingInt(Feature.no_sve_fp_ld1r)] = .{ |
| 1005 | .llvm_name = "no-sve-fp-ld1r", | 1005 | .llvm_name = "no-sve-fp-ld1r", |
| 1006 | .description = "Avoid using LD1RX instructions for FP", | 1006 | .description = "Avoid using LD1RX instructions for FP", |
| 1007 | .dependencies = featureSet(&[_]Feature{}), | 1007 | .dependencies = featureSet(&[_]Feature{}), |
| 1008 | }; | 1008 | }; |
| 1009 | result[@intFromEnum(Feature.no_zcz_fpr64)] = .{ | 1009 | result[@backingInt(Feature.no_zcz_fpr64)] = .{ |
| 1010 | .llvm_name = "no-zcz-fpr64", | 1010 | .llvm_name = "no-zcz-fpr64", |
| 1011 | .description = "Has no zero-cycle zeroing instructions for FPR64 registers", | 1011 | .description = "Has no zero-cycle zeroing instructions for FPR64 registers", |
| 1012 | .dependencies = featureSet(&[_]Feature{}), | 1012 | .dependencies = featureSet(&[_]Feature{}), |
| 1013 | }; | 1013 | }; |
| 1014 | result[@intFromEnum(Feature.nv)] = .{ | 1014 | result[@backingInt(Feature.nv)] = .{ |
| 1015 | .llvm_name = "nv", | 1015 | .llvm_name = "nv", |
| 1016 | .description = "Enable Armv8.4-A Nested Virtualization Enchancement", | 1016 | .description = "Enable Armv8.4-A Nested Virtualization Enchancement", |
| 1017 | .dependencies = featureSet(&[_]Feature{}), | 1017 | .dependencies = featureSet(&[_]Feature{}), |
| 1018 | }; | 1018 | }; |
| 1019 | result[@intFromEnum(Feature.occmo)] = .{ | 1019 | result[@backingInt(Feature.occmo)] = .{ |
| 1020 | .llvm_name = "occmo", | 1020 | .llvm_name = "occmo", |
| 1021 | .description = "Enable Armv9.6-A Outer cacheable cache maintenance operations", | 1021 | .description = "Enable Armv9.6-A Outer cacheable cache maintenance operations", |
| 1022 | .dependencies = featureSet(&[_]Feature{}), | 1022 | .dependencies = featureSet(&[_]Feature{}), |
| 1023 | }; | 1023 | }; |
| 1024 | result[@intFromEnum(Feature.olympus)] = .{ | 1024 | result[@backingInt(Feature.olympus)] = .{ |
| 1025 | .llvm_name = "olympus", | 1025 | .llvm_name = "olympus", |
| 1026 | .description = "NVIDIA Olympus processors", | 1026 | .description = "NVIDIA Olympus processors", |
| 1027 | .dependencies = featureSet(&[_]Feature{ | 1027 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1036,288 +1036,288 @@ pub const all_features = blk: { | ... | @@ -1036,288 +1036,288 @@ pub const all_features = blk: { |
| 1036 | .use_postra_scheduler, | 1036 | .use_postra_scheduler, |
| 1037 | }), | 1037 | }), |
| 1038 | }; | 1038 | }; |
| 1039 | result[@intFromEnum(Feature.outline_atomics)] = .{ | 1039 | result[@backingInt(Feature.outline_atomics)] = .{ |
| 1040 | .llvm_name = "outline-atomics", | 1040 | .llvm_name = "outline-atomics", |
| 1041 | .description = "Enable out of line atomics to support LSE instructions", | 1041 | .description = "Enable out of line atomics to support LSE instructions", |
| 1042 | .dependencies = featureSet(&[_]Feature{}), | 1042 | .dependencies = featureSet(&[_]Feature{}), |
| 1043 | }; | 1043 | }; |
| 1044 | result[@intFromEnum(Feature.pan)] = .{ | 1044 | result[@backingInt(Feature.pan)] = .{ |
| 1045 | .llvm_name = "pan", | 1045 | .llvm_name = "pan", |
| 1046 | .description = "Enable Armv8.1-A Privileged Access-Never extension", | 1046 | .description = "Enable Armv8.1-A Privileged Access-Never extension", |
| 1047 | .dependencies = featureSet(&[_]Feature{}), | 1047 | .dependencies = featureSet(&[_]Feature{}), |
| 1048 | }; | 1048 | }; |
| 1049 | result[@intFromEnum(Feature.pan_rwv)] = .{ | 1049 | result[@backingInt(Feature.pan_rwv)] = .{ |
| 1050 | .llvm_name = "pan-rwv", | 1050 | .llvm_name = "pan-rwv", |
| 1051 | .description = "Enable Armv8.2-A PAN s1e1R and s1e1W Variants", | 1051 | .description = "Enable Armv8.2-A PAN s1e1R and s1e1W Variants", |
| 1052 | .dependencies = featureSet(&[_]Feature{ | 1052 | .dependencies = featureSet(&[_]Feature{ |
| 1053 | .pan, | 1053 | .pan, |
| 1054 | }), | 1054 | }), |
| 1055 | }; | 1055 | }; |
| 1056 | result[@intFromEnum(Feature.pauth)] = .{ | 1056 | result[@backingInt(Feature.pauth)] = .{ |
| 1057 | .llvm_name = "pauth", | 1057 | .llvm_name = "pauth", |
| 1058 | .description = "Enable Armv8.3-A Pointer Authentication extension", | 1058 | .description = "Enable Armv8.3-A Pointer Authentication extension", |
| 1059 | .dependencies = featureSet(&[_]Feature{}), | 1059 | .dependencies = featureSet(&[_]Feature{}), |
| 1060 | }; | 1060 | }; |
| 1061 | result[@intFromEnum(Feature.pauth_lr)] = .{ | 1061 | result[@backingInt(Feature.pauth_lr)] = .{ |
| 1062 | .llvm_name = "pauth-lr", | 1062 | .llvm_name = "pauth-lr", |
| 1063 | .description = "Enable Armv9.5-A PAC enhancements", | 1063 | .description = "Enable Armv9.5-A PAC enhancements", |
| 1064 | .dependencies = featureSet(&[_]Feature{}), | 1064 | .dependencies = featureSet(&[_]Feature{}), |
| 1065 | }; | 1065 | }; |
| 1066 | result[@intFromEnum(Feature.pcdphint)] = .{ | 1066 | result[@backingInt(Feature.pcdphint)] = .{ |
| 1067 | .llvm_name = "pcdphint", | 1067 | .llvm_name = "pcdphint", |
| 1068 | .description = "Enable Armv9.6-A Producer Consumer Data Placement hints", | 1068 | .description = "Enable Armv9.6-A Producer Consumer Data Placement hints", |
| 1069 | .dependencies = featureSet(&[_]Feature{}), | 1069 | .dependencies = featureSet(&[_]Feature{}), |
| 1070 | }; | 1070 | }; |
| 1071 | result[@intFromEnum(Feature.perfmon)] = .{ | 1071 | result[@backingInt(Feature.perfmon)] = .{ |
| 1072 | .llvm_name = "perfmon", | 1072 | .llvm_name = "perfmon", |
| 1073 | .description = "Enable Armv8.0-A PMUv3 Performance Monitors extension", | 1073 | .description = "Enable Armv8.0-A PMUv3 Performance Monitors extension", |
| 1074 | .dependencies = featureSet(&[_]Feature{}), | 1074 | .dependencies = featureSet(&[_]Feature{}), |
| 1075 | }; | 1075 | }; |
| 1076 | result[@intFromEnum(Feature.poe2)] = .{ | 1076 | result[@backingInt(Feature.poe2)] = .{ |
| 1077 | .llvm_name = "poe2", | 1077 | .llvm_name = "poe2", |
| 1078 | .description = "Enable Stage 1 Permission Overlays Extension 2 instructions", | 1078 | .description = "Enable Stage 1 Permission Overlays Extension 2 instructions", |
| 1079 | .dependencies = featureSet(&[_]Feature{}), | 1079 | .dependencies = featureSet(&[_]Feature{}), |
| 1080 | }; | 1080 | }; |
| 1081 | result[@intFromEnum(Feature.pops)] = .{ | 1081 | result[@backingInt(Feature.pops)] = .{ |
| 1082 | .llvm_name = "pops", | 1082 | .llvm_name = "pops", |
| 1083 | .description = "Enable Armv9.6-A Point Of Physical Storage (PoPS) DC instructions", | 1083 | .description = "Enable Armv9.6-A Point Of Physical Storage (PoPS) DC instructions", |
| 1084 | .dependencies = featureSet(&[_]Feature{}), | 1084 | .dependencies = featureSet(&[_]Feature{}), |
| 1085 | }; | 1085 | }; |
| 1086 | result[@intFromEnum(Feature.predictable_select_expensive)] = .{ | 1086 | result[@backingInt(Feature.predictable_select_expensive)] = .{ |
| 1087 | .llvm_name = "predictable-select-expensive", | 1087 | .llvm_name = "predictable-select-expensive", |
| 1088 | .description = "Prefer likely predicted branches over selects", | 1088 | .description = "Prefer likely predicted branches over selects", |
| 1089 | .dependencies = featureSet(&[_]Feature{}), | 1089 | .dependencies = featureSet(&[_]Feature{}), |
| 1090 | }; | 1090 | }; |
| 1091 | result[@intFromEnum(Feature.predres)] = .{ | 1091 | result[@backingInt(Feature.predres)] = .{ |
| 1092 | .llvm_name = "predres", | 1092 | .llvm_name = "predres", |
| 1093 | .description = "Enable Armv8.5-A execution and data prediction invalidation instructions", | 1093 | .description = "Enable Armv8.5-A execution and data prediction invalidation instructions", |
| 1094 | .dependencies = featureSet(&[_]Feature{}), | 1094 | .dependencies = featureSet(&[_]Feature{}), |
| 1095 | }; | 1095 | }; |
| 1096 | result[@intFromEnum(Feature.prfm_slc_target)] = .{ | 1096 | result[@backingInt(Feature.prfm_slc_target)] = .{ |
| 1097 | .llvm_name = "prfm-slc-target", | 1097 | .llvm_name = "prfm-slc-target", |
| 1098 | .description = "Enable SLC target for PRFM instruction", | 1098 | .description = "Enable SLC target for PRFM instruction", |
| 1099 | .dependencies = featureSet(&[_]Feature{}), | 1099 | .dependencies = featureSet(&[_]Feature{}), |
| 1100 | }; | 1100 | }; |
| 1101 | result[@intFromEnum(Feature.rand)] = .{ | 1101 | result[@backingInt(Feature.rand)] = .{ |
| 1102 | .llvm_name = "rand", | 1102 | .llvm_name = "rand", |
| 1103 | .description = "Enable Random Number generation instructions", | 1103 | .description = "Enable Random Number generation instructions", |
| 1104 | .dependencies = featureSet(&[_]Feature{}), | 1104 | .dependencies = featureSet(&[_]Feature{}), |
| 1105 | }; | 1105 | }; |
| 1106 | result[@intFromEnum(Feature.ras)] = .{ | 1106 | result[@backingInt(Feature.ras)] = .{ |
| 1107 | .llvm_name = "ras", | 1107 | .llvm_name = "ras", |
| 1108 | .description = "Enable Armv8.0-A Reliability, Availability and Serviceability Extensions", | 1108 | .description = "Enable Armv8.0-A Reliability, Availability and Serviceability Extensions", |
| 1109 | .dependencies = featureSet(&[_]Feature{}), | 1109 | .dependencies = featureSet(&[_]Feature{}), |
| 1110 | }; | 1110 | }; |
| 1111 | result[@intFromEnum(Feature.rasv2)] = .{ | 1111 | result[@backingInt(Feature.rasv2)] = .{ |
| 1112 | .llvm_name = "rasv2", | 1112 | .llvm_name = "rasv2", |
| 1113 | .description = "Enable Armv8.9-A Reliability, Availability and Serviceability Extensions", | 1113 | .description = "Enable Armv8.9-A Reliability, Availability and Serviceability Extensions", |
| 1114 | .dependencies = featureSet(&[_]Feature{ | 1114 | .dependencies = featureSet(&[_]Feature{ |
| 1115 | .ras, | 1115 | .ras, |
| 1116 | }), | 1116 | }), |
| 1117 | }; | 1117 | }; |
| 1118 | result[@intFromEnum(Feature.rcpc)] = .{ | 1118 | result[@backingInt(Feature.rcpc)] = .{ |
| 1119 | .llvm_name = "rcpc", | 1119 | .llvm_name = "rcpc", |
| 1120 | .description = "Enable support for RCPC extension", | 1120 | .description = "Enable support for RCPC extension", |
| 1121 | .dependencies = featureSet(&[_]Feature{}), | 1121 | .dependencies = featureSet(&[_]Feature{}), |
| 1122 | }; | 1122 | }; |
| 1123 | result[@intFromEnum(Feature.rcpc3)] = .{ | 1123 | result[@backingInt(Feature.rcpc3)] = .{ |
| 1124 | .llvm_name = "rcpc3", | 1124 | .llvm_name = "rcpc3", |
| 1125 | .description = "Enable Armv8.9-A RCPC instructions for A64 and Advanced SIMD and floating-point instruction set", | 1125 | .description = "Enable Armv8.9-A RCPC instructions for A64 and Advanced SIMD and floating-point instruction set", |
| 1126 | .dependencies = featureSet(&[_]Feature{ | 1126 | .dependencies = featureSet(&[_]Feature{ |
| 1127 | .rcpc_immo, | 1127 | .rcpc_immo, |
| 1128 | }), | 1128 | }), |
| 1129 | }; | 1129 | }; |
| 1130 | result[@intFromEnum(Feature.rcpc_immo)] = .{ | 1130 | result[@backingInt(Feature.rcpc_immo)] = .{ |
| 1131 | .llvm_name = "rcpc-immo", | 1131 | .llvm_name = "rcpc-immo", |
| 1132 | .description = "Enable Armv8.4-A RCPC instructions with Immediate Offsets", | 1132 | .description = "Enable Armv8.4-A RCPC instructions with Immediate Offsets", |
| 1133 | .dependencies = featureSet(&[_]Feature{ | 1133 | .dependencies = featureSet(&[_]Feature{ |
| 1134 | .rcpc, | 1134 | .rcpc, |
| 1135 | }), | 1135 | }), |
| 1136 | }; | 1136 | }; |
| 1137 | result[@intFromEnum(Feature.rdm)] = .{ | 1137 | result[@backingInt(Feature.rdm)] = .{ |
| 1138 | .llvm_name = "rdm", | 1138 | .llvm_name = "rdm", |
| 1139 | .description = "Enable Armv8.1-A Rounding Double Multiply Add/Subtract instructions", | 1139 | .description = "Enable Armv8.1-A Rounding Double Multiply Add/Subtract instructions", |
| 1140 | .dependencies = featureSet(&[_]Feature{ | 1140 | .dependencies = featureSet(&[_]Feature{ |
| 1141 | .neon, | 1141 | .neon, |
| 1142 | }), | 1142 | }), |
| 1143 | }; | 1143 | }; |
| 1144 | result[@intFromEnum(Feature.reserve_lr_for_ra)] = .{ | 1144 | result[@backingInt(Feature.reserve_lr_for_ra)] = .{ |
| 1145 | .llvm_name = "reserve-lr-for-ra", | 1145 | .llvm_name = "reserve-lr-for-ra", |
| 1146 | .description = "Reserve LR for call use only", | 1146 | .description = "Reserve LR for call use only", |
| 1147 | .dependencies = featureSet(&[_]Feature{}), | 1147 | .dependencies = featureSet(&[_]Feature{}), |
| 1148 | }; | 1148 | }; |
| 1149 | result[@intFromEnum(Feature.reserve_x1)] = .{ | 1149 | result[@backingInt(Feature.reserve_x1)] = .{ |
| 1150 | .llvm_name = "reserve-x1", | 1150 | .llvm_name = "reserve-x1", |
| 1151 | .description = "Reserve X1, making it unavailable as a GPR", | 1151 | .description = "Reserve X1, making it unavailable as a GPR", |
| 1152 | .dependencies = featureSet(&[_]Feature{}), | 1152 | .dependencies = featureSet(&[_]Feature{}), |
| 1153 | }; | 1153 | }; |
| 1154 | result[@intFromEnum(Feature.reserve_x10)] = .{ | 1154 | result[@backingInt(Feature.reserve_x10)] = .{ |
| 1155 | .llvm_name = "reserve-x10", | 1155 | .llvm_name = "reserve-x10", |
| 1156 | .description = "Reserve X10, making it unavailable as a GPR", | 1156 | .description = "Reserve X10, making it unavailable as a GPR", |
| 1157 | .dependencies = featureSet(&[_]Feature{}), | 1157 | .dependencies = featureSet(&[_]Feature{}), |
| 1158 | }; | 1158 | }; |
| 1159 | result[@intFromEnum(Feature.reserve_x11)] = .{ | 1159 | result[@backingInt(Feature.reserve_x11)] = .{ |
| 1160 | .llvm_name = "reserve-x11", | 1160 | .llvm_name = "reserve-x11", |
| 1161 | .description = "Reserve X11, making it unavailable as a GPR", | 1161 | .description = "Reserve X11, making it unavailable as a GPR", |
| 1162 | .dependencies = featureSet(&[_]Feature{}), | 1162 | .dependencies = featureSet(&[_]Feature{}), |
| 1163 | }; | 1163 | }; |
| 1164 | result[@intFromEnum(Feature.reserve_x12)] = .{ | 1164 | result[@backingInt(Feature.reserve_x12)] = .{ |
| 1165 | .llvm_name = "reserve-x12", | 1165 | .llvm_name = "reserve-x12", |
| 1166 | .description = "Reserve X12, making it unavailable as a GPR", | 1166 | .description = "Reserve X12, making it unavailable as a GPR", |
| 1167 | .dependencies = featureSet(&[_]Feature{}), | 1167 | .dependencies = featureSet(&[_]Feature{}), |
| 1168 | }; | 1168 | }; |
| 1169 | result[@intFromEnum(Feature.reserve_x13)] = .{ | 1169 | result[@backingInt(Feature.reserve_x13)] = .{ |
| 1170 | .llvm_name = "reserve-x13", | 1170 | .llvm_name = "reserve-x13", |
| 1171 | .description = "Reserve X13, making it unavailable as a GPR", | 1171 | .description = "Reserve X13, making it unavailable as a GPR", |
| 1172 | .dependencies = featureSet(&[_]Feature{}), | 1172 | .dependencies = featureSet(&[_]Feature{}), |
| 1173 | }; | 1173 | }; |
| 1174 | result[@intFromEnum(Feature.reserve_x14)] = .{ | 1174 | result[@backingInt(Feature.reserve_x14)] = .{ |
| 1175 | .llvm_name = "reserve-x14", | 1175 | .llvm_name = "reserve-x14", |
| 1176 | .description = "Reserve X14, making it unavailable as a GPR", | 1176 | .description = "Reserve X14, making it unavailable as a GPR", |
| 1177 | .dependencies = featureSet(&[_]Feature{}), | 1177 | .dependencies = featureSet(&[_]Feature{}), |
| 1178 | }; | 1178 | }; |
| 1179 | result[@intFromEnum(Feature.reserve_x15)] = .{ | 1179 | result[@backingInt(Feature.reserve_x15)] = .{ |
| 1180 | .llvm_name = "reserve-x15", | 1180 | .llvm_name = "reserve-x15", |
| 1181 | .description = "Reserve X15, making it unavailable as a GPR", | 1181 | .description = "Reserve X15, making it unavailable as a GPR", |
| 1182 | .dependencies = featureSet(&[_]Feature{}), | 1182 | .dependencies = featureSet(&[_]Feature{}), |
| 1183 | }; | 1183 | }; |
| 1184 | result[@intFromEnum(Feature.reserve_x18)] = .{ | 1184 | result[@backingInt(Feature.reserve_x18)] = .{ |
| 1185 | .llvm_name = "reserve-x18", | 1185 | .llvm_name = "reserve-x18", |
| 1186 | .description = "Reserve X18, making it unavailable as a GPR", | 1186 | .description = "Reserve X18, making it unavailable as a GPR", |
| 1187 | .dependencies = featureSet(&[_]Feature{}), | 1187 | .dependencies = featureSet(&[_]Feature{}), |
| 1188 | }; | 1188 | }; |
| 1189 | result[@intFromEnum(Feature.reserve_x2)] = .{ | 1189 | result[@backingInt(Feature.reserve_x2)] = .{ |
| 1190 | .llvm_name = "reserve-x2", | 1190 | .llvm_name = "reserve-x2", |
| 1191 | .description = "Reserve X2, making it unavailable as a GPR", | 1191 | .description = "Reserve X2, making it unavailable as a GPR", |
| 1192 | .dependencies = featureSet(&[_]Feature{}), | 1192 | .dependencies = featureSet(&[_]Feature{}), |
| 1193 | }; | 1193 | }; |
| 1194 | result[@intFromEnum(Feature.reserve_x20)] = .{ | 1194 | result[@backingInt(Feature.reserve_x20)] = .{ |
| 1195 | .llvm_name = "reserve-x20", | 1195 | .llvm_name = "reserve-x20", |
| 1196 | .description = "Reserve X20, making it unavailable as a GPR", | 1196 | .description = "Reserve X20, making it unavailable as a GPR", |
| 1197 | .dependencies = featureSet(&[_]Feature{}), | 1197 | .dependencies = featureSet(&[_]Feature{}), |
| 1198 | }; | 1198 | }; |
| 1199 | result[@intFromEnum(Feature.reserve_x21)] = .{ | 1199 | result[@backingInt(Feature.reserve_x21)] = .{ |
| 1200 | .llvm_name = "reserve-x21", | 1200 | .llvm_name = "reserve-x21", |
| 1201 | .description = "Reserve X21, making it unavailable as a GPR", | 1201 | .description = "Reserve X21, making it unavailable as a GPR", |
| 1202 | .dependencies = featureSet(&[_]Feature{}), | 1202 | .dependencies = featureSet(&[_]Feature{}), |
| 1203 | }; | 1203 | }; |
| 1204 | result[@intFromEnum(Feature.reserve_x22)] = .{ | 1204 | result[@backingInt(Feature.reserve_x22)] = .{ |
| 1205 | .llvm_name = "reserve-x22", | 1205 | .llvm_name = "reserve-x22", |
| 1206 | .description = "Reserve X22, making it unavailable as a GPR", | 1206 | .description = "Reserve X22, making it unavailable as a GPR", |
| 1207 | .dependencies = featureSet(&[_]Feature{}), | 1207 | .dependencies = featureSet(&[_]Feature{}), |
| 1208 | }; | 1208 | }; |
| 1209 | result[@intFromEnum(Feature.reserve_x23)] = .{ | 1209 | result[@backingInt(Feature.reserve_x23)] = .{ |
| 1210 | .llvm_name = "reserve-x23", | 1210 | .llvm_name = "reserve-x23", |
| 1211 | .description = "Reserve X23, making it unavailable as a GPR", | 1211 | .description = "Reserve X23, making it unavailable as a GPR", |
| 1212 | .dependencies = featureSet(&[_]Feature{}), | 1212 | .dependencies = featureSet(&[_]Feature{}), |
| 1213 | }; | 1213 | }; |
| 1214 | result[@intFromEnum(Feature.reserve_x24)] = .{ | 1214 | result[@backingInt(Feature.reserve_x24)] = .{ |
| 1215 | .llvm_name = "reserve-x24", | 1215 | .llvm_name = "reserve-x24", |
| 1216 | .description = "Reserve X24, making it unavailable as a GPR", | 1216 | .description = "Reserve X24, making it unavailable as a GPR", |
| 1217 | .dependencies = featureSet(&[_]Feature{}), | 1217 | .dependencies = featureSet(&[_]Feature{}), |
| 1218 | }; | 1218 | }; |
| 1219 | result[@intFromEnum(Feature.reserve_x25)] = .{ | 1219 | result[@backingInt(Feature.reserve_x25)] = .{ |
| 1220 | .llvm_name = "reserve-x25", | 1220 | .llvm_name = "reserve-x25", |
| 1221 | .description = "Reserve X25, making it unavailable as a GPR", | 1221 | .description = "Reserve X25, making it unavailable as a GPR", |
| 1222 | .dependencies = featureSet(&[_]Feature{}), | 1222 | .dependencies = featureSet(&[_]Feature{}), |
| 1223 | }; | 1223 | }; |
| 1224 | result[@intFromEnum(Feature.reserve_x26)] = .{ | 1224 | result[@backingInt(Feature.reserve_x26)] = .{ |
| 1225 | .llvm_name = "reserve-x26", | 1225 | .llvm_name = "reserve-x26", |
| 1226 | .description = "Reserve X26, making it unavailable as a GPR", | 1226 | .description = "Reserve X26, making it unavailable as a GPR", |
| 1227 | .dependencies = featureSet(&[_]Feature{}), | 1227 | .dependencies = featureSet(&[_]Feature{}), |
| 1228 | }; | 1228 | }; |
| 1229 | result[@intFromEnum(Feature.reserve_x27)] = .{ | 1229 | result[@backingInt(Feature.reserve_x27)] = .{ |
| 1230 | .llvm_name = "reserve-x27", | 1230 | .llvm_name = "reserve-x27", |
| 1231 | .description = "Reserve X27, making it unavailable as a GPR", | 1231 | .description = "Reserve X27, making it unavailable as a GPR", |
| 1232 | .dependencies = featureSet(&[_]Feature{}), | 1232 | .dependencies = featureSet(&[_]Feature{}), |
| 1233 | }; | 1233 | }; |
| 1234 | result[@intFromEnum(Feature.reserve_x28)] = .{ | 1234 | result[@backingInt(Feature.reserve_x28)] = .{ |
| 1235 | .llvm_name = "reserve-x28", | 1235 | .llvm_name = "reserve-x28", |
| 1236 | .description = "Reserve X28, making it unavailable as a GPR", | 1236 | .description = "Reserve X28, making it unavailable as a GPR", |
| 1237 | .dependencies = featureSet(&[_]Feature{}), | 1237 | .dependencies = featureSet(&[_]Feature{}), |
| 1238 | }; | 1238 | }; |
| 1239 | result[@intFromEnum(Feature.reserve_x3)] = .{ | 1239 | result[@backingInt(Feature.reserve_x3)] = .{ |
| 1240 | .llvm_name = "reserve-x3", | 1240 | .llvm_name = "reserve-x3", |
| 1241 | .description = "Reserve X3, making it unavailable as a GPR", | 1241 | .description = "Reserve X3, making it unavailable as a GPR", |
| 1242 | .dependencies = featureSet(&[_]Feature{}), | 1242 | .dependencies = featureSet(&[_]Feature{}), |
| 1243 | }; | 1243 | }; |
| 1244 | result[@intFromEnum(Feature.reserve_x4)] = .{ | 1244 | result[@backingInt(Feature.reserve_x4)] = .{ |
| 1245 | .llvm_name = "reserve-x4", | 1245 | .llvm_name = "reserve-x4", |
| 1246 | .description = "Reserve X4, making it unavailable as a GPR", | 1246 | .description = "Reserve X4, making it unavailable as a GPR", |
| 1247 | .dependencies = featureSet(&[_]Feature{}), | 1247 | .dependencies = featureSet(&[_]Feature{}), |
| 1248 | }; | 1248 | }; |
| 1249 | result[@intFromEnum(Feature.reserve_x5)] = .{ | 1249 | result[@backingInt(Feature.reserve_x5)] = .{ |
| 1250 | .llvm_name = "reserve-x5", | 1250 | .llvm_name = "reserve-x5", |
| 1251 | .description = "Reserve X5, making it unavailable as a GPR", | 1251 | .description = "Reserve X5, making it unavailable as a GPR", |
| 1252 | .dependencies = featureSet(&[_]Feature{}), | 1252 | .dependencies = featureSet(&[_]Feature{}), |
| 1253 | }; | 1253 | }; |
| 1254 | result[@intFromEnum(Feature.reserve_x6)] = .{ | 1254 | result[@backingInt(Feature.reserve_x6)] = .{ |
| 1255 | .llvm_name = "reserve-x6", | 1255 | .llvm_name = "reserve-x6", |
| 1256 | .description = "Reserve X6, making it unavailable as a GPR", | 1256 | .description = "Reserve X6, making it unavailable as a GPR", |
| 1257 | .dependencies = featureSet(&[_]Feature{}), | 1257 | .dependencies = featureSet(&[_]Feature{}), |
| 1258 | }; | 1258 | }; |
| 1259 | result[@intFromEnum(Feature.reserve_x7)] = .{ | 1259 | result[@backingInt(Feature.reserve_x7)] = .{ |
| 1260 | .llvm_name = "reserve-x7", | 1260 | .llvm_name = "reserve-x7", |
| 1261 | .description = "Reserve X7, making it unavailable as a GPR", | 1261 | .description = "Reserve X7, making it unavailable as a GPR", |
| 1262 | .dependencies = featureSet(&[_]Feature{}), | 1262 | .dependencies = featureSet(&[_]Feature{}), |
| 1263 | }; | 1263 | }; |
| 1264 | result[@intFromEnum(Feature.reserve_x9)] = .{ | 1264 | result[@backingInt(Feature.reserve_x9)] = .{ |
| 1265 | .llvm_name = "reserve-x9", | 1265 | .llvm_name = "reserve-x9", |
| 1266 | .description = "Reserve X9, making it unavailable as a GPR", | 1266 | .description = "Reserve X9, making it unavailable as a GPR", |
| 1267 | .dependencies = featureSet(&[_]Feature{}), | 1267 | .dependencies = featureSet(&[_]Feature{}), |
| 1268 | }; | 1268 | }; |
| 1269 | result[@intFromEnum(Feature.rme)] = .{ | 1269 | result[@backingInt(Feature.rme)] = .{ |
| 1270 | .llvm_name = "rme", | 1270 | .llvm_name = "rme", |
| 1271 | .description = "Enable Realm Management Extension", | 1271 | .description = "Enable Realm Management Extension", |
| 1272 | .dependencies = featureSet(&[_]Feature{}), | 1272 | .dependencies = featureSet(&[_]Feature{}), |
| 1273 | }; | 1273 | }; |
| 1274 | result[@intFromEnum(Feature.sb)] = .{ | 1274 | result[@backingInt(Feature.sb)] = .{ |
| 1275 | .llvm_name = "sb", | 1275 | .llvm_name = "sb", |
| 1276 | .description = "Enable Armv8.5-A Speculation Barrier", | 1276 | .description = "Enable Armv8.5-A Speculation Barrier", |
| 1277 | .dependencies = featureSet(&[_]Feature{}), | 1277 | .dependencies = featureSet(&[_]Feature{}), |
| 1278 | }; | 1278 | }; |
| 1279 | result[@intFromEnum(Feature.sel2)] = .{ | 1279 | result[@backingInt(Feature.sel2)] = .{ |
| 1280 | .llvm_name = "sel2", | 1280 | .llvm_name = "sel2", |
| 1281 | .description = "Enable Armv8.4-A Secure Exception Level 2 extension", | 1281 | .description = "Enable Armv8.4-A Secure Exception Level 2 extension", |
| 1282 | .dependencies = featureSet(&[_]Feature{}), | 1282 | .dependencies = featureSet(&[_]Feature{}), |
| 1283 | }; | 1283 | }; |
| 1284 | result[@intFromEnum(Feature.sha2)] = .{ | 1284 | result[@backingInt(Feature.sha2)] = .{ |
| 1285 | .llvm_name = "sha2", | 1285 | .llvm_name = "sha2", |
| 1286 | .description = "Enable SHA1 and SHA256 support", | 1286 | .description = "Enable SHA1 and SHA256 support", |
| 1287 | .dependencies = featureSet(&[_]Feature{ | 1287 | .dependencies = featureSet(&[_]Feature{ |
| 1288 | .neon, | 1288 | .neon, |
| 1289 | }), | 1289 | }), |
| 1290 | }; | 1290 | }; |
| 1291 | result[@intFromEnum(Feature.sha3)] = .{ | 1291 | result[@backingInt(Feature.sha3)] = .{ |
| 1292 | .llvm_name = "sha3", | 1292 | .llvm_name = "sha3", |
| 1293 | .description = "Enable SHA512 and SHA3 support", | 1293 | .description = "Enable SHA512 and SHA3 support", |
| 1294 | .dependencies = featureSet(&[_]Feature{ | 1294 | .dependencies = featureSet(&[_]Feature{ |
| 1295 | .sha2, | 1295 | .sha2, |
| 1296 | }), | 1296 | }), |
| 1297 | }; | 1297 | }; |
| 1298 | result[@intFromEnum(Feature.slow_misaligned_128store)] = .{ | 1298 | result[@backingInt(Feature.slow_misaligned_128store)] = .{ |
| 1299 | .llvm_name = "slow-misaligned-128store", | 1299 | .llvm_name = "slow-misaligned-128store", |
| 1300 | .description = "Misaligned 128 bit stores are slow", | 1300 | .description = "Misaligned 128 bit stores are slow", |
| 1301 | .dependencies = featureSet(&[_]Feature{}), | 1301 | .dependencies = featureSet(&[_]Feature{}), |
| 1302 | }; | 1302 | }; |
| 1303 | result[@intFromEnum(Feature.slow_paired_128)] = .{ | 1303 | result[@backingInt(Feature.slow_paired_128)] = .{ |
| 1304 | .llvm_name = "slow-paired-128", | 1304 | .llvm_name = "slow-paired-128", |
| 1305 | .description = "Paired 128 bit loads and stores are slow", | 1305 | .description = "Paired 128 bit loads and stores are slow", |
| 1306 | .dependencies = featureSet(&[_]Feature{}), | 1306 | .dependencies = featureSet(&[_]Feature{}), |
| 1307 | }; | 1307 | }; |
| 1308 | result[@intFromEnum(Feature.slow_strqro_store)] = .{ | 1308 | result[@backingInt(Feature.slow_strqro_store)] = .{ |
| 1309 | .llvm_name = "slow-strqro-store", | 1309 | .llvm_name = "slow-strqro-store", |
| 1310 | .description = "STR of Q register with register offset is slow", | 1310 | .description = "STR of Q register with register offset is slow", |
| 1311 | .dependencies = featureSet(&[_]Feature{}), | 1311 | .dependencies = featureSet(&[_]Feature{}), |
| 1312 | }; | 1312 | }; |
| 1313 | result[@intFromEnum(Feature.sm4)] = .{ | 1313 | result[@backingInt(Feature.sm4)] = .{ |
| 1314 | .llvm_name = "sm4", | 1314 | .llvm_name = "sm4", |
| 1315 | .description = "Enable SM3 and SM4 support", | 1315 | .description = "Enable SM3 and SM4 support", |
| 1316 | .dependencies = featureSet(&[_]Feature{ | 1316 | .dependencies = featureSet(&[_]Feature{ |
| 1317 | .neon, | 1317 | .neon, |
| 1318 | }), | 1318 | }), |
| 1319 | }; | 1319 | }; |
| 1320 | result[@intFromEnum(Feature.sme)] = .{ | 1320 | result[@backingInt(Feature.sme)] = .{ |
| 1321 | .llvm_name = "sme", | 1321 | .llvm_name = "sme", |
| 1322 | .description = "Enable Scalable Matrix Extension (SME)", | 1322 | .description = "Enable Scalable Matrix Extension (SME)", |
| 1323 | .dependencies = featureSet(&[_]Feature{ | 1323 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1325,35 +1325,35 @@ pub const all_features = blk: { | ... | @@ -1325,35 +1325,35 @@ pub const all_features = blk: { |
| 1325 | .fullfp16, | 1325 | .fullfp16, |
| 1326 | }), | 1326 | }), |
| 1327 | }; | 1327 | }; |
| 1328 | result[@intFromEnum(Feature.sme2)] = .{ | 1328 | result[@backingInt(Feature.sme2)] = .{ |
| 1329 | .llvm_name = "sme2", | 1329 | .llvm_name = "sme2", |
| 1330 | .description = "Enable Scalable Matrix Extension 2 (SME2) instructions", | 1330 | .description = "Enable Scalable Matrix Extension 2 (SME2) instructions", |
| 1331 | .dependencies = featureSet(&[_]Feature{ | 1331 | .dependencies = featureSet(&[_]Feature{ |
| 1332 | .sme, | 1332 | .sme, |
| 1333 | }), | 1333 | }), |
| 1334 | }; | 1334 | }; |
| 1335 | result[@intFromEnum(Feature.sme2p1)] = .{ | 1335 | result[@backingInt(Feature.sme2p1)] = .{ |
| 1336 | .llvm_name = "sme2p1", | 1336 | .llvm_name = "sme2p1", |
| 1337 | .description = "Enable Scalable Matrix Extension 2.1 instructions", | 1337 | .description = "Enable Scalable Matrix Extension 2.1 instructions", |
| 1338 | .dependencies = featureSet(&[_]Feature{ | 1338 | .dependencies = featureSet(&[_]Feature{ |
| 1339 | .sme2, | 1339 | .sme2, |
| 1340 | }), | 1340 | }), |
| 1341 | }; | 1341 | }; |
| 1342 | result[@intFromEnum(Feature.sme2p2)] = .{ | 1342 | result[@backingInt(Feature.sme2p2)] = .{ |
| 1343 | .llvm_name = "sme2p2", | 1343 | .llvm_name = "sme2p2", |
| 1344 | .description = "Enable Armv9.6-A Scalable Matrix Extension 2.2 instructions", | 1344 | .description = "Enable Armv9.6-A Scalable Matrix Extension 2.2 instructions", |
| 1345 | .dependencies = featureSet(&[_]Feature{ | 1345 | .dependencies = featureSet(&[_]Feature{ |
| 1346 | .sme2p1, | 1346 | .sme2p1, |
| 1347 | }), | 1347 | }), |
| 1348 | }; | 1348 | }; |
| 1349 | result[@intFromEnum(Feature.sme2p3)] = .{ | 1349 | result[@backingInt(Feature.sme2p3)] = .{ |
| 1350 | .llvm_name = "sme2p3", | 1350 | .llvm_name = "sme2p3", |
| 1351 | .description = "Enable Armv9.7-A Scalable Matrix Extension 2.3 instructions", | 1351 | .description = "Enable Armv9.7-A Scalable Matrix Extension 2.3 instructions", |
| 1352 | .dependencies = featureSet(&[_]Feature{ | 1352 | .dependencies = featureSet(&[_]Feature{ |
| 1353 | .sme2p2, | 1353 | .sme2p2, |
| 1354 | }), | 1354 | }), |
| 1355 | }; | 1355 | }; |
| 1356 | result[@intFromEnum(Feature.sme_b16b16)] = .{ | 1356 | result[@backingInt(Feature.sme_b16b16)] = .{ |
| 1357 | .llvm_name = "sme-b16b16", | 1357 | .llvm_name = "sme-b16b16", |
| 1358 | .description = "Enable SME2.1 ZA-targeting non-widening BFloat16 instructions", | 1358 | .description = "Enable SME2.1 ZA-targeting non-widening BFloat16 instructions", |
| 1359 | .dependencies = featureSet(&[_]Feature{ | 1359 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1361,21 +1361,21 @@ pub const all_features = blk: { | ... | @@ -1361,21 +1361,21 @@ pub const all_features = blk: { |
| 1361 | .sve_b16b16, | 1361 | .sve_b16b16, |
| 1362 | }), | 1362 | }), |
| 1363 | }; | 1363 | }; |
| 1364 | result[@intFromEnum(Feature.sme_f16f16)] = .{ | 1364 | result[@backingInt(Feature.sme_f16f16)] = .{ |
| 1365 | .llvm_name = "sme-f16f16", | 1365 | .llvm_name = "sme-f16f16", |
| 1366 | .description = "Enable SME non-widening Float16 instructions", | 1366 | .description = "Enable SME non-widening Float16 instructions", |
| 1367 | .dependencies = featureSet(&[_]Feature{ | 1367 | .dependencies = featureSet(&[_]Feature{ |
| 1368 | .sme2, | 1368 | .sme2, |
| 1369 | }), | 1369 | }), |
| 1370 | }; | 1370 | }; |
| 1371 | result[@intFromEnum(Feature.sme_f64f64)] = .{ | 1371 | result[@backingInt(Feature.sme_f64f64)] = .{ |
| 1372 | .llvm_name = "sme-f64f64", | 1372 | .llvm_name = "sme-f64f64", |
| 1373 | .description = "Enable Scalable Matrix Extension (SME) F64F64 instructions", | 1373 | .description = "Enable Scalable Matrix Extension (SME) F64F64 instructions", |
| 1374 | .dependencies = featureSet(&[_]Feature{ | 1374 | .dependencies = featureSet(&[_]Feature{ |
| 1375 | .sme, | 1375 | .sme, |
| 1376 | }), | 1376 | }), |
| 1377 | }; | 1377 | }; |
| 1378 | result[@intFromEnum(Feature.sme_f8f16)] = .{ | 1378 | result[@backingInt(Feature.sme_f8f16)] = .{ |
| 1379 | .llvm_name = "sme-f8f16", | 1379 | .llvm_name = "sme-f8f16", |
| 1380 | .description = "Enable Scalable Matrix Extension (SME) F8F16 instructions", | 1380 | .description = "Enable Scalable Matrix Extension (SME) F8F16 instructions", |
| 1381 | .dependencies = featureSet(&[_]Feature{ | 1381 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1383,7 +1383,7 @@ pub const all_features = blk: { | ... | @@ -1383,7 +1383,7 @@ pub const all_features = blk: { |
| 1383 | .sme2, | 1383 | .sme2, |
| 1384 | }), | 1384 | }), |
| 1385 | }; | 1385 | }; |
| 1386 | result[@intFromEnum(Feature.sme_f8f32)] = .{ | 1386 | result[@backingInt(Feature.sme_f8f32)] = .{ |
| 1387 | .llvm_name = "sme-f8f32", | 1387 | .llvm_name = "sme-f8f32", |
| 1388 | .description = "Enable Scalable Matrix Extension (SME) F8F32 instructions", | 1388 | .description = "Enable Scalable Matrix Extension (SME) F8F32 instructions", |
| 1389 | .dependencies = featureSet(&[_]Feature{ | 1389 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1391,7 +1391,7 @@ pub const all_features = blk: { | ... | @@ -1391,7 +1391,7 @@ pub const all_features = blk: { |
| 1391 | .sme2, | 1391 | .sme2, |
| 1392 | }), | 1392 | }), |
| 1393 | }; | 1393 | }; |
| 1394 | result[@intFromEnum(Feature.sme_fa64)] = .{ | 1394 | result[@backingInt(Feature.sme_fa64)] = .{ |
| 1395 | .llvm_name = "sme-fa64", | 1395 | .llvm_name = "sme-fa64", |
| 1396 | .description = "Enable the full A64 instruction set in streaming SVE mode", | 1396 | .description = "Enable the full A64 instruction set in streaming SVE mode", |
| 1397 | .dependencies = featureSet(&[_]Feature{ | 1397 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1399,62 +1399,62 @@ pub const all_features = blk: { | ... | @@ -1399,62 +1399,62 @@ pub const all_features = blk: { |
| 1399 | .sve2, | 1399 | .sve2, |
| 1400 | }), | 1400 | }), |
| 1401 | }; | 1401 | }; |
| 1402 | result[@intFromEnum(Feature.sme_i16i64)] = .{ | 1402 | result[@backingInt(Feature.sme_i16i64)] = .{ |
| 1403 | .llvm_name = "sme-i16i64", | 1403 | .llvm_name = "sme-i16i64", |
| 1404 | .description = "Enable Scalable Matrix Extension (SME) I16I64 instructions", | 1404 | .description = "Enable Scalable Matrix Extension (SME) I16I64 instructions", |
| 1405 | .dependencies = featureSet(&[_]Feature{ | 1405 | .dependencies = featureSet(&[_]Feature{ |
| 1406 | .sme, | 1406 | .sme, |
| 1407 | }), | 1407 | }), |
| 1408 | }; | 1408 | }; |
| 1409 | result[@intFromEnum(Feature.sme_lutv2)] = .{ | 1409 | result[@backingInt(Feature.sme_lutv2)] = .{ |
| 1410 | .llvm_name = "sme-lutv2", | 1410 | .llvm_name = "sme-lutv2", |
| 1411 | .description = "Enable Scalable Matrix Extension (SME) LUTv2 instructions", | 1411 | .description = "Enable Scalable Matrix Extension (SME) LUTv2 instructions", |
| 1412 | .dependencies = featureSet(&[_]Feature{ | 1412 | .dependencies = featureSet(&[_]Feature{ |
| 1413 | .sme2, | 1413 | .sme2, |
| 1414 | }), | 1414 | }), |
| 1415 | }; | 1415 | }; |
| 1416 | result[@intFromEnum(Feature.sme_mop4)] = .{ | 1416 | result[@backingInt(Feature.sme_mop4)] = .{ |
| 1417 | .llvm_name = "sme-mop4", | 1417 | .llvm_name = "sme-mop4", |
| 1418 | .description = "Enable SME Quarter-tile outer product instructions", | 1418 | .description = "Enable SME Quarter-tile outer product instructions", |
| 1419 | .dependencies = featureSet(&[_]Feature{ | 1419 | .dependencies = featureSet(&[_]Feature{ |
| 1420 | .sme2, | 1420 | .sme2, |
| 1421 | }), | 1421 | }), |
| 1422 | }; | 1422 | }; |
| 1423 | result[@intFromEnum(Feature.sme_tmop)] = .{ | 1423 | result[@backingInt(Feature.sme_tmop)] = .{ |
| 1424 | .llvm_name = "sme-tmop", | 1424 | .llvm_name = "sme-tmop", |
| 1425 | .description = "Enable SME Structured sparsity outer product instructions.", | 1425 | .description = "Enable SME Structured sparsity outer product instructions.", |
| 1426 | .dependencies = featureSet(&[_]Feature{ | 1426 | .dependencies = featureSet(&[_]Feature{ |
| 1427 | .sme2, | 1427 | .sme2, |
| 1428 | }), | 1428 | }), |
| 1429 | }; | 1429 | }; |
| 1430 | result[@intFromEnum(Feature.spe)] = .{ | 1430 | result[@backingInt(Feature.spe)] = .{ |
| 1431 | .llvm_name = "spe", | 1431 | .llvm_name = "spe", |
| 1432 | .description = "Enable Statistical Profiling extension", | 1432 | .description = "Enable Statistical Profiling extension", |
| 1433 | .dependencies = featureSet(&[_]Feature{}), | 1433 | .dependencies = featureSet(&[_]Feature{}), |
| 1434 | }; | 1434 | }; |
| 1435 | result[@intFromEnum(Feature.spe_eef)] = .{ | 1435 | result[@backingInt(Feature.spe_eef)] = .{ |
| 1436 | .llvm_name = "spe-eef", | 1436 | .llvm_name = "spe-eef", |
| 1437 | .description = "Enable extra register in the Statistical Profiling Extension", | 1437 | .description = "Enable extra register in the Statistical Profiling Extension", |
| 1438 | .dependencies = featureSet(&[_]Feature{}), | 1438 | .dependencies = featureSet(&[_]Feature{}), |
| 1439 | }; | 1439 | }; |
| 1440 | result[@intFromEnum(Feature.specres2)] = .{ | 1440 | result[@backingInt(Feature.specres2)] = .{ |
| 1441 | .llvm_name = "specres2", | 1441 | .llvm_name = "specres2", |
| 1442 | .description = "Enable Speculation Restriction Instruction", | 1442 | .description = "Enable Speculation Restriction Instruction", |
| 1443 | .dependencies = featureSet(&[_]Feature{ | 1443 | .dependencies = featureSet(&[_]Feature{ |
| 1444 | .predres, | 1444 | .predres, |
| 1445 | }), | 1445 | }), |
| 1446 | }; | 1446 | }; |
| 1447 | result[@intFromEnum(Feature.specrestrict)] = .{ | 1447 | result[@backingInt(Feature.specrestrict)] = .{ |
| 1448 | .llvm_name = "specrestrict", | 1448 | .llvm_name = "specrestrict", |
| 1449 | .description = "Enable architectural speculation restriction", | 1449 | .description = "Enable architectural speculation restriction", |
| 1450 | .dependencies = featureSet(&[_]Feature{}), | 1450 | .dependencies = featureSet(&[_]Feature{}), |
| 1451 | }; | 1451 | }; |
| 1452 | result[@intFromEnum(Feature.ssbs)] = .{ | 1452 | result[@backingInt(Feature.ssbs)] = .{ |
| 1453 | .llvm_name = "ssbs", | 1453 | .llvm_name = "ssbs", |
| 1454 | .description = "Enable Speculative Store Bypass Safe bit", | 1454 | .description = "Enable Speculative Store Bypass Safe bit", |
| 1455 | .dependencies = featureSet(&[_]Feature{}), | 1455 | .dependencies = featureSet(&[_]Feature{}), |
| 1456 | }; | 1456 | }; |
| 1457 | result[@intFromEnum(Feature.ssve_aes)] = .{ | 1457 | result[@backingInt(Feature.ssve_aes)] = .{ |
| 1458 | .llvm_name = "ssve-aes", | 1458 | .llvm_name = "ssve-aes", |
| 1459 | .description = "Enable Armv9.6-A SVE AES support in streaming SVE mode", | 1459 | .description = "Enable Armv9.6-A SVE AES support in streaming SVE mode", |
| 1460 | .dependencies = featureSet(&[_]Feature{ | 1460 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1462,7 +1462,7 @@ pub const all_features = blk: { | ... | @@ -1462,7 +1462,7 @@ pub const all_features = blk: { |
| 1462 | .sve_aes, | 1462 | .sve_aes, |
| 1463 | }), | 1463 | }), |
| 1464 | }; | 1464 | }; |
| 1465 | result[@intFromEnum(Feature.ssve_bitperm)] = .{ | 1465 | result[@backingInt(Feature.ssve_bitperm)] = .{ |
| 1466 | .llvm_name = "ssve-bitperm", | 1466 | .llvm_name = "ssve-bitperm", |
| 1467 | .description = "Enable Armv9.6-A SVE BitPerm support in streaming SVE mode", | 1467 | .description = "Enable Armv9.6-A SVE BitPerm support in streaming SVE mode", |
| 1468 | .dependencies = featureSet(&[_]Feature{ | 1468 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1470,14 +1470,14 @@ pub const all_features = blk: { | ... | @@ -1470,14 +1470,14 @@ pub const all_features = blk: { |
| 1470 | .sve_bitperm, | 1470 | .sve_bitperm, |
| 1471 | }), | 1471 | }), |
| 1472 | }; | 1472 | }; |
| 1473 | result[@intFromEnum(Feature.ssve_fexpa)] = .{ | 1473 | result[@backingInt(Feature.ssve_fexpa)] = .{ |
| 1474 | .llvm_name = "ssve-fexpa", | 1474 | .llvm_name = "ssve-fexpa", |
| 1475 | .description = "Enable SVE FEXPA instruction in Streaming SVE mode", | 1475 | .description = "Enable SVE FEXPA instruction in Streaming SVE mode", |
| 1476 | .dependencies = featureSet(&[_]Feature{ | 1476 | .dependencies = featureSet(&[_]Feature{ |
| 1477 | .sme2, | 1477 | .sme2, |
| 1478 | }), | 1478 | }), |
| 1479 | }; | 1479 | }; |
| 1480 | result[@intFromEnum(Feature.ssve_fp8dot2)] = .{ | 1480 | result[@backingInt(Feature.ssve_fp8dot2)] = .{ |
| 1481 | .llvm_name = "ssve-fp8dot2", | 1481 | .llvm_name = "ssve-fp8dot2", |
| 1482 | .description = "Enable SVE2 FP8 2-way dot product instructions", | 1482 | .description = "Enable SVE2 FP8 2-way dot product instructions", |
| 1483 | .dependencies = featureSet(&[_]Feature{ | 1483 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1485,7 +1485,7 @@ pub const all_features = blk: { | ... | @@ -1485,7 +1485,7 @@ pub const all_features = blk: { |
| 1485 | .sme2, | 1485 | .sme2, |
| 1486 | }), | 1486 | }), |
| 1487 | }; | 1487 | }; |
| 1488 | result[@intFromEnum(Feature.ssve_fp8dot4)] = .{ | 1488 | result[@backingInt(Feature.ssve_fp8dot4)] = .{ |
| 1489 | .llvm_name = "ssve-fp8dot4", | 1489 | .llvm_name = "ssve-fp8dot4", |
| 1490 | .description = "Enable SVE2 FP8 4-way dot product instructions", | 1490 | .description = "Enable SVE2 FP8 4-way dot product instructions", |
| 1491 | .dependencies = featureSet(&[_]Feature{ | 1491 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1493,7 +1493,7 @@ pub const all_features = blk: { | ... | @@ -1493,7 +1493,7 @@ pub const all_features = blk: { |
| 1493 | .sme2, | 1493 | .sme2, |
| 1494 | }), | 1494 | }), |
| 1495 | }; | 1495 | }; |
| 1496 | result[@intFromEnum(Feature.ssve_fp8fma)] = .{ | 1496 | result[@backingInt(Feature.ssve_fp8fma)] = .{ |
| 1497 | .llvm_name = "ssve-fp8fma", | 1497 | .llvm_name = "ssve-fp8fma", |
| 1498 | .description = "Enable SVE2 FP8 multiply-add instructions", | 1498 | .description = "Enable SVE2 FP8 multiply-add instructions", |
| 1499 | .dependencies = featureSet(&[_]Feature{ | 1499 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1501,36 +1501,36 @@ pub const all_features = blk: { | ... | @@ -1501,36 +1501,36 @@ pub const all_features = blk: { |
| 1501 | .sme2, | 1501 | .sme2, |
| 1502 | }), | 1502 | }), |
| 1503 | }; | 1503 | }; |
| 1504 | result[@intFromEnum(Feature.store_pair_suppress)] = .{ | 1504 | result[@backingInt(Feature.store_pair_suppress)] = .{ |
| 1505 | .llvm_name = "store-pair-suppress", | 1505 | .llvm_name = "store-pair-suppress", |
| 1506 | .description = "Enable Store Pair Suppression heuristics", | 1506 | .description = "Enable Store Pair Suppression heuristics", |
| 1507 | .dependencies = featureSet(&[_]Feature{}), | 1507 | .dependencies = featureSet(&[_]Feature{}), |
| 1508 | }; | 1508 | }; |
| 1509 | result[@intFromEnum(Feature.stp_aligned_only)] = .{ | 1509 | result[@backingInt(Feature.stp_aligned_only)] = .{ |
| 1510 | .llvm_name = "stp-aligned-only", | 1510 | .llvm_name = "stp-aligned-only", |
| 1511 | .description = "In order to emit stp, first check if the store will be aligned to 2 * element_size", | 1511 | .description = "In order to emit stp, first check if the store will be aligned to 2 * element_size", |
| 1512 | .dependencies = featureSet(&[_]Feature{}), | 1512 | .dependencies = featureSet(&[_]Feature{}), |
| 1513 | }; | 1513 | }; |
| 1514 | result[@intFromEnum(Feature.strict_align)] = .{ | 1514 | result[@backingInt(Feature.strict_align)] = .{ |
| 1515 | .llvm_name = "strict-align", | 1515 | .llvm_name = "strict-align", |
| 1516 | .description = "Disallow all unaligned memory access", | 1516 | .description = "Disallow all unaligned memory access", |
| 1517 | .dependencies = featureSet(&[_]Feature{}), | 1517 | .dependencies = featureSet(&[_]Feature{}), |
| 1518 | }; | 1518 | }; |
| 1519 | result[@intFromEnum(Feature.sve)] = .{ | 1519 | result[@backingInt(Feature.sve)] = .{ |
| 1520 | .llvm_name = "sve", | 1520 | .llvm_name = "sve", |
| 1521 | .description = "Enable Scalable Vector Extension (SVE) instructions", | 1521 | .description = "Enable Scalable Vector Extension (SVE) instructions", |
| 1522 | .dependencies = featureSet(&[_]Feature{ | 1522 | .dependencies = featureSet(&[_]Feature{ |
| 1523 | .fullfp16, | 1523 | .fullfp16, |
| 1524 | }), | 1524 | }), |
| 1525 | }; | 1525 | }; |
| 1526 | result[@intFromEnum(Feature.sve2)] = .{ | 1526 | result[@backingInt(Feature.sve2)] = .{ |
| 1527 | .llvm_name = "sve2", | 1527 | .llvm_name = "sve2", |
| 1528 | .description = "Enable Scalable Vector Extension 2 (SVE2) instructions", | 1528 | .description = "Enable Scalable Vector Extension 2 (SVE2) instructions", |
| 1529 | .dependencies = featureSet(&[_]Feature{ | 1529 | .dependencies = featureSet(&[_]Feature{ |
| 1530 | .sve, | 1530 | .sve, |
| 1531 | }), | 1531 | }), |
| 1532 | }; | 1532 | }; |
| 1533 | result[@intFromEnum(Feature.sve2_aes)] = .{ | 1533 | result[@backingInt(Feature.sve2_aes)] = .{ |
| 1534 | .llvm_name = "sve2-aes", | 1534 | .llvm_name = "sve2-aes", |
| 1535 | .description = "Shorthand for +sve2+sve-aes", | 1535 | .description = "Shorthand for +sve2+sve-aes", |
| 1536 | .dependencies = featureSet(&[_]Feature{ | 1536 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1538,7 +1538,7 @@ pub const all_features = blk: { | ... | @@ -1538,7 +1538,7 @@ pub const all_features = blk: { |
| 1538 | .sve_aes, | 1538 | .sve_aes, |
| 1539 | }), | 1539 | }), |
| 1540 | }; | 1540 | }; |
| 1541 | result[@intFromEnum(Feature.sve2_bitperm)] = .{ | 1541 | result[@backingInt(Feature.sve2_bitperm)] = .{ |
| 1542 | .llvm_name = "sve2-bitperm", | 1542 | .llvm_name = "sve2-bitperm", |
| 1543 | .description = "Shorthand for +sve2+sve-bitperm", | 1543 | .description = "Shorthand for +sve2+sve-bitperm", |
| 1544 | .dependencies = featureSet(&[_]Feature{ | 1544 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1546,7 +1546,7 @@ pub const all_features = blk: { | ... | @@ -1546,7 +1546,7 @@ pub const all_features = blk: { |
| 1546 | .sve_bitperm, | 1546 | .sve_bitperm, |
| 1547 | }), | 1547 | }), |
| 1548 | }; | 1548 | }; |
| 1549 | result[@intFromEnum(Feature.sve2_sha3)] = .{ | 1549 | result[@backingInt(Feature.sve2_sha3)] = .{ |
| 1550 | .llvm_name = "sve2-sha3", | 1550 | .llvm_name = "sve2-sha3", |
| 1551 | .description = "Shorthand for +sve2+sve-sha3", | 1551 | .description = "Shorthand for +sve2+sve-sha3", |
| 1552 | .dependencies = featureSet(&[_]Feature{ | 1552 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1554,7 +1554,7 @@ pub const all_features = blk: { | ... | @@ -1554,7 +1554,7 @@ pub const all_features = blk: { |
| 1554 | .sve_sha3, | 1554 | .sve_sha3, |
| 1555 | }), | 1555 | }), |
| 1556 | }; | 1556 | }; |
| 1557 | result[@intFromEnum(Feature.sve2_sm4)] = .{ | 1557 | result[@backingInt(Feature.sve2_sm4)] = .{ |
| 1558 | .llvm_name = "sve2-sm4", | 1558 | .llvm_name = "sve2-sm4", |
| 1559 | .description = "Shorthand for +sve2+sve-sm4", | 1559 | .description = "Shorthand for +sve2+sve-sm4", |
| 1560 | .dependencies = featureSet(&[_]Feature{ | 1560 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1562,173 +1562,173 @@ pub const all_features = blk: { | ... | @@ -1562,173 +1562,173 @@ pub const all_features = blk: { |
| 1562 | .sve_sm4, | 1562 | .sve_sm4, |
| 1563 | }), | 1563 | }), |
| 1564 | }; | 1564 | }; |
| 1565 | result[@intFromEnum(Feature.sve2p1)] = .{ | 1565 | result[@backingInt(Feature.sve2p1)] = .{ |
| 1566 | .llvm_name = "sve2p1", | 1566 | .llvm_name = "sve2p1", |
| 1567 | .description = "Enable Scalable Vector Extension 2.1 instructions", | 1567 | .description = "Enable Scalable Vector Extension 2.1 instructions", |
| 1568 | .dependencies = featureSet(&[_]Feature{ | 1568 | .dependencies = featureSet(&[_]Feature{ |
| 1569 | .sve2, | 1569 | .sve2, |
| 1570 | }), | 1570 | }), |
| 1571 | }; | 1571 | }; |
| 1572 | result[@intFromEnum(Feature.sve2p2)] = .{ | 1572 | result[@backingInt(Feature.sve2p2)] = .{ |
| 1573 | .llvm_name = "sve2p2", | 1573 | .llvm_name = "sve2p2", |
| 1574 | .description = "Enable Armv9.6-A Scalable Vector Extension 2.2 instructions", | 1574 | .description = "Enable Armv9.6-A Scalable Vector Extension 2.2 instructions", |
| 1575 | .dependencies = featureSet(&[_]Feature{ | 1575 | .dependencies = featureSet(&[_]Feature{ |
| 1576 | .sve2p1, | 1576 | .sve2p1, |
| 1577 | }), | 1577 | }), |
| 1578 | }; | 1578 | }; |
| 1579 | result[@intFromEnum(Feature.sve2p3)] = .{ | 1579 | result[@backingInt(Feature.sve2p3)] = .{ |
| 1580 | .llvm_name = "sve2p3", | 1580 | .llvm_name = "sve2p3", |
| 1581 | .description = "Enable Armv9.7-A Scalable Vector Extension 2.3 instructions", | 1581 | .description = "Enable Armv9.7-A Scalable Vector Extension 2.3 instructions", |
| 1582 | .dependencies = featureSet(&[_]Feature{ | 1582 | .dependencies = featureSet(&[_]Feature{ |
| 1583 | .sve2p2, | 1583 | .sve2p2, |
| 1584 | }), | 1584 | }), |
| 1585 | }; | 1585 | }; |
| 1586 | result[@intFromEnum(Feature.sve_aes)] = .{ | 1586 | result[@backingInt(Feature.sve_aes)] = .{ |
| 1587 | .llvm_name = "sve-aes", | 1587 | .llvm_name = "sve-aes", |
| 1588 | .description = "Enable SVE AES and quadword SVE polynomial multiply instructions", | 1588 | .description = "Enable SVE AES and quadword SVE polynomial multiply instructions", |
| 1589 | .dependencies = featureSet(&[_]Feature{ | 1589 | .dependencies = featureSet(&[_]Feature{ |
| 1590 | .aes, | 1590 | .aes, |
| 1591 | }), | 1591 | }), |
| 1592 | }; | 1592 | }; |
| 1593 | result[@intFromEnum(Feature.sve_aes2)] = .{ | 1593 | result[@backingInt(Feature.sve_aes2)] = .{ |
| 1594 | .llvm_name = "sve-aes2", | 1594 | .llvm_name = "sve-aes2", |
| 1595 | .description = "Enable Armv9.6-A SVE multi-vector AES and multi-vector quadword polynomial multiply instructions", | 1595 | .description = "Enable Armv9.6-A SVE multi-vector AES and multi-vector quadword polynomial multiply instructions", |
| 1596 | .dependencies = featureSet(&[_]Feature{}), | 1596 | .dependencies = featureSet(&[_]Feature{}), |
| 1597 | }; | 1597 | }; |
| 1598 | result[@intFromEnum(Feature.sve_b16b16)] = .{ | 1598 | result[@backingInt(Feature.sve_b16b16)] = .{ |
| 1599 | .llvm_name = "sve-b16b16", | 1599 | .llvm_name = "sve-b16b16", |
| 1600 | .description = "Enable SVE2 non-widening and SME2 Z-targeting non-widening BFloat16 instructions", | 1600 | .description = "Enable SVE2 non-widening and SME2 Z-targeting non-widening BFloat16 instructions", |
| 1601 | .dependencies = featureSet(&[_]Feature{}), | 1601 | .dependencies = featureSet(&[_]Feature{}), |
| 1602 | }; | 1602 | }; |
| 1603 | result[@intFromEnum(Feature.sve_b16mm)] = .{ | 1603 | result[@backingInt(Feature.sve_b16mm)] = .{ |
| 1604 | .llvm_name = "sve-b16mm", | 1604 | .llvm_name = "sve-b16mm", |
| 1605 | .description = "Enable Armv9.7-A SVE non-widening BFloat16 matrix multiply-accumulate", | 1605 | .description = "Enable Armv9.7-A SVE non-widening BFloat16 matrix multiply-accumulate", |
| 1606 | .dependencies = featureSet(&[_]Feature{ | 1606 | .dependencies = featureSet(&[_]Feature{ |
| 1607 | .sve, | 1607 | .sve, |
| 1608 | }), | 1608 | }), |
| 1609 | }; | 1609 | }; |
| 1610 | result[@intFromEnum(Feature.sve_bfscale)] = .{ | 1610 | result[@backingInt(Feature.sve_bfscale)] = .{ |
| 1611 | .llvm_name = "sve-bfscale", | 1611 | .llvm_name = "sve-bfscale", |
| 1612 | .description = "Enable Armv9.6-A SVE BFloat16 scaling instructions", | 1612 | .description = "Enable Armv9.6-A SVE BFloat16 scaling instructions", |
| 1613 | .dependencies = featureSet(&[_]Feature{}), | 1613 | .dependencies = featureSet(&[_]Feature{}), |
| 1614 | }; | 1614 | }; |
| 1615 | result[@intFromEnum(Feature.sve_bitperm)] = .{ | 1615 | result[@backingInt(Feature.sve_bitperm)] = .{ |
| 1616 | .llvm_name = "sve-bitperm", | 1616 | .llvm_name = "sve-bitperm", |
| 1617 | .description = "Enable bit permutation SVE2 instructions", | 1617 | .description = "Enable bit permutation SVE2 instructions", |
| 1618 | .dependencies = featureSet(&[_]Feature{}), | 1618 | .dependencies = featureSet(&[_]Feature{}), |
| 1619 | }; | 1619 | }; |
| 1620 | result[@intFromEnum(Feature.sve_f16f32mm)] = .{ | 1620 | result[@backingInt(Feature.sve_f16f32mm)] = .{ |
| 1621 | .llvm_name = "sve-f16f32mm", | 1621 | .llvm_name = "sve-f16f32mm", |
| 1622 | .description = "Enable Armv9.6-A FP16 to FP32 Matrix Multiply instructions", | 1622 | .description = "Enable Armv9.6-A FP16 to FP32 Matrix Multiply instructions", |
| 1623 | .dependencies = featureSet(&[_]Feature{ | 1623 | .dependencies = featureSet(&[_]Feature{ |
| 1624 | .sve, | 1624 | .sve, |
| 1625 | }), | 1625 | }), |
| 1626 | }; | 1626 | }; |
| 1627 | result[@intFromEnum(Feature.sve_sha3)] = .{ | 1627 | result[@backingInt(Feature.sve_sha3)] = .{ |
| 1628 | .llvm_name = "sve-sha3", | 1628 | .llvm_name = "sve-sha3", |
| 1629 | .description = "Enable SVE SHA3 instructions", | 1629 | .description = "Enable SVE SHA3 instructions", |
| 1630 | .dependencies = featureSet(&[_]Feature{ | 1630 | .dependencies = featureSet(&[_]Feature{ |
| 1631 | .sha3, | 1631 | .sha3, |
| 1632 | }), | 1632 | }), |
| 1633 | }; | 1633 | }; |
| 1634 | result[@intFromEnum(Feature.sve_sm4)] = .{ | 1634 | result[@backingInt(Feature.sve_sm4)] = .{ |
| 1635 | .llvm_name = "sve-sm4", | 1635 | .llvm_name = "sve-sm4", |
| 1636 | .description = "Enable SVE SM4 instructions", | 1636 | .description = "Enable SVE SM4 instructions", |
| 1637 | .dependencies = featureSet(&[_]Feature{ | 1637 | .dependencies = featureSet(&[_]Feature{ |
| 1638 | .sm4, | 1638 | .sm4, |
| 1639 | }), | 1639 | }), |
| 1640 | }; | 1640 | }; |
| 1641 | result[@intFromEnum(Feature.tagged_globals)] = .{ | 1641 | result[@backingInt(Feature.tagged_globals)] = .{ |
| 1642 | .llvm_name = "tagged-globals", | 1642 | .llvm_name = "tagged-globals", |
| 1643 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits", | 1643 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits", |
| 1644 | .dependencies = featureSet(&[_]Feature{}), | 1644 | .dependencies = featureSet(&[_]Feature{}), |
| 1645 | }; | 1645 | }; |
| 1646 | result[@intFromEnum(Feature.tev)] = .{ | 1646 | result[@backingInt(Feature.tev)] = .{ |
| 1647 | .llvm_name = "tev", | 1647 | .llvm_name = "tev", |
| 1648 | .description = "Enable TIndex Exception-like Vector instructions", | 1648 | .description = "Enable TIndex Exception-like Vector instructions", |
| 1649 | .dependencies = featureSet(&[_]Feature{}), | 1649 | .dependencies = featureSet(&[_]Feature{}), |
| 1650 | }; | 1650 | }; |
| 1651 | result[@intFromEnum(Feature.the)] = .{ | 1651 | result[@backingInt(Feature.the)] = .{ |
| 1652 | .llvm_name = "the", | 1652 | .llvm_name = "the", |
| 1653 | .description = "Enable Armv8.9-A Translation Hardening Extension", | 1653 | .description = "Enable Armv8.9-A Translation Hardening Extension", |
| 1654 | .dependencies = featureSet(&[_]Feature{}), | 1654 | .dependencies = featureSet(&[_]Feature{}), |
| 1655 | }; | 1655 | }; |
| 1656 | result[@intFromEnum(Feature.tlb_rmi)] = .{ | 1656 | result[@backingInt(Feature.tlb_rmi)] = .{ |
| 1657 | .llvm_name = "tlb-rmi", | 1657 | .llvm_name = "tlb-rmi", |
| 1658 | .description = "Enable Armv8.4-A TLB Range and Maintenance instructions", | 1658 | .description = "Enable Armv8.4-A TLB Range and Maintenance instructions", |
| 1659 | .dependencies = featureSet(&[_]Feature{}), | 1659 | .dependencies = featureSet(&[_]Feature{}), |
| 1660 | }; | 1660 | }; |
| 1661 | result[@intFromEnum(Feature.tlbid)] = .{ | 1661 | result[@backingInt(Feature.tlbid)] = .{ |
| 1662 | .llvm_name = "tlbid", | 1662 | .llvm_name = "tlbid", |
| 1663 | .description = "Enable Armv9.7-A TLBI Domains extension", | 1663 | .description = "Enable Armv9.7-A TLBI Domains extension", |
| 1664 | .dependencies = featureSet(&[_]Feature{}), | 1664 | .dependencies = featureSet(&[_]Feature{}), |
| 1665 | }; | 1665 | }; |
| 1666 | result[@intFromEnum(Feature.tlbiw)] = .{ | 1666 | result[@backingInt(Feature.tlbiw)] = .{ |
| 1667 | .llvm_name = "tlbiw", | 1667 | .llvm_name = "tlbiw", |
| 1668 | .description = "Enable Armv9.5-A TLBI VMALL for Dirty State", | 1668 | .description = "Enable Armv9.5-A TLBI VMALL for Dirty State", |
| 1669 | .dependencies = featureSet(&[_]Feature{}), | 1669 | .dependencies = featureSet(&[_]Feature{}), |
| 1670 | }; | 1670 | }; |
| 1671 | result[@intFromEnum(Feature.tpidr_el1)] = .{ | 1671 | result[@backingInt(Feature.tpidr_el1)] = .{ |
| 1672 | .llvm_name = "tpidr-el1", | 1672 | .llvm_name = "tpidr-el1", |
| 1673 | .description = "Permit use of TPIDR_EL1 for the TLS base", | 1673 | .description = "Permit use of TPIDR_EL1 for the TLS base", |
| 1674 | .dependencies = featureSet(&[_]Feature{}), | 1674 | .dependencies = featureSet(&[_]Feature{}), |
| 1675 | }; | 1675 | }; |
| 1676 | result[@intFromEnum(Feature.tpidr_el2)] = .{ | 1676 | result[@backingInt(Feature.tpidr_el2)] = .{ |
| 1677 | .llvm_name = "tpidr-el2", | 1677 | .llvm_name = "tpidr-el2", |
| 1678 | .description = "Permit use of TPIDR_EL2 for the TLS base", | 1678 | .description = "Permit use of TPIDR_EL2 for the TLS base", |
| 1679 | .dependencies = featureSet(&[_]Feature{}), | 1679 | .dependencies = featureSet(&[_]Feature{}), |
| 1680 | }; | 1680 | }; |
| 1681 | result[@intFromEnum(Feature.tpidr_el3)] = .{ | 1681 | result[@backingInt(Feature.tpidr_el3)] = .{ |
| 1682 | .llvm_name = "tpidr-el3", | 1682 | .llvm_name = "tpidr-el3", |
| 1683 | .description = "Permit use of TPIDR_EL3 for the TLS base", | 1683 | .description = "Permit use of TPIDR_EL3 for the TLS base", |
| 1684 | .dependencies = featureSet(&[_]Feature{}), | 1684 | .dependencies = featureSet(&[_]Feature{}), |
| 1685 | }; | 1685 | }; |
| 1686 | result[@intFromEnum(Feature.tpidrro_el0)] = .{ | 1686 | result[@backingInt(Feature.tpidrro_el0)] = .{ |
| 1687 | .llvm_name = "tpidrro-el0", | 1687 | .llvm_name = "tpidrro-el0", |
| 1688 | .description = "Permit use of TPIDRRO_EL0 for the TLS base", | 1688 | .description = "Permit use of TPIDRRO_EL0 for the TLS base", |
| 1689 | .dependencies = featureSet(&[_]Feature{}), | 1689 | .dependencies = featureSet(&[_]Feature{}), |
| 1690 | }; | 1690 | }; |
| 1691 | result[@intFromEnum(Feature.tracev8_4)] = .{ | 1691 | result[@backingInt(Feature.tracev8_4)] = .{ |
| 1692 | .llvm_name = "tracev8.4", | 1692 | .llvm_name = "tracev8.4", |
| 1693 | .description = "Enable Armv8.4-A Trace extension", | 1693 | .description = "Enable Armv8.4-A Trace extension", |
| 1694 | .dependencies = featureSet(&[_]Feature{}), | 1694 | .dependencies = featureSet(&[_]Feature{}), |
| 1695 | }; | 1695 | }; |
| 1696 | result[@intFromEnum(Feature.trbe)] = .{ | 1696 | result[@backingInt(Feature.trbe)] = .{ |
| 1697 | .llvm_name = "trbe", | 1697 | .llvm_name = "trbe", |
| 1698 | .description = "Enable Trace Buffer Extension", | 1698 | .description = "Enable Trace Buffer Extension", |
| 1699 | .dependencies = featureSet(&[_]Feature{}), | 1699 | .dependencies = featureSet(&[_]Feature{}), |
| 1700 | }; | 1700 | }; |
| 1701 | result[@intFromEnum(Feature.uaops)] = .{ | 1701 | result[@backingInt(Feature.uaops)] = .{ |
| 1702 | .llvm_name = "uaops", | 1702 | .llvm_name = "uaops", |
| 1703 | .description = "Enable Armv8.2-A UAO PState", | 1703 | .description = "Enable Armv8.2-A UAO PState", |
| 1704 | .dependencies = featureSet(&[_]Feature{}), | 1704 | .dependencies = featureSet(&[_]Feature{}), |
| 1705 | }; | 1705 | }; |
| 1706 | result[@intFromEnum(Feature.use_experimental_zeroing_pseudos)] = .{ | 1706 | result[@backingInt(Feature.use_experimental_zeroing_pseudos)] = .{ |
| 1707 | .llvm_name = "use-experimental-zeroing-pseudos", | 1707 | .llvm_name = "use-experimental-zeroing-pseudos", |
| 1708 | .description = "Hint to the compiler that the MOVPRFX instruction is merged with destructive operations", | 1708 | .description = "Hint to the compiler that the MOVPRFX instruction is merged with destructive operations", |
| 1709 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "use-fixed-over-scalable-if-equal-cost", | 1712 | .llvm_name = "use-fixed-over-scalable-if-equal-cost", |
| 1713 | .description = "Prefer fixed width loop vectorization over scalable if the cost-model assigns equal costs", | 1713 | .description = "Prefer fixed width loop vectorization over scalable if the cost-model assigns equal costs", |
| 1714 | .dependencies = featureSet(&[_]Feature{}), | 1714 | .dependencies = featureSet(&[_]Feature{}), |
| 1715 | }; | 1715 | }; |
| 1716 | result[@intFromEnum(Feature.use_postra_scheduler)] = .{ | 1716 | result[@backingInt(Feature.use_postra_scheduler)] = .{ |
| 1717 | .llvm_name = "use-postra-scheduler", | 1717 | .llvm_name = "use-postra-scheduler", |
| 1718 | .description = "Schedule again after register allocation", | 1718 | .description = "Schedule again after register allocation", |
| 1719 | .dependencies = featureSet(&[_]Feature{}), | 1719 | .dependencies = featureSet(&[_]Feature{}), |
| 1720 | }; | 1720 | }; |
| 1721 | result[@intFromEnum(Feature.use_reciprocal_square_root)] = .{ | 1721 | result[@backingInt(Feature.use_reciprocal_square_root)] = .{ |
| 1722 | .llvm_name = "use-reciprocal-square-root", | 1722 | .llvm_name = "use-reciprocal-square-root", |
| 1723 | .description = "Use the reciprocal square root approximation", | 1723 | .description = "Use the reciprocal square root approximation", |
| 1724 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "use-wzr-to-vec-move", | 1727 | .llvm_name = "use-wzr-to-vec-move", |
| 1728 | .description = "Move from WZR to insert 0 into vector registers", | 1728 | .description = "Move from WZR to insert 0 into vector registers", |
| 1729 | .dependencies = featureSet(&[_]Feature{}), | 1729 | .dependencies = featureSet(&[_]Feature{}), |
| 1730 | }; | 1730 | }; |
| 1731 | result[@intFromEnum(Feature.v8_1a)] = .{ | 1731 | result[@backingInt(Feature.v8_1a)] = .{ |
| 1732 | .llvm_name = "v8.1a", | 1732 | .llvm_name = "v8.1a", |
| 1733 | .description = "Support ARM v8.1a architecture", | 1733 | .description = "Support ARM v8.1a architecture", |
| 1734 | .dependencies = featureSet(&[_]Feature{ | 1734 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1741,7 +1741,7 @@ pub const all_features = blk: { | ... | @@ -1741,7 +1741,7 @@ pub const all_features = blk: { |
| 1741 | .vh, | 1741 | .vh, |
| 1742 | }), | 1742 | }), |
| 1743 | }; | 1743 | }; |
| 1744 | result[@intFromEnum(Feature.v8_2a)] = .{ | 1744 | result[@backingInt(Feature.v8_2a)] = .{ |
| 1745 | .llvm_name = "v8.2a", | 1745 | .llvm_name = "v8.2a", |
| 1746 | .description = "Support ARM v8.2a architecture", | 1746 | .description = "Support ARM v8.2a architecture", |
| 1747 | .dependencies = featureSet(&[_]Feature{ | 1747 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1752,7 +1752,7 @@ pub const all_features = blk: { | ... | @@ -1752,7 +1752,7 @@ pub const all_features = blk: { |
| 1752 | .v8_1a, | 1752 | .v8_1a, |
| 1753 | }), | 1753 | }), |
| 1754 | }; | 1754 | }; |
| 1755 | result[@intFromEnum(Feature.v8_3a)] = .{ | 1755 | result[@backingInt(Feature.v8_3a)] = .{ |
| 1756 | .llvm_name = "v8.3a", | 1756 | .llvm_name = "v8.3a", |
| 1757 | .description = "Support ARM v8.3a architecture", | 1757 | .description = "Support ARM v8.3a architecture", |
| 1758 | .dependencies = featureSet(&[_]Feature{ | 1758 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1764,7 +1764,7 @@ pub const all_features = blk: { | ... | @@ -1764,7 +1764,7 @@ pub const all_features = blk: { |
| 1764 | .v8_2a, | 1764 | .v8_2a, |
| 1765 | }), | 1765 | }), |
| 1766 | }; | 1766 | }; |
| 1767 | result[@intFromEnum(Feature.v8_4a)] = .{ | 1767 | result[@backingInt(Feature.v8_4a)] = .{ |
| 1768 | .llvm_name = "v8.4a", | 1768 | .llvm_name = "v8.4a", |
| 1769 | .description = "Support ARM v8.4a architecture", | 1769 | .description = "Support ARM v8.4a architecture", |
| 1770 | .dependencies = featureSet(&[_]Feature{ | 1770 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1782,7 +1782,7 @@ pub const all_features = blk: { | ... | @@ -1782,7 +1782,7 @@ pub const all_features = blk: { |
| 1782 | .v8_3a, | 1782 | .v8_3a, |
| 1783 | }), | 1783 | }), |
| 1784 | }; | 1784 | }; |
| 1785 | result[@intFromEnum(Feature.v8_5a)] = .{ | 1785 | result[@backingInt(Feature.v8_5a)] = .{ |
| 1786 | .llvm_name = "v8.5a", | 1786 | .llvm_name = "v8.5a", |
| 1787 | .description = "Support ARM v8.5a architecture", | 1787 | .description = "Support ARM v8.5a architecture", |
| 1788 | .dependencies = featureSet(&[_]Feature{ | 1788 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1797,7 +1797,7 @@ pub const all_features = blk: { | ... | @@ -1797,7 +1797,7 @@ pub const all_features = blk: { |
| 1797 | .v8_4a, | 1797 | .v8_4a, |
| 1798 | }), | 1798 | }), |
| 1799 | }; | 1799 | }; |
| 1800 | result[@intFromEnum(Feature.v8_6a)] = .{ | 1800 | result[@backingInt(Feature.v8_6a)] = .{ |
| 1801 | .llvm_name = "v8.6a", | 1801 | .llvm_name = "v8.6a", |
| 1802 | .description = "Support ARM v8.6a architecture", | 1802 | .description = "Support ARM v8.6a architecture", |
| 1803 | .dependencies = featureSet(&[_]Feature{ | 1803 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1809,7 +1809,7 @@ pub const all_features = blk: { | ... | @@ -1809,7 +1809,7 @@ pub const all_features = blk: { |
| 1809 | .v8_5a, | 1809 | .v8_5a, |
| 1810 | }), | 1810 | }), |
| 1811 | }; | 1811 | }; |
| 1812 | result[@intFromEnum(Feature.v8_7a)] = .{ | 1812 | result[@backingInt(Feature.v8_7a)] = .{ |
| 1813 | .llvm_name = "v8.7a", | 1813 | .llvm_name = "v8.7a", |
| 1814 | .description = "Support ARM v8.7a architecture", | 1814 | .description = "Support ARM v8.7a architecture", |
| 1815 | .dependencies = featureSet(&[_]Feature{ | 1815 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1820,7 +1820,7 @@ pub const all_features = blk: { | ... | @@ -1820,7 +1820,7 @@ pub const all_features = blk: { |
| 1820 | .xs, | 1820 | .xs, |
| 1821 | }), | 1821 | }), |
| 1822 | }; | 1822 | }; |
| 1823 | result[@intFromEnum(Feature.v8_8a)] = .{ | 1823 | result[@backingInt(Feature.v8_8a)] = .{ |
| 1824 | .llvm_name = "v8.8a", | 1824 | .llvm_name = "v8.8a", |
| 1825 | .description = "Support ARM v8.8a architecture", | 1825 | .description = "Support ARM v8.8a architecture", |
| 1826 | .dependencies = featureSet(&[_]Feature{ | 1826 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1830,7 +1830,7 @@ pub const all_features = blk: { | ... | @@ -1830,7 +1830,7 @@ pub const all_features = blk: { |
| 1830 | .v8_7a, | 1830 | .v8_7a, |
| 1831 | }), | 1831 | }), |
| 1832 | }; | 1832 | }; |
| 1833 | result[@intFromEnum(Feature.v8_9a)] = .{ | 1833 | result[@backingInt(Feature.v8_9a)] = .{ |
| 1834 | .llvm_name = "v8.9a", | 1834 | .llvm_name = "v8.9a", |
| 1835 | .description = "Support ARM v8.9a architecture", | 1835 | .description = "Support ARM v8.9a architecture", |
| 1836 | .dependencies = featureSet(&[_]Feature{ | 1836 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1843,7 +1843,7 @@ pub const all_features = blk: { | ... | @@ -1843,7 +1843,7 @@ pub const all_features = blk: { |
| 1843 | .v8_8a, | 1843 | .v8_8a, |
| 1844 | }), | 1844 | }), |
| 1845 | }; | 1845 | }; |
| 1846 | result[@intFromEnum(Feature.v8a)] = .{ | 1846 | result[@backingInt(Feature.v8a)] = .{ |
| 1847 | .llvm_name = "v8a", | 1847 | .llvm_name = "v8a", |
| 1848 | .description = "Support ARM v8a architecture", | 1848 | .description = "Support ARM v8a architecture", |
| 1849 | .dependencies = featureSet(&[_]Feature{ | 1849 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1852,7 +1852,7 @@ pub const all_features = blk: { | ... | @@ -1852,7 +1852,7 @@ pub const all_features = blk: { |
| 1852 | .neon, | 1852 | .neon, |
| 1853 | }), | 1853 | }), |
| 1854 | }; | 1854 | }; |
| 1855 | result[@intFromEnum(Feature.v8r)] = .{ | 1855 | result[@backingInt(Feature.v8r)] = .{ |
| 1856 | .llvm_name = "v8r", | 1856 | .llvm_name = "v8r", |
| 1857 | .description = "Support ARM v8r architecture", | 1857 | .description = "Support ARM v8r architecture", |
| 1858 | .dependencies = featureSet(&[_]Feature{ | 1858 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1881,7 +1881,7 @@ pub const all_features = blk: { | ... | @@ -1881,7 +1881,7 @@ pub const all_features = blk: { |
| 1881 | .uaops, | 1881 | .uaops, |
| 1882 | }), | 1882 | }), |
| 1883 | }; | 1883 | }; |
| 1884 | result[@intFromEnum(Feature.v9_1a)] = .{ | 1884 | result[@backingInt(Feature.v9_1a)] = .{ |
| 1885 | .llvm_name = "v9.1a", | 1885 | .llvm_name = "v9.1a", |
| 1886 | .description = "Support ARM v9.1a architecture", | 1886 | .description = "Support ARM v9.1a architecture", |
| 1887 | .dependencies = featureSet(&[_]Feature{ | 1887 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1890,7 +1890,7 @@ pub const all_features = blk: { | ... | @@ -1890,7 +1890,7 @@ pub const all_features = blk: { |
| 1890 | .v9a, | 1890 | .v9a, |
| 1891 | }), | 1891 | }), |
| 1892 | }; | 1892 | }; |
| 1893 | result[@intFromEnum(Feature.v9_2a)] = .{ | 1893 | result[@backingInt(Feature.v9_2a)] = .{ |
| 1894 | .llvm_name = "v9.2a", | 1894 | .llvm_name = "v9.2a", |
| 1895 | .description = "Support ARM v9.2a architecture", | 1895 | .description = "Support ARM v9.2a architecture", |
| 1896 | .dependencies = featureSet(&[_]Feature{ | 1896 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1899,7 +1899,7 @@ pub const all_features = blk: { | ... | @@ -1899,7 +1899,7 @@ pub const all_features = blk: { |
| 1899 | .v9_1a, | 1899 | .v9_1a, |
| 1900 | }), | 1900 | }), |
| 1901 | }; | 1901 | }; |
| 1902 | result[@intFromEnum(Feature.v9_3a)] = .{ | 1902 | result[@backingInt(Feature.v9_3a)] = .{ |
| 1903 | .llvm_name = "v9.3a", | 1903 | .llvm_name = "v9.3a", |
| 1904 | .description = "Support ARM v9.3a architecture", | 1904 | .description = "Support ARM v9.3a architecture", |
| 1905 | .dependencies = featureSet(&[_]Feature{ | 1905 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1907,7 +1907,7 @@ pub const all_features = blk: { | ... | @@ -1907,7 +1907,7 @@ pub const all_features = blk: { |
| 1907 | .v9_2a, | 1907 | .v9_2a, |
| 1908 | }), | 1908 | }), |
| 1909 | }; | 1909 | }; |
| 1910 | result[@intFromEnum(Feature.v9_4a)] = .{ | 1910 | result[@backingInt(Feature.v9_4a)] = .{ |
| 1911 | .llvm_name = "v9.4a", | 1911 | .llvm_name = "v9.4a", |
| 1912 | .description = "Support ARM v9.4a architecture", | 1912 | .description = "Support ARM v9.4a architecture", |
| 1913 | .dependencies = featureSet(&[_]Feature{ | 1913 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1916,7 +1916,7 @@ pub const all_features = blk: { | ... | @@ -1916,7 +1916,7 @@ pub const all_features = blk: { |
| 1916 | .v9_3a, | 1916 | .v9_3a, |
| 1917 | }), | 1917 | }), |
| 1918 | }; | 1918 | }; |
| 1919 | result[@intFromEnum(Feature.v9_5a)] = .{ | 1919 | result[@backingInt(Feature.v9_5a)] = .{ |
| 1920 | .llvm_name = "v9.5a", | 1920 | .llvm_name = "v9.5a", |
| 1921 | .description = "Support ARM v9.5a architecture", | 1921 | .description = "Support ARM v9.5a architecture", |
| 1922 | .dependencies = featureSet(&[_]Feature{ | 1922 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1926,7 +1926,7 @@ pub const all_features = blk: { | ... | @@ -1926,7 +1926,7 @@ pub const all_features = blk: { |
| 1926 | .v9_4a, | 1926 | .v9_4a, |
| 1927 | }), | 1927 | }), |
| 1928 | }; | 1928 | }; |
| 1929 | result[@intFromEnum(Feature.v9_6a)] = .{ | 1929 | result[@backingInt(Feature.v9_6a)] = .{ |
| 1930 | .llvm_name = "v9.6a", | 1930 | .llvm_name = "v9.6a", |
| 1931 | .description = "Support ARM v9.6a architecture", | 1931 | .description = "Support ARM v9.6a architecture", |
| 1932 | .dependencies = featureSet(&[_]Feature{ | 1932 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1936,7 +1936,7 @@ pub const all_features = blk: { | ... | @@ -1936,7 +1936,7 @@ pub const all_features = blk: { |
| 1936 | .v9_5a, | 1936 | .v9_5a, |
| 1937 | }), | 1937 | }), |
| 1938 | }; | 1938 | }; |
| 1939 | result[@intFromEnum(Feature.v9_7a)] = .{ | 1939 | result[@backingInt(Feature.v9_7a)] = .{ |
| 1940 | .llvm_name = "v9.7a", | 1940 | .llvm_name = "v9.7a", |
| 1941 | .description = "Support ARM v9.7a architecture", | 1941 | .description = "Support ARM v9.7a architecture", |
| 1942 | .dependencies = featureSet(&[_]Feature{ | 1942 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1946,7 +1946,7 @@ pub const all_features = blk: { | ... | @@ -1946,7 +1946,7 @@ pub const all_features = blk: { |
| 1946 | .v9_6a, | 1946 | .v9_6a, |
| 1947 | }), | 1947 | }), |
| 1948 | }; | 1948 | }; |
| 1949 | result[@intFromEnum(Feature.v9a)] = .{ | 1949 | result[@backingInt(Feature.v9a)] = .{ |
| 1950 | .llvm_name = "v9a", | 1950 | .llvm_name = "v9a", |
| 1951 | .description = "Support ARM v9a architecture", | 1951 | .description = "Support ARM v9a architecture", |
| 1952 | .dependencies = featureSet(&[_]Feature{ | 1952 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1954,64 +1954,64 @@ pub const all_features = blk: { | ... | @@ -1954,64 +1954,64 @@ pub const all_features = blk: { |
| 1954 | .v8_5a, | 1954 | .v8_5a, |
| 1955 | }), | 1955 | }), |
| 1956 | }; | 1956 | }; |
| 1957 | result[@intFromEnum(Feature.vh)] = .{ | 1957 | result[@backingInt(Feature.vh)] = .{ |
| 1958 | .llvm_name = "vh", | 1958 | .llvm_name = "vh", |
| 1959 | .description = "Enable Armv8.1-A Virtual Host extension", | 1959 | .description = "Enable Armv8.1-A Virtual Host extension", |
| 1960 | .dependencies = featureSet(&[_]Feature{ | 1960 | .dependencies = featureSet(&[_]Feature{ |
| 1961 | .contextidr_el2, | 1961 | .contextidr_el2, |
| 1962 | }), | 1962 | }), |
| 1963 | }; | 1963 | }; |
| 1964 | result[@intFromEnum(Feature.wfxt)] = .{ | 1964 | result[@backingInt(Feature.wfxt)] = .{ |
| 1965 | .llvm_name = "wfxt", | 1965 | .llvm_name = "wfxt", |
| 1966 | .description = "Enable Armv8.7-A WFET and WFIT instruction", | 1966 | .description = "Enable Armv8.7-A WFET and WFIT instruction", |
| 1967 | .dependencies = featureSet(&[_]Feature{}), | 1967 | .dependencies = featureSet(&[_]Feature{}), |
| 1968 | }; | 1968 | }; |
| 1969 | result[@intFromEnum(Feature.xs)] = .{ | 1969 | result[@backingInt(Feature.xs)] = .{ |
| 1970 | .llvm_name = "xs", | 1970 | .llvm_name = "xs", |
| 1971 | .description = "Enable Armv8.7-A limited-TLB-maintenance instruction", | 1971 | .description = "Enable Armv8.7-A limited-TLB-maintenance instruction", |
| 1972 | .dependencies = featureSet(&[_]Feature{}), | 1972 | .dependencies = featureSet(&[_]Feature{}), |
| 1973 | }; | 1973 | }; |
| 1974 | result[@intFromEnum(Feature.zcm_fpr128)] = .{ | 1974 | result[@backingInt(Feature.zcm_fpr128)] = .{ |
| 1975 | .llvm_name = "zcm-fpr128", | 1975 | .llvm_name = "zcm-fpr128", |
| 1976 | .description = "Has zero-cycle register moves for FPR128 registers", | 1976 | .description = "Has zero-cycle register moves for FPR128 registers", |
| 1977 | .dependencies = featureSet(&[_]Feature{}), | 1977 | .dependencies = featureSet(&[_]Feature{}), |
| 1978 | }; | 1978 | }; |
| 1979 | result[@intFromEnum(Feature.zcm_fpr32)] = .{ | 1979 | result[@backingInt(Feature.zcm_fpr32)] = .{ |
| 1980 | .llvm_name = "zcm-fpr32", | 1980 | .llvm_name = "zcm-fpr32", |
| 1981 | .description = "Has zero-cycle register moves for FPR32 registers", | 1981 | .description = "Has zero-cycle register moves for FPR32 registers", |
| 1982 | .dependencies = featureSet(&[_]Feature{}), | 1982 | .dependencies = featureSet(&[_]Feature{}), |
| 1983 | }; | 1983 | }; |
| 1984 | result[@intFromEnum(Feature.zcm_fpr64)] = .{ | 1984 | result[@backingInt(Feature.zcm_fpr64)] = .{ |
| 1985 | .llvm_name = "zcm-fpr64", | 1985 | .llvm_name = "zcm-fpr64", |
| 1986 | .description = "Has zero-cycle register moves for FPR64 registers", | 1986 | .description = "Has zero-cycle register moves for FPR64 registers", |
| 1987 | .dependencies = featureSet(&[_]Feature{}), | 1987 | .dependencies = featureSet(&[_]Feature{}), |
| 1988 | }; | 1988 | }; |
| 1989 | result[@intFromEnum(Feature.zcm_gpr32)] = .{ | 1989 | result[@backingInt(Feature.zcm_gpr32)] = .{ |
| 1990 | .llvm_name = "zcm-gpr32", | 1990 | .llvm_name = "zcm-gpr32", |
| 1991 | .description = "Has zero-cycle register moves for GPR32 registers", | 1991 | .description = "Has zero-cycle register moves for GPR32 registers", |
| 1992 | .dependencies = featureSet(&[_]Feature{}), | 1992 | .dependencies = featureSet(&[_]Feature{}), |
| 1993 | }; | 1993 | }; |
| 1994 | result[@intFromEnum(Feature.zcm_gpr64)] = .{ | 1994 | result[@backingInt(Feature.zcm_gpr64)] = .{ |
| 1995 | .llvm_name = "zcm-gpr64", | 1995 | .llvm_name = "zcm-gpr64", |
| 1996 | .description = "Has zero-cycle register moves for GPR64 registers", | 1996 | .description = "Has zero-cycle register moves for GPR64 registers", |
| 1997 | .dependencies = featureSet(&[_]Feature{}), | 1997 | .dependencies = featureSet(&[_]Feature{}), |
| 1998 | }; | 1998 | }; |
| 1999 | result[@intFromEnum(Feature.zcz_fp_workaround)] = .{ | 1999 | result[@backingInt(Feature.zcz_fp_workaround)] = .{ |
| 2000 | .llvm_name = "zcz-fp-workaround", | 2000 | .llvm_name = "zcz-fp-workaround", |
| 2001 | .description = "The zero-cycle floating-point zeroing instruction has a bug", | 2001 | .description = "The zero-cycle floating-point zeroing instruction has a bug", |
| 2002 | .dependencies = featureSet(&[_]Feature{}), | 2002 | .dependencies = featureSet(&[_]Feature{}), |
| 2003 | }; | 2003 | }; |
| 2004 | result[@intFromEnum(Feature.zcz_fpr128)] = .{ | 2004 | result[@backingInt(Feature.zcz_fpr128)] = .{ |
| 2005 | .llvm_name = "zcz-fpr128", | 2005 | .llvm_name = "zcz-fpr128", |
| 2006 | .description = "Has zero-cycle zeroing instructions for FPR128 registers", | 2006 | .description = "Has zero-cycle zeroing instructions for FPR128 registers", |
| 2007 | .dependencies = featureSet(&[_]Feature{}), | 2007 | .dependencies = featureSet(&[_]Feature{}), |
| 2008 | }; | 2008 | }; |
| 2009 | result[@intFromEnum(Feature.zcz_gpr32)] = .{ | 2009 | result[@backingInt(Feature.zcz_gpr32)] = .{ |
| 2010 | .llvm_name = "zcz-gpr32", | 2010 | .llvm_name = "zcz-gpr32", |
| 2011 | .description = "Has zero-cycle zeroing instructions for GPR32 registers", | 2011 | .description = "Has zero-cycle zeroing instructions for GPR32 registers", |
| 2012 | .dependencies = featureSet(&[_]Feature{}), | 2012 | .dependencies = featureSet(&[_]Feature{}), |
| 2013 | }; | 2013 | }; |
| 2014 | result[@intFromEnum(Feature.zcz_gpr64)] = .{ | 2014 | result[@backingInt(Feature.zcz_gpr64)] = .{ |
| 2015 | .llvm_name = "zcz-gpr64", | 2015 | .llvm_name = "zcz-gpr64", |
| 2016 | .description = "Has zero-cycle zeroing instructions for GPR64 registers", | 2016 | .description = "Has zero-cycle zeroing instructions for GPR64 registers", |
| 2017 | .dependencies = featureSet(&[_]Feature{}), | 2017 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/alpha.zig+4-4| ... | @@ -20,22 +20,22 @@ pub const all_features = blk: { | ... | @@ -20,22 +20,22 @@ pub const all_features = blk: { |
| 20 | const len = @typeInfo(Feature).@"enum".field_names.len; | 20 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 21 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 21 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 22 | var result: [len]CpuFeature = undefined; | 22 | var result: [len]CpuFeature = undefined; |
| 23 | result[@intFromEnum(Feature.bwx)] = .{ | 23 | result[@backingInt(Feature.bwx)] = .{ |
| 24 | .llvm_name = null, | 24 | .llvm_name = null, |
| 25 | .description = "Enable byte/word extensions", | 25 | .description = "Enable byte/word extensions", |
| 26 | .dependencies = featureSet(&[_]Feature{}), | 26 | .dependencies = featureSet(&[_]Feature{}), |
| 27 | }; | 27 | }; |
| 28 | result[@intFromEnum(Feature.cix)] = .{ | 28 | result[@backingInt(Feature.cix)] = .{ |
| 29 | .llvm_name = null, | 29 | .llvm_name = null, |
| 30 | .description = "Enable counting extensions", | 30 | .description = "Enable counting extensions", |
| 31 | .dependencies = featureSet(&[_]Feature{}), | 31 | .dependencies = featureSet(&[_]Feature{}), |
| 32 | }; | 32 | }; |
| 33 | result[@intFromEnum(Feature.fix)] = .{ | 33 | result[@backingInt(Feature.fix)] = .{ |
| 34 | .llvm_name = null, | 34 | .llvm_name = null, |
| 35 | .description = "Enable floating point move and square root extensions", | 35 | .description = "Enable floating point move and square root extensions", |
| 36 | .dependencies = featureSet(&[_]Feature{}), | 36 | .dependencies = featureSet(&[_]Feature{}), |
| 37 | }; | 37 | }; |
| 38 | result[@intFromEnum(Feature.max)] = .{ | 38 | result[@backingInt(Feature.max)] = .{ |
| 39 | .llvm_name = null, | 39 | .llvm_name = null, |
| 40 | .description = "Enable motion video extensions", | 40 | .description = "Enable motion video extensions", |
| 41 | .dependencies = featureSet(&[_]Feature{}), | 41 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/amdgcn.zig+254-254| ... | @@ -271,556 +271,556 @@ pub const all_features = blk: { | ... | @@ -271,556 +271,556 @@ pub const all_features = blk: { |
| 271 | const len = @typeInfo(Feature).@"enum".field_names.len; | 271 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 272 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 272 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 273 | var result: [len]CpuFeature = undefined; | 273 | var result: [len]CpuFeature = undefined; |
| 274 | result[@intFromEnum(Feature.@"1024_addressable_vgprs")] = .{ | 274 | result[@backingInt(Feature.@"1024_addressable_vgprs")] = .{ |
| 275 | .llvm_name = "1024-addressable-vgprs", | 275 | .llvm_name = "1024-addressable-vgprs", |
| 276 | .description = "Has 1024 addressable VGPRs", | 276 | .description = "Has 1024 addressable VGPRs", |
| 277 | .dependencies = featureSet(&[_]Feature{}), | 277 | .dependencies = featureSet(&[_]Feature{}), |
| 278 | }; | 278 | }; |
| 279 | result[@intFromEnum(Feature.@"16_bit_insts")] = .{ | 279 | result[@backingInt(Feature.@"16_bit_insts")] = .{ |
| 280 | .llvm_name = "16-bit-insts", | 280 | .llvm_name = "16-bit-insts", |
| 281 | .description = "Has i16/f16 instructions", | 281 | .description = "Has i16/f16 instructions", |
| 282 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "45-bit-num-records-buffer-resource", | 285 | .llvm_name = "45-bit-num-records-buffer-resource", |
| 286 | .description = "The buffer resource (V#) supports 45-bit num_records", | 286 | .description = "The buffer resource (V#) supports 45-bit num_records", |
| 287 | .dependencies = featureSet(&[_]Feature{}), | 287 | .dependencies = featureSet(&[_]Feature{}), |
| 288 | }; | 288 | }; |
| 289 | result[@intFromEnum(Feature.@"64_bit_literals")] = .{ | 289 | result[@backingInt(Feature.@"64_bit_literals")] = .{ |
| 290 | .llvm_name = "64-bit-literals", | 290 | .llvm_name = "64-bit-literals", |
| 291 | .description = "Can use 64-bit literals with single DWORD instructions", | 291 | .description = "Can use 64-bit literals with single DWORD instructions", |
| 292 | .dependencies = featureSet(&[_]Feature{}), | 292 | .dependencies = featureSet(&[_]Feature{}), |
| 293 | }; | 293 | }; |
| 294 | result[@intFromEnum(Feature.a16)] = .{ | 294 | result[@backingInt(Feature.a16)] = .{ |
| 295 | .llvm_name = "a16", | 295 | .llvm_name = "a16", |
| 296 | .description = "Support A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands", | 296 | .description = "Support A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands", |
| 297 | .dependencies = featureSet(&[_]Feature{}), | 297 | .dependencies = featureSet(&[_]Feature{}), |
| 298 | }; | 298 | }; |
| 299 | result[@intFromEnum(Feature.add_min_max_insts)] = .{ | 299 | result[@backingInt(Feature.add_min_max_insts)] = .{ |
| 300 | .llvm_name = "add-min-max-insts", | 300 | .llvm_name = "add-min-max-insts", |
| 301 | .description = "Has v_add_{min|max}_{i|u}32 instructions", | 301 | .description = "Has v_add_{min|max}_{i|u}32 instructions", |
| 302 | .dependencies = featureSet(&[_]Feature{}), | 302 | .dependencies = featureSet(&[_]Feature{}), |
| 303 | }; | 303 | }; |
| 304 | result[@intFromEnum(Feature.add_no_carry_insts)] = .{ | 304 | result[@backingInt(Feature.add_no_carry_insts)] = .{ |
| 305 | .llvm_name = "add-no-carry-insts", | 305 | .llvm_name = "add-no-carry-insts", |
| 306 | .description = "Have VALU add/sub instructions without carry out", | 306 | .description = "Have VALU add/sub instructions without carry out", |
| 307 | .dependencies = featureSet(&[_]Feature{}), | 307 | .dependencies = featureSet(&[_]Feature{}), |
| 308 | }; | 308 | }; |
| 309 | result[@intFromEnum(Feature.add_sub_u64_insts)] = .{ | 309 | result[@backingInt(Feature.add_sub_u64_insts)] = .{ |
| 310 | .llvm_name = "add-sub-u64-insts", | 310 | .llvm_name = "add-sub-u64-insts", |
| 311 | .description = "Has v_add_u64 and v_sub_u64 instructions", | 311 | .description = "Has v_add_u64 and v_sub_u64 instructions", |
| 312 | .dependencies = featureSet(&[_]Feature{}), | 312 | .dependencies = featureSet(&[_]Feature{}), |
| 313 | }; | 313 | }; |
| 314 | result[@intFromEnum(Feature.addressablelocalmemorysize163840)] = .{ | 314 | result[@backingInt(Feature.addressablelocalmemorysize163840)] = .{ |
| 315 | .llvm_name = "addressablelocalmemorysize163840", | 315 | .llvm_name = "addressablelocalmemorysize163840", |
| 316 | .description = "The size of local memory in bytes", | 316 | .description = "The size of local memory in bytes", |
| 317 | .dependencies = featureSet(&[_]Feature{}), | 317 | .dependencies = featureSet(&[_]Feature{}), |
| 318 | }; | 318 | }; |
| 319 | result[@intFromEnum(Feature.addressablelocalmemorysize32768)] = .{ | 319 | result[@backingInt(Feature.addressablelocalmemorysize32768)] = .{ |
| 320 | .llvm_name = "addressablelocalmemorysize32768", | 320 | .llvm_name = "addressablelocalmemorysize32768", |
| 321 | .description = "The size of local memory in bytes", | 321 | .description = "The size of local memory in bytes", |
| 322 | .dependencies = featureSet(&[_]Feature{}), | 322 | .dependencies = featureSet(&[_]Feature{}), |
| 323 | }; | 323 | }; |
| 324 | result[@intFromEnum(Feature.addressablelocalmemorysize327680)] = .{ | 324 | result[@backingInt(Feature.addressablelocalmemorysize327680)] = .{ |
| 325 | .llvm_name = "addressablelocalmemorysize327680", | 325 | .llvm_name = "addressablelocalmemorysize327680", |
| 326 | .description = "The size of local memory in bytes", | 326 | .description = "The size of local memory in bytes", |
| 327 | .dependencies = featureSet(&[_]Feature{}), | 327 | .dependencies = featureSet(&[_]Feature{}), |
| 328 | }; | 328 | }; |
| 329 | result[@intFromEnum(Feature.addressablelocalmemorysize65536)] = .{ | 329 | result[@backingInt(Feature.addressablelocalmemorysize65536)] = .{ |
| 330 | .llvm_name = "addressablelocalmemorysize65536", | 330 | .llvm_name = "addressablelocalmemorysize65536", |
| 331 | .description = "The size of local memory in bytes", | 331 | .description = "The size of local memory in bytes", |
| 332 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "agent-scope-fine-grained-remote-memory-atomics", | 335 | .llvm_name = "agent-scope-fine-grained-remote-memory-atomics", |
| 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.", | 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 | .dependencies = featureSet(&[_]Feature{}), | 337 | .dependencies = featureSet(&[_]Feature{}), |
| 338 | }; | 338 | }; |
| 339 | result[@intFromEnum(Feature.allocate1_5xvgprs)] = .{ | 339 | result[@backingInt(Feature.allocate1_5xvgprs)] = .{ |
| 340 | .llvm_name = "allocate1_5xvgprs", | 340 | .llvm_name = "allocate1_5xvgprs", |
| 341 | .description = "Has 50% more physical VGPRs and 50% larger allocation granule", | 341 | .description = "Has 50% more physical VGPRs and 50% larger allocation granule", |
| 342 | .dependencies = featureSet(&[_]Feature{}), | 342 | .dependencies = featureSet(&[_]Feature{}), |
| 343 | }; | 343 | }; |
| 344 | result[@intFromEnum(Feature.aperture_regs)] = .{ | 344 | result[@backingInt(Feature.aperture_regs)] = .{ |
| 345 | .llvm_name = "aperture-regs", | 345 | .llvm_name = "aperture-regs", |
| 346 | .description = "Has Memory Aperture Base and Size Registers", | 346 | .description = "Has Memory Aperture Base and Size Registers", |
| 347 | .dependencies = featureSet(&[_]Feature{}), | 347 | .dependencies = featureSet(&[_]Feature{}), |
| 348 | }; | 348 | }; |
| 349 | result[@intFromEnum(Feature.architected_flat_scratch)] = .{ | 349 | result[@backingInt(Feature.architected_flat_scratch)] = .{ |
| 350 | .llvm_name = "architected-flat-scratch", | 350 | .llvm_name = "architected-flat-scratch", |
| 351 | .description = "Flat Scratch register is a readonly SPI initialized architected register", | 351 | .description = "Flat Scratch register is a readonly SPI initialized architected register", |
| 352 | .dependencies = featureSet(&[_]Feature{}), | 352 | .dependencies = featureSet(&[_]Feature{}), |
| 353 | }; | 353 | }; |
| 354 | result[@intFromEnum(Feature.architected_sgprs)] = .{ | 354 | result[@backingInt(Feature.architected_sgprs)] = .{ |
| 355 | .llvm_name = "architected-sgprs", | 355 | .llvm_name = "architected-sgprs", |
| 356 | .description = "Enable the architected SGPRs", | 356 | .description = "Enable the architected SGPRs", |
| 357 | .dependencies = featureSet(&[_]Feature{}), | 357 | .dependencies = featureSet(&[_]Feature{}), |
| 358 | }; | 358 | }; |
| 359 | result[@intFromEnum(Feature.ashr_pk_insts)] = .{ | 359 | result[@backingInt(Feature.ashr_pk_insts)] = .{ |
| 360 | .llvm_name = "ashr-pk-insts", | 360 | .llvm_name = "ashr-pk-insts", |
| 361 | .description = "Has Arithmetic Shift Pack instructions", | 361 | .description = "Has Arithmetic Shift Pack instructions", |
| 362 | .dependencies = featureSet(&[_]Feature{}), | 362 | .dependencies = featureSet(&[_]Feature{}), |
| 363 | }; | 363 | }; |
| 364 | result[@intFromEnum(Feature.assembler_permissive_wavesize)] = .{ | 364 | result[@backingInt(Feature.assembler_permissive_wavesize)] = .{ |
| 365 | .llvm_name = "assembler-permissive-wavesize", | 365 | .llvm_name = "assembler-permissive-wavesize", |
| 366 | .description = "allow parsing wave32 and wave64 variants of instructions", | 366 | .description = "allow parsing wave32 and wave64 variants of instructions", |
| 367 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "atomic-buffer-global-pk-add-f16-insts", | 370 | .llvm_name = "atomic-buffer-global-pk-add-f16-insts", |
| 371 | .description = "Has buffer_atomic_pk_add_f16 and global_atomic_pk_add_f16 instructions that can return original value", | 371 | .description = "Has buffer_atomic_pk_add_f16 and global_atomic_pk_add_f16 instructions that can return original value", |
| 372 | .dependencies = featureSet(&[_]Feature{ | 372 | .dependencies = featureSet(&[_]Feature{ |
| 373 | .flat_global_insts, | 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 | .llvm_name = "atomic-buffer-global-pk-add-f16-no-rtn-insts", | 377 | .llvm_name = "atomic-buffer-global-pk-add-f16-no-rtn-insts", |
| 378 | .description = "Has buffer_atomic_pk_add_f16 and global_atomic_pk_add_f16 instructions that don't return original value", | 378 | .description = "Has buffer_atomic_pk_add_f16 and global_atomic_pk_add_f16 instructions that don't return original value", |
| 379 | .dependencies = featureSet(&[_]Feature{ | 379 | .dependencies = featureSet(&[_]Feature{ |
| 380 | .flat_global_insts, | 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 | .llvm_name = "atomic-buffer-pk-add-bf16-inst", | 384 | .llvm_name = "atomic-buffer-pk-add-bf16-inst", |
| 385 | .description = "Has buffer_atomic_pk_add_bf16 instruction", | 385 | .description = "Has buffer_atomic_pk_add_bf16 instruction", |
| 386 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "atomic-csub-no-rtn-insts", | 389 | .llvm_name = "atomic-csub-no-rtn-insts", |
| 390 | .description = "Has buffer_atomic_csub and global_atomic_csub instructions that don't return original value", | 390 | .description = "Has buffer_atomic_csub and global_atomic_csub instructions that don't return original value", |
| 391 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "atomic-ds-pk-add-16-insts", | 394 | .llvm_name = "atomic-ds-pk-add-16-insts", |
| 395 | .description = "Has ds_pk_add_bf16, ds_pk_add_f16, ds_pk_add_rtn_bf16, ds_pk_add_rtn_f16 instructions", | 395 | .description = "Has ds_pk_add_bf16, ds_pk_add_f16, ds_pk_add_rtn_bf16, ds_pk_add_rtn_f16 instructions", |
| 396 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "atomic-fadd-no-rtn-insts", | 399 | .llvm_name = "atomic-fadd-no-rtn-insts", |
| 400 | .description = "Has buffer_atomic_add_f32 and global_atomic_add_f32 instructions that don't return original value", | 400 | .description = "Has buffer_atomic_add_f32 and global_atomic_add_f32 instructions that don't return original value", |
| 401 | .dependencies = featureSet(&[_]Feature{ | 401 | .dependencies = featureSet(&[_]Feature{ |
| 402 | .flat_global_insts, | 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 | .llvm_name = "atomic-fadd-rtn-insts", | 406 | .llvm_name = "atomic-fadd-rtn-insts", |
| 407 | .description = "Has buffer_atomic_add_f32 and global_atomic_add_f32 instructions that return original value", | 407 | .description = "Has buffer_atomic_add_f32 and global_atomic_add_f32 instructions that return original value", |
| 408 | .dependencies = featureSet(&[_]Feature{ | 408 | .dependencies = featureSet(&[_]Feature{ |
| 409 | .flat_global_insts, | 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 | .llvm_name = "atomic-flat-pk-add-16-insts", | 413 | .llvm_name = "atomic-flat-pk-add-16-insts", |
| 414 | .description = "Has flat_atomic_pk_add_f16 and flat_atomic_pk_add_bf16 instructions", | 414 | .description = "Has flat_atomic_pk_add_f16 and flat_atomic_pk_add_bf16 instructions", |
| 415 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "atomic-fmin-fmax-flat-f32", | 418 | .llvm_name = "atomic-fmin-fmax-flat-f32", |
| 419 | .description = "Has flat memory instructions for atomicrmw fmin/fmax for float", | 419 | .description = "Has flat memory instructions for atomicrmw fmin/fmax for float", |
| 420 | .dependencies = featureSet(&[_]Feature{ | 420 | .dependencies = featureSet(&[_]Feature{ |
| 421 | .flat_address_space, | 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 | .llvm_name = "atomic-fmin-fmax-flat-f64", | 425 | .llvm_name = "atomic-fmin-fmax-flat-f64", |
| 426 | .description = "Has flat memory instructions for atomicrmw fmin/fmax for double", | 426 | .description = "Has flat memory instructions for atomicrmw fmin/fmax for double", |
| 427 | .dependencies = featureSet(&[_]Feature{ | 427 | .dependencies = featureSet(&[_]Feature{ |
| 428 | .flat_address_space, | 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 | .llvm_name = "atomic-fmin-fmax-global-f32", | 432 | .llvm_name = "atomic-fmin-fmax-global-f32", |
| 433 | .description = "Has global/buffer instructions for atomicrmw fmin/fmax for float", | 433 | .description = "Has global/buffer instructions for atomicrmw fmin/fmax for float", |
| 434 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "atomic-fmin-fmax-global-f64", | 437 | .llvm_name = "atomic-fmin-fmax-global-f64", |
| 438 | .description = "Has global/buffer instructions for atomicrmw fmin/fmax for float", | 438 | .description = "Has global/buffer instructions for atomicrmw fmin/fmax for float", |
| 439 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "atomic-global-pk-add-bf16-inst", | 442 | .llvm_name = "atomic-global-pk-add-bf16-inst", |
| 443 | .description = "Has global_atomic_pk_add_bf16 instruction", | 443 | .description = "Has global_atomic_pk_add_bf16 instruction", |
| 444 | .dependencies = featureSet(&[_]Feature{ | 444 | .dependencies = featureSet(&[_]Feature{ |
| 445 | .flat_global_insts, | 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 | .llvm_name = "auto-waitcnt-before-barrier", | 449 | .llvm_name = "auto-waitcnt-before-barrier", |
| 450 | .description = "Hardware automatically inserts waitcnt before barrier", | 450 | .description = "Hardware automatically inserts waitcnt before barrier", |
| 451 | .dependencies = featureSet(&[_]Feature{}), | 451 | .dependencies = featureSet(&[_]Feature{}), |
| 452 | }; | 452 | }; |
| 453 | result[@intFromEnum(Feature.back_off_barrier)] = .{ | 453 | result[@backingInt(Feature.back_off_barrier)] = .{ |
| 454 | .llvm_name = "back-off-barrier", | 454 | .llvm_name = "back-off-barrier", |
| 455 | .description = "Hardware supports backing off s_barrier if an exception occurs", | 455 | .description = "Hardware supports backing off s_barrier if an exception occurs", |
| 456 | .dependencies = featureSet(&[_]Feature{}), | 456 | .dependencies = featureSet(&[_]Feature{}), |
| 457 | }; | 457 | }; |
| 458 | result[@intFromEnum(Feature.bf16_cvt_insts)] = .{ | 458 | result[@backingInt(Feature.bf16_cvt_insts)] = .{ |
| 459 | .llvm_name = "bf16-cvt-insts", | 459 | .llvm_name = "bf16-cvt-insts", |
| 460 | .description = "Has bf16 conversion instructions", | 460 | .description = "Has bf16 conversion instructions", |
| 461 | .dependencies = featureSet(&[_]Feature{}), | 461 | .dependencies = featureSet(&[_]Feature{}), |
| 462 | }; | 462 | }; |
| 463 | result[@intFromEnum(Feature.bf16_pk_insts)] = .{ | 463 | result[@backingInt(Feature.bf16_pk_insts)] = .{ |
| 464 | .llvm_name = "bf16-pk-insts", | 464 | .llvm_name = "bf16-pk-insts", |
| 465 | .description = "Has bf16 packed instructions (fma, add, mul, max, min)", | 465 | .description = "Has bf16 packed instructions (fma, add, mul, max, min)", |
| 466 | .dependencies = featureSet(&[_]Feature{}), | 466 | .dependencies = featureSet(&[_]Feature{}), |
| 467 | }; | 467 | }; |
| 468 | result[@intFromEnum(Feature.bf16_trans_insts)] = .{ | 468 | result[@backingInt(Feature.bf16_trans_insts)] = .{ |
| 469 | .llvm_name = "bf16-trans-insts", | 469 | .llvm_name = "bf16-trans-insts", |
| 470 | .description = "Has bf16 transcendental instructions", | 470 | .description = "Has bf16 transcendental instructions", |
| 471 | .dependencies = featureSet(&[_]Feature{}), | 471 | .dependencies = featureSet(&[_]Feature{}), |
| 472 | }; | 472 | }; |
| 473 | result[@intFromEnum(Feature.bf8_cvt_scale_insts)] = .{ | 473 | result[@backingInt(Feature.bf8_cvt_scale_insts)] = .{ |
| 474 | .llvm_name = "bf8-cvt-scale-insts", | 474 | .llvm_name = "bf8-cvt-scale-insts", |
| 475 | .description = "Has bf8 conversion scale instructions", | 475 | .description = "Has bf8 conversion scale instructions", |
| 476 | .dependencies = featureSet(&[_]Feature{}), | 476 | .dependencies = featureSet(&[_]Feature{}), |
| 477 | }; | 477 | }; |
| 478 | result[@intFromEnum(Feature.bitop3_insts)] = .{ | 478 | result[@backingInt(Feature.bitop3_insts)] = .{ |
| 479 | .llvm_name = "bitop3-insts", | 479 | .llvm_name = "bitop3-insts", |
| 480 | .description = "Has v_bitop3_b32/v_bitop3_b16 instructions", | 480 | .description = "Has v_bitop3_b32/v_bitop3_b16 instructions", |
| 481 | .dependencies = featureSet(&[_]Feature{}), | 481 | .dependencies = featureSet(&[_]Feature{}), |
| 482 | }; | 482 | }; |
| 483 | result[@intFromEnum(Feature.block_vgpr_csr)] = .{ | 483 | result[@backingInt(Feature.block_vgpr_csr)] = .{ |
| 484 | .llvm_name = "block-vgpr-csr", | 484 | .llvm_name = "block-vgpr-csr", |
| 485 | .description = "Use block load/store for VGPR callee saved registers", | 485 | .description = "Use block load/store for VGPR callee saved registers", |
| 486 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "bvh-dual-bvh-8-insts", | 489 | .llvm_name = "bvh-dual-bvh-8-insts", |
| 490 | .description = "Has image_bvh_dual_intersect_ray and image_bvh8_intersect_ray instructions", | 490 | .description = "Has image_bvh_dual_intersect_ray and image_bvh8_intersect_ray instructions", |
| 491 | .dependencies = featureSet(&[_]Feature{}), | 491 | .dependencies = featureSet(&[_]Feature{}), |
| 492 | }; | 492 | }; |
| 493 | result[@intFromEnum(Feature.ci_insts)] = .{ | 493 | result[@backingInt(Feature.ci_insts)] = .{ |
| 494 | .llvm_name = "ci-insts", | 494 | .llvm_name = "ci-insts", |
| 495 | .description = "Additional instructions for CI+", | 495 | .description = "Additional instructions for CI+", |
| 496 | .dependencies = featureSet(&[_]Feature{}), | 496 | .dependencies = featureSet(&[_]Feature{}), |
| 497 | }; | 497 | }; |
| 498 | result[@intFromEnum(Feature.clusters)] = .{ | 498 | result[@backingInt(Feature.clusters)] = .{ |
| 499 | .llvm_name = "clusters", | 499 | .llvm_name = "clusters", |
| 500 | .description = "Has clusters of workgroups support", | 500 | .description = "Has clusters of workgroups support", |
| 501 | .dependencies = featureSet(&[_]Feature{}), | 501 | .dependencies = featureSet(&[_]Feature{}), |
| 502 | }; | 502 | }; |
| 503 | result[@intFromEnum(Feature.cube_insts)] = .{ | 503 | result[@backingInt(Feature.cube_insts)] = .{ |
| 504 | .llvm_name = "cube-insts", | 504 | .llvm_name = "cube-insts", |
| 505 | .description = "Has v_cube* instructions", | 505 | .description = "Has v_cube* instructions", |
| 506 | .dependencies = featureSet(&[_]Feature{}), | 506 | .dependencies = featureSet(&[_]Feature{}), |
| 507 | }; | 507 | }; |
| 508 | result[@intFromEnum(Feature.cumode)] = .{ | 508 | result[@backingInt(Feature.cumode)] = .{ |
| 509 | .llvm_name = "cumode", | 509 | .llvm_name = "cumode", |
| 510 | .description = "Enable CU wavefront execution mode", | 510 | .description = "Enable CU wavefront execution mode", |
| 511 | .dependencies = featureSet(&[_]Feature{}), | 511 | .dependencies = featureSet(&[_]Feature{}), |
| 512 | }; | 512 | }; |
| 513 | result[@intFromEnum(Feature.cvt_fp8_vop1_bug)] = .{ | 513 | result[@backingInt(Feature.cvt_fp8_vop1_bug)] = .{ |
| 514 | .llvm_name = "cvt-fp8-vop1-bug", | 514 | .llvm_name = "cvt-fp8-vop1-bug", |
| 515 | .description = "FP8/BF8 VOP1 form of conversion to F32 is unreliable", | 515 | .description = "FP8/BF8 VOP1 form of conversion to F32 is unreliable", |
| 516 | .dependencies = featureSet(&[_]Feature{ | 516 | .dependencies = featureSet(&[_]Feature{ |
| 517 | .fp8_conversion_insts, | 517 | .fp8_conversion_insts, |
| 518 | }), | 518 | }), |
| 519 | }; | 519 | }; |
| 520 | result[@intFromEnum(Feature.cvt_norm_insts)] = .{ | 520 | result[@backingInt(Feature.cvt_norm_insts)] = .{ |
| 521 | .llvm_name = "cvt-norm-insts", | 521 | .llvm_name = "cvt-norm-insts", |
| 522 | .description = "Has v_cvt_norm* instructions", | 522 | .description = "Has v_cvt_norm* instructions", |
| 523 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "cvt-pk-f16-f32-inst", | 526 | .llvm_name = "cvt-pk-f16-f32-inst", |
| 527 | .description = "Has cvt_pk_f16_f32 instruction", | 527 | .description = "Has cvt_pk_f16_f32 instruction", |
| 528 | .dependencies = featureSet(&[_]Feature{}), | 528 | .dependencies = featureSet(&[_]Feature{}), |
| 529 | }; | 529 | }; |
| 530 | result[@intFromEnum(Feature.cvt_pknorm_vop2_insts)] = .{ | 530 | result[@backingInt(Feature.cvt_pknorm_vop2_insts)] = .{ |
| 531 | .llvm_name = "cvt-pknorm-vop2-insts", | 531 | .llvm_name = "cvt-pknorm-vop2-insts", |
| 532 | .description = "Has v_cvt_pk_norm_*f32 instructions/Has v_cvt_pk_norm_*_f16 instructions", | 532 | .description = "Has v_cvt_pk_norm_*f32 instructions/Has v_cvt_pk_norm_*_f16 instructions", |
| 533 | .dependencies = featureSet(&[_]Feature{}), | 533 | .dependencies = featureSet(&[_]Feature{}), |
| 534 | }; | 534 | }; |
| 535 | result[@intFromEnum(Feature.cvt_pknorm_vop3_insts)] = .{ | 535 | result[@backingInt(Feature.cvt_pknorm_vop3_insts)] = .{ |
| 536 | .llvm_name = "cvt-pknorm-vop3-insts", | 536 | .llvm_name = "cvt-pknorm-vop3-insts", |
| 537 | .description = "Has v_cvt_pk_norm_*f32 instructions/Has v_cvt_pk_norm_*_f16 instructions", | 537 | .description = "Has v_cvt_pk_norm_*f32 instructions/Has v_cvt_pk_norm_*_f16 instructions", |
| 538 | .dependencies = featureSet(&[_]Feature{}), | 538 | .dependencies = featureSet(&[_]Feature{}), |
| 539 | }; | 539 | }; |
| 540 | result[@intFromEnum(Feature.d16_write_vgpr32)] = .{ | 540 | result[@backingInt(Feature.d16_write_vgpr32)] = .{ |
| 541 | .llvm_name = "d16-write-vgpr32", | 541 | .llvm_name = "d16-write-vgpr32", |
| 542 | .description = "D16 instructions potentially have 32-bit data dependencies", | 542 | .description = "D16 instructions potentially have 32-bit data dependencies", |
| 543 | .dependencies = featureSet(&[_]Feature{}), | 543 | .dependencies = featureSet(&[_]Feature{}), |
| 544 | }; | 544 | }; |
| 545 | result[@intFromEnum(Feature.default_component_broadcast)] = .{ | 545 | result[@backingInt(Feature.default_component_broadcast)] = .{ |
| 546 | .llvm_name = "default-component-broadcast", | 546 | .llvm_name = "default-component-broadcast", |
| 547 | .description = "BUFFER/IMAGE store instructions set unspecified components to x component (GFX12)", | 547 | .description = "BUFFER/IMAGE store instructions set unspecified components to x component (GFX12)", |
| 548 | .dependencies = featureSet(&[_]Feature{}), | 548 | .dependencies = featureSet(&[_]Feature{}), |
| 549 | }; | 549 | }; |
| 550 | result[@intFromEnum(Feature.default_component_zero)] = .{ | 550 | result[@backingInt(Feature.default_component_zero)] = .{ |
| 551 | .llvm_name = "default-component-zero", | 551 | .llvm_name = "default-component-zero", |
| 552 | .description = "BUFFER/IMAGE store instructions set unspecified components to zero (before GFX12)", | 552 | .description = "BUFFER/IMAGE store instructions set unspecified components to zero (before GFX12)", |
| 553 | .dependencies = featureSet(&[_]Feature{}), | 553 | .dependencies = featureSet(&[_]Feature{}), |
| 554 | }; | 554 | }; |
| 555 | result[@intFromEnum(Feature.dl_insts)] = .{ | 555 | result[@backingInt(Feature.dl_insts)] = .{ |
| 556 | .llvm_name = "dl-insts", | 556 | .llvm_name = "dl-insts", |
| 557 | .description = "Has v_fmac_f32 and v_xnor_b32 instructions", | 557 | .description = "Has v_fmac_f32 and v_xnor_b32 instructions", |
| 558 | .dependencies = featureSet(&[_]Feature{}), | 558 | .dependencies = featureSet(&[_]Feature{}), |
| 559 | }; | 559 | }; |
| 560 | result[@intFromEnum(Feature.dot10_insts)] = .{ | 560 | result[@backingInt(Feature.dot10_insts)] = .{ |
| 561 | .llvm_name = "dot10-insts", | 561 | .llvm_name = "dot10-insts", |
| 562 | .description = "Has v_dot2_f32_f16 instruction", | 562 | .description = "Has v_dot2_f32_f16 instruction", |
| 563 | .dependencies = featureSet(&[_]Feature{}), | 563 | .dependencies = featureSet(&[_]Feature{}), |
| 564 | }; | 564 | }; |
| 565 | result[@intFromEnum(Feature.dot11_insts)] = .{ | 565 | result[@backingInt(Feature.dot11_insts)] = .{ |
| 566 | .llvm_name = "dot11-insts", | 566 | .llvm_name = "dot11-insts", |
| 567 | .description = "Has v_dot4_f32_fp8_fp8, v_dot4_f32_fp8_bf8, v_dot4_f32_bf8_fp8, v_dot4_f32_bf8_bf8 instructions", | 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 | .dependencies = featureSet(&[_]Feature{}), | 568 | .dependencies = featureSet(&[_]Feature{}), |
| 569 | }; | 569 | }; |
| 570 | result[@intFromEnum(Feature.dot12_insts)] = .{ | 570 | result[@backingInt(Feature.dot12_insts)] = .{ |
| 571 | .llvm_name = "dot12-insts", | 571 | .llvm_name = "dot12-insts", |
| 572 | .description = "Has v_dot2_f32_bf16 instructions", | 572 | .description = "Has v_dot2_f32_bf16 instructions", |
| 573 | .dependencies = featureSet(&[_]Feature{}), | 573 | .dependencies = featureSet(&[_]Feature{}), |
| 574 | }; | 574 | }; |
| 575 | result[@intFromEnum(Feature.dot13_insts)] = .{ | 575 | result[@backingInt(Feature.dot13_insts)] = .{ |
| 576 | .llvm_name = "dot13-insts", | 576 | .llvm_name = "dot13-insts", |
| 577 | .description = "Has v_dot2c_f32_bf16 instructions", | 577 | .description = "Has v_dot2c_f32_bf16 instructions", |
| 578 | .dependencies = featureSet(&[_]Feature{}), | 578 | .dependencies = featureSet(&[_]Feature{}), |
| 579 | }; | 579 | }; |
| 580 | result[@intFromEnum(Feature.dot1_insts)] = .{ | 580 | result[@backingInt(Feature.dot1_insts)] = .{ |
| 581 | .llvm_name = "dot1-insts", | 581 | .llvm_name = "dot1-insts", |
| 582 | .description = "Has v_dot4_i32_i8 and v_dot8_i32_i4 instructions", | 582 | .description = "Has v_dot4_i32_i8 and v_dot8_i32_i4 instructions", |
| 583 | .dependencies = featureSet(&[_]Feature{}), | 583 | .dependencies = featureSet(&[_]Feature{}), |
| 584 | }; | 584 | }; |
| 585 | result[@intFromEnum(Feature.dot2_insts)] = .{ | 585 | result[@backingInt(Feature.dot2_insts)] = .{ |
| 586 | .llvm_name = "dot2-insts", | 586 | .llvm_name = "dot2-insts", |
| 587 | .description = "Has v_dot2_i32_i16, v_dot2_u32_u16 instructions", | 587 | .description = "Has v_dot2_i32_i16, v_dot2_u32_u16 instructions", |
| 588 | .dependencies = featureSet(&[_]Feature{}), | 588 | .dependencies = featureSet(&[_]Feature{}), |
| 589 | }; | 589 | }; |
| 590 | result[@intFromEnum(Feature.dot3_insts)] = .{ | 590 | result[@backingInt(Feature.dot3_insts)] = .{ |
| 591 | .llvm_name = "dot3-insts", | 591 | .llvm_name = "dot3-insts", |
| 592 | .description = "Has v_dot8c_i32_i4 instruction", | 592 | .description = "Has v_dot8c_i32_i4 instruction", |
| 593 | .dependencies = featureSet(&[_]Feature{}), | 593 | .dependencies = featureSet(&[_]Feature{}), |
| 594 | }; | 594 | }; |
| 595 | result[@intFromEnum(Feature.dot4_insts)] = .{ | 595 | result[@backingInt(Feature.dot4_insts)] = .{ |
| 596 | .llvm_name = "dot4-insts", | 596 | .llvm_name = "dot4-insts", |
| 597 | .description = "Has v_dot2c_i32_i16 instruction", | 597 | .description = "Has v_dot2c_i32_i16 instruction", |
| 598 | .dependencies = featureSet(&[_]Feature{}), | 598 | .dependencies = featureSet(&[_]Feature{}), |
| 599 | }; | 599 | }; |
| 600 | result[@intFromEnum(Feature.dot5_insts)] = .{ | 600 | result[@backingInt(Feature.dot5_insts)] = .{ |
| 601 | .llvm_name = "dot5-insts", | 601 | .llvm_name = "dot5-insts", |
| 602 | .description = "Has v_dot2c_f32_f16 instruction", | 602 | .description = "Has v_dot2c_f32_f16 instruction", |
| 603 | .dependencies = featureSet(&[_]Feature{}), | 603 | .dependencies = featureSet(&[_]Feature{}), |
| 604 | }; | 604 | }; |
| 605 | result[@intFromEnum(Feature.dot6_insts)] = .{ | 605 | result[@backingInt(Feature.dot6_insts)] = .{ |
| 606 | .llvm_name = "dot6-insts", | 606 | .llvm_name = "dot6-insts", |
| 607 | .description = "Has v_dot4c_i32_i8 instruction", | 607 | .description = "Has v_dot4c_i32_i8 instruction", |
| 608 | .dependencies = featureSet(&[_]Feature{}), | 608 | .dependencies = featureSet(&[_]Feature{}), |
| 609 | }; | 609 | }; |
| 610 | result[@intFromEnum(Feature.dot7_insts)] = .{ | 610 | result[@backingInt(Feature.dot7_insts)] = .{ |
| 611 | .llvm_name = "dot7-insts", | 611 | .llvm_name = "dot7-insts", |
| 612 | .description = "Has v_dot4_u32_u8, v_dot8_u32_u4 instructions", | 612 | .description = "Has v_dot4_u32_u8, v_dot8_u32_u4 instructions", |
| 613 | .dependencies = featureSet(&[_]Feature{}), | 613 | .dependencies = featureSet(&[_]Feature{}), |
| 614 | }; | 614 | }; |
| 615 | result[@intFromEnum(Feature.dot8_insts)] = .{ | 615 | result[@backingInt(Feature.dot8_insts)] = .{ |
| 616 | .llvm_name = "dot8-insts", | 616 | .llvm_name = "dot8-insts", |
| 617 | .description = "Has v_dot4_i32_iu8, v_dot8_i32_iu4 instructions", | 617 | .description = "Has v_dot4_i32_iu8, v_dot8_i32_iu4 instructions", |
| 618 | .dependencies = featureSet(&[_]Feature{}), | 618 | .dependencies = featureSet(&[_]Feature{}), |
| 619 | }; | 619 | }; |
| 620 | result[@intFromEnum(Feature.dot9_insts)] = .{ | 620 | result[@backingInt(Feature.dot9_insts)] = .{ |
| 621 | .llvm_name = "dot9-insts", | 621 | .llvm_name = "dot9-insts", |
| 622 | .description = "Has v_dot2_f16_f16, v_dot2_bf16_bf16 instructions", | 622 | .description = "Has v_dot2_f16_f16, v_dot2_bf16_bf16 instructions", |
| 623 | .dependencies = featureSet(&[_]Feature{}), | 623 | .dependencies = featureSet(&[_]Feature{}), |
| 624 | }; | 624 | }; |
| 625 | result[@intFromEnum(Feature.dpp)] = .{ | 625 | result[@backingInt(Feature.dpp)] = .{ |
| 626 | .llvm_name = "dpp", | 626 | .llvm_name = "dpp", |
| 627 | .description = "Support DPP (Data Parallel Primitives) extension", | 627 | .description = "Support DPP (Data Parallel Primitives) extension", |
| 628 | .dependencies = featureSet(&[_]Feature{}), | 628 | .dependencies = featureSet(&[_]Feature{}), |
| 629 | }; | 629 | }; |
| 630 | result[@intFromEnum(Feature.dpp8)] = .{ | 630 | result[@backingInt(Feature.dpp8)] = .{ |
| 631 | .llvm_name = "dpp8", | 631 | .llvm_name = "dpp8", |
| 632 | .description = "Support DPP8 (Data Parallel Primitives) extension", | 632 | .description = "Support DPP8 (Data Parallel Primitives) extension", |
| 633 | .dependencies = featureSet(&[_]Feature{}), | 633 | .dependencies = featureSet(&[_]Feature{}), |
| 634 | }; | 634 | }; |
| 635 | result[@intFromEnum(Feature.dpp_64bit)] = .{ | 635 | result[@backingInt(Feature.dpp_64bit)] = .{ |
| 636 | .llvm_name = "dpp-64bit", | 636 | .llvm_name = "dpp-64bit", |
| 637 | .description = "Support DPP (Data Parallel Primitives) extension in DP ALU", | 637 | .description = "Support DPP (Data Parallel Primitives) extension in DP ALU", |
| 638 | .dependencies = featureSet(&[_]Feature{}), | 638 | .dependencies = featureSet(&[_]Feature{}), |
| 639 | }; | 639 | }; |
| 640 | result[@intFromEnum(Feature.dpp_src1_sgpr)] = .{ | 640 | result[@backingInt(Feature.dpp_src1_sgpr)] = .{ |
| 641 | .llvm_name = "dpp-src1-sgpr", | 641 | .llvm_name = "dpp-src1-sgpr", |
| 642 | .description = "Support SGPR for Src1 of DPP instructions", | 642 | .description = "Support SGPR for Src1 of DPP instructions", |
| 643 | .dependencies = featureSet(&[_]Feature{}), | 643 | .dependencies = featureSet(&[_]Feature{}), |
| 644 | }; | 644 | }; |
| 645 | result[@intFromEnum(Feature.ds128)] = .{ | 645 | result[@backingInt(Feature.ds128)] = .{ |
| 646 | .llvm_name = "enable-ds128", | 646 | .llvm_name = "enable-ds128", |
| 647 | .description = "Use ds_{read|write}_b128", | 647 | .description = "Use ds_{read|write}_b128", |
| 648 | .dependencies = featureSet(&[_]Feature{}), | 648 | .dependencies = featureSet(&[_]Feature{}), |
| 649 | }; | 649 | }; |
| 650 | result[@intFromEnum(Feature.ds_src2_insts)] = .{ | 650 | result[@backingInt(Feature.ds_src2_insts)] = .{ |
| 651 | .llvm_name = "ds-src2-insts", | 651 | .llvm_name = "ds-src2-insts", |
| 652 | .description = "Has ds_*_src2 instructions", | 652 | .description = "Has ds_*_src2 instructions", |
| 653 | .dependencies = featureSet(&[_]Feature{}), | 653 | .dependencies = featureSet(&[_]Feature{}), |
| 654 | }; | 654 | }; |
| 655 | result[@intFromEnum(Feature.emulated_system_scope_atomics)] = .{ | 655 | result[@backingInt(Feature.emulated_system_scope_atomics)] = .{ |
| 656 | .llvm_name = "emulated-system-scope-atomics", | 656 | .llvm_name = "emulated-system-scope-atomics", |
| 657 | .description = "System scope atomics unsupported by the PCI-e are emulated in HW via CAS loop and functional.", | 657 | .description = "System scope atomics unsupported by the PCI-e are emulated in HW via CAS loop and functional.", |
| 658 | .dependencies = featureSet(&[_]Feature{}), | 658 | .dependencies = featureSet(&[_]Feature{}), |
| 659 | }; | 659 | }; |
| 660 | result[@intFromEnum(Feature.extended_image_insts)] = .{ | 660 | result[@backingInt(Feature.extended_image_insts)] = .{ |
| 661 | .llvm_name = "extended-image-insts", | 661 | .llvm_name = "extended-image-insts", |
| 662 | .description = "Support mips != 0, lod != 0, gather4, and get_lod", | 662 | .description = "Support mips != 0, lod != 0, gather4, and get_lod", |
| 663 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "f16bf16-to-fp6bf6-cvt-scale-insts", | 666 | .llvm_name = "f16bf16-to-fp6bf6-cvt-scale-insts", |
| 667 | .description = "Has f16bf16 to fp6bf6 conversion scale instructions", | 667 | .description = "Has f16bf16 to fp6bf6 conversion scale instructions", |
| 668 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "f32-to-f16bf16-cvt-sr-insts", | 671 | .llvm_name = "f32-to-f16bf16-cvt-sr-insts", |
| 672 | .description = "Has f32 to f16bf16 conversion scale instructions", | 672 | .description = "Has f32 to f16bf16 conversion scale instructions", |
| 673 | .dependencies = featureSet(&[_]Feature{}), | 673 | .dependencies = featureSet(&[_]Feature{}), |
| 674 | }; | 674 | }; |
| 675 | result[@intFromEnum(Feature.fast_denormal_f32)] = .{ | 675 | result[@backingInt(Feature.fast_denormal_f32)] = .{ |
| 676 | .llvm_name = "fast-denormal-f32", | 676 | .llvm_name = "fast-denormal-f32", |
| 677 | .description = "Enabling denormals does not cause f32 instructions to run at f64 rates", | 677 | .description = "Enabling denormals does not cause f32 instructions to run at f64 rates", |
| 678 | .dependencies = featureSet(&[_]Feature{}), | 678 | .dependencies = featureSet(&[_]Feature{}), |
| 679 | }; | 679 | }; |
| 680 | result[@intFromEnum(Feature.fast_fmaf)] = .{ | 680 | result[@backingInt(Feature.fast_fmaf)] = .{ |
| 681 | .llvm_name = "fast-fmaf", | 681 | .llvm_name = "fast-fmaf", |
| 682 | .description = "Assuming f32 fma is at least as fast as mul + add", | 682 | .description = "Assuming f32 fma is at least as fast as mul + add", |
| 683 | .dependencies = featureSet(&[_]Feature{}), | 683 | .dependencies = featureSet(&[_]Feature{}), |
| 684 | }; | 684 | }; |
| 685 | result[@intFromEnum(Feature.flat_address_space)] = .{ | 685 | result[@backingInt(Feature.flat_address_space)] = .{ |
| 686 | .llvm_name = "flat-address-space", | 686 | .llvm_name = "flat-address-space", |
| 687 | .description = "Support flat address space", | 687 | .description = "Support flat address space", |
| 688 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "flat-atomic-fadd-f32-inst", | 691 | .llvm_name = "flat-atomic-fadd-f32-inst", |
| 692 | .description = "Has flat_atomic_add_f32 instruction", | 692 | .description = "Has flat_atomic_add_f32 instruction", |
| 693 | .dependencies = featureSet(&[_]Feature{ | 693 | .dependencies = featureSet(&[_]Feature{ |
| 694 | .flat_address_space, | 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 | .llvm_name = "flat-buffer-global-fadd-f64-inst", | 698 | .llvm_name = "flat-buffer-global-fadd-f64-inst", |
| 699 | .description = "Has flat, buffer, and global instructions for f64 atomic fadd", | 699 | .description = "Has flat, buffer, and global instructions for f64 atomic fadd", |
| 700 | .dependencies = featureSet(&[_]Feature{}), | 700 | .dependencies = featureSet(&[_]Feature{}), |
| 701 | }; | 701 | }; |
| 702 | result[@intFromEnum(Feature.flat_for_global)] = .{ | 702 | result[@backingInt(Feature.flat_for_global)] = .{ |
| 703 | .llvm_name = "flat-for-global", | 703 | .llvm_name = "flat-for-global", |
| 704 | .description = "Force to generate flat instruction for global", | 704 | .description = "Force to generate flat instruction for global", |
| 705 | .dependencies = featureSet(&[_]Feature{}), | 705 | .dependencies = featureSet(&[_]Feature{}), |
| 706 | }; | 706 | }; |
| 707 | result[@intFromEnum(Feature.flat_global_insts)] = .{ | 707 | result[@backingInt(Feature.flat_global_insts)] = .{ |
| 708 | .llvm_name = "flat-global-insts", | 708 | .llvm_name = "flat-global-insts", |
| 709 | .description = "Have global_* flat memory instructions", | 709 | .description = "Have global_* flat memory instructions", |
| 710 | .dependencies = featureSet(&[_]Feature{ | 710 | .dependencies = featureSet(&[_]Feature{ |
| 711 | .flat_address_space, | 711 | .flat_address_space, |
| 712 | }), | 712 | }), |
| 713 | }; | 713 | }; |
| 714 | result[@intFromEnum(Feature.flat_gvs_mode)] = .{ | 714 | result[@backingInt(Feature.flat_gvs_mode)] = .{ |
| 715 | .llvm_name = "flat-gvs-mode", | 715 | .llvm_name = "flat-gvs-mode", |
| 716 | .description = "Have GVS addressing mode with flat_* instructions", | 716 | .description = "Have GVS addressing mode with flat_* instructions", |
| 717 | .dependencies = featureSet(&[_]Feature{ | 717 | .dependencies = featureSet(&[_]Feature{ |
| 718 | .flat_address_space, | 718 | .flat_address_space, |
| 719 | }), | 719 | }), |
| 720 | }; | 720 | }; |
| 721 | result[@intFromEnum(Feature.flat_inst_offsets)] = .{ | 721 | result[@backingInt(Feature.flat_inst_offsets)] = .{ |
| 722 | .llvm_name = "flat-inst-offsets", | 722 | .llvm_name = "flat-inst-offsets", |
| 723 | .description = "Flat instructions have immediate offset addressing mode", | 723 | .description = "Flat instructions have immediate offset addressing mode", |
| 724 | .dependencies = featureSet(&[_]Feature{}), | 724 | .dependencies = featureSet(&[_]Feature{}), |
| 725 | }; | 725 | }; |
| 726 | result[@intFromEnum(Feature.flat_scratch)] = .{ | 726 | result[@backingInt(Feature.flat_scratch)] = .{ |
| 727 | .llvm_name = "enable-flat-scratch", | 727 | .llvm_name = "enable-flat-scratch", |
| 728 | .description = "Use scratch_* flat memory instructions to access scratch", | 728 | .description = "Use scratch_* flat memory instructions to access scratch", |
| 729 | .dependencies = featureSet(&[_]Feature{}), | 729 | .dependencies = featureSet(&[_]Feature{}), |
| 730 | }; | 730 | }; |
| 731 | result[@intFromEnum(Feature.flat_scratch_insts)] = .{ | 731 | result[@backingInt(Feature.flat_scratch_insts)] = .{ |
| 732 | .llvm_name = "flat-scratch-insts", | 732 | .llvm_name = "flat-scratch-insts", |
| 733 | .description = "Have scratch_* flat memory instructions", | 733 | .description = "Have scratch_* flat memory instructions", |
| 734 | .dependencies = featureSet(&[_]Feature{ | 734 | .dependencies = featureSet(&[_]Feature{ |
| 735 | .flat_address_space, | 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 | .llvm_name = "flat-segment-offset-bug", | 739 | .llvm_name = "flat-segment-offset-bug", |
| 740 | .description = "GFX10 bug where inst_offset is ignored when flat instructions access global memory", | 740 | .description = "GFX10 bug where inst_offset is ignored when flat instructions access global memory", |
| 741 | .dependencies = featureSet(&[_]Feature{}), | 741 | .dependencies = featureSet(&[_]Feature{}), |
| 742 | }; | 742 | }; |
| 743 | result[@intFromEnum(Feature.fma_mix_bf16_insts)] = .{ | 743 | result[@backingInt(Feature.fma_mix_bf16_insts)] = .{ |
| 744 | .llvm_name = "fma-mix-bf16-insts", | 744 | .llvm_name = "fma-mix-bf16-insts", |
| 745 | .description = "Has v_fma_mix_f32_bf16, v_fma_mixlo_bf16, v_fma_mixhi_bf16 instructions", | 745 | .description = "Has v_fma_mix_f32_bf16, v_fma_mixlo_bf16, v_fma_mixhi_bf16 instructions", |
| 746 | .dependencies = featureSet(&[_]Feature{}), | 746 | .dependencies = featureSet(&[_]Feature{}), |
| 747 | }; | 747 | }; |
| 748 | result[@intFromEnum(Feature.fma_mix_insts)] = .{ | 748 | result[@backingInt(Feature.fma_mix_insts)] = .{ |
| 749 | .llvm_name = "fma-mix-insts", | 749 | .llvm_name = "fma-mix-insts", |
| 750 | .description = "Has v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16 instructions", | 750 | .description = "Has v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16 instructions", |
| 751 | .dependencies = featureSet(&[_]Feature{}), | 751 | .dependencies = featureSet(&[_]Feature{}), |
| 752 | }; | 752 | }; |
| 753 | result[@intFromEnum(Feature.fmacf64_inst)] = .{ | 753 | result[@backingInt(Feature.fmacf64_inst)] = .{ |
| 754 | .llvm_name = "fmacf64-inst", | 754 | .llvm_name = "fmacf64-inst", |
| 755 | .description = "Has v_fmac_f64 instruction", | 755 | .description = "Has v_fmac_f64 instruction", |
| 756 | .dependencies = featureSet(&[_]Feature{}), | 756 | .dependencies = featureSet(&[_]Feature{}), |
| 757 | }; | 757 | }; |
| 758 | result[@intFromEnum(Feature.fmaf)] = .{ | 758 | result[@backingInt(Feature.fmaf)] = .{ |
| 759 | .llvm_name = "fmaf", | 759 | .llvm_name = "fmaf", |
| 760 | .description = "Enable single precision FMA (not as fast as mul+add, but fused)", | 760 | .description = "Enable single precision FMA (not as fast as mul+add, but fused)", |
| 761 | .dependencies = featureSet(&[_]Feature{}), | 761 | .dependencies = featureSet(&[_]Feature{}), |
| 762 | }; | 762 | }; |
| 763 | result[@intFromEnum(Feature.fp4_cvt_scale_insts)] = .{ | 763 | result[@backingInt(Feature.fp4_cvt_scale_insts)] = .{ |
| 764 | .llvm_name = "fp4-cvt-scale-insts", | 764 | .llvm_name = "fp4-cvt-scale-insts", |
| 765 | .description = "Has fp4 conversion scale instructions", | 765 | .description = "Has fp4 conversion scale instructions", |
| 766 | .dependencies = featureSet(&[_]Feature{}), | 766 | .dependencies = featureSet(&[_]Feature{}), |
| 767 | }; | 767 | }; |
| 768 | result[@intFromEnum(Feature.fp64)] = .{ | 768 | result[@backingInt(Feature.fp64)] = .{ |
| 769 | .llvm_name = "fp64", | 769 | .llvm_name = "fp64", |
| 770 | .description = "Enable double precision operations", | 770 | .description = "Enable double precision operations", |
| 771 | .dependencies = featureSet(&[_]Feature{}), | 771 | .dependencies = featureSet(&[_]Feature{}), |
| 772 | }; | 772 | }; |
| 773 | result[@intFromEnum(Feature.fp6bf6_cvt_scale_insts)] = .{ | 773 | result[@backingInt(Feature.fp6bf6_cvt_scale_insts)] = .{ |
| 774 | .llvm_name = "fp6bf6-cvt-scale-insts", | 774 | .llvm_name = "fp6bf6-cvt-scale-insts", |
| 775 | .description = "Has fp6 and bf6 conversion scale instructions", | 775 | .description = "Has fp6 and bf6 conversion scale instructions", |
| 776 | .dependencies = featureSet(&[_]Feature{}), | 776 | .dependencies = featureSet(&[_]Feature{}), |
| 777 | }; | 777 | }; |
| 778 | result[@intFromEnum(Feature.fp8_conversion_insts)] = .{ | 778 | result[@backingInt(Feature.fp8_conversion_insts)] = .{ |
| 779 | .llvm_name = "fp8-conversion-insts", | 779 | .llvm_name = "fp8-conversion-insts", |
| 780 | .description = "Has fp8 and bf8 conversion instructions", | 780 | .description = "Has fp8 and bf8 conversion instructions", |
| 781 | .dependencies = featureSet(&[_]Feature{}), | 781 | .dependencies = featureSet(&[_]Feature{}), |
| 782 | }; | 782 | }; |
| 783 | result[@intFromEnum(Feature.fp8_cvt_scale_insts)] = .{ | 783 | result[@backingInt(Feature.fp8_cvt_scale_insts)] = .{ |
| 784 | .llvm_name = "fp8-cvt-scale-insts", | 784 | .llvm_name = "fp8-cvt-scale-insts", |
| 785 | .description = "Has fp8 conversion scale instructions", | 785 | .description = "Has fp8 conversion scale instructions", |
| 786 | .dependencies = featureSet(&[_]Feature{}), | 786 | .dependencies = featureSet(&[_]Feature{}), |
| 787 | }; | 787 | }; |
| 788 | result[@intFromEnum(Feature.fp8_insts)] = .{ | 788 | result[@backingInt(Feature.fp8_insts)] = .{ |
| 789 | .llvm_name = "fp8-insts", | 789 | .llvm_name = "fp8-insts", |
| 790 | .description = "Has fp8 and bf8 instructions", | 790 | .description = "Has fp8 and bf8 instructions", |
| 791 | .dependencies = featureSet(&[_]Feature{}), | 791 | .dependencies = featureSet(&[_]Feature{}), |
| 792 | }; | 792 | }; |
| 793 | result[@intFromEnum(Feature.fp8e5m3_insts)] = .{ | 793 | result[@backingInt(Feature.fp8e5m3_insts)] = .{ |
| 794 | .llvm_name = "fp8e5m3-insts", | 794 | .llvm_name = "fp8e5m3-insts", |
| 795 | .description = "Has fp8 e5m3 format support", | 795 | .description = "Has fp8 e5m3 format support", |
| 796 | .dependencies = featureSet(&[_]Feature{}), | 796 | .dependencies = featureSet(&[_]Feature{}), |
| 797 | }; | 797 | }; |
| 798 | result[@intFromEnum(Feature.full_rate_64_ops)] = .{ | 798 | result[@backingInt(Feature.full_rate_64_ops)] = .{ |
| 799 | .llvm_name = "full-rate-64-ops", | 799 | .llvm_name = "full-rate-64-ops", |
| 800 | .description = "Most fp64 instructions are full rate", | 800 | .description = "Most fp64 instructions are full rate", |
| 801 | .dependencies = featureSet(&[_]Feature{}), | 801 | .dependencies = featureSet(&[_]Feature{}), |
| 802 | }; | 802 | }; |
| 803 | result[@intFromEnum(Feature.g16)] = .{ | 803 | result[@backingInt(Feature.g16)] = .{ |
| 804 | .llvm_name = "g16", | 804 | .llvm_name = "g16", |
| 805 | .description = "Support G16 for 16-bit gradient image operands", | 805 | .description = "Support G16 for 16-bit gradient image operands", |
| 806 | .dependencies = featureSet(&[_]Feature{}), | 806 | .dependencies = featureSet(&[_]Feature{}), |
| 807 | }; | 807 | }; |
| 808 | result[@intFromEnum(Feature.gcn3_encoding)] = .{ | 808 | result[@backingInt(Feature.gcn3_encoding)] = .{ |
| 809 | .llvm_name = "gcn3-encoding", | 809 | .llvm_name = "gcn3-encoding", |
| 810 | .description = "Encoding format for VI", | 810 | .description = "Encoding format for VI", |
| 811 | .dependencies = featureSet(&[_]Feature{}), | 811 | .dependencies = featureSet(&[_]Feature{}), |
| 812 | }; | 812 | }; |
| 813 | result[@intFromEnum(Feature.gds)] = .{ | 813 | result[@backingInt(Feature.gds)] = .{ |
| 814 | .llvm_name = "gds", | 814 | .llvm_name = "gds", |
| 815 | .description = "Has Global Data Share", | 815 | .description = "Has Global Data Share", |
| 816 | .dependencies = featureSet(&[_]Feature{}), | 816 | .dependencies = featureSet(&[_]Feature{}), |
| 817 | }; | 817 | }; |
| 818 | result[@intFromEnum(Feature.get_wave_id_inst)] = .{ | 818 | result[@backingInt(Feature.get_wave_id_inst)] = .{ |
| 819 | .llvm_name = "get-wave-id-inst", | 819 | .llvm_name = "get-wave-id-inst", |
| 820 | .description = "Has s_get_waveid_in_workgroup instruction", | 820 | .description = "Has s_get_waveid_in_workgroup instruction", |
| 821 | .dependencies = featureSet(&[_]Feature{}), | 821 | .dependencies = featureSet(&[_]Feature{}), |
| 822 | }; | 822 | }; |
| 823 | result[@intFromEnum(Feature.gfx10)] = .{ | 823 | result[@backingInt(Feature.gfx10)] = .{ |
| 824 | .llvm_name = "gfx10", | 824 | .llvm_name = "gfx10", |
| 825 | .description = "GFX10 GPU generation", | 825 | .description = "GFX10 GPU generation", |
| 826 | .dependencies = featureSet(&[_]Feature{ | 826 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -883,27 +883,27 @@ pub const all_features = blk: { | ... | @@ -883,27 +883,27 @@ pub const all_features = blk: { |
| 883 | .vscnt, | 883 | .vscnt, |
| 884 | }), | 884 | }), |
| 885 | }; | 885 | }; |
| 886 | result[@intFromEnum(Feature.gfx10_3_insts)] = .{ | 886 | result[@backingInt(Feature.gfx10_3_insts)] = .{ |
| 887 | .llvm_name = "gfx10-3-insts", | 887 | .llvm_name = "gfx10-3-insts", |
| 888 | .description = "Additional instructions for GFX10.3", | 888 | .description = "Additional instructions for GFX10.3", |
| 889 | .dependencies = featureSet(&[_]Feature{}), | 889 | .dependencies = featureSet(&[_]Feature{}), |
| 890 | }; | 890 | }; |
| 891 | result[@intFromEnum(Feature.gfx10_a_encoding)] = .{ | 891 | result[@backingInt(Feature.gfx10_a_encoding)] = .{ |
| 892 | .llvm_name = "gfx10_a-encoding", | 892 | .llvm_name = "gfx10_a-encoding", |
| 893 | .description = "Has BVH ray tracing instructions", | 893 | .description = "Has BVH ray tracing instructions", |
| 894 | .dependencies = featureSet(&[_]Feature{}), | 894 | .dependencies = featureSet(&[_]Feature{}), |
| 895 | }; | 895 | }; |
| 896 | result[@intFromEnum(Feature.gfx10_b_encoding)] = .{ | 896 | result[@backingInt(Feature.gfx10_b_encoding)] = .{ |
| 897 | .llvm_name = "gfx10_b-encoding", | 897 | .llvm_name = "gfx10_b-encoding", |
| 898 | .description = "Encoding format GFX10_B", | 898 | .description = "Encoding format GFX10_B", |
| 899 | .dependencies = featureSet(&[_]Feature{}), | 899 | .dependencies = featureSet(&[_]Feature{}), |
| 900 | }; | 900 | }; |
| 901 | result[@intFromEnum(Feature.gfx10_insts)] = .{ | 901 | result[@backingInt(Feature.gfx10_insts)] = .{ |
| 902 | .llvm_name = "gfx10-insts", | 902 | .llvm_name = "gfx10-insts", |
| 903 | .description = "Additional instructions for GFX10+", | 903 | .description = "Additional instructions for GFX10+", |
| 904 | .dependencies = featureSet(&[_]Feature{}), | 904 | .dependencies = featureSet(&[_]Feature{}), |
| 905 | }; | 905 | }; |
| 906 | result[@intFromEnum(Feature.gfx11)] = .{ | 906 | result[@backingInt(Feature.gfx11)] = .{ |
| 907 | .llvm_name = "gfx11", | 907 | .llvm_name = "gfx11", |
| 908 | .description = "GFX11 GPU generation", | 908 | .description = "GFX11 GPU generation", |
| 909 | .dependencies = featureSet(&[_]Feature{ | 909 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -962,12 +962,12 @@ pub const all_features = blk: { | ... | @@ -962,12 +962,12 @@ pub const all_features = blk: { |
| 962 | .vscnt, | 962 | .vscnt, |
| 963 | }), | 963 | }), |
| 964 | }; | 964 | }; |
| 965 | result[@intFromEnum(Feature.gfx11_insts)] = .{ | 965 | result[@backingInt(Feature.gfx11_insts)] = .{ |
| 966 | .llvm_name = "gfx11-insts", | 966 | .llvm_name = "gfx11-insts", |
| 967 | .description = "Additional instructions for GFX11+", | 967 | .description = "Additional instructions for GFX11+", |
| 968 | .dependencies = featureSet(&[_]Feature{}), | 968 | .dependencies = featureSet(&[_]Feature{}), |
| 969 | }; | 969 | }; |
| 970 | result[@intFromEnum(Feature.gfx12)] = .{ | 970 | result[@backingInt(Feature.gfx12)] = .{ |
| 971 | .llvm_name = "gfx12", | 971 | .llvm_name = "gfx12", |
| 972 | .description = "GFX12 GPU generation", | 972 | .description = "GFX12 GPU generation", |
| 973 | .dependencies = featureSet(&[_]Feature{ | 973 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1019,27 +1019,27 @@ pub const all_features = blk: { | ... | @@ -1019,27 +1019,27 @@ pub const all_features = blk: { |
| 1019 | .vscnt, | 1019 | .vscnt, |
| 1020 | }), | 1020 | }), |
| 1021 | }; | 1021 | }; |
| 1022 | result[@intFromEnum(Feature.gfx1250_insts)] = .{ | 1022 | result[@backingInt(Feature.gfx1250_insts)] = .{ |
| 1023 | .llvm_name = "gfx1250-insts", | 1023 | .llvm_name = "gfx1250-insts", |
| 1024 | .description = "Additional instructions for GFX1250+", | 1024 | .description = "Additional instructions for GFX1250+", |
| 1025 | .dependencies = featureSet(&[_]Feature{}), | 1025 | .dependencies = featureSet(&[_]Feature{}), |
| 1026 | }; | 1026 | }; |
| 1027 | result[@intFromEnum(Feature.gfx12_insts)] = .{ | 1027 | result[@backingInt(Feature.gfx12_insts)] = .{ |
| 1028 | .llvm_name = "gfx12-insts", | 1028 | .llvm_name = "gfx12-insts", |
| 1029 | .description = "Additional instructions for GFX12+", | 1029 | .description = "Additional instructions for GFX12+", |
| 1030 | .dependencies = featureSet(&[_]Feature{}), | 1030 | .dependencies = featureSet(&[_]Feature{}), |
| 1031 | }; | 1031 | }; |
| 1032 | result[@intFromEnum(Feature.gfx7_gfx8_gfx9_insts)] = .{ | 1032 | result[@backingInt(Feature.gfx7_gfx8_gfx9_insts)] = .{ |
| 1033 | .llvm_name = "gfx7-gfx8-gfx9-insts", | 1033 | .llvm_name = "gfx7-gfx8-gfx9-insts", |
| 1034 | .description = "Instructions shared in GFX7, GFX8, GFX9", | 1034 | .description = "Instructions shared in GFX7, GFX8, GFX9", |
| 1035 | .dependencies = featureSet(&[_]Feature{}), | 1035 | .dependencies = featureSet(&[_]Feature{}), |
| 1036 | }; | 1036 | }; |
| 1037 | result[@intFromEnum(Feature.gfx8_insts)] = .{ | 1037 | result[@backingInt(Feature.gfx8_insts)] = .{ |
| 1038 | .llvm_name = "gfx8-insts", | 1038 | .llvm_name = "gfx8-insts", |
| 1039 | .description = "Additional instructions for GFX8+", | 1039 | .description = "Additional instructions for GFX8+", |
| 1040 | .dependencies = featureSet(&[_]Feature{}), | 1040 | .dependencies = featureSet(&[_]Feature{}), |
| 1041 | }; | 1041 | }; |
| 1042 | result[@intFromEnum(Feature.gfx9)] = .{ | 1042 | result[@backingInt(Feature.gfx9)] = .{ |
| 1043 | .llvm_name = "gfx9", | 1043 | .llvm_name = "gfx9", |
| 1044 | .description = "GFX9 GPU generation", | 1044 | .description = "GFX9 GPU generation", |
| 1045 | .dependencies = featureSet(&[_]Feature{ | 1045 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1092,17 +1092,17 @@ pub const all_features = blk: { | ... | @@ -1092,17 +1092,17 @@ pub const all_features = blk: { |
| 1092 | .xnack_support, | 1092 | .xnack_support, |
| 1093 | }), | 1093 | }), |
| 1094 | }; | 1094 | }; |
| 1095 | result[@intFromEnum(Feature.gfx90a_insts)] = .{ | 1095 | result[@backingInt(Feature.gfx90a_insts)] = .{ |
| 1096 | .llvm_name = "gfx90a-insts", | 1096 | .llvm_name = "gfx90a-insts", |
| 1097 | .description = "Additional instructions for GFX90A+", | 1097 | .description = "Additional instructions for GFX90A+", |
| 1098 | .dependencies = featureSet(&[_]Feature{}), | 1098 | .dependencies = featureSet(&[_]Feature{}), |
| 1099 | }; | 1099 | }; |
| 1100 | result[@intFromEnum(Feature.gfx940_insts)] = .{ | 1100 | result[@backingInt(Feature.gfx940_insts)] = .{ |
| 1101 | .llvm_name = "gfx940-insts", | 1101 | .llvm_name = "gfx940-insts", |
| 1102 | .description = "Additional instructions for GFX940+", | 1102 | .description = "Additional instructions for GFX940+", |
| 1103 | .dependencies = featureSet(&[_]Feature{}), | 1103 | .dependencies = featureSet(&[_]Feature{}), |
| 1104 | }; | 1104 | }; |
| 1105 | result[@intFromEnum(Feature.gfx950_insts)] = .{ | 1105 | result[@backingInt(Feature.gfx950_insts)] = .{ |
| 1106 | .llvm_name = "gfx950-insts", | 1106 | .llvm_name = "gfx950-insts", |
| 1107 | .description = "Additional instructions for GFX950+", | 1107 | .description = "Additional instructions for GFX950+", |
| 1108 | .dependencies = featureSet(&[_]Feature{ | 1108 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1120,437 +1120,437 @@ pub const all_features = blk: { | ... | @@ -1120,437 +1120,437 @@ pub const all_features = blk: { |
| 1120 | .permlane32_swap, | 1120 | .permlane32_swap, |
| 1121 | }), | 1121 | }), |
| 1122 | }; | 1122 | }; |
| 1123 | result[@intFromEnum(Feature.gfx9_insts)] = .{ | 1123 | result[@backingInt(Feature.gfx9_insts)] = .{ |
| 1124 | .llvm_name = "gfx9-insts", | 1124 | .llvm_name = "gfx9-insts", |
| 1125 | .description = "Additional instructions for GFX9+", | 1125 | .description = "Additional instructions for GFX9+", |
| 1126 | .dependencies = featureSet(&[_]Feature{}), | 1126 | .dependencies = featureSet(&[_]Feature{}), |
| 1127 | }; | 1127 | }; |
| 1128 | result[@intFromEnum(Feature.globally_addressable_scratch)] = .{ | 1128 | result[@backingInt(Feature.globally_addressable_scratch)] = .{ |
| 1129 | .llvm_name = "globally-addressable-scratch", | 1129 | .llvm_name = "globally-addressable-scratch", |
| 1130 | .description = "FLAT instructions can access scratch memory for any thread in any wave", | 1130 | .description = "FLAT instructions can access scratch memory for any thread in any wave", |
| 1131 | .dependencies = featureSet(&[_]Feature{}), | 1131 | .dependencies = featureSet(&[_]Feature{}), |
| 1132 | }; | 1132 | }; |
| 1133 | result[@intFromEnum(Feature.gws)] = .{ | 1133 | result[@backingInt(Feature.gws)] = .{ |
| 1134 | .llvm_name = "gws", | 1134 | .llvm_name = "gws", |
| 1135 | .description = "Has Global Wave Sync", | 1135 | .description = "Has Global Wave Sync", |
| 1136 | .dependencies = featureSet(&[_]Feature{}), | 1136 | .dependencies = featureSet(&[_]Feature{}), |
| 1137 | }; | 1137 | }; |
| 1138 | result[@intFromEnum(Feature.half_rate_64_ops)] = .{ | 1138 | result[@backingInt(Feature.half_rate_64_ops)] = .{ |
| 1139 | .llvm_name = "half-rate-64-ops", | 1139 | .llvm_name = "half-rate-64-ops", |
| 1140 | .description = "Most fp64 instructions are half rate instead of quarter", | 1140 | .description = "Most fp64 instructions are half rate instead of quarter", |
| 1141 | .dependencies = featureSet(&[_]Feature{}), | 1141 | .dependencies = featureSet(&[_]Feature{}), |
| 1142 | }; | 1142 | }; |
| 1143 | result[@intFromEnum(Feature.ieee_minimum_maximum_insts)] = .{ | 1143 | result[@backingInt(Feature.ieee_minimum_maximum_insts)] = .{ |
| 1144 | .llvm_name = "ieee-minimum-maximum-insts", | 1144 | .llvm_name = "ieee-minimum-maximum-insts", |
| 1145 | .description = "Has v_minimum/maximum_f16/f32/f64, v_minimummaximum/maximumminimum_f16/f32 and v_pk_minimum/maximum_f16 instructions", | 1145 | .description = "Has v_minimum/maximum_f16/f32/f64, v_minimummaximum/maximumminimum_f16/f32 and v_pk_minimum/maximum_f16 instructions", |
| 1146 | .dependencies = featureSet(&[_]Feature{}), | 1146 | .dependencies = featureSet(&[_]Feature{}), |
| 1147 | }; | 1147 | }; |
| 1148 | result[@intFromEnum(Feature.image_gather4_d16_bug)] = .{ | 1148 | result[@backingInt(Feature.image_gather4_d16_bug)] = .{ |
| 1149 | .llvm_name = "image-gather4-d16-bug", | 1149 | .llvm_name = "image-gather4-d16-bug", |
| 1150 | .description = "Image Gather4 D16 hardware bug", | 1150 | .description = "Image Gather4 D16 hardware bug", |
| 1151 | .dependencies = featureSet(&[_]Feature{}), | 1151 | .dependencies = featureSet(&[_]Feature{}), |
| 1152 | }; | 1152 | }; |
| 1153 | result[@intFromEnum(Feature.image_insts)] = .{ | 1153 | result[@backingInt(Feature.image_insts)] = .{ |
| 1154 | .llvm_name = "image-insts", | 1154 | .llvm_name = "image-insts", |
| 1155 | .description = "Support image instructions", | 1155 | .description = "Support image instructions", |
| 1156 | .dependencies = featureSet(&[_]Feature{}), | 1156 | .dependencies = featureSet(&[_]Feature{}), |
| 1157 | }; | 1157 | }; |
| 1158 | result[@intFromEnum(Feature.image_store_d16_bug)] = .{ | 1158 | result[@backingInt(Feature.image_store_d16_bug)] = .{ |
| 1159 | .llvm_name = "image-store-d16-bug", | 1159 | .llvm_name = "image-store-d16-bug", |
| 1160 | .description = "Image Store D16 hardware bug", | 1160 | .description = "Image Store D16 hardware bug", |
| 1161 | .dependencies = featureSet(&[_]Feature{}), | 1161 | .dependencies = featureSet(&[_]Feature{}), |
| 1162 | }; | 1162 | }; |
| 1163 | result[@intFromEnum(Feature.inst_fwd_prefetch_bug)] = .{ | 1163 | result[@backingInt(Feature.inst_fwd_prefetch_bug)] = .{ |
| 1164 | .llvm_name = "inst-fwd-prefetch-bug", | 1164 | .llvm_name = "inst-fwd-prefetch-bug", |
| 1165 | .description = "S_INST_PREFETCH instruction causes shader to hang", | 1165 | .description = "S_INST_PREFETCH instruction causes shader to hang", |
| 1166 | .dependencies = featureSet(&[_]Feature{}), | 1166 | .dependencies = featureSet(&[_]Feature{}), |
| 1167 | }; | 1167 | }; |
| 1168 | result[@intFromEnum(Feature.int_clamp_insts)] = .{ | 1168 | result[@backingInt(Feature.int_clamp_insts)] = .{ |
| 1169 | .llvm_name = "int-clamp-insts", | 1169 | .llvm_name = "int-clamp-insts", |
| 1170 | .description = "Support clamp for integer destination", | 1170 | .description = "Support clamp for integer destination", |
| 1171 | .dependencies = featureSet(&[_]Feature{}), | 1171 | .dependencies = featureSet(&[_]Feature{}), |
| 1172 | }; | 1172 | }; |
| 1173 | result[@intFromEnum(Feature.inv_2pi_inline_imm)] = .{ | 1173 | result[@backingInt(Feature.inv_2pi_inline_imm)] = .{ |
| 1174 | .llvm_name = "inv-2pi-inline-imm", | 1174 | .llvm_name = "inv-2pi-inline-imm", |
| 1175 | .description = "Has 1 / (2 * pi) as inline immediate", | 1175 | .description = "Has 1 / (2 * pi) as inline immediate", |
| 1176 | .dependencies = featureSet(&[_]Feature{}), | 1176 | .dependencies = featureSet(&[_]Feature{}), |
| 1177 | }; | 1177 | }; |
| 1178 | result[@intFromEnum(Feature.kernarg_preload)] = .{ | 1178 | result[@backingInt(Feature.kernarg_preload)] = .{ |
| 1179 | .llvm_name = "kernarg-preload", | 1179 | .llvm_name = "kernarg-preload", |
| 1180 | .description = "Hardware supports preloading of kernel arguments in user SGPRs.", | 1180 | .description = "Hardware supports preloading of kernel arguments in user SGPRs.", |
| 1181 | .dependencies = featureSet(&[_]Feature{}), | 1181 | .dependencies = featureSet(&[_]Feature{}), |
| 1182 | }; | 1182 | }; |
| 1183 | result[@intFromEnum(Feature.lds_barrier_arrive_atomic)] = .{ | 1183 | result[@backingInt(Feature.lds_barrier_arrive_atomic)] = .{ |
| 1184 | .llvm_name = "lds-barrier-arrive-atomic", | 1184 | .llvm_name = "lds-barrier-arrive-atomic", |
| 1185 | .description = "Has LDS barrier-arrive atomic instructions", | 1185 | .description = "Has LDS barrier-arrive atomic instructions", |
| 1186 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "lds-branch-vmem-war-hazard", | 1189 | .llvm_name = "lds-branch-vmem-war-hazard", |
| 1190 | .description = "Switching between LDS and VMEM-tex not waiting VM_VSRC=0", | 1190 | .description = "Switching between LDS and VMEM-tex not waiting VM_VSRC=0", |
| 1191 | .dependencies = featureSet(&[_]Feature{}), | 1191 | .dependencies = featureSet(&[_]Feature{}), |
| 1192 | }; | 1192 | }; |
| 1193 | result[@intFromEnum(Feature.lds_misaligned_bug)] = .{ | 1193 | result[@backingInt(Feature.lds_misaligned_bug)] = .{ |
| 1194 | .llvm_name = "lds-misaligned-bug", | 1194 | .llvm_name = "lds-misaligned-bug", |
| 1195 | .description = "Some GFX10 bug with multi-dword LDS and flat access that is not naturally aligned in WGP mode", | 1195 | .description = "Some GFX10 bug with multi-dword LDS and flat access that is not naturally aligned in WGP mode", |
| 1196 | .dependencies = featureSet(&[_]Feature{}), | 1196 | .dependencies = featureSet(&[_]Feature{}), |
| 1197 | }; | 1197 | }; |
| 1198 | result[@intFromEnum(Feature.ldsbankcount16)] = .{ | 1198 | result[@backingInt(Feature.ldsbankcount16)] = .{ |
| 1199 | .llvm_name = "ldsbankcount16", | 1199 | .llvm_name = "ldsbankcount16", |
| 1200 | .description = "The number of LDS banks per compute unit.", | 1200 | .description = "The number of LDS banks per compute unit.", |
| 1201 | .dependencies = featureSet(&[_]Feature{}), | 1201 | .dependencies = featureSet(&[_]Feature{}), |
| 1202 | }; | 1202 | }; |
| 1203 | result[@intFromEnum(Feature.ldsbankcount32)] = .{ | 1203 | result[@backingInt(Feature.ldsbankcount32)] = .{ |
| 1204 | .llvm_name = "ldsbankcount32", | 1204 | .llvm_name = "ldsbankcount32", |
| 1205 | .description = "The number of LDS banks per compute unit.", | 1205 | .description = "The number of LDS banks per compute unit.", |
| 1206 | .dependencies = featureSet(&[_]Feature{}), | 1206 | .dependencies = featureSet(&[_]Feature{}), |
| 1207 | }; | 1207 | }; |
| 1208 | result[@intFromEnum(Feature.lerp_inst)] = .{ | 1208 | result[@backingInt(Feature.lerp_inst)] = .{ |
| 1209 | .llvm_name = "lerp-inst", | 1209 | .llvm_name = "lerp-inst", |
| 1210 | .description = "Has v_lerp_u8 instruction", | 1210 | .description = "Has v_lerp_u8 instruction", |
| 1211 | .dependencies = featureSet(&[_]Feature{}), | 1211 | .dependencies = featureSet(&[_]Feature{}), |
| 1212 | }; | 1212 | }; |
| 1213 | result[@intFromEnum(Feature.load_store_opt)] = .{ | 1213 | result[@backingInt(Feature.load_store_opt)] = .{ |
| 1214 | .llvm_name = "load-store-opt", | 1214 | .llvm_name = "load-store-opt", |
| 1215 | .description = "Enable SI load/store optimizer pass", | 1215 | .description = "Enable SI load/store optimizer pass", |
| 1216 | .dependencies = featureSet(&[_]Feature{}), | 1216 | .dependencies = featureSet(&[_]Feature{}), |
| 1217 | }; | 1217 | }; |
| 1218 | result[@intFromEnum(Feature.lshl_add_u64_inst)] = .{ | 1218 | result[@backingInt(Feature.lshl_add_u64_inst)] = .{ |
| 1219 | .llvm_name = "lshl-add-u64-inst", | 1219 | .llvm_name = "lshl-add-u64-inst", |
| 1220 | .description = "Has v_lshl_add_u64 instruction", | 1220 | .description = "Has v_lshl_add_u64 instruction", |
| 1221 | .dependencies = featureSet(&[_]Feature{}), | 1221 | .dependencies = featureSet(&[_]Feature{}), |
| 1222 | }; | 1222 | }; |
| 1223 | result[@intFromEnum(Feature.mad_intra_fwd_bug)] = .{ | 1223 | result[@backingInt(Feature.mad_intra_fwd_bug)] = .{ |
| 1224 | .llvm_name = "mad-intra-fwd-bug", | 1224 | .llvm_name = "mad-intra-fwd-bug", |
| 1225 | .description = "MAD_U64/I64 intra instruction forwarding bug", | 1225 | .description = "MAD_U64/I64 intra instruction forwarding bug", |
| 1226 | .dependencies = featureSet(&[_]Feature{}), | 1226 | .dependencies = featureSet(&[_]Feature{}), |
| 1227 | }; | 1227 | }; |
| 1228 | result[@intFromEnum(Feature.mad_mac_f32_insts)] = .{ | 1228 | result[@backingInt(Feature.mad_mac_f32_insts)] = .{ |
| 1229 | .llvm_name = "mad-mac-f32-insts", | 1229 | .llvm_name = "mad-mac-f32-insts", |
| 1230 | .description = "Has v_mad_f32/v_mac_f32/v_madak_f32/v_madmk_f32 instructions", | 1230 | .description = "Has v_mad_f32/v_mac_f32/v_madak_f32/v_madmk_f32 instructions", |
| 1231 | .dependencies = featureSet(&[_]Feature{}), | 1231 | .dependencies = featureSet(&[_]Feature{}), |
| 1232 | }; | 1232 | }; |
| 1233 | result[@intFromEnum(Feature.mad_mix_insts)] = .{ | 1233 | result[@backingInt(Feature.mad_mix_insts)] = .{ |
| 1234 | .llvm_name = "mad-mix-insts", | 1234 | .llvm_name = "mad-mix-insts", |
| 1235 | .description = "Has v_mad_mix_f32, v_mad_mixlo_f16, v_mad_mixhi_f16 instructions", | 1235 | .description = "Has v_mad_mix_f32, v_mad_mixlo_f16, v_mad_mixhi_f16 instructions", |
| 1236 | .dependencies = featureSet(&[_]Feature{}), | 1236 | .dependencies = featureSet(&[_]Feature{}), |
| 1237 | }; | 1237 | }; |
| 1238 | result[@intFromEnum(Feature.mad_u32_inst)] = .{ | 1238 | result[@backingInt(Feature.mad_u32_inst)] = .{ |
| 1239 | .llvm_name = "mad-u32-inst", | 1239 | .llvm_name = "mad-u32-inst", |
| 1240 | .description = "Has v_mad_u32 instruction", | 1240 | .description = "Has v_mad_u32 instruction", |
| 1241 | .dependencies = featureSet(&[_]Feature{}), | 1241 | .dependencies = featureSet(&[_]Feature{}), |
| 1242 | }; | 1242 | }; |
| 1243 | result[@intFromEnum(Feature.mai_insts)] = .{ | 1243 | result[@backingInt(Feature.mai_insts)] = .{ |
| 1244 | .llvm_name = "mai-insts", | 1244 | .llvm_name = "mai-insts", |
| 1245 | .description = "Has mAI instructions", | 1245 | .description = "Has mAI instructions", |
| 1246 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "max-hard-clause-length-32", | 1249 | .llvm_name = "max-hard-clause-length-32", |
| 1250 | .description = "Maximum number of instructions in an explicit S_CLAUSE is 32", | 1250 | .description = "Maximum number of instructions in an explicit S_CLAUSE is 32", |
| 1251 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "max-hard-clause-length-63", | 1254 | .llvm_name = "max-hard-clause-length-63", |
| 1255 | .description = "Maximum number of instructions in an explicit S_CLAUSE is 63", | 1255 | .description = "Maximum number of instructions in an explicit S_CLAUSE is 63", |
| 1256 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "max-private-element-size-16", | 1259 | .llvm_name = "max-private-element-size-16", |
| 1260 | .description = "Maximum private access size may be 16", | 1260 | .description = "Maximum private access size may be 16", |
| 1261 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "max-private-element-size-4", | 1264 | .llvm_name = "max-private-element-size-4", |
| 1265 | .description = "Maximum private access size may be 4", | 1265 | .description = "Maximum private access size may be 4", |
| 1266 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "max-private-element-size-8", | 1269 | .llvm_name = "max-private-element-size-8", |
| 1270 | .description = "Maximum private access size may be 8", | 1270 | .description = "Maximum private access size may be 8", |
| 1271 | .dependencies = featureSet(&[_]Feature{}), | 1271 | .dependencies = featureSet(&[_]Feature{}), |
| 1272 | }; | 1272 | }; |
| 1273 | result[@intFromEnum(Feature.mcast_load_insts)] = .{ | 1273 | result[@backingInt(Feature.mcast_load_insts)] = .{ |
| 1274 | .llvm_name = "mcast-load-insts", | 1274 | .llvm_name = "mcast-load-insts", |
| 1275 | .description = "Has multicast load instructions", | 1275 | .description = "Has multicast load instructions", |
| 1276 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "memory-atomic-fadd-f32-denormal-support", | 1279 | .llvm_name = "memory-atomic-fadd-f32-denormal-support", |
| 1280 | .description = "global/flat/buffer atomic fadd for float supports denormal handling", | 1280 | .description = "global/flat/buffer atomic fadd for float supports denormal handling", |
| 1281 | .dependencies = featureSet(&[_]Feature{}), | 1281 | .dependencies = featureSet(&[_]Feature{}), |
| 1282 | }; | 1282 | }; |
| 1283 | result[@intFromEnum(Feature.mfma_inline_literal_bug)] = .{ | 1283 | result[@backingInt(Feature.mfma_inline_literal_bug)] = .{ |
| 1284 | .llvm_name = "mfma-inline-literal-bug", | 1284 | .llvm_name = "mfma-inline-literal-bug", |
| 1285 | .description = "MFMA cannot use inline literal as SrcC", | 1285 | .description = "MFMA cannot use inline literal as SrcC", |
| 1286 | .dependencies = featureSet(&[_]Feature{}), | 1286 | .dependencies = featureSet(&[_]Feature{}), |
| 1287 | }; | 1287 | }; |
| 1288 | result[@intFromEnum(Feature.mimg_r128)] = .{ | 1288 | result[@backingInt(Feature.mimg_r128)] = .{ |
| 1289 | .llvm_name = "mimg-r128", | 1289 | .llvm_name = "mimg-r128", |
| 1290 | .description = "Support 128-bit texture resources", | 1290 | .description = "Support 128-bit texture resources", |
| 1291 | .dependencies = featureSet(&[_]Feature{}), | 1291 | .dependencies = featureSet(&[_]Feature{}), |
| 1292 | }; | 1292 | }; |
| 1293 | result[@intFromEnum(Feature.min3_max3_pkf16)] = .{ | 1293 | result[@backingInt(Feature.min3_max3_pkf16)] = .{ |
| 1294 | .llvm_name = "min3-max3-pkf16", | 1294 | .llvm_name = "min3-max3-pkf16", |
| 1295 | .description = "Has v_pk_min3_num_f16 and v_pk_max3_num_f16 instructions", | 1295 | .description = "Has v_pk_min3_num_f16 and v_pk_max3_num_f16 instructions", |
| 1296 | .dependencies = featureSet(&[_]Feature{}), | 1296 | .dependencies = featureSet(&[_]Feature{}), |
| 1297 | }; | 1297 | }; |
| 1298 | result[@intFromEnum(Feature.minimum3_maximum3_f16)] = .{ | 1298 | result[@backingInt(Feature.minimum3_maximum3_f16)] = .{ |
| 1299 | .llvm_name = "minimum3-maximum3-f16", | 1299 | .llvm_name = "minimum3-maximum3-f16", |
| 1300 | .description = "Has v_minimum3_f16 and v_maximum3_f16 instructions", | 1300 | .description = "Has v_minimum3_f16 and v_maximum3_f16 instructions", |
| 1301 | .dependencies = featureSet(&[_]Feature{}), | 1301 | .dependencies = featureSet(&[_]Feature{}), |
| 1302 | }; | 1302 | }; |
| 1303 | result[@intFromEnum(Feature.minimum3_maximum3_f32)] = .{ | 1303 | result[@backingInt(Feature.minimum3_maximum3_f32)] = .{ |
| 1304 | .llvm_name = "minimum3-maximum3-f32", | 1304 | .llvm_name = "minimum3-maximum3-f32", |
| 1305 | .description = "Has v_minimum3_f32 and v_maximum3_f32 instructions", | 1305 | .description = "Has v_minimum3_f32 and v_maximum3_f32 instructions", |
| 1306 | .dependencies = featureSet(&[_]Feature{}), | 1306 | .dependencies = featureSet(&[_]Feature{}), |
| 1307 | }; | 1307 | }; |
| 1308 | result[@intFromEnum(Feature.minimum3_maximum3_pkf16)] = .{ | 1308 | result[@backingInt(Feature.minimum3_maximum3_pkf16)] = .{ |
| 1309 | .llvm_name = "minimum3-maximum3-pkf16", | 1309 | .llvm_name = "minimum3-maximum3-pkf16", |
| 1310 | .description = "Has v_pk_minimum3_f16 and v_pk_maximum3_f16 instructions", | 1310 | .description = "Has v_pk_minimum3_f16 and v_pk_maximum3_f16 instructions", |
| 1311 | .dependencies = featureSet(&[_]Feature{}), | 1311 | .dependencies = featureSet(&[_]Feature{}), |
| 1312 | }; | 1312 | }; |
| 1313 | result[@intFromEnum(Feature.movrel)] = .{ | 1313 | result[@backingInt(Feature.movrel)] = .{ |
| 1314 | .llvm_name = "movrel", | 1314 | .llvm_name = "movrel", |
| 1315 | .description = "Has v_movrel*_b32 instructions", | 1315 | .description = "Has v_movrel*_b32 instructions", |
| 1316 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "msaa-load-dst-sel-bug", | 1319 | .llvm_name = "msaa-load-dst-sel-bug", |
| 1320 | .description = "MSAA loads not honoring dst_sel bug", | 1320 | .description = "MSAA loads not honoring dst_sel bug", |
| 1321 | .dependencies = featureSet(&[_]Feature{}), | 1321 | .dependencies = featureSet(&[_]Feature{}), |
| 1322 | }; | 1322 | }; |
| 1323 | result[@intFromEnum(Feature.negative_scratch_offset_bug)] = .{ | 1323 | result[@backingInt(Feature.negative_scratch_offset_bug)] = .{ |
| 1324 | .llvm_name = "negative-scratch-offset-bug", | 1324 | .llvm_name = "negative-scratch-offset-bug", |
| 1325 | .description = "Negative immediate offsets in scratch instructions with an SGPR offset page fault on GFX9", | 1325 | .description = "Negative immediate offsets in scratch instructions with an SGPR offset page fault on GFX9", |
| 1326 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "negative-unaligned-scratch-offset-bug", | 1329 | .llvm_name = "negative-unaligned-scratch-offset-bug", |
| 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", | 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 | .dependencies = featureSet(&[_]Feature{}), | 1331 | .dependencies = featureSet(&[_]Feature{}), |
| 1332 | }; | 1332 | }; |
| 1333 | result[@intFromEnum(Feature.no_data_dep_hazard)] = .{ | 1333 | result[@backingInt(Feature.no_data_dep_hazard)] = .{ |
| 1334 | .llvm_name = "no-data-dep-hazard", | 1334 | .llvm_name = "no-data-dep-hazard", |
| 1335 | .description = "Does not need SW waitstates", | 1335 | .description = "Does not need SW waitstates", |
| 1336 | .dependencies = featureSet(&[_]Feature{}), | 1336 | .dependencies = featureSet(&[_]Feature{}), |
| 1337 | }; | 1337 | }; |
| 1338 | result[@intFromEnum(Feature.no_sdst_cmpx)] = .{ | 1338 | result[@backingInt(Feature.no_sdst_cmpx)] = .{ |
| 1339 | .llvm_name = "no-sdst-cmpx", | 1339 | .llvm_name = "no-sdst-cmpx", |
| 1340 | .description = "V_CMPX does not write VCC/SGPR in addition to EXEC", | 1340 | .description = "V_CMPX does not write VCC/SGPR in addition to EXEC", |
| 1341 | .dependencies = featureSet(&[_]Feature{}), | 1341 | .dependencies = featureSet(&[_]Feature{}), |
| 1342 | }; | 1342 | }; |
| 1343 | result[@intFromEnum(Feature.nsa_clause_bug)] = .{ | 1343 | result[@backingInt(Feature.nsa_clause_bug)] = .{ |
| 1344 | .llvm_name = "nsa-clause-bug", | 1344 | .llvm_name = "nsa-clause-bug", |
| 1345 | .description = "MIMG-NSA in a hard clause has unpredictable results on GFX10.1", | 1345 | .description = "MIMG-NSA in a hard clause has unpredictable results on GFX10.1", |
| 1346 | .dependencies = featureSet(&[_]Feature{}), | 1346 | .dependencies = featureSet(&[_]Feature{}), |
| 1347 | }; | 1347 | }; |
| 1348 | result[@intFromEnum(Feature.nsa_encoding)] = .{ | 1348 | result[@backingInt(Feature.nsa_encoding)] = .{ |
| 1349 | .llvm_name = "nsa-encoding", | 1349 | .llvm_name = "nsa-encoding", |
| 1350 | .description = "Support NSA encoding for image instructions", | 1350 | .description = "Support NSA encoding for image instructions", |
| 1351 | .dependencies = featureSet(&[_]Feature{}), | 1351 | .dependencies = featureSet(&[_]Feature{}), |
| 1352 | }; | 1352 | }; |
| 1353 | result[@intFromEnum(Feature.nsa_to_vmem_bug)] = .{ | 1353 | result[@backingInt(Feature.nsa_to_vmem_bug)] = .{ |
| 1354 | .llvm_name = "nsa-to-vmem-bug", | 1354 | .llvm_name = "nsa-to-vmem-bug", |
| 1355 | .description = "MIMG-NSA followed by VMEM fail if EXEC_LO or EXEC_HI equals zero", | 1355 | .description = "MIMG-NSA followed by VMEM fail if EXEC_LO or EXEC_HI equals zero", |
| 1356 | .dependencies = featureSet(&[_]Feature{}), | 1356 | .dependencies = featureSet(&[_]Feature{}), |
| 1357 | }; | 1357 | }; |
| 1358 | result[@intFromEnum(Feature.offset_3f_bug)] = .{ | 1358 | result[@backingInt(Feature.offset_3f_bug)] = .{ |
| 1359 | .llvm_name = "offset-3f-bug", | 1359 | .llvm_name = "offset-3f-bug", |
| 1360 | .description = "Branch offset of 3f hardware bug", | 1360 | .description = "Branch offset of 3f hardware bug", |
| 1361 | .dependencies = featureSet(&[_]Feature{}), | 1361 | .dependencies = featureSet(&[_]Feature{}), |
| 1362 | }; | 1362 | }; |
| 1363 | result[@intFromEnum(Feature.packed_fp32_ops)] = .{ | 1363 | result[@backingInt(Feature.packed_fp32_ops)] = .{ |
| 1364 | .llvm_name = "packed-fp32-ops", | 1364 | .llvm_name = "packed-fp32-ops", |
| 1365 | .description = "Support packed fp32 instructions", | 1365 | .description = "Support packed fp32 instructions", |
| 1366 | .dependencies = featureSet(&[_]Feature{}), | 1366 | .dependencies = featureSet(&[_]Feature{}), |
| 1367 | }; | 1367 | }; |
| 1368 | result[@intFromEnum(Feature.packed_tid)] = .{ | 1368 | result[@backingInt(Feature.packed_tid)] = .{ |
| 1369 | .llvm_name = "packed-tid", | 1369 | .llvm_name = "packed-tid", |
| 1370 | .description = "Workitem IDs are packed into v0 at kernel launch", | 1370 | .description = "Workitem IDs are packed into v0 at kernel launch", |
| 1371 | .dependencies = featureSet(&[_]Feature{}), | 1371 | .dependencies = featureSet(&[_]Feature{}), |
| 1372 | }; | 1372 | }; |
| 1373 | result[@intFromEnum(Feature.partial_nsa_encoding)] = .{ | 1373 | result[@backingInt(Feature.partial_nsa_encoding)] = .{ |
| 1374 | .llvm_name = "partial-nsa-encoding", | 1374 | .llvm_name = "partial-nsa-encoding", |
| 1375 | .description = "Support partial NSA encoding for image instructions", | 1375 | .description = "Support partial NSA encoding for image instructions", |
| 1376 | .dependencies = featureSet(&[_]Feature{}), | 1376 | .dependencies = featureSet(&[_]Feature{}), |
| 1377 | }; | 1377 | }; |
| 1378 | result[@intFromEnum(Feature.permlane16_swap)] = .{ | 1378 | result[@backingInt(Feature.permlane16_swap)] = .{ |
| 1379 | .llvm_name = "permlane16-swap", | 1379 | .llvm_name = "permlane16-swap", |
| 1380 | .description = "Has v_permlane16_swap_b32 instructions", | 1380 | .description = "Has v_permlane16_swap_b32 instructions", |
| 1381 | .dependencies = featureSet(&[_]Feature{}), | 1381 | .dependencies = featureSet(&[_]Feature{}), |
| 1382 | }; | 1382 | }; |
| 1383 | result[@intFromEnum(Feature.permlane32_swap)] = .{ | 1383 | result[@backingInt(Feature.permlane32_swap)] = .{ |
| 1384 | .llvm_name = "permlane32-swap", | 1384 | .llvm_name = "permlane32-swap", |
| 1385 | .description = "Has v_permlane32_swap_b32 instructions", | 1385 | .description = "Has v_permlane32_swap_b32 instructions", |
| 1386 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "pk-add-min-max-insts", | 1389 | .llvm_name = "pk-add-min-max-insts", |
| 1390 | .description = "Has v_pk_add_{min|max}_{i|u}16 instructions", | 1390 | .description = "Has v_pk_add_{min|max}_{i|u}16 instructions", |
| 1391 | .dependencies = featureSet(&[_]Feature{}), | 1391 | .dependencies = featureSet(&[_]Feature{}), |
| 1392 | }; | 1392 | }; |
| 1393 | result[@intFromEnum(Feature.pk_fmac_f16_inst)] = .{ | 1393 | result[@backingInt(Feature.pk_fmac_f16_inst)] = .{ |
| 1394 | .llvm_name = "pk-fmac-f16-inst", | 1394 | .llvm_name = "pk-fmac-f16-inst", |
| 1395 | .description = "Has v_pk_fmac_f16 instruction", | 1395 | .description = "Has v_pk_fmac_f16 instruction", |
| 1396 | .dependencies = featureSet(&[_]Feature{}), | 1396 | .dependencies = featureSet(&[_]Feature{}), |
| 1397 | }; | 1397 | }; |
| 1398 | result[@intFromEnum(Feature.point_sample_accel)] = .{ | 1398 | result[@backingInt(Feature.point_sample_accel)] = .{ |
| 1399 | .llvm_name = "point-sample-accel", | 1399 | .llvm_name = "point-sample-accel", |
| 1400 | .description = "Has point sample acceleration feature", | 1400 | .description = "Has point sample acceleration feature", |
| 1401 | .dependencies = featureSet(&[_]Feature{}), | 1401 | .dependencies = featureSet(&[_]Feature{}), |
| 1402 | }; | 1402 | }; |
| 1403 | result[@intFromEnum(Feature.precise_memory)] = .{ | 1403 | result[@backingInt(Feature.precise_memory)] = .{ |
| 1404 | .llvm_name = "precise-memory", | 1404 | .llvm_name = "precise-memory", |
| 1405 | .description = "Enable precise memory mode", | 1405 | .description = "Enable precise memory mode", |
| 1406 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "priv-enabled-trap2-nop-bug", | 1409 | .llvm_name = "priv-enabled-trap2-nop-bug", |
| 1410 | .description = "Hardware that runs with PRIV=1 interpreting 's_trap 2' as a nop bug", | 1410 | .description = "Hardware that runs with PRIV=1 interpreting 's_trap 2' as a nop bug", |
| 1411 | .dependencies = featureSet(&[_]Feature{}), | 1411 | .dependencies = featureSet(&[_]Feature{}), |
| 1412 | }; | 1412 | }; |
| 1413 | result[@intFromEnum(Feature.prng_inst)] = .{ | 1413 | result[@backingInt(Feature.prng_inst)] = .{ |
| 1414 | .llvm_name = "prng-inst", | 1414 | .llvm_name = "prng-inst", |
| 1415 | .description = "Has v_prng_b32 instruction", | 1415 | .description = "Has v_prng_b32 instruction", |
| 1416 | .dependencies = featureSet(&[_]Feature{}), | 1416 | .dependencies = featureSet(&[_]Feature{}), |
| 1417 | }; | 1417 | }; |
| 1418 | result[@intFromEnum(Feature.promote_alloca)] = .{ | 1418 | result[@backingInt(Feature.promote_alloca)] = .{ |
| 1419 | .llvm_name = "promote-alloca", | 1419 | .llvm_name = "promote-alloca", |
| 1420 | .description = "Enable promote alloca pass", | 1420 | .description = "Enable promote alloca pass", |
| 1421 | .dependencies = featureSet(&[_]Feature{}), | 1421 | .dependencies = featureSet(&[_]Feature{}), |
| 1422 | }; | 1422 | }; |
| 1423 | result[@intFromEnum(Feature.prt_strict_null)] = .{ | 1423 | result[@backingInt(Feature.prt_strict_null)] = .{ |
| 1424 | .llvm_name = "enable-prt-strict-null", | 1424 | .llvm_name = "enable-prt-strict-null", |
| 1425 | .description = "Enable zeroing of result registers for sparse texture fetches", | 1425 | .description = "Enable zeroing of result registers for sparse texture fetches", |
| 1426 | .dependencies = featureSet(&[_]Feature{}), | 1426 | .dependencies = featureSet(&[_]Feature{}), |
| 1427 | }; | 1427 | }; |
| 1428 | result[@intFromEnum(Feature.pseudo_scalar_trans)] = .{ | 1428 | result[@backingInt(Feature.pseudo_scalar_trans)] = .{ |
| 1429 | .llvm_name = "pseudo-scalar-trans", | 1429 | .llvm_name = "pseudo-scalar-trans", |
| 1430 | .description = "Has Pseudo Scalar Transcendental instructions", | 1430 | .description = "Has Pseudo Scalar Transcendental instructions", |
| 1431 | .dependencies = featureSet(&[_]Feature{}), | 1431 | .dependencies = featureSet(&[_]Feature{}), |
| 1432 | }; | 1432 | }; |
| 1433 | result[@intFromEnum(Feature.qsad_insts)] = .{ | 1433 | result[@backingInt(Feature.qsad_insts)] = .{ |
| 1434 | .llvm_name = "qsad-insts", | 1434 | .llvm_name = "qsad-insts", |
| 1435 | .description = "Has v_qsad* instructions", | 1435 | .description = "Has v_qsad* instructions", |
| 1436 | .dependencies = featureSet(&[_]Feature{}), | 1436 | .dependencies = featureSet(&[_]Feature{}), |
| 1437 | }; | 1437 | }; |
| 1438 | result[@intFromEnum(Feature.r128_a16)] = .{ | 1438 | result[@backingInt(Feature.r128_a16)] = .{ |
| 1439 | .llvm_name = "r128-a16", | 1439 | .llvm_name = "r128-a16", |
| 1440 | .description = "Support gfx9-style A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands, where a16 is aliased with r128", | 1440 | .description = "Support gfx9-style A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands, where a16 is aliased with r128", |
| 1441 | .dependencies = featureSet(&[_]Feature{}), | 1441 | .dependencies = featureSet(&[_]Feature{}), |
| 1442 | }; | 1442 | }; |
| 1443 | result[@intFromEnum(Feature.real_true16)] = .{ | 1443 | result[@backingInt(Feature.real_true16)] = .{ |
| 1444 | .llvm_name = "real-true16", | 1444 | .llvm_name = "real-true16", |
| 1445 | .description = "Use true 16-bit registers", | 1445 | .description = "Use true 16-bit registers", |
| 1446 | .dependencies = featureSet(&[_]Feature{}), | 1446 | .dependencies = featureSet(&[_]Feature{}), |
| 1447 | }; | 1447 | }; |
| 1448 | result[@intFromEnum(Feature.relaxed_buffer_oob_mode)] = .{ | 1448 | result[@backingInt(Feature.relaxed_buffer_oob_mode)] = .{ |
| 1449 | .llvm_name = "relaxed-buffer-oob-mode", | 1449 | .llvm_name = "relaxed-buffer-oob-mode", |
| 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", | 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 | .dependencies = featureSet(&[_]Feature{}), | 1451 | .dependencies = featureSet(&[_]Feature{}), |
| 1452 | }; | 1452 | }; |
| 1453 | result[@intFromEnum(Feature.required_export_priority)] = .{ | 1453 | result[@backingInt(Feature.required_export_priority)] = .{ |
| 1454 | .llvm_name = "required-export-priority", | 1454 | .llvm_name = "required-export-priority", |
| 1455 | .description = "Export priority must be explicitly manipulated on GFX11.5", | 1455 | .description = "Export priority must be explicitly manipulated on GFX11.5", |
| 1456 | .dependencies = featureSet(&[_]Feature{}), | 1456 | .dependencies = featureSet(&[_]Feature{}), |
| 1457 | }; | 1457 | }; |
| 1458 | result[@intFromEnum(Feature.requires_cov6)] = .{ | 1458 | result[@backingInt(Feature.requires_cov6)] = .{ |
| 1459 | .llvm_name = "requires-cov6", | 1459 | .llvm_name = "requires-cov6", |
| 1460 | .description = "Target Requires Code Object V6", | 1460 | .description = "Target Requires Code Object V6", |
| 1461 | .dependencies = featureSet(&[_]Feature{}), | 1461 | .dependencies = featureSet(&[_]Feature{}), |
| 1462 | }; | 1462 | }; |
| 1463 | result[@intFromEnum(Feature.restricted_soffset)] = .{ | 1463 | result[@backingInt(Feature.restricted_soffset)] = .{ |
| 1464 | .llvm_name = "restricted-soffset", | 1464 | .llvm_name = "restricted-soffset", |
| 1465 | .description = "Has restricted SOffset (immediate not supported).", | 1465 | .description = "Has restricted SOffset (immediate not supported).", |
| 1466 | .dependencies = featureSet(&[_]Feature{}), | 1466 | .dependencies = featureSet(&[_]Feature{}), |
| 1467 | }; | 1467 | }; |
| 1468 | result[@intFromEnum(Feature.s_memrealtime)] = .{ | 1468 | result[@backingInt(Feature.s_memrealtime)] = .{ |
| 1469 | .llvm_name = "s-memrealtime", | 1469 | .llvm_name = "s-memrealtime", |
| 1470 | .description = "Has s_memrealtime instruction", | 1470 | .description = "Has s_memrealtime instruction", |
| 1471 | .dependencies = featureSet(&[_]Feature{}), | 1471 | .dependencies = featureSet(&[_]Feature{}), |
| 1472 | }; | 1472 | }; |
| 1473 | result[@intFromEnum(Feature.s_memtime_inst)] = .{ | 1473 | result[@backingInt(Feature.s_memtime_inst)] = .{ |
| 1474 | .llvm_name = "s-memtime-inst", | 1474 | .llvm_name = "s-memtime-inst", |
| 1475 | .description = "Has s_memtime instruction", | 1475 | .description = "Has s_memtime instruction", |
| 1476 | .dependencies = featureSet(&[_]Feature{}), | 1476 | .dependencies = featureSet(&[_]Feature{}), |
| 1477 | }; | 1477 | }; |
| 1478 | result[@intFromEnum(Feature.s_wakeup_barrier_inst)] = .{ | 1478 | result[@backingInt(Feature.s_wakeup_barrier_inst)] = .{ |
| 1479 | .llvm_name = "s-wakeup-barrier-inst", | 1479 | .llvm_name = "s-wakeup-barrier-inst", |
| 1480 | .description = "Has s_wakeup_barrier instruction.", | 1480 | .description = "Has s_wakeup_barrier instruction.", |
| 1481 | .dependencies = featureSet(&[_]Feature{}), | 1481 | .dependencies = featureSet(&[_]Feature{}), |
| 1482 | }; | 1482 | }; |
| 1483 | result[@intFromEnum(Feature.sad_insts)] = .{ | 1483 | result[@backingInt(Feature.sad_insts)] = .{ |
| 1484 | .llvm_name = "sad-insts", | 1484 | .llvm_name = "sad-insts", |
| 1485 | .description = "Has v_sad* instructions", | 1485 | .description = "Has v_sad* instructions", |
| 1486 | .dependencies = featureSet(&[_]Feature{}), | 1486 | .dependencies = featureSet(&[_]Feature{}), |
| 1487 | }; | 1487 | }; |
| 1488 | result[@intFromEnum(Feature.safe_cu_prefetch)] = .{ | 1488 | result[@backingInt(Feature.safe_cu_prefetch)] = .{ |
| 1489 | .llvm_name = "safe-cu-prefetch", | 1489 | .llvm_name = "safe-cu-prefetch", |
| 1490 | .description = "VMEM CU scope prefetches do not fail on illegal address", | 1490 | .description = "VMEM CU scope prefetches do not fail on illegal address", |
| 1491 | .dependencies = featureSet(&[_]Feature{}), | 1491 | .dependencies = featureSet(&[_]Feature{}), |
| 1492 | }; | 1492 | }; |
| 1493 | result[@intFromEnum(Feature.safe_smem_prefetch)] = .{ | 1493 | result[@backingInt(Feature.safe_smem_prefetch)] = .{ |
| 1494 | .llvm_name = "safe-smem-prefetch", | 1494 | .llvm_name = "safe-smem-prefetch", |
| 1495 | .description = "SMEM prefetches do not fail on illegal address", | 1495 | .description = "SMEM prefetches do not fail on illegal address", |
| 1496 | .dependencies = featureSet(&[_]Feature{}), | 1496 | .dependencies = featureSet(&[_]Feature{}), |
| 1497 | }; | 1497 | }; |
| 1498 | result[@intFromEnum(Feature.salu_float)] = .{ | 1498 | result[@backingInt(Feature.salu_float)] = .{ |
| 1499 | .llvm_name = "salu-float", | 1499 | .llvm_name = "salu-float", |
| 1500 | .description = "Has SALU floating point instructions", | 1500 | .description = "Has SALU floating point instructions", |
| 1501 | .dependencies = featureSet(&[_]Feature{}), | 1501 | .dependencies = featureSet(&[_]Feature{}), |
| 1502 | }; | 1502 | }; |
| 1503 | result[@intFromEnum(Feature.scalar_atomics)] = .{ | 1503 | result[@backingInt(Feature.scalar_atomics)] = .{ |
| 1504 | .llvm_name = "scalar-atomics", | 1504 | .llvm_name = "scalar-atomics", |
| 1505 | .description = "Has atomic scalar memory instructions", | 1505 | .description = "Has atomic scalar memory instructions", |
| 1506 | .dependencies = featureSet(&[_]Feature{}), | 1506 | .dependencies = featureSet(&[_]Feature{}), |
| 1507 | }; | 1507 | }; |
| 1508 | result[@intFromEnum(Feature.scalar_dwordx3_loads)] = .{ | 1508 | result[@backingInt(Feature.scalar_dwordx3_loads)] = .{ |
| 1509 | .llvm_name = "scalar-dwordx3-loads", | 1509 | .llvm_name = "scalar-dwordx3-loads", |
| 1510 | .description = "Has 96-bit scalar load instructions", | 1510 | .description = "Has 96-bit scalar load instructions", |
| 1511 | .dependencies = featureSet(&[_]Feature{}), | 1511 | .dependencies = featureSet(&[_]Feature{}), |
| 1512 | }; | 1512 | }; |
| 1513 | result[@intFromEnum(Feature.scalar_flat_scratch_insts)] = .{ | 1513 | result[@backingInt(Feature.scalar_flat_scratch_insts)] = .{ |
| 1514 | .llvm_name = "scalar-flat-scratch-insts", | 1514 | .llvm_name = "scalar-flat-scratch-insts", |
| 1515 | .description = "Have s_scratch_* flat memory instructions", | 1515 | .description = "Have s_scratch_* flat memory instructions", |
| 1516 | .dependencies = featureSet(&[_]Feature{}), | 1516 | .dependencies = featureSet(&[_]Feature{}), |
| 1517 | }; | 1517 | }; |
| 1518 | result[@intFromEnum(Feature.scalar_stores)] = .{ | 1518 | result[@backingInt(Feature.scalar_stores)] = .{ |
| 1519 | .llvm_name = "scalar-stores", | 1519 | .llvm_name = "scalar-stores", |
| 1520 | .description = "Has store scalar memory instructions", | 1520 | .description = "Has store scalar memory instructions", |
| 1521 | .dependencies = featureSet(&[_]Feature{}), | 1521 | .dependencies = featureSet(&[_]Feature{}), |
| 1522 | }; | 1522 | }; |
| 1523 | result[@intFromEnum(Feature.sdwa)] = .{ | 1523 | result[@backingInt(Feature.sdwa)] = .{ |
| 1524 | .llvm_name = "sdwa", | 1524 | .llvm_name = "sdwa", |
| 1525 | .description = "Support SDWA (Sub-DWORD Addressing) extension", | 1525 | .description = "Support SDWA (Sub-DWORD Addressing) extension", |
| 1526 | .dependencies = featureSet(&[_]Feature{}), | 1526 | .dependencies = featureSet(&[_]Feature{}), |
| 1527 | }; | 1527 | }; |
| 1528 | result[@intFromEnum(Feature.sdwa_mav)] = .{ | 1528 | result[@backingInt(Feature.sdwa_mav)] = .{ |
| 1529 | .llvm_name = "sdwa-mav", | 1529 | .llvm_name = "sdwa-mav", |
| 1530 | .description = "Support v_mac_f32/f16 with SDWA (Sub-DWORD Addressing) extension", | 1530 | .description = "Support v_mac_f32/f16 with SDWA (Sub-DWORD Addressing) extension", |
| 1531 | .dependencies = featureSet(&[_]Feature{}), | 1531 | .dependencies = featureSet(&[_]Feature{}), |
| 1532 | }; | 1532 | }; |
| 1533 | result[@intFromEnum(Feature.sdwa_omod)] = .{ | 1533 | result[@backingInt(Feature.sdwa_omod)] = .{ |
| 1534 | .llvm_name = "sdwa-omod", | 1534 | .llvm_name = "sdwa-omod", |
| 1535 | .description = "Support OMod with SDWA (Sub-DWORD Addressing) extension", | 1535 | .description = "Support OMod with SDWA (Sub-DWORD Addressing) extension", |
| 1536 | .dependencies = featureSet(&[_]Feature{}), | 1536 | .dependencies = featureSet(&[_]Feature{}), |
| 1537 | }; | 1537 | }; |
| 1538 | result[@intFromEnum(Feature.sdwa_out_mods_vopc)] = .{ | 1538 | result[@backingInt(Feature.sdwa_out_mods_vopc)] = .{ |
| 1539 | .llvm_name = "sdwa-out-mods-vopc", | 1539 | .llvm_name = "sdwa-out-mods-vopc", |
| 1540 | .description = "Support clamp for VOPC with SDWA (Sub-DWORD Addressing) extension", | 1540 | .description = "Support clamp for VOPC with SDWA (Sub-DWORD Addressing) extension", |
| 1541 | .dependencies = featureSet(&[_]Feature{}), | 1541 | .dependencies = featureSet(&[_]Feature{}), |
| 1542 | }; | 1542 | }; |
| 1543 | result[@intFromEnum(Feature.sdwa_scalar)] = .{ | 1543 | result[@backingInt(Feature.sdwa_scalar)] = .{ |
| 1544 | .llvm_name = "sdwa-scalar", | 1544 | .llvm_name = "sdwa-scalar", |
| 1545 | .description = "Support scalar register with SDWA (Sub-DWORD Addressing) extension", | 1545 | .description = "Support scalar register with SDWA (Sub-DWORD Addressing) extension", |
| 1546 | .dependencies = featureSet(&[_]Feature{}), | 1546 | .dependencies = featureSet(&[_]Feature{}), |
| 1547 | }; | 1547 | }; |
| 1548 | result[@intFromEnum(Feature.sdwa_sdst)] = .{ | 1548 | result[@backingInt(Feature.sdwa_sdst)] = .{ |
| 1549 | .llvm_name = "sdwa-sdst", | 1549 | .llvm_name = "sdwa-sdst", |
| 1550 | .description = "Support scalar dst for VOPC with SDWA (Sub-DWORD Addressing) extension", | 1550 | .description = "Support scalar dst for VOPC with SDWA (Sub-DWORD Addressing) extension", |
| 1551 | .dependencies = featureSet(&[_]Feature{}), | 1551 | .dependencies = featureSet(&[_]Feature{}), |
| 1552 | }; | 1552 | }; |
| 1553 | result[@intFromEnum(Feature.sea_islands)] = .{ | 1553 | result[@backingInt(Feature.sea_islands)] = .{ |
| 1554 | .llvm_name = "sea-islands", | 1554 | .llvm_name = "sea-islands", |
| 1555 | .description = "SEA_ISLANDS GPU generation", | 1555 | .description = "SEA_ISLANDS GPU generation", |
| 1556 | .dependencies = featureSet(&[_]Feature{ | 1556 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1583,42 +1583,42 @@ pub const all_features = blk: { | ... | @@ -1583,42 +1583,42 @@ pub const all_features = blk: { |
| 1583 | .wavefrontsize64, | 1583 | .wavefrontsize64, |
| 1584 | }), | 1584 | }), |
| 1585 | }; | 1585 | }; |
| 1586 | result[@intFromEnum(Feature.setprio_inc_wg_inst)] = .{ | 1586 | result[@backingInt(Feature.setprio_inc_wg_inst)] = .{ |
| 1587 | .llvm_name = "setprio-inc-wg-inst", | 1587 | .llvm_name = "setprio-inc-wg-inst", |
| 1588 | .description = "Has s_setprio_inc_wg instruction.", | 1588 | .description = "Has s_setprio_inc_wg instruction.", |
| 1589 | .dependencies = featureSet(&[_]Feature{}), | 1589 | .dependencies = featureSet(&[_]Feature{}), |
| 1590 | }; | 1590 | }; |
| 1591 | result[@intFromEnum(Feature.setreg_vgpr_msb_fixup)] = .{ | 1591 | result[@backingInt(Feature.setreg_vgpr_msb_fixup)] = .{ |
| 1592 | .llvm_name = "setreg-vgpr-msb-fixup", | 1592 | .llvm_name = "setreg-vgpr-msb-fixup", |
| 1593 | .description = "S_SETREG to MODE clobbers VGPR MSB bits, requires fixup", | 1593 | .description = "S_SETREG to MODE clobbers VGPR MSB bits, requires fixup", |
| 1594 | .dependencies = featureSet(&[_]Feature{}), | 1594 | .dependencies = featureSet(&[_]Feature{}), |
| 1595 | }; | 1595 | }; |
| 1596 | result[@intFromEnum(Feature.sgpr_init_bug)] = .{ | 1596 | result[@backingInt(Feature.sgpr_init_bug)] = .{ |
| 1597 | .llvm_name = "sgpr-init-bug", | 1597 | .llvm_name = "sgpr-init-bug", |
| 1598 | .description = "VI SGPR initialization bug requiring a fixed SGPR allocation size", | 1598 | .description = "VI SGPR initialization bug requiring a fixed SGPR allocation size", |
| 1599 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "shader-cycles-hi-lo-registers", | 1602 | .llvm_name = "shader-cycles-hi-lo-registers", |
| 1603 | .description = "Has SHADER_CYCLES_HI/LO hardware registers", | 1603 | .description = "Has SHADER_CYCLES_HI/LO hardware registers", |
| 1604 | .dependencies = featureSet(&[_]Feature{}), | 1604 | .dependencies = featureSet(&[_]Feature{}), |
| 1605 | }; | 1605 | }; |
| 1606 | result[@intFromEnum(Feature.shader_cycles_register)] = .{ | 1606 | result[@backingInt(Feature.shader_cycles_register)] = .{ |
| 1607 | .llvm_name = "shader-cycles-register", | 1607 | .llvm_name = "shader-cycles-register", |
| 1608 | .description = "Has SHADER_CYCLES hardware register", | 1608 | .description = "Has SHADER_CYCLES hardware register", |
| 1609 | .dependencies = featureSet(&[_]Feature{}), | 1609 | .dependencies = featureSet(&[_]Feature{}), |
| 1610 | }; | 1610 | }; |
| 1611 | result[@intFromEnum(Feature.si_scheduler)] = .{ | 1611 | result[@backingInt(Feature.si_scheduler)] = .{ |
| 1612 | .llvm_name = "si-scheduler", | 1612 | .llvm_name = "si-scheduler", |
| 1613 | .description = "Enable SI Machine Scheduler", | 1613 | .description = "Enable SI Machine Scheduler", |
| 1614 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "smem-to-vector-write-hazard", | 1617 | .llvm_name = "smem-to-vector-write-hazard", |
| 1618 | .description = "s_load_dword followed by v_cmp page faults", | 1618 | .description = "s_load_dword followed by v_cmp page faults", |
| 1619 | .dependencies = featureSet(&[_]Feature{}), | 1619 | .dependencies = featureSet(&[_]Feature{}), |
| 1620 | }; | 1620 | }; |
| 1621 | result[@intFromEnum(Feature.southern_islands)] = .{ | 1621 | result[@backingInt(Feature.southern_islands)] = .{ |
| 1622 | .llvm_name = "southern-islands", | 1622 | .llvm_name = "southern-islands", |
| 1623 | .description = "SOUTHERN_ISLANDS GPU generation", | 1623 | .description = "SOUTHERN_ISLANDS GPU generation", |
| 1624 | .dependencies = featureSet(&[_]Feature{ | 1624 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1646,132 +1646,132 @@ pub const all_features = blk: { | ... | @@ -1646,132 +1646,132 @@ pub const all_features = blk: { |
| 1646 | .wavefrontsize64, | 1646 | .wavefrontsize64, |
| 1647 | }), | 1647 | }), |
| 1648 | }; | 1648 | }; |
| 1649 | result[@intFromEnum(Feature.sramecc)] = .{ | 1649 | result[@backingInt(Feature.sramecc)] = .{ |
| 1650 | .llvm_name = "sramecc", | 1650 | .llvm_name = "sramecc", |
| 1651 | .description = "Enable SRAMECC", | 1651 | .description = "Enable SRAMECC", |
| 1652 | .dependencies = featureSet(&[_]Feature{}), | 1652 | .dependencies = featureSet(&[_]Feature{}), |
| 1653 | }; | 1653 | }; |
| 1654 | result[@intFromEnum(Feature.sramecc_support)] = .{ | 1654 | result[@backingInt(Feature.sramecc_support)] = .{ |
| 1655 | .llvm_name = "sramecc-support", | 1655 | .llvm_name = "sramecc-support", |
| 1656 | .description = "Hardware supports SRAMECC", | 1656 | .description = "Hardware supports SRAMECC", |
| 1657 | .dependencies = featureSet(&[_]Feature{}), | 1657 | .dependencies = featureSet(&[_]Feature{}), |
| 1658 | }; | 1658 | }; |
| 1659 | result[@intFromEnum(Feature.tanh_insts)] = .{ | 1659 | result[@backingInt(Feature.tanh_insts)] = .{ |
| 1660 | .llvm_name = "tanh-insts", | 1660 | .llvm_name = "tanh-insts", |
| 1661 | .description = "Has v_tanh_f32/f16 instructions", | 1661 | .description = "Has v_tanh_f32/f16 instructions", |
| 1662 | .dependencies = featureSet(&[_]Feature{}), | 1662 | .dependencies = featureSet(&[_]Feature{}), |
| 1663 | }; | 1663 | }; |
| 1664 | result[@intFromEnum(Feature.tensor_cvt_lut_insts)] = .{ | 1664 | result[@backingInt(Feature.tensor_cvt_lut_insts)] = .{ |
| 1665 | .llvm_name = "tensor-cvt-lut-insts", | 1665 | .llvm_name = "tensor-cvt-lut-insts", |
| 1666 | .description = "Has v_perm_pk16* instructions", | 1666 | .description = "Has v_perm_pk16* instructions", |
| 1667 | .dependencies = featureSet(&[_]Feature{}), | 1667 | .dependencies = featureSet(&[_]Feature{}), |
| 1668 | }; | 1668 | }; |
| 1669 | result[@intFromEnum(Feature.tgsplit)] = .{ | 1669 | result[@backingInt(Feature.tgsplit)] = .{ |
| 1670 | .llvm_name = "tgsplit", | 1670 | .llvm_name = "tgsplit", |
| 1671 | .description = "Enable threadgroup split execution", | 1671 | .description = "Enable threadgroup split execution", |
| 1672 | .dependencies = featureSet(&[_]Feature{}), | 1672 | .dependencies = featureSet(&[_]Feature{}), |
| 1673 | }; | 1673 | }; |
| 1674 | result[@intFromEnum(Feature.transpose_load_f4f6_insts)] = .{ | 1674 | result[@backingInt(Feature.transpose_load_f4f6_insts)] = .{ |
| 1675 | .llvm_name = "transpose-load-f4f6-insts", | 1675 | .llvm_name = "transpose-load-f4f6-insts", |
| 1676 | .description = "Has ds_load_tr4/tr6 and global_load_tr4/tr6 instructions", | 1676 | .description = "Has ds_load_tr4/tr6 and global_load_tr4/tr6 instructions", |
| 1677 | .dependencies = featureSet(&[_]Feature{}), | 1677 | .dependencies = featureSet(&[_]Feature{}), |
| 1678 | }; | 1678 | }; |
| 1679 | result[@intFromEnum(Feature.trap_handler)] = .{ | 1679 | result[@backingInt(Feature.trap_handler)] = .{ |
| 1680 | .llvm_name = "trap-handler", | 1680 | .llvm_name = "trap-handler", |
| 1681 | .description = "Trap handler support", | 1681 | .description = "Trap handler support", |
| 1682 | .dependencies = featureSet(&[_]Feature{}), | 1682 | .dependencies = featureSet(&[_]Feature{}), |
| 1683 | }; | 1683 | }; |
| 1684 | result[@intFromEnum(Feature.trig_reduced_range)] = .{ | 1684 | result[@backingInt(Feature.trig_reduced_range)] = .{ |
| 1685 | .llvm_name = "trig-reduced-range", | 1685 | .llvm_name = "trig-reduced-range", |
| 1686 | .description = "Requires use of fract on arguments to trig instructions", | 1686 | .description = "Requires use of fract on arguments to trig instructions", |
| 1687 | .dependencies = featureSet(&[_]Feature{}), | 1687 | .dependencies = featureSet(&[_]Feature{}), |
| 1688 | }; | 1688 | }; |
| 1689 | result[@intFromEnum(Feature.true16)] = .{ | 1689 | result[@backingInt(Feature.true16)] = .{ |
| 1690 | .llvm_name = "true16", | 1690 | .llvm_name = "true16", |
| 1691 | .description = "True 16-bit operand instructions", | 1691 | .description = "True 16-bit operand instructions", |
| 1692 | .dependencies = featureSet(&[_]Feature{}), | 1692 | .dependencies = featureSet(&[_]Feature{}), |
| 1693 | }; | 1693 | }; |
| 1694 | result[@intFromEnum(Feature.unaligned_access_mode)] = .{ | 1694 | result[@backingInt(Feature.unaligned_access_mode)] = .{ |
| 1695 | .llvm_name = "unaligned-access-mode", | 1695 | .llvm_name = "unaligned-access-mode", |
| 1696 | .description = "Enable unaligned global, local and region loads and stores if the hardware supports it", | 1696 | .description = "Enable unaligned global, local and region loads and stores if the hardware supports it", |
| 1697 | .dependencies = featureSet(&[_]Feature{}), | 1697 | .dependencies = featureSet(&[_]Feature{}), |
| 1698 | }; | 1698 | }; |
| 1699 | result[@intFromEnum(Feature.unaligned_buffer_access)] = .{ | 1699 | result[@backingInt(Feature.unaligned_buffer_access)] = .{ |
| 1700 | .llvm_name = "unaligned-buffer-access", | 1700 | .llvm_name = "unaligned-buffer-access", |
| 1701 | .description = "Hardware supports unaligned global loads and stores", | 1701 | .description = "Hardware supports unaligned global loads and stores", |
| 1702 | .dependencies = featureSet(&[_]Feature{}), | 1702 | .dependencies = featureSet(&[_]Feature{}), |
| 1703 | }; | 1703 | }; |
| 1704 | result[@intFromEnum(Feature.unaligned_ds_access)] = .{ | 1704 | result[@backingInt(Feature.unaligned_ds_access)] = .{ |
| 1705 | .llvm_name = "unaligned-ds-access", | 1705 | .llvm_name = "unaligned-ds-access", |
| 1706 | .description = "Hardware supports unaligned local and region loads and stores", | 1706 | .description = "Hardware supports unaligned local and region loads and stores", |
| 1707 | .dependencies = featureSet(&[_]Feature{}), | 1707 | .dependencies = featureSet(&[_]Feature{}), |
| 1708 | }; | 1708 | }; |
| 1709 | result[@intFromEnum(Feature.unaligned_scratch_access)] = .{ | 1709 | result[@backingInt(Feature.unaligned_scratch_access)] = .{ |
| 1710 | .llvm_name = "unaligned-scratch-access", | 1710 | .llvm_name = "unaligned-scratch-access", |
| 1711 | .description = "Support unaligned scratch loads and stores", | 1711 | .description = "Support unaligned scratch loads and stores", |
| 1712 | .dependencies = featureSet(&[_]Feature{}), | 1712 | .dependencies = featureSet(&[_]Feature{}), |
| 1713 | }; | 1713 | }; |
| 1714 | result[@intFromEnum(Feature.unpacked_d16_vmem)] = .{ | 1714 | result[@backingInt(Feature.unpacked_d16_vmem)] = .{ |
| 1715 | .llvm_name = "unpacked-d16-vmem", | 1715 | .llvm_name = "unpacked-d16-vmem", |
| 1716 | .description = "Has unpacked d16 vmem instructions", | 1716 | .description = "Has unpacked d16 vmem instructions", |
| 1717 | .dependencies = featureSet(&[_]Feature{}), | 1717 | .dependencies = featureSet(&[_]Feature{}), |
| 1718 | }; | 1718 | }; |
| 1719 | result[@intFromEnum(Feature.unsafe_ds_offset_folding)] = .{ | 1719 | result[@backingInt(Feature.unsafe_ds_offset_folding)] = .{ |
| 1720 | .llvm_name = "unsafe-ds-offset-folding", | 1720 | .llvm_name = "unsafe-ds-offset-folding", |
| 1721 | .description = "Force using DS instruction immediate offsets on SI", | 1721 | .description = "Force using DS instruction immediate offsets on SI", |
| 1722 | .dependencies = featureSet(&[_]Feature{}), | 1722 | .dependencies = featureSet(&[_]Feature{}), |
| 1723 | }; | 1723 | }; |
| 1724 | result[@intFromEnum(Feature.user_sgpr_init16_bug)] = .{ | 1724 | result[@backingInt(Feature.user_sgpr_init16_bug)] = .{ |
| 1725 | .llvm_name = "user-sgpr-init16-bug", | 1725 | .llvm_name = "user-sgpr-init16-bug", |
| 1726 | .description = "Bug requiring at least 16 user+system SGPRs to be enabled", | 1726 | .description = "Bug requiring at least 16 user+system SGPRs to be enabled", |
| 1727 | .dependencies = featureSet(&[_]Feature{}), | 1727 | .dependencies = featureSet(&[_]Feature{}), |
| 1728 | }; | 1728 | }; |
| 1729 | result[@intFromEnum(Feature.valu_trans_use_hazard)] = .{ | 1729 | result[@backingInt(Feature.valu_trans_use_hazard)] = .{ |
| 1730 | .llvm_name = "valu-trans-use-hazard", | 1730 | .llvm_name = "valu-trans-use-hazard", |
| 1731 | .description = "Hazard when TRANS instructions are closely followed by a use of the result", | 1731 | .description = "Hazard when TRANS instructions are closely followed by a use of the result", |
| 1732 | .dependencies = featureSet(&[_]Feature{}), | 1732 | .dependencies = featureSet(&[_]Feature{}), |
| 1733 | }; | 1733 | }; |
| 1734 | result[@intFromEnum(Feature.vcmpx_exec_war_hazard)] = .{ | 1734 | result[@backingInt(Feature.vcmpx_exec_war_hazard)] = .{ |
| 1735 | .llvm_name = "vcmpx-exec-war-hazard", | 1735 | .llvm_name = "vcmpx-exec-war-hazard", |
| 1736 | .description = "V_CMPX WAR hazard on EXEC (V_CMPX issue ONLY)", | 1736 | .description = "V_CMPX WAR hazard on EXEC (V_CMPX issue ONLY)", |
| 1737 | .dependencies = featureSet(&[_]Feature{}), | 1737 | .dependencies = featureSet(&[_]Feature{}), |
| 1738 | }; | 1738 | }; |
| 1739 | result[@intFromEnum(Feature.vcmpx_permlane_hazard)] = .{ | 1739 | result[@backingInt(Feature.vcmpx_permlane_hazard)] = .{ |
| 1740 | .llvm_name = "vcmpx-permlane-hazard", | 1740 | .llvm_name = "vcmpx-permlane-hazard", |
| 1741 | .description = "TODO: describe me", | 1741 | .description = "TODO: describe me", |
| 1742 | .dependencies = featureSet(&[_]Feature{}), | 1742 | .dependencies = featureSet(&[_]Feature{}), |
| 1743 | }; | 1743 | }; |
| 1744 | result[@intFromEnum(Feature.vgpr_align2)] = .{ | 1744 | result[@backingInt(Feature.vgpr_align2)] = .{ |
| 1745 | .llvm_name = "vgpr-align2", | 1745 | .llvm_name = "vgpr-align2", |
| 1746 | .description = "VGPR and AGPR tuple operands require even alignment", | 1746 | .description = "VGPR and AGPR tuple operands require even alignment", |
| 1747 | .dependencies = featureSet(&[_]Feature{}), | 1747 | .dependencies = featureSet(&[_]Feature{}), |
| 1748 | }; | 1748 | }; |
| 1749 | result[@intFromEnum(Feature.vgpr_index_mode)] = .{ | 1749 | result[@backingInt(Feature.vgpr_index_mode)] = .{ |
| 1750 | .llvm_name = "vgpr-index-mode", | 1750 | .llvm_name = "vgpr-index-mode", |
| 1751 | .description = "Has VGPR mode register indexing", | 1751 | .description = "Has VGPR mode register indexing", |
| 1752 | .dependencies = featureSet(&[_]Feature{}), | 1752 | .dependencies = featureSet(&[_]Feature{}), |
| 1753 | }; | 1753 | }; |
| 1754 | result[@intFromEnum(Feature.vmem_pref_insts)] = .{ | 1754 | result[@backingInt(Feature.vmem_pref_insts)] = .{ |
| 1755 | .llvm_name = "vmem-pref-insts", | 1755 | .llvm_name = "vmem-pref-insts", |
| 1756 | .description = "Has flat_prefect_b8 and global_prefetch_b8 instructions", | 1756 | .description = "Has flat_prefect_b8 and global_prefetch_b8 instructions", |
| 1757 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "vmem-to-lds-load-insts", | 1760 | .llvm_name = "vmem-to-lds-load-insts", |
| 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.", | 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 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "vmem-to-scalar-write-hazard", | 1765 | .llvm_name = "vmem-to-scalar-write-hazard", |
| 1766 | .description = "VMEM instruction followed by scalar writing to EXEC mask, M0 or SGPR leads to incorrect execution.", | 1766 | .description = "VMEM instruction followed by scalar writing to EXEC mask, M0 or SGPR leads to incorrect execution.", |
| 1767 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "vmem-write-vgpr-in-order", | 1770 | .llvm_name = "vmem-write-vgpr-in-order", |
| 1771 | .description = "VMEM instructions of the same type write VGPR results in order", | 1771 | .description = "VMEM instructions of the same type write VGPR results in order", |
| 1772 | .dependencies = featureSet(&[_]Feature{}), | 1772 | .dependencies = featureSet(&[_]Feature{}), |
| 1773 | }; | 1773 | }; |
| 1774 | result[@intFromEnum(Feature.volcanic_islands)] = .{ | 1774 | result[@backingInt(Feature.volcanic_islands)] = .{ |
| 1775 | .llvm_name = "volcanic-islands", | 1775 | .llvm_name = "volcanic-islands", |
| 1776 | .description = "VOLCANIC_ISLANDS GPU generation", | 1776 | .description = "VOLCANIC_ISLANDS GPU generation", |
| 1777 | .dependencies = featureSet(&[_]Feature{ | 1777 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1814,62 +1814,62 @@ pub const all_features = blk: { | ... | @@ -1814,62 +1814,62 @@ pub const all_features = blk: { |
| 1814 | .wavefrontsize64, | 1814 | .wavefrontsize64, |
| 1815 | }), | 1815 | }), |
| 1816 | }; | 1816 | }; |
| 1817 | result[@intFromEnum(Feature.vop3_literal)] = .{ | 1817 | result[@backingInt(Feature.vop3_literal)] = .{ |
| 1818 | .llvm_name = "vop3-literal", | 1818 | .llvm_name = "vop3-literal", |
| 1819 | .description = "Can use one literal in VOP3", | 1819 | .description = "Can use one literal in VOP3", |
| 1820 | .dependencies = featureSet(&[_]Feature{}), | 1820 | .dependencies = featureSet(&[_]Feature{}), |
| 1821 | }; | 1821 | }; |
| 1822 | result[@intFromEnum(Feature.vop3p)] = .{ | 1822 | result[@backingInt(Feature.vop3p)] = .{ |
| 1823 | .llvm_name = "vop3p", | 1823 | .llvm_name = "vop3p", |
| 1824 | .description = "Has VOP3P packed instructions", | 1824 | .description = "Has VOP3P packed instructions", |
| 1825 | .dependencies = featureSet(&[_]Feature{}), | 1825 | .dependencies = featureSet(&[_]Feature{}), |
| 1826 | }; | 1826 | }; |
| 1827 | result[@intFromEnum(Feature.vopd)] = .{ | 1827 | result[@backingInt(Feature.vopd)] = .{ |
| 1828 | .llvm_name = "vopd", | 1828 | .llvm_name = "vopd", |
| 1829 | .description = "Has VOPD dual issue wave32 instructions", | 1829 | .description = "Has VOPD dual issue wave32 instructions", |
| 1830 | .dependencies = featureSet(&[_]Feature{}), | 1830 | .dependencies = featureSet(&[_]Feature{}), |
| 1831 | }; | 1831 | }; |
| 1832 | result[@intFromEnum(Feature.vscnt)] = .{ | 1832 | result[@backingInt(Feature.vscnt)] = .{ |
| 1833 | .llvm_name = "vscnt", | 1833 | .llvm_name = "vscnt", |
| 1834 | .description = "Has separate store vscnt counter", | 1834 | .description = "Has separate store vscnt counter", |
| 1835 | .dependencies = featureSet(&[_]Feature{}), | 1835 | .dependencies = featureSet(&[_]Feature{}), |
| 1836 | }; | 1836 | }; |
| 1837 | result[@intFromEnum(Feature.wait_xcnt)] = .{ | 1837 | result[@backingInt(Feature.wait_xcnt)] = .{ |
| 1838 | .llvm_name = "wait-xcnt", | 1838 | .llvm_name = "wait-xcnt", |
| 1839 | .description = "Has s_wait_xcnt instruction", | 1839 | .description = "Has s_wait_xcnt instruction", |
| 1840 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "waits-before-system-scope-stores", | 1843 | .llvm_name = "waits-before-system-scope-stores", |
| 1844 | .description = "Target requires waits for loads and atomics before system scope stores", | 1844 | .description = "Target requires waits for loads and atomics before system scope stores", |
| 1845 | .dependencies = featureSet(&[_]Feature{}), | 1845 | .dependencies = featureSet(&[_]Feature{}), |
| 1846 | }; | 1846 | }; |
| 1847 | result[@intFromEnum(Feature.wavefrontsize16)] = .{ | 1847 | result[@backingInt(Feature.wavefrontsize16)] = .{ |
| 1848 | .llvm_name = "wavefrontsize16", | 1848 | .llvm_name = "wavefrontsize16", |
| 1849 | .description = "The number of threads per wavefront", | 1849 | .description = "The number of threads per wavefront", |
| 1850 | .dependencies = featureSet(&[_]Feature{}), | 1850 | .dependencies = featureSet(&[_]Feature{}), |
| 1851 | }; | 1851 | }; |
| 1852 | result[@intFromEnum(Feature.wavefrontsize32)] = .{ | 1852 | result[@backingInt(Feature.wavefrontsize32)] = .{ |
| 1853 | .llvm_name = "wavefrontsize32", | 1853 | .llvm_name = "wavefrontsize32", |
| 1854 | .description = "The number of threads per wavefront", | 1854 | .description = "The number of threads per wavefront", |
| 1855 | .dependencies = featureSet(&[_]Feature{}), | 1855 | .dependencies = featureSet(&[_]Feature{}), |
| 1856 | }; | 1856 | }; |
| 1857 | result[@intFromEnum(Feature.wavefrontsize64)] = .{ | 1857 | result[@backingInt(Feature.wavefrontsize64)] = .{ |
| 1858 | .llvm_name = "wavefrontsize64", | 1858 | .llvm_name = "wavefrontsize64", |
| 1859 | .description = "The number of threads per wavefront", | 1859 | .description = "The number of threads per wavefront", |
| 1860 | .dependencies = featureSet(&[_]Feature{}), | 1860 | .dependencies = featureSet(&[_]Feature{}), |
| 1861 | }; | 1861 | }; |
| 1862 | result[@intFromEnum(Feature.xf32_insts)] = .{ | 1862 | result[@backingInt(Feature.xf32_insts)] = .{ |
| 1863 | .llvm_name = "xf32-insts", | 1863 | .llvm_name = "xf32-insts", |
| 1864 | .description = "Has instructions that support xf32 format, such as v_mfma_f32_16x16x8_xf32 and v_mfma_f32_32x32x4_xf32", | 1864 | .description = "Has instructions that support xf32 format, such as v_mfma_f32_16x16x8_xf32 and v_mfma_f32_32x32x4_xf32", |
| 1865 | .dependencies = featureSet(&[_]Feature{}), | 1865 | .dependencies = featureSet(&[_]Feature{}), |
| 1866 | }; | 1866 | }; |
| 1867 | result[@intFromEnum(Feature.xnack)] = .{ | 1867 | result[@backingInt(Feature.xnack)] = .{ |
| 1868 | .llvm_name = "xnack", | 1868 | .llvm_name = "xnack", |
| 1869 | .description = "Enable XNACK support", | 1869 | .description = "Enable XNACK support", |
| 1870 | .dependencies = featureSet(&[_]Feature{}), | 1870 | .dependencies = featureSet(&[_]Feature{}), |
| 1871 | }; | 1871 | }; |
| 1872 | result[@intFromEnum(Feature.xnack_support)] = .{ | 1872 | result[@backingInt(Feature.xnack_support)] = .{ |
| 1873 | .llvm_name = "xnack-support", | 1873 | .llvm_name = "xnack-support", |
| 1874 | .description = "Hardware supports XNACK", | 1874 | .description = "Hardware supports XNACK", |
| 1875 | .dependencies = featureSet(&[_]Feature{}), | 1875 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/arc.zig+1-1| ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { | ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { |
| 17 | const len = @typeInfo(Feature).@"enum".field_names.len; | 17 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 19 | var result: [len]CpuFeature = undefined; | 19 | var result: [len]CpuFeature = undefined; |
| 20 | result[@intFromEnum(Feature.norm)] = .{ | 20 | result[@backingInt(Feature.norm)] = .{ |
| 21 | .llvm_name = "norm", | 21 | .llvm_name = "norm", |
| 22 | .description = "Enable support for norm instruction.", | 22 | .description = "Enable support for norm instruction.", |
| 23 | .dependencies = featureSet(&[_]Feature{}), | 23 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/arm.zig+201-201| ... | @@ -218,159 +218,159 @@ pub const all_features = blk: { | ... | @@ -218,159 +218,159 @@ pub const all_features = blk: { |
| 218 | const len = @typeInfo(Feature).@"enum".field_names.len; | 218 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 219 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 219 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 220 | var result: [len]CpuFeature = undefined; | 220 | var result: [len]CpuFeature = undefined; |
| 221 | result[@intFromEnum(Feature.@"32bit")] = .{ | 221 | result[@backingInt(Feature.@"32bit")] = .{ |
| 222 | .llvm_name = "32bit", | 222 | .llvm_name = "32bit", |
| 223 | .description = "Prefer 32-bit Thumb instrs", | 223 | .description = "Prefer 32-bit Thumb instrs", |
| 224 | .dependencies = featureSet(&[_]Feature{}), | 224 | .dependencies = featureSet(&[_]Feature{}), |
| 225 | }; | 225 | }; |
| 226 | result[@intFromEnum(Feature.@"8msecext")] = .{ | 226 | result[@backingInt(Feature.@"8msecext")] = .{ |
| 227 | .llvm_name = "8msecext", | 227 | .llvm_name = "8msecext", |
| 228 | .description = "Enable support for ARMv8-M Security Extensions", | 228 | .description = "Enable support for ARMv8-M Security Extensions", |
| 229 | .dependencies = featureSet(&[_]Feature{}), | 229 | .dependencies = featureSet(&[_]Feature{}), |
| 230 | }; | 230 | }; |
| 231 | result[@intFromEnum(Feature.aapcs_frame_chain)] = .{ | 231 | result[@backingInt(Feature.aapcs_frame_chain)] = .{ |
| 232 | .llvm_name = "aapcs-frame-chain", | 232 | .llvm_name = "aapcs-frame-chain", |
| 233 | .description = "Create an AAPCS compliant frame chain", | 233 | .description = "Create an AAPCS compliant frame chain", |
| 234 | .dependencies = featureSet(&[_]Feature{}), | 234 | .dependencies = featureSet(&[_]Feature{}), |
| 235 | }; | 235 | }; |
| 236 | result[@intFromEnum(Feature.aclass)] = .{ | 236 | result[@backingInt(Feature.aclass)] = .{ |
| 237 | .llvm_name = "aclass", | 237 | .llvm_name = "aclass", |
| 238 | .description = "Is application profile ('A' series)", | 238 | .description = "Is application profile ('A' series)", |
| 239 | .dependencies = featureSet(&[_]Feature{}), | 239 | .dependencies = featureSet(&[_]Feature{}), |
| 240 | }; | 240 | }; |
| 241 | result[@intFromEnum(Feature.acquire_release)] = .{ | 241 | result[@backingInt(Feature.acquire_release)] = .{ |
| 242 | .llvm_name = "acquire-release", | 242 | .llvm_name = "acquire-release", |
| 243 | .description = "Has v8 acquire/release (lda/ldaex etc) instructions", | 243 | .description = "Has v8 acquire/release (lda/ldaex etc) instructions", |
| 244 | .dependencies = featureSet(&[_]Feature{}), | 244 | .dependencies = featureSet(&[_]Feature{}), |
| 245 | }; | 245 | }; |
| 246 | result[@intFromEnum(Feature.aes)] = .{ | 246 | result[@backingInt(Feature.aes)] = .{ |
| 247 | .llvm_name = "aes", | 247 | .llvm_name = "aes", |
| 248 | .description = "Enable AES support", | 248 | .description = "Enable AES support", |
| 249 | .dependencies = featureSet(&[_]Feature{ | 249 | .dependencies = featureSet(&[_]Feature{ |
| 250 | .neon, | 250 | .neon, |
| 251 | }), | 251 | }), |
| 252 | }; | 252 | }; |
| 253 | result[@intFromEnum(Feature.atomics_32)] = .{ | 253 | result[@backingInt(Feature.atomics_32)] = .{ |
| 254 | .llvm_name = "atomics-32", | 254 | .llvm_name = "atomics-32", |
| 255 | .description = "Assume that lock-free 32-bit atomics are available", | 255 | .description = "Assume that lock-free 32-bit atomics are available", |
| 256 | .dependencies = featureSet(&[_]Feature{}), | 256 | .dependencies = featureSet(&[_]Feature{}), |
| 257 | }; | 257 | }; |
| 258 | result[@intFromEnum(Feature.avoid_movs_shop)] = .{ | 258 | result[@backingInt(Feature.avoid_movs_shop)] = .{ |
| 259 | .llvm_name = "avoid-movs-shop", | 259 | .llvm_name = "avoid-movs-shop", |
| 260 | .description = "Avoid movs instructions with shifter operand", | 260 | .description = "Avoid movs instructions with shifter operand", |
| 261 | .dependencies = featureSet(&[_]Feature{}), | 261 | .dependencies = featureSet(&[_]Feature{}), |
| 262 | }; | 262 | }; |
| 263 | result[@intFromEnum(Feature.avoid_muls)] = .{ | 263 | result[@backingInt(Feature.avoid_muls)] = .{ |
| 264 | .llvm_name = "avoid-muls", | 264 | .llvm_name = "avoid-muls", |
| 265 | .description = "Avoid MULS instructions for M class cores", | 265 | .description = "Avoid MULS instructions for M class cores", |
| 266 | .dependencies = featureSet(&[_]Feature{}), | 266 | .dependencies = featureSet(&[_]Feature{}), |
| 267 | }; | 267 | }; |
| 268 | result[@intFromEnum(Feature.avoid_partial_cpsr)] = .{ | 268 | result[@backingInt(Feature.avoid_partial_cpsr)] = .{ |
| 269 | .llvm_name = "avoid-partial-cpsr", | 269 | .llvm_name = "avoid-partial-cpsr", |
| 270 | .description = "Avoid CPSR partial update for OOO execution", | 270 | .description = "Avoid CPSR partial update for OOO execution", |
| 271 | .dependencies = featureSet(&[_]Feature{}), | 271 | .dependencies = featureSet(&[_]Feature{}), |
| 272 | }; | 272 | }; |
| 273 | result[@intFromEnum(Feature.bf16)] = .{ | 273 | result[@backingInt(Feature.bf16)] = .{ |
| 274 | .llvm_name = "bf16", | 274 | .llvm_name = "bf16", |
| 275 | .description = "Enable support for BFloat16 instructions", | 275 | .description = "Enable support for BFloat16 instructions", |
| 276 | .dependencies = featureSet(&[_]Feature{ | 276 | .dependencies = featureSet(&[_]Feature{ |
| 277 | .neon, | 277 | .neon, |
| 278 | }), | 278 | }), |
| 279 | }; | 279 | }; |
| 280 | result[@intFromEnum(Feature.big_endian_instructions)] = .{ | 280 | result[@backingInt(Feature.big_endian_instructions)] = .{ |
| 281 | .llvm_name = "big-endian-instructions", | 281 | .llvm_name = "big-endian-instructions", |
| 282 | .description = "Expect instructions to be stored big-endian.", | 282 | .description = "Expect instructions to be stored big-endian.", |
| 283 | .dependencies = featureSet(&[_]Feature{}), | 283 | .dependencies = featureSet(&[_]Feature{}), |
| 284 | }; | 284 | }; |
| 285 | result[@intFromEnum(Feature.branch_align_64)] = .{ | 285 | result[@backingInt(Feature.branch_align_64)] = .{ |
| 286 | .llvm_name = "branch-align-64", | 286 | .llvm_name = "branch-align-64", |
| 287 | .description = "Prefer 64-bit alignment for branch targets", | 287 | .description = "Prefer 64-bit alignment for branch targets", |
| 288 | .dependencies = featureSet(&[_]Feature{}), | 288 | .dependencies = featureSet(&[_]Feature{}), |
| 289 | }; | 289 | }; |
| 290 | result[@intFromEnum(Feature.cde)] = .{ | 290 | result[@backingInt(Feature.cde)] = .{ |
| 291 | .llvm_name = "cde", | 291 | .llvm_name = "cde", |
| 292 | .description = "Support CDE instructions", | 292 | .description = "Support CDE instructions", |
| 293 | .dependencies = featureSet(&[_]Feature{ | 293 | .dependencies = featureSet(&[_]Feature{ |
| 294 | .has_v8m_main, | 294 | .has_v8m_main, |
| 295 | }), | 295 | }), |
| 296 | }; | 296 | }; |
| 297 | result[@intFromEnum(Feature.cdecp0)] = .{ | 297 | result[@backingInt(Feature.cdecp0)] = .{ |
| 298 | .llvm_name = "cdecp0", | 298 | .llvm_name = "cdecp0", |
| 299 | .description = "Coprocessor 0 ISA is CDEv1", | 299 | .description = "Coprocessor 0 ISA is CDEv1", |
| 300 | .dependencies = featureSet(&[_]Feature{ | 300 | .dependencies = featureSet(&[_]Feature{ |
| 301 | .cde, | 301 | .cde, |
| 302 | }), | 302 | }), |
| 303 | }; | 303 | }; |
| 304 | result[@intFromEnum(Feature.cdecp1)] = .{ | 304 | result[@backingInt(Feature.cdecp1)] = .{ |
| 305 | .llvm_name = "cdecp1", | 305 | .llvm_name = "cdecp1", |
| 306 | .description = "Coprocessor 1 ISA is CDEv1", | 306 | .description = "Coprocessor 1 ISA is CDEv1", |
| 307 | .dependencies = featureSet(&[_]Feature{ | 307 | .dependencies = featureSet(&[_]Feature{ |
| 308 | .cde, | 308 | .cde, |
| 309 | }), | 309 | }), |
| 310 | }; | 310 | }; |
| 311 | result[@intFromEnum(Feature.cdecp2)] = .{ | 311 | result[@backingInt(Feature.cdecp2)] = .{ |
| 312 | .llvm_name = "cdecp2", | 312 | .llvm_name = "cdecp2", |
| 313 | .description = "Coprocessor 2 ISA is CDEv1", | 313 | .description = "Coprocessor 2 ISA is CDEv1", |
| 314 | .dependencies = featureSet(&[_]Feature{ | 314 | .dependencies = featureSet(&[_]Feature{ |
| 315 | .cde, | 315 | .cde, |
| 316 | }), | 316 | }), |
| 317 | }; | 317 | }; |
| 318 | result[@intFromEnum(Feature.cdecp3)] = .{ | 318 | result[@backingInt(Feature.cdecp3)] = .{ |
| 319 | .llvm_name = "cdecp3", | 319 | .llvm_name = "cdecp3", |
| 320 | .description = "Coprocessor 3 ISA is CDEv1", | 320 | .description = "Coprocessor 3 ISA is CDEv1", |
| 321 | .dependencies = featureSet(&[_]Feature{ | 321 | .dependencies = featureSet(&[_]Feature{ |
| 322 | .cde, | 322 | .cde, |
| 323 | }), | 323 | }), |
| 324 | }; | 324 | }; |
| 325 | result[@intFromEnum(Feature.cdecp4)] = .{ | 325 | result[@backingInt(Feature.cdecp4)] = .{ |
| 326 | .llvm_name = "cdecp4", | 326 | .llvm_name = "cdecp4", |
| 327 | .description = "Coprocessor 4 ISA is CDEv1", | 327 | .description = "Coprocessor 4 ISA is CDEv1", |
| 328 | .dependencies = featureSet(&[_]Feature{ | 328 | .dependencies = featureSet(&[_]Feature{ |
| 329 | .cde, | 329 | .cde, |
| 330 | }), | 330 | }), |
| 331 | }; | 331 | }; |
| 332 | result[@intFromEnum(Feature.cdecp5)] = .{ | 332 | result[@backingInt(Feature.cdecp5)] = .{ |
| 333 | .llvm_name = "cdecp5", | 333 | .llvm_name = "cdecp5", |
| 334 | .description = "Coprocessor 5 ISA is CDEv1", | 334 | .description = "Coprocessor 5 ISA is CDEv1", |
| 335 | .dependencies = featureSet(&[_]Feature{ | 335 | .dependencies = featureSet(&[_]Feature{ |
| 336 | .cde, | 336 | .cde, |
| 337 | }), | 337 | }), |
| 338 | }; | 338 | }; |
| 339 | result[@intFromEnum(Feature.cdecp6)] = .{ | 339 | result[@backingInt(Feature.cdecp6)] = .{ |
| 340 | .llvm_name = "cdecp6", | 340 | .llvm_name = "cdecp6", |
| 341 | .description = "Coprocessor 6 ISA is CDEv1", | 341 | .description = "Coprocessor 6 ISA is CDEv1", |
| 342 | .dependencies = featureSet(&[_]Feature{ | 342 | .dependencies = featureSet(&[_]Feature{ |
| 343 | .cde, | 343 | .cde, |
| 344 | }), | 344 | }), |
| 345 | }; | 345 | }; |
| 346 | result[@intFromEnum(Feature.cdecp7)] = .{ | 346 | result[@backingInt(Feature.cdecp7)] = .{ |
| 347 | .llvm_name = "cdecp7", | 347 | .llvm_name = "cdecp7", |
| 348 | .description = "Coprocessor 7 ISA is CDEv1", | 348 | .description = "Coprocessor 7 ISA is CDEv1", |
| 349 | .dependencies = featureSet(&[_]Feature{ | 349 | .dependencies = featureSet(&[_]Feature{ |
| 350 | .cde, | 350 | .cde, |
| 351 | }), | 351 | }), |
| 352 | }; | 352 | }; |
| 353 | result[@intFromEnum(Feature.cheap_predicable_cpsr)] = .{ | 353 | result[@backingInt(Feature.cheap_predicable_cpsr)] = .{ |
| 354 | .llvm_name = "cheap-predicable-cpsr", | 354 | .llvm_name = "cheap-predicable-cpsr", |
| 355 | .description = "Disable +1 predication cost for instructions updating CPSR", | 355 | .description = "Disable +1 predication cost for instructions updating CPSR", |
| 356 | .dependencies = featureSet(&[_]Feature{}), | 356 | .dependencies = featureSet(&[_]Feature{}), |
| 357 | }; | 357 | }; |
| 358 | result[@intFromEnum(Feature.clrbhb)] = .{ | 358 | result[@backingInt(Feature.clrbhb)] = .{ |
| 359 | .llvm_name = "clrbhb", | 359 | .llvm_name = "clrbhb", |
| 360 | .description = "Enable Clear BHB instruction", | 360 | .description = "Enable Clear BHB instruction", |
| 361 | .dependencies = featureSet(&[_]Feature{}), | 361 | .dependencies = featureSet(&[_]Feature{}), |
| 362 | }; | 362 | }; |
| 363 | result[@intFromEnum(Feature.cortex_a510)] = .{ | 363 | result[@backingInt(Feature.cortex_a510)] = .{ |
| 364 | .llvm_name = "cortex-a510", | 364 | .llvm_name = "cortex-a510", |
| 365 | .description = "Cortex-A510 ARM processors", | 365 | .description = "Cortex-A510 ARM processors", |
| 366 | .dependencies = featureSet(&[_]Feature{}), | 366 | .dependencies = featureSet(&[_]Feature{}), |
| 367 | }; | 367 | }; |
| 368 | result[@intFromEnum(Feature.crc)] = .{ | 368 | result[@backingInt(Feature.crc)] = .{ |
| 369 | .llvm_name = "crc", | 369 | .llvm_name = "crc", |
| 370 | .description = "Enable support for CRC instructions", | 370 | .description = "Enable support for CRC instructions", |
| 371 | .dependencies = featureSet(&[_]Feature{}), | 371 | .dependencies = featureSet(&[_]Feature{}), |
| 372 | }; | 372 | }; |
| 373 | result[@intFromEnum(Feature.crypto)] = .{ | 373 | result[@backingInt(Feature.crypto)] = .{ |
| 374 | .llvm_name = "crypto", | 374 | .llvm_name = "crypto", |
| 375 | .description = "Enable support for Cryptography extensions", | 375 | .description = "Enable support for Cryptography extensions", |
| 376 | .dependencies = featureSet(&[_]Feature{ | 376 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -378,83 +378,83 @@ pub const all_features = blk: { | ... | @@ -378,83 +378,83 @@ pub const all_features = blk: { |
| 378 | .sha2, | 378 | .sha2, |
| 379 | }), | 379 | }), |
| 380 | }; | 380 | }; |
| 381 | result[@intFromEnum(Feature.d32)] = .{ | 381 | result[@backingInt(Feature.d32)] = .{ |
| 382 | .llvm_name = "d32", | 382 | .llvm_name = "d32", |
| 383 | .description = "Extend FP to 32 double registers", | 383 | .description = "Extend FP to 32 double registers", |
| 384 | .dependencies = featureSet(&[_]Feature{}), | 384 | .dependencies = featureSet(&[_]Feature{}), |
| 385 | }; | 385 | }; |
| 386 | result[@intFromEnum(Feature.db)] = .{ | 386 | result[@backingInt(Feature.db)] = .{ |
| 387 | .llvm_name = "db", | 387 | .llvm_name = "db", |
| 388 | .description = "Has data barrier (dmb/dsb) instructions", | 388 | .description = "Has data barrier (dmb/dsb) instructions", |
| 389 | .dependencies = featureSet(&[_]Feature{}), | 389 | .dependencies = featureSet(&[_]Feature{}), |
| 390 | }; | 390 | }; |
| 391 | result[@intFromEnum(Feature.dfb)] = .{ | 391 | result[@backingInt(Feature.dfb)] = .{ |
| 392 | .llvm_name = "dfb", | 392 | .llvm_name = "dfb", |
| 393 | .description = "Has full data barrier (dfb) instruction", | 393 | .description = "Has full data barrier (dfb) instruction", |
| 394 | .dependencies = featureSet(&[_]Feature{}), | 394 | .dependencies = featureSet(&[_]Feature{}), |
| 395 | }; | 395 | }; |
| 396 | result[@intFromEnum(Feature.disable_postra_scheduler)] = .{ | 396 | result[@backingInt(Feature.disable_postra_scheduler)] = .{ |
| 397 | .llvm_name = "disable-postra-scheduler", | 397 | .llvm_name = "disable-postra-scheduler", |
| 398 | .description = "Don't schedule again after register allocation", | 398 | .description = "Don't schedule again after register allocation", |
| 399 | .dependencies = featureSet(&[_]Feature{}), | 399 | .dependencies = featureSet(&[_]Feature{}), |
| 400 | }; | 400 | }; |
| 401 | result[@intFromEnum(Feature.dont_widen_vmovs)] = .{ | 401 | result[@backingInt(Feature.dont_widen_vmovs)] = .{ |
| 402 | .llvm_name = "dont-widen-vmovs", | 402 | .llvm_name = "dont-widen-vmovs", |
| 403 | .description = "Don't widen VMOVS to VMOVD", | 403 | .description = "Don't widen VMOVS to VMOVD", |
| 404 | .dependencies = featureSet(&[_]Feature{}), | 404 | .dependencies = featureSet(&[_]Feature{}), |
| 405 | }; | 405 | }; |
| 406 | result[@intFromEnum(Feature.dotprod)] = .{ | 406 | result[@backingInt(Feature.dotprod)] = .{ |
| 407 | .llvm_name = "dotprod", | 407 | .llvm_name = "dotprod", |
| 408 | .description = "Enable support for dot product instructions", | 408 | .description = "Enable support for dot product instructions", |
| 409 | .dependencies = featureSet(&[_]Feature{ | 409 | .dependencies = featureSet(&[_]Feature{ |
| 410 | .neon, | 410 | .neon, |
| 411 | }), | 411 | }), |
| 412 | }; | 412 | }; |
| 413 | result[@intFromEnum(Feature.dsp)] = .{ | 413 | result[@backingInt(Feature.dsp)] = .{ |
| 414 | .llvm_name = "dsp", | 414 | .llvm_name = "dsp", |
| 415 | .description = "Supports DSP instructions in ARM and/or Thumb2", | 415 | .description = "Supports DSP instructions in ARM and/or Thumb2", |
| 416 | .dependencies = featureSet(&[_]Feature{}), | 416 | .dependencies = featureSet(&[_]Feature{}), |
| 417 | }; | 417 | }; |
| 418 | result[@intFromEnum(Feature.execute_only)] = .{ | 418 | result[@backingInt(Feature.execute_only)] = .{ |
| 419 | .llvm_name = "execute-only", | 419 | .llvm_name = "execute-only", |
| 420 | .description = "Enable the generation of execute only code.", | 420 | .description = "Enable the generation of execute only code.", |
| 421 | .dependencies = featureSet(&[_]Feature{}), | 421 | .dependencies = featureSet(&[_]Feature{}), |
| 422 | }; | 422 | }; |
| 423 | result[@intFromEnum(Feature.expand_fp_mlx)] = .{ | 423 | result[@backingInt(Feature.expand_fp_mlx)] = .{ |
| 424 | .llvm_name = "expand-fp-mlx", | 424 | .llvm_name = "expand-fp-mlx", |
| 425 | .description = "Expand VFP/NEON MLA/MLS instructions", | 425 | .description = "Expand VFP/NEON MLA/MLS instructions", |
| 426 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "fix-cmse-cve-2021-35465", | 429 | .llvm_name = "fix-cmse-cve-2021-35465", |
| 430 | .description = "Mitigate against the cve-2021-35465 security vulnurability", | 430 | .description = "Mitigate against the cve-2021-35465 security vulnurability", |
| 431 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "fix-cortex-a57-aes-1742098", | 434 | .llvm_name = "fix-cortex-a57-aes-1742098", |
| 435 | .description = "Work around Cortex-A57 Erratum 1742098 / Cortex-A72 Erratum 1655431 (AES)", | 435 | .description = "Work around Cortex-A57 Erratum 1742098 / Cortex-A72 Erratum 1655431 (AES)", |
| 436 | .dependencies = featureSet(&[_]Feature{}), | 436 | .dependencies = featureSet(&[_]Feature{}), |
| 437 | }; | 437 | }; |
| 438 | result[@intFromEnum(Feature.fp16)] = .{ | 438 | result[@backingInt(Feature.fp16)] = .{ |
| 439 | .llvm_name = "fp16", | 439 | .llvm_name = "fp16", |
| 440 | .description = "Enable half-precision floating point", | 440 | .description = "Enable half-precision floating point", |
| 441 | .dependencies = featureSet(&[_]Feature{}), | 441 | .dependencies = featureSet(&[_]Feature{}), |
| 442 | }; | 442 | }; |
| 443 | result[@intFromEnum(Feature.fp16fml)] = .{ | 443 | result[@backingInt(Feature.fp16fml)] = .{ |
| 444 | .llvm_name = "fp16fml", | 444 | .llvm_name = "fp16fml", |
| 445 | .description = "Enable full half-precision floating point fml instructions", | 445 | .description = "Enable full half-precision floating point fml instructions", |
| 446 | .dependencies = featureSet(&[_]Feature{ | 446 | .dependencies = featureSet(&[_]Feature{ |
| 447 | .fullfp16, | 447 | .fullfp16, |
| 448 | }), | 448 | }), |
| 449 | }; | 449 | }; |
| 450 | result[@intFromEnum(Feature.fp64)] = .{ | 450 | result[@backingInt(Feature.fp64)] = .{ |
| 451 | .llvm_name = "fp64", | 451 | .llvm_name = "fp64", |
| 452 | .description = "Floating point unit supports double precision", | 452 | .description = "Floating point unit supports double precision", |
| 453 | .dependencies = featureSet(&[_]Feature{ | 453 | .dependencies = featureSet(&[_]Feature{ |
| 454 | .fpregs64, | 454 | .fpregs64, |
| 455 | }), | 455 | }), |
| 456 | }; | 456 | }; |
| 457 | result[@intFromEnum(Feature.fp_armv8)] = .{ | 457 | result[@backingInt(Feature.fp_armv8)] = .{ |
| 458 | .llvm_name = "fp-armv8", | 458 | .llvm_name = "fp-armv8", |
| 459 | .description = "Enable ARMv8 FP", | 459 | .description = "Enable ARMv8 FP", |
| 460 | .dependencies = featureSet(&[_]Feature{ | 460 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -463,7 +463,7 @@ pub const all_features = blk: { | ... | @@ -463,7 +463,7 @@ pub const all_features = blk: { |
| 463 | .vfp4, | 463 | .vfp4, |
| 464 | }), | 464 | }), |
| 465 | }; | 465 | }; |
| 466 | result[@intFromEnum(Feature.fp_armv8d16)] = .{ | 466 | result[@backingInt(Feature.fp_armv8d16)] = .{ |
| 467 | .llvm_name = "fp-armv8d16", | 467 | .llvm_name = "fp-armv8d16", |
| 468 | .description = "Enable ARMv8 FP with only 16 d-registers", | 468 | .description = "Enable ARMv8 FP with only 16 d-registers", |
| 469 | .dependencies = featureSet(&[_]Feature{ | 469 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -471,14 +471,14 @@ pub const all_features = blk: { | ... | @@ -471,14 +471,14 @@ pub const all_features = blk: { |
| 471 | .vfp4d16, | 471 | .vfp4d16, |
| 472 | }), | 472 | }), |
| 473 | }; | 473 | }; |
| 474 | result[@intFromEnum(Feature.fp_armv8d16sp)] = .{ | 474 | result[@backingInt(Feature.fp_armv8d16sp)] = .{ |
| 475 | .llvm_name = "fp-armv8d16sp", | 475 | .llvm_name = "fp-armv8d16sp", |
| 476 | .description = "Enable ARMv8 FP with only 16 d-registers and no double precision", | 476 | .description = "Enable ARMv8 FP with only 16 d-registers and no double precision", |
| 477 | .dependencies = featureSet(&[_]Feature{ | 477 | .dependencies = featureSet(&[_]Feature{ |
| 478 | .vfp4d16sp, | 478 | .vfp4d16sp, |
| 479 | }), | 479 | }), |
| 480 | }; | 480 | }; |
| 481 | result[@intFromEnum(Feature.fp_armv8sp)] = .{ | 481 | result[@backingInt(Feature.fp_armv8sp)] = .{ |
| 482 | .llvm_name = "fp-armv8sp", | 482 | .llvm_name = "fp-armv8sp", |
| 483 | .description = "Enable ARMv8 FP with no double precision", | 483 | .description = "Enable ARMv8 FP with no double precision", |
| 484 | .dependencies = featureSet(&[_]Feature{ | 484 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -486,31 +486,31 @@ pub const all_features = blk: { | ... | @@ -486,31 +486,31 @@ pub const all_features = blk: { |
| 486 | .vfp4sp, | 486 | .vfp4sp, |
| 487 | }), | 487 | }), |
| 488 | }; | 488 | }; |
| 489 | result[@intFromEnum(Feature.fpao)] = .{ | 489 | result[@backingInt(Feature.fpao)] = .{ |
| 490 | .llvm_name = "fpao", | 490 | .llvm_name = "fpao", |
| 491 | .description = "Enable fast computation of positive address offsets", | 491 | .description = "Enable fast computation of positive address offsets", |
| 492 | .dependencies = featureSet(&[_]Feature{}), | 492 | .dependencies = featureSet(&[_]Feature{}), |
| 493 | }; | 493 | }; |
| 494 | result[@intFromEnum(Feature.fpregs)] = .{ | 494 | result[@backingInt(Feature.fpregs)] = .{ |
| 495 | .llvm_name = "fpregs", | 495 | .llvm_name = "fpregs", |
| 496 | .description = "Enable FP registers", | 496 | .description = "Enable FP registers", |
| 497 | .dependencies = featureSet(&[_]Feature{}), | 497 | .dependencies = featureSet(&[_]Feature{}), |
| 498 | }; | 498 | }; |
| 499 | result[@intFromEnum(Feature.fpregs16)] = .{ | 499 | result[@backingInt(Feature.fpregs16)] = .{ |
| 500 | .llvm_name = "fpregs16", | 500 | .llvm_name = "fpregs16", |
| 501 | .description = "Enable 16-bit FP registers", | 501 | .description = "Enable 16-bit FP registers", |
| 502 | .dependencies = featureSet(&[_]Feature{ | 502 | .dependencies = featureSet(&[_]Feature{ |
| 503 | .fpregs, | 503 | .fpregs, |
| 504 | }), | 504 | }), |
| 505 | }; | 505 | }; |
| 506 | result[@intFromEnum(Feature.fpregs64)] = .{ | 506 | result[@backingInt(Feature.fpregs64)] = .{ |
| 507 | .llvm_name = "fpregs64", | 507 | .llvm_name = "fpregs64", |
| 508 | .description = "Enable 64-bit FP registers", | 508 | .description = "Enable 64-bit FP registers", |
| 509 | .dependencies = featureSet(&[_]Feature{ | 509 | .dependencies = featureSet(&[_]Feature{ |
| 510 | .fpregs, | 510 | .fpregs, |
| 511 | }), | 511 | }), |
| 512 | }; | 512 | }; |
| 513 | result[@intFromEnum(Feature.fullfp16)] = .{ | 513 | result[@backingInt(Feature.fullfp16)] = .{ |
| 514 | .llvm_name = "fullfp16", | 514 | .llvm_name = "fullfp16", |
| 515 | .description = "Enable full half-precision floating point", | 515 | .description = "Enable full half-precision floating point", |
| 516 | .dependencies = featureSet(&[_]Feature{ | 516 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -518,72 +518,72 @@ pub const all_features = blk: { | ... | @@ -518,72 +518,72 @@ pub const all_features = blk: { |
| 518 | .fpregs16, | 518 | .fpregs16, |
| 519 | }), | 519 | }), |
| 520 | }; | 520 | }; |
| 521 | result[@intFromEnum(Feature.fuse_aes)] = .{ | 521 | result[@backingInt(Feature.fuse_aes)] = .{ |
| 522 | .llvm_name = "fuse-aes", | 522 | .llvm_name = "fuse-aes", |
| 523 | .description = "CPU fuses AES crypto operations", | 523 | .description = "CPU fuses AES crypto operations", |
| 524 | .dependencies = featureSet(&[_]Feature{}), | 524 | .dependencies = featureSet(&[_]Feature{}), |
| 525 | }; | 525 | }; |
| 526 | result[@intFromEnum(Feature.fuse_literals)] = .{ | 526 | result[@backingInt(Feature.fuse_literals)] = .{ |
| 527 | .llvm_name = "fuse-literals", | 527 | .llvm_name = "fuse-literals", |
| 528 | .description = "CPU fuses literal generation operations", | 528 | .description = "CPU fuses literal generation operations", |
| 529 | .dependencies = featureSet(&[_]Feature{}), | 529 | .dependencies = featureSet(&[_]Feature{}), |
| 530 | }; | 530 | }; |
| 531 | result[@intFromEnum(Feature.harden_sls_blr)] = .{ | 531 | result[@backingInt(Feature.harden_sls_blr)] = .{ |
| 532 | .llvm_name = "harden-sls-blr", | 532 | .llvm_name = "harden-sls-blr", |
| 533 | .description = "Harden against straight line speculation across indirect calls", | 533 | .description = "Harden against straight line speculation across indirect calls", |
| 534 | .dependencies = featureSet(&[_]Feature{}), | 534 | .dependencies = featureSet(&[_]Feature{}), |
| 535 | }; | 535 | }; |
| 536 | result[@intFromEnum(Feature.harden_sls_nocomdat)] = .{ | 536 | result[@backingInt(Feature.harden_sls_nocomdat)] = .{ |
| 537 | .llvm_name = "harden-sls-nocomdat", | 537 | .llvm_name = "harden-sls-nocomdat", |
| 538 | .description = "Generate thunk code for SLS mitigation in the normal text section", | 538 | .description = "Generate thunk code for SLS mitigation in the normal text section", |
| 539 | .dependencies = featureSet(&[_]Feature{}), | 539 | .dependencies = featureSet(&[_]Feature{}), |
| 540 | }; | 540 | }; |
| 541 | result[@intFromEnum(Feature.harden_sls_retbr)] = .{ | 541 | result[@backingInt(Feature.harden_sls_retbr)] = .{ |
| 542 | .llvm_name = "harden-sls-retbr", | 542 | .llvm_name = "harden-sls-retbr", |
| 543 | .description = "Harden against straight line speculation across RETurn and BranchRegister instructions", | 543 | .description = "Harden against straight line speculation across RETurn and BranchRegister instructions", |
| 544 | .dependencies = featureSet(&[_]Feature{}), | 544 | .dependencies = featureSet(&[_]Feature{}), |
| 545 | }; | 545 | }; |
| 546 | result[@intFromEnum(Feature.has_v4t)] = .{ | 546 | result[@backingInt(Feature.has_v4t)] = .{ |
| 547 | .llvm_name = "v4t", | 547 | .llvm_name = "v4t", |
| 548 | .description = "Support ARM v4T instructions", | 548 | .description = "Support ARM v4T instructions", |
| 549 | .dependencies = featureSet(&[_]Feature{}), | 549 | .dependencies = featureSet(&[_]Feature{}), |
| 550 | }; | 550 | }; |
| 551 | result[@intFromEnum(Feature.has_v5t)] = .{ | 551 | result[@backingInt(Feature.has_v5t)] = .{ |
| 552 | .llvm_name = "v5t", | 552 | .llvm_name = "v5t", |
| 553 | .description = "Support ARM v5T instructions", | 553 | .description = "Support ARM v5T instructions", |
| 554 | .dependencies = featureSet(&[_]Feature{ | 554 | .dependencies = featureSet(&[_]Feature{ |
| 555 | .has_v4t, | 555 | .has_v4t, |
| 556 | }), | 556 | }), |
| 557 | }; | 557 | }; |
| 558 | result[@intFromEnum(Feature.has_v5te)] = .{ | 558 | result[@backingInt(Feature.has_v5te)] = .{ |
| 559 | .llvm_name = "v5te", | 559 | .llvm_name = "v5te", |
| 560 | .description = "Support ARM v5TE, v5TEj, and v5TExp instructions", | 560 | .description = "Support ARM v5TE, v5TEj, and v5TExp instructions", |
| 561 | .dependencies = featureSet(&[_]Feature{ | 561 | .dependencies = featureSet(&[_]Feature{ |
| 562 | .has_v5t, | 562 | .has_v5t, |
| 563 | }), | 563 | }), |
| 564 | }; | 564 | }; |
| 565 | result[@intFromEnum(Feature.has_v6)] = .{ | 565 | result[@backingInt(Feature.has_v6)] = .{ |
| 566 | .llvm_name = "v6", | 566 | .llvm_name = "v6", |
| 567 | .description = "Support ARM v6 instructions", | 567 | .description = "Support ARM v6 instructions", |
| 568 | .dependencies = featureSet(&[_]Feature{ | 568 | .dependencies = featureSet(&[_]Feature{ |
| 569 | .has_v5te, | 569 | .has_v5te, |
| 570 | }), | 570 | }), |
| 571 | }; | 571 | }; |
| 572 | result[@intFromEnum(Feature.has_v6k)] = .{ | 572 | result[@backingInt(Feature.has_v6k)] = .{ |
| 573 | .llvm_name = "v6k", | 573 | .llvm_name = "v6k", |
| 574 | .description = "Support ARM v6k instructions", | 574 | .description = "Support ARM v6k instructions", |
| 575 | .dependencies = featureSet(&[_]Feature{ | 575 | .dependencies = featureSet(&[_]Feature{ |
| 576 | .has_v6, | 576 | .has_v6, |
| 577 | }), | 577 | }), |
| 578 | }; | 578 | }; |
| 579 | result[@intFromEnum(Feature.has_v6m)] = .{ | 579 | result[@backingInt(Feature.has_v6m)] = .{ |
| 580 | .llvm_name = "v6m", | 580 | .llvm_name = "v6m", |
| 581 | .description = "Support ARM v6M instructions", | 581 | .description = "Support ARM v6M instructions", |
| 582 | .dependencies = featureSet(&[_]Feature{ | 582 | .dependencies = featureSet(&[_]Feature{ |
| 583 | .has_v6, | 583 | .has_v6, |
| 584 | }), | 584 | }), |
| 585 | }; | 585 | }; |
| 586 | result[@intFromEnum(Feature.has_v6t2)] = .{ | 586 | result[@backingInt(Feature.has_v6t2)] = .{ |
| 587 | .llvm_name = "v6t2", | 587 | .llvm_name = "v6t2", |
| 588 | .description = "Support ARM v6t2 instructions", | 588 | .description = "Support ARM v6t2 instructions", |
| 589 | .dependencies = featureSet(&[_]Feature{ | 589 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -592,7 +592,7 @@ pub const all_features = blk: { | ... | @@ -592,7 +592,7 @@ pub const all_features = blk: { |
| 592 | .thumb2, | 592 | .thumb2, |
| 593 | }), | 593 | }), |
| 594 | }; | 594 | }; |
| 595 | result[@intFromEnum(Feature.has_v7)] = .{ | 595 | result[@backingInt(Feature.has_v7)] = .{ |
| 596 | .llvm_name = "v7", | 596 | .llvm_name = "v7", |
| 597 | .description = "Support ARM v7 instructions", | 597 | .description = "Support ARM v7 instructions", |
| 598 | .dependencies = featureSet(&[_]Feature{ | 598 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -600,12 +600,12 @@ pub const all_features = blk: { | ... | @@ -600,12 +600,12 @@ pub const all_features = blk: { |
| 600 | .has_v7clrex, | 600 | .has_v7clrex, |
| 601 | }), | 601 | }), |
| 602 | }; | 602 | }; |
| 603 | result[@intFromEnum(Feature.has_v7clrex)] = .{ | 603 | result[@backingInt(Feature.has_v7clrex)] = .{ |
| 604 | .llvm_name = "v7clrex", | 604 | .llvm_name = "v7clrex", |
| 605 | .description = "Has v7 clrex instruction", | 605 | .description = "Has v7 clrex instruction", |
| 606 | .dependencies = featureSet(&[_]Feature{}), | 606 | .dependencies = featureSet(&[_]Feature{}), |
| 607 | }; | 607 | }; |
| 608 | result[@intFromEnum(Feature.has_v8)] = .{ | 608 | result[@backingInt(Feature.has_v8)] = .{ |
| 609 | .llvm_name = "v8", | 609 | .llvm_name = "v8", |
| 610 | .description = "Support ARM v8 instructions", | 610 | .description = "Support ARM v8 instructions", |
| 611 | .dependencies = featureSet(&[_]Feature{ | 611 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -614,35 +614,35 @@ pub const all_features = blk: { | ... | @@ -614,35 +614,35 @@ pub const all_features = blk: { |
| 614 | .perfmon, | 614 | .perfmon, |
| 615 | }), | 615 | }), |
| 616 | }; | 616 | }; |
| 617 | result[@intFromEnum(Feature.has_v8_1a)] = .{ | 617 | result[@backingInt(Feature.has_v8_1a)] = .{ |
| 618 | .llvm_name = "v8.1a", | 618 | .llvm_name = "v8.1a", |
| 619 | .description = "Support ARM v8.1a instructions", | 619 | .description = "Support ARM v8.1a instructions", |
| 620 | .dependencies = featureSet(&[_]Feature{ | 620 | .dependencies = featureSet(&[_]Feature{ |
| 621 | .has_v8, | 621 | .has_v8, |
| 622 | }), | 622 | }), |
| 623 | }; | 623 | }; |
| 624 | result[@intFromEnum(Feature.has_v8_1m_main)] = .{ | 624 | result[@backingInt(Feature.has_v8_1m_main)] = .{ |
| 625 | .llvm_name = "v8.1m.main", | 625 | .llvm_name = "v8.1m.main", |
| 626 | .description = "Support ARM v8-1M Mainline instructions", | 626 | .description = "Support ARM v8-1M Mainline instructions", |
| 627 | .dependencies = featureSet(&[_]Feature{ | 627 | .dependencies = featureSet(&[_]Feature{ |
| 628 | .has_v8m_main, | 628 | .has_v8m_main, |
| 629 | }), | 629 | }), |
| 630 | }; | 630 | }; |
| 631 | result[@intFromEnum(Feature.has_v8_2a)] = .{ | 631 | result[@backingInt(Feature.has_v8_2a)] = .{ |
| 632 | .llvm_name = "v8.2a", | 632 | .llvm_name = "v8.2a", |
| 633 | .description = "Support ARM v8.2a instructions", | 633 | .description = "Support ARM v8.2a instructions", |
| 634 | .dependencies = featureSet(&[_]Feature{ | 634 | .dependencies = featureSet(&[_]Feature{ |
| 635 | .has_v8_1a, | 635 | .has_v8_1a, |
| 636 | }), | 636 | }), |
| 637 | }; | 637 | }; |
| 638 | result[@intFromEnum(Feature.has_v8_3a)] = .{ | 638 | result[@backingInt(Feature.has_v8_3a)] = .{ |
| 639 | .llvm_name = "v8.3a", | 639 | .llvm_name = "v8.3a", |
| 640 | .description = "Support ARM v8.3a instructions", | 640 | .description = "Support ARM v8.3a instructions", |
| 641 | .dependencies = featureSet(&[_]Feature{ | 641 | .dependencies = featureSet(&[_]Feature{ |
| 642 | .has_v8_2a, | 642 | .has_v8_2a, |
| 643 | }), | 643 | }), |
| 644 | }; | 644 | }; |
| 645 | result[@intFromEnum(Feature.has_v8_4a)] = .{ | 645 | result[@backingInt(Feature.has_v8_4a)] = .{ |
| 646 | .llvm_name = "v8.4a", | 646 | .llvm_name = "v8.4a", |
| 647 | .description = "Support ARM v8.4a instructions", | 647 | .description = "Support ARM v8.4a instructions", |
| 648 | .dependencies = featureSet(&[_]Feature{ | 648 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -650,7 +650,7 @@ pub const all_features = blk: { | ... | @@ -650,7 +650,7 @@ pub const all_features = blk: { |
| 650 | .has_v8_3a, | 650 | .has_v8_3a, |
| 651 | }), | 651 | }), |
| 652 | }; | 652 | }; |
| 653 | result[@intFromEnum(Feature.has_v8_5a)] = .{ | 653 | result[@backingInt(Feature.has_v8_5a)] = .{ |
| 654 | .llvm_name = "v8.5a", | 654 | .llvm_name = "v8.5a", |
| 655 | .description = "Support ARM v8.5a instructions", | 655 | .description = "Support ARM v8.5a instructions", |
| 656 | .dependencies = featureSet(&[_]Feature{ | 656 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -658,7 +658,7 @@ pub const all_features = blk: { | ... | @@ -658,7 +658,7 @@ pub const all_features = blk: { |
| 658 | .sb, | 658 | .sb, |
| 659 | }), | 659 | }), |
| 660 | }; | 660 | }; |
| 661 | result[@intFromEnum(Feature.has_v8_6a)] = .{ | 661 | result[@backingInt(Feature.has_v8_6a)] = .{ |
| 662 | .llvm_name = "v8.6a", | 662 | .llvm_name = "v8.6a", |
| 663 | .description = "Support ARM v8.6a instructions", | 663 | .description = "Support ARM v8.6a instructions", |
| 664 | .dependencies = featureSet(&[_]Feature{ | 664 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -667,21 +667,21 @@ pub const all_features = blk: { | ... | @@ -667,21 +667,21 @@ pub const all_features = blk: { |
| 667 | .i8mm, | 667 | .i8mm, |
| 668 | }), | 668 | }), |
| 669 | }; | 669 | }; |
| 670 | result[@intFromEnum(Feature.has_v8_7a)] = .{ | 670 | result[@backingInt(Feature.has_v8_7a)] = .{ |
| 671 | .llvm_name = "v8.7a", | 671 | .llvm_name = "v8.7a", |
| 672 | .description = "Support ARM v8.7a instructions", | 672 | .description = "Support ARM v8.7a instructions", |
| 673 | .dependencies = featureSet(&[_]Feature{ | 673 | .dependencies = featureSet(&[_]Feature{ |
| 674 | .has_v8_6a, | 674 | .has_v8_6a, |
| 675 | }), | 675 | }), |
| 676 | }; | 676 | }; |
| 677 | result[@intFromEnum(Feature.has_v8_8a)] = .{ | 677 | result[@backingInt(Feature.has_v8_8a)] = .{ |
| 678 | .llvm_name = "v8.8a", | 678 | .llvm_name = "v8.8a", |
| 679 | .description = "Support ARM v8.8a instructions", | 679 | .description = "Support ARM v8.8a instructions", |
| 680 | .dependencies = featureSet(&[_]Feature{ | 680 | .dependencies = featureSet(&[_]Feature{ |
| 681 | .has_v8_7a, | 681 | .has_v8_7a, |
| 682 | }), | 682 | }), |
| 683 | }; | 683 | }; |
| 684 | result[@intFromEnum(Feature.has_v8_9a)] = .{ | 684 | result[@backingInt(Feature.has_v8_9a)] = .{ |
| 685 | .llvm_name = "v8.9a", | 685 | .llvm_name = "v8.9a", |
| 686 | .description = "Support ARM v8.9a instructions", | 686 | .description = "Support ARM v8.9a instructions", |
| 687 | .dependencies = featureSet(&[_]Feature{ | 687 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -689,21 +689,21 @@ pub const all_features = blk: { | ... | @@ -689,21 +689,21 @@ pub const all_features = blk: { |
| 689 | .has_v8_8a, | 689 | .has_v8_8a, |
| 690 | }), | 690 | }), |
| 691 | }; | 691 | }; |
| 692 | result[@intFromEnum(Feature.has_v8m)] = .{ | 692 | result[@backingInt(Feature.has_v8m)] = .{ |
| 693 | .llvm_name = "v8m", | 693 | .llvm_name = "v8m", |
| 694 | .description = "Support ARM v8M Baseline instructions", | 694 | .description = "Support ARM v8M Baseline instructions", |
| 695 | .dependencies = featureSet(&[_]Feature{ | 695 | .dependencies = featureSet(&[_]Feature{ |
| 696 | .has_v6m, | 696 | .has_v6m, |
| 697 | }), | 697 | }), |
| 698 | }; | 698 | }; |
| 699 | result[@intFromEnum(Feature.has_v8m_main)] = .{ | 699 | result[@backingInt(Feature.has_v8m_main)] = .{ |
| 700 | .llvm_name = "v8m.main", | 700 | .llvm_name = "v8m.main", |
| 701 | .description = "Support ARM v8M Mainline instructions", | 701 | .description = "Support ARM v8M Mainline instructions", |
| 702 | .dependencies = featureSet(&[_]Feature{ | 702 | .dependencies = featureSet(&[_]Feature{ |
| 703 | .has_v7, | 703 | .has_v7, |
| 704 | }), | 704 | }), |
| 705 | }; | 705 | }; |
| 706 | result[@intFromEnum(Feature.has_v9_1a)] = .{ | 706 | result[@backingInt(Feature.has_v9_1a)] = .{ |
| 707 | .llvm_name = "v9.1a", | 707 | .llvm_name = "v9.1a", |
| 708 | .description = "Support ARM v9.1a instructions", | 708 | .description = "Support ARM v9.1a instructions", |
| 709 | .dependencies = featureSet(&[_]Feature{ | 709 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -711,7 +711,7 @@ pub const all_features = blk: { | ... | @@ -711,7 +711,7 @@ pub const all_features = blk: { |
| 711 | .has_v9a, | 711 | .has_v9a, |
| 712 | }), | 712 | }), |
| 713 | }; | 713 | }; |
| 714 | result[@intFromEnum(Feature.has_v9_2a)] = .{ | 714 | result[@backingInt(Feature.has_v9_2a)] = .{ |
| 715 | .llvm_name = "v9.2a", | 715 | .llvm_name = "v9.2a", |
| 716 | .description = "Support ARM v9.2a instructions", | 716 | .description = "Support ARM v9.2a instructions", |
| 717 | .dependencies = featureSet(&[_]Feature{ | 717 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -719,7 +719,7 @@ pub const all_features = blk: { | ... | @@ -719,7 +719,7 @@ pub const all_features = blk: { |
| 719 | .has_v9_1a, | 719 | .has_v9_1a, |
| 720 | }), | 720 | }), |
| 721 | }; | 721 | }; |
| 722 | result[@intFromEnum(Feature.has_v9_3a)] = .{ | 722 | result[@backingInt(Feature.has_v9_3a)] = .{ |
| 723 | .llvm_name = "v9.3a", | 723 | .llvm_name = "v9.3a", |
| 724 | .description = "Support ARM v9.3a instructions", | 724 | .description = "Support ARM v9.3a instructions", |
| 725 | .dependencies = featureSet(&[_]Feature{ | 725 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -727,7 +727,7 @@ pub const all_features = blk: { | ... | @@ -727,7 +727,7 @@ pub const all_features = blk: { |
| 727 | .has_v9_2a, | 727 | .has_v9_2a, |
| 728 | }), | 728 | }), |
| 729 | }; | 729 | }; |
| 730 | result[@intFromEnum(Feature.has_v9_4a)] = .{ | 730 | result[@backingInt(Feature.has_v9_4a)] = .{ |
| 731 | .llvm_name = "v9.4a", | 731 | .llvm_name = "v9.4a", |
| 732 | .description = "Support ARM v9.4a instructions", | 732 | .description = "Support ARM v9.4a instructions", |
| 733 | .dependencies = featureSet(&[_]Feature{ | 733 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -735,106 +735,106 @@ pub const all_features = blk: { | ... | @@ -735,106 +735,106 @@ pub const all_features = blk: { |
| 735 | .has_v9_3a, | 735 | .has_v9_3a, |
| 736 | }), | 736 | }), |
| 737 | }; | 737 | }; |
| 738 | result[@intFromEnum(Feature.has_v9_5a)] = .{ | 738 | result[@backingInt(Feature.has_v9_5a)] = .{ |
| 739 | .llvm_name = "v9.5a", | 739 | .llvm_name = "v9.5a", |
| 740 | .description = "Support ARM v9.5a instructions", | 740 | .description = "Support ARM v9.5a instructions", |
| 741 | .dependencies = featureSet(&[_]Feature{ | 741 | .dependencies = featureSet(&[_]Feature{ |
| 742 | .has_v9_4a, | 742 | .has_v9_4a, |
| 743 | }), | 743 | }), |
| 744 | }; | 744 | }; |
| 745 | result[@intFromEnum(Feature.has_v9_6a)] = .{ | 745 | result[@backingInt(Feature.has_v9_6a)] = .{ |
| 746 | .llvm_name = "v9.6a", | 746 | .llvm_name = "v9.6a", |
| 747 | .description = "Support ARM v9.6a instructions", | 747 | .description = "Support ARM v9.6a instructions", |
| 748 | .dependencies = featureSet(&[_]Feature{ | 748 | .dependencies = featureSet(&[_]Feature{ |
| 749 | .has_v9_5a, | 749 | .has_v9_5a, |
| 750 | }), | 750 | }), |
| 751 | }; | 751 | }; |
| 752 | result[@intFromEnum(Feature.has_v9_7a)] = .{ | 752 | result[@backingInt(Feature.has_v9_7a)] = .{ |
| 753 | .llvm_name = "v9.7a", | 753 | .llvm_name = "v9.7a", |
| 754 | .description = "Support ARM v9.7a instructions", | 754 | .description = "Support ARM v9.7a instructions", |
| 755 | .dependencies = featureSet(&[_]Feature{ | 755 | .dependencies = featureSet(&[_]Feature{ |
| 756 | .has_v9_6a, | 756 | .has_v9_6a, |
| 757 | }), | 757 | }), |
| 758 | }; | 758 | }; |
| 759 | result[@intFromEnum(Feature.has_v9a)] = .{ | 759 | result[@backingInt(Feature.has_v9a)] = .{ |
| 760 | .llvm_name = "v9a", | 760 | .llvm_name = "v9a", |
| 761 | .description = "Support ARM v9a instructions", | 761 | .description = "Support ARM v9a instructions", |
| 762 | .dependencies = featureSet(&[_]Feature{ | 762 | .dependencies = featureSet(&[_]Feature{ |
| 763 | .has_v8_5a, | 763 | .has_v8_5a, |
| 764 | }), | 764 | }), |
| 765 | }; | 765 | }; |
| 766 | result[@intFromEnum(Feature.hwdiv)] = .{ | 766 | result[@backingInt(Feature.hwdiv)] = .{ |
| 767 | .llvm_name = "hwdiv", | 767 | .llvm_name = "hwdiv", |
| 768 | .description = "Enable divide instructions in Thumb", | 768 | .description = "Enable divide instructions in Thumb", |
| 769 | .dependencies = featureSet(&[_]Feature{}), | 769 | .dependencies = featureSet(&[_]Feature{}), |
| 770 | }; | 770 | }; |
| 771 | result[@intFromEnum(Feature.hwdiv_arm)] = .{ | 771 | result[@backingInt(Feature.hwdiv_arm)] = .{ |
| 772 | .llvm_name = "hwdiv-arm", | 772 | .llvm_name = "hwdiv-arm", |
| 773 | .description = "Enable divide instructions in ARM mode", | 773 | .description = "Enable divide instructions in ARM mode", |
| 774 | .dependencies = featureSet(&[_]Feature{}), | 774 | .dependencies = featureSet(&[_]Feature{}), |
| 775 | }; | 775 | }; |
| 776 | result[@intFromEnum(Feature.i8mm)] = .{ | 776 | result[@backingInt(Feature.i8mm)] = .{ |
| 777 | .llvm_name = "i8mm", | 777 | .llvm_name = "i8mm", |
| 778 | .description = "Enable Matrix Multiply Int8 Extension", | 778 | .description = "Enable Matrix Multiply Int8 Extension", |
| 779 | .dependencies = featureSet(&[_]Feature{ | 779 | .dependencies = featureSet(&[_]Feature{ |
| 780 | .neon, | 780 | .neon, |
| 781 | }), | 781 | }), |
| 782 | }; | 782 | }; |
| 783 | result[@intFromEnum(Feature.iwmmxt)] = .{ | 783 | result[@backingInt(Feature.iwmmxt)] = .{ |
| 784 | .llvm_name = "iwmmxt", | 784 | .llvm_name = "iwmmxt", |
| 785 | .description = "ARMv5te architecture", | 785 | .description = "ARMv5te architecture", |
| 786 | .dependencies = featureSet(&[_]Feature{ | 786 | .dependencies = featureSet(&[_]Feature{ |
| 787 | .v5te, | 787 | .v5te, |
| 788 | }), | 788 | }), |
| 789 | }; | 789 | }; |
| 790 | result[@intFromEnum(Feature.iwmmxt2)] = .{ | 790 | result[@backingInt(Feature.iwmmxt2)] = .{ |
| 791 | .llvm_name = "iwmmxt2", | 791 | .llvm_name = "iwmmxt2", |
| 792 | .description = "ARMv5te architecture", | 792 | .description = "ARMv5te architecture", |
| 793 | .dependencies = featureSet(&[_]Feature{ | 793 | .dependencies = featureSet(&[_]Feature{ |
| 794 | .v5te, | 794 | .v5te, |
| 795 | }), | 795 | }), |
| 796 | }; | 796 | }; |
| 797 | result[@intFromEnum(Feature.lob)] = .{ | 797 | result[@backingInt(Feature.lob)] = .{ |
| 798 | .llvm_name = "lob", | 798 | .llvm_name = "lob", |
| 799 | .description = "Enable Low Overhead Branch extensions", | 799 | .description = "Enable Low Overhead Branch extensions", |
| 800 | .dependencies = featureSet(&[_]Feature{}), | 800 | .dependencies = featureSet(&[_]Feature{}), |
| 801 | }; | 801 | }; |
| 802 | result[@intFromEnum(Feature.long_calls)] = .{ | 802 | result[@backingInt(Feature.long_calls)] = .{ |
| 803 | .llvm_name = "long-calls", | 803 | .llvm_name = "long-calls", |
| 804 | .description = "Generate calls via indirect call instructions", | 804 | .description = "Generate calls via indirect call instructions", |
| 805 | .dependencies = featureSet(&[_]Feature{}), | 805 | .dependencies = featureSet(&[_]Feature{}), |
| 806 | }; | 806 | }; |
| 807 | result[@intFromEnum(Feature.loop_align)] = .{ | 807 | result[@backingInt(Feature.loop_align)] = .{ |
| 808 | .llvm_name = "loop-align", | 808 | .llvm_name = "loop-align", |
| 809 | .description = "Prefer 32-bit alignment for branch targets", | 809 | .description = "Prefer 32-bit alignment for branch targets", |
| 810 | .dependencies = featureSet(&[_]Feature{}), | 810 | .dependencies = featureSet(&[_]Feature{}), |
| 811 | }; | 811 | }; |
| 812 | result[@intFromEnum(Feature.m55)] = .{ | 812 | result[@backingInt(Feature.m55)] = .{ |
| 813 | .llvm_name = "m55", | 813 | .llvm_name = "m55", |
| 814 | .description = "Cortex-M55 ARM processors", | 814 | .description = "Cortex-M55 ARM processors", |
| 815 | .dependencies = featureSet(&[_]Feature{}), | 815 | .dependencies = featureSet(&[_]Feature{}), |
| 816 | }; | 816 | }; |
| 817 | result[@intFromEnum(Feature.m85)] = .{ | 817 | result[@backingInt(Feature.m85)] = .{ |
| 818 | .llvm_name = "m85", | 818 | .llvm_name = "m85", |
| 819 | .description = "Cortex-M85 ARM processors", | 819 | .description = "Cortex-M85 ARM processors", |
| 820 | .dependencies = featureSet(&[_]Feature{}), | 820 | .dependencies = featureSet(&[_]Feature{}), |
| 821 | }; | 821 | }; |
| 822 | result[@intFromEnum(Feature.mclass)] = .{ | 822 | result[@backingInt(Feature.mclass)] = .{ |
| 823 | .llvm_name = "mclass", | 823 | .llvm_name = "mclass", |
| 824 | .description = "Is microcontroller profile ('M' series)", | 824 | .description = "Is microcontroller profile ('M' series)", |
| 825 | .dependencies = featureSet(&[_]Feature{}), | 825 | .dependencies = featureSet(&[_]Feature{}), |
| 826 | }; | 826 | }; |
| 827 | result[@intFromEnum(Feature.mp)] = .{ | 827 | result[@backingInt(Feature.mp)] = .{ |
| 828 | .llvm_name = "mp", | 828 | .llvm_name = "mp", |
| 829 | .description = "Supports Multiprocessing extension", | 829 | .description = "Supports Multiprocessing extension", |
| 830 | .dependencies = featureSet(&[_]Feature{}), | 830 | .dependencies = featureSet(&[_]Feature{}), |
| 831 | }; | 831 | }; |
| 832 | result[@intFromEnum(Feature.muxed_units)] = .{ | 832 | result[@backingInt(Feature.muxed_units)] = .{ |
| 833 | .llvm_name = "muxed-units", | 833 | .llvm_name = "muxed-units", |
| 834 | .description = "Has muxed AGU and NEON/FPU", | 834 | .description = "Has muxed AGU and NEON/FPU", |
| 835 | .dependencies = featureSet(&[_]Feature{}), | 835 | .dependencies = featureSet(&[_]Feature{}), |
| 836 | }; | 836 | }; |
| 837 | result[@intFromEnum(Feature.mve)] = .{ | 837 | result[@backingInt(Feature.mve)] = .{ |
| 838 | .llvm_name = "mve", | 838 | .llvm_name = "mve", |
| 839 | .description = "Support M-Class Vector Extension with integer ops", | 839 | .description = "Support M-Class Vector Extension with integer ops", |
| 840 | .dependencies = featureSet(&[_]Feature{ | 840 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -844,22 +844,22 @@ pub const all_features = blk: { | ... | @@ -844,22 +844,22 @@ pub const all_features = blk: { |
| 844 | .has_v8_1m_main, | 844 | .has_v8_1m_main, |
| 845 | }), | 845 | }), |
| 846 | }; | 846 | }; |
| 847 | result[@intFromEnum(Feature.mve1beat)] = .{ | 847 | result[@backingInt(Feature.mve1beat)] = .{ |
| 848 | .llvm_name = "mve1beat", | 848 | .llvm_name = "mve1beat", |
| 849 | .description = "Model MVE instructions as a 1 beat per tick architecture", | 849 | .description = "Model MVE instructions as a 1 beat per tick architecture", |
| 850 | .dependencies = featureSet(&[_]Feature{}), | 850 | .dependencies = featureSet(&[_]Feature{}), |
| 851 | }; | 851 | }; |
| 852 | result[@intFromEnum(Feature.mve2beat)] = .{ | 852 | result[@backingInt(Feature.mve2beat)] = .{ |
| 853 | .llvm_name = "mve2beat", | 853 | .llvm_name = "mve2beat", |
| 854 | .description = "Model MVE instructions as a 2 beats per tick architecture", | 854 | .description = "Model MVE instructions as a 2 beats per tick architecture", |
| 855 | .dependencies = featureSet(&[_]Feature{}), | 855 | .dependencies = featureSet(&[_]Feature{}), |
| 856 | }; | 856 | }; |
| 857 | result[@intFromEnum(Feature.mve4beat)] = .{ | 857 | result[@backingInt(Feature.mve4beat)] = .{ |
| 858 | .llvm_name = "mve4beat", | 858 | .llvm_name = "mve4beat", |
| 859 | .description = "Model MVE instructions as a 4 beats per tick architecture", | 859 | .description = "Model MVE instructions as a 4 beats per tick architecture", |
| 860 | .dependencies = featureSet(&[_]Feature{}), | 860 | .dependencies = featureSet(&[_]Feature{}), |
| 861 | }; | 861 | }; |
| 862 | result[@intFromEnum(Feature.mve_fp)] = .{ | 862 | result[@backingInt(Feature.mve_fp)] = .{ |
| 863 | .llvm_name = "mve.fp", | 863 | .llvm_name = "mve.fp", |
| 864 | .description = "Support M-Class Vector Extension with integer and floating ops", | 864 | .description = "Support M-Class Vector Extension with integer and floating ops", |
| 865 | .dependencies = featureSet(&[_]Feature{ | 865 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -867,238 +867,238 @@ pub const all_features = blk: { | ... | @@ -867,238 +867,238 @@ pub const all_features = blk: { |
| 867 | .mve, | 867 | .mve, |
| 868 | }), | 868 | }), |
| 869 | }; | 869 | }; |
| 870 | result[@intFromEnum(Feature.neon)] = .{ | 870 | result[@backingInt(Feature.neon)] = .{ |
| 871 | .llvm_name = "neon", | 871 | .llvm_name = "neon", |
| 872 | .description = "Enable NEON instructions", | 872 | .description = "Enable NEON instructions", |
| 873 | .dependencies = featureSet(&[_]Feature{ | 873 | .dependencies = featureSet(&[_]Feature{ |
| 874 | .vfp3, | 874 | .vfp3, |
| 875 | }), | 875 | }), |
| 876 | }; | 876 | }; |
| 877 | result[@intFromEnum(Feature.neon_fpmovs)] = .{ | 877 | result[@backingInt(Feature.neon_fpmovs)] = .{ |
| 878 | .llvm_name = "neon-fpmovs", | 878 | .llvm_name = "neon-fpmovs", |
| 879 | .description = "Convert VMOVSR, VMOVRS, VMOVS to NEON", | 879 | .description = "Convert VMOVSR, VMOVRS, VMOVS to NEON", |
| 880 | .dependencies = featureSet(&[_]Feature{}), | 880 | .dependencies = featureSet(&[_]Feature{}), |
| 881 | }; | 881 | }; |
| 882 | result[@intFromEnum(Feature.neonfp)] = .{ | 882 | result[@backingInt(Feature.neonfp)] = .{ |
| 883 | .llvm_name = "neonfp", | 883 | .llvm_name = "neonfp", |
| 884 | .description = "Use NEON for single precision FP", | 884 | .description = "Use NEON for single precision FP", |
| 885 | .dependencies = featureSet(&[_]Feature{}), | 885 | .dependencies = featureSet(&[_]Feature{}), |
| 886 | }; | 886 | }; |
| 887 | result[@intFromEnum(Feature.no_branch_predictor)] = .{ | 887 | result[@backingInt(Feature.no_branch_predictor)] = .{ |
| 888 | .llvm_name = "no-branch-predictor", | 888 | .llvm_name = "no-branch-predictor", |
| 889 | .description = "Has no branch predictor", | 889 | .description = "Has no branch predictor", |
| 890 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "no-bti-at-return-twice", | 893 | .llvm_name = "no-bti-at-return-twice", |
| 894 | .description = "Don't place a BTI instruction after a return-twice", | 894 | .description = "Don't place a BTI instruction after a return-twice", |
| 895 | .dependencies = featureSet(&[_]Feature{}), | 895 | .dependencies = featureSet(&[_]Feature{}), |
| 896 | }; | 896 | }; |
| 897 | result[@intFromEnum(Feature.no_movt)] = .{ | 897 | result[@backingInt(Feature.no_movt)] = .{ |
| 898 | .llvm_name = "no-movt", | 898 | .llvm_name = "no-movt", |
| 899 | .description = "Don't use movt/movw pairs for 32-bit imms", | 899 | .description = "Don't use movt/movw pairs for 32-bit imms", |
| 900 | .dependencies = featureSet(&[_]Feature{}), | 900 | .dependencies = featureSet(&[_]Feature{}), |
| 901 | }; | 901 | }; |
| 902 | result[@intFromEnum(Feature.no_neg_immediates)] = .{ | 902 | result[@backingInt(Feature.no_neg_immediates)] = .{ |
| 903 | .llvm_name = "no-neg-immediates", | 903 | .llvm_name = "no-neg-immediates", |
| 904 | .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.", | 904 | .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.", |
| 905 | .dependencies = featureSet(&[_]Feature{}), | 905 | .dependencies = featureSet(&[_]Feature{}), |
| 906 | }; | 906 | }; |
| 907 | result[@intFromEnum(Feature.noarm)] = .{ | 907 | result[@backingInt(Feature.noarm)] = .{ |
| 908 | .llvm_name = "noarm", | 908 | .llvm_name = "noarm", |
| 909 | .description = "Does not support ARM mode execution", | 909 | .description = "Does not support ARM mode execution", |
| 910 | .dependencies = featureSet(&[_]Feature{}), | 910 | .dependencies = featureSet(&[_]Feature{}), |
| 911 | }; | 911 | }; |
| 912 | result[@intFromEnum(Feature.nonpipelined_vfp)] = .{ | 912 | result[@backingInt(Feature.nonpipelined_vfp)] = .{ |
| 913 | .llvm_name = "nonpipelined-vfp", | 913 | .llvm_name = "nonpipelined-vfp", |
| 914 | .description = "VFP instructions are not pipelined", | 914 | .description = "VFP instructions are not pipelined", |
| 915 | .dependencies = featureSet(&[_]Feature{}), | 915 | .dependencies = featureSet(&[_]Feature{}), |
| 916 | }; | 916 | }; |
| 917 | result[@intFromEnum(Feature.pacbti)] = .{ | 917 | result[@backingInt(Feature.pacbti)] = .{ |
| 918 | .llvm_name = "pacbti", | 918 | .llvm_name = "pacbti", |
| 919 | .description = "Enable Pointer Authentication and Branch Target Identification", | 919 | .description = "Enable Pointer Authentication and Branch Target Identification", |
| 920 | .dependencies = featureSet(&[_]Feature{}), | 920 | .dependencies = featureSet(&[_]Feature{}), |
| 921 | }; | 921 | }; |
| 922 | result[@intFromEnum(Feature.perfmon)] = .{ | 922 | result[@backingInt(Feature.perfmon)] = .{ |
| 923 | .llvm_name = "perfmon", | 923 | .llvm_name = "perfmon", |
| 924 | .description = "Enable support for Performance Monitor extensions", | 924 | .description = "Enable support for Performance Monitor extensions", |
| 925 | .dependencies = featureSet(&[_]Feature{}), | 925 | .dependencies = featureSet(&[_]Feature{}), |
| 926 | }; | 926 | }; |
| 927 | result[@intFromEnum(Feature.prefer_ishst)] = .{ | 927 | result[@backingInt(Feature.prefer_ishst)] = .{ |
| 928 | .llvm_name = "prefer-ishst", | 928 | .llvm_name = "prefer-ishst", |
| 929 | .description = "Prefer ISHST barriers", | 929 | .description = "Prefer ISHST barriers", |
| 930 | .dependencies = featureSet(&[_]Feature{}), | 930 | .dependencies = featureSet(&[_]Feature{}), |
| 931 | }; | 931 | }; |
| 932 | result[@intFromEnum(Feature.prefer_vmovsr)] = .{ | 932 | result[@backingInt(Feature.prefer_vmovsr)] = .{ |
| 933 | .llvm_name = "prefer-vmovsr", | 933 | .llvm_name = "prefer-vmovsr", |
| 934 | .description = "Prefer VMOVSR", | 934 | .description = "Prefer VMOVSR", |
| 935 | .dependencies = featureSet(&[_]Feature{}), | 935 | .dependencies = featureSet(&[_]Feature{}), |
| 936 | }; | 936 | }; |
| 937 | result[@intFromEnum(Feature.prof_unpr)] = .{ | 937 | result[@backingInt(Feature.prof_unpr)] = .{ |
| 938 | .llvm_name = "prof-unpr", | 938 | .llvm_name = "prof-unpr", |
| 939 | .description = "Is profitable to unpredicate", | 939 | .description = "Is profitable to unpredicate", |
| 940 | .dependencies = featureSet(&[_]Feature{}), | 940 | .dependencies = featureSet(&[_]Feature{}), |
| 941 | }; | 941 | }; |
| 942 | result[@intFromEnum(Feature.ras)] = .{ | 942 | result[@backingInt(Feature.ras)] = .{ |
| 943 | .llvm_name = "ras", | 943 | .llvm_name = "ras", |
| 944 | .description = "Enable Reliability, Availability and Serviceability extensions", | 944 | .description = "Enable Reliability, Availability and Serviceability extensions", |
| 945 | .dependencies = featureSet(&[_]Feature{}), | 945 | .dependencies = featureSet(&[_]Feature{}), |
| 946 | }; | 946 | }; |
| 947 | result[@intFromEnum(Feature.rclass)] = .{ | 947 | result[@backingInt(Feature.rclass)] = .{ |
| 948 | .llvm_name = "rclass", | 948 | .llvm_name = "rclass", |
| 949 | .description = "Is realtime profile ('R' series)", | 949 | .description = "Is realtime profile ('R' series)", |
| 950 | .dependencies = featureSet(&[_]Feature{}), | 950 | .dependencies = featureSet(&[_]Feature{}), |
| 951 | }; | 951 | }; |
| 952 | result[@intFromEnum(Feature.read_tp_tpidrprw)] = .{ | 952 | result[@backingInt(Feature.read_tp_tpidrprw)] = .{ |
| 953 | .llvm_name = "read-tp-tpidrprw", | 953 | .llvm_name = "read-tp-tpidrprw", |
| 954 | .description = "Reading thread pointer from TPIDRPRW register", | 954 | .description = "Reading thread pointer from TPIDRPRW register", |
| 955 | .dependencies = featureSet(&[_]Feature{}), | 955 | .dependencies = featureSet(&[_]Feature{}), |
| 956 | }; | 956 | }; |
| 957 | result[@intFromEnum(Feature.read_tp_tpidruro)] = .{ | 957 | result[@backingInt(Feature.read_tp_tpidruro)] = .{ |
| 958 | .llvm_name = "read-tp-tpidruro", | 958 | .llvm_name = "read-tp-tpidruro", |
| 959 | .description = "Reading thread pointer from TPIDRURO register", | 959 | .description = "Reading thread pointer from TPIDRURO register", |
| 960 | .dependencies = featureSet(&[_]Feature{}), | 960 | .dependencies = featureSet(&[_]Feature{}), |
| 961 | }; | 961 | }; |
| 962 | result[@intFromEnum(Feature.read_tp_tpidrurw)] = .{ | 962 | result[@backingInt(Feature.read_tp_tpidrurw)] = .{ |
| 963 | .llvm_name = "read-tp-tpidrurw", | 963 | .llvm_name = "read-tp-tpidrurw", |
| 964 | .description = "Reading thread pointer from TPIDRURW register", | 964 | .description = "Reading thread pointer from TPIDRURW register", |
| 965 | .dependencies = featureSet(&[_]Feature{}), | 965 | .dependencies = featureSet(&[_]Feature{}), |
| 966 | }; | 966 | }; |
| 967 | result[@intFromEnum(Feature.reserve_r9)] = .{ | 967 | result[@backingInt(Feature.reserve_r9)] = .{ |
| 968 | .llvm_name = "reserve-r9", | 968 | .llvm_name = "reserve-r9", |
| 969 | .description = "Reserve R9, making it unavailable as GPR", | 969 | .description = "Reserve R9, making it unavailable as GPR", |
| 970 | .dependencies = featureSet(&[_]Feature{}), | 970 | .dependencies = featureSet(&[_]Feature{}), |
| 971 | }; | 971 | }; |
| 972 | result[@intFromEnum(Feature.ret_addr_stack)] = .{ | 972 | result[@backingInt(Feature.ret_addr_stack)] = .{ |
| 973 | .llvm_name = "ret-addr-stack", | 973 | .llvm_name = "ret-addr-stack", |
| 974 | .description = "Has return address stack", | 974 | .description = "Has return address stack", |
| 975 | .dependencies = featureSet(&[_]Feature{}), | 975 | .dependencies = featureSet(&[_]Feature{}), |
| 976 | }; | 976 | }; |
| 977 | result[@intFromEnum(Feature.sb)] = .{ | 977 | result[@backingInt(Feature.sb)] = .{ |
| 978 | .llvm_name = "sb", | 978 | .llvm_name = "sb", |
| 979 | .description = "Enable v8.5a Speculation Barrier", | 979 | .description = "Enable v8.5a Speculation Barrier", |
| 980 | .dependencies = featureSet(&[_]Feature{}), | 980 | .dependencies = featureSet(&[_]Feature{}), |
| 981 | }; | 981 | }; |
| 982 | result[@intFromEnum(Feature.sha2)] = .{ | 982 | result[@backingInt(Feature.sha2)] = .{ |
| 983 | .llvm_name = "sha2", | 983 | .llvm_name = "sha2", |
| 984 | .description = "Enable SHA1 and SHA256 support", | 984 | .description = "Enable SHA1 and SHA256 support", |
| 985 | .dependencies = featureSet(&[_]Feature{ | 985 | .dependencies = featureSet(&[_]Feature{ |
| 986 | .neon, | 986 | .neon, |
| 987 | }), | 987 | }), |
| 988 | }; | 988 | }; |
| 989 | result[@intFromEnum(Feature.slow_fp_brcc)] = .{ | 989 | result[@backingInt(Feature.slow_fp_brcc)] = .{ |
| 990 | .llvm_name = "slow-fp-brcc", | 990 | .llvm_name = "slow-fp-brcc", |
| 991 | .description = "FP compare + branch is slow", | 991 | .description = "FP compare + branch is slow", |
| 992 | .dependencies = featureSet(&[_]Feature{}), | 992 | .dependencies = featureSet(&[_]Feature{}), |
| 993 | }; | 993 | }; |
| 994 | result[@intFromEnum(Feature.slow_load_D_subreg)] = .{ | 994 | result[@backingInt(Feature.slow_load_D_subreg)] = .{ |
| 995 | .llvm_name = "slow-load-D-subreg", | 995 | .llvm_name = "slow-load-D-subreg", |
| 996 | .description = "Loading into D subregs is slow", | 996 | .description = "Loading into D subregs is slow", |
| 997 | .dependencies = featureSet(&[_]Feature{}), | 997 | .dependencies = featureSet(&[_]Feature{}), |
| 998 | }; | 998 | }; |
| 999 | result[@intFromEnum(Feature.slow_odd_reg)] = .{ | 999 | result[@backingInt(Feature.slow_odd_reg)] = .{ |
| 1000 | .llvm_name = "slow-odd-reg", | 1000 | .llvm_name = "slow-odd-reg", |
| 1001 | .description = "VLDM/VSTM starting with an odd register is slow", | 1001 | .description = "VLDM/VSTM starting with an odd register is slow", |
| 1002 | .dependencies = featureSet(&[_]Feature{}), | 1002 | .dependencies = featureSet(&[_]Feature{}), |
| 1003 | }; | 1003 | }; |
| 1004 | result[@intFromEnum(Feature.slow_vdup32)] = .{ | 1004 | result[@backingInt(Feature.slow_vdup32)] = .{ |
| 1005 | .llvm_name = "slow-vdup32", | 1005 | .llvm_name = "slow-vdup32", |
| 1006 | .description = "Has slow VDUP32 - prefer VMOV", | 1006 | .description = "Has slow VDUP32 - prefer VMOV", |
| 1007 | .dependencies = featureSet(&[_]Feature{}), | 1007 | .dependencies = featureSet(&[_]Feature{}), |
| 1008 | }; | 1008 | }; |
| 1009 | result[@intFromEnum(Feature.slow_vgetlni32)] = .{ | 1009 | result[@backingInt(Feature.slow_vgetlni32)] = .{ |
| 1010 | .llvm_name = "slow-vgetlni32", | 1010 | .llvm_name = "slow-vgetlni32", |
| 1011 | .description = "Has slow VGETLNi32 - prefer VMOV", | 1011 | .description = "Has slow VGETLNi32 - prefer VMOV", |
| 1012 | .dependencies = featureSet(&[_]Feature{}), | 1012 | .dependencies = featureSet(&[_]Feature{}), |
| 1013 | }; | 1013 | }; |
| 1014 | result[@intFromEnum(Feature.slowfpvfmx)] = .{ | 1014 | result[@backingInt(Feature.slowfpvfmx)] = .{ |
| 1015 | .llvm_name = "slowfpvfmx", | 1015 | .llvm_name = "slowfpvfmx", |
| 1016 | .description = "Disable VFP / NEON FMA instructions", | 1016 | .description = "Disable VFP / NEON FMA instructions", |
| 1017 | .dependencies = featureSet(&[_]Feature{}), | 1017 | .dependencies = featureSet(&[_]Feature{}), |
| 1018 | }; | 1018 | }; |
| 1019 | result[@intFromEnum(Feature.slowfpvmlx)] = .{ | 1019 | result[@backingInt(Feature.slowfpvmlx)] = .{ |
| 1020 | .llvm_name = "slowfpvmlx", | 1020 | .llvm_name = "slowfpvmlx", |
| 1021 | .description = "Disable VFP / NEON MAC instructions", | 1021 | .description = "Disable VFP / NEON MAC instructions", |
| 1022 | .dependencies = featureSet(&[_]Feature{}), | 1022 | .dependencies = featureSet(&[_]Feature{}), |
| 1023 | }; | 1023 | }; |
| 1024 | result[@intFromEnum(Feature.soft_float)] = .{ | 1024 | result[@backingInt(Feature.soft_float)] = .{ |
| 1025 | .llvm_name = "soft-float", | 1025 | .llvm_name = "soft-float", |
| 1026 | .description = "Use software floating point features.", | 1026 | .description = "Use software floating point features.", |
| 1027 | .dependencies = featureSet(&[_]Feature{}), | 1027 | .dependencies = featureSet(&[_]Feature{}), |
| 1028 | }; | 1028 | }; |
| 1029 | result[@intFromEnum(Feature.splat_vfp_neon)] = .{ | 1029 | result[@backingInt(Feature.splat_vfp_neon)] = .{ |
| 1030 | .llvm_name = "splat-vfp-neon", | 1030 | .llvm_name = "splat-vfp-neon", |
| 1031 | .description = "Splat register from VFP to NEON", | 1031 | .description = "Splat register from VFP to NEON", |
| 1032 | .dependencies = featureSet(&[_]Feature{ | 1032 | .dependencies = featureSet(&[_]Feature{ |
| 1033 | .dont_widen_vmovs, | 1033 | .dont_widen_vmovs, |
| 1034 | }), | 1034 | }), |
| 1035 | }; | 1035 | }; |
| 1036 | result[@intFromEnum(Feature.strict_align)] = .{ | 1036 | result[@backingInt(Feature.strict_align)] = .{ |
| 1037 | .llvm_name = "strict-align", | 1037 | .llvm_name = "strict-align", |
| 1038 | .description = "Disallow all unaligned memory access", | 1038 | .description = "Disallow all unaligned memory access", |
| 1039 | .dependencies = featureSet(&[_]Feature{}), | 1039 | .dependencies = featureSet(&[_]Feature{}), |
| 1040 | }; | 1040 | }; |
| 1041 | result[@intFromEnum(Feature.thumb2)] = .{ | 1041 | result[@backingInt(Feature.thumb2)] = .{ |
| 1042 | .llvm_name = "thumb2", | 1042 | .llvm_name = "thumb2", |
| 1043 | .description = "Enable Thumb2 instructions", | 1043 | .description = "Enable Thumb2 instructions", |
| 1044 | .dependencies = featureSet(&[_]Feature{}), | 1044 | .dependencies = featureSet(&[_]Feature{}), |
| 1045 | }; | 1045 | }; |
| 1046 | result[@intFromEnum(Feature.thumb_mode)] = .{ | 1046 | result[@backingInt(Feature.thumb_mode)] = .{ |
| 1047 | .llvm_name = "thumb-mode", | 1047 | .llvm_name = "thumb-mode", |
| 1048 | .description = "Thumb mode", | 1048 | .description = "Thumb mode", |
| 1049 | .dependencies = featureSet(&[_]Feature{}), | 1049 | .dependencies = featureSet(&[_]Feature{}), |
| 1050 | }; | 1050 | }; |
| 1051 | result[@intFromEnum(Feature.trustzone)] = .{ | 1051 | result[@backingInt(Feature.trustzone)] = .{ |
| 1052 | .llvm_name = "trustzone", | 1052 | .llvm_name = "trustzone", |
| 1053 | .description = "Enable support for TrustZone security extensions", | 1053 | .description = "Enable support for TrustZone security extensions", |
| 1054 | .dependencies = featureSet(&[_]Feature{}), | 1054 | .dependencies = featureSet(&[_]Feature{}), |
| 1055 | }; | 1055 | }; |
| 1056 | result[@intFromEnum(Feature.use_mipipeliner)] = .{ | 1056 | result[@backingInt(Feature.use_mipipeliner)] = .{ |
| 1057 | .llvm_name = "use-mipipeliner", | 1057 | .llvm_name = "use-mipipeliner", |
| 1058 | .description = "Use the MachinePipeliner", | 1058 | .description = "Use the MachinePipeliner", |
| 1059 | .dependencies = featureSet(&[_]Feature{}), | 1059 | .dependencies = featureSet(&[_]Feature{}), |
| 1060 | }; | 1060 | }; |
| 1061 | result[@intFromEnum(Feature.use_misched)] = .{ | 1061 | result[@backingInt(Feature.use_misched)] = .{ |
| 1062 | .llvm_name = "use-misched", | 1062 | .llvm_name = "use-misched", |
| 1063 | .description = "Use the MachineScheduler", | 1063 | .description = "Use the MachineScheduler", |
| 1064 | .dependencies = featureSet(&[_]Feature{}), | 1064 | .dependencies = featureSet(&[_]Feature{}), |
| 1065 | }; | 1065 | }; |
| 1066 | result[@intFromEnum(Feature.v2)] = .{ | 1066 | result[@backingInt(Feature.v2)] = .{ |
| 1067 | .llvm_name = null, | 1067 | .llvm_name = null, |
| 1068 | .description = "ARMv2 architecture", | 1068 | .description = "ARMv2 architecture", |
| 1069 | .dependencies = featureSet(&[_]Feature{ | 1069 | .dependencies = featureSet(&[_]Feature{ |
| 1070 | .strict_align, | 1070 | .strict_align, |
| 1071 | }), | 1071 | }), |
| 1072 | }; | 1072 | }; |
| 1073 | result[@intFromEnum(Feature.v2a)] = .{ | 1073 | result[@backingInt(Feature.v2a)] = .{ |
| 1074 | .llvm_name = null, | 1074 | .llvm_name = null, |
| 1075 | .description = "ARMv2a architecture", | 1075 | .description = "ARMv2a architecture", |
| 1076 | .dependencies = featureSet(&[_]Feature{ | 1076 | .dependencies = featureSet(&[_]Feature{ |
| 1077 | .strict_align, | 1077 | .strict_align, |
| 1078 | }), | 1078 | }), |
| 1079 | }; | 1079 | }; |
| 1080 | result[@intFromEnum(Feature.v3)] = .{ | 1080 | result[@backingInt(Feature.v3)] = .{ |
| 1081 | .llvm_name = null, | 1081 | .llvm_name = null, |
| 1082 | .description = "ARMv3 architecture", | 1082 | .description = "ARMv3 architecture", |
| 1083 | .dependencies = featureSet(&[_]Feature{ | 1083 | .dependencies = featureSet(&[_]Feature{ |
| 1084 | .strict_align, | 1084 | .strict_align, |
| 1085 | }), | 1085 | }), |
| 1086 | }; | 1086 | }; |
| 1087 | result[@intFromEnum(Feature.v3m)] = .{ | 1087 | result[@backingInt(Feature.v3m)] = .{ |
| 1088 | .llvm_name = null, | 1088 | .llvm_name = null, |
| 1089 | .description = "ARMv3m architecture", | 1089 | .description = "ARMv3m architecture", |
| 1090 | .dependencies = featureSet(&[_]Feature{ | 1090 | .dependencies = featureSet(&[_]Feature{ |
| 1091 | .strict_align, | 1091 | .strict_align, |
| 1092 | }), | 1092 | }), |
| 1093 | }; | 1093 | }; |
| 1094 | result[@intFromEnum(Feature.v4)] = .{ | 1094 | result[@backingInt(Feature.v4)] = .{ |
| 1095 | .llvm_name = "armv4", | 1095 | .llvm_name = "armv4", |
| 1096 | .description = "ARMv4 architecture", | 1096 | .description = "ARMv4 architecture", |
| 1097 | .dependencies = featureSet(&[_]Feature{ | 1097 | .dependencies = featureSet(&[_]Feature{ |
| 1098 | .strict_align, | 1098 | .strict_align, |
| 1099 | }), | 1099 | }), |
| 1100 | }; | 1100 | }; |
| 1101 | result[@intFromEnum(Feature.v4t)] = .{ | 1101 | result[@backingInt(Feature.v4t)] = .{ |
| 1102 | .llvm_name = "armv4t", | 1102 | .llvm_name = "armv4t", |
| 1103 | .description = "ARMv4t architecture", | 1103 | .description = "ARMv4t architecture", |
| 1104 | .dependencies = featureSet(&[_]Feature{ | 1104 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1106,7 +1106,7 @@ pub const all_features = blk: { | ... | @@ -1106,7 +1106,7 @@ pub const all_features = blk: { |
| 1106 | .strict_align, | 1106 | .strict_align, |
| 1107 | }), | 1107 | }), |
| 1108 | }; | 1108 | }; |
| 1109 | result[@intFromEnum(Feature.v5t)] = .{ | 1109 | result[@backingInt(Feature.v5t)] = .{ |
| 1110 | .llvm_name = "armv5t", | 1110 | .llvm_name = "armv5t", |
| 1111 | .description = "ARMv5t architecture", | 1111 | .description = "ARMv5t architecture", |
| 1112 | .dependencies = featureSet(&[_]Feature{ | 1112 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1114,7 +1114,7 @@ pub const all_features = blk: { | ... | @@ -1114,7 +1114,7 @@ pub const all_features = blk: { |
| 1114 | .strict_align, | 1114 | .strict_align, |
| 1115 | }), | 1115 | }), |
| 1116 | }; | 1116 | }; |
| 1117 | result[@intFromEnum(Feature.v5te)] = .{ | 1117 | result[@backingInt(Feature.v5te)] = .{ |
| 1118 | .llvm_name = "armv5te", | 1118 | .llvm_name = "armv5te", |
| 1119 | .description = "ARMv5te architecture", | 1119 | .description = "ARMv5te architecture", |
| 1120 | .dependencies = featureSet(&[_]Feature{ | 1120 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1122,7 +1122,7 @@ pub const all_features = blk: { | ... | @@ -1122,7 +1122,7 @@ pub const all_features = blk: { |
| 1122 | .strict_align, | 1122 | .strict_align, |
| 1123 | }), | 1123 | }), |
| 1124 | }; | 1124 | }; |
| 1125 | result[@intFromEnum(Feature.v5tej)] = .{ | 1125 | result[@backingInt(Feature.v5tej)] = .{ |
| 1126 | .llvm_name = "armv5tej", | 1126 | .llvm_name = "armv5tej", |
| 1127 | .description = "ARMv5tej architecture", | 1127 | .description = "ARMv5tej architecture", |
| 1128 | .dependencies = featureSet(&[_]Feature{ | 1128 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1130,7 +1130,7 @@ pub const all_features = blk: { | ... | @@ -1130,7 +1130,7 @@ pub const all_features = blk: { |
| 1130 | .strict_align, | 1130 | .strict_align, |
| 1131 | }), | 1131 | }), |
| 1132 | }; | 1132 | }; |
| 1133 | result[@intFromEnum(Feature.v6)] = .{ | 1133 | result[@backingInt(Feature.v6)] = .{ |
| 1134 | .llvm_name = "armv6", | 1134 | .llvm_name = "armv6", |
| 1135 | .description = "ARMv6 architecture", | 1135 | .description = "ARMv6 architecture", |
| 1136 | .dependencies = featureSet(&[_]Feature{ | 1136 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1138,21 +1138,21 @@ pub const all_features = blk: { | ... | @@ -1138,21 +1138,21 @@ pub const all_features = blk: { |
| 1138 | .has_v6, | 1138 | .has_v6, |
| 1139 | }), | 1139 | }), |
| 1140 | }; | 1140 | }; |
| 1141 | result[@intFromEnum(Feature.v6j)] = .{ | 1141 | result[@backingInt(Feature.v6j)] = .{ |
| 1142 | .llvm_name = "armv6j", | 1142 | .llvm_name = "armv6j", |
| 1143 | .description = "ARMv7a architecture", | 1143 | .description = "ARMv7a architecture", |
| 1144 | .dependencies = featureSet(&[_]Feature{ | 1144 | .dependencies = featureSet(&[_]Feature{ |
| 1145 | .v6, | 1145 | .v6, |
| 1146 | }), | 1146 | }), |
| 1147 | }; | 1147 | }; |
| 1148 | result[@intFromEnum(Feature.v6k)] = .{ | 1148 | result[@backingInt(Feature.v6k)] = .{ |
| 1149 | .llvm_name = "armv6k", | 1149 | .llvm_name = "armv6k", |
| 1150 | .description = "ARMv6k architecture", | 1150 | .description = "ARMv6k architecture", |
| 1151 | .dependencies = featureSet(&[_]Feature{ | 1151 | .dependencies = featureSet(&[_]Feature{ |
| 1152 | .has_v6k, | 1152 | .has_v6k, |
| 1153 | }), | 1153 | }), |
| 1154 | }; | 1154 | }; |
| 1155 | result[@intFromEnum(Feature.v6kz)] = .{ | 1155 | result[@backingInt(Feature.v6kz)] = .{ |
| 1156 | .llvm_name = "armv6kz", | 1156 | .llvm_name = "armv6kz", |
| 1157 | .description = "ARMv6kz architecture", | 1157 | .description = "ARMv6kz architecture", |
| 1158 | .dependencies = featureSet(&[_]Feature{ | 1158 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1160,7 +1160,7 @@ pub const all_features = blk: { | ... | @@ -1160,7 +1160,7 @@ pub const all_features = blk: { |
| 1160 | .trustzone, | 1160 | .trustzone, |
| 1161 | }), | 1161 | }), |
| 1162 | }; | 1162 | }; |
| 1163 | result[@intFromEnum(Feature.v6m)] = .{ | 1163 | result[@backingInt(Feature.v6m)] = .{ |
| 1164 | .llvm_name = "armv6-m", | 1164 | .llvm_name = "armv6-m", |
| 1165 | .description = "ARMv6m architecture", | 1165 | .description = "ARMv6m architecture", |
| 1166 | .dependencies = featureSet(&[_]Feature{ | 1166 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1172,7 +1172,7 @@ pub const all_features = blk: { | ... | @@ -1172,7 +1172,7 @@ pub const all_features = blk: { |
| 1172 | .thumb_mode, | 1172 | .thumb_mode, |
| 1173 | }), | 1173 | }), |
| 1174 | }; | 1174 | }; |
| 1175 | result[@intFromEnum(Feature.v6sm)] = .{ | 1175 | result[@backingInt(Feature.v6sm)] = .{ |
| 1176 | .llvm_name = "armv6s-m", | 1176 | .llvm_name = "armv6s-m", |
| 1177 | .description = "ARMv6sm architecture", | 1177 | .description = "ARMv6sm architecture", |
| 1178 | .dependencies = featureSet(&[_]Feature{ | 1178 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1184,7 +1184,7 @@ pub const all_features = blk: { | ... | @@ -1184,7 +1184,7 @@ pub const all_features = blk: { |
| 1184 | .thumb_mode, | 1184 | .thumb_mode, |
| 1185 | }), | 1185 | }), |
| 1186 | }; | 1186 | }; |
| 1187 | result[@intFromEnum(Feature.v6t2)] = .{ | 1187 | result[@backingInt(Feature.v6t2)] = .{ |
| 1188 | .llvm_name = "armv6t2", | 1188 | .llvm_name = "armv6t2", |
| 1189 | .description = "ARMv6t2 architecture", | 1189 | .description = "ARMv6t2 architecture", |
| 1190 | .dependencies = featureSet(&[_]Feature{ | 1190 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1192,7 +1192,7 @@ pub const all_features = blk: { | ... | @@ -1192,7 +1192,7 @@ pub const all_features = blk: { |
| 1192 | .has_v6t2, | 1192 | .has_v6t2, |
| 1193 | }), | 1193 | }), |
| 1194 | }; | 1194 | }; |
| 1195 | result[@intFromEnum(Feature.v7a)] = .{ | 1195 | result[@backingInt(Feature.v7a)] = .{ |
| 1196 | .llvm_name = "armv7-a", | 1196 | .llvm_name = "armv7-a", |
| 1197 | .description = "ARMv7a architecture", | 1197 | .description = "ARMv7a architecture", |
| 1198 | .dependencies = featureSet(&[_]Feature{ | 1198 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1204,7 +1204,7 @@ pub const all_features = blk: { | ... | @@ -1204,7 +1204,7 @@ pub const all_features = blk: { |
| 1204 | .perfmon, | 1204 | .perfmon, |
| 1205 | }), | 1205 | }), |
| 1206 | }; | 1206 | }; |
| 1207 | result[@intFromEnum(Feature.v7em)] = .{ | 1207 | result[@backingInt(Feature.v7em)] = .{ |
| 1208 | .llvm_name = "armv7e-m", | 1208 | .llvm_name = "armv7e-m", |
| 1209 | .description = "ARMv7em architecture", | 1209 | .description = "ARMv7em architecture", |
| 1210 | .dependencies = featureSet(&[_]Feature{ | 1210 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1217,7 +1217,7 @@ pub const all_features = blk: { | ... | @@ -1217,7 +1217,7 @@ pub const all_features = blk: { |
| 1217 | .thumb_mode, | 1217 | .thumb_mode, |
| 1218 | }), | 1218 | }), |
| 1219 | }; | 1219 | }; |
| 1220 | result[@intFromEnum(Feature.v7m)] = .{ | 1220 | result[@backingInt(Feature.v7m)] = .{ |
| 1221 | .llvm_name = "armv7-m", | 1221 | .llvm_name = "armv7-m", |
| 1222 | .description = "ARMv7m architecture", | 1222 | .description = "ARMv7m architecture", |
| 1223 | .dependencies = featureSet(&[_]Feature{ | 1223 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1229,7 +1229,7 @@ pub const all_features = blk: { | ... | @@ -1229,7 +1229,7 @@ pub const all_features = blk: { |
| 1229 | .thumb_mode, | 1229 | .thumb_mode, |
| 1230 | }), | 1230 | }), |
| 1231 | }; | 1231 | }; |
| 1232 | result[@intFromEnum(Feature.v7r)] = .{ | 1232 | result[@backingInt(Feature.v7r)] = .{ |
| 1233 | .llvm_name = "armv7-r", | 1233 | .llvm_name = "armv7-r", |
| 1234 | .description = "ARMv7r architecture", | 1234 | .description = "ARMv7r architecture", |
| 1235 | .dependencies = featureSet(&[_]Feature{ | 1235 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1241,7 +1241,7 @@ pub const all_features = blk: { | ... | @@ -1241,7 +1241,7 @@ pub const all_features = blk: { |
| 1241 | .rclass, | 1241 | .rclass, |
| 1242 | }), | 1242 | }), |
| 1243 | }; | 1243 | }; |
| 1244 | result[@intFromEnum(Feature.v7ve)] = .{ | 1244 | result[@backingInt(Feature.v7ve)] = .{ |
| 1245 | .llvm_name = "armv7ve", | 1245 | .llvm_name = "armv7ve", |
| 1246 | .description = "ARMv7ve architecture", | 1246 | .description = "ARMv7ve architecture", |
| 1247 | .dependencies = featureSet(&[_]Feature{ | 1247 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1256,7 +1256,7 @@ pub const all_features = blk: { | ... | @@ -1256,7 +1256,7 @@ pub const all_features = blk: { |
| 1256 | .virtualization, | 1256 | .virtualization, |
| 1257 | }), | 1257 | }), |
| 1258 | }; | 1258 | }; |
| 1259 | result[@intFromEnum(Feature.v8_1a)] = .{ | 1259 | result[@backingInt(Feature.v8_1a)] = .{ |
| 1260 | .llvm_name = "armv8.1-a", | 1260 | .llvm_name = "armv8.1-a", |
| 1261 | .description = "ARMv81a architecture", | 1261 | .description = "ARMv81a architecture", |
| 1262 | .dependencies = featureSet(&[_]Feature{ | 1262 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1272,7 +1272,7 @@ pub const all_features = blk: { | ... | @@ -1272,7 +1272,7 @@ pub const all_features = blk: { |
| 1272 | .virtualization, | 1272 | .virtualization, |
| 1273 | }), | 1273 | }), |
| 1274 | }; | 1274 | }; |
| 1275 | result[@intFromEnum(Feature.v8_1m_main)] = .{ | 1275 | result[@backingInt(Feature.v8_1m_main)] = .{ |
| 1276 | .llvm_name = "armv8.1-m.main", | 1276 | .llvm_name = "armv8.1-m.main", |
| 1277 | .description = "ARMv81mMainline architecture", | 1277 | .description = "ARMv81mMainline architecture", |
| 1278 | .dependencies = featureSet(&[_]Feature{ | 1278 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1288,7 +1288,7 @@ pub const all_features = blk: { | ... | @@ -1288,7 +1288,7 @@ pub const all_features = blk: { |
| 1288 | .thumb_mode, | 1288 | .thumb_mode, |
| 1289 | }), | 1289 | }), |
| 1290 | }; | 1290 | }; |
| 1291 | result[@intFromEnum(Feature.v8_2a)] = .{ | 1291 | result[@backingInt(Feature.v8_2a)] = .{ |
| 1292 | .llvm_name = "armv8.2-a", | 1292 | .llvm_name = "armv8.2-a", |
| 1293 | .description = "ARMv82a architecture", | 1293 | .description = "ARMv82a architecture", |
| 1294 | .dependencies = featureSet(&[_]Feature{ | 1294 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1305,7 +1305,7 @@ pub const all_features = blk: { | ... | @@ -1305,7 +1305,7 @@ pub const all_features = blk: { |
| 1305 | .virtualization, | 1305 | .virtualization, |
| 1306 | }), | 1306 | }), |
| 1307 | }; | 1307 | }; |
| 1308 | result[@intFromEnum(Feature.v8_3a)] = .{ | 1308 | result[@backingInt(Feature.v8_3a)] = .{ |
| 1309 | .llvm_name = "armv8.3-a", | 1309 | .llvm_name = "armv8.3-a", |
| 1310 | .description = "ARMv83a architecture", | 1310 | .description = "ARMv83a architecture", |
| 1311 | .dependencies = featureSet(&[_]Feature{ | 1311 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1322,7 +1322,7 @@ pub const all_features = blk: { | ... | @@ -1322,7 +1322,7 @@ pub const all_features = blk: { |
| 1322 | .virtualization, | 1322 | .virtualization, |
| 1323 | }), | 1323 | }), |
| 1324 | }; | 1324 | }; |
| 1325 | result[@intFromEnum(Feature.v8_4a)] = .{ | 1325 | result[@backingInt(Feature.v8_4a)] = .{ |
| 1326 | .llvm_name = "armv8.4-a", | 1326 | .llvm_name = "armv8.4-a", |
| 1327 | .description = "ARMv84a architecture", | 1327 | .description = "ARMv84a architecture", |
| 1328 | .dependencies = featureSet(&[_]Feature{ | 1328 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1339,7 +1339,7 @@ pub const all_features = blk: { | ... | @@ -1339,7 +1339,7 @@ pub const all_features = blk: { |
| 1339 | .virtualization, | 1339 | .virtualization, |
| 1340 | }), | 1340 | }), |
| 1341 | }; | 1341 | }; |
| 1342 | result[@intFromEnum(Feature.v8_5a)] = .{ | 1342 | result[@backingInt(Feature.v8_5a)] = .{ |
| 1343 | .llvm_name = "armv8.5-a", | 1343 | .llvm_name = "armv8.5-a", |
| 1344 | .description = "ARMv85a architecture", | 1344 | .description = "ARMv85a architecture", |
| 1345 | .dependencies = featureSet(&[_]Feature{ | 1345 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1356,7 +1356,7 @@ pub const all_features = blk: { | ... | @@ -1356,7 +1356,7 @@ pub const all_features = blk: { |
| 1356 | .virtualization, | 1356 | .virtualization, |
| 1357 | }), | 1357 | }), |
| 1358 | }; | 1358 | }; |
| 1359 | result[@intFromEnum(Feature.v8_6a)] = .{ | 1359 | result[@backingInt(Feature.v8_6a)] = .{ |
| 1360 | .llvm_name = "armv8.6-a", | 1360 | .llvm_name = "armv8.6-a", |
| 1361 | .description = "ARMv86a architecture", | 1361 | .description = "ARMv86a architecture", |
| 1362 | .dependencies = featureSet(&[_]Feature{ | 1362 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1373,7 +1373,7 @@ pub const all_features = blk: { | ... | @@ -1373,7 +1373,7 @@ pub const all_features = blk: { |
| 1373 | .virtualization, | 1373 | .virtualization, |
| 1374 | }), | 1374 | }), |
| 1375 | }; | 1375 | }; |
| 1376 | result[@intFromEnum(Feature.v8_7a)] = .{ | 1376 | result[@backingInt(Feature.v8_7a)] = .{ |
| 1377 | .llvm_name = "armv8.7-a", | 1377 | .llvm_name = "armv8.7-a", |
| 1378 | .description = "ARMv87a architecture", | 1378 | .description = "ARMv87a architecture", |
| 1379 | .dependencies = featureSet(&[_]Feature{ | 1379 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1390,7 +1390,7 @@ pub const all_features = blk: { | ... | @@ -1390,7 +1390,7 @@ pub const all_features = blk: { |
| 1390 | .virtualization, | 1390 | .virtualization, |
| 1391 | }), | 1391 | }), |
| 1392 | }; | 1392 | }; |
| 1393 | result[@intFromEnum(Feature.v8_8a)] = .{ | 1393 | result[@backingInt(Feature.v8_8a)] = .{ |
| 1394 | .llvm_name = "armv8.8-a", | 1394 | .llvm_name = "armv8.8-a", |
| 1395 | .description = "ARMv88a architecture", | 1395 | .description = "ARMv88a architecture", |
| 1396 | .dependencies = featureSet(&[_]Feature{ | 1396 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1407,7 +1407,7 @@ pub const all_features = blk: { | ... | @@ -1407,7 +1407,7 @@ pub const all_features = blk: { |
| 1407 | .virtualization, | 1407 | .virtualization, |
| 1408 | }), | 1408 | }), |
| 1409 | }; | 1409 | }; |
| 1410 | result[@intFromEnum(Feature.v8_9a)] = .{ | 1410 | result[@backingInt(Feature.v8_9a)] = .{ |
| 1411 | .llvm_name = "armv8.9-a", | 1411 | .llvm_name = "armv8.9-a", |
| 1412 | .description = "ARMv89a architecture", | 1412 | .description = "ARMv89a architecture", |
| 1413 | .dependencies = featureSet(&[_]Feature{ | 1413 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1424,7 +1424,7 @@ pub const all_features = blk: { | ... | @@ -1424,7 +1424,7 @@ pub const all_features = blk: { |
| 1424 | .virtualization, | 1424 | .virtualization, |
| 1425 | }), | 1425 | }), |
| 1426 | }; | 1426 | }; |
| 1427 | result[@intFromEnum(Feature.v8a)] = .{ | 1427 | result[@backingInt(Feature.v8a)] = .{ |
| 1428 | .llvm_name = "armv8-a", | 1428 | .llvm_name = "armv8-a", |
| 1429 | .description = "ARMv8a architecture", | 1429 | .description = "ARMv8a architecture", |
| 1430 | .dependencies = featureSet(&[_]Feature{ | 1430 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1440,7 +1440,7 @@ pub const all_features = blk: { | ... | @@ -1440,7 +1440,7 @@ pub const all_features = blk: { |
| 1440 | .virtualization, | 1440 | .virtualization, |
| 1441 | }), | 1441 | }), |
| 1442 | }; | 1442 | }; |
| 1443 | result[@intFromEnum(Feature.v8m)] = .{ | 1443 | result[@backingInt(Feature.v8m)] = .{ |
| 1444 | .llvm_name = "armv8-m.base", | 1444 | .llvm_name = "armv8-m.base", |
| 1445 | .description = "ARMv8mBaseline architecture", | 1445 | .description = "ARMv8mBaseline architecture", |
| 1446 | .dependencies = featureSet(&[_]Feature{ | 1446 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1456,7 +1456,7 @@ pub const all_features = blk: { | ... | @@ -1456,7 +1456,7 @@ pub const all_features = blk: { |
| 1456 | .thumb_mode, | 1456 | .thumb_mode, |
| 1457 | }), | 1457 | }), |
| 1458 | }; | 1458 | }; |
| 1459 | result[@intFromEnum(Feature.v8m_main)] = .{ | 1459 | result[@backingInt(Feature.v8m_main)] = .{ |
| 1460 | .llvm_name = "armv8-m.main", | 1460 | .llvm_name = "armv8-m.main", |
| 1461 | .description = "ARMv8mMainline architecture", | 1461 | .description = "ARMv8mMainline architecture", |
| 1462 | .dependencies = featureSet(&[_]Feature{ | 1462 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1470,7 +1470,7 @@ pub const all_features = blk: { | ... | @@ -1470,7 +1470,7 @@ pub const all_features = blk: { |
| 1470 | .thumb_mode, | 1470 | .thumb_mode, |
| 1471 | }), | 1471 | }), |
| 1472 | }; | 1472 | }; |
| 1473 | result[@intFromEnum(Feature.v8r)] = .{ | 1473 | result[@backingInt(Feature.v8r)] = .{ |
| 1474 | .llvm_name = "armv8-r", | 1474 | .llvm_name = "armv8-r", |
| 1475 | .description = "ARMv8r architecture", | 1475 | .description = "ARMv8r architecture", |
| 1476 | .dependencies = featureSet(&[_]Feature{ | 1476 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1485,7 +1485,7 @@ pub const all_features = blk: { | ... | @@ -1485,7 +1485,7 @@ pub const all_features = blk: { |
| 1485 | .virtualization, | 1485 | .virtualization, |
| 1486 | }), | 1486 | }), |
| 1487 | }; | 1487 | }; |
| 1488 | result[@intFromEnum(Feature.v9_1a)] = .{ | 1488 | result[@backingInt(Feature.v9_1a)] = .{ |
| 1489 | .llvm_name = "armv9.1-a", | 1489 | .llvm_name = "armv9.1-a", |
| 1490 | .description = "ARMv91a architecture", | 1490 | .description = "ARMv91a architecture", |
| 1491 | .dependencies = featureSet(&[_]Feature{ | 1491 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1501,7 +1501,7 @@ pub const all_features = blk: { | ... | @@ -1501,7 +1501,7 @@ pub const all_features = blk: { |
| 1501 | .virtualization, | 1501 | .virtualization, |
| 1502 | }), | 1502 | }), |
| 1503 | }; | 1503 | }; |
| 1504 | result[@intFromEnum(Feature.v9_2a)] = .{ | 1504 | result[@backingInt(Feature.v9_2a)] = .{ |
| 1505 | .llvm_name = "armv9.2-a", | 1505 | .llvm_name = "armv9.2-a", |
| 1506 | .description = "ARMv92a architecture", | 1506 | .description = "ARMv92a architecture", |
| 1507 | .dependencies = featureSet(&[_]Feature{ | 1507 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1517,7 +1517,7 @@ pub const all_features = blk: { | ... | @@ -1517,7 +1517,7 @@ pub const all_features = blk: { |
| 1517 | .virtualization, | 1517 | .virtualization, |
| 1518 | }), | 1518 | }), |
| 1519 | }; | 1519 | }; |
| 1520 | result[@intFromEnum(Feature.v9_3a)] = .{ | 1520 | result[@backingInt(Feature.v9_3a)] = .{ |
| 1521 | .llvm_name = "armv9.3-a", | 1521 | .llvm_name = "armv9.3-a", |
| 1522 | .description = "ARMv93a architecture", | 1522 | .description = "ARMv93a architecture", |
| 1523 | .dependencies = featureSet(&[_]Feature{ | 1523 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1534,7 +1534,7 @@ pub const all_features = blk: { | ... | @@ -1534,7 +1534,7 @@ pub const all_features = blk: { |
| 1534 | .virtualization, | 1534 | .virtualization, |
| 1535 | }), | 1535 | }), |
| 1536 | }; | 1536 | }; |
| 1537 | result[@intFromEnum(Feature.v9_4a)] = .{ | 1537 | result[@backingInt(Feature.v9_4a)] = .{ |
| 1538 | .llvm_name = "armv9.4-a", | 1538 | .llvm_name = "armv9.4-a", |
| 1539 | .description = "ARMv94a architecture", | 1539 | .description = "ARMv94a architecture", |
| 1540 | .dependencies = featureSet(&[_]Feature{ | 1540 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1550,7 +1550,7 @@ pub const all_features = blk: { | ... | @@ -1550,7 +1550,7 @@ pub const all_features = blk: { |
| 1550 | .virtualization, | 1550 | .virtualization, |
| 1551 | }), | 1551 | }), |
| 1552 | }; | 1552 | }; |
| 1553 | result[@intFromEnum(Feature.v9_5a)] = .{ | 1553 | result[@backingInt(Feature.v9_5a)] = .{ |
| 1554 | .llvm_name = "armv9.5-a", | 1554 | .llvm_name = "armv9.5-a", |
| 1555 | .description = "ARMv95a architecture", | 1555 | .description = "ARMv95a architecture", |
| 1556 | .dependencies = featureSet(&[_]Feature{ | 1556 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1566,7 +1566,7 @@ pub const all_features = blk: { | ... | @@ -1566,7 +1566,7 @@ pub const all_features = blk: { |
| 1566 | .virtualization, | 1566 | .virtualization, |
| 1567 | }), | 1567 | }), |
| 1568 | }; | 1568 | }; |
| 1569 | result[@intFromEnum(Feature.v9_6a)] = .{ | 1569 | result[@backingInt(Feature.v9_6a)] = .{ |
| 1570 | .llvm_name = "armv9.6-a", | 1570 | .llvm_name = "armv9.6-a", |
| 1571 | .description = "ARMv96a architecture", | 1571 | .description = "ARMv96a architecture", |
| 1572 | .dependencies = featureSet(&[_]Feature{ | 1572 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1582,7 +1582,7 @@ pub const all_features = blk: { | ... | @@ -1582,7 +1582,7 @@ pub const all_features = blk: { |
| 1582 | .virtualization, | 1582 | .virtualization, |
| 1583 | }), | 1583 | }), |
| 1584 | }; | 1584 | }; |
| 1585 | result[@intFromEnum(Feature.v9_7a)] = .{ | 1585 | result[@backingInt(Feature.v9_7a)] = .{ |
| 1586 | .llvm_name = "armv9.7-a", | 1586 | .llvm_name = "armv9.7-a", |
| 1587 | .description = "ARMv97a architecture", | 1587 | .description = "ARMv97a architecture", |
| 1588 | .dependencies = featureSet(&[_]Feature{ | 1588 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1598,7 +1598,7 @@ pub const all_features = blk: { | ... | @@ -1598,7 +1598,7 @@ pub const all_features = blk: { |
| 1598 | .virtualization, | 1598 | .virtualization, |
| 1599 | }), | 1599 | }), |
| 1600 | }; | 1600 | }; |
| 1601 | result[@intFromEnum(Feature.v9a)] = .{ | 1601 | result[@backingInt(Feature.v9a)] = .{ |
| 1602 | .llvm_name = "armv9-a", | 1602 | .llvm_name = "armv9-a", |
| 1603 | .description = "ARMv9a architecture", | 1603 | .description = "ARMv9a architecture", |
| 1604 | .dependencies = featureSet(&[_]Feature{ | 1604 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1614,7 +1614,7 @@ pub const all_features = blk: { | ... | @@ -1614,7 +1614,7 @@ pub const all_features = blk: { |
| 1614 | .virtualization, | 1614 | .virtualization, |
| 1615 | }), | 1615 | }), |
| 1616 | }; | 1616 | }; |
| 1617 | result[@intFromEnum(Feature.vfp2)] = .{ | 1617 | result[@backingInt(Feature.vfp2)] = .{ |
| 1618 | .llvm_name = "vfp2", | 1618 | .llvm_name = "vfp2", |
| 1619 | .description = "Enable VFP2 instructions", | 1619 | .description = "Enable VFP2 instructions", |
| 1620 | .dependencies = featureSet(&[_]Feature{ | 1620 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1622,14 +1622,14 @@ pub const all_features = blk: { | ... | @@ -1622,14 +1622,14 @@ pub const all_features = blk: { |
| 1622 | .vfp2sp, | 1622 | .vfp2sp, |
| 1623 | }), | 1623 | }), |
| 1624 | }; | 1624 | }; |
| 1625 | result[@intFromEnum(Feature.vfp2sp)] = .{ | 1625 | result[@backingInt(Feature.vfp2sp)] = .{ |
| 1626 | .llvm_name = "vfp2sp", | 1626 | .llvm_name = "vfp2sp", |
| 1627 | .description = "Enable VFP2 instructions with no double precision", | 1627 | .description = "Enable VFP2 instructions with no double precision", |
| 1628 | .dependencies = featureSet(&[_]Feature{ | 1628 | .dependencies = featureSet(&[_]Feature{ |
| 1629 | .fpregs, | 1629 | .fpregs, |
| 1630 | }), | 1630 | }), |
| 1631 | }; | 1631 | }; |
| 1632 | result[@intFromEnum(Feature.vfp3)] = .{ | 1632 | result[@backingInt(Feature.vfp3)] = .{ |
| 1633 | .llvm_name = "vfp3", | 1633 | .llvm_name = "vfp3", |
| 1634 | .description = "Enable VFP3 instructions", | 1634 | .description = "Enable VFP3 instructions", |
| 1635 | .dependencies = featureSet(&[_]Feature{ | 1635 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1637,7 +1637,7 @@ pub const all_features = blk: { | ... | @@ -1637,7 +1637,7 @@ pub const all_features = blk: { |
| 1637 | .vfp3sp, | 1637 | .vfp3sp, |
| 1638 | }), | 1638 | }), |
| 1639 | }; | 1639 | }; |
| 1640 | result[@intFromEnum(Feature.vfp3d16)] = .{ | 1640 | result[@backingInt(Feature.vfp3d16)] = .{ |
| 1641 | .llvm_name = "vfp3d16", | 1641 | .llvm_name = "vfp3d16", |
| 1642 | .description = "Enable VFP3 instructions with only 16 d-registers", | 1642 | .description = "Enable VFP3 instructions with only 16 d-registers", |
| 1643 | .dependencies = featureSet(&[_]Feature{ | 1643 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1645,14 +1645,14 @@ pub const all_features = blk: { | ... | @@ -1645,14 +1645,14 @@ pub const all_features = blk: { |
| 1645 | .vfp3d16sp, | 1645 | .vfp3d16sp, |
| 1646 | }), | 1646 | }), |
| 1647 | }; | 1647 | }; |
| 1648 | result[@intFromEnum(Feature.vfp3d16sp)] = .{ | 1648 | result[@backingInt(Feature.vfp3d16sp)] = .{ |
| 1649 | .llvm_name = "vfp3d16sp", | 1649 | .llvm_name = "vfp3d16sp", |
| 1650 | .description = "Enable VFP3 instructions with only 16 d-registers and no double precision", | 1650 | .description = "Enable VFP3 instructions with only 16 d-registers and no double precision", |
| 1651 | .dependencies = featureSet(&[_]Feature{ | 1651 | .dependencies = featureSet(&[_]Feature{ |
| 1652 | .vfp2sp, | 1652 | .vfp2sp, |
| 1653 | }), | 1653 | }), |
| 1654 | }; | 1654 | }; |
| 1655 | result[@intFromEnum(Feature.vfp3sp)] = .{ | 1655 | result[@backingInt(Feature.vfp3sp)] = .{ |
| 1656 | .llvm_name = "vfp3sp", | 1656 | .llvm_name = "vfp3sp", |
| 1657 | .description = "Enable VFP3 instructions with no double precision", | 1657 | .description = "Enable VFP3 instructions with no double precision", |
| 1658 | .dependencies = featureSet(&[_]Feature{ | 1658 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1660,7 +1660,7 @@ pub const all_features = blk: { | ... | @@ -1660,7 +1660,7 @@ pub const all_features = blk: { |
| 1660 | .vfp3d16sp, | 1660 | .vfp3d16sp, |
| 1661 | }), | 1661 | }), |
| 1662 | }; | 1662 | }; |
| 1663 | result[@intFromEnum(Feature.vfp4)] = .{ | 1663 | result[@backingInt(Feature.vfp4)] = .{ |
| 1664 | .llvm_name = "vfp4", | 1664 | .llvm_name = "vfp4", |
| 1665 | .description = "Enable VFP4 instructions", | 1665 | .description = "Enable VFP4 instructions", |
| 1666 | .dependencies = featureSet(&[_]Feature{ | 1666 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1669,7 +1669,7 @@ pub const all_features = blk: { | ... | @@ -1669,7 +1669,7 @@ pub const all_features = blk: { |
| 1669 | .vfp4sp, | 1669 | .vfp4sp, |
| 1670 | }), | 1670 | }), |
| 1671 | }; | 1671 | }; |
| 1672 | result[@intFromEnum(Feature.vfp4d16)] = .{ | 1672 | result[@backingInt(Feature.vfp4d16)] = .{ |
| 1673 | .llvm_name = "vfp4d16", | 1673 | .llvm_name = "vfp4d16", |
| 1674 | .description = "Enable VFP4 instructions with only 16 d-registers", | 1674 | .description = "Enable VFP4 instructions with only 16 d-registers", |
| 1675 | .dependencies = featureSet(&[_]Feature{ | 1675 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1677,7 +1677,7 @@ pub const all_features = blk: { | ... | @@ -1677,7 +1677,7 @@ pub const all_features = blk: { |
| 1677 | .vfp4d16sp, | 1677 | .vfp4d16sp, |
| 1678 | }), | 1678 | }), |
| 1679 | }; | 1679 | }; |
| 1680 | result[@intFromEnum(Feature.vfp4d16sp)] = .{ | 1680 | result[@backingInt(Feature.vfp4d16sp)] = .{ |
| 1681 | .llvm_name = "vfp4d16sp", | 1681 | .llvm_name = "vfp4d16sp", |
| 1682 | .description = "Enable VFP4 instructions with only 16 d-registers and no double precision", | 1682 | .description = "Enable VFP4 instructions with only 16 d-registers and no double precision", |
| 1683 | .dependencies = featureSet(&[_]Feature{ | 1683 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1685,7 +1685,7 @@ pub const all_features = blk: { | ... | @@ -1685,7 +1685,7 @@ pub const all_features = blk: { |
| 1685 | .vfp3d16sp, | 1685 | .vfp3d16sp, |
| 1686 | }), | 1686 | }), |
| 1687 | }; | 1687 | }; |
| 1688 | result[@intFromEnum(Feature.vfp4sp)] = .{ | 1688 | result[@backingInt(Feature.vfp4sp)] = .{ |
| 1689 | .llvm_name = "vfp4sp", | 1689 | .llvm_name = "vfp4sp", |
| 1690 | .description = "Enable VFP4 instructions with no double precision", | 1690 | .description = "Enable VFP4 instructions with no double precision", |
| 1691 | .dependencies = featureSet(&[_]Feature{ | 1691 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1693,7 +1693,7 @@ pub const all_features = blk: { | ... | @@ -1693,7 +1693,7 @@ pub const all_features = blk: { |
| 1693 | .vfp4d16sp, | 1693 | .vfp4d16sp, |
| 1694 | }), | 1694 | }), |
| 1695 | }; | 1695 | }; |
| 1696 | result[@intFromEnum(Feature.virtualization)] = .{ | 1696 | result[@backingInt(Feature.virtualization)] = .{ |
| 1697 | .llvm_name = "virtualization", | 1697 | .llvm_name = "virtualization", |
| 1698 | .description = "Supports Virtualization extension", | 1698 | .description = "Supports Virtualization extension", |
| 1699 | .dependencies = featureSet(&[_]Feature{ | 1699 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1701,34 +1701,34 @@ pub const all_features = blk: { | ... | @@ -1701,34 +1701,34 @@ pub const all_features = blk: { |
| 1701 | .hwdiv_arm, | 1701 | .hwdiv_arm, |
| 1702 | }), | 1702 | }), |
| 1703 | }; | 1703 | }; |
| 1704 | result[@intFromEnum(Feature.vldn_align)] = .{ | 1704 | result[@backingInt(Feature.vldn_align)] = .{ |
| 1705 | .llvm_name = "vldn-align", | 1705 | .llvm_name = "vldn-align", |
| 1706 | .description = "Check for VLDn unaligned access", | 1706 | .description = "Check for VLDn unaligned access", |
| 1707 | .dependencies = featureSet(&[_]Feature{}), | 1707 | .dependencies = featureSet(&[_]Feature{}), |
| 1708 | }; | 1708 | }; |
| 1709 | result[@intFromEnum(Feature.vmlx_forwarding)] = .{ | 1709 | result[@backingInt(Feature.vmlx_forwarding)] = .{ |
| 1710 | .llvm_name = "vmlx-forwarding", | 1710 | .llvm_name = "vmlx-forwarding", |
| 1711 | .description = "Has multiplier accumulator forwarding", | 1711 | .description = "Has multiplier accumulator forwarding", |
| 1712 | .dependencies = featureSet(&[_]Feature{}), | 1712 | .dependencies = featureSet(&[_]Feature{}), |
| 1713 | }; | 1713 | }; |
| 1714 | result[@intFromEnum(Feature.vmlx_hazards)] = .{ | 1714 | result[@backingInt(Feature.vmlx_hazards)] = .{ |
| 1715 | .llvm_name = "vmlx-hazards", | 1715 | .llvm_name = "vmlx-hazards", |
| 1716 | .description = "Has VMLx hazards", | 1716 | .description = "Has VMLx hazards", |
| 1717 | .dependencies = featureSet(&[_]Feature{}), | 1717 | .dependencies = featureSet(&[_]Feature{}), |
| 1718 | }; | 1718 | }; |
| 1719 | result[@intFromEnum(Feature.wide_stride_vfp)] = .{ | 1719 | result[@backingInt(Feature.wide_stride_vfp)] = .{ |
| 1720 | .llvm_name = "wide-stride-vfp", | 1720 | .llvm_name = "wide-stride-vfp", |
| 1721 | .description = "Use a wide stride when allocating VFP registers", | 1721 | .description = "Use a wide stride when allocating VFP registers", |
| 1722 | .dependencies = featureSet(&[_]Feature{}), | 1722 | .dependencies = featureSet(&[_]Feature{}), |
| 1723 | }; | 1723 | }; |
| 1724 | result[@intFromEnum(Feature.xscale)] = .{ | 1724 | result[@backingInt(Feature.xscale)] = .{ |
| 1725 | .llvm_name = "xscale", | 1725 | .llvm_name = "xscale", |
| 1726 | .description = "ARMv5te architecture", | 1726 | .description = "ARMv5te architecture", |
| 1727 | .dependencies = featureSet(&[_]Feature{ | 1727 | .dependencies = featureSet(&[_]Feature{ |
| 1728 | .v5te, | 1728 | .v5te, |
| 1729 | }), | 1729 | }), |
| 1730 | }; | 1730 | }; |
| 1731 | result[@intFromEnum(Feature.zcz)] = .{ | 1731 | result[@backingInt(Feature.zcz)] = .{ |
| 1732 | .llvm_name = "zcz", | 1732 | .llvm_name = "zcz", |
| 1733 | .description = "Has zero-cycle zeroing instructions", | 1733 | .description = "Has zero-cycle zeroing instructions", |
| 1734 | .dependencies = featureSet(&[_]Feature{}), | 1734 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/avr.zig+39-39| ... | @@ -55,17 +55,17 @@ pub const all_features = blk: { | ... | @@ -55,17 +55,17 @@ pub const all_features = blk: { |
| 55 | const len = @typeInfo(Feature).@"enum".field_names.len; | 55 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 56 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 56 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 57 | var result: [len]CpuFeature = undefined; | 57 | var result: [len]CpuFeature = undefined; |
| 58 | result[@intFromEnum(Feature.addsubiw)] = .{ | 58 | result[@backingInt(Feature.addsubiw)] = .{ |
| 59 | .llvm_name = "addsubiw", | 59 | .llvm_name = "addsubiw", |
| 60 | .description = "Enable 16-bit register-immediate addition and subtraction instructions", | 60 | .description = "Enable 16-bit register-immediate addition and subtraction instructions", |
| 61 | .dependencies = featureSet(&[_]Feature{}), | 61 | .dependencies = featureSet(&[_]Feature{}), |
| 62 | }; | 62 | }; |
| 63 | result[@intFromEnum(Feature.avr0)] = .{ | 63 | result[@backingInt(Feature.avr0)] = .{ |
| 64 | .llvm_name = "avr0", | 64 | .llvm_name = "avr0", |
| 65 | .description = "The device is a part of the avr0 family", | 65 | .description = "The device is a part of the avr0 family", |
| 66 | .dependencies = featureSet(&[_]Feature{}), | 66 | .dependencies = featureSet(&[_]Feature{}), |
| 67 | }; | 67 | }; |
| 68 | result[@intFromEnum(Feature.avr1)] = .{ | 68 | result[@backingInt(Feature.avr1)] = .{ |
| 69 | .llvm_name = "avr1", | 69 | .llvm_name = "avr1", |
| 70 | .description = "The device is a part of the avr1 family", | 70 | .description = "The device is a part of the avr1 family", |
| 71 | .dependencies = featureSet(&[_]Feature{ | 71 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -74,7 +74,7 @@ pub const all_features = blk: { | ... | @@ -74,7 +74,7 @@ pub const all_features = blk: { |
| 74 | .memmappedregs, | 74 | .memmappedregs, |
| 75 | }), | 75 | }), |
| 76 | }; | 76 | }; |
| 77 | result[@intFromEnum(Feature.avr2)] = .{ | 77 | result[@backingInt(Feature.avr2)] = .{ |
| 78 | .llvm_name = "avr2", | 78 | .llvm_name = "avr2", |
| 79 | .description = "The device is a part of the avr2 family", | 79 | .description = "The device is a part of the avr2 family", |
| 80 | .dependencies = featureSet(&[_]Feature{ | 80 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -84,7 +84,7 @@ pub const all_features = blk: { | ... | @@ -84,7 +84,7 @@ pub const all_features = blk: { |
| 84 | .sram, | 84 | .sram, |
| 85 | }), | 85 | }), |
| 86 | }; | 86 | }; |
| 87 | result[@intFromEnum(Feature.avr25)] = .{ | 87 | result[@backingInt(Feature.avr25)] = .{ |
| 88 | .llvm_name = "avr25", | 88 | .llvm_name = "avr25", |
| 89 | .description = "The device is a part of the avr25 family", | 89 | .description = "The device is a part of the avr25 family", |
| 90 | .dependencies = featureSet(&[_]Feature{ | 90 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -95,7 +95,7 @@ pub const all_features = blk: { | ... | @@ -95,7 +95,7 @@ pub const all_features = blk: { |
| 95 | .spm, | 95 | .spm, |
| 96 | }), | 96 | }), |
| 97 | }; | 97 | }; |
| 98 | result[@intFromEnum(Feature.avr3)] = .{ | 98 | result[@backingInt(Feature.avr3)] = .{ |
| 99 | .llvm_name = "avr3", | 99 | .llvm_name = "avr3", |
| 100 | .description = "The device is a part of the avr3 family", | 100 | .description = "The device is a part of the avr3 family", |
| 101 | .dependencies = featureSet(&[_]Feature{ | 101 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -103,7 +103,7 @@ pub const all_features = blk: { | ... | @@ -103,7 +103,7 @@ pub const all_features = blk: { |
| 103 | .jmpcall, | 103 | .jmpcall, |
| 104 | }), | 104 | }), |
| 105 | }; | 105 | }; |
| 106 | result[@intFromEnum(Feature.avr31)] = .{ | 106 | result[@backingInt(Feature.avr31)] = .{ |
| 107 | .llvm_name = "avr31", | 107 | .llvm_name = "avr31", |
| 108 | .description = "The device is a part of the avr31 family", | 108 | .description = "The device is a part of the avr31 family", |
| 109 | .dependencies = featureSet(&[_]Feature{ | 109 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -111,7 +111,7 @@ pub const all_features = blk: { | ... | @@ -111,7 +111,7 @@ pub const all_features = blk: { |
| 111 | .elpm, | 111 | .elpm, |
| 112 | }), | 112 | }), |
| 113 | }; | 113 | }; |
| 114 | result[@intFromEnum(Feature.avr35)] = .{ | 114 | result[@backingInt(Feature.avr35)] = .{ |
| 115 | .llvm_name = "avr35", | 115 | .llvm_name = "avr35", |
| 116 | .description = "The device is a part of the avr35 family", | 116 | .description = "The device is a part of the avr35 family", |
| 117 | .dependencies = featureSet(&[_]Feature{ | 117 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -122,7 +122,7 @@ pub const all_features = blk: { | ... | @@ -122,7 +122,7 @@ pub const all_features = blk: { |
| 122 | .spm, | 122 | .spm, |
| 123 | }), | 123 | }), |
| 124 | }; | 124 | }; |
| 125 | result[@intFromEnum(Feature.avr4)] = .{ | 125 | result[@backingInt(Feature.avr4)] = .{ |
| 126 | .llvm_name = "avr4", | 126 | .llvm_name = "avr4", |
| 127 | .description = "The device is a part of the avr4 family", | 127 | .description = "The device is a part of the avr4 family", |
| 128 | .dependencies = featureSet(&[_]Feature{ | 128 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -134,7 +134,7 @@ pub const all_features = blk: { | ... | @@ -134,7 +134,7 @@ pub const all_features = blk: { |
| 134 | .spm, | 134 | .spm, |
| 135 | }), | 135 | }), |
| 136 | }; | 136 | }; |
| 137 | result[@intFromEnum(Feature.avr5)] = .{ | 137 | result[@backingInt(Feature.avr5)] = .{ |
| 138 | .llvm_name = "avr5", | 138 | .llvm_name = "avr5", |
| 139 | .description = "The device is a part of the avr5 family", | 139 | .description = "The device is a part of the avr5 family", |
| 140 | .dependencies = featureSet(&[_]Feature{ | 140 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -146,7 +146,7 @@ pub const all_features = blk: { | ... | @@ -146,7 +146,7 @@ pub const all_features = blk: { |
| 146 | .spm, | 146 | .spm, |
| 147 | }), | 147 | }), |
| 148 | }; | 148 | }; |
| 149 | result[@intFromEnum(Feature.avr51)] = .{ | 149 | result[@backingInt(Feature.avr51)] = .{ |
| 150 | .llvm_name = "avr51", | 150 | .llvm_name = "avr51", |
| 151 | .description = "The device is a part of the avr51 family", | 151 | .description = "The device is a part of the avr51 family", |
| 152 | .dependencies = featureSet(&[_]Feature{ | 152 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -155,7 +155,7 @@ pub const all_features = blk: { | ... | @@ -155,7 +155,7 @@ pub const all_features = blk: { |
| 155 | .elpmx, | 155 | .elpmx, |
| 156 | }), | 156 | }), |
| 157 | }; | 157 | }; |
| 158 | result[@intFromEnum(Feature.avr6)] = .{ | 158 | result[@backingInt(Feature.avr6)] = .{ |
| 159 | .llvm_name = "avr6", | 159 | .llvm_name = "avr6", |
| 160 | .description = "The device is a part of the avr6 family", | 160 | .description = "The device is a part of the avr6 family", |
| 161 | .dependencies = featureSet(&[_]Feature{ | 161 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -163,7 +163,7 @@ pub const all_features = blk: { | ... | @@ -163,7 +163,7 @@ pub const all_features = blk: { |
| 163 | .eijmpcall, | 163 | .eijmpcall, |
| 164 | }), | 164 | }), |
| 165 | }; | 165 | }; |
| 166 | result[@intFromEnum(Feature.avrtiny)] = .{ | 166 | result[@backingInt(Feature.avrtiny)] = .{ |
| 167 | .llvm_name = "avrtiny", | 167 | .llvm_name = "avrtiny", |
| 168 | .description = "The device is a part of the avrtiny family", | 168 | .description = "The device is a part of the avrtiny family", |
| 169 | .dependencies = featureSet(&[_]Feature{ | 169 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -174,82 +174,82 @@ pub const all_features = blk: { | ... | @@ -174,82 +174,82 @@ pub const all_features = blk: { |
| 174 | .tinyencoding, | 174 | .tinyencoding, |
| 175 | }), | 175 | }), |
| 176 | }; | 176 | }; |
| 177 | result[@intFromEnum(Feature.@"break")] = .{ | 177 | result[@backingInt(Feature.@"break")] = .{ |
| 178 | .llvm_name = "break", | 178 | .llvm_name = "break", |
| 179 | .description = "The device supports the `BREAK` debugging instruction", | 179 | .description = "The device supports the `BREAK` debugging instruction", |
| 180 | .dependencies = featureSet(&[_]Feature{}), | 180 | .dependencies = featureSet(&[_]Feature{}), |
| 181 | }; | 181 | }; |
| 182 | result[@intFromEnum(Feature.des)] = .{ | 182 | result[@backingInt(Feature.des)] = .{ |
| 183 | .llvm_name = "des", | 183 | .llvm_name = "des", |
| 184 | .description = "The device supports the `DES k` encryption instruction", | 184 | .description = "The device supports the `DES k` encryption instruction", |
| 185 | .dependencies = featureSet(&[_]Feature{}), | 185 | .dependencies = featureSet(&[_]Feature{}), |
| 186 | }; | 186 | }; |
| 187 | result[@intFromEnum(Feature.eijmpcall)] = .{ | 187 | result[@backingInt(Feature.eijmpcall)] = .{ |
| 188 | .llvm_name = "eijmpcall", | 188 | .llvm_name = "eijmpcall", |
| 189 | .description = "The device supports the `EIJMP`/`EICALL` instructions", | 189 | .description = "The device supports the `EIJMP`/`EICALL` instructions", |
| 190 | .dependencies = featureSet(&[_]Feature{}), | 190 | .dependencies = featureSet(&[_]Feature{}), |
| 191 | }; | 191 | }; |
| 192 | result[@intFromEnum(Feature.elpm)] = .{ | 192 | result[@backingInt(Feature.elpm)] = .{ |
| 193 | .llvm_name = "elpm", | 193 | .llvm_name = "elpm", |
| 194 | .description = "The device supports the ELPM instruction", | 194 | .description = "The device supports the ELPM instruction", |
| 195 | .dependencies = featureSet(&[_]Feature{}), | 195 | .dependencies = featureSet(&[_]Feature{}), |
| 196 | }; | 196 | }; |
| 197 | result[@intFromEnum(Feature.elpmx)] = .{ | 197 | result[@backingInt(Feature.elpmx)] = .{ |
| 198 | .llvm_name = "elpmx", | 198 | .llvm_name = "elpmx", |
| 199 | .description = "The device supports the `ELPM Rd, Z[+]` instructions", | 199 | .description = "The device supports the `ELPM Rd, Z[+]` instructions", |
| 200 | .dependencies = featureSet(&[_]Feature{}), | 200 | .dependencies = featureSet(&[_]Feature{}), |
| 201 | }; | 201 | }; |
| 202 | result[@intFromEnum(Feature.ijmpcall)] = .{ | 202 | result[@backingInt(Feature.ijmpcall)] = .{ |
| 203 | .llvm_name = "ijmpcall", | 203 | .llvm_name = "ijmpcall", |
| 204 | .description = "The device supports `IJMP`/`ICALL`instructions", | 204 | .description = "The device supports `IJMP`/`ICALL`instructions", |
| 205 | .dependencies = featureSet(&[_]Feature{}), | 205 | .dependencies = featureSet(&[_]Feature{}), |
| 206 | }; | 206 | }; |
| 207 | result[@intFromEnum(Feature.jmpcall)] = .{ | 207 | result[@backingInt(Feature.jmpcall)] = .{ |
| 208 | .llvm_name = "jmpcall", | 208 | .llvm_name = "jmpcall", |
| 209 | .description = "The device supports the `JMP` and `CALL` instructions", | 209 | .description = "The device supports the `JMP` and `CALL` instructions", |
| 210 | .dependencies = featureSet(&[_]Feature{}), | 210 | .dependencies = featureSet(&[_]Feature{}), |
| 211 | }; | 211 | }; |
| 212 | result[@intFromEnum(Feature.lowbytefirst)] = .{ | 212 | result[@backingInt(Feature.lowbytefirst)] = .{ |
| 213 | .llvm_name = "lowbytefirst", | 213 | .llvm_name = "lowbytefirst", |
| 214 | .description = "Do the low byte first when writing a 16-bit port or storing a 16-bit word", | 214 | .description = "Do the low byte first when writing a 16-bit port or storing a 16-bit word", |
| 215 | .dependencies = featureSet(&[_]Feature{}), | 215 | .dependencies = featureSet(&[_]Feature{}), |
| 216 | }; | 216 | }; |
| 217 | result[@intFromEnum(Feature.lpm)] = .{ | 217 | result[@backingInt(Feature.lpm)] = .{ |
| 218 | .llvm_name = "lpm", | 218 | .llvm_name = "lpm", |
| 219 | .description = "The device supports the `LPM` instruction", | 219 | .description = "The device supports the `LPM` instruction", |
| 220 | .dependencies = featureSet(&[_]Feature{}), | 220 | .dependencies = featureSet(&[_]Feature{}), |
| 221 | }; | 221 | }; |
| 222 | result[@intFromEnum(Feature.lpmx)] = .{ | 222 | result[@backingInt(Feature.lpmx)] = .{ |
| 223 | .llvm_name = "lpmx", | 223 | .llvm_name = "lpmx", |
| 224 | .description = "The device supports the `LPM Rd, Z[+]` instruction", | 224 | .description = "The device supports the `LPM Rd, Z[+]` instruction", |
| 225 | .dependencies = featureSet(&[_]Feature{}), | 225 | .dependencies = featureSet(&[_]Feature{}), |
| 226 | }; | 226 | }; |
| 227 | result[@intFromEnum(Feature.memmappedregs)] = .{ | 227 | result[@backingInt(Feature.memmappedregs)] = .{ |
| 228 | .llvm_name = "memmappedregs", | 228 | .llvm_name = "memmappedregs", |
| 229 | .description = "The device has CPU registers mapped in data address space", | 229 | .description = "The device has CPU registers mapped in data address space", |
| 230 | .dependencies = featureSet(&[_]Feature{}), | 230 | .dependencies = featureSet(&[_]Feature{}), |
| 231 | }; | 231 | }; |
| 232 | result[@intFromEnum(Feature.movw)] = .{ | 232 | result[@backingInt(Feature.movw)] = .{ |
| 233 | .llvm_name = "movw", | 233 | .llvm_name = "movw", |
| 234 | .description = "The device supports the 16-bit MOVW instruction", | 234 | .description = "The device supports the 16-bit MOVW instruction", |
| 235 | .dependencies = featureSet(&[_]Feature{}), | 235 | .dependencies = featureSet(&[_]Feature{}), |
| 236 | }; | 236 | }; |
| 237 | result[@intFromEnum(Feature.mul)] = .{ | 237 | result[@backingInt(Feature.mul)] = .{ |
| 238 | .llvm_name = "mul", | 238 | .llvm_name = "mul", |
| 239 | .description = "The device supports the multiplication instructions", | 239 | .description = "The device supports the multiplication instructions", |
| 240 | .dependencies = featureSet(&[_]Feature{}), | 240 | .dependencies = featureSet(&[_]Feature{}), |
| 241 | }; | 241 | }; |
| 242 | result[@intFromEnum(Feature.rmw)] = .{ | 242 | result[@backingInt(Feature.rmw)] = .{ |
| 243 | .llvm_name = "rmw", | 243 | .llvm_name = "rmw", |
| 244 | .description = "The device supports the read-write-modify instructions: XCH, LAS, LAC, LAT", | 244 | .description = "The device supports the read-write-modify instructions: XCH, LAS, LAC, LAT", |
| 245 | .dependencies = featureSet(&[_]Feature{}), | 245 | .dependencies = featureSet(&[_]Feature{}), |
| 246 | }; | 246 | }; |
| 247 | result[@intFromEnum(Feature.smallstack)] = .{ | 247 | result[@backingInt(Feature.smallstack)] = .{ |
| 248 | .llvm_name = "smallstack", | 248 | .llvm_name = "smallstack", |
| 249 | .description = "The device has an 8-bit stack pointer", | 249 | .description = "The device has an 8-bit stack pointer", |
| 250 | .dependencies = featureSet(&[_]Feature{}), | 250 | .dependencies = featureSet(&[_]Feature{}), |
| 251 | }; | 251 | }; |
| 252 | result[@intFromEnum(Feature.special)] = .{ | 252 | result[@backingInt(Feature.special)] = .{ |
| 253 | .llvm_name = "special", | 253 | .llvm_name = "special", |
| 254 | .description = "Enable use of the entire instruction set - used for debugging", | 254 | .description = "Enable use of the entire instruction set - used for debugging", |
| 255 | .dependencies = featureSet(&[_]Feature{ | 255 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -272,32 +272,32 @@ pub const all_features = blk: { | ... | @@ -272,32 +272,32 @@ pub const all_features = blk: { |
| 272 | .sram, | 272 | .sram, |
| 273 | }), | 273 | }), |
| 274 | }; | 274 | }; |
| 275 | result[@intFromEnum(Feature.spm)] = .{ | 275 | result[@backingInt(Feature.spm)] = .{ |
| 276 | .llvm_name = "spm", | 276 | .llvm_name = "spm", |
| 277 | .description = "The device supports the `SPM` instruction", | 277 | .description = "The device supports the `SPM` instruction", |
| 278 | .dependencies = featureSet(&[_]Feature{}), | 278 | .dependencies = featureSet(&[_]Feature{}), |
| 279 | }; | 279 | }; |
| 280 | result[@intFromEnum(Feature.spmx)] = .{ | 280 | result[@backingInt(Feature.spmx)] = .{ |
| 281 | .llvm_name = "spmx", | 281 | .llvm_name = "spmx", |
| 282 | .description = "The device supports the `SPM Z+` instruction", | 282 | .description = "The device supports the `SPM Z+` instruction", |
| 283 | .dependencies = featureSet(&[_]Feature{}), | 283 | .dependencies = featureSet(&[_]Feature{}), |
| 284 | }; | 284 | }; |
| 285 | result[@intFromEnum(Feature.sram)] = .{ | 285 | result[@backingInt(Feature.sram)] = .{ |
| 286 | .llvm_name = "sram", | 286 | .llvm_name = "sram", |
| 287 | .description = "The device has random access memory", | 287 | .description = "The device has random access memory", |
| 288 | .dependencies = featureSet(&[_]Feature{}), | 288 | .dependencies = featureSet(&[_]Feature{}), |
| 289 | }; | 289 | }; |
| 290 | result[@intFromEnum(Feature.tinyencoding)] = .{ | 290 | result[@backingInt(Feature.tinyencoding)] = .{ |
| 291 | .llvm_name = "tinyencoding", | 291 | .llvm_name = "tinyencoding", |
| 292 | .description = "The device has Tiny core specific instruction encodings", | 292 | .description = "The device has Tiny core specific instruction encodings", |
| 293 | .dependencies = featureSet(&[_]Feature{}), | 293 | .dependencies = featureSet(&[_]Feature{}), |
| 294 | }; | 294 | }; |
| 295 | result[@intFromEnum(Feature.wrappingrjmp)] = .{ | 295 | result[@backingInt(Feature.wrappingrjmp)] = .{ |
| 296 | .llvm_name = "wrappingrjmp", | 296 | .llvm_name = "wrappingrjmp", |
| 297 | .description = "The device potentially requires emitting rjmp that wraps across the flash boundary", | 297 | .description = "The device potentially requires emitting rjmp that wraps across the flash boundary", |
| 298 | .dependencies = featureSet(&[_]Feature{}), | 298 | .dependencies = featureSet(&[_]Feature{}), |
| 299 | }; | 299 | }; |
| 300 | result[@intFromEnum(Feature.xmega)] = .{ | 300 | result[@backingInt(Feature.xmega)] = .{ |
| 301 | .llvm_name = "xmega", | 301 | .llvm_name = "xmega", |
| 302 | .description = "The device is a part of the xmega family", | 302 | .description = "The device is a part of the xmega family", |
| 303 | .dependencies = featureSet(&[_]Feature{ | 303 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -320,7 +320,7 @@ pub const all_features = blk: { | ... | @@ -320,7 +320,7 @@ pub const all_features = blk: { |
| 320 | .sram, | 320 | .sram, |
| 321 | }), | 321 | }), |
| 322 | }; | 322 | }; |
| 323 | result[@intFromEnum(Feature.xmega2)] = .{ | 323 | result[@backingInt(Feature.xmega2)] = .{ |
| 324 | .llvm_name = "xmega2", | 324 | .llvm_name = "xmega2", |
| 325 | .description = "The device is a part of the xmega2 family", | 325 | .description = "The device is a part of the xmega2 family", |
| 326 | .dependencies = featureSet(&[_]Feature{ | 326 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -339,7 +339,7 @@ pub const all_features = blk: { | ... | @@ -339,7 +339,7 @@ pub const all_features = blk: { |
| 339 | .sram, | 339 | .sram, |
| 340 | }), | 340 | }), |
| 341 | }; | 341 | }; |
| 342 | result[@intFromEnum(Feature.xmega3)] = .{ | 342 | result[@backingInt(Feature.xmega3)] = .{ |
| 343 | .llvm_name = "xmega3", | 343 | .llvm_name = "xmega3", |
| 344 | .description = "The device is a part of the xmega3 family", | 344 | .description = "The device is a part of the xmega3 family", |
| 345 | .dependencies = featureSet(&[_]Feature{ | 345 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -356,7 +356,7 @@ pub const all_features = blk: { | ... | @@ -356,7 +356,7 @@ pub const all_features = blk: { |
| 356 | .sram, | 356 | .sram, |
| 357 | }), | 357 | }), |
| 358 | }; | 358 | }; |
| 359 | result[@intFromEnum(Feature.xmega4)] = .{ | 359 | result[@backingInt(Feature.xmega4)] = .{ |
| 360 | .llvm_name = "xmega4", | 360 | .llvm_name = "xmega4", |
| 361 | .description = "The device is a part of the xmega4 family", | 361 | .description = "The device is a part of the xmega4 family", |
| 362 | .dependencies = featureSet(&[_]Feature{ | 362 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -377,7 +377,7 @@ pub const all_features = blk: { | ... | @@ -377,7 +377,7 @@ pub const all_features = blk: { |
| 377 | .sram, | 377 | .sram, |
| 378 | }), | 378 | }), |
| 379 | }; | 379 | }; |
| 380 | result[@intFromEnum(Feature.xmegau)] = .{ | 380 | result[@backingInt(Feature.xmegau)] = .{ |
| 381 | .llvm_name = "xmegau", | 381 | .llvm_name = "xmegau", |
| 382 | .description = "The device is a part of the xmegau family", | 382 | .description = "The device is a part of the xmegau family", |
| 383 | .dependencies = featureSet(&[_]Feature{ | 383 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/bpf.zig+4-4| ... | @@ -20,22 +20,22 @@ pub const all_features = blk: { | ... | @@ -20,22 +20,22 @@ pub const all_features = blk: { |
| 20 | const len = @typeInfo(Feature).@"enum".field_names.len; | 20 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 21 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 21 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 22 | var result: [len]CpuFeature = undefined; | 22 | var result: [len]CpuFeature = undefined; |
| 23 | result[@intFromEnum(Feature.allows_misaligned_mem_access)] = .{ | 23 | result[@backingInt(Feature.allows_misaligned_mem_access)] = .{ |
| 24 | .llvm_name = "allows-misaligned-mem-access", | 24 | .llvm_name = "allows-misaligned-mem-access", |
| 25 | .description = "Allows misaligned memory access", | 25 | .description = "Allows misaligned memory access", |
| 26 | .dependencies = featureSet(&[_]Feature{}), | 26 | .dependencies = featureSet(&[_]Feature{}), |
| 27 | }; | 27 | }; |
| 28 | result[@intFromEnum(Feature.alu32)] = .{ | 28 | result[@backingInt(Feature.alu32)] = .{ |
| 29 | .llvm_name = "alu32", | 29 | .llvm_name = "alu32", |
| 30 | .description = "Enable ALU32 instructions", | 30 | .description = "Enable ALU32 instructions", |
| 31 | .dependencies = featureSet(&[_]Feature{}), | 31 | .dependencies = featureSet(&[_]Feature{}), |
| 32 | }; | 32 | }; |
| 33 | result[@intFromEnum(Feature.dummy)] = .{ | 33 | result[@backingInt(Feature.dummy)] = .{ |
| 34 | .llvm_name = "dummy", | 34 | .llvm_name = "dummy", |
| 35 | .description = "unused feature", | 35 | .description = "unused feature", |
| 36 | .dependencies = featureSet(&[_]Feature{}), | 36 | .dependencies = featureSet(&[_]Feature{}), |
| 37 | }; | 37 | }; |
| 38 | result[@intFromEnum(Feature.dwarfris)] = .{ | 38 | result[@backingInt(Feature.dwarfris)] = .{ |
| 39 | .llvm_name = "dwarfris", | 39 | .llvm_name = "dwarfris", |
| 40 | .description = "Disable MCAsmInfo DwarfUsesRelocationsAcrossSections", | 40 | .description = "Disable MCAsmInfo DwarfUsesRelocationsAcrossSections", |
| 41 | .dependencies = featureSet(&[_]Feature{}), | 41 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/csky.zig+63-63| ... | @@ -79,26 +79,26 @@ pub const all_features = blk: { | ... | @@ -79,26 +79,26 @@ pub const all_features = blk: { |
| 79 | const len = @typeInfo(Feature).@"enum".field_names.len; | 79 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 80 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 80 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 81 | var result: [len]CpuFeature = undefined; | 81 | var result: [len]CpuFeature = undefined; |
| 82 | result[@intFromEnum(Feature.@"10e60")] = .{ | 82 | result[@backingInt(Feature.@"10e60")] = .{ |
| 83 | .llvm_name = "10e60", | 83 | .llvm_name = "10e60", |
| 84 | .description = "Support CSKY 10e60 instructions", | 84 | .description = "Support CSKY 10e60 instructions", |
| 85 | .dependencies = featureSet(&[_]Feature{ | 85 | .dependencies = featureSet(&[_]Feature{ |
| 86 | .@"7e10", | 86 | .@"7e10", |
| 87 | }), | 87 | }), |
| 88 | }; | 88 | }; |
| 89 | result[@intFromEnum(Feature.@"2e3")] = .{ | 89 | result[@backingInt(Feature.@"2e3")] = .{ |
| 90 | .llvm_name = "2e3", | 90 | .llvm_name = "2e3", |
| 91 | .description = "Support CSKY 2e3 instructions", | 91 | .description = "Support CSKY 2e3 instructions", |
| 92 | .dependencies = featureSet(&[_]Feature{ | 92 | .dependencies = featureSet(&[_]Feature{ |
| 93 | .e2, | 93 | .e2, |
| 94 | }), | 94 | }), |
| 95 | }; | 95 | }; |
| 96 | result[@intFromEnum(Feature.@"3e3r1")] = .{ | 96 | result[@backingInt(Feature.@"3e3r1")] = .{ |
| 97 | .llvm_name = "3e3r1", | 97 | .llvm_name = "3e3r1", |
| 98 | .description = "Support CSKY 3e3r1 instructions", | 98 | .description = "Support CSKY 3e3r1 instructions", |
| 99 | .dependencies = featureSet(&[_]Feature{}), | 99 | .dependencies = featureSet(&[_]Feature{}), |
| 100 | }; | 100 | }; |
| 101 | result[@intFromEnum(Feature.@"3e3r2")] = .{ | 101 | result[@backingInt(Feature.@"3e3r2")] = .{ |
| 102 | .llvm_name = "3e3r2", | 102 | .llvm_name = "3e3r2", |
| 103 | .description = "Support CSKY 3e3r2 instructions", | 103 | .description = "Support CSKY 3e3r2 instructions", |
| 104 | .dependencies = featureSet(&[_]Feature{ | 104 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -106,311 +106,311 @@ pub const all_features = blk: { | ... | @@ -106,311 +106,311 @@ pub const all_features = blk: { |
| 106 | .doloop, | 106 | .doloop, |
| 107 | }), | 107 | }), |
| 108 | }; | 108 | }; |
| 109 | result[@intFromEnum(Feature.@"3e3r3")] = .{ | 109 | result[@backingInt(Feature.@"3e3r3")] = .{ |
| 110 | .llvm_name = "3e3r3", | 110 | .llvm_name = "3e3r3", |
| 111 | .description = "Support CSKY 3e3r3 instructions", | 111 | .description = "Support CSKY 3e3r3 instructions", |
| 112 | .dependencies = featureSet(&[_]Feature{ | 112 | .dependencies = featureSet(&[_]Feature{ |
| 113 | .doloop, | 113 | .doloop, |
| 114 | }), | 114 | }), |
| 115 | }; | 115 | }; |
| 116 | result[@intFromEnum(Feature.@"3e7")] = .{ | 116 | result[@backingInt(Feature.@"3e7")] = .{ |
| 117 | .llvm_name = "3e7", | 117 | .llvm_name = "3e7", |
| 118 | .description = "Support CSKY 3e7 instructions", | 118 | .description = "Support CSKY 3e7 instructions", |
| 119 | .dependencies = featureSet(&[_]Feature{ | 119 | .dependencies = featureSet(&[_]Feature{ |
| 120 | .@"2e3", | 120 | .@"2e3", |
| 121 | }), | 121 | }), |
| 122 | }; | 122 | }; |
| 123 | result[@intFromEnum(Feature.@"7e10")] = .{ | 123 | result[@backingInt(Feature.@"7e10")] = .{ |
| 124 | .llvm_name = "7e10", | 124 | .llvm_name = "7e10", |
| 125 | .description = "Support CSKY 7e10 instructions", | 125 | .description = "Support CSKY 7e10 instructions", |
| 126 | .dependencies = featureSet(&[_]Feature{ | 126 | .dependencies = featureSet(&[_]Feature{ |
| 127 | .@"3e7", | 127 | .@"3e7", |
| 128 | }), | 128 | }), |
| 129 | }; | 129 | }; |
| 130 | result[@intFromEnum(Feature.btst16)] = .{ | 130 | result[@backingInt(Feature.btst16)] = .{ |
| 131 | .llvm_name = "btst16", | 131 | .llvm_name = "btst16", |
| 132 | .description = "Use the 16-bit btsti instruction", | 132 | .description = "Use the 16-bit btsti instruction", |
| 133 | .dependencies = featureSet(&[_]Feature{}), | 133 | .dependencies = featureSet(&[_]Feature{}), |
| 134 | }; | 134 | }; |
| 135 | result[@intFromEnum(Feature.cache)] = .{ | 135 | result[@backingInt(Feature.cache)] = .{ |
| 136 | .llvm_name = "cache", | 136 | .llvm_name = "cache", |
| 137 | .description = "Enable cache", | 137 | .description = "Enable cache", |
| 138 | .dependencies = featureSet(&[_]Feature{}), | 138 | .dependencies = featureSet(&[_]Feature{}), |
| 139 | }; | 139 | }; |
| 140 | result[@intFromEnum(Feature.ccrt)] = .{ | 140 | result[@backingInt(Feature.ccrt)] = .{ |
| 141 | .llvm_name = "ccrt", | 141 | .llvm_name = "ccrt", |
| 142 | .description = "Use CSKY compiler runtime", | 142 | .description = "Use CSKY compiler runtime", |
| 143 | .dependencies = featureSet(&[_]Feature{}), | 143 | .dependencies = featureSet(&[_]Feature{}), |
| 144 | }; | 144 | }; |
| 145 | result[@intFromEnum(Feature.ck801)] = .{ | 145 | result[@backingInt(Feature.ck801)] = .{ |
| 146 | .llvm_name = "ck801", | 146 | .llvm_name = "ck801", |
| 147 | .description = "CSKY ck801 processors", | 147 | .description = "CSKY ck801 processors", |
| 148 | .dependencies = featureSet(&[_]Feature{}), | 148 | .dependencies = featureSet(&[_]Feature{}), |
| 149 | }; | 149 | }; |
| 150 | result[@intFromEnum(Feature.ck802)] = .{ | 150 | result[@backingInt(Feature.ck802)] = .{ |
| 151 | .llvm_name = "ck802", | 151 | .llvm_name = "ck802", |
| 152 | .description = "CSKY ck802 processors", | 152 | .description = "CSKY ck802 processors", |
| 153 | .dependencies = featureSet(&[_]Feature{}), | 153 | .dependencies = featureSet(&[_]Feature{}), |
| 154 | }; | 154 | }; |
| 155 | result[@intFromEnum(Feature.ck803)] = .{ | 155 | result[@backingInt(Feature.ck803)] = .{ |
| 156 | .llvm_name = "ck803", | 156 | .llvm_name = "ck803", |
| 157 | .description = "CSKY ck803 processors", | 157 | .description = "CSKY ck803 processors", |
| 158 | .dependencies = featureSet(&[_]Feature{}), | 158 | .dependencies = featureSet(&[_]Feature{}), |
| 159 | }; | 159 | }; |
| 160 | result[@intFromEnum(Feature.ck803s)] = .{ | 160 | result[@backingInt(Feature.ck803s)] = .{ |
| 161 | .llvm_name = "ck803s", | 161 | .llvm_name = "ck803s", |
| 162 | .description = "CSKY ck803s processors", | 162 | .description = "CSKY ck803s processors", |
| 163 | .dependencies = featureSet(&[_]Feature{}), | 163 | .dependencies = featureSet(&[_]Feature{}), |
| 164 | }; | 164 | }; |
| 165 | result[@intFromEnum(Feature.ck804)] = .{ | 165 | result[@backingInt(Feature.ck804)] = .{ |
| 166 | .llvm_name = "ck804", | 166 | .llvm_name = "ck804", |
| 167 | .description = "CSKY ck804 processors", | 167 | .description = "CSKY ck804 processors", |
| 168 | .dependencies = featureSet(&[_]Feature{}), | 168 | .dependencies = featureSet(&[_]Feature{}), |
| 169 | }; | 169 | }; |
| 170 | result[@intFromEnum(Feature.ck805)] = .{ | 170 | result[@backingInt(Feature.ck805)] = .{ |
| 171 | .llvm_name = "ck805", | 171 | .llvm_name = "ck805", |
| 172 | .description = "CSKY ck805 processors", | 172 | .description = "CSKY ck805 processors", |
| 173 | .dependencies = featureSet(&[_]Feature{}), | 173 | .dependencies = featureSet(&[_]Feature{}), |
| 174 | }; | 174 | }; |
| 175 | result[@intFromEnum(Feature.ck807)] = .{ | 175 | result[@backingInt(Feature.ck807)] = .{ |
| 176 | .llvm_name = "ck807", | 176 | .llvm_name = "ck807", |
| 177 | .description = "CSKY ck807 processors", | 177 | .description = "CSKY ck807 processors", |
| 178 | .dependencies = featureSet(&[_]Feature{}), | 178 | .dependencies = featureSet(&[_]Feature{}), |
| 179 | }; | 179 | }; |
| 180 | result[@intFromEnum(Feature.ck810)] = .{ | 180 | result[@backingInt(Feature.ck810)] = .{ |
| 181 | .llvm_name = "ck810", | 181 | .llvm_name = "ck810", |
| 182 | .description = "CSKY ck810 processors", | 182 | .description = "CSKY ck810 processors", |
| 183 | .dependencies = featureSet(&[_]Feature{}), | 183 | .dependencies = featureSet(&[_]Feature{}), |
| 184 | }; | 184 | }; |
| 185 | result[@intFromEnum(Feature.ck810v)] = .{ | 185 | result[@backingInt(Feature.ck810v)] = .{ |
| 186 | .llvm_name = "ck810v", | 186 | .llvm_name = "ck810v", |
| 187 | .description = "CSKY ck810v processors", | 187 | .description = "CSKY ck810v processors", |
| 188 | .dependencies = featureSet(&[_]Feature{}), | 188 | .dependencies = featureSet(&[_]Feature{}), |
| 189 | }; | 189 | }; |
| 190 | result[@intFromEnum(Feature.ck860)] = .{ | 190 | result[@backingInt(Feature.ck860)] = .{ |
| 191 | .llvm_name = "ck860", | 191 | .llvm_name = "ck860", |
| 192 | .description = "CSKY ck860 processors", | 192 | .description = "CSKY ck860 processors", |
| 193 | .dependencies = featureSet(&[_]Feature{}), | 193 | .dependencies = featureSet(&[_]Feature{}), |
| 194 | }; | 194 | }; |
| 195 | result[@intFromEnum(Feature.ck860v)] = .{ | 195 | result[@backingInt(Feature.ck860v)] = .{ |
| 196 | .llvm_name = "ck860v", | 196 | .llvm_name = "ck860v", |
| 197 | .description = "CSKY ck860v processors", | 197 | .description = "CSKY ck860v processors", |
| 198 | .dependencies = featureSet(&[_]Feature{}), | 198 | .dependencies = featureSet(&[_]Feature{}), |
| 199 | }; | 199 | }; |
| 200 | result[@intFromEnum(Feature.constpool)] = .{ | 200 | result[@backingInt(Feature.constpool)] = .{ |
| 201 | .llvm_name = "constpool", | 201 | .llvm_name = "constpool", |
| 202 | .description = "Dump the constant pool by compiler", | 202 | .description = "Dump the constant pool by compiler", |
| 203 | .dependencies = featureSet(&[_]Feature{}), | 203 | .dependencies = featureSet(&[_]Feature{}), |
| 204 | }; | 204 | }; |
| 205 | result[@intFromEnum(Feature.doloop)] = .{ | 205 | result[@backingInt(Feature.doloop)] = .{ |
| 206 | .llvm_name = "doloop", | 206 | .llvm_name = "doloop", |
| 207 | .description = "Enable doloop instructions", | 207 | .description = "Enable doloop instructions", |
| 208 | .dependencies = featureSet(&[_]Feature{}), | 208 | .dependencies = featureSet(&[_]Feature{}), |
| 209 | }; | 209 | }; |
| 210 | result[@intFromEnum(Feature.dsp1e2)] = .{ | 210 | result[@backingInt(Feature.dsp1e2)] = .{ |
| 211 | .llvm_name = "dsp1e2", | 211 | .llvm_name = "dsp1e2", |
| 212 | .description = "Support CSKY dsp1e2 instructions", | 212 | .description = "Support CSKY dsp1e2 instructions", |
| 213 | .dependencies = featureSet(&[_]Feature{}), | 213 | .dependencies = featureSet(&[_]Feature{}), |
| 214 | }; | 214 | }; |
| 215 | result[@intFromEnum(Feature.dsp_silan)] = .{ | 215 | result[@backingInt(Feature.dsp_silan)] = .{ |
| 216 | .llvm_name = "dsp_silan", | 216 | .llvm_name = "dsp_silan", |
| 217 | .description = "Enable DSP Silan instructions", | 217 | .description = "Enable DSP Silan instructions", |
| 218 | .dependencies = featureSet(&[_]Feature{}), | 218 | .dependencies = featureSet(&[_]Feature{}), |
| 219 | }; | 219 | }; |
| 220 | result[@intFromEnum(Feature.dspe60)] = .{ | 220 | result[@backingInt(Feature.dspe60)] = .{ |
| 221 | .llvm_name = "dspe60", | 221 | .llvm_name = "dspe60", |
| 222 | .description = "Support CSKY dspe60 instructions", | 222 | .description = "Support CSKY dspe60 instructions", |
| 223 | .dependencies = featureSet(&[_]Feature{}), | 223 | .dependencies = featureSet(&[_]Feature{}), |
| 224 | }; | 224 | }; |
| 225 | result[@intFromEnum(Feature.dspv2)] = .{ | 225 | result[@backingInt(Feature.dspv2)] = .{ |
| 226 | .llvm_name = "dspv2", | 226 | .llvm_name = "dspv2", |
| 227 | .description = "Enable DSP V2.0 instructions", | 227 | .description = "Enable DSP V2.0 instructions", |
| 228 | .dependencies = featureSet(&[_]Feature{}), | 228 | .dependencies = featureSet(&[_]Feature{}), |
| 229 | }; | 229 | }; |
| 230 | result[@intFromEnum(Feature.e1)] = .{ | 230 | result[@backingInt(Feature.e1)] = .{ |
| 231 | .llvm_name = "e1", | 231 | .llvm_name = "e1", |
| 232 | .description = "Support CSKY e1 instructions", | 232 | .description = "Support CSKY e1 instructions", |
| 233 | .dependencies = featureSet(&[_]Feature{ | 233 | .dependencies = featureSet(&[_]Feature{ |
| 234 | .elrw, | 234 | .elrw, |
| 235 | }), | 235 | }), |
| 236 | }; | 236 | }; |
| 237 | result[@intFromEnum(Feature.e2)] = .{ | 237 | result[@backingInt(Feature.e2)] = .{ |
| 238 | .llvm_name = "e2", | 238 | .llvm_name = "e2", |
| 239 | .description = "Support CSKY e2 instructions", | 239 | .description = "Support CSKY e2 instructions", |
| 240 | .dependencies = featureSet(&[_]Feature{ | 240 | .dependencies = featureSet(&[_]Feature{ |
| 241 | .e1, | 241 | .e1, |
| 242 | }), | 242 | }), |
| 243 | }; | 243 | }; |
| 244 | result[@intFromEnum(Feature.edsp)] = .{ | 244 | result[@backingInt(Feature.edsp)] = .{ |
| 245 | .llvm_name = "edsp", | 245 | .llvm_name = "edsp", |
| 246 | .description = "Enable DSP instructions", | 246 | .description = "Enable DSP instructions", |
| 247 | .dependencies = featureSet(&[_]Feature{}), | 247 | .dependencies = featureSet(&[_]Feature{}), |
| 248 | }; | 248 | }; |
| 249 | result[@intFromEnum(Feature.elrw)] = .{ | 249 | result[@backingInt(Feature.elrw)] = .{ |
| 250 | .llvm_name = "elrw", | 250 | .llvm_name = "elrw", |
| 251 | .description = "Use the extend LRW instruction", | 251 | .description = "Use the extend LRW instruction", |
| 252 | .dependencies = featureSet(&[_]Feature{}), | 252 | .dependencies = featureSet(&[_]Feature{}), |
| 253 | }; | 253 | }; |
| 254 | result[@intFromEnum(Feature.fdivdu)] = .{ | 254 | result[@backingInt(Feature.fdivdu)] = .{ |
| 255 | .llvm_name = "fdivdu", | 255 | .llvm_name = "fdivdu", |
| 256 | .description = "Enable float divide instructions", | 256 | .description = "Enable float divide instructions", |
| 257 | .dependencies = featureSet(&[_]Feature{}), | 257 | .dependencies = featureSet(&[_]Feature{}), |
| 258 | }; | 258 | }; |
| 259 | result[@intFromEnum(Feature.float1e2)] = .{ | 259 | result[@backingInt(Feature.float1e2)] = .{ |
| 260 | .llvm_name = "float1e2", | 260 | .llvm_name = "float1e2", |
| 261 | .description = "Support CSKY float1e2 instructions", | 261 | .description = "Support CSKY float1e2 instructions", |
| 262 | .dependencies = featureSet(&[_]Feature{}), | 262 | .dependencies = featureSet(&[_]Feature{}), |
| 263 | }; | 263 | }; |
| 264 | result[@intFromEnum(Feature.float1e3)] = .{ | 264 | result[@backingInt(Feature.float1e3)] = .{ |
| 265 | .llvm_name = "float1e3", | 265 | .llvm_name = "float1e3", |
| 266 | .description = "Support CSKY float1e3 instructions", | 266 | .description = "Support CSKY float1e3 instructions", |
| 267 | .dependencies = featureSet(&[_]Feature{}), | 267 | .dependencies = featureSet(&[_]Feature{}), |
| 268 | }; | 268 | }; |
| 269 | result[@intFromEnum(Feature.float3e4)] = .{ | 269 | result[@backingInt(Feature.float3e4)] = .{ |
| 270 | .llvm_name = "float3e4", | 270 | .llvm_name = "float3e4", |
| 271 | .description = "Support CSKY float3e4 instructions", | 271 | .description = "Support CSKY float3e4 instructions", |
| 272 | .dependencies = featureSet(&[_]Feature{}), | 272 | .dependencies = featureSet(&[_]Feature{}), |
| 273 | }; | 273 | }; |
| 274 | result[@intFromEnum(Feature.float7e60)] = .{ | 274 | result[@backingInt(Feature.float7e60)] = .{ |
| 275 | .llvm_name = "float7e60", | 275 | .llvm_name = "float7e60", |
| 276 | .description = "Support CSKY float7e60 instructions", | 276 | .description = "Support CSKY float7e60 instructions", |
| 277 | .dependencies = featureSet(&[_]Feature{}), | 277 | .dependencies = featureSet(&[_]Feature{}), |
| 278 | }; | 278 | }; |
| 279 | result[@intFromEnum(Feature.floate1)] = .{ | 279 | result[@backingInt(Feature.floate1)] = .{ |
| 280 | .llvm_name = "floate1", | 280 | .llvm_name = "floate1", |
| 281 | .description = "Support CSKY floate1 instructions", | 281 | .description = "Support CSKY floate1 instructions", |
| 282 | .dependencies = featureSet(&[_]Feature{}), | 282 | .dependencies = featureSet(&[_]Feature{}), |
| 283 | }; | 283 | }; |
| 284 | result[@intFromEnum(Feature.fpuv2_df)] = .{ | 284 | result[@backingInt(Feature.fpuv2_df)] = .{ |
| 285 | .llvm_name = "fpuv2_df", | 285 | .llvm_name = "fpuv2_df", |
| 286 | .description = "Enable FPUv2 double float instructions", | 286 | .description = "Enable FPUv2 double float instructions", |
| 287 | .dependencies = featureSet(&[_]Feature{}), | 287 | .dependencies = featureSet(&[_]Feature{}), |
| 288 | }; | 288 | }; |
| 289 | result[@intFromEnum(Feature.fpuv2_sf)] = .{ | 289 | result[@backingInt(Feature.fpuv2_sf)] = .{ |
| 290 | .llvm_name = "fpuv2_sf", | 290 | .llvm_name = "fpuv2_sf", |
| 291 | .description = "Enable FPUv2 single float instructions", | 291 | .description = "Enable FPUv2 single float instructions", |
| 292 | .dependencies = featureSet(&[_]Feature{}), | 292 | .dependencies = featureSet(&[_]Feature{}), |
| 293 | }; | 293 | }; |
| 294 | result[@intFromEnum(Feature.fpuv3_df)] = .{ | 294 | result[@backingInt(Feature.fpuv3_df)] = .{ |
| 295 | .llvm_name = "fpuv3_df", | 295 | .llvm_name = "fpuv3_df", |
| 296 | .description = "Enable FPUv3 double float instructions", | 296 | .description = "Enable FPUv3 double float instructions", |
| 297 | .dependencies = featureSet(&[_]Feature{}), | 297 | .dependencies = featureSet(&[_]Feature{}), |
| 298 | }; | 298 | }; |
| 299 | result[@intFromEnum(Feature.fpuv3_hf)] = .{ | 299 | result[@backingInt(Feature.fpuv3_hf)] = .{ |
| 300 | .llvm_name = "fpuv3_hf", | 300 | .llvm_name = "fpuv3_hf", |
| 301 | .description = "Enable FPUv3 half precision operate instructions", | 301 | .description = "Enable FPUv3 half precision operate instructions", |
| 302 | .dependencies = featureSet(&[_]Feature{}), | 302 | .dependencies = featureSet(&[_]Feature{}), |
| 303 | }; | 303 | }; |
| 304 | result[@intFromEnum(Feature.fpuv3_hi)] = .{ | 304 | result[@backingInt(Feature.fpuv3_hi)] = .{ |
| 305 | .llvm_name = "fpuv3_hi", | 305 | .llvm_name = "fpuv3_hi", |
| 306 | .description = "Enable FPUv3 half word converting instructions", | 306 | .description = "Enable FPUv3 half word converting instructions", |
| 307 | .dependencies = featureSet(&[_]Feature{}), | 307 | .dependencies = featureSet(&[_]Feature{}), |
| 308 | }; | 308 | }; |
| 309 | result[@intFromEnum(Feature.fpuv3_sf)] = .{ | 309 | result[@backingInt(Feature.fpuv3_sf)] = .{ |
| 310 | .llvm_name = "fpuv3_sf", | 310 | .llvm_name = "fpuv3_sf", |
| 311 | .description = "Enable FPUv3 single float instructions", | 311 | .description = "Enable FPUv3 single float instructions", |
| 312 | .dependencies = featureSet(&[_]Feature{}), | 312 | .dependencies = featureSet(&[_]Feature{}), |
| 313 | }; | 313 | }; |
| 314 | result[@intFromEnum(Feature.hard_float)] = .{ | 314 | result[@backingInt(Feature.hard_float)] = .{ |
| 315 | .llvm_name = "hard-float", | 315 | .llvm_name = "hard-float", |
| 316 | .description = "Use hard floating point features", | 316 | .description = "Use hard floating point features", |
| 317 | .dependencies = featureSet(&[_]Feature{}), | 317 | .dependencies = featureSet(&[_]Feature{}), |
| 318 | }; | 318 | }; |
| 319 | result[@intFromEnum(Feature.hard_float_abi)] = .{ | 319 | result[@backingInt(Feature.hard_float_abi)] = .{ |
| 320 | .llvm_name = "hard-float-abi", | 320 | .llvm_name = "hard-float-abi", |
| 321 | .description = "Use hard floating point ABI to pass args", | 321 | .description = "Use hard floating point ABI to pass args", |
| 322 | .dependencies = featureSet(&[_]Feature{}), | 322 | .dependencies = featureSet(&[_]Feature{}), |
| 323 | }; | 323 | }; |
| 324 | result[@intFromEnum(Feature.hard_tp)] = .{ | 324 | result[@backingInt(Feature.hard_tp)] = .{ |
| 325 | .llvm_name = "hard-tp", | 325 | .llvm_name = "hard-tp", |
| 326 | .description = "Enable TLS Pointer register", | 326 | .description = "Enable TLS Pointer register", |
| 327 | .dependencies = featureSet(&[_]Feature{}), | 327 | .dependencies = featureSet(&[_]Feature{}), |
| 328 | }; | 328 | }; |
| 329 | result[@intFromEnum(Feature.high_registers)] = .{ | 329 | result[@backingInt(Feature.high_registers)] = .{ |
| 330 | .llvm_name = "high-registers", | 330 | .llvm_name = "high-registers", |
| 331 | .description = "Enable r16-r31 registers", | 331 | .description = "Enable r16-r31 registers", |
| 332 | .dependencies = featureSet(&[_]Feature{}), | 332 | .dependencies = featureSet(&[_]Feature{}), |
| 333 | }; | 333 | }; |
| 334 | result[@intFromEnum(Feature.hwdiv)] = .{ | 334 | result[@backingInt(Feature.hwdiv)] = .{ |
| 335 | .llvm_name = "hwdiv", | 335 | .llvm_name = "hwdiv", |
| 336 | .description = "Enable divide instructions", | 336 | .description = "Enable divide instructions", |
| 337 | .dependencies = featureSet(&[_]Feature{}), | 337 | .dependencies = featureSet(&[_]Feature{}), |
| 338 | }; | 338 | }; |
| 339 | result[@intFromEnum(Feature.istack)] = .{ | 339 | result[@backingInt(Feature.istack)] = .{ |
| 340 | .llvm_name = "istack", | 340 | .llvm_name = "istack", |
| 341 | .description = "Enable interrupt attribute", | 341 | .description = "Enable interrupt attribute", |
| 342 | .dependencies = featureSet(&[_]Feature{}), | 342 | .dependencies = featureSet(&[_]Feature{}), |
| 343 | }; | 343 | }; |
| 344 | result[@intFromEnum(Feature.java)] = .{ | 344 | result[@backingInt(Feature.java)] = .{ |
| 345 | .llvm_name = "java", | 345 | .llvm_name = "java", |
| 346 | .description = "Enable java instructions", | 346 | .description = "Enable java instructions", |
| 347 | .dependencies = featureSet(&[_]Feature{}), | 347 | .dependencies = featureSet(&[_]Feature{}), |
| 348 | }; | 348 | }; |
| 349 | result[@intFromEnum(Feature.mp)] = .{ | 349 | result[@backingInt(Feature.mp)] = .{ |
| 350 | .llvm_name = "mp", | 350 | .llvm_name = "mp", |
| 351 | .description = "Support CSKY mp instructions", | 351 | .description = "Support CSKY mp instructions", |
| 352 | .dependencies = featureSet(&[_]Feature{ | 352 | .dependencies = featureSet(&[_]Feature{ |
| 353 | .@"2e3", | 353 | .@"2e3", |
| 354 | }), | 354 | }), |
| 355 | }; | 355 | }; |
| 356 | result[@intFromEnum(Feature.mp1e2)] = .{ | 356 | result[@backingInt(Feature.mp1e2)] = .{ |
| 357 | .llvm_name = "mp1e2", | 357 | .llvm_name = "mp1e2", |
| 358 | .description = "Support CSKY mp1e2 instructions", | 358 | .description = "Support CSKY mp1e2 instructions", |
| 359 | .dependencies = featureSet(&[_]Feature{ | 359 | .dependencies = featureSet(&[_]Feature{ |
| 360 | .@"3e7", | 360 | .@"3e7", |
| 361 | }), | 361 | }), |
| 362 | }; | 362 | }; |
| 363 | result[@intFromEnum(Feature.multiple_stld)] = .{ | 363 | result[@backingInt(Feature.multiple_stld)] = .{ |
| 364 | .llvm_name = "multiple_stld", | 364 | .llvm_name = "multiple_stld", |
| 365 | .description = "Enable multiple load/store instructions", | 365 | .description = "Enable multiple load/store instructions", |
| 366 | .dependencies = featureSet(&[_]Feature{}), | 366 | .dependencies = featureSet(&[_]Feature{}), |
| 367 | }; | 367 | }; |
| 368 | result[@intFromEnum(Feature.nvic)] = .{ | 368 | result[@backingInt(Feature.nvic)] = .{ |
| 369 | .llvm_name = "nvic", | 369 | .llvm_name = "nvic", |
| 370 | .description = "Enable NVIC", | 370 | .description = "Enable NVIC", |
| 371 | .dependencies = featureSet(&[_]Feature{}), | 371 | .dependencies = featureSet(&[_]Feature{}), |
| 372 | }; | 372 | }; |
| 373 | result[@intFromEnum(Feature.pushpop)] = .{ | 373 | result[@backingInt(Feature.pushpop)] = .{ |
| 374 | .llvm_name = "pushpop", | 374 | .llvm_name = "pushpop", |
| 375 | .description = "Enable push/pop instructions", | 375 | .description = "Enable push/pop instructions", |
| 376 | .dependencies = featureSet(&[_]Feature{}), | 376 | .dependencies = featureSet(&[_]Feature{}), |
| 377 | }; | 377 | }; |
| 378 | result[@intFromEnum(Feature.smart)] = .{ | 378 | result[@backingInt(Feature.smart)] = .{ |
| 379 | .llvm_name = "smart", | 379 | .llvm_name = "smart", |
| 380 | .description = "Let CPU work in Smart Mode", | 380 | .description = "Let CPU work in Smart Mode", |
| 381 | .dependencies = featureSet(&[_]Feature{}), | 381 | .dependencies = featureSet(&[_]Feature{}), |
| 382 | }; | 382 | }; |
| 383 | result[@intFromEnum(Feature.soft_tp)] = .{ | 383 | result[@backingInt(Feature.soft_tp)] = .{ |
| 384 | .llvm_name = "soft-tp", | 384 | .llvm_name = "soft-tp", |
| 385 | .description = "Disable TLS Pointer register", | 385 | .description = "Disable TLS Pointer register", |
| 386 | .dependencies = featureSet(&[_]Feature{}), | 386 | .dependencies = featureSet(&[_]Feature{}), |
| 387 | }; | 387 | }; |
| 388 | result[@intFromEnum(Feature.stack_size)] = .{ | 388 | result[@backingInt(Feature.stack_size)] = .{ |
| 389 | .llvm_name = "stack-size", | 389 | .llvm_name = "stack-size", |
| 390 | .description = "Output stack size information", | 390 | .description = "Output stack size information", |
| 391 | .dependencies = featureSet(&[_]Feature{}), | 391 | .dependencies = featureSet(&[_]Feature{}), |
| 392 | }; | 392 | }; |
| 393 | result[@intFromEnum(Feature.trust)] = .{ | 393 | result[@backingInt(Feature.trust)] = .{ |
| 394 | .llvm_name = "trust", | 394 | .llvm_name = "trust", |
| 395 | .description = "Enable trust instructions", | 395 | .description = "Enable trust instructions", |
| 396 | .dependencies = featureSet(&[_]Feature{}), | 396 | .dependencies = featureSet(&[_]Feature{}), |
| 397 | }; | 397 | }; |
| 398 | result[@intFromEnum(Feature.vdsp2e3)] = .{ | 398 | result[@backingInt(Feature.vdsp2e3)] = .{ |
| 399 | .llvm_name = "vdsp2e3", | 399 | .llvm_name = "vdsp2e3", |
| 400 | .description = "Support CSKY vdsp2e3 instructions", | 400 | .description = "Support CSKY vdsp2e3 instructions", |
| 401 | .dependencies = featureSet(&[_]Feature{}), | 401 | .dependencies = featureSet(&[_]Feature{}), |
| 402 | }; | 402 | }; |
| 403 | result[@intFromEnum(Feature.vdsp2e60f)] = .{ | 403 | result[@backingInt(Feature.vdsp2e60f)] = .{ |
| 404 | .llvm_name = "vdsp2e60f", | 404 | .llvm_name = "vdsp2e60f", |
| 405 | .description = "Support CSKY vdsp2e60f instructions", | 405 | .description = "Support CSKY vdsp2e60f instructions", |
| 406 | .dependencies = featureSet(&[_]Feature{}), | 406 | .dependencies = featureSet(&[_]Feature{}), |
| 407 | }; | 407 | }; |
| 408 | result[@intFromEnum(Feature.vdspv1)] = .{ | 408 | result[@backingInt(Feature.vdspv1)] = .{ |
| 409 | .llvm_name = "vdspv1", | 409 | .llvm_name = "vdspv1", |
| 410 | .description = "Enable 128bit vdsp-v1 instructions", | 410 | .description = "Enable 128bit vdsp-v1 instructions", |
| 411 | .dependencies = featureSet(&[_]Feature{}), | 411 | .dependencies = featureSet(&[_]Feature{}), |
| 412 | }; | 412 | }; |
| 413 | result[@intFromEnum(Feature.vdspv2)] = .{ | 413 | result[@backingInt(Feature.vdspv2)] = .{ |
| 414 | .llvm_name = "vdspv2", | 414 | .llvm_name = "vdspv2", |
| 415 | .description = "Enable vdsp-v2 instructions", | 415 | .description = "Enable vdsp-v2 instructions", |
| 416 | .dependencies = featureSet(&[_]Feature{}), | 416 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/hexagon.zig+47-47| ... | @@ -63,77 +63,77 @@ pub const all_features = blk: { | ... | @@ -63,77 +63,77 @@ pub const all_features = blk: { |
| 63 | const len = @typeInfo(Feature).@"enum".field_names.len; | 63 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 64 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 64 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 65 | var result: [len]CpuFeature = undefined; | 65 | var result: [len]CpuFeature = undefined; |
| 66 | result[@intFromEnum(Feature.audio)] = .{ | 66 | result[@backingInt(Feature.audio)] = .{ |
| 67 | .llvm_name = "audio", | 67 | .llvm_name = "audio", |
| 68 | .description = "Hexagon Audio extension instructions", | 68 | .description = "Hexagon Audio extension instructions", |
| 69 | .dependencies = featureSet(&[_]Feature{}), | 69 | .dependencies = featureSet(&[_]Feature{}), |
| 70 | }; | 70 | }; |
| 71 | result[@intFromEnum(Feature.cabac)] = .{ | 71 | result[@backingInt(Feature.cabac)] = .{ |
| 72 | .llvm_name = "cabac", | 72 | .llvm_name = "cabac", |
| 73 | .description = "Emit the CABAC instruction", | 73 | .description = "Emit the CABAC instruction", |
| 74 | .dependencies = featureSet(&[_]Feature{}), | 74 | .dependencies = featureSet(&[_]Feature{}), |
| 75 | }; | 75 | }; |
| 76 | result[@intFromEnum(Feature.compound)] = .{ | 76 | result[@backingInt(Feature.compound)] = .{ |
| 77 | .llvm_name = "compound", | 77 | .llvm_name = "compound", |
| 78 | .description = "Use compound instructions", | 78 | .description = "Use compound instructions", |
| 79 | .dependencies = featureSet(&[_]Feature{}), | 79 | .dependencies = featureSet(&[_]Feature{}), |
| 80 | }; | 80 | }; |
| 81 | result[@intFromEnum(Feature.duplex)] = .{ | 81 | result[@backingInt(Feature.duplex)] = .{ |
| 82 | .llvm_name = "duplex", | 82 | .llvm_name = "duplex", |
| 83 | .description = "Enable generation of duplex instruction", | 83 | .description = "Enable generation of duplex instruction", |
| 84 | .dependencies = featureSet(&[_]Feature{}), | 84 | .dependencies = featureSet(&[_]Feature{}), |
| 85 | }; | 85 | }; |
| 86 | result[@intFromEnum(Feature.hvx)] = .{ | 86 | result[@backingInt(Feature.hvx)] = .{ |
| 87 | .llvm_name = "hvx", | 87 | .llvm_name = "hvx", |
| 88 | .description = "Hexagon HVX instructions", | 88 | .description = "Hexagon HVX instructions", |
| 89 | .dependencies = featureSet(&[_]Feature{}), | 89 | .dependencies = featureSet(&[_]Feature{}), |
| 90 | }; | 90 | }; |
| 91 | result[@intFromEnum(Feature.hvx_ieee_fp)] = .{ | 91 | result[@backingInt(Feature.hvx_ieee_fp)] = .{ |
| 92 | .llvm_name = "hvx-ieee-fp", | 92 | .llvm_name = "hvx-ieee-fp", |
| 93 | .description = "Hexagon HVX IEEE floating point instructions", | 93 | .description = "Hexagon HVX IEEE floating point instructions", |
| 94 | .dependencies = featureSet(&[_]Feature{}), | 94 | .dependencies = featureSet(&[_]Feature{}), |
| 95 | }; | 95 | }; |
| 96 | result[@intFromEnum(Feature.hvx_length128b)] = .{ | 96 | result[@backingInt(Feature.hvx_length128b)] = .{ |
| 97 | .llvm_name = "hvx-length128b", | 97 | .llvm_name = "hvx-length128b", |
| 98 | .description = "Hexagon HVX 128B instructions", | 98 | .description = "Hexagon HVX 128B instructions", |
| 99 | .dependencies = featureSet(&[_]Feature{ | 99 | .dependencies = featureSet(&[_]Feature{ |
| 100 | .hvx, | 100 | .hvx, |
| 101 | }), | 101 | }), |
| 102 | }; | 102 | }; |
| 103 | result[@intFromEnum(Feature.hvx_length64b)] = .{ | 103 | result[@backingInt(Feature.hvx_length64b)] = .{ |
| 104 | .llvm_name = "hvx-length64b", | 104 | .llvm_name = "hvx-length64b", |
| 105 | .description = "Hexagon HVX 64B instructions", | 105 | .description = "Hexagon HVX 64B instructions", |
| 106 | .dependencies = featureSet(&[_]Feature{ | 106 | .dependencies = featureSet(&[_]Feature{ |
| 107 | .hvx, | 107 | .hvx, |
| 108 | }), | 108 | }), |
| 109 | }; | 109 | }; |
| 110 | result[@intFromEnum(Feature.hvx_qfloat)] = .{ | 110 | result[@backingInt(Feature.hvx_qfloat)] = .{ |
| 111 | .llvm_name = "hvx-qfloat", | 111 | .llvm_name = "hvx-qfloat", |
| 112 | .description = "Hexagon HVX QFloating point instructions", | 112 | .description = "Hexagon HVX QFloating point instructions", |
| 113 | .dependencies = featureSet(&[_]Feature{}), | 113 | .dependencies = featureSet(&[_]Feature{}), |
| 114 | }; | 114 | }; |
| 115 | result[@intFromEnum(Feature.hvxv60)] = .{ | 115 | result[@backingInt(Feature.hvxv60)] = .{ |
| 116 | .llvm_name = "hvxv60", | 116 | .llvm_name = "hvxv60", |
| 117 | .description = "Hexagon HVX instructions", | 117 | .description = "Hexagon HVX instructions", |
| 118 | .dependencies = featureSet(&[_]Feature{ | 118 | .dependencies = featureSet(&[_]Feature{ |
| 119 | .hvx, | 119 | .hvx, |
| 120 | }), | 120 | }), |
| 121 | }; | 121 | }; |
| 122 | result[@intFromEnum(Feature.hvxv62)] = .{ | 122 | result[@backingInt(Feature.hvxv62)] = .{ |
| 123 | .llvm_name = "hvxv62", | 123 | .llvm_name = "hvxv62", |
| 124 | .description = "Hexagon HVX instructions", | 124 | .description = "Hexagon HVX instructions", |
| 125 | .dependencies = featureSet(&[_]Feature{ | 125 | .dependencies = featureSet(&[_]Feature{ |
| 126 | .hvxv60, | 126 | .hvxv60, |
| 127 | }), | 127 | }), |
| 128 | }; | 128 | }; |
| 129 | result[@intFromEnum(Feature.hvxv65)] = .{ | 129 | result[@backingInt(Feature.hvxv65)] = .{ |
| 130 | .llvm_name = "hvxv65", | 130 | .llvm_name = "hvxv65", |
| 131 | .description = "Hexagon HVX instructions", | 131 | .description = "Hexagon HVX instructions", |
| 132 | .dependencies = featureSet(&[_]Feature{ | 132 | .dependencies = featureSet(&[_]Feature{ |
| 133 | .hvxv62, | 133 | .hvxv62, |
| 134 | }), | 134 | }), |
| 135 | }; | 135 | }; |
| 136 | result[@intFromEnum(Feature.hvxv66)] = .{ | 136 | result[@backingInt(Feature.hvxv66)] = .{ |
| 137 | .llvm_name = "hvxv66", | 137 | .llvm_name = "hvxv66", |
| 138 | .description = "Hexagon HVX instructions", | 138 | .description = "Hexagon HVX instructions", |
| 139 | .dependencies = featureSet(&[_]Feature{ | 139 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -141,192 +141,192 @@ pub const all_features = blk: { | ... | @@ -141,192 +141,192 @@ pub const all_features = blk: { |
| 141 | .zreg, | 141 | .zreg, |
| 142 | }), | 142 | }), |
| 143 | }; | 143 | }; |
| 144 | result[@intFromEnum(Feature.hvxv67)] = .{ | 144 | result[@backingInt(Feature.hvxv67)] = .{ |
| 145 | .llvm_name = "hvxv67", | 145 | .llvm_name = "hvxv67", |
| 146 | .description = "Hexagon HVX instructions", | 146 | .description = "Hexagon HVX instructions", |
| 147 | .dependencies = featureSet(&[_]Feature{ | 147 | .dependencies = featureSet(&[_]Feature{ |
| 148 | .hvxv66, | 148 | .hvxv66, |
| 149 | }), | 149 | }), |
| 150 | }; | 150 | }; |
| 151 | result[@intFromEnum(Feature.hvxv68)] = .{ | 151 | result[@backingInt(Feature.hvxv68)] = .{ |
| 152 | .llvm_name = "hvxv68", | 152 | .llvm_name = "hvxv68", |
| 153 | .description = "Hexagon HVX instructions", | 153 | .description = "Hexagon HVX instructions", |
| 154 | .dependencies = featureSet(&[_]Feature{ | 154 | .dependencies = featureSet(&[_]Feature{ |
| 155 | .hvxv67, | 155 | .hvxv67, |
| 156 | }), | 156 | }), |
| 157 | }; | 157 | }; |
| 158 | result[@intFromEnum(Feature.hvxv69)] = .{ | 158 | result[@backingInt(Feature.hvxv69)] = .{ |
| 159 | .llvm_name = "hvxv69", | 159 | .llvm_name = "hvxv69", |
| 160 | .description = "Hexagon HVX instructions", | 160 | .description = "Hexagon HVX instructions", |
| 161 | .dependencies = featureSet(&[_]Feature{ | 161 | .dependencies = featureSet(&[_]Feature{ |
| 162 | .hvxv68, | 162 | .hvxv68, |
| 163 | }), | 163 | }), |
| 164 | }; | 164 | }; |
| 165 | result[@intFromEnum(Feature.hvxv71)] = .{ | 165 | result[@backingInt(Feature.hvxv71)] = .{ |
| 166 | .llvm_name = "hvxv71", | 166 | .llvm_name = "hvxv71", |
| 167 | .description = "Hexagon HVX instructions", | 167 | .description = "Hexagon HVX instructions", |
| 168 | .dependencies = featureSet(&[_]Feature{ | 168 | .dependencies = featureSet(&[_]Feature{ |
| 169 | .hvxv69, | 169 | .hvxv69, |
| 170 | }), | 170 | }), |
| 171 | }; | 171 | }; |
| 172 | result[@intFromEnum(Feature.hvxv73)] = .{ | 172 | result[@backingInt(Feature.hvxv73)] = .{ |
| 173 | .llvm_name = "hvxv73", | 173 | .llvm_name = "hvxv73", |
| 174 | .description = "Hexagon HVX instructions", | 174 | .description = "Hexagon HVX instructions", |
| 175 | .dependencies = featureSet(&[_]Feature{ | 175 | .dependencies = featureSet(&[_]Feature{ |
| 176 | .hvxv71, | 176 | .hvxv71, |
| 177 | }), | 177 | }), |
| 178 | }; | 178 | }; |
| 179 | result[@intFromEnum(Feature.hvxv75)] = .{ | 179 | result[@backingInt(Feature.hvxv75)] = .{ |
| 180 | .llvm_name = "hvxv75", | 180 | .llvm_name = "hvxv75", |
| 181 | .description = "Hexagon HVX instructions", | 181 | .description = "Hexagon HVX instructions", |
| 182 | .dependencies = featureSet(&[_]Feature{ | 182 | .dependencies = featureSet(&[_]Feature{ |
| 183 | .hvxv73, | 183 | .hvxv73, |
| 184 | }), | 184 | }), |
| 185 | }; | 185 | }; |
| 186 | result[@intFromEnum(Feature.hvxv79)] = .{ | 186 | result[@backingInt(Feature.hvxv79)] = .{ |
| 187 | .llvm_name = "hvxv79", | 187 | .llvm_name = "hvxv79", |
| 188 | .description = "Hexagon HVX instructions", | 188 | .description = "Hexagon HVX instructions", |
| 189 | .dependencies = featureSet(&[_]Feature{ | 189 | .dependencies = featureSet(&[_]Feature{ |
| 190 | .hvxv75, | 190 | .hvxv75, |
| 191 | }), | 191 | }), |
| 192 | }; | 192 | }; |
| 193 | result[@intFromEnum(Feature.hvxv81)] = .{ | 193 | result[@backingInt(Feature.hvxv81)] = .{ |
| 194 | .llvm_name = "hvxv81", | 194 | .llvm_name = "hvxv81", |
| 195 | .description = "Hexagon HVX instructions", | 195 | .description = "Hexagon HVX instructions", |
| 196 | .dependencies = featureSet(&[_]Feature{ | 196 | .dependencies = featureSet(&[_]Feature{ |
| 197 | .hvxv79, | 197 | .hvxv79, |
| 198 | }), | 198 | }), |
| 199 | }; | 199 | }; |
| 200 | result[@intFromEnum(Feature.long_calls)] = .{ | 200 | result[@backingInt(Feature.long_calls)] = .{ |
| 201 | .llvm_name = "long-calls", | 201 | .llvm_name = "long-calls", |
| 202 | .description = "Use constant-extended calls", | 202 | .description = "Use constant-extended calls", |
| 203 | .dependencies = featureSet(&[_]Feature{}), | 203 | .dependencies = featureSet(&[_]Feature{}), |
| 204 | }; | 204 | }; |
| 205 | result[@intFromEnum(Feature.mem_noshuf)] = .{ | 205 | result[@backingInt(Feature.mem_noshuf)] = .{ |
| 206 | .llvm_name = "mem_noshuf", | 206 | .llvm_name = "mem_noshuf", |
| 207 | .description = "Supports mem_noshuf feature", | 207 | .description = "Supports mem_noshuf feature", |
| 208 | .dependencies = featureSet(&[_]Feature{}), | 208 | .dependencies = featureSet(&[_]Feature{}), |
| 209 | }; | 209 | }; |
| 210 | result[@intFromEnum(Feature.memops)] = .{ | 210 | result[@backingInt(Feature.memops)] = .{ |
| 211 | .llvm_name = "memops", | 211 | .llvm_name = "memops", |
| 212 | .description = "Use memop instructions", | 212 | .description = "Use memop instructions", |
| 213 | .dependencies = featureSet(&[_]Feature{}), | 213 | .dependencies = featureSet(&[_]Feature{}), |
| 214 | }; | 214 | }; |
| 215 | result[@intFromEnum(Feature.noreturn_stack_elim)] = .{ | 215 | result[@backingInt(Feature.noreturn_stack_elim)] = .{ |
| 216 | .llvm_name = "noreturn-stack-elim", | 216 | .llvm_name = "noreturn-stack-elim", |
| 217 | .description = "Eliminate stack allocation in a noreturn function when possible", | 217 | .description = "Eliminate stack allocation in a noreturn function when possible", |
| 218 | .dependencies = featureSet(&[_]Feature{}), | 218 | .dependencies = featureSet(&[_]Feature{}), |
| 219 | }; | 219 | }; |
| 220 | result[@intFromEnum(Feature.nvj)] = .{ | 220 | result[@backingInt(Feature.nvj)] = .{ |
| 221 | .llvm_name = "nvj", | 221 | .llvm_name = "nvj", |
| 222 | .description = "Support for new-value jumps", | 222 | .description = "Support for new-value jumps", |
| 223 | .dependencies = featureSet(&[_]Feature{ | 223 | .dependencies = featureSet(&[_]Feature{ |
| 224 | .packets, | 224 | .packets, |
| 225 | }), | 225 | }), |
| 226 | }; | 226 | }; |
| 227 | result[@intFromEnum(Feature.nvs)] = .{ | 227 | result[@backingInt(Feature.nvs)] = .{ |
| 228 | .llvm_name = "nvs", | 228 | .llvm_name = "nvs", |
| 229 | .description = "Support for new-value stores", | 229 | .description = "Support for new-value stores", |
| 230 | .dependencies = featureSet(&[_]Feature{ | 230 | .dependencies = featureSet(&[_]Feature{ |
| 231 | .packets, | 231 | .packets, |
| 232 | }), | 232 | }), |
| 233 | }; | 233 | }; |
| 234 | result[@intFromEnum(Feature.packets)] = .{ | 234 | result[@backingInt(Feature.packets)] = .{ |
| 235 | .llvm_name = "packets", | 235 | .llvm_name = "packets", |
| 236 | .description = "Support for instruction packets", | 236 | .description = "Support for instruction packets", |
| 237 | .dependencies = featureSet(&[_]Feature{}), | 237 | .dependencies = featureSet(&[_]Feature{}), |
| 238 | }; | 238 | }; |
| 239 | result[@intFromEnum(Feature.prev65)] = .{ | 239 | result[@backingInt(Feature.prev65)] = .{ |
| 240 | .llvm_name = "prev65", | 240 | .llvm_name = "prev65", |
| 241 | .description = "Support features deprecated in v65", | 241 | .description = "Support features deprecated in v65", |
| 242 | .dependencies = featureSet(&[_]Feature{}), | 242 | .dependencies = featureSet(&[_]Feature{}), |
| 243 | }; | 243 | }; |
| 244 | result[@intFromEnum(Feature.reserved_r19)] = .{ | 244 | result[@backingInt(Feature.reserved_r19)] = .{ |
| 245 | .llvm_name = "reserved-r19", | 245 | .llvm_name = "reserved-r19", |
| 246 | .description = "Reserve register R19", | 246 | .description = "Reserve register R19", |
| 247 | .dependencies = featureSet(&[_]Feature{}), | 247 | .dependencies = featureSet(&[_]Feature{}), |
| 248 | }; | 248 | }; |
| 249 | result[@intFromEnum(Feature.small_data)] = .{ | 249 | result[@backingInt(Feature.small_data)] = .{ |
| 250 | .llvm_name = "small-data", | 250 | .llvm_name = "small-data", |
| 251 | .description = "Allow GP-relative addressing of global variables", | 251 | .description = "Allow GP-relative addressing of global variables", |
| 252 | .dependencies = featureSet(&[_]Feature{}), | 252 | .dependencies = featureSet(&[_]Feature{}), |
| 253 | }; | 253 | }; |
| 254 | result[@intFromEnum(Feature.tinycore)] = .{ | 254 | result[@backingInt(Feature.tinycore)] = .{ |
| 255 | .llvm_name = "tinycore", | 255 | .llvm_name = "tinycore", |
| 256 | .description = "Hexagon Tiny Core", | 256 | .description = "Hexagon Tiny Core", |
| 257 | .dependencies = featureSet(&[_]Feature{}), | 257 | .dependencies = featureSet(&[_]Feature{}), |
| 258 | }; | 258 | }; |
| 259 | result[@intFromEnum(Feature.v5)] = .{ | 259 | result[@backingInt(Feature.v5)] = .{ |
| 260 | .llvm_name = "v5", | 260 | .llvm_name = "v5", |
| 261 | .description = "Enable Hexagon V5 architecture", | 261 | .description = "Enable Hexagon V5 architecture", |
| 262 | .dependencies = featureSet(&[_]Feature{}), | 262 | .dependencies = featureSet(&[_]Feature{}), |
| 263 | }; | 263 | }; |
| 264 | result[@intFromEnum(Feature.v55)] = .{ | 264 | result[@backingInt(Feature.v55)] = .{ |
| 265 | .llvm_name = "v55", | 265 | .llvm_name = "v55", |
| 266 | .description = "Enable Hexagon V55 architecture", | 266 | .description = "Enable Hexagon V55 architecture", |
| 267 | .dependencies = featureSet(&[_]Feature{}), | 267 | .dependencies = featureSet(&[_]Feature{}), |
| 268 | }; | 268 | }; |
| 269 | result[@intFromEnum(Feature.v60)] = .{ | 269 | result[@backingInt(Feature.v60)] = .{ |
| 270 | .llvm_name = "v60", | 270 | .llvm_name = "v60", |
| 271 | .description = "Enable Hexagon V60 architecture", | 271 | .description = "Enable Hexagon V60 architecture", |
| 272 | .dependencies = featureSet(&[_]Feature{}), | 272 | .dependencies = featureSet(&[_]Feature{}), |
| 273 | }; | 273 | }; |
| 274 | result[@intFromEnum(Feature.v62)] = .{ | 274 | result[@backingInt(Feature.v62)] = .{ |
| 275 | .llvm_name = "v62", | 275 | .llvm_name = "v62", |
| 276 | .description = "Enable Hexagon V62 architecture", | 276 | .description = "Enable Hexagon V62 architecture", |
| 277 | .dependencies = featureSet(&[_]Feature{}), | 277 | .dependencies = featureSet(&[_]Feature{}), |
| 278 | }; | 278 | }; |
| 279 | result[@intFromEnum(Feature.v65)] = .{ | 279 | result[@backingInt(Feature.v65)] = .{ |
| 280 | .llvm_name = "v65", | 280 | .llvm_name = "v65", |
| 281 | .description = "Enable Hexagon V65 architecture", | 281 | .description = "Enable Hexagon V65 architecture", |
| 282 | .dependencies = featureSet(&[_]Feature{}), | 282 | .dependencies = featureSet(&[_]Feature{}), |
| 283 | }; | 283 | }; |
| 284 | result[@intFromEnum(Feature.v66)] = .{ | 284 | result[@backingInt(Feature.v66)] = .{ |
| 285 | .llvm_name = "v66", | 285 | .llvm_name = "v66", |
| 286 | .description = "Enable Hexagon V66 architecture", | 286 | .description = "Enable Hexagon V66 architecture", |
| 287 | .dependencies = featureSet(&[_]Feature{}), | 287 | .dependencies = featureSet(&[_]Feature{}), |
| 288 | }; | 288 | }; |
| 289 | result[@intFromEnum(Feature.v67)] = .{ | 289 | result[@backingInt(Feature.v67)] = .{ |
| 290 | .llvm_name = "v67", | 290 | .llvm_name = "v67", |
| 291 | .description = "Enable Hexagon V67 architecture", | 291 | .description = "Enable Hexagon V67 architecture", |
| 292 | .dependencies = featureSet(&[_]Feature{}), | 292 | .dependencies = featureSet(&[_]Feature{}), |
| 293 | }; | 293 | }; |
| 294 | result[@intFromEnum(Feature.v68)] = .{ | 294 | result[@backingInt(Feature.v68)] = .{ |
| 295 | .llvm_name = "v68", | 295 | .llvm_name = "v68", |
| 296 | .description = "Enable Hexagon V68 architecture", | 296 | .description = "Enable Hexagon V68 architecture", |
| 297 | .dependencies = featureSet(&[_]Feature{}), | 297 | .dependencies = featureSet(&[_]Feature{}), |
| 298 | }; | 298 | }; |
| 299 | result[@intFromEnum(Feature.v69)] = .{ | 299 | result[@backingInt(Feature.v69)] = .{ |
| 300 | .llvm_name = "v69", | 300 | .llvm_name = "v69", |
| 301 | .description = "Enable Hexagon V69 architecture", | 301 | .description = "Enable Hexagon V69 architecture", |
| 302 | .dependencies = featureSet(&[_]Feature{}), | 302 | .dependencies = featureSet(&[_]Feature{}), |
| 303 | }; | 303 | }; |
| 304 | result[@intFromEnum(Feature.v71)] = .{ | 304 | result[@backingInt(Feature.v71)] = .{ |
| 305 | .llvm_name = "v71", | 305 | .llvm_name = "v71", |
| 306 | .description = "Enable Hexagon V71 architecture", | 306 | .description = "Enable Hexagon V71 architecture", |
| 307 | .dependencies = featureSet(&[_]Feature{}), | 307 | .dependencies = featureSet(&[_]Feature{}), |
| 308 | }; | 308 | }; |
| 309 | result[@intFromEnum(Feature.v73)] = .{ | 309 | result[@backingInt(Feature.v73)] = .{ |
| 310 | .llvm_name = "v73", | 310 | .llvm_name = "v73", |
| 311 | .description = "Enable Hexagon V73 architecture", | 311 | .description = "Enable Hexagon V73 architecture", |
| 312 | .dependencies = featureSet(&[_]Feature{}), | 312 | .dependencies = featureSet(&[_]Feature{}), |
| 313 | }; | 313 | }; |
| 314 | result[@intFromEnum(Feature.v75)] = .{ | 314 | result[@backingInt(Feature.v75)] = .{ |
| 315 | .llvm_name = "v75", | 315 | .llvm_name = "v75", |
| 316 | .description = "Enable Hexagon V75 architecture", | 316 | .description = "Enable Hexagon V75 architecture", |
| 317 | .dependencies = featureSet(&[_]Feature{}), | 317 | .dependencies = featureSet(&[_]Feature{}), |
| 318 | }; | 318 | }; |
| 319 | result[@intFromEnum(Feature.v79)] = .{ | 319 | result[@backingInt(Feature.v79)] = .{ |
| 320 | .llvm_name = "v79", | 320 | .llvm_name = "v79", |
| 321 | .description = "Enable Hexagon V79 architecture", | 321 | .description = "Enable Hexagon V79 architecture", |
| 322 | .dependencies = featureSet(&[_]Feature{}), | 322 | .dependencies = featureSet(&[_]Feature{}), |
| 323 | }; | 323 | }; |
| 324 | result[@intFromEnum(Feature.v81)] = .{ | 324 | result[@backingInt(Feature.v81)] = .{ |
| 325 | .llvm_name = "v81", | 325 | .llvm_name = "v81", |
| 326 | .description = "Enable Hexagon V81 architecture", | 326 | .description = "Enable Hexagon V81 architecture", |
| 327 | .dependencies = featureSet(&[_]Feature{}), | 327 | .dependencies = featureSet(&[_]Feature{}), |
| 328 | }; | 328 | }; |
| 329 | result[@intFromEnum(Feature.zreg)] = .{ | 329 | result[@backingInt(Feature.zreg)] = .{ |
| 330 | .llvm_name = "zreg", | 330 | .llvm_name = "zreg", |
| 331 | .description = "Hexagon ZReg extension instructions", | 331 | .description = "Hexagon ZReg extension instructions", |
| 332 | .dependencies = featureSet(&[_]Feature{}), | 332 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/hppa.zig+5-5| ... | @@ -21,31 +21,31 @@ pub const all_features = blk: { | ... | @@ -21,31 +21,31 @@ pub const all_features = blk: { |
| 21 | const len = @typeInfo(Feature).@"enum".field_names.len; | 21 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 22 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 22 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 23 | var result: [len]CpuFeature = undefined; | 23 | var result: [len]CpuFeature = undefined; |
| 24 | result[@intFromEnum(Feature.@"64bit")] = .{ | 24 | result[@backingInt(Feature.@"64bit")] = .{ |
| 25 | .llvm_name = null, | 25 | .llvm_name = null, |
| 26 | .description = "Enable 64-bit PA-RISC 2.0", | 26 | .description = "Enable 64-bit PA-RISC 2.0", |
| 27 | .dependencies = featureSet(&[_]Feature{ | 27 | .dependencies = featureSet(&[_]Feature{ |
| 28 | .v2_0, | 28 | .v2_0, |
| 29 | }), | 29 | }), |
| 30 | }; | 30 | }; |
| 31 | result[@intFromEnum(Feature.max_1)] = .{ | 31 | result[@backingInt(Feature.max_1)] = .{ |
| 32 | .llvm_name = null, | 32 | .llvm_name = null, |
| 33 | .description = "Enable MAX-1 multimedia acceleration extensions", | 33 | .description = "Enable MAX-1 multimedia acceleration extensions", |
| 34 | .dependencies = featureSet(&[_]Feature{}), | 34 | .dependencies = featureSet(&[_]Feature{}), |
| 35 | }; | 35 | }; |
| 36 | result[@intFromEnum(Feature.max_2)] = .{ | 36 | result[@backingInt(Feature.max_2)] = .{ |
| 37 | .llvm_name = null, | 37 | .llvm_name = null, |
| 38 | .description = "Enable MAX-2 multimedia acceleration extensions", | 38 | .description = "Enable MAX-2 multimedia acceleration extensions", |
| 39 | .dependencies = featureSet(&[_]Feature{ | 39 | .dependencies = featureSet(&[_]Feature{ |
| 40 | .max_1, | 40 | .max_1, |
| 41 | }), | 41 | }), |
| 42 | }; | 42 | }; |
| 43 | result[@intFromEnum(Feature.v1_1)] = .{ | 43 | result[@backingInt(Feature.v1_1)] = .{ |
| 44 | .llvm_name = null, | 44 | .llvm_name = null, |
| 45 | .description = "Enable ISA v1.1", | 45 | .description = "Enable ISA v1.1", |
| 46 | .dependencies = featureSet(&[_]Feature{}), | 46 | .dependencies = featureSet(&[_]Feature{}), |
| 47 | }; | 47 | }; |
| 48 | result[@intFromEnum(Feature.v2_0)] = .{ | 48 | result[@backingInt(Feature.v2_0)] = .{ |
| 49 | .llvm_name = null, | 49 | .llvm_name = null, |
| 50 | .description = "Enable ISA v2.0", | 50 | .description = "Enable ISA v2.0", |
| 51 | .dependencies = featureSet(&[_]Feature{ | 51 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/kvx.zig+3-3| ... | @@ -19,19 +19,19 @@ pub const all_features = blk: { | ... | @@ -19,19 +19,19 @@ pub const all_features = blk: { |
| 19 | const len = @typeInfo(Feature).@"enum".field_names.len; | 19 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 20 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 20 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 21 | var result: [len]CpuFeature = undefined; | 21 | var result: [len]CpuFeature = undefined; |
| 22 | result[@intFromEnum(Feature.v3_1)] = .{ | 22 | result[@backingInt(Feature.v3_1)] = .{ |
| 23 | .llvm_name = null, | 23 | .llvm_name = null, |
| 24 | .description = "Enable ISA v3.1", | 24 | .description = "Enable ISA v3.1", |
| 25 | .dependencies = featureSet(&[_]Feature{}), | 25 | .dependencies = featureSet(&[_]Feature{}), |
| 26 | }; | 26 | }; |
| 27 | result[@intFromEnum(Feature.v3_2)] = .{ | 27 | result[@backingInt(Feature.v3_2)] = .{ |
| 28 | .llvm_name = null, | 28 | .llvm_name = null, |
| 29 | .description = "Enable ISA v3.2", | 29 | .description = "Enable ISA v3.2", |
| 30 | .dependencies = featureSet(&[_]Feature{ | 30 | .dependencies = featureSet(&[_]Feature{ |
| 31 | .v3_1, | 31 | .v3_1, |
| 32 | }), | 32 | }), |
| 33 | }; | 33 | }; |
| 34 | result[@intFromEnum(Feature.v4_1)] = .{ | 34 | result[@backingInt(Feature.v4_1)] = .{ |
| 35 | .llvm_name = null, | 35 | .llvm_name = null, |
| 36 | .description = "Enable ISA v4.1", | 36 | .description = "Enable ISA v4.1", |
| 37 | .dependencies = featureSet(&[_]Feature{ | 37 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/loongarch.zig+21-21| ... | @@ -37,115 +37,115 @@ pub const all_features = blk: { | ... | @@ -37,115 +37,115 @@ pub const all_features = blk: { |
| 37 | const len = @typeInfo(Feature).@"enum".field_names.len; | 37 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 38 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 38 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 39 | var result: [len]CpuFeature = undefined; | 39 | var result: [len]CpuFeature = undefined; |
| 40 | result[@intFromEnum(Feature.@"32bit")] = .{ | 40 | result[@backingInt(Feature.@"32bit")] = .{ |
| 41 | .llvm_name = "32bit", | 41 | .llvm_name = "32bit", |
| 42 | .description = "LA32 Basic Integer and Privilege Instruction Set", | 42 | .description = "LA32 Basic Integer and Privilege Instruction Set", |
| 43 | .dependencies = featureSet(&[_]Feature{}), | 43 | .dependencies = featureSet(&[_]Feature{}), |
| 44 | }; | 44 | }; |
| 45 | result[@intFromEnum(Feature.@"32s")] = .{ | 45 | result[@backingInt(Feature.@"32s")] = .{ |
| 46 | .llvm_name = "32s", | 46 | .llvm_name = "32s", |
| 47 | .description = "LA32 Standard Basic Instruction Extension", | 47 | .description = "LA32 Standard Basic Instruction Extension", |
| 48 | .dependencies = featureSet(&[_]Feature{}), | 48 | .dependencies = featureSet(&[_]Feature{}), |
| 49 | }; | 49 | }; |
| 50 | result[@intFromEnum(Feature.@"64bit")] = .{ | 50 | result[@backingInt(Feature.@"64bit")] = .{ |
| 51 | .llvm_name = "64bit", | 51 | .llvm_name = "64bit", |
| 52 | .description = "LA64 Basic Integer and Privilege Instruction Set", | 52 | .description = "LA64 Basic Integer and Privilege Instruction Set", |
| 53 | .dependencies = featureSet(&[_]Feature{ | 53 | .dependencies = featureSet(&[_]Feature{ |
| 54 | .@"32s", | 54 | .@"32s", |
| 55 | }), | 55 | }), |
| 56 | }; | 56 | }; |
| 57 | result[@intFromEnum(Feature.d)] = .{ | 57 | result[@backingInt(Feature.d)] = .{ |
| 58 | .llvm_name = "d", | 58 | .llvm_name = "d", |
| 59 | .description = "'D' (Double-Precision Floating-Point)", | 59 | .description = "'D' (Double-Precision Floating-Point)", |
| 60 | .dependencies = featureSet(&[_]Feature{ | 60 | .dependencies = featureSet(&[_]Feature{ |
| 61 | .f, | 61 | .f, |
| 62 | }), | 62 | }), |
| 63 | }; | 63 | }; |
| 64 | result[@intFromEnum(Feature.div32)] = .{ | 64 | result[@backingInt(Feature.div32)] = .{ |
| 65 | .llvm_name = "div32", | 65 | .llvm_name = "div32", |
| 66 | .description = "Assume div.w[u] and mod.w[u] can handle inputs that are not sign-extended", | 66 | .description = "Assume div.w[u] and mod.w[u] can handle inputs that are not sign-extended", |
| 67 | .dependencies = featureSet(&[_]Feature{}), | 67 | .dependencies = featureSet(&[_]Feature{}), |
| 68 | }; | 68 | }; |
| 69 | result[@intFromEnum(Feature.f)] = .{ | 69 | result[@backingInt(Feature.f)] = .{ |
| 70 | .llvm_name = "f", | 70 | .llvm_name = "f", |
| 71 | .description = "'F' (Single-Precision Floating-Point)", | 71 | .description = "'F' (Single-Precision Floating-Point)", |
| 72 | .dependencies = featureSet(&[_]Feature{}), | 72 | .dependencies = featureSet(&[_]Feature{}), |
| 73 | }; | 73 | }; |
| 74 | result[@intFromEnum(Feature.frecipe)] = .{ | 74 | result[@backingInt(Feature.frecipe)] = .{ |
| 75 | .llvm_name = "frecipe", | 75 | .llvm_name = "frecipe", |
| 76 | .description = "Support frecipe.{s/d} and frsqrte.{s/d} instructions", | 76 | .description = "Support frecipe.{s/d} and frsqrte.{s/d} instructions", |
| 77 | .dependencies = featureSet(&[_]Feature{}), | 77 | .dependencies = featureSet(&[_]Feature{}), |
| 78 | }; | 78 | }; |
| 79 | result[@intFromEnum(Feature.la_global_with_abs)] = .{ | 79 | result[@backingInt(Feature.la_global_with_abs)] = .{ |
| 80 | .llvm_name = "la-global-with-abs", | 80 | .llvm_name = "la-global-with-abs", |
| 81 | .description = "Expand la.global as la.abs", | 81 | .description = "Expand la.global as la.abs", |
| 82 | .dependencies = featureSet(&[_]Feature{}), | 82 | .dependencies = featureSet(&[_]Feature{}), |
| 83 | }; | 83 | }; |
| 84 | result[@intFromEnum(Feature.la_global_with_pcrel)] = .{ | 84 | result[@backingInt(Feature.la_global_with_pcrel)] = .{ |
| 85 | .llvm_name = "la-global-with-pcrel", | 85 | .llvm_name = "la-global-with-pcrel", |
| 86 | .description = "Expand la.global as la.pcrel", | 86 | .description = "Expand la.global as la.pcrel", |
| 87 | .dependencies = featureSet(&[_]Feature{}), | 87 | .dependencies = featureSet(&[_]Feature{}), |
| 88 | }; | 88 | }; |
| 89 | result[@intFromEnum(Feature.la_local_with_abs)] = .{ | 89 | result[@backingInt(Feature.la_local_with_abs)] = .{ |
| 90 | .llvm_name = "la-local-with-abs", | 90 | .llvm_name = "la-local-with-abs", |
| 91 | .description = "Expand la.local as la.abs", | 91 | .description = "Expand la.local as la.abs", |
| 92 | .dependencies = featureSet(&[_]Feature{}), | 92 | .dependencies = featureSet(&[_]Feature{}), |
| 93 | }; | 93 | }; |
| 94 | result[@intFromEnum(Feature.lam_bh)] = .{ | 94 | result[@backingInt(Feature.lam_bh)] = .{ |
| 95 | .llvm_name = "lam-bh", | 95 | .llvm_name = "lam-bh", |
| 96 | .description = "Support amswap[_db].{b/h} and amadd[_db].{b/h} instructions", | 96 | .description = "Support amswap[_db].{b/h} and amadd[_db].{b/h} instructions", |
| 97 | .dependencies = featureSet(&[_]Feature{}), | 97 | .dependencies = featureSet(&[_]Feature{}), |
| 98 | }; | 98 | }; |
| 99 | result[@intFromEnum(Feature.lamcas)] = .{ | 99 | result[@backingInt(Feature.lamcas)] = .{ |
| 100 | .llvm_name = "lamcas", | 100 | .llvm_name = "lamcas", |
| 101 | .description = "Support amcas[_db].{b/h/w/d}", | 101 | .description = "Support amcas[_db].{b/h/w/d}", |
| 102 | .dependencies = featureSet(&[_]Feature{}), | 102 | .dependencies = featureSet(&[_]Feature{}), |
| 103 | }; | 103 | }; |
| 104 | result[@intFromEnum(Feature.lasx)] = .{ | 104 | result[@backingInt(Feature.lasx)] = .{ |
| 105 | .llvm_name = "lasx", | 105 | .llvm_name = "lasx", |
| 106 | .description = "'LASX' (Loongson Advanced SIMD Extension)", | 106 | .description = "'LASX' (Loongson Advanced SIMD Extension)", |
| 107 | .dependencies = featureSet(&[_]Feature{ | 107 | .dependencies = featureSet(&[_]Feature{ |
| 108 | .lsx, | 108 | .lsx, |
| 109 | }), | 109 | }), |
| 110 | }; | 110 | }; |
| 111 | result[@intFromEnum(Feature.lbt)] = .{ | 111 | result[@backingInt(Feature.lbt)] = .{ |
| 112 | .llvm_name = "lbt", | 112 | .llvm_name = "lbt", |
| 113 | .description = "'LBT' (Loongson Binary Translation Extension)", | 113 | .description = "'LBT' (Loongson Binary Translation Extension)", |
| 114 | .dependencies = featureSet(&[_]Feature{}), | 114 | .dependencies = featureSet(&[_]Feature{}), |
| 115 | }; | 115 | }; |
| 116 | result[@intFromEnum(Feature.ld_seq_sa)] = .{ | 116 | result[@backingInt(Feature.ld_seq_sa)] = .{ |
| 117 | .llvm_name = "ld-seq-sa", | 117 | .llvm_name = "ld-seq-sa", |
| 118 | .description = "Don't use a same-address load-load barrier (dbar 0x700)", | 118 | .description = "Don't use a same-address load-load barrier (dbar 0x700)", |
| 119 | .dependencies = featureSet(&[_]Feature{}), | 119 | .dependencies = featureSet(&[_]Feature{}), |
| 120 | }; | 120 | }; |
| 121 | result[@intFromEnum(Feature.lsx)] = .{ | 121 | result[@backingInt(Feature.lsx)] = .{ |
| 122 | .llvm_name = "lsx", | 122 | .llvm_name = "lsx", |
| 123 | .description = "'LSX' (Loongson SIMD Extension)", | 123 | .description = "'LSX' (Loongson SIMD Extension)", |
| 124 | .dependencies = featureSet(&[_]Feature{ | 124 | .dependencies = featureSet(&[_]Feature{ |
| 125 | .d, | 125 | .d, |
| 126 | }), | 126 | }), |
| 127 | }; | 127 | }; |
| 128 | result[@intFromEnum(Feature.lvz)] = .{ | 128 | result[@backingInt(Feature.lvz)] = .{ |
| 129 | .llvm_name = "lvz", | 129 | .llvm_name = "lvz", |
| 130 | .description = "'LVZ' (Loongson Virtualization Extension)", | 130 | .description = "'LVZ' (Loongson Virtualization Extension)", |
| 131 | .dependencies = featureSet(&[_]Feature{}), | 131 | .dependencies = featureSet(&[_]Feature{}), |
| 132 | }; | 132 | }; |
| 133 | result[@intFromEnum(Feature.prefer_w_inst)] = .{ | 133 | result[@backingInt(Feature.prefer_w_inst)] = .{ |
| 134 | .llvm_name = "prefer-w-inst", | 134 | .llvm_name = "prefer-w-inst", |
| 135 | .description = "Prefer instructions with W suffix", | 135 | .description = "Prefer instructions with W suffix", |
| 136 | .dependencies = featureSet(&[_]Feature{}), | 136 | .dependencies = featureSet(&[_]Feature{}), |
| 137 | }; | 137 | }; |
| 138 | result[@intFromEnum(Feature.relax)] = .{ | 138 | result[@backingInt(Feature.relax)] = .{ |
| 139 | .llvm_name = "relax", | 139 | .llvm_name = "relax", |
| 140 | .description = "Enable Linker relaxation", | 140 | .description = "Enable Linker relaxation", |
| 141 | .dependencies = featureSet(&[_]Feature{}), | 141 | .dependencies = featureSet(&[_]Feature{}), |
| 142 | }; | 142 | }; |
| 143 | result[@intFromEnum(Feature.scq)] = .{ | 143 | result[@backingInt(Feature.scq)] = .{ |
| 144 | .llvm_name = "scq", | 144 | .llvm_name = "scq", |
| 145 | .description = "Support sc.q instruction", | 145 | .description = "Support sc.q instruction", |
| 146 | .dependencies = featureSet(&[_]Feature{}), | 146 | .dependencies = featureSet(&[_]Feature{}), |
| 147 | }; | 147 | }; |
| 148 | result[@intFromEnum(Feature.ual)] = .{ | 148 | result[@backingInt(Feature.ual)] = .{ |
| 149 | .llvm_name = "ual", | 149 | .llvm_name = "ual", |
| 150 | .description = "Allow memory accesses to be unaligned", | 150 | .description = "Allow memory accesses to be unaligned", |
| 151 | .dependencies = featureSet(&[_]Feature{}), | 151 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/m68k.zig+23-23| ... | @@ -39,33 +39,33 @@ pub const all_features = blk: { | ... | @@ -39,33 +39,33 @@ pub const all_features = blk: { |
| 39 | const len = @typeInfo(Feature).@"enum".field_names.len; | 39 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 40 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 40 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 41 | var result: [len]CpuFeature = undefined; | 41 | var result: [len]CpuFeature = undefined; |
| 42 | result[@intFromEnum(Feature.isa_68000)] = .{ | 42 | result[@backingInt(Feature.isa_68000)] = .{ |
| 43 | .llvm_name = "isa-68000", | 43 | .llvm_name = "isa-68000", |
| 44 | .description = "Is M68000 ISA supported", | 44 | .description = "Is M68000 ISA supported", |
| 45 | .dependencies = featureSet(&[_]Feature{}), | 45 | .dependencies = featureSet(&[_]Feature{}), |
| 46 | }; | 46 | }; |
| 47 | result[@intFromEnum(Feature.isa_68010)] = .{ | 47 | result[@backingInt(Feature.isa_68010)] = .{ |
| 48 | .llvm_name = "isa-68010", | 48 | .llvm_name = "isa-68010", |
| 49 | .description = "Is M68010 ISA supported", | 49 | .description = "Is M68010 ISA supported", |
| 50 | .dependencies = featureSet(&[_]Feature{ | 50 | .dependencies = featureSet(&[_]Feature{ |
| 51 | .isa_68000, | 51 | .isa_68000, |
| 52 | }), | 52 | }), |
| 53 | }; | 53 | }; |
| 54 | result[@intFromEnum(Feature.isa_68020)] = .{ | 54 | result[@backingInt(Feature.isa_68020)] = .{ |
| 55 | .llvm_name = "isa-68020", | 55 | .llvm_name = "isa-68020", |
| 56 | .description = "Is M68020 ISA supported", | 56 | .description = "Is M68020 ISA supported", |
| 57 | .dependencies = featureSet(&[_]Feature{ | 57 | .dependencies = featureSet(&[_]Feature{ |
| 58 | .isa_68010, | 58 | .isa_68010, |
| 59 | }), | 59 | }), |
| 60 | }; | 60 | }; |
| 61 | result[@intFromEnum(Feature.isa_68030)] = .{ | 61 | result[@backingInt(Feature.isa_68030)] = .{ |
| 62 | .llvm_name = "isa-68030", | 62 | .llvm_name = "isa-68030", |
| 63 | .description = "Is M68030 ISA supported", | 63 | .description = "Is M68030 ISA supported", |
| 64 | .dependencies = featureSet(&[_]Feature{ | 64 | .dependencies = featureSet(&[_]Feature{ |
| 65 | .isa_68020, | 65 | .isa_68020, |
| 66 | }), | 66 | }), |
| 67 | }; | 67 | }; |
| 68 | result[@intFromEnum(Feature.isa_68040)] = .{ | 68 | result[@backingInt(Feature.isa_68040)] = .{ |
| 69 | .llvm_name = "isa-68040", | 69 | .llvm_name = "isa-68040", |
| 70 | .description = "Is M68040 ISA supported", | 70 | .description = "Is M68040 ISA supported", |
| 71 | .dependencies = featureSet(&[_]Feature{ | 71 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -73,96 +73,96 @@ pub const all_features = blk: { | ... | @@ -73,96 +73,96 @@ pub const all_features = blk: { |
| 73 | .isa_68882, | 73 | .isa_68882, |
| 74 | }), | 74 | }), |
| 75 | }; | 75 | }; |
| 76 | result[@intFromEnum(Feature.isa_68060)] = .{ | 76 | result[@backingInt(Feature.isa_68060)] = .{ |
| 77 | .llvm_name = "isa-68060", | 77 | .llvm_name = "isa-68060", |
| 78 | .description = "Is M68060 ISA supported", | 78 | .description = "Is M68060 ISA supported", |
| 79 | .dependencies = featureSet(&[_]Feature{ | 79 | .dependencies = featureSet(&[_]Feature{ |
| 80 | .isa_68040, | 80 | .isa_68040, |
| 81 | }), | 81 | }), |
| 82 | }; | 82 | }; |
| 83 | result[@intFromEnum(Feature.isa_68881)] = .{ | 83 | result[@backingInt(Feature.isa_68881)] = .{ |
| 84 | .llvm_name = "isa-68881", | 84 | .llvm_name = "isa-68881", |
| 85 | .description = "Is M68881 (FPU) ISA supported", | 85 | .description = "Is M68881 (FPU) ISA supported", |
| 86 | .dependencies = featureSet(&[_]Feature{}), | 86 | .dependencies = featureSet(&[_]Feature{}), |
| 87 | }; | 87 | }; |
| 88 | result[@intFromEnum(Feature.isa_68882)] = .{ | 88 | result[@backingInt(Feature.isa_68882)] = .{ |
| 89 | .llvm_name = "isa-68882", | 89 | .llvm_name = "isa-68882", |
| 90 | .description = "Is M68882 (FPU) ISA supported", | 90 | .description = "Is M68882 (FPU) ISA supported", |
| 91 | .dependencies = featureSet(&[_]Feature{ | 91 | .dependencies = featureSet(&[_]Feature{ |
| 92 | .isa_68881, | 92 | .isa_68881, |
| 93 | }), | 93 | }), |
| 94 | }; | 94 | }; |
| 95 | result[@intFromEnum(Feature.reserve_a0)] = .{ | 95 | result[@backingInt(Feature.reserve_a0)] = .{ |
| 96 | .llvm_name = "reserve-a0", | 96 | .llvm_name = "reserve-a0", |
| 97 | .description = "Reserve A0 register", | 97 | .description = "Reserve A0 register", |
| 98 | .dependencies = featureSet(&[_]Feature{}), | 98 | .dependencies = featureSet(&[_]Feature{}), |
| 99 | }; | 99 | }; |
| 100 | result[@intFromEnum(Feature.reserve_a1)] = .{ | 100 | result[@backingInt(Feature.reserve_a1)] = .{ |
| 101 | .llvm_name = "reserve-a1", | 101 | .llvm_name = "reserve-a1", |
| 102 | .description = "Reserve A1 register", | 102 | .description = "Reserve A1 register", |
| 103 | .dependencies = featureSet(&[_]Feature{}), | 103 | .dependencies = featureSet(&[_]Feature{}), |
| 104 | }; | 104 | }; |
| 105 | result[@intFromEnum(Feature.reserve_a2)] = .{ | 105 | result[@backingInt(Feature.reserve_a2)] = .{ |
| 106 | .llvm_name = "reserve-a2", | 106 | .llvm_name = "reserve-a2", |
| 107 | .description = "Reserve A2 register", | 107 | .description = "Reserve A2 register", |
| 108 | .dependencies = featureSet(&[_]Feature{}), | 108 | .dependencies = featureSet(&[_]Feature{}), |
| 109 | }; | 109 | }; |
| 110 | result[@intFromEnum(Feature.reserve_a3)] = .{ | 110 | result[@backingInt(Feature.reserve_a3)] = .{ |
| 111 | .llvm_name = "reserve-a3", | 111 | .llvm_name = "reserve-a3", |
| 112 | .description = "Reserve A3 register", | 112 | .description = "Reserve A3 register", |
| 113 | .dependencies = featureSet(&[_]Feature{}), | 113 | .dependencies = featureSet(&[_]Feature{}), |
| 114 | }; | 114 | }; |
| 115 | result[@intFromEnum(Feature.reserve_a4)] = .{ | 115 | result[@backingInt(Feature.reserve_a4)] = .{ |
| 116 | .llvm_name = "reserve-a4", | 116 | .llvm_name = "reserve-a4", |
| 117 | .description = "Reserve A4 register", | 117 | .description = "Reserve A4 register", |
| 118 | .dependencies = featureSet(&[_]Feature{}), | 118 | .dependencies = featureSet(&[_]Feature{}), |
| 119 | }; | 119 | }; |
| 120 | result[@intFromEnum(Feature.reserve_a5)] = .{ | 120 | result[@backingInt(Feature.reserve_a5)] = .{ |
| 121 | .llvm_name = "reserve-a5", | 121 | .llvm_name = "reserve-a5", |
| 122 | .description = "Reserve A5 register", | 122 | .description = "Reserve A5 register", |
| 123 | .dependencies = featureSet(&[_]Feature{}), | 123 | .dependencies = featureSet(&[_]Feature{}), |
| 124 | }; | 124 | }; |
| 125 | result[@intFromEnum(Feature.reserve_a6)] = .{ | 125 | result[@backingInt(Feature.reserve_a6)] = .{ |
| 126 | .llvm_name = "reserve-a6", | 126 | .llvm_name = "reserve-a6", |
| 127 | .description = "Reserve A6 register", | 127 | .description = "Reserve A6 register", |
| 128 | .dependencies = featureSet(&[_]Feature{}), | 128 | .dependencies = featureSet(&[_]Feature{}), |
| 129 | }; | 129 | }; |
| 130 | result[@intFromEnum(Feature.reserve_d0)] = .{ | 130 | result[@backingInt(Feature.reserve_d0)] = .{ |
| 131 | .llvm_name = "reserve-d0", | 131 | .llvm_name = "reserve-d0", |
| 132 | .description = "Reserve D0 register", | 132 | .description = "Reserve D0 register", |
| 133 | .dependencies = featureSet(&[_]Feature{}), | 133 | .dependencies = featureSet(&[_]Feature{}), |
| 134 | }; | 134 | }; |
| 135 | result[@intFromEnum(Feature.reserve_d1)] = .{ | 135 | result[@backingInt(Feature.reserve_d1)] = .{ |
| 136 | .llvm_name = "reserve-d1", | 136 | .llvm_name = "reserve-d1", |
| 137 | .description = "Reserve D1 register", | 137 | .description = "Reserve D1 register", |
| 138 | .dependencies = featureSet(&[_]Feature{}), | 138 | .dependencies = featureSet(&[_]Feature{}), |
| 139 | }; | 139 | }; |
| 140 | result[@intFromEnum(Feature.reserve_d2)] = .{ | 140 | result[@backingInt(Feature.reserve_d2)] = .{ |
| 141 | .llvm_name = "reserve-d2", | 141 | .llvm_name = "reserve-d2", |
| 142 | .description = "Reserve D2 register", | 142 | .description = "Reserve D2 register", |
| 143 | .dependencies = featureSet(&[_]Feature{}), | 143 | .dependencies = featureSet(&[_]Feature{}), |
| 144 | }; | 144 | }; |
| 145 | result[@intFromEnum(Feature.reserve_d3)] = .{ | 145 | result[@backingInt(Feature.reserve_d3)] = .{ |
| 146 | .llvm_name = "reserve-d3", | 146 | .llvm_name = "reserve-d3", |
| 147 | .description = "Reserve D3 register", | 147 | .description = "Reserve D3 register", |
| 148 | .dependencies = featureSet(&[_]Feature{}), | 148 | .dependencies = featureSet(&[_]Feature{}), |
| 149 | }; | 149 | }; |
| 150 | result[@intFromEnum(Feature.reserve_d4)] = .{ | 150 | result[@backingInt(Feature.reserve_d4)] = .{ |
| 151 | .llvm_name = "reserve-d4", | 151 | .llvm_name = "reserve-d4", |
| 152 | .description = "Reserve D4 register", | 152 | .description = "Reserve D4 register", |
| 153 | .dependencies = featureSet(&[_]Feature{}), | 153 | .dependencies = featureSet(&[_]Feature{}), |
| 154 | }; | 154 | }; |
| 155 | result[@intFromEnum(Feature.reserve_d5)] = .{ | 155 | result[@backingInt(Feature.reserve_d5)] = .{ |
| 156 | .llvm_name = "reserve-d5", | 156 | .llvm_name = "reserve-d5", |
| 157 | .description = "Reserve D5 register", | 157 | .description = "Reserve D5 register", |
| 158 | .dependencies = featureSet(&[_]Feature{}), | 158 | .dependencies = featureSet(&[_]Feature{}), |
| 159 | }; | 159 | }; |
| 160 | result[@intFromEnum(Feature.reserve_d6)] = .{ | 160 | result[@backingInt(Feature.reserve_d6)] = .{ |
| 161 | .llvm_name = "reserve-d6", | 161 | .llvm_name = "reserve-d6", |
| 162 | .description = "Reserve D6 register", | 162 | .description = "Reserve D6 register", |
| 163 | .dependencies = featureSet(&[_]Feature{}), | 163 | .dependencies = featureSet(&[_]Feature{}), |
| 164 | }; | 164 | }; |
| 165 | result[@intFromEnum(Feature.reserve_d7)] = .{ | 165 | result[@backingInt(Feature.reserve_d7)] = .{ |
| 166 | .llvm_name = "reserve-d7", | 166 | .llvm_name = "reserve-d7", |
| 167 | .description = "Reserve D7 register", | 167 | .description = "Reserve D7 register", |
| 168 | .dependencies = featureSet(&[_]Feature{}), | 168 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/mips.zig+57-57| ... | @@ -73,75 +73,75 @@ pub const all_features = blk: { | ... | @@ -73,75 +73,75 @@ pub const all_features = blk: { |
| 73 | const len = @typeInfo(Feature).@"enum".field_names.len; | 73 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 74 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 74 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 75 | var result: [len]CpuFeature = undefined; | 75 | var result: [len]CpuFeature = undefined; |
| 76 | result[@intFromEnum(Feature.abs2008)] = .{ | 76 | result[@backingInt(Feature.abs2008)] = .{ |
| 77 | .llvm_name = "abs2008", | 77 | .llvm_name = "abs2008", |
| 78 | .description = "Disable IEEE 754-2008 abs.fmt mode", | 78 | .description = "Disable IEEE 754-2008 abs.fmt mode", |
| 79 | .dependencies = featureSet(&[_]Feature{}), | 79 | .dependencies = featureSet(&[_]Feature{}), |
| 80 | }; | 80 | }; |
| 81 | result[@intFromEnum(Feature.cnmips)] = .{ | 81 | result[@backingInt(Feature.cnmips)] = .{ |
| 82 | .llvm_name = "cnmips", | 82 | .llvm_name = "cnmips", |
| 83 | .description = "Octeon cnMIPS Support", | 83 | .description = "Octeon cnMIPS Support", |
| 84 | .dependencies = featureSet(&[_]Feature{ | 84 | .dependencies = featureSet(&[_]Feature{ |
| 85 | .mips64r2, | 85 | .mips64r2, |
| 86 | }), | 86 | }), |
| 87 | }; | 87 | }; |
| 88 | result[@intFromEnum(Feature.cnmipsp)] = .{ | 88 | result[@backingInt(Feature.cnmipsp)] = .{ |
| 89 | .llvm_name = "cnmipsp", | 89 | .llvm_name = "cnmipsp", |
| 90 | .description = "Octeon+ cnMIPS Support", | 90 | .description = "Octeon+ cnMIPS Support", |
| 91 | .dependencies = featureSet(&[_]Feature{ | 91 | .dependencies = featureSet(&[_]Feature{ |
| 92 | .cnmips, | 92 | .cnmips, |
| 93 | }), | 93 | }), |
| 94 | }; | 94 | }; |
| 95 | result[@intFromEnum(Feature.crc)] = .{ | 95 | result[@backingInt(Feature.crc)] = .{ |
| 96 | .llvm_name = "crc", | 96 | .llvm_name = "crc", |
| 97 | .description = "Mips R6 CRC ASE", | 97 | .description = "Mips R6 CRC ASE", |
| 98 | .dependencies = featureSet(&[_]Feature{}), | 98 | .dependencies = featureSet(&[_]Feature{}), |
| 99 | }; | 99 | }; |
| 100 | result[@intFromEnum(Feature.dsp)] = .{ | 100 | result[@backingInt(Feature.dsp)] = .{ |
| 101 | .llvm_name = "dsp", | 101 | .llvm_name = "dsp", |
| 102 | .description = "Mips DSP ASE", | 102 | .description = "Mips DSP ASE", |
| 103 | .dependencies = featureSet(&[_]Feature{}), | 103 | .dependencies = featureSet(&[_]Feature{}), |
| 104 | }; | 104 | }; |
| 105 | result[@intFromEnum(Feature.dspr2)] = .{ | 105 | result[@backingInt(Feature.dspr2)] = .{ |
| 106 | .llvm_name = "dspr2", | 106 | .llvm_name = "dspr2", |
| 107 | .description = "Mips DSP-R2 ASE", | 107 | .description = "Mips DSP-R2 ASE", |
| 108 | .dependencies = featureSet(&[_]Feature{ | 108 | .dependencies = featureSet(&[_]Feature{ |
| 109 | .dsp, | 109 | .dsp, |
| 110 | }), | 110 | }), |
| 111 | }; | 111 | }; |
| 112 | result[@intFromEnum(Feature.dspr3)] = .{ | 112 | result[@backingInt(Feature.dspr3)] = .{ |
| 113 | .llvm_name = "dspr3", | 113 | .llvm_name = "dspr3", |
| 114 | .description = "Mips DSP-R3 ASE", | 114 | .description = "Mips DSP-R3 ASE", |
| 115 | .dependencies = featureSet(&[_]Feature{ | 115 | .dependencies = featureSet(&[_]Feature{ |
| 116 | .dspr2, | 116 | .dspr2, |
| 117 | }), | 117 | }), |
| 118 | }; | 118 | }; |
| 119 | result[@intFromEnum(Feature.eva)] = .{ | 119 | result[@backingInt(Feature.eva)] = .{ |
| 120 | .llvm_name = "eva", | 120 | .llvm_name = "eva", |
| 121 | .description = "Mips EVA ASE", | 121 | .description = "Mips EVA ASE", |
| 122 | .dependencies = featureSet(&[_]Feature{}), | 122 | .dependencies = featureSet(&[_]Feature{}), |
| 123 | }; | 123 | }; |
| 124 | result[@intFromEnum(Feature.fp64)] = .{ | 124 | result[@backingInt(Feature.fp64)] = .{ |
| 125 | .llvm_name = "fp64", | 125 | .llvm_name = "fp64", |
| 126 | .description = "Support 64-bit FP registers", | 126 | .description = "Support 64-bit FP registers", |
| 127 | .dependencies = featureSet(&[_]Feature{}), | 127 | .dependencies = featureSet(&[_]Feature{}), |
| 128 | }; | 128 | }; |
| 129 | result[@intFromEnum(Feature.fpxx)] = .{ | 129 | result[@backingInt(Feature.fpxx)] = .{ |
| 130 | .llvm_name = "fpxx", | 130 | .llvm_name = "fpxx", |
| 131 | .description = "Support for FPXX", | 131 | .description = "Support for FPXX", |
| 132 | .dependencies = featureSet(&[_]Feature{}), | 132 | .dependencies = featureSet(&[_]Feature{}), |
| 133 | }; | 133 | }; |
| 134 | result[@intFromEnum(Feature.ginv)] = .{ | 134 | result[@backingInt(Feature.ginv)] = .{ |
| 135 | .llvm_name = "ginv", | 135 | .llvm_name = "ginv", |
| 136 | .description = "Mips Global Invalidate ASE", | 136 | .description = "Mips Global Invalidate ASE", |
| 137 | .dependencies = featureSet(&[_]Feature{}), | 137 | .dependencies = featureSet(&[_]Feature{}), |
| 138 | }; | 138 | }; |
| 139 | result[@intFromEnum(Feature.gp64)] = .{ | 139 | result[@backingInt(Feature.gp64)] = .{ |
| 140 | .llvm_name = "gp64", | 140 | .llvm_name = "gp64", |
| 141 | .description = "General Purpose Registers are 64-bit wide", | 141 | .description = "General Purpose Registers are 64-bit wide", |
| 142 | .dependencies = featureSet(&[_]Feature{}), | 142 | .dependencies = featureSet(&[_]Feature{}), |
| 143 | }; | 143 | }; |
| 144 | result[@intFromEnum(Feature.i6400)] = .{ | 144 | result[@backingInt(Feature.i6400)] = .{ |
| 145 | .llvm_name = "i6400", | 145 | .llvm_name = "i6400", |
| 146 | .description = "MIPS I6400 Processor", | 146 | .description = "MIPS I6400 Processor", |
| 147 | .dependencies = featureSet(&[_]Feature{ | 147 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -149,7 +149,7 @@ pub const all_features = blk: { | ... | @@ -149,7 +149,7 @@ pub const all_features = blk: { |
| 149 | .msa, | 149 | .msa, |
| 150 | }), | 150 | }), |
| 151 | }; | 151 | }; |
| 152 | result[@intFromEnum(Feature.i6500)] = .{ | 152 | result[@backingInt(Feature.i6500)] = .{ |
| 153 | .llvm_name = "i6500", | 153 | .llvm_name = "i6500", |
| 154 | .description = "MIPS I6500 Processor", | 154 | .description = "MIPS I6500 Processor", |
| 155 | .dependencies = featureSet(&[_]Feature{ | 155 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -157,34 +157,34 @@ pub const all_features = blk: { | ... | @@ -157,34 +157,34 @@ pub const all_features = blk: { |
| 157 | .msa, | 157 | .msa, |
| 158 | }), | 158 | }), |
| 159 | }; | 159 | }; |
| 160 | result[@intFromEnum(Feature.long_calls)] = .{ | 160 | result[@backingInt(Feature.long_calls)] = .{ |
| 161 | .llvm_name = "long-calls", | 161 | .llvm_name = "long-calls", |
| 162 | .description = "Disable use of the jal instruction", | 162 | .description = "Disable use of the jal instruction", |
| 163 | .dependencies = featureSet(&[_]Feature{}), | 163 | .dependencies = featureSet(&[_]Feature{}), |
| 164 | }; | 164 | }; |
| 165 | result[@intFromEnum(Feature.micromips)] = .{ | 165 | result[@backingInt(Feature.micromips)] = .{ |
| 166 | .llvm_name = "micromips", | 166 | .llvm_name = "micromips", |
| 167 | .description = "microMips mode", | 167 | .description = "microMips mode", |
| 168 | .dependencies = featureSet(&[_]Feature{}), | 168 | .dependencies = featureSet(&[_]Feature{}), |
| 169 | }; | 169 | }; |
| 170 | result[@intFromEnum(Feature.mips1)] = .{ | 170 | result[@backingInt(Feature.mips1)] = .{ |
| 171 | .llvm_name = "mips1", | 171 | .llvm_name = "mips1", |
| 172 | .description = "Mips I ISA Support [highly experimental]", | 172 | .description = "Mips I ISA Support [highly experimental]", |
| 173 | .dependencies = featureSet(&[_]Feature{}), | 173 | .dependencies = featureSet(&[_]Feature{}), |
| 174 | }; | 174 | }; |
| 175 | result[@intFromEnum(Feature.mips16)] = .{ | 175 | result[@backingInt(Feature.mips16)] = .{ |
| 176 | .llvm_name = "mips16", | 176 | .llvm_name = "mips16", |
| 177 | .description = "Mips16 mode", | 177 | .description = "Mips16 mode", |
| 178 | .dependencies = featureSet(&[_]Feature{}), | 178 | .dependencies = featureSet(&[_]Feature{}), |
| 179 | }; | 179 | }; |
| 180 | result[@intFromEnum(Feature.mips2)] = .{ | 180 | result[@backingInt(Feature.mips2)] = .{ |
| 181 | .llvm_name = "mips2", | 181 | .llvm_name = "mips2", |
| 182 | .description = "Mips II ISA Support [highly experimental]", | 182 | .description = "Mips II ISA Support [highly experimental]", |
| 183 | .dependencies = featureSet(&[_]Feature{ | 183 | .dependencies = featureSet(&[_]Feature{ |
| 184 | .mips1, | 184 | .mips1, |
| 185 | }), | 185 | }), |
| 186 | }; | 186 | }; |
| 187 | result[@intFromEnum(Feature.mips3)] = .{ | 187 | result[@backingInt(Feature.mips3)] = .{ |
| 188 | .llvm_name = "mips3", | 188 | .llvm_name = "mips3", |
| 189 | .description = "MIPS III ISA Support [highly experimental]", | 189 | .description = "MIPS III ISA Support [highly experimental]", |
| 190 | .dependencies = featureSet(&[_]Feature{ | 190 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -195,7 +195,7 @@ pub const all_features = blk: { | ... | @@ -195,7 +195,7 @@ pub const all_features = blk: { |
| 195 | .mips3_32r2, | 195 | .mips3_32r2, |
| 196 | }), | 196 | }), |
| 197 | }; | 197 | }; |
| 198 | result[@intFromEnum(Feature.mips32)] = .{ | 198 | result[@backingInt(Feature.mips32)] = .{ |
| 199 | .llvm_name = "mips32", | 199 | .llvm_name = "mips32", |
| 200 | .description = "Mips32 ISA Support", | 200 | .description = "Mips32 ISA Support", |
| 201 | .dependencies = featureSet(&[_]Feature{ | 201 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -204,7 +204,7 @@ pub const all_features = blk: { | ... | @@ -204,7 +204,7 @@ pub const all_features = blk: { |
| 204 | .mips4_32, | 204 | .mips4_32, |
| 205 | }), | 205 | }), |
| 206 | }; | 206 | }; |
| 207 | result[@intFromEnum(Feature.mips32r2)] = .{ | 207 | result[@backingInt(Feature.mips32r2)] = .{ |
| 208 | .llvm_name = "mips32r2", | 208 | .llvm_name = "mips32r2", |
| 209 | .description = "Mips32r2 ISA Support", | 209 | .description = "Mips32r2 ISA Support", |
| 210 | .dependencies = featureSet(&[_]Feature{ | 210 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -214,21 +214,21 @@ pub const all_features = blk: { | ... | @@ -214,21 +214,21 @@ pub const all_features = blk: { |
| 214 | .mips5_32r2, | 214 | .mips5_32r2, |
| 215 | }), | 215 | }), |
| 216 | }; | 216 | }; |
| 217 | result[@intFromEnum(Feature.mips32r3)] = .{ | 217 | result[@backingInt(Feature.mips32r3)] = .{ |
| 218 | .llvm_name = "mips32r3", | 218 | .llvm_name = "mips32r3", |
| 219 | .description = "Mips32r3 ISA Support", | 219 | .description = "Mips32r3 ISA Support", |
| 220 | .dependencies = featureSet(&[_]Feature{ | 220 | .dependencies = featureSet(&[_]Feature{ |
| 221 | .mips32r2, | 221 | .mips32r2, |
| 222 | }), | 222 | }), |
| 223 | }; | 223 | }; |
| 224 | result[@intFromEnum(Feature.mips32r5)] = .{ | 224 | result[@backingInt(Feature.mips32r5)] = .{ |
| 225 | .llvm_name = "mips32r5", | 225 | .llvm_name = "mips32r5", |
| 226 | .description = "Mips32r5 ISA Support", | 226 | .description = "Mips32r5 ISA Support", |
| 227 | .dependencies = featureSet(&[_]Feature{ | 227 | .dependencies = featureSet(&[_]Feature{ |
| 228 | .mips32r3, | 228 | .mips32r3, |
| 229 | }), | 229 | }), |
| 230 | }; | 230 | }; |
| 231 | result[@intFromEnum(Feature.mips32r6)] = .{ | 231 | result[@backingInt(Feature.mips32r6)] = .{ |
| 232 | .llvm_name = "mips32r6", | 232 | .llvm_name = "mips32r6", |
| 233 | .description = "Mips32r6 ISA Support [experimental]", | 233 | .description = "Mips32r6 ISA Support [experimental]", |
| 234 | .dependencies = featureSet(&[_]Feature{ | 234 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -238,22 +238,22 @@ pub const all_features = blk: { | ... | @@ -238,22 +238,22 @@ pub const all_features = blk: { |
| 238 | .nan2008, | 238 | .nan2008, |
| 239 | }), | 239 | }), |
| 240 | }; | 240 | }; |
| 241 | result[@intFromEnum(Feature.mips3_32)] = .{ | 241 | result[@backingInt(Feature.mips3_32)] = .{ |
| 242 | .llvm_name = "mips3_32", | 242 | .llvm_name = "mips3_32", |
| 243 | .description = "Subset of MIPS-III that is also in MIPS32 [highly experimental]", | 243 | .description = "Subset of MIPS-III that is also in MIPS32 [highly experimental]", |
| 244 | .dependencies = featureSet(&[_]Feature{}), | 244 | .dependencies = featureSet(&[_]Feature{}), |
| 245 | }; | 245 | }; |
| 246 | result[@intFromEnum(Feature.mips3_32r2)] = .{ | 246 | result[@backingInt(Feature.mips3_32r2)] = .{ |
| 247 | .llvm_name = "mips3_32r2", | 247 | .llvm_name = "mips3_32r2", |
| 248 | .description = "Subset of MIPS-III that is also in MIPS32r2 [highly experimental]", | 248 | .description = "Subset of MIPS-III that is also in MIPS32r2 [highly experimental]", |
| 249 | .dependencies = featureSet(&[_]Feature{}), | 249 | .dependencies = featureSet(&[_]Feature{}), |
| 250 | }; | 250 | }; |
| 251 | result[@intFromEnum(Feature.mips3d)] = .{ | 251 | result[@backingInt(Feature.mips3d)] = .{ |
| 252 | .llvm_name = "mips3d", | 252 | .llvm_name = "mips3d", |
| 253 | .description = "Mips 3D ASE", | 253 | .description = "Mips 3D ASE", |
| 254 | .dependencies = featureSet(&[_]Feature{}), | 254 | .dependencies = featureSet(&[_]Feature{}), |
| 255 | }; | 255 | }; |
| 256 | result[@intFromEnum(Feature.mips4)] = .{ | 256 | result[@backingInt(Feature.mips4)] = .{ |
| 257 | .llvm_name = "mips4", | 257 | .llvm_name = "mips4", |
| 258 | .description = "MIPS IV ISA Support", | 258 | .description = "MIPS IV ISA Support", |
| 259 | .dependencies = featureSet(&[_]Feature{ | 259 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -262,17 +262,17 @@ pub const all_features = blk: { | ... | @@ -262,17 +262,17 @@ pub const all_features = blk: { |
| 262 | .mips4_32r2, | 262 | .mips4_32r2, |
| 263 | }), | 263 | }), |
| 264 | }; | 264 | }; |
| 265 | result[@intFromEnum(Feature.mips4_32)] = .{ | 265 | result[@backingInt(Feature.mips4_32)] = .{ |
| 266 | .llvm_name = "mips4_32", | 266 | .llvm_name = "mips4_32", |
| 267 | .description = "Subset of MIPS-IV that is also in MIPS32 [highly experimental]", | 267 | .description = "Subset of MIPS-IV that is also in MIPS32 [highly experimental]", |
| 268 | .dependencies = featureSet(&[_]Feature{}), | 268 | .dependencies = featureSet(&[_]Feature{}), |
| 269 | }; | 269 | }; |
| 270 | result[@intFromEnum(Feature.mips4_32r2)] = .{ | 270 | result[@backingInt(Feature.mips4_32r2)] = .{ |
| 271 | .llvm_name = "mips4_32r2", | 271 | .llvm_name = "mips4_32r2", |
| 272 | .description = "Subset of MIPS-IV that is also in MIPS32r2 [highly experimental]", | 272 | .description = "Subset of MIPS-IV that is also in MIPS32r2 [highly experimental]", |
| 273 | .dependencies = featureSet(&[_]Feature{}), | 273 | .dependencies = featureSet(&[_]Feature{}), |
| 274 | }; | 274 | }; |
| 275 | result[@intFromEnum(Feature.mips5)] = .{ | 275 | result[@backingInt(Feature.mips5)] = .{ |
| 276 | .llvm_name = "mips5", | 276 | .llvm_name = "mips5", |
| 277 | .description = "MIPS V ISA Support [highly experimental]", | 277 | .description = "MIPS V ISA Support [highly experimental]", |
| 278 | .dependencies = featureSet(&[_]Feature{ | 278 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -280,12 +280,12 @@ pub const all_features = blk: { | ... | @@ -280,12 +280,12 @@ pub const all_features = blk: { |
| 280 | .mips5_32r2, | 280 | .mips5_32r2, |
| 281 | }), | 281 | }), |
| 282 | }; | 282 | }; |
| 283 | result[@intFromEnum(Feature.mips5_32r2)] = .{ | 283 | result[@backingInt(Feature.mips5_32r2)] = .{ |
| 284 | .llvm_name = "mips5_32r2", | 284 | .llvm_name = "mips5_32r2", |
| 285 | .description = "Subset of MIPS-V that is also in MIPS32r2 [highly experimental]", | 285 | .description = "Subset of MIPS-V that is also in MIPS32r2 [highly experimental]", |
| 286 | .dependencies = featureSet(&[_]Feature{}), | 286 | .dependencies = featureSet(&[_]Feature{}), |
| 287 | }; | 287 | }; |
| 288 | result[@intFromEnum(Feature.mips64)] = .{ | 288 | result[@backingInt(Feature.mips64)] = .{ |
| 289 | .llvm_name = "mips64", | 289 | .llvm_name = "mips64", |
| 290 | .description = "Mips64 ISA Support", | 290 | .description = "Mips64 ISA Support", |
| 291 | .dependencies = featureSet(&[_]Feature{ | 291 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -293,7 +293,7 @@ pub const all_features = blk: { | ... | @@ -293,7 +293,7 @@ pub const all_features = blk: { |
| 293 | .mips5, | 293 | .mips5, |
| 294 | }), | 294 | }), |
| 295 | }; | 295 | }; |
| 296 | result[@intFromEnum(Feature.mips64r2)] = .{ | 296 | result[@backingInt(Feature.mips64r2)] = .{ |
| 297 | .llvm_name = "mips64r2", | 297 | .llvm_name = "mips64r2", |
| 298 | .description = "Mips64r2 ISA Support", | 298 | .description = "Mips64r2 ISA Support", |
| 299 | .dependencies = featureSet(&[_]Feature{ | 299 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -301,7 +301,7 @@ pub const all_features = blk: { | ... | @@ -301,7 +301,7 @@ pub const all_features = blk: { |
| 301 | .mips64, | 301 | .mips64, |
| 302 | }), | 302 | }), |
| 303 | }; | 303 | }; |
| 304 | result[@intFromEnum(Feature.mips64r3)] = .{ | 304 | result[@backingInt(Feature.mips64r3)] = .{ |
| 305 | .llvm_name = "mips64r3", | 305 | .llvm_name = "mips64r3", |
| 306 | .description = "Mips64r3 ISA Support", | 306 | .description = "Mips64r3 ISA Support", |
| 307 | .dependencies = featureSet(&[_]Feature{ | 307 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -309,7 +309,7 @@ pub const all_features = blk: { | ... | @@ -309,7 +309,7 @@ pub const all_features = blk: { |
| 309 | .mips64r2, | 309 | .mips64r2, |
| 310 | }), | 310 | }), |
| 311 | }; | 311 | }; |
| 312 | result[@intFromEnum(Feature.mips64r5)] = .{ | 312 | result[@backingInt(Feature.mips64r5)] = .{ |
| 313 | .llvm_name = "mips64r5", | 313 | .llvm_name = "mips64r5", |
| 314 | .description = "Mips64r5 ISA Support", | 314 | .description = "Mips64r5 ISA Support", |
| 315 | .dependencies = featureSet(&[_]Feature{ | 315 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -317,7 +317,7 @@ pub const all_features = blk: { | ... | @@ -317,7 +317,7 @@ pub const all_features = blk: { |
| 317 | .mips64r3, | 317 | .mips64r3, |
| 318 | }), | 318 | }), |
| 319 | }; | 319 | }; |
| 320 | result[@intFromEnum(Feature.mips64r6)] = .{ | 320 | result[@backingInt(Feature.mips64r6)] = .{ |
| 321 | .llvm_name = "mips64r6", | 321 | .llvm_name = "mips64r6", |
| 322 | .description = "Mips64r6 ISA Support [experimental]", | 322 | .description = "Mips64r6 ISA Support [experimental]", |
| 323 | .dependencies = featureSet(&[_]Feature{ | 323 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -325,99 +325,99 @@ pub const all_features = blk: { | ... | @@ -325,99 +325,99 @@ pub const all_features = blk: { |
| 325 | .mips64r5, | 325 | .mips64r5, |
| 326 | }), | 326 | }), |
| 327 | }; | 327 | }; |
| 328 | result[@intFromEnum(Feature.msa)] = .{ | 328 | result[@backingInt(Feature.msa)] = .{ |
| 329 | .llvm_name = "msa", | 329 | .llvm_name = "msa", |
| 330 | .description = "Mips MSA ASE", | 330 | .description = "Mips MSA ASE", |
| 331 | .dependencies = featureSet(&[_]Feature{}), | 331 | .dependencies = featureSet(&[_]Feature{}), |
| 332 | }; | 332 | }; |
| 333 | result[@intFromEnum(Feature.mt)] = .{ | 333 | result[@backingInt(Feature.mt)] = .{ |
| 334 | .llvm_name = "mt", | 334 | .llvm_name = "mt", |
| 335 | .description = "Mips MT ASE", | 335 | .description = "Mips MT ASE", |
| 336 | .dependencies = featureSet(&[_]Feature{}), | 336 | .dependencies = featureSet(&[_]Feature{}), |
| 337 | }; | 337 | }; |
| 338 | result[@intFromEnum(Feature.nan2008)] = .{ | 338 | result[@backingInt(Feature.nan2008)] = .{ |
| 339 | .llvm_name = "nan2008", | 339 | .llvm_name = "nan2008", |
| 340 | .description = "IEEE 754-2008 NaN encoding", | 340 | .description = "IEEE 754-2008 NaN encoding", |
| 341 | .dependencies = featureSet(&[_]Feature{}), | 341 | .dependencies = featureSet(&[_]Feature{}), |
| 342 | }; | 342 | }; |
| 343 | result[@intFromEnum(Feature.noabicalls)] = .{ | 343 | result[@backingInt(Feature.noabicalls)] = .{ |
| 344 | .llvm_name = "noabicalls", | 344 | .llvm_name = "noabicalls", |
| 345 | .description = "Disable SVR4-style position-independent code", | 345 | .description = "Disable SVR4-style position-independent code", |
| 346 | .dependencies = featureSet(&[_]Feature{}), | 346 | .dependencies = featureSet(&[_]Feature{}), |
| 347 | }; | 347 | }; |
| 348 | result[@intFromEnum(Feature.nomadd4)] = .{ | 348 | result[@backingInt(Feature.nomadd4)] = .{ |
| 349 | .llvm_name = "nomadd4", | 349 | .llvm_name = "nomadd4", |
| 350 | .description = "Disable 4-operand madd.fmt and related instructions", | 350 | .description = "Disable 4-operand madd.fmt and related instructions", |
| 351 | .dependencies = featureSet(&[_]Feature{}), | 351 | .dependencies = featureSet(&[_]Feature{}), |
| 352 | }; | 352 | }; |
| 353 | result[@intFromEnum(Feature.nooddspreg)] = .{ | 353 | result[@backingInt(Feature.nooddspreg)] = .{ |
| 354 | .llvm_name = "nooddspreg", | 354 | .llvm_name = "nooddspreg", |
| 355 | .description = "Disable odd numbered single-precision registers", | 355 | .description = "Disable odd numbered single-precision registers", |
| 356 | .dependencies = featureSet(&[_]Feature{}), | 356 | .dependencies = featureSet(&[_]Feature{}), |
| 357 | }; | 357 | }; |
| 358 | result[@intFromEnum(Feature.notraps)] = .{ | 358 | result[@backingInt(Feature.notraps)] = .{ |
| 359 | .llvm_name = null, | 359 | .llvm_name = null, |
| 360 | .description = "Disable trap instructions", | 360 | .description = "Disable trap instructions", |
| 361 | .dependencies = featureSet(&[_]Feature{}), | 361 | .dependencies = featureSet(&[_]Feature{}), |
| 362 | }; | 362 | }; |
| 363 | result[@intFromEnum(Feature.p5600)] = .{ | 363 | result[@backingInt(Feature.p5600)] = .{ |
| 364 | .llvm_name = "p5600", | 364 | .llvm_name = "p5600", |
| 365 | .description = "The P5600 Processor", | 365 | .description = "The P5600 Processor", |
| 366 | .dependencies = featureSet(&[_]Feature{ | 366 | .dependencies = featureSet(&[_]Feature{ |
| 367 | .mips32r5, | 367 | .mips32r5, |
| 368 | }), | 368 | }), |
| 369 | }; | 369 | }; |
| 370 | result[@intFromEnum(Feature.ptr64)] = .{ | 370 | result[@backingInt(Feature.ptr64)] = .{ |
| 371 | .llvm_name = "ptr64", | 371 | .llvm_name = "ptr64", |
| 372 | .description = "Pointers are 64-bit wide", | 372 | .description = "Pointers are 64-bit wide", |
| 373 | .dependencies = featureSet(&[_]Feature{}), | 373 | .dependencies = featureSet(&[_]Feature{}), |
| 374 | }; | 374 | }; |
| 375 | result[@intFromEnum(Feature.single_float)] = .{ | 375 | result[@backingInt(Feature.single_float)] = .{ |
| 376 | .llvm_name = "single-float", | 376 | .llvm_name = "single-float", |
| 377 | .description = "Only supports single precision float", | 377 | .description = "Only supports single precision float", |
| 378 | .dependencies = featureSet(&[_]Feature{}), | 378 | .dependencies = featureSet(&[_]Feature{}), |
| 379 | }; | 379 | }; |
| 380 | result[@intFromEnum(Feature.soft_float)] = .{ | 380 | result[@backingInt(Feature.soft_float)] = .{ |
| 381 | .llvm_name = "soft-float", | 381 | .llvm_name = "soft-float", |
| 382 | .description = "Does not support floating point instructions", | 382 | .description = "Does not support floating point instructions", |
| 383 | .dependencies = featureSet(&[_]Feature{}), | 383 | .dependencies = featureSet(&[_]Feature{}), |
| 384 | }; | 384 | }; |
| 385 | result[@intFromEnum(Feature.strict_align)] = .{ | 385 | result[@backingInt(Feature.strict_align)] = .{ |
| 386 | .llvm_name = "strict-align", | 386 | .llvm_name = "strict-align", |
| 387 | .description = "Disable unaligned load store for r6", | 387 | .description = "Disable unaligned load store for r6", |
| 388 | .dependencies = featureSet(&[_]Feature{}), | 388 | .dependencies = featureSet(&[_]Feature{}), |
| 389 | }; | 389 | }; |
| 390 | result[@intFromEnum(Feature.sym32)] = .{ | 390 | result[@backingInt(Feature.sym32)] = .{ |
| 391 | .llvm_name = "sym32", | 391 | .llvm_name = "sym32", |
| 392 | .description = "Symbols are 32 bit on Mips64", | 392 | .description = "Symbols are 32 bit on Mips64", |
| 393 | .dependencies = featureSet(&[_]Feature{}), | 393 | .dependencies = featureSet(&[_]Feature{}), |
| 394 | }; | 394 | }; |
| 395 | result[@intFromEnum(Feature.use_compact_branches)] = .{ | 395 | result[@backingInt(Feature.use_compact_branches)] = .{ |
| 396 | .llvm_name = "use-compact-branches", | 396 | .llvm_name = "use-compact-branches", |
| 397 | .description = "Use compact branch instructions for MIPS32R6/MIPS64R6", | 397 | .description = "Use compact branch instructions for MIPS32R6/MIPS64R6", |
| 398 | .dependencies = featureSet(&[_]Feature{}), | 398 | .dependencies = featureSet(&[_]Feature{}), |
| 399 | }; | 399 | }; |
| 400 | result[@intFromEnum(Feature.use_indirect_jump_hazard)] = .{ | 400 | result[@backingInt(Feature.use_indirect_jump_hazard)] = .{ |
| 401 | .llvm_name = "use-indirect-jump-hazard", | 401 | .llvm_name = "use-indirect-jump-hazard", |
| 402 | .description = "Use indirect jump guards to prevent certain speculation based attacks", | 402 | .description = "Use indirect jump guards to prevent certain speculation based attacks", |
| 403 | .dependencies = featureSet(&[_]Feature{}), | 403 | .dependencies = featureSet(&[_]Feature{}), |
| 404 | }; | 404 | }; |
| 405 | result[@intFromEnum(Feature.use_tcc_in_div)] = .{ | 405 | result[@backingInt(Feature.use_tcc_in_div)] = .{ |
| 406 | .llvm_name = "use-tcc-in-div", | 406 | .llvm_name = "use-tcc-in-div", |
| 407 | .description = "Force the assembler to use trapping", | 407 | .description = "Force the assembler to use trapping", |
| 408 | .dependencies = featureSet(&[_]Feature{}), | 408 | .dependencies = featureSet(&[_]Feature{}), |
| 409 | }; | 409 | }; |
| 410 | result[@intFromEnum(Feature.vfpu)] = .{ | 410 | result[@backingInt(Feature.vfpu)] = .{ |
| 411 | .llvm_name = "vfpu", | 411 | .llvm_name = "vfpu", |
| 412 | .description = "Enable vector FPU instructions", | 412 | .description = "Enable vector FPU instructions", |
| 413 | .dependencies = featureSet(&[_]Feature{}), | 413 | .dependencies = featureSet(&[_]Feature{}), |
| 414 | }; | 414 | }; |
| 415 | result[@intFromEnum(Feature.virt)] = .{ | 415 | result[@backingInt(Feature.virt)] = .{ |
| 416 | .llvm_name = "virt", | 416 | .llvm_name = "virt", |
| 417 | .description = "Mips Virtualization ASE", | 417 | .description = "Mips Virtualization ASE", |
| 418 | .dependencies = featureSet(&[_]Feature{}), | 418 | .dependencies = featureSet(&[_]Feature{}), |
| 419 | }; | 419 | }; |
| 420 | result[@intFromEnum(Feature.xgot)] = .{ | 420 | result[@backingInt(Feature.xgot)] = .{ |
| 421 | .llvm_name = "xgot", | 421 | .llvm_name = "xgot", |
| 422 | .description = "Assume 32-bit GOT", | 422 | .description = "Assume 32-bit GOT", |
| 423 | .dependencies = featureSet(&[_]Feature{}), | 423 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/msp430.zig+4-4| ... | @@ -20,22 +20,22 @@ pub const all_features = blk: { | ... | @@ -20,22 +20,22 @@ pub const all_features = blk: { |
| 20 | const len = @typeInfo(Feature).@"enum".field_names.len; | 20 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 21 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 21 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 22 | var result: [len]CpuFeature = undefined; | 22 | var result: [len]CpuFeature = undefined; |
| 23 | result[@intFromEnum(Feature.ext)] = .{ | 23 | result[@backingInt(Feature.ext)] = .{ |
| 24 | .llvm_name = "ext", | 24 | .llvm_name = "ext", |
| 25 | .description = "Enable MSP430-X extensions", | 25 | .description = "Enable MSP430-X extensions", |
| 26 | .dependencies = featureSet(&[_]Feature{}), | 26 | .dependencies = featureSet(&[_]Feature{}), |
| 27 | }; | 27 | }; |
| 28 | result[@intFromEnum(Feature.hwmult16)] = .{ | 28 | result[@backingInt(Feature.hwmult16)] = .{ |
| 29 | .llvm_name = "hwmult16", | 29 | .llvm_name = "hwmult16", |
| 30 | .description = "Enable 16-bit hardware multiplier", | 30 | .description = "Enable 16-bit hardware multiplier", |
| 31 | .dependencies = featureSet(&[_]Feature{}), | 31 | .dependencies = featureSet(&[_]Feature{}), |
| 32 | }; | 32 | }; |
| 33 | result[@intFromEnum(Feature.hwmult32)] = .{ | 33 | result[@backingInt(Feature.hwmult32)] = .{ |
| 34 | .llvm_name = "hwmult32", | 34 | .llvm_name = "hwmult32", |
| 35 | .description = "Enable 32-bit hardware multiplier", | 35 | .description = "Enable 32-bit hardware multiplier", |
| 36 | .dependencies = featureSet(&[_]Feature{}), | 36 | .dependencies = featureSet(&[_]Feature{}), |
| 37 | }; | 37 | }; |
| 38 | result[@intFromEnum(Feature.hwmultf5)] = .{ | 38 | result[@backingInt(Feature.hwmultf5)] = .{ |
| 39 | .llvm_name = "hwmultf5", | 39 | .llvm_name = "hwmultf5", |
| 40 | .description = "Enable F5 series hardware multiplier", | 40 | .description = "Enable F5 series hardware multiplier", |
| 41 | .dependencies = featureSet(&[_]Feature{}), | 41 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/nvptx.zig+71-71| ... | @@ -87,357 +87,357 @@ pub const all_features = blk: { | ... | @@ -87,357 +87,357 @@ pub const all_features = blk: { |
| 87 | const len = @typeInfo(Feature).@"enum".field_names.len; | 87 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 88 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 88 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 89 | var result: [len]CpuFeature = undefined; | 89 | var result: [len]CpuFeature = undefined; |
| 90 | result[@intFromEnum(Feature.ptx32)] = .{ | 90 | result[@backingInt(Feature.ptx32)] = .{ |
| 91 | .llvm_name = "ptx32", | 91 | .llvm_name = "ptx32", |
| 92 | .description = "Use PTX version 32", | 92 | .description = "Use PTX version 32", |
| 93 | .dependencies = featureSet(&[_]Feature{}), | 93 | .dependencies = featureSet(&[_]Feature{}), |
| 94 | }; | 94 | }; |
| 95 | result[@intFromEnum(Feature.ptx40)] = .{ | 95 | result[@backingInt(Feature.ptx40)] = .{ |
| 96 | .llvm_name = "ptx40", | 96 | .llvm_name = "ptx40", |
| 97 | .description = "Use PTX version 40", | 97 | .description = "Use PTX version 40", |
| 98 | .dependencies = featureSet(&[_]Feature{}), | 98 | .dependencies = featureSet(&[_]Feature{}), |
| 99 | }; | 99 | }; |
| 100 | result[@intFromEnum(Feature.ptx41)] = .{ | 100 | result[@backingInt(Feature.ptx41)] = .{ |
| 101 | .llvm_name = "ptx41", | 101 | .llvm_name = "ptx41", |
| 102 | .description = "Use PTX version 41", | 102 | .description = "Use PTX version 41", |
| 103 | .dependencies = featureSet(&[_]Feature{}), | 103 | .dependencies = featureSet(&[_]Feature{}), |
| 104 | }; | 104 | }; |
| 105 | result[@intFromEnum(Feature.ptx42)] = .{ | 105 | result[@backingInt(Feature.ptx42)] = .{ |
| 106 | .llvm_name = "ptx42", | 106 | .llvm_name = "ptx42", |
| 107 | .description = "Use PTX version 42", | 107 | .description = "Use PTX version 42", |
| 108 | .dependencies = featureSet(&[_]Feature{}), | 108 | .dependencies = featureSet(&[_]Feature{}), |
| 109 | }; | 109 | }; |
| 110 | result[@intFromEnum(Feature.ptx43)] = .{ | 110 | result[@backingInt(Feature.ptx43)] = .{ |
| 111 | .llvm_name = "ptx43", | 111 | .llvm_name = "ptx43", |
| 112 | .description = "Use PTX version 43", | 112 | .description = "Use PTX version 43", |
| 113 | .dependencies = featureSet(&[_]Feature{}), | 113 | .dependencies = featureSet(&[_]Feature{}), |
| 114 | }; | 114 | }; |
| 115 | result[@intFromEnum(Feature.ptx50)] = .{ | 115 | result[@backingInt(Feature.ptx50)] = .{ |
| 116 | .llvm_name = "ptx50", | 116 | .llvm_name = "ptx50", |
| 117 | .description = "Use PTX version 50", | 117 | .description = "Use PTX version 50", |
| 118 | .dependencies = featureSet(&[_]Feature{}), | 118 | .dependencies = featureSet(&[_]Feature{}), |
| 119 | }; | 119 | }; |
| 120 | result[@intFromEnum(Feature.ptx60)] = .{ | 120 | result[@backingInt(Feature.ptx60)] = .{ |
| 121 | .llvm_name = "ptx60", | 121 | .llvm_name = "ptx60", |
| 122 | .description = "Use PTX version 60", | 122 | .description = "Use PTX version 60", |
| 123 | .dependencies = featureSet(&[_]Feature{}), | 123 | .dependencies = featureSet(&[_]Feature{}), |
| 124 | }; | 124 | }; |
| 125 | result[@intFromEnum(Feature.ptx61)] = .{ | 125 | result[@backingInt(Feature.ptx61)] = .{ |
| 126 | .llvm_name = "ptx61", | 126 | .llvm_name = "ptx61", |
| 127 | .description = "Use PTX version 61", | 127 | .description = "Use PTX version 61", |
| 128 | .dependencies = featureSet(&[_]Feature{}), | 128 | .dependencies = featureSet(&[_]Feature{}), |
| 129 | }; | 129 | }; |
| 130 | result[@intFromEnum(Feature.ptx62)] = .{ | 130 | result[@backingInt(Feature.ptx62)] = .{ |
| 131 | .llvm_name = "ptx62", | 131 | .llvm_name = "ptx62", |
| 132 | .description = "Use PTX version 62", | 132 | .description = "Use PTX version 62", |
| 133 | .dependencies = featureSet(&[_]Feature{}), | 133 | .dependencies = featureSet(&[_]Feature{}), |
| 134 | }; | 134 | }; |
| 135 | result[@intFromEnum(Feature.ptx63)] = .{ | 135 | result[@backingInt(Feature.ptx63)] = .{ |
| 136 | .llvm_name = "ptx63", | 136 | .llvm_name = "ptx63", |
| 137 | .description = "Use PTX version 63", | 137 | .description = "Use PTX version 63", |
| 138 | .dependencies = featureSet(&[_]Feature{}), | 138 | .dependencies = featureSet(&[_]Feature{}), |
| 139 | }; | 139 | }; |
| 140 | result[@intFromEnum(Feature.ptx64)] = .{ | 140 | result[@backingInt(Feature.ptx64)] = .{ |
| 141 | .llvm_name = "ptx64", | 141 | .llvm_name = "ptx64", |
| 142 | .description = "Use PTX version 64", | 142 | .description = "Use PTX version 64", |
| 143 | .dependencies = featureSet(&[_]Feature{}), | 143 | .dependencies = featureSet(&[_]Feature{}), |
| 144 | }; | 144 | }; |
| 145 | result[@intFromEnum(Feature.ptx65)] = .{ | 145 | result[@backingInt(Feature.ptx65)] = .{ |
| 146 | .llvm_name = "ptx65", | 146 | .llvm_name = "ptx65", |
| 147 | .description = "Use PTX version 65", | 147 | .description = "Use PTX version 65", |
| 148 | .dependencies = featureSet(&[_]Feature{}), | 148 | .dependencies = featureSet(&[_]Feature{}), |
| 149 | }; | 149 | }; |
| 150 | result[@intFromEnum(Feature.ptx70)] = .{ | 150 | result[@backingInt(Feature.ptx70)] = .{ |
| 151 | .llvm_name = "ptx70", | 151 | .llvm_name = "ptx70", |
| 152 | .description = "Use PTX version 70", | 152 | .description = "Use PTX version 70", |
| 153 | .dependencies = featureSet(&[_]Feature{}), | 153 | .dependencies = featureSet(&[_]Feature{}), |
| 154 | }; | 154 | }; |
| 155 | result[@intFromEnum(Feature.ptx71)] = .{ | 155 | result[@backingInt(Feature.ptx71)] = .{ |
| 156 | .llvm_name = "ptx71", | 156 | .llvm_name = "ptx71", |
| 157 | .description = "Use PTX version 71", | 157 | .description = "Use PTX version 71", |
| 158 | .dependencies = featureSet(&[_]Feature{}), | 158 | .dependencies = featureSet(&[_]Feature{}), |
| 159 | }; | 159 | }; |
| 160 | result[@intFromEnum(Feature.ptx72)] = .{ | 160 | result[@backingInt(Feature.ptx72)] = .{ |
| 161 | .llvm_name = "ptx72", | 161 | .llvm_name = "ptx72", |
| 162 | .description = "Use PTX version 72", | 162 | .description = "Use PTX version 72", |
| 163 | .dependencies = featureSet(&[_]Feature{}), | 163 | .dependencies = featureSet(&[_]Feature{}), |
| 164 | }; | 164 | }; |
| 165 | result[@intFromEnum(Feature.ptx73)] = .{ | 165 | result[@backingInt(Feature.ptx73)] = .{ |
| 166 | .llvm_name = "ptx73", | 166 | .llvm_name = "ptx73", |
| 167 | .description = "Use PTX version 73", | 167 | .description = "Use PTX version 73", |
| 168 | .dependencies = featureSet(&[_]Feature{}), | 168 | .dependencies = featureSet(&[_]Feature{}), |
| 169 | }; | 169 | }; |
| 170 | result[@intFromEnum(Feature.ptx74)] = .{ | 170 | result[@backingInt(Feature.ptx74)] = .{ |
| 171 | .llvm_name = "ptx74", | 171 | .llvm_name = "ptx74", |
| 172 | .description = "Use PTX version 74", | 172 | .description = "Use PTX version 74", |
| 173 | .dependencies = featureSet(&[_]Feature{}), | 173 | .dependencies = featureSet(&[_]Feature{}), |
| 174 | }; | 174 | }; |
| 175 | result[@intFromEnum(Feature.ptx75)] = .{ | 175 | result[@backingInt(Feature.ptx75)] = .{ |
| 176 | .llvm_name = "ptx75", | 176 | .llvm_name = "ptx75", |
| 177 | .description = "Use PTX version 75", | 177 | .description = "Use PTX version 75", |
| 178 | .dependencies = featureSet(&[_]Feature{}), | 178 | .dependencies = featureSet(&[_]Feature{}), |
| 179 | }; | 179 | }; |
| 180 | result[@intFromEnum(Feature.ptx76)] = .{ | 180 | result[@backingInt(Feature.ptx76)] = .{ |
| 181 | .llvm_name = "ptx76", | 181 | .llvm_name = "ptx76", |
| 182 | .description = "Use PTX version 76", | 182 | .description = "Use PTX version 76", |
| 183 | .dependencies = featureSet(&[_]Feature{}), | 183 | .dependencies = featureSet(&[_]Feature{}), |
| 184 | }; | 184 | }; |
| 185 | result[@intFromEnum(Feature.ptx77)] = .{ | 185 | result[@backingInt(Feature.ptx77)] = .{ |
| 186 | .llvm_name = "ptx77", | 186 | .llvm_name = "ptx77", |
| 187 | .description = "Use PTX version 77", | 187 | .description = "Use PTX version 77", |
| 188 | .dependencies = featureSet(&[_]Feature{}), | 188 | .dependencies = featureSet(&[_]Feature{}), |
| 189 | }; | 189 | }; |
| 190 | result[@intFromEnum(Feature.ptx78)] = .{ | 190 | result[@backingInt(Feature.ptx78)] = .{ |
| 191 | .llvm_name = "ptx78", | 191 | .llvm_name = "ptx78", |
| 192 | .description = "Use PTX version 78", | 192 | .description = "Use PTX version 78", |
| 193 | .dependencies = featureSet(&[_]Feature{}), | 193 | .dependencies = featureSet(&[_]Feature{}), |
| 194 | }; | 194 | }; |
| 195 | result[@intFromEnum(Feature.ptx80)] = .{ | 195 | result[@backingInt(Feature.ptx80)] = .{ |
| 196 | .llvm_name = "ptx80", | 196 | .llvm_name = "ptx80", |
| 197 | .description = "Use PTX version 80", | 197 | .description = "Use PTX version 80", |
| 198 | .dependencies = featureSet(&[_]Feature{}), | 198 | .dependencies = featureSet(&[_]Feature{}), |
| 199 | }; | 199 | }; |
| 200 | result[@intFromEnum(Feature.ptx81)] = .{ | 200 | result[@backingInt(Feature.ptx81)] = .{ |
| 201 | .llvm_name = "ptx81", | 201 | .llvm_name = "ptx81", |
| 202 | .description = "Use PTX version 81", | 202 | .description = "Use PTX version 81", |
| 203 | .dependencies = featureSet(&[_]Feature{}), | 203 | .dependencies = featureSet(&[_]Feature{}), |
| 204 | }; | 204 | }; |
| 205 | result[@intFromEnum(Feature.ptx82)] = .{ | 205 | result[@backingInt(Feature.ptx82)] = .{ |
| 206 | .llvm_name = "ptx82", | 206 | .llvm_name = "ptx82", |
| 207 | .description = "Use PTX version 82", | 207 | .description = "Use PTX version 82", |
| 208 | .dependencies = featureSet(&[_]Feature{}), | 208 | .dependencies = featureSet(&[_]Feature{}), |
| 209 | }; | 209 | }; |
| 210 | result[@intFromEnum(Feature.ptx83)] = .{ | 210 | result[@backingInt(Feature.ptx83)] = .{ |
| 211 | .llvm_name = "ptx83", | 211 | .llvm_name = "ptx83", |
| 212 | .description = "Use PTX version 83", | 212 | .description = "Use PTX version 83", |
| 213 | .dependencies = featureSet(&[_]Feature{}), | 213 | .dependencies = featureSet(&[_]Feature{}), |
| 214 | }; | 214 | }; |
| 215 | result[@intFromEnum(Feature.ptx84)] = .{ | 215 | result[@backingInt(Feature.ptx84)] = .{ |
| 216 | .llvm_name = "ptx84", | 216 | .llvm_name = "ptx84", |
| 217 | .description = "Use PTX version 84", | 217 | .description = "Use PTX version 84", |
| 218 | .dependencies = featureSet(&[_]Feature{}), | 218 | .dependencies = featureSet(&[_]Feature{}), |
| 219 | }; | 219 | }; |
| 220 | result[@intFromEnum(Feature.ptx85)] = .{ | 220 | result[@backingInt(Feature.ptx85)] = .{ |
| 221 | .llvm_name = "ptx85", | 221 | .llvm_name = "ptx85", |
| 222 | .description = "Use PTX version 85", | 222 | .description = "Use PTX version 85", |
| 223 | .dependencies = featureSet(&[_]Feature{}), | 223 | .dependencies = featureSet(&[_]Feature{}), |
| 224 | }; | 224 | }; |
| 225 | result[@intFromEnum(Feature.ptx86)] = .{ | 225 | result[@backingInt(Feature.ptx86)] = .{ |
| 226 | .llvm_name = "ptx86", | 226 | .llvm_name = "ptx86", |
| 227 | .description = "Use PTX version 86", | 227 | .description = "Use PTX version 86", |
| 228 | .dependencies = featureSet(&[_]Feature{}), | 228 | .dependencies = featureSet(&[_]Feature{}), |
| 229 | }; | 229 | }; |
| 230 | result[@intFromEnum(Feature.ptx87)] = .{ | 230 | result[@backingInt(Feature.ptx87)] = .{ |
| 231 | .llvm_name = "ptx87", | 231 | .llvm_name = "ptx87", |
| 232 | .description = "Use PTX version 87", | 232 | .description = "Use PTX version 87", |
| 233 | .dependencies = featureSet(&[_]Feature{}), | 233 | .dependencies = featureSet(&[_]Feature{}), |
| 234 | }; | 234 | }; |
| 235 | result[@intFromEnum(Feature.ptx88)] = .{ | 235 | result[@backingInt(Feature.ptx88)] = .{ |
| 236 | .llvm_name = "ptx88", | 236 | .llvm_name = "ptx88", |
| 237 | .description = "Use PTX version 88", | 237 | .description = "Use PTX version 88", |
| 238 | .dependencies = featureSet(&[_]Feature{}), | 238 | .dependencies = featureSet(&[_]Feature{}), |
| 239 | }; | 239 | }; |
| 240 | result[@intFromEnum(Feature.ptx90)] = .{ | 240 | result[@backingInt(Feature.ptx90)] = .{ |
| 241 | .llvm_name = "ptx90", | 241 | .llvm_name = "ptx90", |
| 242 | .description = "Use PTX version 90", | 242 | .description = "Use PTX version 90", |
| 243 | .dependencies = featureSet(&[_]Feature{}), | 243 | .dependencies = featureSet(&[_]Feature{}), |
| 244 | }; | 244 | }; |
| 245 | result[@intFromEnum(Feature.sm_100)] = .{ | 245 | result[@backingInt(Feature.sm_100)] = .{ |
| 246 | .llvm_name = "sm_100", | 246 | .llvm_name = "sm_100", |
| 247 | .description = "Target SM 100", | 247 | .description = "Target SM 100", |
| 248 | .dependencies = featureSet(&[_]Feature{}), | 248 | .dependencies = featureSet(&[_]Feature{}), |
| 249 | }; | 249 | }; |
| 250 | result[@intFromEnum(Feature.sm_100a)] = .{ | 250 | result[@backingInt(Feature.sm_100a)] = .{ |
| 251 | .llvm_name = "sm_100a", | 251 | .llvm_name = "sm_100a", |
| 252 | .description = "Target SM 100a", | 252 | .description = "Target SM 100a", |
| 253 | .dependencies = featureSet(&[_]Feature{}), | 253 | .dependencies = featureSet(&[_]Feature{}), |
| 254 | }; | 254 | }; |
| 255 | result[@intFromEnum(Feature.sm_100f)] = .{ | 255 | result[@backingInt(Feature.sm_100f)] = .{ |
| 256 | .llvm_name = "sm_100f", | 256 | .llvm_name = "sm_100f", |
| 257 | .description = "Target SM 100f", | 257 | .description = "Target SM 100f", |
| 258 | .dependencies = featureSet(&[_]Feature{}), | 258 | .dependencies = featureSet(&[_]Feature{}), |
| 259 | }; | 259 | }; |
| 260 | result[@intFromEnum(Feature.sm_101)] = .{ | 260 | result[@backingInt(Feature.sm_101)] = .{ |
| 261 | .llvm_name = "sm_101", | 261 | .llvm_name = "sm_101", |
| 262 | .description = "Target SM 101", | 262 | .description = "Target SM 101", |
| 263 | .dependencies = featureSet(&[_]Feature{}), | 263 | .dependencies = featureSet(&[_]Feature{}), |
| 264 | }; | 264 | }; |
| 265 | result[@intFromEnum(Feature.sm_101a)] = .{ | 265 | result[@backingInt(Feature.sm_101a)] = .{ |
| 266 | .llvm_name = "sm_101a", | 266 | .llvm_name = "sm_101a", |
| 267 | .description = "Target SM 101a", | 267 | .description = "Target SM 101a", |
| 268 | .dependencies = featureSet(&[_]Feature{}), | 268 | .dependencies = featureSet(&[_]Feature{}), |
| 269 | }; | 269 | }; |
| 270 | result[@intFromEnum(Feature.sm_101f)] = .{ | 270 | result[@backingInt(Feature.sm_101f)] = .{ |
| 271 | .llvm_name = "sm_101f", | 271 | .llvm_name = "sm_101f", |
| 272 | .description = "Target SM 101f", | 272 | .description = "Target SM 101f", |
| 273 | .dependencies = featureSet(&[_]Feature{}), | 273 | .dependencies = featureSet(&[_]Feature{}), |
| 274 | }; | 274 | }; |
| 275 | result[@intFromEnum(Feature.sm_103)] = .{ | 275 | result[@backingInt(Feature.sm_103)] = .{ |
| 276 | .llvm_name = "sm_103", | 276 | .llvm_name = "sm_103", |
| 277 | .description = "Target SM 103", | 277 | .description = "Target SM 103", |
| 278 | .dependencies = featureSet(&[_]Feature{}), | 278 | .dependencies = featureSet(&[_]Feature{}), |
| 279 | }; | 279 | }; |
| 280 | result[@intFromEnum(Feature.sm_103a)] = .{ | 280 | result[@backingInt(Feature.sm_103a)] = .{ |
| 281 | .llvm_name = "sm_103a", | 281 | .llvm_name = "sm_103a", |
| 282 | .description = "Target SM 103a", | 282 | .description = "Target SM 103a", |
| 283 | .dependencies = featureSet(&[_]Feature{}), | 283 | .dependencies = featureSet(&[_]Feature{}), |
| 284 | }; | 284 | }; |
| 285 | result[@intFromEnum(Feature.sm_103f)] = .{ | 285 | result[@backingInt(Feature.sm_103f)] = .{ |
| 286 | .llvm_name = "sm_103f", | 286 | .llvm_name = "sm_103f", |
| 287 | .description = "Target SM 103f", | 287 | .description = "Target SM 103f", |
| 288 | .dependencies = featureSet(&[_]Feature{}), | 288 | .dependencies = featureSet(&[_]Feature{}), |
| 289 | }; | 289 | }; |
| 290 | result[@intFromEnum(Feature.sm_110)] = .{ | 290 | result[@backingInt(Feature.sm_110)] = .{ |
| 291 | .llvm_name = "sm_110", | 291 | .llvm_name = "sm_110", |
| 292 | .description = "Target SM 110", | 292 | .description = "Target SM 110", |
| 293 | .dependencies = featureSet(&[_]Feature{}), | 293 | .dependencies = featureSet(&[_]Feature{}), |
| 294 | }; | 294 | }; |
| 295 | result[@intFromEnum(Feature.sm_110a)] = .{ | 295 | result[@backingInt(Feature.sm_110a)] = .{ |
| 296 | .llvm_name = "sm_110a", | 296 | .llvm_name = "sm_110a", |
| 297 | .description = "Target SM 110a", | 297 | .description = "Target SM 110a", |
| 298 | .dependencies = featureSet(&[_]Feature{}), | 298 | .dependencies = featureSet(&[_]Feature{}), |
| 299 | }; | 299 | }; |
| 300 | result[@intFromEnum(Feature.sm_110f)] = .{ | 300 | result[@backingInt(Feature.sm_110f)] = .{ |
| 301 | .llvm_name = "sm_110f", | 301 | .llvm_name = "sm_110f", |
| 302 | .description = "Target SM 110f", | 302 | .description = "Target SM 110f", |
| 303 | .dependencies = featureSet(&[_]Feature{}), | 303 | .dependencies = featureSet(&[_]Feature{}), |
| 304 | }; | 304 | }; |
| 305 | result[@intFromEnum(Feature.sm_120)] = .{ | 305 | result[@backingInt(Feature.sm_120)] = .{ |
| 306 | .llvm_name = "sm_120", | 306 | .llvm_name = "sm_120", |
| 307 | .description = "Target SM 120", | 307 | .description = "Target SM 120", |
| 308 | .dependencies = featureSet(&[_]Feature{}), | 308 | .dependencies = featureSet(&[_]Feature{}), |
| 309 | }; | 309 | }; |
| 310 | result[@intFromEnum(Feature.sm_120a)] = .{ | 310 | result[@backingInt(Feature.sm_120a)] = .{ |
| 311 | .llvm_name = "sm_120a", | 311 | .llvm_name = "sm_120a", |
| 312 | .description = "Target SM 120a", | 312 | .description = "Target SM 120a", |
| 313 | .dependencies = featureSet(&[_]Feature{}), | 313 | .dependencies = featureSet(&[_]Feature{}), |
| 314 | }; | 314 | }; |
| 315 | result[@intFromEnum(Feature.sm_120f)] = .{ | 315 | result[@backingInt(Feature.sm_120f)] = .{ |
| 316 | .llvm_name = "sm_120f", | 316 | .llvm_name = "sm_120f", |
| 317 | .description = "Target SM 120f", | 317 | .description = "Target SM 120f", |
| 318 | .dependencies = featureSet(&[_]Feature{}), | 318 | .dependencies = featureSet(&[_]Feature{}), |
| 319 | }; | 319 | }; |
| 320 | result[@intFromEnum(Feature.sm_121)] = .{ | 320 | result[@backingInt(Feature.sm_121)] = .{ |
| 321 | .llvm_name = "sm_121", | 321 | .llvm_name = "sm_121", |
| 322 | .description = "Target SM 121", | 322 | .description = "Target SM 121", |
| 323 | .dependencies = featureSet(&[_]Feature{}), | 323 | .dependencies = featureSet(&[_]Feature{}), |
| 324 | }; | 324 | }; |
| 325 | result[@intFromEnum(Feature.sm_121a)] = .{ | 325 | result[@backingInt(Feature.sm_121a)] = .{ |
| 326 | .llvm_name = "sm_121a", | 326 | .llvm_name = "sm_121a", |
| 327 | .description = "Target SM 121a", | 327 | .description = "Target SM 121a", |
| 328 | .dependencies = featureSet(&[_]Feature{}), | 328 | .dependencies = featureSet(&[_]Feature{}), |
| 329 | }; | 329 | }; |
| 330 | result[@intFromEnum(Feature.sm_121f)] = .{ | 330 | result[@backingInt(Feature.sm_121f)] = .{ |
| 331 | .llvm_name = "sm_121f", | 331 | .llvm_name = "sm_121f", |
| 332 | .description = "Target SM 121f", | 332 | .description = "Target SM 121f", |
| 333 | .dependencies = featureSet(&[_]Feature{}), | 333 | .dependencies = featureSet(&[_]Feature{}), |
| 334 | }; | 334 | }; |
| 335 | result[@intFromEnum(Feature.sm_20)] = .{ | 335 | result[@backingInt(Feature.sm_20)] = .{ |
| 336 | .llvm_name = "sm_20", | 336 | .llvm_name = "sm_20", |
| 337 | .description = "Target SM 20", | 337 | .description = "Target SM 20", |
| 338 | .dependencies = featureSet(&[_]Feature{}), | 338 | .dependencies = featureSet(&[_]Feature{}), |
| 339 | }; | 339 | }; |
| 340 | result[@intFromEnum(Feature.sm_21)] = .{ | 340 | result[@backingInt(Feature.sm_21)] = .{ |
| 341 | .llvm_name = "sm_21", | 341 | .llvm_name = "sm_21", |
| 342 | .description = "Target SM 21", | 342 | .description = "Target SM 21", |
| 343 | .dependencies = featureSet(&[_]Feature{}), | 343 | .dependencies = featureSet(&[_]Feature{}), |
| 344 | }; | 344 | }; |
| 345 | result[@intFromEnum(Feature.sm_30)] = .{ | 345 | result[@backingInt(Feature.sm_30)] = .{ |
| 346 | .llvm_name = "sm_30", | 346 | .llvm_name = "sm_30", |
| 347 | .description = "Target SM 30", | 347 | .description = "Target SM 30", |
| 348 | .dependencies = featureSet(&[_]Feature{}), | 348 | .dependencies = featureSet(&[_]Feature{}), |
| 349 | }; | 349 | }; |
| 350 | result[@intFromEnum(Feature.sm_32)] = .{ | 350 | result[@backingInt(Feature.sm_32)] = .{ |
| 351 | .llvm_name = "sm_32", | 351 | .llvm_name = "sm_32", |
| 352 | .description = "Target SM 32", | 352 | .description = "Target SM 32", |
| 353 | .dependencies = featureSet(&[_]Feature{}), | 353 | .dependencies = featureSet(&[_]Feature{}), |
| 354 | }; | 354 | }; |
| 355 | result[@intFromEnum(Feature.sm_35)] = .{ | 355 | result[@backingInt(Feature.sm_35)] = .{ |
| 356 | .llvm_name = "sm_35", | 356 | .llvm_name = "sm_35", |
| 357 | .description = "Target SM 35", | 357 | .description = "Target SM 35", |
| 358 | .dependencies = featureSet(&[_]Feature{}), | 358 | .dependencies = featureSet(&[_]Feature{}), |
| 359 | }; | 359 | }; |
| 360 | result[@intFromEnum(Feature.sm_37)] = .{ | 360 | result[@backingInt(Feature.sm_37)] = .{ |
| 361 | .llvm_name = "sm_37", | 361 | .llvm_name = "sm_37", |
| 362 | .description = "Target SM 37", | 362 | .description = "Target SM 37", |
| 363 | .dependencies = featureSet(&[_]Feature{}), | 363 | .dependencies = featureSet(&[_]Feature{}), |
| 364 | }; | 364 | }; |
| 365 | result[@intFromEnum(Feature.sm_50)] = .{ | 365 | result[@backingInt(Feature.sm_50)] = .{ |
| 366 | .llvm_name = "sm_50", | 366 | .llvm_name = "sm_50", |
| 367 | .description = "Target SM 50", | 367 | .description = "Target SM 50", |
| 368 | .dependencies = featureSet(&[_]Feature{}), | 368 | .dependencies = featureSet(&[_]Feature{}), |
| 369 | }; | 369 | }; |
| 370 | result[@intFromEnum(Feature.sm_52)] = .{ | 370 | result[@backingInt(Feature.sm_52)] = .{ |
| 371 | .llvm_name = "sm_52", | 371 | .llvm_name = "sm_52", |
| 372 | .description = "Target SM 52", | 372 | .description = "Target SM 52", |
| 373 | .dependencies = featureSet(&[_]Feature{}), | 373 | .dependencies = featureSet(&[_]Feature{}), |
| 374 | }; | 374 | }; |
| 375 | result[@intFromEnum(Feature.sm_53)] = .{ | 375 | result[@backingInt(Feature.sm_53)] = .{ |
| 376 | .llvm_name = "sm_53", | 376 | .llvm_name = "sm_53", |
| 377 | .description = "Target SM 53", | 377 | .description = "Target SM 53", |
| 378 | .dependencies = featureSet(&[_]Feature{}), | 378 | .dependencies = featureSet(&[_]Feature{}), |
| 379 | }; | 379 | }; |
| 380 | result[@intFromEnum(Feature.sm_60)] = .{ | 380 | result[@backingInt(Feature.sm_60)] = .{ |
| 381 | .llvm_name = "sm_60", | 381 | .llvm_name = "sm_60", |
| 382 | .description = "Target SM 60", | 382 | .description = "Target SM 60", |
| 383 | .dependencies = featureSet(&[_]Feature{}), | 383 | .dependencies = featureSet(&[_]Feature{}), |
| 384 | }; | 384 | }; |
| 385 | result[@intFromEnum(Feature.sm_61)] = .{ | 385 | result[@backingInt(Feature.sm_61)] = .{ |
| 386 | .llvm_name = "sm_61", | 386 | .llvm_name = "sm_61", |
| 387 | .description = "Target SM 61", | 387 | .description = "Target SM 61", |
| 388 | .dependencies = featureSet(&[_]Feature{}), | 388 | .dependencies = featureSet(&[_]Feature{}), |
| 389 | }; | 389 | }; |
| 390 | result[@intFromEnum(Feature.sm_62)] = .{ | 390 | result[@backingInt(Feature.sm_62)] = .{ |
| 391 | .llvm_name = "sm_62", | 391 | .llvm_name = "sm_62", |
| 392 | .description = "Target SM 62", | 392 | .description = "Target SM 62", |
| 393 | .dependencies = featureSet(&[_]Feature{}), | 393 | .dependencies = featureSet(&[_]Feature{}), |
| 394 | }; | 394 | }; |
| 395 | result[@intFromEnum(Feature.sm_70)] = .{ | 395 | result[@backingInt(Feature.sm_70)] = .{ |
| 396 | .llvm_name = "sm_70", | 396 | .llvm_name = "sm_70", |
| 397 | .description = "Target SM 70", | 397 | .description = "Target SM 70", |
| 398 | .dependencies = featureSet(&[_]Feature{}), | 398 | .dependencies = featureSet(&[_]Feature{}), |
| 399 | }; | 399 | }; |
| 400 | result[@intFromEnum(Feature.sm_72)] = .{ | 400 | result[@backingInt(Feature.sm_72)] = .{ |
| 401 | .llvm_name = "sm_72", | 401 | .llvm_name = "sm_72", |
| 402 | .description = "Target SM 72", | 402 | .description = "Target SM 72", |
| 403 | .dependencies = featureSet(&[_]Feature{}), | 403 | .dependencies = featureSet(&[_]Feature{}), |
| 404 | }; | 404 | }; |
| 405 | result[@intFromEnum(Feature.sm_75)] = .{ | 405 | result[@backingInt(Feature.sm_75)] = .{ |
| 406 | .llvm_name = "sm_75", | 406 | .llvm_name = "sm_75", |
| 407 | .description = "Target SM 75", | 407 | .description = "Target SM 75", |
| 408 | .dependencies = featureSet(&[_]Feature{}), | 408 | .dependencies = featureSet(&[_]Feature{}), |
| 409 | }; | 409 | }; |
| 410 | result[@intFromEnum(Feature.sm_80)] = .{ | 410 | result[@backingInt(Feature.sm_80)] = .{ |
| 411 | .llvm_name = "sm_80", | 411 | .llvm_name = "sm_80", |
| 412 | .description = "Target SM 80", | 412 | .description = "Target SM 80", |
| 413 | .dependencies = featureSet(&[_]Feature{}), | 413 | .dependencies = featureSet(&[_]Feature{}), |
| 414 | }; | 414 | }; |
| 415 | result[@intFromEnum(Feature.sm_86)] = .{ | 415 | result[@backingInt(Feature.sm_86)] = .{ |
| 416 | .llvm_name = "sm_86", | 416 | .llvm_name = "sm_86", |
| 417 | .description = "Target SM 86", | 417 | .description = "Target SM 86", |
| 418 | .dependencies = featureSet(&[_]Feature{}), | 418 | .dependencies = featureSet(&[_]Feature{}), |
| 419 | }; | 419 | }; |
| 420 | result[@intFromEnum(Feature.sm_87)] = .{ | 420 | result[@backingInt(Feature.sm_87)] = .{ |
| 421 | .llvm_name = "sm_87", | 421 | .llvm_name = "sm_87", |
| 422 | .description = "Target SM 87", | 422 | .description = "Target SM 87", |
| 423 | .dependencies = featureSet(&[_]Feature{}), | 423 | .dependencies = featureSet(&[_]Feature{}), |
| 424 | }; | 424 | }; |
| 425 | result[@intFromEnum(Feature.sm_88)] = .{ | 425 | result[@backingInt(Feature.sm_88)] = .{ |
| 426 | .llvm_name = "sm_88", | 426 | .llvm_name = "sm_88", |
| 427 | .description = "Target SM 88", | 427 | .description = "Target SM 88", |
| 428 | .dependencies = featureSet(&[_]Feature{}), | 428 | .dependencies = featureSet(&[_]Feature{}), |
| 429 | }; | 429 | }; |
| 430 | result[@intFromEnum(Feature.sm_89)] = .{ | 430 | result[@backingInt(Feature.sm_89)] = .{ |
| 431 | .llvm_name = "sm_89", | 431 | .llvm_name = "sm_89", |
| 432 | .description = "Target SM 89", | 432 | .description = "Target SM 89", |
| 433 | .dependencies = featureSet(&[_]Feature{}), | 433 | .dependencies = featureSet(&[_]Feature{}), |
| 434 | }; | 434 | }; |
| 435 | result[@intFromEnum(Feature.sm_90)] = .{ | 435 | result[@backingInt(Feature.sm_90)] = .{ |
| 436 | .llvm_name = "sm_90", | 436 | .llvm_name = "sm_90", |
| 437 | .description = "Target SM 90", | 437 | .description = "Target SM 90", |
| 438 | .dependencies = featureSet(&[_]Feature{}), | 438 | .dependencies = featureSet(&[_]Feature{}), |
| 439 | }; | 439 | }; |
| 440 | result[@intFromEnum(Feature.sm_90a)] = .{ | 440 | result[@backingInt(Feature.sm_90a)] = .{ |
| 441 | .llvm_name = "sm_90a", | 441 | .llvm_name = "sm_90a", |
| 442 | .description = "Target SM 90a", | 442 | .description = "Target SM 90a", |
| 443 | .dependencies = featureSet(&[_]Feature{}), | 443 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/powerpc.zig+80-80| ... | @@ -96,331 +96,331 @@ pub const all_features = blk: { | ... | @@ -96,331 +96,331 @@ pub const all_features = blk: { |
| 96 | const len = @typeInfo(Feature).@"enum".field_names.len; | 96 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 97 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 97 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 98 | var result: [len]CpuFeature = undefined; | 98 | var result: [len]CpuFeature = undefined; |
| 99 | result[@intFromEnum(Feature.@"64bit")] = .{ | 99 | result[@backingInt(Feature.@"64bit")] = .{ |
| 100 | .llvm_name = "64bit", | 100 | .llvm_name = "64bit", |
| 101 | .description = "Enable 64-bit mode", | 101 | .description = "Enable 64-bit mode", |
| 102 | .dependencies = featureSet(&[_]Feature{ | 102 | .dependencies = featureSet(&[_]Feature{ |
| 103 | .@"64bit_support", | 103 | .@"64bit_support", |
| 104 | }), | 104 | }), |
| 105 | }; | 105 | }; |
| 106 | result[@intFromEnum(Feature.@"64bit_support")] = .{ | 106 | result[@backingInt(Feature.@"64bit_support")] = .{ |
| 107 | .llvm_name = "64bit-support", | 107 | .llvm_name = "64bit-support", |
| 108 | .description = "Supports 64-bit instructions", | 108 | .description = "Supports 64-bit instructions", |
| 109 | .dependencies = featureSet(&[_]Feature{}), | 109 | .dependencies = featureSet(&[_]Feature{}), |
| 110 | }; | 110 | }; |
| 111 | result[@intFromEnum(Feature.@"64bitregs")] = .{ | 111 | result[@backingInt(Feature.@"64bitregs")] = .{ |
| 112 | .llvm_name = "64bitregs", | 112 | .llvm_name = "64bitregs", |
| 113 | .description = "Enable 64-bit registers usage for ppc32 [beta]", | 113 | .description = "Enable 64-bit registers usage for ppc32 [beta]", |
| 114 | .dependencies = featureSet(&[_]Feature{}), | 114 | .dependencies = featureSet(&[_]Feature{}), |
| 115 | }; | 115 | }; |
| 116 | result[@intFromEnum(Feature.allow_unaligned_fp_access)] = .{ | 116 | result[@backingInt(Feature.allow_unaligned_fp_access)] = .{ |
| 117 | .llvm_name = "allow-unaligned-fp-access", | 117 | .llvm_name = "allow-unaligned-fp-access", |
| 118 | .description = "CPU does not trap on unaligned FP access", | 118 | .description = "CPU does not trap on unaligned FP access", |
| 119 | .dependencies = featureSet(&[_]Feature{}), | 119 | .dependencies = featureSet(&[_]Feature{}), |
| 120 | }; | 120 | }; |
| 121 | result[@intFromEnum(Feature.altivec)] = .{ | 121 | result[@backingInt(Feature.altivec)] = .{ |
| 122 | .llvm_name = "altivec", | 122 | .llvm_name = "altivec", |
| 123 | .description = "Enable Altivec instructions", | 123 | .description = "Enable Altivec instructions", |
| 124 | .dependencies = featureSet(&[_]Feature{ | 124 | .dependencies = featureSet(&[_]Feature{ |
| 125 | .fpu, | 125 | .fpu, |
| 126 | }), | 126 | }), |
| 127 | }; | 127 | }; |
| 128 | result[@intFromEnum(Feature.booke)] = .{ | 128 | result[@backingInt(Feature.booke)] = .{ |
| 129 | .llvm_name = "booke", | 129 | .llvm_name = "booke", |
| 130 | .description = "Enable Book E instructions", | 130 | .description = "Enable Book E instructions", |
| 131 | .dependencies = featureSet(&[_]Feature{ | 131 | .dependencies = featureSet(&[_]Feature{ |
| 132 | .icbt, | 132 | .icbt, |
| 133 | }), | 133 | }), |
| 134 | }; | 134 | }; |
| 135 | result[@intFromEnum(Feature.bpermd)] = .{ | 135 | result[@backingInt(Feature.bpermd)] = .{ |
| 136 | .llvm_name = "bpermd", | 136 | .llvm_name = "bpermd", |
| 137 | .description = "Enable the bpermd instruction", | 137 | .description = "Enable the bpermd instruction", |
| 138 | .dependencies = featureSet(&[_]Feature{}), | 138 | .dependencies = featureSet(&[_]Feature{}), |
| 139 | }; | 139 | }; |
| 140 | result[@intFromEnum(Feature.cmpb)] = .{ | 140 | result[@backingInt(Feature.cmpb)] = .{ |
| 141 | .llvm_name = "cmpb", | 141 | .llvm_name = "cmpb", |
| 142 | .description = "Enable the cmpb instruction", | 142 | .description = "Enable the cmpb instruction", |
| 143 | .dependencies = featureSet(&[_]Feature{}), | 143 | .dependencies = featureSet(&[_]Feature{}), |
| 144 | }; | 144 | }; |
| 145 | result[@intFromEnum(Feature.crbits)] = .{ | 145 | result[@backingInt(Feature.crbits)] = .{ |
| 146 | .llvm_name = "crbits", | 146 | .llvm_name = "crbits", |
| 147 | .description = "Use condition-register bits individually", | 147 | .description = "Use condition-register bits individually", |
| 148 | .dependencies = featureSet(&[_]Feature{}), | 148 | .dependencies = featureSet(&[_]Feature{}), |
| 149 | }; | 149 | }; |
| 150 | result[@intFromEnum(Feature.crypto)] = .{ | 150 | result[@backingInt(Feature.crypto)] = .{ |
| 151 | .llvm_name = "crypto", | 151 | .llvm_name = "crypto", |
| 152 | .description = "Enable POWER8 Crypto instructions", | 152 | .description = "Enable POWER8 Crypto instructions", |
| 153 | .dependencies = featureSet(&[_]Feature{ | 153 | .dependencies = featureSet(&[_]Feature{ |
| 154 | .power8_altivec, | 154 | .power8_altivec, |
| 155 | }), | 155 | }), |
| 156 | }; | 156 | }; |
| 157 | result[@intFromEnum(Feature.direct_move)] = .{ | 157 | result[@backingInt(Feature.direct_move)] = .{ |
| 158 | .llvm_name = "direct-move", | 158 | .llvm_name = "direct-move", |
| 159 | .description = "Enable Power8 direct move instructions", | 159 | .description = "Enable Power8 direct move instructions", |
| 160 | .dependencies = featureSet(&[_]Feature{ | 160 | .dependencies = featureSet(&[_]Feature{ |
| 161 | .vsx, | 161 | .vsx, |
| 162 | }), | 162 | }), |
| 163 | }; | 163 | }; |
| 164 | result[@intFromEnum(Feature.e500)] = .{ | 164 | result[@backingInt(Feature.e500)] = .{ |
| 165 | .llvm_name = "e500", | 165 | .llvm_name = "e500", |
| 166 | .description = "Enable E500/E500mc instructions", | 166 | .description = "Enable E500/E500mc instructions", |
| 167 | .dependencies = featureSet(&[_]Feature{}), | 167 | .dependencies = featureSet(&[_]Feature{}), |
| 168 | }; | 168 | }; |
| 169 | result[@intFromEnum(Feature.efpu2)] = .{ | 169 | result[@backingInt(Feature.efpu2)] = .{ |
| 170 | .llvm_name = "efpu2", | 170 | .llvm_name = "efpu2", |
| 171 | .description = "Enable Embedded Floating-Point APU 2 instructions", | 171 | .description = "Enable Embedded Floating-Point APU 2 instructions", |
| 172 | .dependencies = featureSet(&[_]Feature{ | 172 | .dependencies = featureSet(&[_]Feature{ |
| 173 | .spe, | 173 | .spe, |
| 174 | }), | 174 | }), |
| 175 | }; | 175 | }; |
| 176 | result[@intFromEnum(Feature.extdiv)] = .{ | 176 | result[@backingInt(Feature.extdiv)] = .{ |
| 177 | .llvm_name = "extdiv", | 177 | .llvm_name = "extdiv", |
| 178 | .description = "Enable extended divide instructions", | 178 | .description = "Enable extended divide instructions", |
| 179 | .dependencies = featureSet(&[_]Feature{}), | 179 | .dependencies = featureSet(&[_]Feature{}), |
| 180 | }; | 180 | }; |
| 181 | result[@intFromEnum(Feature.fast_MFLR)] = .{ | 181 | result[@backingInt(Feature.fast_MFLR)] = .{ |
| 182 | .llvm_name = "fast-MFLR", | 182 | .llvm_name = "fast-MFLR", |
| 183 | .description = "MFLR is a fast instruction", | 183 | .description = "MFLR is a fast instruction", |
| 184 | .dependencies = featureSet(&[_]Feature{}), | 184 | .dependencies = featureSet(&[_]Feature{}), |
| 185 | }; | 185 | }; |
| 186 | result[@intFromEnum(Feature.fcpsgn)] = .{ | 186 | result[@backingInt(Feature.fcpsgn)] = .{ |
| 187 | .llvm_name = "fcpsgn", | 187 | .llvm_name = "fcpsgn", |
| 188 | .description = "Enable the fcpsgn instruction", | 188 | .description = "Enable the fcpsgn instruction", |
| 189 | .dependencies = featureSet(&[_]Feature{ | 189 | .dependencies = featureSet(&[_]Feature{ |
| 190 | .fpu, | 190 | .fpu, |
| 191 | }), | 191 | }), |
| 192 | }; | 192 | }; |
| 193 | result[@intFromEnum(Feature.float128)] = .{ | 193 | result[@backingInt(Feature.float128)] = .{ |
| 194 | .llvm_name = "float128", | 194 | .llvm_name = "float128", |
| 195 | .description = "Enable the __float128 data type for IEEE-754R Binary128.", | 195 | .description = "Enable the __float128 data type for IEEE-754R Binary128.", |
| 196 | .dependencies = featureSet(&[_]Feature{ | 196 | .dependencies = featureSet(&[_]Feature{ |
| 197 | .vsx, | 197 | .vsx, |
| 198 | }), | 198 | }), |
| 199 | }; | 199 | }; |
| 200 | result[@intFromEnum(Feature.fpcvt)] = .{ | 200 | result[@backingInt(Feature.fpcvt)] = .{ |
| 201 | .llvm_name = "fpcvt", | 201 | .llvm_name = "fpcvt", |
| 202 | .description = "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions", | 202 | .description = "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions", |
| 203 | .dependencies = featureSet(&[_]Feature{ | 203 | .dependencies = featureSet(&[_]Feature{ |
| 204 | .fpu, | 204 | .fpu, |
| 205 | }), | 205 | }), |
| 206 | }; | 206 | }; |
| 207 | result[@intFromEnum(Feature.fprnd)] = .{ | 207 | result[@backingInt(Feature.fprnd)] = .{ |
| 208 | .llvm_name = "fprnd", | 208 | .llvm_name = "fprnd", |
| 209 | .description = "Enable the fri[mnpz] instructions", | 209 | .description = "Enable the fri[mnpz] instructions", |
| 210 | .dependencies = featureSet(&[_]Feature{ | 210 | .dependencies = featureSet(&[_]Feature{ |
| 211 | .fpu, | 211 | .fpu, |
| 212 | }), | 212 | }), |
| 213 | }; | 213 | }; |
| 214 | result[@intFromEnum(Feature.fpu)] = .{ | 214 | result[@backingInt(Feature.fpu)] = .{ |
| 215 | .llvm_name = "fpu", | 215 | .llvm_name = "fpu", |
| 216 | .description = "Enable classic FPU instructions", | 216 | .description = "Enable classic FPU instructions", |
| 217 | .dependencies = featureSet(&[_]Feature{ | 217 | .dependencies = featureSet(&[_]Feature{ |
| 218 | .hard_float, | 218 | .hard_float, |
| 219 | }), | 219 | }), |
| 220 | }; | 220 | }; |
| 221 | result[@intFromEnum(Feature.fre)] = .{ | 221 | result[@backingInt(Feature.fre)] = .{ |
| 222 | .llvm_name = "fre", | 222 | .llvm_name = "fre", |
| 223 | .description = "Enable the fre instruction", | 223 | .description = "Enable the fre instruction", |
| 224 | .dependencies = featureSet(&[_]Feature{ | 224 | .dependencies = featureSet(&[_]Feature{ |
| 225 | .fpu, | 225 | .fpu, |
| 226 | }), | 226 | }), |
| 227 | }; | 227 | }; |
| 228 | result[@intFromEnum(Feature.fres)] = .{ | 228 | result[@backingInt(Feature.fres)] = .{ |
| 229 | .llvm_name = "fres", | 229 | .llvm_name = "fres", |
| 230 | .description = "Enable the fres instruction", | 230 | .description = "Enable the fres instruction", |
| 231 | .dependencies = featureSet(&[_]Feature{ | 231 | .dependencies = featureSet(&[_]Feature{ |
| 232 | .fpu, | 232 | .fpu, |
| 233 | }), | 233 | }), |
| 234 | }; | 234 | }; |
| 235 | result[@intFromEnum(Feature.frsqrte)] = .{ | 235 | result[@backingInt(Feature.frsqrte)] = .{ |
| 236 | .llvm_name = "frsqrte", | 236 | .llvm_name = "frsqrte", |
| 237 | .description = "Enable the frsqrte instruction", | 237 | .description = "Enable the frsqrte instruction", |
| 238 | .dependencies = featureSet(&[_]Feature{ | 238 | .dependencies = featureSet(&[_]Feature{ |
| 239 | .fpu, | 239 | .fpu, |
| 240 | }), | 240 | }), |
| 241 | }; | 241 | }; |
| 242 | result[@intFromEnum(Feature.frsqrtes)] = .{ | 242 | result[@backingInt(Feature.frsqrtes)] = .{ |
| 243 | .llvm_name = "frsqrtes", | 243 | .llvm_name = "frsqrtes", |
| 244 | .description = "Enable the frsqrtes instruction", | 244 | .description = "Enable the frsqrtes instruction", |
| 245 | .dependencies = featureSet(&[_]Feature{ | 245 | .dependencies = featureSet(&[_]Feature{ |
| 246 | .fpu, | 246 | .fpu, |
| 247 | }), | 247 | }), |
| 248 | }; | 248 | }; |
| 249 | result[@intFromEnum(Feature.fsqrt)] = .{ | 249 | result[@backingInt(Feature.fsqrt)] = .{ |
| 250 | .llvm_name = "fsqrt", | 250 | .llvm_name = "fsqrt", |
| 251 | .description = "Enable the fsqrt instruction", | 251 | .description = "Enable the fsqrt instruction", |
| 252 | .dependencies = featureSet(&[_]Feature{ | 252 | .dependencies = featureSet(&[_]Feature{ |
| 253 | .fpu, | 253 | .fpu, |
| 254 | }), | 254 | }), |
| 255 | }; | 255 | }; |
| 256 | result[@intFromEnum(Feature.fuse_add_logical)] = .{ | 256 | result[@backingInt(Feature.fuse_add_logical)] = .{ |
| 257 | .llvm_name = "fuse-add-logical", | 257 | .llvm_name = "fuse-add-logical", |
| 258 | .description = "Target supports Add with Logical Operations fusion", | 258 | .description = "Target supports Add with Logical Operations fusion", |
| 259 | .dependencies = featureSet(&[_]Feature{ | 259 | .dependencies = featureSet(&[_]Feature{ |
| 260 | .fusion, | 260 | .fusion, |
| 261 | }), | 261 | }), |
| 262 | }; | 262 | }; |
| 263 | result[@intFromEnum(Feature.fuse_addi_load)] = .{ | 263 | result[@backingInt(Feature.fuse_addi_load)] = .{ |
| 264 | .llvm_name = "fuse-addi-load", | 264 | .llvm_name = "fuse-addi-load", |
| 265 | .description = "Power8 Addi-Load fusion", | 265 | .description = "Power8 Addi-Load fusion", |
| 266 | .dependencies = featureSet(&[_]Feature{ | 266 | .dependencies = featureSet(&[_]Feature{ |
| 267 | .fusion, | 267 | .fusion, |
| 268 | }), | 268 | }), |
| 269 | }; | 269 | }; |
| 270 | result[@intFromEnum(Feature.fuse_addis_load)] = .{ | 270 | result[@backingInt(Feature.fuse_addis_load)] = .{ |
| 271 | .llvm_name = "fuse-addis-load", | 271 | .llvm_name = "fuse-addis-load", |
| 272 | .description = "Power8 Addis-Load fusion", | 272 | .description = "Power8 Addis-Load fusion", |
| 273 | .dependencies = featureSet(&[_]Feature{ | 273 | .dependencies = featureSet(&[_]Feature{ |
| 274 | .fusion, | 274 | .fusion, |
| 275 | }), | 275 | }), |
| 276 | }; | 276 | }; |
| 277 | result[@intFromEnum(Feature.fuse_arith_add)] = .{ | 277 | result[@backingInt(Feature.fuse_arith_add)] = .{ |
| 278 | .llvm_name = "fuse-arith-add", | 278 | .llvm_name = "fuse-arith-add", |
| 279 | .description = "Target supports Arithmetic Operations with Add fusion", | 279 | .description = "Target supports Arithmetic Operations with Add fusion", |
| 280 | .dependencies = featureSet(&[_]Feature{ | 280 | .dependencies = featureSet(&[_]Feature{ |
| 281 | .fusion, | 281 | .fusion, |
| 282 | }), | 282 | }), |
| 283 | }; | 283 | }; |
| 284 | result[@intFromEnum(Feature.fuse_back2back)] = .{ | 284 | result[@backingInt(Feature.fuse_back2back)] = .{ |
| 285 | .llvm_name = "fuse-back2back", | 285 | .llvm_name = "fuse-back2back", |
| 286 | .description = "Target supports general back to back fusion", | 286 | .description = "Target supports general back to back fusion", |
| 287 | .dependencies = featureSet(&[_]Feature{ | 287 | .dependencies = featureSet(&[_]Feature{ |
| 288 | .fusion, | 288 | .fusion, |
| 289 | }), | 289 | }), |
| 290 | }; | 290 | }; |
| 291 | result[@intFromEnum(Feature.fuse_cmp)] = .{ | 291 | result[@backingInt(Feature.fuse_cmp)] = .{ |
| 292 | .llvm_name = "fuse-cmp", | 292 | .llvm_name = "fuse-cmp", |
| 293 | .description = "Target supports Comparison Operations fusion", | 293 | .description = "Target supports Comparison Operations fusion", |
| 294 | .dependencies = featureSet(&[_]Feature{ | 294 | .dependencies = featureSet(&[_]Feature{ |
| 295 | .fusion, | 295 | .fusion, |
| 296 | }), | 296 | }), |
| 297 | }; | 297 | }; |
| 298 | result[@intFromEnum(Feature.fuse_logical)] = .{ | 298 | result[@backingInt(Feature.fuse_logical)] = .{ |
| 299 | .llvm_name = "fuse-logical", | 299 | .llvm_name = "fuse-logical", |
| 300 | .description = "Target supports Logical Operations fusion", | 300 | .description = "Target supports Logical Operations fusion", |
| 301 | .dependencies = featureSet(&[_]Feature{ | 301 | .dependencies = featureSet(&[_]Feature{ |
| 302 | .fusion, | 302 | .fusion, |
| 303 | }), | 303 | }), |
| 304 | }; | 304 | }; |
| 305 | result[@intFromEnum(Feature.fuse_logical_add)] = .{ | 305 | result[@backingInt(Feature.fuse_logical_add)] = .{ |
| 306 | .llvm_name = "fuse-logical-add", | 306 | .llvm_name = "fuse-logical-add", |
| 307 | .description = "Target supports Logical with Add Operations fusion", | 307 | .description = "Target supports Logical with Add Operations fusion", |
| 308 | .dependencies = featureSet(&[_]Feature{ | 308 | .dependencies = featureSet(&[_]Feature{ |
| 309 | .fusion, | 309 | .fusion, |
| 310 | }), | 310 | }), |
| 311 | }; | 311 | }; |
| 312 | result[@intFromEnum(Feature.fuse_sha3)] = .{ | 312 | result[@backingInt(Feature.fuse_sha3)] = .{ |
| 313 | .llvm_name = "fuse-sha3", | 313 | .llvm_name = "fuse-sha3", |
| 314 | .description = "Target supports SHA3 assist fusion", | 314 | .description = "Target supports SHA3 assist fusion", |
| 315 | .dependencies = featureSet(&[_]Feature{ | 315 | .dependencies = featureSet(&[_]Feature{ |
| 316 | .fusion, | 316 | .fusion, |
| 317 | }), | 317 | }), |
| 318 | }; | 318 | }; |
| 319 | result[@intFromEnum(Feature.fuse_store)] = .{ | 319 | result[@backingInt(Feature.fuse_store)] = .{ |
| 320 | .llvm_name = "fuse-store", | 320 | .llvm_name = "fuse-store", |
| 321 | .description = "Target supports store clustering", | 321 | .description = "Target supports store clustering", |
| 322 | .dependencies = featureSet(&[_]Feature{ | 322 | .dependencies = featureSet(&[_]Feature{ |
| 323 | .fusion, | 323 | .fusion, |
| 324 | }), | 324 | }), |
| 325 | }; | 325 | }; |
| 326 | result[@intFromEnum(Feature.fuse_wideimm)] = .{ | 326 | result[@backingInt(Feature.fuse_wideimm)] = .{ |
| 327 | .llvm_name = "fuse-wideimm", | 327 | .llvm_name = "fuse-wideimm", |
| 328 | .description = "Target supports Wide-Immediate fusion", | 328 | .description = "Target supports Wide-Immediate fusion", |
| 329 | .dependencies = featureSet(&[_]Feature{ | 329 | .dependencies = featureSet(&[_]Feature{ |
| 330 | .fusion, | 330 | .fusion, |
| 331 | }), | 331 | }), |
| 332 | }; | 332 | }; |
| 333 | result[@intFromEnum(Feature.fuse_zeromove)] = .{ | 333 | result[@backingInt(Feature.fuse_zeromove)] = .{ |
| 334 | .llvm_name = "fuse-zeromove", | 334 | .llvm_name = "fuse-zeromove", |
| 335 | .description = "Target supports move to SPR with branch fusion", | 335 | .description = "Target supports move to SPR with branch fusion", |
| 336 | .dependencies = featureSet(&[_]Feature{ | 336 | .dependencies = featureSet(&[_]Feature{ |
| 337 | .fusion, | 337 | .fusion, |
| 338 | }), | 338 | }), |
| 339 | }; | 339 | }; |
| 340 | result[@intFromEnum(Feature.fusion)] = .{ | 340 | result[@backingInt(Feature.fusion)] = .{ |
| 341 | .llvm_name = "fusion", | 341 | .llvm_name = "fusion", |
| 342 | .description = "Target supports instruction fusion", | 342 | .description = "Target supports instruction fusion", |
| 343 | .dependencies = featureSet(&[_]Feature{}), | 343 | .dependencies = featureSet(&[_]Feature{}), |
| 344 | }; | 344 | }; |
| 345 | result[@intFromEnum(Feature.hard_float)] = .{ | 345 | result[@backingInt(Feature.hard_float)] = .{ |
| 346 | .llvm_name = "hard-float", | 346 | .llvm_name = "hard-float", |
| 347 | .description = "Enable floating-point instructions", | 347 | .description = "Enable floating-point instructions", |
| 348 | .dependencies = featureSet(&[_]Feature{}), | 348 | .dependencies = featureSet(&[_]Feature{}), |
| 349 | }; | 349 | }; |
| 350 | result[@intFromEnum(Feature.htm)] = .{ | 350 | result[@backingInt(Feature.htm)] = .{ |
| 351 | .llvm_name = "htm", | 351 | .llvm_name = "htm", |
| 352 | .description = "Enable Hardware Transactional Memory instructions", | 352 | .description = "Enable Hardware Transactional Memory instructions", |
| 353 | .dependencies = featureSet(&[_]Feature{}), | 353 | .dependencies = featureSet(&[_]Feature{}), |
| 354 | }; | 354 | }; |
| 355 | result[@intFromEnum(Feature.icbt)] = .{ | 355 | result[@backingInt(Feature.icbt)] = .{ |
| 356 | .llvm_name = "icbt", | 356 | .llvm_name = "icbt", |
| 357 | .description = "Enable icbt instruction", | 357 | .description = "Enable icbt instruction", |
| 358 | .dependencies = featureSet(&[_]Feature{}), | 358 | .dependencies = featureSet(&[_]Feature{}), |
| 359 | }; | 359 | }; |
| 360 | result[@intFromEnum(Feature.invariant_function_descriptors)] = .{ | 360 | result[@backingInt(Feature.invariant_function_descriptors)] = .{ |
| 361 | .llvm_name = "invariant-function-descriptors", | 361 | .llvm_name = "invariant-function-descriptors", |
| 362 | .description = "Assume function descriptors are invariant", | 362 | .description = "Assume function descriptors are invariant", |
| 363 | .dependencies = featureSet(&[_]Feature{}), | 363 | .dependencies = featureSet(&[_]Feature{}), |
| 364 | }; | 364 | }; |
| 365 | result[@intFromEnum(Feature.isa_future_instructions)] = .{ | 365 | result[@backingInt(Feature.isa_future_instructions)] = .{ |
| 366 | .llvm_name = "isa-future-instructions", | 366 | .llvm_name = "isa-future-instructions", |
| 367 | .description = "Enable instructions for Future ISA.", | 367 | .description = "Enable instructions for Future ISA.", |
| 368 | .dependencies = featureSet(&[_]Feature{ | 368 | .dependencies = featureSet(&[_]Feature{ |
| 369 | .isa_v31_instructions, | 369 | .isa_v31_instructions, |
| 370 | }), | 370 | }), |
| 371 | }; | 371 | }; |
| 372 | result[@intFromEnum(Feature.isa_v206_instructions)] = .{ | 372 | result[@backingInt(Feature.isa_v206_instructions)] = .{ |
| 373 | .llvm_name = "isa-v206-instructions", | 373 | .llvm_name = "isa-v206-instructions", |
| 374 | .description = "Enable instructions in ISA 2.06.", | 374 | .description = "Enable instructions in ISA 2.06.", |
| 375 | .dependencies = featureSet(&[_]Feature{}), | 375 | .dependencies = featureSet(&[_]Feature{}), |
| 376 | }; | 376 | }; |
| 377 | result[@intFromEnum(Feature.isa_v207_instructions)] = .{ | 377 | result[@backingInt(Feature.isa_v207_instructions)] = .{ |
| 378 | .llvm_name = "isa-v207-instructions", | 378 | .llvm_name = "isa-v207-instructions", |
| 379 | .description = "Enable instructions in ISA 2.07.", | 379 | .description = "Enable instructions in ISA 2.07.", |
| 380 | .dependencies = featureSet(&[_]Feature{}), | 380 | .dependencies = featureSet(&[_]Feature{}), |
| 381 | }; | 381 | }; |
| 382 | result[@intFromEnum(Feature.isa_v30_instructions)] = .{ | 382 | result[@backingInt(Feature.isa_v30_instructions)] = .{ |
| 383 | .llvm_name = "isa-v30-instructions", | 383 | .llvm_name = "isa-v30-instructions", |
| 384 | .description = "Enable instructions in ISA 3.0.", | 384 | .description = "Enable instructions in ISA 3.0.", |
| 385 | .dependencies = featureSet(&[_]Feature{ | 385 | .dependencies = featureSet(&[_]Feature{ |
| 386 | .isa_v207_instructions, | 386 | .isa_v207_instructions, |
| 387 | }), | 387 | }), |
| 388 | }; | 388 | }; |
| 389 | result[@intFromEnum(Feature.isa_v31_instructions)] = .{ | 389 | result[@backingInt(Feature.isa_v31_instructions)] = .{ |
| 390 | .llvm_name = "isa-v31-instructions", | 390 | .llvm_name = "isa-v31-instructions", |
| 391 | .description = "Enable instructions in ISA 3.1.", | 391 | .description = "Enable instructions in ISA 3.1.", |
| 392 | .dependencies = featureSet(&[_]Feature{ | 392 | .dependencies = featureSet(&[_]Feature{ |
| 393 | .isa_v30_instructions, | 393 | .isa_v30_instructions, |
| 394 | }), | 394 | }), |
| 395 | }; | 395 | }; |
| 396 | result[@intFromEnum(Feature.isel)] = .{ | 396 | result[@backingInt(Feature.isel)] = .{ |
| 397 | .llvm_name = "isel", | 397 | .llvm_name = "isel", |
| 398 | .description = "Enable the isel instruction", | 398 | .description = "Enable the isel instruction", |
| 399 | .dependencies = featureSet(&[_]Feature{}), | 399 | .dependencies = featureSet(&[_]Feature{}), |
| 400 | }; | 400 | }; |
| 401 | result[@intFromEnum(Feature.ldbrx)] = .{ | 401 | result[@backingInt(Feature.ldbrx)] = .{ |
| 402 | .llvm_name = "ldbrx", | 402 | .llvm_name = "ldbrx", |
| 403 | .description = "Enable the ldbrx instruction", | 403 | .description = "Enable the ldbrx instruction", |
| 404 | .dependencies = featureSet(&[_]Feature{}), | 404 | .dependencies = featureSet(&[_]Feature{}), |
| 405 | }; | 405 | }; |
| 406 | result[@intFromEnum(Feature.lfiwax)] = .{ | 406 | result[@backingInt(Feature.lfiwax)] = .{ |
| 407 | .llvm_name = "lfiwax", | 407 | .llvm_name = "lfiwax", |
| 408 | .description = "Enable the lfiwax instruction", | 408 | .description = "Enable the lfiwax instruction", |
| 409 | .dependencies = featureSet(&[_]Feature{ | 409 | .dependencies = featureSet(&[_]Feature{ |
| 410 | .fpu, | 410 | .fpu, |
| 411 | }), | 411 | }), |
| 412 | }; | 412 | }; |
| 413 | result[@intFromEnum(Feature.longcall)] = .{ | 413 | result[@backingInt(Feature.longcall)] = .{ |
| 414 | .llvm_name = "longcall", | 414 | .llvm_name = "longcall", |
| 415 | .description = "Always use indirect calls", | 415 | .description = "Always use indirect calls", |
| 416 | .dependencies = featureSet(&[_]Feature{}), | 416 | .dependencies = featureSet(&[_]Feature{}), |
| 417 | }; | 417 | }; |
| 418 | result[@intFromEnum(Feature.mfocrf)] = .{ | 418 | result[@backingInt(Feature.mfocrf)] = .{ |
| 419 | .llvm_name = "mfocrf", | 419 | .llvm_name = "mfocrf", |
| 420 | .description = "Enable the MFOCRF instruction", | 420 | .description = "Enable the MFOCRF instruction", |
| 421 | .dependencies = featureSet(&[_]Feature{}), | 421 | .dependencies = featureSet(&[_]Feature{}), |
| 422 | }; | 422 | }; |
| 423 | result[@intFromEnum(Feature.mma)] = .{ | 423 | result[@backingInt(Feature.mma)] = .{ |
| 424 | .llvm_name = "mma", | 424 | .llvm_name = "mma", |
| 425 | .description = "Enable MMA instructions", | 425 | .description = "Enable MMA instructions", |
| 426 | .dependencies = featureSet(&[_]Feature{ | 426 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -429,38 +429,38 @@ pub const all_features = blk: { | ... | @@ -429,38 +429,38 @@ pub const all_features = blk: { |
| 429 | .power9_altivec, | 429 | .power9_altivec, |
| 430 | }), | 430 | }), |
| 431 | }; | 431 | }; |
| 432 | result[@intFromEnum(Feature.msync)] = .{ | 432 | result[@backingInt(Feature.msync)] = .{ |
| 433 | .llvm_name = "msync", | 433 | .llvm_name = "msync", |
| 434 | .description = "Has only the msync instruction instead of sync", | 434 | .description = "Has only the msync instruction instead of sync", |
| 435 | .dependencies = featureSet(&[_]Feature{ | 435 | .dependencies = featureSet(&[_]Feature{ |
| 436 | .booke, | 436 | .booke, |
| 437 | }), | 437 | }), |
| 438 | }; | 438 | }; |
| 439 | result[@intFromEnum(Feature.paired_vector_memops)] = .{ | 439 | result[@backingInt(Feature.paired_vector_memops)] = .{ |
| 440 | .llvm_name = "paired-vector-memops", | 440 | .llvm_name = "paired-vector-memops", |
| 441 | .description = "32Byte load and store instructions", | 441 | .description = "32Byte load and store instructions", |
| 442 | .dependencies = featureSet(&[_]Feature{ | 442 | .dependencies = featureSet(&[_]Feature{ |
| 443 | .isa_v30_instructions, | 443 | .isa_v30_instructions, |
| 444 | }), | 444 | }), |
| 445 | }; | 445 | }; |
| 446 | result[@intFromEnum(Feature.partword_atomics)] = .{ | 446 | result[@backingInt(Feature.partword_atomics)] = .{ |
| 447 | .llvm_name = "partword-atomics", | 447 | .llvm_name = "partword-atomics", |
| 448 | .description = "Enable l[bh]arx and st[bh]cx.", | 448 | .description = "Enable l[bh]arx and st[bh]cx.", |
| 449 | .dependencies = featureSet(&[_]Feature{}), | 449 | .dependencies = featureSet(&[_]Feature{}), |
| 450 | }; | 450 | }; |
| 451 | result[@intFromEnum(Feature.pcrelative_memops)] = .{ | 451 | result[@backingInt(Feature.pcrelative_memops)] = .{ |
| 452 | .llvm_name = "pcrelative-memops", | 452 | .llvm_name = "pcrelative-memops", |
| 453 | .description = "Enable PC relative Memory Ops", | 453 | .description = "Enable PC relative Memory Ops", |
| 454 | .dependencies = featureSet(&[_]Feature{ | 454 | .dependencies = featureSet(&[_]Feature{ |
| 455 | .prefix_instrs, | 455 | .prefix_instrs, |
| 456 | }), | 456 | }), |
| 457 | }; | 457 | }; |
| 458 | result[@intFromEnum(Feature.popcntd)] = .{ | 458 | result[@backingInt(Feature.popcntd)] = .{ |
| 459 | .llvm_name = "popcntd", | 459 | .llvm_name = "popcntd", |
| 460 | .description = "Enable the popcnt[dw] instructions", | 460 | .description = "Enable the popcnt[dw] instructions", |
| 461 | .dependencies = featureSet(&[_]Feature{}), | 461 | .dependencies = featureSet(&[_]Feature{}), |
| 462 | }; | 462 | }; |
| 463 | result[@intFromEnum(Feature.power10_vector)] = .{ | 463 | result[@backingInt(Feature.power10_vector)] = .{ |
| 464 | .llvm_name = "power10-vector", | 464 | .llvm_name = "power10-vector", |
| 465 | .description = "Enable POWER10 vector instructions", | 465 | .description = "Enable POWER10 vector instructions", |
| 466 | .dependencies = featureSet(&[_]Feature{ | 466 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -468,14 +468,14 @@ pub const all_features = blk: { | ... | @@ -468,14 +468,14 @@ pub const all_features = blk: { |
| 468 | .power9_vector, | 468 | .power9_vector, |
| 469 | }), | 469 | }), |
| 470 | }; | 470 | }; |
| 471 | result[@intFromEnum(Feature.power8_altivec)] = .{ | 471 | result[@backingInt(Feature.power8_altivec)] = .{ |
| 472 | .llvm_name = "power8-altivec", | 472 | .llvm_name = "power8-altivec", |
| 473 | .description = "Enable POWER8 Altivec instructions", | 473 | .description = "Enable POWER8 Altivec instructions", |
| 474 | .dependencies = featureSet(&[_]Feature{ | 474 | .dependencies = featureSet(&[_]Feature{ |
| 475 | .altivec, | 475 | .altivec, |
| 476 | }), | 476 | }), |
| 477 | }; | 477 | }; |
| 478 | result[@intFromEnum(Feature.power8_vector)] = .{ | 478 | result[@backingInt(Feature.power8_vector)] = .{ |
| 479 | .llvm_name = "power8-vector", | 479 | .llvm_name = "power8-vector", |
| 480 | .description = "Enable POWER8 vector instructions", | 480 | .description = "Enable POWER8 vector instructions", |
| 481 | .dependencies = featureSet(&[_]Feature{ | 481 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -483,7 +483,7 @@ pub const all_features = blk: { | ... | @@ -483,7 +483,7 @@ pub const all_features = blk: { |
| 483 | .vsx, | 483 | .vsx, |
| 484 | }), | 484 | }), |
| 485 | }; | 485 | }; |
| 486 | result[@intFromEnum(Feature.power9_altivec)] = .{ | 486 | result[@backingInt(Feature.power9_altivec)] = .{ |
| 487 | .llvm_name = "power9-altivec", | 487 | .llvm_name = "power9-altivec", |
| 488 | .description = "Enable POWER9 Altivec instructions", | 488 | .description = "Enable POWER9 Altivec instructions", |
| 489 | .dependencies = featureSet(&[_]Feature{ | 489 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -491,7 +491,7 @@ pub const all_features = blk: { | ... | @@ -491,7 +491,7 @@ pub const all_features = blk: { |
| 491 | .power8_altivec, | 491 | .power8_altivec, |
| 492 | }), | 492 | }), |
| 493 | }; | 493 | }; |
| 494 | result[@intFromEnum(Feature.power9_vector)] = .{ | 494 | result[@backingInt(Feature.power9_vector)] = .{ |
| 495 | .llvm_name = "power9-vector", | 495 | .llvm_name = "power9-vector", |
| 496 | .description = "Enable POWER9 vector instructions", | 496 | .description = "Enable POWER9 vector instructions", |
| 497 | .dependencies = featureSet(&[_]Feature{ | 497 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -499,93 +499,93 @@ pub const all_features = blk: { | ... | @@ -499,93 +499,93 @@ pub const all_features = blk: { |
| 499 | .power9_altivec, | 499 | .power9_altivec, |
| 500 | }), | 500 | }), |
| 501 | }; | 501 | }; |
| 502 | result[@intFromEnum(Feature.ppc4xx)] = .{ | 502 | result[@backingInt(Feature.ppc4xx)] = .{ |
| 503 | .llvm_name = "ppc4xx", | 503 | .llvm_name = "ppc4xx", |
| 504 | .description = "Enable PPC 4xx instructions", | 504 | .description = "Enable PPC 4xx instructions", |
| 505 | .dependencies = featureSet(&[_]Feature{}), | 505 | .dependencies = featureSet(&[_]Feature{}), |
| 506 | }; | 506 | }; |
| 507 | result[@intFromEnum(Feature.ppc6xx)] = .{ | 507 | result[@backingInt(Feature.ppc6xx)] = .{ |
| 508 | .llvm_name = "ppc6xx", | 508 | .llvm_name = "ppc6xx", |
| 509 | .description = "Enable PPC 6xx instructions", | 509 | .description = "Enable PPC 6xx instructions", |
| 510 | .dependencies = featureSet(&[_]Feature{}), | 510 | .dependencies = featureSet(&[_]Feature{}), |
| 511 | }; | 511 | }; |
| 512 | result[@intFromEnum(Feature.ppc_postra_sched)] = .{ | 512 | result[@backingInt(Feature.ppc_postra_sched)] = .{ |
| 513 | .llvm_name = "ppc-postra-sched", | 513 | .llvm_name = "ppc-postra-sched", |
| 514 | .description = "Use PowerPC post-RA scheduling strategy", | 514 | .description = "Use PowerPC post-RA scheduling strategy", |
| 515 | .dependencies = featureSet(&[_]Feature{}), | 515 | .dependencies = featureSet(&[_]Feature{}), |
| 516 | }; | 516 | }; |
| 517 | result[@intFromEnum(Feature.ppc_prera_sched)] = .{ | 517 | result[@backingInt(Feature.ppc_prera_sched)] = .{ |
| 518 | .llvm_name = "ppc-prera-sched", | 518 | .llvm_name = "ppc-prera-sched", |
| 519 | .description = "Use PowerPC pre-RA scheduling strategy", | 519 | .description = "Use PowerPC pre-RA scheduling strategy", |
| 520 | .dependencies = featureSet(&[_]Feature{}), | 520 | .dependencies = featureSet(&[_]Feature{}), |
| 521 | }; | 521 | }; |
| 522 | result[@intFromEnum(Feature.predictable_select_expensive)] = .{ | 522 | result[@backingInt(Feature.predictable_select_expensive)] = .{ |
| 523 | .llvm_name = "predictable-select-expensive", | 523 | .llvm_name = "predictable-select-expensive", |
| 524 | .description = "Prefer likely predicted branches over selects", | 524 | .description = "Prefer likely predicted branches over selects", |
| 525 | .dependencies = featureSet(&[_]Feature{}), | 525 | .dependencies = featureSet(&[_]Feature{}), |
| 526 | }; | 526 | }; |
| 527 | result[@intFromEnum(Feature.prefix_instrs)] = .{ | 527 | result[@backingInt(Feature.prefix_instrs)] = .{ |
| 528 | .llvm_name = "prefix-instrs", | 528 | .llvm_name = "prefix-instrs", |
| 529 | .description = "Enable prefixed instructions", | 529 | .description = "Enable prefixed instructions", |
| 530 | .dependencies = featureSet(&[_]Feature{ | 530 | .dependencies = featureSet(&[_]Feature{ |
| 531 | .isa_v31_instructions, | 531 | .isa_v31_instructions, |
| 532 | }), | 532 | }), |
| 533 | }; | 533 | }; |
| 534 | result[@intFromEnum(Feature.privileged)] = .{ | 534 | result[@backingInt(Feature.privileged)] = .{ |
| 535 | .llvm_name = "privileged", | 535 | .llvm_name = "privileged", |
| 536 | .description = "Add privileged instructions", | 536 | .description = "Add privileged instructions", |
| 537 | .dependencies = featureSet(&[_]Feature{}), | 537 | .dependencies = featureSet(&[_]Feature{}), |
| 538 | }; | 538 | }; |
| 539 | result[@intFromEnum(Feature.quadword_atomics)] = .{ | 539 | result[@backingInt(Feature.quadword_atomics)] = .{ |
| 540 | .llvm_name = "quadword-atomics", | 540 | .llvm_name = "quadword-atomics", |
| 541 | .description = "Enable lqarx and stqcx.", | 541 | .description = "Enable lqarx and stqcx.", |
| 542 | .dependencies = featureSet(&[_]Feature{}), | 542 | .dependencies = featureSet(&[_]Feature{}), |
| 543 | }; | 543 | }; |
| 544 | result[@intFromEnum(Feature.recipprec)] = .{ | 544 | result[@backingInt(Feature.recipprec)] = .{ |
| 545 | .llvm_name = "recipprec", | 545 | .llvm_name = "recipprec", |
| 546 | .description = "Assume higher precision reciprocal estimates", | 546 | .description = "Assume higher precision reciprocal estimates", |
| 547 | .dependencies = featureSet(&[_]Feature{}), | 547 | .dependencies = featureSet(&[_]Feature{}), |
| 548 | }; | 548 | }; |
| 549 | result[@intFromEnum(Feature.rop_protect)] = .{ | 549 | result[@backingInt(Feature.rop_protect)] = .{ |
| 550 | .llvm_name = "rop-protect", | 550 | .llvm_name = "rop-protect", |
| 551 | .description = "Add ROP protect", | 551 | .description = "Add ROP protect", |
| 552 | .dependencies = featureSet(&[_]Feature{}), | 552 | .dependencies = featureSet(&[_]Feature{}), |
| 553 | }; | 553 | }; |
| 554 | result[@intFromEnum(Feature.secure_plt)] = .{ | 554 | result[@backingInt(Feature.secure_plt)] = .{ |
| 555 | .llvm_name = "secure-plt", | 555 | .llvm_name = "secure-plt", |
| 556 | .description = "Enable secure plt mode", | 556 | .description = "Enable secure plt mode", |
| 557 | .dependencies = featureSet(&[_]Feature{}), | 557 | .dependencies = featureSet(&[_]Feature{}), |
| 558 | }; | 558 | }; |
| 559 | result[@intFromEnum(Feature.slow_popcntd)] = .{ | 559 | result[@backingInt(Feature.slow_popcntd)] = .{ |
| 560 | .llvm_name = "slow-popcntd", | 560 | .llvm_name = "slow-popcntd", |
| 561 | .description = "Has slow popcnt[dw] instructions", | 561 | .description = "Has slow popcnt[dw] instructions", |
| 562 | .dependencies = featureSet(&[_]Feature{}), | 562 | .dependencies = featureSet(&[_]Feature{}), |
| 563 | }; | 563 | }; |
| 564 | result[@intFromEnum(Feature.spe)] = .{ | 564 | result[@backingInt(Feature.spe)] = .{ |
| 565 | .llvm_name = "spe", | 565 | .llvm_name = "spe", |
| 566 | .description = "Enable SPE instructions", | 566 | .description = "Enable SPE instructions", |
| 567 | .dependencies = featureSet(&[_]Feature{ | 567 | .dependencies = featureSet(&[_]Feature{ |
| 568 | .hard_float, | 568 | .hard_float, |
| 569 | }), | 569 | }), |
| 570 | }; | 570 | }; |
| 571 | result[@intFromEnum(Feature.stfiwx)] = .{ | 571 | result[@backingInt(Feature.stfiwx)] = .{ |
| 572 | .llvm_name = "stfiwx", | 572 | .llvm_name = "stfiwx", |
| 573 | .description = "Enable the stfiwx instruction", | 573 | .description = "Enable the stfiwx instruction", |
| 574 | .dependencies = featureSet(&[_]Feature{ | 574 | .dependencies = featureSet(&[_]Feature{ |
| 575 | .fpu, | 575 | .fpu, |
| 576 | }), | 576 | }), |
| 577 | }; | 577 | }; |
| 578 | result[@intFromEnum(Feature.two_const_nr)] = .{ | 578 | result[@backingInt(Feature.two_const_nr)] = .{ |
| 579 | .llvm_name = "two-const-nr", | 579 | .llvm_name = "two-const-nr", |
| 580 | .description = "Requires two constant Newton-Raphson computation", | 580 | .description = "Requires two constant Newton-Raphson computation", |
| 581 | .dependencies = featureSet(&[_]Feature{}), | 581 | .dependencies = featureSet(&[_]Feature{}), |
| 582 | }; | 582 | }; |
| 583 | result[@intFromEnum(Feature.vectors_use_two_units)] = .{ | 583 | result[@backingInt(Feature.vectors_use_two_units)] = .{ |
| 584 | .llvm_name = "vectors-use-two-units", | 584 | .llvm_name = "vectors-use-two-units", |
| 585 | .description = "Vectors use two units", | 585 | .description = "Vectors use two units", |
| 586 | .dependencies = featureSet(&[_]Feature{}), | 586 | .dependencies = featureSet(&[_]Feature{}), |
| 587 | }; | 587 | }; |
| 588 | result[@intFromEnum(Feature.vsx)] = .{ | 588 | result[@backingInt(Feature.vsx)] = .{ |
| 589 | .llvm_name = "vsx", | 589 | .llvm_name = "vsx", |
| 590 | .description = "Enable VSX instructions", | 590 | .description = "Enable VSX instructions", |
| 591 | .dependencies = featureSet(&[_]Feature{ | 591 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/propeller.zig+1-1| ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { | ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { |
| 17 | const len = @typeInfo(Feature).@"enum".field_names.len; | 17 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 19 | var result: [len]CpuFeature = undefined; | 19 | var result: [len]CpuFeature = undefined; |
| 20 | result[@intFromEnum(Feature.p2)] = .{ | 20 | result[@backingInt(Feature.p2)] = .{ |
| 21 | .llvm_name = null, | 21 | .llvm_name = null, |
| 22 | .description = "Enable Propeller 2", | 22 | .description = "Enable Propeller 2", |
| 23 | .dependencies = featureSet(&[_]Feature{}), | 23 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/riscv.zig+347-347| ... | @@ -364,17 +364,17 @@ pub const all_features = blk: { | ... | @@ -364,17 +364,17 @@ pub const all_features = blk: { |
| 364 | const len = @typeInfo(Feature).@"enum".field_names.len; | 364 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 365 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 365 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 366 | var result: [len]CpuFeature = undefined; | 366 | var result: [len]CpuFeature = undefined; |
| 367 | result[@intFromEnum(Feature.@"32bit")] = .{ | 367 | result[@backingInt(Feature.@"32bit")] = .{ |
| 368 | .llvm_name = "32bit", | 368 | .llvm_name = "32bit", |
| 369 | .description = "Implements RV32", | 369 | .description = "Implements RV32", |
| 370 | .dependencies = featureSet(&[_]Feature{}), | 370 | .dependencies = featureSet(&[_]Feature{}), |
| 371 | }; | 371 | }; |
| 372 | result[@intFromEnum(Feature.@"64bit")] = .{ | 372 | result[@backingInt(Feature.@"64bit")] = .{ |
| 373 | .llvm_name = "64bit", | 373 | .llvm_name = "64bit", |
| 374 | .description = "Implements RV64", | 374 | .description = "Implements RV64", |
| 375 | .dependencies = featureSet(&[_]Feature{}), | 375 | .dependencies = featureSet(&[_]Feature{}), |
| 376 | }; | 376 | }; |
| 377 | result[@intFromEnum(Feature.a)] = .{ | 377 | result[@backingInt(Feature.a)] = .{ |
| 378 | .llvm_name = "a", | 378 | .llvm_name = "a", |
| 379 | .description = "'A' (Atomic Instructions)", | 379 | .description = "'A' (Atomic Instructions)", |
| 380 | .dependencies = featureSet(&[_]Feature{ | 380 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -382,32 +382,32 @@ pub const all_features = blk: { | ... | @@ -382,32 +382,32 @@ pub const all_features = blk: { |
| 382 | .zalrsc, | 382 | .zalrsc, |
| 383 | }), | 383 | }), |
| 384 | }; | 384 | }; |
| 385 | result[@intFromEnum(Feature.add_load_fusion)] = .{ | 385 | result[@backingInt(Feature.add_load_fusion)] = .{ |
| 386 | .llvm_name = "add-load-fusion", | 386 | .llvm_name = "add-load-fusion", |
| 387 | .description = "Enable ADD(.UW) + load macrofusion", | 387 | .description = "Enable ADD(.UW) + load macrofusion", |
| 388 | .dependencies = featureSet(&[_]Feature{}), | 388 | .dependencies = featureSet(&[_]Feature{}), |
| 389 | }; | 389 | }; |
| 390 | result[@intFromEnum(Feature.addi_load_fusion)] = .{ | 390 | result[@backingInt(Feature.addi_load_fusion)] = .{ |
| 391 | .llvm_name = "addi-load-fusion", | 391 | .llvm_name = "addi-load-fusion", |
| 392 | .description = "Enable ADDI + load macrofusion", | 392 | .description = "Enable ADDI + load macrofusion", |
| 393 | .dependencies = featureSet(&[_]Feature{}), | 393 | .dependencies = featureSet(&[_]Feature{}), |
| 394 | }; | 394 | }; |
| 395 | result[@intFromEnum(Feature.andes45)] = .{ | 395 | result[@backingInt(Feature.andes45)] = .{ |
| 396 | .llvm_name = "andes45", | 396 | .llvm_name = "andes45", |
| 397 | .description = "Andes 45-Series processors", | 397 | .description = "Andes 45-Series processors", |
| 398 | .dependencies = featureSet(&[_]Feature{}), | 398 | .dependencies = featureSet(&[_]Feature{}), |
| 399 | }; | 399 | }; |
| 400 | result[@intFromEnum(Feature.auipc_addi_fusion)] = .{ | 400 | result[@backingInt(Feature.auipc_addi_fusion)] = .{ |
| 401 | .llvm_name = "auipc-addi-fusion", | 401 | .llvm_name = "auipc-addi-fusion", |
| 402 | .description = "Enable AUIPC+ADDI macrofusion", | 402 | .description = "Enable AUIPC+ADDI macrofusion", |
| 403 | .dependencies = featureSet(&[_]Feature{}), | 403 | .dependencies = featureSet(&[_]Feature{}), |
| 404 | }; | 404 | }; |
| 405 | result[@intFromEnum(Feature.auipc_load_fusion)] = .{ | 405 | result[@backingInt(Feature.auipc_load_fusion)] = .{ |
| 406 | .llvm_name = "auipc-load-fusion", | 406 | .llvm_name = "auipc-load-fusion", |
| 407 | .description = "Enable AUIPC + load macrofusion", | 407 | .description = "Enable AUIPC + load macrofusion", |
| 408 | .dependencies = featureSet(&[_]Feature{}), | 408 | .dependencies = featureSet(&[_]Feature{}), |
| 409 | }; | 409 | }; |
| 410 | result[@intFromEnum(Feature.b)] = .{ | 410 | result[@backingInt(Feature.b)] = .{ |
| 411 | .llvm_name = "b", | 411 | .llvm_name = "b", |
| 412 | .description = "'B' (the collection of the Zba, Zbb, Zbs extensions)", | 412 | .description = "'B' (the collection of the Zba, Zbb, Zbs extensions)", |
| 413 | .dependencies = featureSet(&[_]Feature{ | 413 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -416,86 +416,86 @@ pub const all_features = blk: { | ... | @@ -416,86 +416,86 @@ pub const all_features = blk: { |
| 416 | .zbs, | 416 | .zbs, |
| 417 | }), | 417 | }), |
| 418 | }; | 418 | }; |
| 419 | result[@intFromEnum(Feature.bfext_fusion)] = .{ | 419 | result[@backingInt(Feature.bfext_fusion)] = .{ |
| 420 | .llvm_name = "bfext-fusion", | 420 | .llvm_name = "bfext-fusion", |
| 421 | .description = "Enable SLLI+SRLI (bitfield extract) macrofusion", | 421 | .description = "Enable SLLI+SRLI (bitfield extract) macrofusion", |
| 422 | .dependencies = featureSet(&[_]Feature{}), | 422 | .dependencies = featureSet(&[_]Feature{}), |
| 423 | }; | 423 | }; |
| 424 | result[@intFromEnum(Feature.c)] = .{ | 424 | result[@backingInt(Feature.c)] = .{ |
| 425 | .llvm_name = "c", | 425 | .llvm_name = "c", |
| 426 | .description = "'C' (Compressed Instructions)", | 426 | .description = "'C' (Compressed Instructions)", |
| 427 | .dependencies = featureSet(&[_]Feature{ | 427 | .dependencies = featureSet(&[_]Feature{ |
| 428 | .zca, | 428 | .zca, |
| 429 | }), | 429 | }), |
| 430 | }; | 430 | }; |
| 431 | result[@intFromEnum(Feature.conditional_cmv_fusion)] = .{ | 431 | result[@backingInt(Feature.conditional_cmv_fusion)] = .{ |
| 432 | .llvm_name = "conditional-cmv-fusion", | 432 | .llvm_name = "conditional-cmv-fusion", |
| 433 | .description = "Enable branch+c.mv fusion", | 433 | .description = "Enable branch+c.mv fusion", |
| 434 | .dependencies = featureSet(&[_]Feature{}), | 434 | .dependencies = featureSet(&[_]Feature{}), |
| 435 | }; | 435 | }; |
| 436 | result[@intFromEnum(Feature.d)] = .{ | 436 | result[@backingInt(Feature.d)] = .{ |
| 437 | .llvm_name = "d", | 437 | .llvm_name = "d", |
| 438 | .description = "'D' (Double-Precision Floating-Point)", | 438 | .description = "'D' (Double-Precision Floating-Point)", |
| 439 | .dependencies = featureSet(&[_]Feature{ | 439 | .dependencies = featureSet(&[_]Feature{ |
| 440 | .f, | 440 | .f, |
| 441 | }), | 441 | }), |
| 442 | }; | 442 | }; |
| 443 | result[@intFromEnum(Feature.disable_latency_sched_heuristic)] = .{ | 443 | result[@backingInt(Feature.disable_latency_sched_heuristic)] = .{ |
| 444 | .llvm_name = "disable-latency-sched-heuristic", | 444 | .llvm_name = "disable-latency-sched-heuristic", |
| 445 | .description = "Disable latency scheduling heuristic", | 445 | .description = "Disable latency scheduling heuristic", |
| 446 | .dependencies = featureSet(&[_]Feature{}), | 446 | .dependencies = featureSet(&[_]Feature{}), |
| 447 | }; | 447 | }; |
| 448 | result[@intFromEnum(Feature.disable_misched_load_clustering)] = .{ | 448 | result[@backingInt(Feature.disable_misched_load_clustering)] = .{ |
| 449 | .llvm_name = "disable-misched-load-clustering", | 449 | .llvm_name = "disable-misched-load-clustering", |
| 450 | .description = "Disable load clustering in the machine scheduler", | 450 | .description = "Disable load clustering in the machine scheduler", |
| 451 | .dependencies = featureSet(&[_]Feature{}), | 451 | .dependencies = featureSet(&[_]Feature{}), |
| 452 | }; | 452 | }; |
| 453 | result[@intFromEnum(Feature.disable_misched_store_clustering)] = .{ | 453 | result[@backingInt(Feature.disable_misched_store_clustering)] = .{ |
| 454 | .llvm_name = "disable-misched-store-clustering", | 454 | .llvm_name = "disable-misched-store-clustering", |
| 455 | .description = "Disable store clustering in the machine scheduler", | 455 | .description = "Disable store clustering in the machine scheduler", |
| 456 | .dependencies = featureSet(&[_]Feature{}), | 456 | .dependencies = featureSet(&[_]Feature{}), |
| 457 | }; | 457 | }; |
| 458 | result[@intFromEnum(Feature.disable_postmisched_load_clustering)] = .{ | 458 | result[@backingInt(Feature.disable_postmisched_load_clustering)] = .{ |
| 459 | .llvm_name = "disable-postmisched-load-clustering", | 459 | .llvm_name = "disable-postmisched-load-clustering", |
| 460 | .description = "Disable PostRA load clustering in the machine scheduler", | 460 | .description = "Disable PostRA load clustering in the machine scheduler", |
| 461 | .dependencies = featureSet(&[_]Feature{}), | 461 | .dependencies = featureSet(&[_]Feature{}), |
| 462 | }; | 462 | }; |
| 463 | result[@intFromEnum(Feature.disable_postmisched_store_clustering)] = .{ | 463 | result[@backingInt(Feature.disable_postmisched_store_clustering)] = .{ |
| 464 | .llvm_name = "disable-postmisched-store-clustering", | 464 | .llvm_name = "disable-postmisched-store-clustering", |
| 465 | .description = "Disable PostRA store clustering in the machine scheduler", | 465 | .description = "Disable PostRA store clustering in the machine scheduler", |
| 466 | .dependencies = featureSet(&[_]Feature{}), | 466 | .dependencies = featureSet(&[_]Feature{}), |
| 467 | }; | 467 | }; |
| 468 | result[@intFromEnum(Feature.dlen_factor_2)] = .{ | 468 | result[@backingInt(Feature.dlen_factor_2)] = .{ |
| 469 | .llvm_name = "dlen-factor-2", | 469 | .llvm_name = "dlen-factor-2", |
| 470 | .description = "Vector unit DLEN(data path width) is half of VLEN", | 470 | .description = "Vector unit DLEN(data path width) is half of VLEN", |
| 471 | .dependencies = featureSet(&[_]Feature{}), | 471 | .dependencies = featureSet(&[_]Feature{}), |
| 472 | }; | 472 | }; |
| 473 | result[@intFromEnum(Feature.e)] = .{ | 473 | result[@backingInt(Feature.e)] = .{ |
| 474 | .llvm_name = "e", | 474 | .llvm_name = "e", |
| 475 | .description = "'E' (Embedded Instruction Set with 16 GPRs)", | 475 | .description = "'E' (Embedded Instruction Set with 16 GPRs)", |
| 476 | .dependencies = featureSet(&[_]Feature{}), | 476 | .dependencies = featureSet(&[_]Feature{}), |
| 477 | }; | 477 | }; |
| 478 | result[@intFromEnum(Feature.enable_vsetvli_sched_heuristic)] = .{ | 478 | result[@backingInt(Feature.enable_vsetvli_sched_heuristic)] = .{ |
| 479 | .llvm_name = "enable-vsetvli-sched-heuristic", | 479 | .llvm_name = "enable-vsetvli-sched-heuristic", |
| 480 | .description = "Enable vsetvli-based scheduling heuristic", | 480 | .description = "Enable vsetvli-based scheduling heuristic", |
| 481 | .dependencies = featureSet(&[_]Feature{}), | 481 | .dependencies = featureSet(&[_]Feature{}), |
| 482 | }; | 482 | }; |
| 483 | result[@intFromEnum(Feature.exact_asm)] = .{ | 483 | result[@backingInt(Feature.exact_asm)] = .{ |
| 484 | .llvm_name = "exact-asm", | 484 | .llvm_name = "exact-asm", |
| 485 | .description = "Enable Exact Assembly (Disables Compression and Relaxation)", | 485 | .description = "Enable Exact Assembly (Disables Compression and Relaxation)", |
| 486 | .dependencies = featureSet(&[_]Feature{}), | 486 | .dependencies = featureSet(&[_]Feature{}), |
| 487 | }; | 487 | }; |
| 488 | result[@intFromEnum(Feature.experimental)] = .{ | 488 | result[@backingInt(Feature.experimental)] = .{ |
| 489 | .llvm_name = "experimental", | 489 | .llvm_name = "experimental", |
| 490 | .description = "Experimental intrinsics", | 490 | .description = "Experimental intrinsics", |
| 491 | .dependencies = featureSet(&[_]Feature{}), | 491 | .dependencies = featureSet(&[_]Feature{}), |
| 492 | }; | 492 | }; |
| 493 | result[@intFromEnum(Feature.experimental_p)] = .{ | 493 | result[@backingInt(Feature.experimental_p)] = .{ |
| 494 | .llvm_name = "experimental-p", | 494 | .llvm_name = "experimental-p", |
| 495 | .description = "'P' ('Base P' (Packed SIMD))", | 495 | .description = "'P' ('Base P' (Packed SIMD))", |
| 496 | .dependencies = featureSet(&[_]Feature{}), | 496 | .dependencies = featureSet(&[_]Feature{}), |
| 497 | }; | 497 | }; |
| 498 | result[@intFromEnum(Feature.experimental_rvm23u32)] = .{ | 498 | result[@backingInt(Feature.experimental_rvm23u32)] = .{ |
| 499 | .llvm_name = "experimental-rvm23u32", | 499 | .llvm_name = "experimental-rvm23u32", |
| 500 | .description = "RISC-V experimental-rvm23u32 profile", | 500 | .description = "RISC-V experimental-rvm23u32 profile", |
| 501 | .dependencies = featureSet(&[_]Feature{ | 501 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -512,49 +512,49 @@ pub const all_features = blk: { | ... | @@ -512,49 +512,49 @@ pub const all_features = blk: { |
| 512 | .zimop, | 512 | .zimop, |
| 513 | }), | 513 | }), |
| 514 | }; | 514 | }; |
| 515 | result[@intFromEnum(Feature.experimental_smpmpmt)] = .{ | 515 | result[@backingInt(Feature.experimental_smpmpmt)] = .{ |
| 516 | .llvm_name = "experimental-smpmpmt", | 516 | .llvm_name = "experimental-smpmpmt", |
| 517 | .description = "'Smpmpmt' (PMP-based Memory Types Extension)", | 517 | .description = "'Smpmpmt' (PMP-based Memory Types Extension)", |
| 518 | .dependencies = featureSet(&[_]Feature{}), | 518 | .dependencies = featureSet(&[_]Feature{}), |
| 519 | }; | 519 | }; |
| 520 | result[@intFromEnum(Feature.experimental_svukte)] = .{ | 520 | result[@backingInt(Feature.experimental_svukte)] = .{ |
| 521 | .llvm_name = "experimental-svukte", | 521 | .llvm_name = "experimental-svukte", |
| 522 | .description = "'Svukte' (Address-Independent Latency of User-Mode Faults to Supervisor Addresses)", | 522 | .description = "'Svukte' (Address-Independent Latency of User-Mode Faults to Supervisor Addresses)", |
| 523 | .dependencies = featureSet(&[_]Feature{}), | 523 | .dependencies = featureSet(&[_]Feature{}), |
| 524 | }; | 524 | }; |
| 525 | result[@intFromEnum(Feature.experimental_xrivosvisni)] = .{ | 525 | result[@backingInt(Feature.experimental_xrivosvisni)] = .{ |
| 526 | .llvm_name = "experimental-xrivosvisni", | 526 | .llvm_name = "experimental-xrivosvisni", |
| 527 | .description = "'XRivosVisni' (Rivos Vector Integer Small New)", | 527 | .description = "'XRivosVisni' (Rivos Vector Integer Small New)", |
| 528 | .dependencies = featureSet(&[_]Feature{}), | 528 | .dependencies = featureSet(&[_]Feature{}), |
| 529 | }; | 529 | }; |
| 530 | result[@intFromEnum(Feature.experimental_xrivosvizip)] = .{ | 530 | result[@backingInt(Feature.experimental_xrivosvizip)] = .{ |
| 531 | .llvm_name = "experimental-xrivosvizip", | 531 | .llvm_name = "experimental-xrivosvizip", |
| 532 | .description = "'XRivosVizip' (Rivos Vector Register Zips)", | 532 | .description = "'XRivosVizip' (Rivos Vector Register Zips)", |
| 533 | .dependencies = featureSet(&[_]Feature{}), | 533 | .dependencies = featureSet(&[_]Feature{}), |
| 534 | }; | 534 | }; |
| 535 | result[@intFromEnum(Feature.experimental_xsfmclic)] = .{ | 535 | result[@backingInt(Feature.experimental_xsfmclic)] = .{ |
| 536 | .llvm_name = "experimental-xsfmclic", | 536 | .llvm_name = "experimental-xsfmclic", |
| 537 | .description = "'XSfmclic' (SiFive CLIC Machine-mode CSRs)", | 537 | .description = "'XSfmclic' (SiFive CLIC Machine-mode CSRs)", |
| 538 | .dependencies = featureSet(&[_]Feature{}), | 538 | .dependencies = featureSet(&[_]Feature{}), |
| 539 | }; | 539 | }; |
| 540 | result[@intFromEnum(Feature.experimental_xsfsclic)] = .{ | 540 | result[@backingInt(Feature.experimental_xsfsclic)] = .{ |
| 541 | .llvm_name = "experimental-xsfsclic", | 541 | .llvm_name = "experimental-xsfsclic", |
| 542 | .description = "'XSfsclic' (SiFive CLIC Supervisor-mode CSRs)", | 542 | .description = "'XSfsclic' (SiFive CLIC Supervisor-mode CSRs)", |
| 543 | .dependencies = featureSet(&[_]Feature{}), | 543 | .dependencies = featureSet(&[_]Feature{}), |
| 544 | }; | 544 | }; |
| 545 | result[@intFromEnum(Feature.experimental_zibi)] = .{ | 545 | result[@backingInt(Feature.experimental_zibi)] = .{ |
| 546 | .llvm_name = "experimental-zibi", | 546 | .llvm_name = "experimental-zibi", |
| 547 | .description = "'Zibi' (Branch with Immediate)", | 547 | .description = "'Zibi' (Branch with Immediate)", |
| 548 | .dependencies = featureSet(&[_]Feature{}), | 548 | .dependencies = featureSet(&[_]Feature{}), |
| 549 | }; | 549 | }; |
| 550 | result[@intFromEnum(Feature.experimental_zicfilp)] = .{ | 550 | result[@backingInt(Feature.experimental_zicfilp)] = .{ |
| 551 | .llvm_name = "experimental-zicfilp", | 551 | .llvm_name = "experimental-zicfilp", |
| 552 | .description = "'Zicfilp' (Landing pad)", | 552 | .description = "'Zicfilp' (Landing pad)", |
| 553 | .dependencies = featureSet(&[_]Feature{ | 553 | .dependencies = featureSet(&[_]Feature{ |
| 554 | .zicsr, | 554 | .zicsr, |
| 555 | }), | 555 | }), |
| 556 | }; | 556 | }; |
| 557 | result[@intFromEnum(Feature.experimental_zicfiss)] = .{ | 557 | result[@backingInt(Feature.experimental_zicfiss)] = .{ |
| 558 | .llvm_name = "experimental-zicfiss", | 558 | .llvm_name = "experimental-zicfiss", |
| 559 | .description = "'Zicfiss' (Shadow stack)", | 559 | .description = "'Zicfiss' (Shadow stack)", |
| 560 | .dependencies = featureSet(&[_]Feature{ | 560 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -562,14 +562,14 @@ pub const all_features = blk: { | ... | @@ -562,14 +562,14 @@ pub const all_features = blk: { |
| 562 | .zimop, | 562 | .zimop, |
| 563 | }), | 563 | }), |
| 564 | }; | 564 | }; |
| 565 | result[@intFromEnum(Feature.experimental_zvbc32e)] = .{ | 565 | result[@backingInt(Feature.experimental_zvbc32e)] = .{ |
| 566 | .llvm_name = "experimental-zvbc32e", | 566 | .llvm_name = "experimental-zvbc32e", |
| 567 | .description = "'Zvbc32e' (Vector Carryless Multiplication with 32-bits elements)", | 567 | .description = "'Zvbc32e' (Vector Carryless Multiplication with 32-bits elements)", |
| 568 | .dependencies = featureSet(&[_]Feature{ | 568 | .dependencies = featureSet(&[_]Feature{ |
| 569 | .zve32x, | 569 | .zve32x, |
| 570 | }), | 570 | }), |
| 571 | }; | 571 | }; |
| 572 | result[@intFromEnum(Feature.experimental_zvfbfa)] = .{ | 572 | result[@backingInt(Feature.experimental_zvfbfa)] = .{ |
| 573 | .llvm_name = "experimental-zvfbfa", | 573 | .llvm_name = "experimental-zvfbfa", |
| 574 | .description = "'Zvfbfa' (Additional BF16 vector compute support)", | 574 | .description = "'Zvfbfa' (Additional BF16 vector compute support)", |
| 575 | .dependencies = featureSet(&[_]Feature{ | 575 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -577,324 +577,324 @@ pub const all_features = blk: { | ... | @@ -577,324 +577,324 @@ pub const all_features = blk: { |
| 577 | .zve32f, | 577 | .zve32f, |
| 578 | }), | 578 | }), |
| 579 | }; | 579 | }; |
| 580 | result[@intFromEnum(Feature.experimental_zvfofp8min)] = .{ | 580 | result[@backingInt(Feature.experimental_zvfofp8min)] = .{ |
| 581 | .llvm_name = "experimental-zvfofp8min", | 581 | .llvm_name = "experimental-zvfofp8min", |
| 582 | .description = "'Zvfofp8min' (Vector OFP8 Converts)", | 582 | .description = "'Zvfofp8min' (Vector OFP8 Converts)", |
| 583 | .dependencies = featureSet(&[_]Feature{ | 583 | .dependencies = featureSet(&[_]Feature{ |
| 584 | .zve32f, | 584 | .zve32f, |
| 585 | }), | 585 | }), |
| 586 | }; | 586 | }; |
| 587 | result[@intFromEnum(Feature.experimental_zvkgs)] = .{ | 587 | result[@backingInt(Feature.experimental_zvkgs)] = .{ |
| 588 | .llvm_name = "experimental-zvkgs", | 588 | .llvm_name = "experimental-zvkgs", |
| 589 | .description = "'Zvkgs' (Vector-Scalar GCM instructions for Cryptography)", | 589 | .description = "'Zvkgs' (Vector-Scalar GCM instructions for Cryptography)", |
| 590 | .dependencies = featureSet(&[_]Feature{ | 590 | .dependencies = featureSet(&[_]Feature{ |
| 591 | .zvkg, | 591 | .zvkg, |
| 592 | }), | 592 | }), |
| 593 | }; | 593 | }; |
| 594 | result[@intFromEnum(Feature.experimental_zvqdotq)] = .{ | 594 | result[@backingInt(Feature.experimental_zvqdotq)] = .{ |
| 595 | .llvm_name = "experimental-zvqdotq", | 595 | .llvm_name = "experimental-zvqdotq", |
| 596 | .description = "'Zvqdotq' (Vector quad widening 4D Dot Product)", | 596 | .description = "'Zvqdotq' (Vector quad widening 4D Dot Product)", |
| 597 | .dependencies = featureSet(&[_]Feature{ | 597 | .dependencies = featureSet(&[_]Feature{ |
| 598 | .zve32x, | 598 | .zve32x, |
| 599 | }), | 599 | }), |
| 600 | }; | 600 | }; |
| 601 | result[@intFromEnum(Feature.f)] = .{ | 601 | result[@backingInt(Feature.f)] = .{ |
| 602 | .llvm_name = "f", | 602 | .llvm_name = "f", |
| 603 | .description = "'F' (Single-Precision Floating-Point)", | 603 | .description = "'F' (Single-Precision Floating-Point)", |
| 604 | .dependencies = featureSet(&[_]Feature{ | 604 | .dependencies = featureSet(&[_]Feature{ |
| 605 | .zicsr, | 605 | .zicsr, |
| 606 | }), | 606 | }), |
| 607 | }; | 607 | }; |
| 608 | result[@intFromEnum(Feature.forced_atomics)] = .{ | 608 | result[@backingInt(Feature.forced_atomics)] = .{ |
| 609 | .llvm_name = "forced-atomics", | 609 | .llvm_name = "forced-atomics", |
| 610 | .description = "Assume that lock-free native-width atomics are available", | 610 | .description = "Assume that lock-free native-width atomics are available", |
| 611 | .dependencies = featureSet(&[_]Feature{}), | 611 | .dependencies = featureSet(&[_]Feature{}), |
| 612 | }; | 612 | }; |
| 613 | result[@intFromEnum(Feature.h)] = .{ | 613 | result[@backingInt(Feature.h)] = .{ |
| 614 | .llvm_name = "h", | 614 | .llvm_name = "h", |
| 615 | .description = "'H' (Hypervisor)", | 615 | .description = "'H' (Hypervisor)", |
| 616 | .dependencies = featureSet(&[_]Feature{}), | 616 | .dependencies = featureSet(&[_]Feature{}), |
| 617 | }; | 617 | }; |
| 618 | result[@intFromEnum(Feature.i)] = .{ | 618 | result[@backingInt(Feature.i)] = .{ |
| 619 | .llvm_name = "i", | 619 | .llvm_name = "i", |
| 620 | .description = "'I' (Base Integer Instruction Set)", | 620 | .description = "'I' (Base Integer Instruction Set)", |
| 621 | .dependencies = featureSet(&[_]Feature{}), | 621 | .dependencies = featureSet(&[_]Feature{}), |
| 622 | }; | 622 | }; |
| 623 | result[@intFromEnum(Feature.ld_add_fusion)] = .{ | 623 | result[@backingInt(Feature.ld_add_fusion)] = .{ |
| 624 | .llvm_name = "ld-add-fusion", | 624 | .llvm_name = "ld-add-fusion", |
| 625 | .description = "Enable LD+ADD macrofusion", | 625 | .description = "Enable LD+ADD macrofusion", |
| 626 | .dependencies = featureSet(&[_]Feature{}), | 626 | .dependencies = featureSet(&[_]Feature{}), |
| 627 | }; | 627 | }; |
| 628 | result[@intFromEnum(Feature.log_vrgather)] = .{ | 628 | result[@backingInt(Feature.log_vrgather)] = .{ |
| 629 | .llvm_name = "log-vrgather", | 629 | .llvm_name = "log-vrgather", |
| 630 | .description = "Has vrgather.vv with LMUL*log2(LMUL) latency", | 630 | .description = "Has vrgather.vv with LMUL*log2(LMUL) latency", |
| 631 | .dependencies = featureSet(&[_]Feature{}), | 631 | .dependencies = featureSet(&[_]Feature{}), |
| 632 | }; | 632 | }; |
| 633 | result[@intFromEnum(Feature.lui_addi_fusion)] = .{ | 633 | result[@backingInt(Feature.lui_addi_fusion)] = .{ |
| 634 | .llvm_name = "lui-addi-fusion", | 634 | .llvm_name = "lui-addi-fusion", |
| 635 | .description = "Enable LUI+ADDI macro fusion", | 635 | .description = "Enable LUI+ADDI macro fusion", |
| 636 | .dependencies = featureSet(&[_]Feature{}), | 636 | .dependencies = featureSet(&[_]Feature{}), |
| 637 | }; | 637 | }; |
| 638 | result[@intFromEnum(Feature.lui_load_fusion)] = .{ | 638 | result[@backingInt(Feature.lui_load_fusion)] = .{ |
| 639 | .llvm_name = "lui-load-fusion", | 639 | .llvm_name = "lui-load-fusion", |
| 640 | .description = "Enable LUI + load macrofusion", | 640 | .description = "Enable LUI + load macrofusion", |
| 641 | .dependencies = featureSet(&[_]Feature{}), | 641 | .dependencies = featureSet(&[_]Feature{}), |
| 642 | }; | 642 | }; |
| 643 | result[@intFromEnum(Feature.m)] = .{ | 643 | result[@backingInt(Feature.m)] = .{ |
| 644 | .llvm_name = "m", | 644 | .llvm_name = "m", |
| 645 | .description = "'M' (Integer Multiplication and Division)", | 645 | .description = "'M' (Integer Multiplication and Division)", |
| 646 | .dependencies = featureSet(&[_]Feature{ | 646 | .dependencies = featureSet(&[_]Feature{ |
| 647 | .zmmul, | 647 | .zmmul, |
| 648 | }), | 648 | }), |
| 649 | }; | 649 | }; |
| 650 | result[@intFromEnum(Feature.mips_p8700)] = .{ | 650 | result[@backingInt(Feature.mips_p8700)] = .{ |
| 651 | .llvm_name = "mips-p8700", | 651 | .llvm_name = "mips-p8700", |
| 652 | .description = "MIPS p8700 processor", | 652 | .description = "MIPS p8700 processor", |
| 653 | .dependencies = featureSet(&[_]Feature{}), | 653 | .dependencies = featureSet(&[_]Feature{}), |
| 654 | }; | 654 | }; |
| 655 | result[@intFromEnum(Feature.no_default_unroll)] = .{ | 655 | result[@backingInt(Feature.no_default_unroll)] = .{ |
| 656 | .llvm_name = "no-default-unroll", | 656 | .llvm_name = "no-default-unroll", |
| 657 | .description = "Disable default unroll preference.", | 657 | .description = "Disable default unroll preference.", |
| 658 | .dependencies = featureSet(&[_]Feature{}), | 658 | .dependencies = featureSet(&[_]Feature{}), |
| 659 | }; | 659 | }; |
| 660 | result[@intFromEnum(Feature.no_sink_splat_operands)] = .{ | 660 | result[@backingInt(Feature.no_sink_splat_operands)] = .{ |
| 661 | .llvm_name = "no-sink-splat-operands", | 661 | .llvm_name = "no-sink-splat-operands", |
| 662 | .description = "Disable sink splat operands to enable .vx, .vf,.wx, and .wf instructions", | 662 | .description = "Disable sink splat operands to enable .vx, .vf,.wx, and .wf instructions", |
| 663 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "no-trailing-seq-cst-fence", | 666 | .llvm_name = "no-trailing-seq-cst-fence", |
| 667 | .description = "Disable trailing fence for seq-cst store.", | 667 | .description = "Disable trailing fence for seq-cst store.", |
| 668 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "optimized-nf2-segment-load-store", | 671 | .llvm_name = "optimized-nf2-segment-load-store", |
| 672 | .description = "vlseg2eN.v and vsseg2eN.v are implemented as a wide memory op and shuffle", | 672 | .description = "vlseg2eN.v and vsseg2eN.v are implemented as a wide memory op and shuffle", |
| 673 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "optimized-nf3-segment-load-store", | 676 | .llvm_name = "optimized-nf3-segment-load-store", |
| 677 | .description = "vlseg3eN.v and vsseg3eN.v are implemented as a wide memory op and shuffle", | 677 | .description = "vlseg3eN.v and vsseg3eN.v are implemented as a wide memory op and shuffle", |
| 678 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "optimized-nf4-segment-load-store", | 681 | .llvm_name = "optimized-nf4-segment-load-store", |
| 682 | .description = "vlseg4eN.v and vsseg4eN.v are implemented as a wide memory op and shuffle", | 682 | .description = "vlseg4eN.v and vsseg4eN.v are implemented as a wide memory op and shuffle", |
| 683 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "optimized-nf5-segment-load-store", | 686 | .llvm_name = "optimized-nf5-segment-load-store", |
| 687 | .description = "vlseg5eN.v and vsseg5eN.v are implemented as a wide memory op and shuffle", | 687 | .description = "vlseg5eN.v and vsseg5eN.v are implemented as a wide memory op and shuffle", |
| 688 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "optimized-nf6-segment-load-store", | 691 | .llvm_name = "optimized-nf6-segment-load-store", |
| 692 | .description = "vlseg6eN.v and vsseg6eN.v are implemented as a wide memory op and shuffle", | 692 | .description = "vlseg6eN.v and vsseg6eN.v are implemented as a wide memory op and shuffle", |
| 693 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "optimized-nf7-segment-load-store", | 696 | .llvm_name = "optimized-nf7-segment-load-store", |
| 697 | .description = "vlseg7eN.v and vsseg7eN.v are implemented as a wide memory op and shuffle", | 697 | .description = "vlseg7eN.v and vsseg7eN.v are implemented as a wide memory op and shuffle", |
| 698 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "optimized-nf8-segment-load-store", | 701 | .llvm_name = "optimized-nf8-segment-load-store", |
| 702 | .description = "vlseg8eN.v and vsseg8eN.v are implemented as a wide memory op and shuffle", | 702 | .description = "vlseg8eN.v and vsseg8eN.v are implemented as a wide memory op and shuffle", |
| 703 | .dependencies = featureSet(&[_]Feature{}), | 703 | .dependencies = featureSet(&[_]Feature{}), |
| 704 | }; | 704 | }; |
| 705 | result[@intFromEnum(Feature.optimized_zero_stride_load)] = .{ | 705 | result[@backingInt(Feature.optimized_zero_stride_load)] = .{ |
| 706 | .llvm_name = "optimized-zero-stride-load", | 706 | .llvm_name = "optimized-zero-stride-load", |
| 707 | .description = "Optimized (perform fewer memory operations)zero-stride vector load", | 707 | .description = "Optimized (perform fewer memory operations)zero-stride vector load", |
| 708 | .dependencies = featureSet(&[_]Feature{}), | 708 | .dependencies = featureSet(&[_]Feature{}), |
| 709 | }; | 709 | }; |
| 710 | result[@intFromEnum(Feature.permissive_zalrsc)] = .{ | 710 | result[@backingInt(Feature.permissive_zalrsc)] = .{ |
| 711 | .llvm_name = "permissive-zalrsc", | 711 | .llvm_name = "permissive-zalrsc", |
| 712 | .description = "Implementation permits non-base instructions between LR/SC pairs", | 712 | .description = "Implementation permits non-base instructions between LR/SC pairs", |
| 713 | .dependencies = featureSet(&[_]Feature{}), | 713 | .dependencies = featureSet(&[_]Feature{}), |
| 714 | }; | 714 | }; |
| 715 | result[@intFromEnum(Feature.predictable_select_expensive)] = .{ | 715 | result[@backingInt(Feature.predictable_select_expensive)] = .{ |
| 716 | .llvm_name = "predictable-select-expensive", | 716 | .llvm_name = "predictable-select-expensive", |
| 717 | .description = "Prefer likely predicted branches over selects", | 717 | .description = "Prefer likely predicted branches over selects", |
| 718 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "prefer-vsetvli-over-read-vlenb", | 721 | .llvm_name = "prefer-vsetvli-over-read-vlenb", |
| 722 | .description = "Prefer vsetvli over read vlenb CSR to calculate VLEN", | 722 | .description = "Prefer vsetvli over read vlenb CSR to calculate VLEN", |
| 723 | .dependencies = featureSet(&[_]Feature{}), | 723 | .dependencies = featureSet(&[_]Feature{}), |
| 724 | }; | 724 | }; |
| 725 | result[@intFromEnum(Feature.prefer_w_inst)] = .{ | 725 | result[@backingInt(Feature.prefer_w_inst)] = .{ |
| 726 | .llvm_name = "prefer-w-inst", | 726 | .llvm_name = "prefer-w-inst", |
| 727 | .description = "Prefer instructions with W suffix", | 727 | .description = "Prefer instructions with W suffix", |
| 728 | .dependencies = featureSet(&[_]Feature{}), | 728 | .dependencies = featureSet(&[_]Feature{}), |
| 729 | }; | 729 | }; |
| 730 | result[@intFromEnum(Feature.q)] = .{ | 730 | result[@backingInt(Feature.q)] = .{ |
| 731 | .llvm_name = "q", | 731 | .llvm_name = "q", |
| 732 | .description = "'Q' (Quad-Precision Floating-Point)", | 732 | .description = "'Q' (Quad-Precision Floating-Point)", |
| 733 | .dependencies = featureSet(&[_]Feature{ | 733 | .dependencies = featureSet(&[_]Feature{ |
| 734 | .d, | 734 | .d, |
| 735 | }), | 735 | }), |
| 736 | }; | 736 | }; |
| 737 | result[@intFromEnum(Feature.relax)] = .{ | 737 | result[@backingInt(Feature.relax)] = .{ |
| 738 | .llvm_name = "relax", | 738 | .llvm_name = "relax", |
| 739 | .description = "Enable Linker relaxation.", | 739 | .description = "Enable Linker relaxation.", |
| 740 | .dependencies = featureSet(&[_]Feature{}), | 740 | .dependencies = featureSet(&[_]Feature{}), |
| 741 | }; | 741 | }; |
| 742 | result[@intFromEnum(Feature.reserve_x1)] = .{ | 742 | result[@backingInt(Feature.reserve_x1)] = .{ |
| 743 | .llvm_name = "reserve-x1", | 743 | .llvm_name = "reserve-x1", |
| 744 | .description = "Reserve X1", | 744 | .description = "Reserve X1", |
| 745 | .dependencies = featureSet(&[_]Feature{}), | 745 | .dependencies = featureSet(&[_]Feature{}), |
| 746 | }; | 746 | }; |
| 747 | result[@intFromEnum(Feature.reserve_x10)] = .{ | 747 | result[@backingInt(Feature.reserve_x10)] = .{ |
| 748 | .llvm_name = "reserve-x10", | 748 | .llvm_name = "reserve-x10", |
| 749 | .description = "Reserve X10", | 749 | .description = "Reserve X10", |
| 750 | .dependencies = featureSet(&[_]Feature{}), | 750 | .dependencies = featureSet(&[_]Feature{}), |
| 751 | }; | 751 | }; |
| 752 | result[@intFromEnum(Feature.reserve_x11)] = .{ | 752 | result[@backingInt(Feature.reserve_x11)] = .{ |
| 753 | .llvm_name = "reserve-x11", | 753 | .llvm_name = "reserve-x11", |
| 754 | .description = "Reserve X11", | 754 | .description = "Reserve X11", |
| 755 | .dependencies = featureSet(&[_]Feature{}), | 755 | .dependencies = featureSet(&[_]Feature{}), |
| 756 | }; | 756 | }; |
| 757 | result[@intFromEnum(Feature.reserve_x12)] = .{ | 757 | result[@backingInt(Feature.reserve_x12)] = .{ |
| 758 | .llvm_name = "reserve-x12", | 758 | .llvm_name = "reserve-x12", |
| 759 | .description = "Reserve X12", | 759 | .description = "Reserve X12", |
| 760 | .dependencies = featureSet(&[_]Feature{}), | 760 | .dependencies = featureSet(&[_]Feature{}), |
| 761 | }; | 761 | }; |
| 762 | result[@intFromEnum(Feature.reserve_x13)] = .{ | 762 | result[@backingInt(Feature.reserve_x13)] = .{ |
| 763 | .llvm_name = "reserve-x13", | 763 | .llvm_name = "reserve-x13", |
| 764 | .description = "Reserve X13", | 764 | .description = "Reserve X13", |
| 765 | .dependencies = featureSet(&[_]Feature{}), | 765 | .dependencies = featureSet(&[_]Feature{}), |
| 766 | }; | 766 | }; |
| 767 | result[@intFromEnum(Feature.reserve_x14)] = .{ | 767 | result[@backingInt(Feature.reserve_x14)] = .{ |
| 768 | .llvm_name = "reserve-x14", | 768 | .llvm_name = "reserve-x14", |
| 769 | .description = "Reserve X14", | 769 | .description = "Reserve X14", |
| 770 | .dependencies = featureSet(&[_]Feature{}), | 770 | .dependencies = featureSet(&[_]Feature{}), |
| 771 | }; | 771 | }; |
| 772 | result[@intFromEnum(Feature.reserve_x15)] = .{ | 772 | result[@backingInt(Feature.reserve_x15)] = .{ |
| 773 | .llvm_name = "reserve-x15", | 773 | .llvm_name = "reserve-x15", |
| 774 | .description = "Reserve X15", | 774 | .description = "Reserve X15", |
| 775 | .dependencies = featureSet(&[_]Feature{}), | 775 | .dependencies = featureSet(&[_]Feature{}), |
| 776 | }; | 776 | }; |
| 777 | result[@intFromEnum(Feature.reserve_x16)] = .{ | 777 | result[@backingInt(Feature.reserve_x16)] = .{ |
| 778 | .llvm_name = "reserve-x16", | 778 | .llvm_name = "reserve-x16", |
| 779 | .description = "Reserve X16", | 779 | .description = "Reserve X16", |
| 780 | .dependencies = featureSet(&[_]Feature{}), | 780 | .dependencies = featureSet(&[_]Feature{}), |
| 781 | }; | 781 | }; |
| 782 | result[@intFromEnum(Feature.reserve_x17)] = .{ | 782 | result[@backingInt(Feature.reserve_x17)] = .{ |
| 783 | .llvm_name = "reserve-x17", | 783 | .llvm_name = "reserve-x17", |
| 784 | .description = "Reserve X17", | 784 | .description = "Reserve X17", |
| 785 | .dependencies = featureSet(&[_]Feature{}), | 785 | .dependencies = featureSet(&[_]Feature{}), |
| 786 | }; | 786 | }; |
| 787 | result[@intFromEnum(Feature.reserve_x18)] = .{ | 787 | result[@backingInt(Feature.reserve_x18)] = .{ |
| 788 | .llvm_name = "reserve-x18", | 788 | .llvm_name = "reserve-x18", |
| 789 | .description = "Reserve X18", | 789 | .description = "Reserve X18", |
| 790 | .dependencies = featureSet(&[_]Feature{}), | 790 | .dependencies = featureSet(&[_]Feature{}), |
| 791 | }; | 791 | }; |
| 792 | result[@intFromEnum(Feature.reserve_x19)] = .{ | 792 | result[@backingInt(Feature.reserve_x19)] = .{ |
| 793 | .llvm_name = "reserve-x19", | 793 | .llvm_name = "reserve-x19", |
| 794 | .description = "Reserve X19", | 794 | .description = "Reserve X19", |
| 795 | .dependencies = featureSet(&[_]Feature{}), | 795 | .dependencies = featureSet(&[_]Feature{}), |
| 796 | }; | 796 | }; |
| 797 | result[@intFromEnum(Feature.reserve_x2)] = .{ | 797 | result[@backingInt(Feature.reserve_x2)] = .{ |
| 798 | .llvm_name = "reserve-x2", | 798 | .llvm_name = "reserve-x2", |
| 799 | .description = "Reserve X2", | 799 | .description = "Reserve X2", |
| 800 | .dependencies = featureSet(&[_]Feature{}), | 800 | .dependencies = featureSet(&[_]Feature{}), |
| 801 | }; | 801 | }; |
| 802 | result[@intFromEnum(Feature.reserve_x20)] = .{ | 802 | result[@backingInt(Feature.reserve_x20)] = .{ |
| 803 | .llvm_name = "reserve-x20", | 803 | .llvm_name = "reserve-x20", |
| 804 | .description = "Reserve X20", | 804 | .description = "Reserve X20", |
| 805 | .dependencies = featureSet(&[_]Feature{}), | 805 | .dependencies = featureSet(&[_]Feature{}), |
| 806 | }; | 806 | }; |
| 807 | result[@intFromEnum(Feature.reserve_x21)] = .{ | 807 | result[@backingInt(Feature.reserve_x21)] = .{ |
| 808 | .llvm_name = "reserve-x21", | 808 | .llvm_name = "reserve-x21", |
| 809 | .description = "Reserve X21", | 809 | .description = "Reserve X21", |
| 810 | .dependencies = featureSet(&[_]Feature{}), | 810 | .dependencies = featureSet(&[_]Feature{}), |
| 811 | }; | 811 | }; |
| 812 | result[@intFromEnum(Feature.reserve_x22)] = .{ | 812 | result[@backingInt(Feature.reserve_x22)] = .{ |
| 813 | .llvm_name = "reserve-x22", | 813 | .llvm_name = "reserve-x22", |
| 814 | .description = "Reserve X22", | 814 | .description = "Reserve X22", |
| 815 | .dependencies = featureSet(&[_]Feature{}), | 815 | .dependencies = featureSet(&[_]Feature{}), |
| 816 | }; | 816 | }; |
| 817 | result[@intFromEnum(Feature.reserve_x23)] = .{ | 817 | result[@backingInt(Feature.reserve_x23)] = .{ |
| 818 | .llvm_name = "reserve-x23", | 818 | .llvm_name = "reserve-x23", |
| 819 | .description = "Reserve X23", | 819 | .description = "Reserve X23", |
| 820 | .dependencies = featureSet(&[_]Feature{}), | 820 | .dependencies = featureSet(&[_]Feature{}), |
| 821 | }; | 821 | }; |
| 822 | result[@intFromEnum(Feature.reserve_x24)] = .{ | 822 | result[@backingInt(Feature.reserve_x24)] = .{ |
| 823 | .llvm_name = "reserve-x24", | 823 | .llvm_name = "reserve-x24", |
| 824 | .description = "Reserve X24", | 824 | .description = "Reserve X24", |
| 825 | .dependencies = featureSet(&[_]Feature{}), | 825 | .dependencies = featureSet(&[_]Feature{}), |
| 826 | }; | 826 | }; |
| 827 | result[@intFromEnum(Feature.reserve_x25)] = .{ | 827 | result[@backingInt(Feature.reserve_x25)] = .{ |
| 828 | .llvm_name = "reserve-x25", | 828 | .llvm_name = "reserve-x25", |
| 829 | .description = "Reserve X25", | 829 | .description = "Reserve X25", |
| 830 | .dependencies = featureSet(&[_]Feature{}), | 830 | .dependencies = featureSet(&[_]Feature{}), |
| 831 | }; | 831 | }; |
| 832 | result[@intFromEnum(Feature.reserve_x26)] = .{ | 832 | result[@backingInt(Feature.reserve_x26)] = .{ |
| 833 | .llvm_name = "reserve-x26", | 833 | .llvm_name = "reserve-x26", |
| 834 | .description = "Reserve X26", | 834 | .description = "Reserve X26", |
| 835 | .dependencies = featureSet(&[_]Feature{}), | 835 | .dependencies = featureSet(&[_]Feature{}), |
| 836 | }; | 836 | }; |
| 837 | result[@intFromEnum(Feature.reserve_x27)] = .{ | 837 | result[@backingInt(Feature.reserve_x27)] = .{ |
| 838 | .llvm_name = "reserve-x27", | 838 | .llvm_name = "reserve-x27", |
| 839 | .description = "Reserve X27", | 839 | .description = "Reserve X27", |
| 840 | .dependencies = featureSet(&[_]Feature{}), | 840 | .dependencies = featureSet(&[_]Feature{}), |
| 841 | }; | 841 | }; |
| 842 | result[@intFromEnum(Feature.reserve_x28)] = .{ | 842 | result[@backingInt(Feature.reserve_x28)] = .{ |
| 843 | .llvm_name = "reserve-x28", | 843 | .llvm_name = "reserve-x28", |
| 844 | .description = "Reserve X28", | 844 | .description = "Reserve X28", |
| 845 | .dependencies = featureSet(&[_]Feature{}), | 845 | .dependencies = featureSet(&[_]Feature{}), |
| 846 | }; | 846 | }; |
| 847 | result[@intFromEnum(Feature.reserve_x29)] = .{ | 847 | result[@backingInt(Feature.reserve_x29)] = .{ |
| 848 | .llvm_name = "reserve-x29", | 848 | .llvm_name = "reserve-x29", |
| 849 | .description = "Reserve X29", | 849 | .description = "Reserve X29", |
| 850 | .dependencies = featureSet(&[_]Feature{}), | 850 | .dependencies = featureSet(&[_]Feature{}), |
| 851 | }; | 851 | }; |
| 852 | result[@intFromEnum(Feature.reserve_x3)] = .{ | 852 | result[@backingInt(Feature.reserve_x3)] = .{ |
| 853 | .llvm_name = "reserve-x3", | 853 | .llvm_name = "reserve-x3", |
| 854 | .description = "Reserve X3", | 854 | .description = "Reserve X3", |
| 855 | .dependencies = featureSet(&[_]Feature{}), | 855 | .dependencies = featureSet(&[_]Feature{}), |
| 856 | }; | 856 | }; |
| 857 | result[@intFromEnum(Feature.reserve_x30)] = .{ | 857 | result[@backingInt(Feature.reserve_x30)] = .{ |
| 858 | .llvm_name = "reserve-x30", | 858 | .llvm_name = "reserve-x30", |
| 859 | .description = "Reserve X30", | 859 | .description = "Reserve X30", |
| 860 | .dependencies = featureSet(&[_]Feature{}), | 860 | .dependencies = featureSet(&[_]Feature{}), |
| 861 | }; | 861 | }; |
| 862 | result[@intFromEnum(Feature.reserve_x31)] = .{ | 862 | result[@backingInt(Feature.reserve_x31)] = .{ |
| 863 | .llvm_name = "reserve-x31", | 863 | .llvm_name = "reserve-x31", |
| 864 | .description = "Reserve X31", | 864 | .description = "Reserve X31", |
| 865 | .dependencies = featureSet(&[_]Feature{}), | 865 | .dependencies = featureSet(&[_]Feature{}), |
| 866 | }; | 866 | }; |
| 867 | result[@intFromEnum(Feature.reserve_x4)] = .{ | 867 | result[@backingInt(Feature.reserve_x4)] = .{ |
| 868 | .llvm_name = "reserve-x4", | 868 | .llvm_name = "reserve-x4", |
| 869 | .description = "Reserve X4", | 869 | .description = "Reserve X4", |
| 870 | .dependencies = featureSet(&[_]Feature{}), | 870 | .dependencies = featureSet(&[_]Feature{}), |
| 871 | }; | 871 | }; |
| 872 | result[@intFromEnum(Feature.reserve_x5)] = .{ | 872 | result[@backingInt(Feature.reserve_x5)] = .{ |
| 873 | .llvm_name = "reserve-x5", | 873 | .llvm_name = "reserve-x5", |
| 874 | .description = "Reserve X5", | 874 | .description = "Reserve X5", |
| 875 | .dependencies = featureSet(&[_]Feature{}), | 875 | .dependencies = featureSet(&[_]Feature{}), |
| 876 | }; | 876 | }; |
| 877 | result[@intFromEnum(Feature.reserve_x6)] = .{ | 877 | result[@backingInt(Feature.reserve_x6)] = .{ |
| 878 | .llvm_name = "reserve-x6", | 878 | .llvm_name = "reserve-x6", |
| 879 | .description = "Reserve X6", | 879 | .description = "Reserve X6", |
| 880 | .dependencies = featureSet(&[_]Feature{}), | 880 | .dependencies = featureSet(&[_]Feature{}), |
| 881 | }; | 881 | }; |
| 882 | result[@intFromEnum(Feature.reserve_x7)] = .{ | 882 | result[@backingInt(Feature.reserve_x7)] = .{ |
| 883 | .llvm_name = "reserve-x7", | 883 | .llvm_name = "reserve-x7", |
| 884 | .description = "Reserve X7", | 884 | .description = "Reserve X7", |
| 885 | .dependencies = featureSet(&[_]Feature{}), | 885 | .dependencies = featureSet(&[_]Feature{}), |
| 886 | }; | 886 | }; |
| 887 | result[@intFromEnum(Feature.reserve_x8)] = .{ | 887 | result[@backingInt(Feature.reserve_x8)] = .{ |
| 888 | .llvm_name = "reserve-x8", | 888 | .llvm_name = "reserve-x8", |
| 889 | .description = "Reserve X8", | 889 | .description = "Reserve X8", |
| 890 | .dependencies = featureSet(&[_]Feature{}), | 890 | .dependencies = featureSet(&[_]Feature{}), |
| 891 | }; | 891 | }; |
| 892 | result[@intFromEnum(Feature.reserve_x9)] = .{ | 892 | result[@backingInt(Feature.reserve_x9)] = .{ |
| 893 | .llvm_name = "reserve-x9", | 893 | .llvm_name = "reserve-x9", |
| 894 | .description = "Reserve X9", | 894 | .description = "Reserve X9", |
| 895 | .dependencies = featureSet(&[_]Feature{}), | 895 | .dependencies = featureSet(&[_]Feature{}), |
| 896 | }; | 896 | }; |
| 897 | result[@intFromEnum(Feature.rva20s64)] = .{ | 897 | result[@backingInt(Feature.rva20s64)] = .{ |
| 898 | .llvm_name = "rva20s64", | 898 | .llvm_name = "rva20s64", |
| 899 | .description = "RISC-V rva20s64 profile", | 899 | .description = "RISC-V rva20s64 profile", |
| 900 | .dependencies = featureSet(&[_]Feature{ | 900 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -918,7 +918,7 @@ pub const all_features = blk: { | ... | @@ -918,7 +918,7 @@ pub const all_features = blk: { |
| 918 | .zifencei, | 918 | .zifencei, |
| 919 | }), | 919 | }), |
| 920 | }; | 920 | }; |
| 921 | result[@intFromEnum(Feature.rva20u64)] = .{ | 921 | result[@backingInt(Feature.rva20u64)] = .{ |
| 922 | .llvm_name = "rva20u64", | 922 | .llvm_name = "rva20u64", |
| 923 | .description = "RISC-V rva20u64 profile", | 923 | .description = "RISC-V rva20u64 profile", |
| 924 | .dependencies = featureSet(&[_]Feature{ | 924 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -936,7 +936,7 @@ pub const all_features = blk: { | ... | @@ -936,7 +936,7 @@ pub const all_features = blk: { |
| 936 | .zicntr, | 936 | .zicntr, |
| 937 | }), | 937 | }), |
| 938 | }; | 938 | }; |
| 939 | result[@intFromEnum(Feature.rva22s64)] = .{ | 939 | result[@backingInt(Feature.rva22s64)] = .{ |
| 940 | .llvm_name = "rva22s64", | 940 | .llvm_name = "rva22s64", |
| 941 | .description = "RISC-V rva22s64 profile", | 941 | .description = "RISC-V rva22s64 profile", |
| 942 | .dependencies = featureSet(&[_]Feature{ | 942 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -972,7 +972,7 @@ pub const all_features = blk: { | ... | @@ -972,7 +972,7 @@ pub const all_features = blk: { |
| 972 | .zkt, | 972 | .zkt, |
| 973 | }), | 973 | }), |
| 974 | }; | 974 | }; |
| 975 | result[@intFromEnum(Feature.rva22u64)] = .{ | 975 | result[@backingInt(Feature.rva22u64)] = .{ |
| 976 | .llvm_name = "rva22u64", | 976 | .llvm_name = "rva22u64", |
| 977 | .description = "RISC-V rva22u64 profile", | 977 | .description = "RISC-V rva22u64 profile", |
| 978 | .dependencies = featureSet(&[_]Feature{ | 978 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -999,7 +999,7 @@ pub const all_features = blk: { | ... | @@ -999,7 +999,7 @@ pub const all_features = blk: { |
| 999 | .zkt, | 999 | .zkt, |
| 1000 | }), | 1000 | }), |
| 1001 | }; | 1001 | }; |
| 1002 | result[@intFromEnum(Feature.rva23s64)] = .{ | 1002 | result[@backingInt(Feature.rva23s64)] = .{ |
| 1003 | .llvm_name = "rva23s64", | 1003 | .llvm_name = "rva23s64", |
| 1004 | .description = "RISC-V rva23s64 profile", | 1004 | .description = "RISC-V rva23s64 profile", |
| 1005 | .dependencies = featureSet(&[_]Feature{ | 1005 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1052,7 +1052,7 @@ pub const all_features = blk: { | ... | @@ -1052,7 +1052,7 @@ pub const all_features = blk: { |
| 1052 | .zvkt, | 1052 | .zvkt, |
| 1053 | }), | 1053 | }), |
| 1054 | }; | 1054 | }; |
| 1055 | result[@intFromEnum(Feature.rva23u64)] = .{ | 1055 | result[@backingInt(Feature.rva23u64)] = .{ |
| 1056 | .llvm_name = "rva23u64", | 1056 | .llvm_name = "rva23u64", |
| 1057 | .description = "RISC-V rva23u64 profile", | 1057 | .description = "RISC-V rva23u64 profile", |
| 1058 | .dependencies = featureSet(&[_]Feature{ | 1058 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1090,7 +1090,7 @@ pub const all_features = blk: { | ... | @@ -1090,7 +1090,7 @@ pub const all_features = blk: { |
| 1090 | .zvkt, | 1090 | .zvkt, |
| 1091 | }), | 1091 | }), |
| 1092 | }; | 1092 | }; |
| 1093 | result[@intFromEnum(Feature.rvb23s64)] = .{ | 1093 | result[@backingInt(Feature.rvb23s64)] = .{ |
| 1094 | .llvm_name = "rvb23s64", | 1094 | .llvm_name = "rvb23s64", |
| 1095 | .description = "RISC-V rvb23s64 profile", | 1095 | .description = "RISC-V rvb23s64 profile", |
| 1096 | .dependencies = featureSet(&[_]Feature{ | 1096 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1136,7 +1136,7 @@ pub const all_features = blk: { | ... | @@ -1136,7 +1136,7 @@ pub const all_features = blk: { |
| 1136 | .zkt, | 1136 | .zkt, |
| 1137 | }), | 1137 | }), |
| 1138 | }; | 1138 | }; |
| 1139 | result[@intFromEnum(Feature.rvb23u64)] = .{ | 1139 | result[@backingInt(Feature.rvb23u64)] = .{ |
| 1140 | .llvm_name = "rvb23u64", | 1140 | .llvm_name = "rvb23u64", |
| 1141 | .description = "RISC-V rvb23u64 profile", | 1141 | .description = "RISC-V rvb23u64 profile", |
| 1142 | .dependencies = featureSet(&[_]Feature{ | 1142 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1169,7 +1169,7 @@ pub const all_features = blk: { | ... | @@ -1169,7 +1169,7 @@ pub const all_features = blk: { |
| 1169 | .zkt, | 1169 | .zkt, |
| 1170 | }), | 1170 | }), |
| 1171 | }; | 1171 | }; |
| 1172 | result[@intFromEnum(Feature.rvi20u32)] = .{ | 1172 | result[@backingInt(Feature.rvi20u32)] = .{ |
| 1173 | .llvm_name = "rvi20u32", | 1173 | .llvm_name = "rvi20u32", |
| 1174 | .description = "RISC-V rvi20u32 profile", | 1174 | .description = "RISC-V rvi20u32 profile", |
| 1175 | .dependencies = featureSet(&[_]Feature{ | 1175 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1177,7 +1177,7 @@ pub const all_features = blk: { | ... | @@ -1177,7 +1177,7 @@ pub const all_features = blk: { |
| 1177 | .i, | 1177 | .i, |
| 1178 | }), | 1178 | }), |
| 1179 | }; | 1179 | }; |
| 1180 | result[@intFromEnum(Feature.rvi20u64)] = .{ | 1180 | result[@backingInt(Feature.rvi20u64)] = .{ |
| 1181 | .llvm_name = "rvi20u64", | 1181 | .llvm_name = "rvi20u64", |
| 1182 | .description = "RISC-V rvi20u64 profile", | 1182 | .description = "RISC-V rvi20u64 profile", |
| 1183 | .dependencies = featureSet(&[_]Feature{ | 1183 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1185,22 +1185,22 @@ pub const all_features = blk: { | ... | @@ -1185,22 +1185,22 @@ pub const all_features = blk: { |
| 1185 | .i, | 1185 | .i, |
| 1186 | }), | 1186 | }), |
| 1187 | }; | 1187 | }; |
| 1188 | result[@intFromEnum(Feature.save_restore)] = .{ | 1188 | result[@backingInt(Feature.save_restore)] = .{ |
| 1189 | .llvm_name = "save-restore", | 1189 | .llvm_name = "save-restore", |
| 1190 | .description = "Enable save/restore.", | 1190 | .description = "Enable save/restore.", |
| 1191 | .dependencies = featureSet(&[_]Feature{}), | 1191 | .dependencies = featureSet(&[_]Feature{}), |
| 1192 | }; | 1192 | }; |
| 1193 | result[@intFromEnum(Feature.sdext)] = .{ | 1193 | result[@backingInt(Feature.sdext)] = .{ |
| 1194 | .llvm_name = "sdext", | 1194 | .llvm_name = "sdext", |
| 1195 | .description = "'Sdext' (External debugger)", | 1195 | .description = "'Sdext' (External debugger)", |
| 1196 | .dependencies = featureSet(&[_]Feature{}), | 1196 | .dependencies = featureSet(&[_]Feature{}), |
| 1197 | }; | 1197 | }; |
| 1198 | result[@intFromEnum(Feature.sdtrig)] = .{ | 1198 | result[@backingInt(Feature.sdtrig)] = .{ |
| 1199 | .llvm_name = "sdtrig", | 1199 | .llvm_name = "sdtrig", |
| 1200 | .description = "'Sdtrig' (Debugger triggers)", | 1200 | .description = "'Sdtrig' (Debugger triggers)", |
| 1201 | .dependencies = featureSet(&[_]Feature{}), | 1201 | .dependencies = featureSet(&[_]Feature{}), |
| 1202 | }; | 1202 | }; |
| 1203 | result[@intFromEnum(Feature.sha)] = .{ | 1203 | result[@backingInt(Feature.sha)] = .{ |
| 1204 | .llvm_name = "sha", | 1204 | .llvm_name = "sha", |
| 1205 | .description = "'Sha' (Augmented Hypervisor)", | 1205 | .description = "'Sha' (Augmented Hypervisor)", |
| 1206 | .dependencies = featureSet(&[_]Feature{ | 1206 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1214,291 +1214,291 @@ pub const all_features = blk: { | ... | @@ -1214,291 +1214,291 @@ pub const all_features = blk: { |
| 1214 | .ssstateen, | 1214 | .ssstateen, |
| 1215 | }), | 1215 | }), |
| 1216 | }; | 1216 | }; |
| 1217 | result[@intFromEnum(Feature.shcounterenw)] = .{ | 1217 | result[@backingInt(Feature.shcounterenw)] = .{ |
| 1218 | .llvm_name = "shcounterenw", | 1218 | .llvm_name = "shcounterenw", |
| 1219 | .description = "'Shcounterenw' (Support writeable hcounteren enable bit for any hpmcounter that is not read-only zero)", | 1219 | .description = "'Shcounterenw' (Support writeable hcounteren enable bit for any hpmcounter that is not read-only zero)", |
| 1220 | .dependencies = featureSet(&[_]Feature{}), | 1220 | .dependencies = featureSet(&[_]Feature{}), |
| 1221 | }; | 1221 | }; |
| 1222 | result[@intFromEnum(Feature.shgatpa)] = .{ | 1222 | result[@backingInt(Feature.shgatpa)] = .{ |
| 1223 | .llvm_name = "shgatpa", | 1223 | .llvm_name = "shgatpa", |
| 1224 | .description = "'Shgatpa' (SvNNx4 mode supported for all modes supported by satp, as well as Bare)", | 1224 | .description = "'Shgatpa' (SvNNx4 mode supported for all modes supported by satp, as well as Bare)", |
| 1225 | .dependencies = featureSet(&[_]Feature{}), | 1225 | .dependencies = featureSet(&[_]Feature{}), |
| 1226 | }; | 1226 | }; |
| 1227 | result[@intFromEnum(Feature.shifted_zextw_fusion)] = .{ | 1227 | result[@backingInt(Feature.shifted_zextw_fusion)] = .{ |
| 1228 | .llvm_name = "shifted-zextw-fusion", | 1228 | .llvm_name = "shifted-zextw-fusion", |
| 1229 | .description = "Enable SLLI+SRLI to be fused when computing (shifted) word zero extension", | 1229 | .description = "Enable SLLI+SRLI to be fused when computing (shifted) word zero extension", |
| 1230 | .dependencies = featureSet(&[_]Feature{}), | 1230 | .dependencies = featureSet(&[_]Feature{}), |
| 1231 | }; | 1231 | }; |
| 1232 | result[@intFromEnum(Feature.shlcofideleg)] = .{ | 1232 | result[@backingInt(Feature.shlcofideleg)] = .{ |
| 1233 | .llvm_name = "shlcofideleg", | 1233 | .llvm_name = "shlcofideleg", |
| 1234 | .description = "'Shlcofideleg' (Delegating LCOFI Interrupts to VS-mode)", | 1234 | .description = "'Shlcofideleg' (Delegating LCOFI Interrupts to VS-mode)", |
| 1235 | .dependencies = featureSet(&[_]Feature{}), | 1235 | .dependencies = featureSet(&[_]Feature{}), |
| 1236 | }; | 1236 | }; |
| 1237 | result[@intFromEnum(Feature.short_forward_branch_ialu)] = .{ | 1237 | result[@backingInt(Feature.short_forward_branch_ialu)] = .{ |
| 1238 | .llvm_name = "short-forward-branch-ialu", | 1238 | .llvm_name = "short-forward-branch-ialu", |
| 1239 | .description = "Enable short forward branch optimization for RVI base instructions", | 1239 | .description = "Enable short forward branch optimization for RVI base instructions", |
| 1240 | .dependencies = featureSet(&[_]Feature{}), | 1240 | .dependencies = featureSet(&[_]Feature{}), |
| 1241 | }; | 1241 | }; |
| 1242 | result[@intFromEnum(Feature.short_forward_branch_iload)] = .{ | 1242 | result[@backingInt(Feature.short_forward_branch_iload)] = .{ |
| 1243 | .llvm_name = "short-forward-branch-iload", | 1243 | .llvm_name = "short-forward-branch-iload", |
| 1244 | .description = "Enable short forward branch optimization for load instructions", | 1244 | .description = "Enable short forward branch optimization for load instructions", |
| 1245 | .dependencies = featureSet(&[_]Feature{ | 1245 | .dependencies = featureSet(&[_]Feature{ |
| 1246 | .short_forward_branch_ialu, | 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 | .llvm_name = "short-forward-branch-iminmax", | 1250 | .llvm_name = "short-forward-branch-iminmax", |
| 1251 | .description = "Enable short forward branch optimization for MIN,MAX instructions in Zbb", | 1251 | .description = "Enable short forward branch optimization for MIN,MAX instructions in Zbb", |
| 1252 | .dependencies = featureSet(&[_]Feature{ | 1252 | .dependencies = featureSet(&[_]Feature{ |
| 1253 | .short_forward_branch_ialu, | 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 | .llvm_name = "short-forward-branch-imul", | 1257 | .llvm_name = "short-forward-branch-imul", |
| 1258 | .description = "Enable short forward branch optimization for MUL instruction", | 1258 | .description = "Enable short forward branch optimization for MUL instruction", |
| 1259 | .dependencies = featureSet(&[_]Feature{ | 1259 | .dependencies = featureSet(&[_]Feature{ |
| 1260 | .short_forward_branch_ialu, | 1260 | .short_forward_branch_ialu, |
| 1261 | }), | 1261 | }), |
| 1262 | }; | 1262 | }; |
| 1263 | result[@intFromEnum(Feature.shtvala)] = .{ | 1263 | result[@backingInt(Feature.shtvala)] = .{ |
| 1264 | .llvm_name = "shtvala", | 1264 | .llvm_name = "shtvala", |
| 1265 | .description = "'Shtvala' (htval provides all needed values)", | 1265 | .description = "'Shtvala' (htval provides all needed values)", |
| 1266 | .dependencies = featureSet(&[_]Feature{}), | 1266 | .dependencies = featureSet(&[_]Feature{}), |
| 1267 | }; | 1267 | }; |
| 1268 | result[@intFromEnum(Feature.shvsatpa)] = .{ | 1268 | result[@backingInt(Feature.shvsatpa)] = .{ |
| 1269 | .llvm_name = "shvsatpa", | 1269 | .llvm_name = "shvsatpa", |
| 1270 | .description = "'Shvsatpa' (vsatp supports all modes supported by satp)", | 1270 | .description = "'Shvsatpa' (vsatp supports all modes supported by satp)", |
| 1271 | .dependencies = featureSet(&[_]Feature{}), | 1271 | .dependencies = featureSet(&[_]Feature{}), |
| 1272 | }; | 1272 | }; |
| 1273 | result[@intFromEnum(Feature.shvstvala)] = .{ | 1273 | result[@backingInt(Feature.shvstvala)] = .{ |
| 1274 | .llvm_name = "shvstvala", | 1274 | .llvm_name = "shvstvala", |
| 1275 | .description = "'Shvstvala' (vstval provides all needed values)", | 1275 | .description = "'Shvstvala' (vstval provides all needed values)", |
| 1276 | .dependencies = featureSet(&[_]Feature{}), | 1276 | .dependencies = featureSet(&[_]Feature{}), |
| 1277 | }; | 1277 | }; |
| 1278 | result[@intFromEnum(Feature.shvstvecd)] = .{ | 1278 | result[@backingInt(Feature.shvstvecd)] = .{ |
| 1279 | .llvm_name = "shvstvecd", | 1279 | .llvm_name = "shvstvecd", |
| 1280 | .description = "'Shvstvecd' (vstvec supports Direct mode)", | 1280 | .description = "'Shvstvecd' (vstvec supports Direct mode)", |
| 1281 | .dependencies = featureSet(&[_]Feature{}), | 1281 | .dependencies = featureSet(&[_]Feature{}), |
| 1282 | }; | 1282 | }; |
| 1283 | result[@intFromEnum(Feature.shxadd_load_fusion)] = .{ | 1283 | result[@backingInt(Feature.shxadd_load_fusion)] = .{ |
| 1284 | .llvm_name = "shxadd-load-fusion", | 1284 | .llvm_name = "shxadd-load-fusion", |
| 1285 | .description = "Enable SH(1|2|3)ADD(.UW) + load macrofusion", | 1285 | .description = "Enable SH(1|2|3)ADD(.UW) + load macrofusion", |
| 1286 | .dependencies = featureSet(&[_]Feature{}), | 1286 | .dependencies = featureSet(&[_]Feature{}), |
| 1287 | }; | 1287 | }; |
| 1288 | result[@intFromEnum(Feature.single_element_vec_fp64)] = .{ | 1288 | result[@backingInt(Feature.single_element_vec_fp64)] = .{ |
| 1289 | .llvm_name = "single-element-vec-fp64", | 1289 | .llvm_name = "single-element-vec-fp64", |
| 1290 | .description = "Certain vector FP64 operations produce a single result element per cycle", | 1290 | .description = "Certain vector FP64 operations produce a single result element per cycle", |
| 1291 | .dependencies = featureSet(&[_]Feature{}), | 1291 | .dependencies = featureSet(&[_]Feature{}), |
| 1292 | }; | 1292 | }; |
| 1293 | result[@intFromEnum(Feature.smaia)] = .{ | 1293 | result[@backingInt(Feature.smaia)] = .{ |
| 1294 | .llvm_name = "smaia", | 1294 | .llvm_name = "smaia", |
| 1295 | .description = "'Smaia' (Advanced Interrupt Architecture Machine Level)", | 1295 | .description = "'Smaia' (Advanced Interrupt Architecture Machine Level)", |
| 1296 | .dependencies = featureSet(&[_]Feature{}), | 1296 | .dependencies = featureSet(&[_]Feature{}), |
| 1297 | }; | 1297 | }; |
| 1298 | result[@intFromEnum(Feature.smcdeleg)] = .{ | 1298 | result[@backingInt(Feature.smcdeleg)] = .{ |
| 1299 | .llvm_name = "smcdeleg", | 1299 | .llvm_name = "smcdeleg", |
| 1300 | .description = "'Smcdeleg' (Counter Delegation Machine Level)", | 1300 | .description = "'Smcdeleg' (Counter Delegation Machine Level)", |
| 1301 | .dependencies = featureSet(&[_]Feature{}), | 1301 | .dependencies = featureSet(&[_]Feature{}), |
| 1302 | }; | 1302 | }; |
| 1303 | result[@intFromEnum(Feature.smcntrpmf)] = .{ | 1303 | result[@backingInt(Feature.smcntrpmf)] = .{ |
| 1304 | .llvm_name = "smcntrpmf", | 1304 | .llvm_name = "smcntrpmf", |
| 1305 | .description = "'Smcntrpmf' (Cycle and Instret Privilege Mode Filtering)", | 1305 | .description = "'Smcntrpmf' (Cycle and Instret Privilege Mode Filtering)", |
| 1306 | .dependencies = featureSet(&[_]Feature{}), | 1306 | .dependencies = featureSet(&[_]Feature{}), |
| 1307 | }; | 1307 | }; |
| 1308 | result[@intFromEnum(Feature.smcsrind)] = .{ | 1308 | result[@backingInt(Feature.smcsrind)] = .{ |
| 1309 | .llvm_name = "smcsrind", | 1309 | .llvm_name = "smcsrind", |
| 1310 | .description = "'Smcsrind' (Indirect CSR Access Machine Level)", | 1310 | .description = "'Smcsrind' (Indirect CSR Access Machine Level)", |
| 1311 | .dependencies = featureSet(&[_]Feature{}), | 1311 | .dependencies = featureSet(&[_]Feature{}), |
| 1312 | }; | 1312 | }; |
| 1313 | result[@intFromEnum(Feature.smctr)] = .{ | 1313 | result[@backingInt(Feature.smctr)] = .{ |
| 1314 | .llvm_name = "smctr", | 1314 | .llvm_name = "smctr", |
| 1315 | .description = "'Smctr' (Control Transfer Records Machine Level)", | 1315 | .description = "'Smctr' (Control Transfer Records Machine Level)", |
| 1316 | .dependencies = featureSet(&[_]Feature{ | 1316 | .dependencies = featureSet(&[_]Feature{ |
| 1317 | .sscsrind, | 1317 | .sscsrind, |
| 1318 | }), | 1318 | }), |
| 1319 | }; | 1319 | }; |
| 1320 | result[@intFromEnum(Feature.smdbltrp)] = .{ | 1320 | result[@backingInt(Feature.smdbltrp)] = .{ |
| 1321 | .llvm_name = "smdbltrp", | 1321 | .llvm_name = "smdbltrp", |
| 1322 | .description = "'Smdbltrp' (Double Trap Machine Level)", | 1322 | .description = "'Smdbltrp' (Double Trap Machine Level)", |
| 1323 | .dependencies = featureSet(&[_]Feature{ | 1323 | .dependencies = featureSet(&[_]Feature{ |
| 1324 | .zicsr, | 1324 | .zicsr, |
| 1325 | }), | 1325 | }), |
| 1326 | }; | 1326 | }; |
| 1327 | result[@intFromEnum(Feature.smepmp)] = .{ | 1327 | result[@backingInt(Feature.smepmp)] = .{ |
| 1328 | .llvm_name = "smepmp", | 1328 | .llvm_name = "smepmp", |
| 1329 | .description = "'Smepmp' (Enhanced Physical Memory Protection)", | 1329 | .description = "'Smepmp' (Enhanced Physical Memory Protection)", |
| 1330 | .dependencies = featureSet(&[_]Feature{}), | 1330 | .dependencies = featureSet(&[_]Feature{}), |
| 1331 | }; | 1331 | }; |
| 1332 | result[@intFromEnum(Feature.smmpm)] = .{ | 1332 | result[@backingInt(Feature.smmpm)] = .{ |
| 1333 | .llvm_name = "smmpm", | 1333 | .llvm_name = "smmpm", |
| 1334 | .description = "'Smmpm' (Machine-level Pointer Masking for M-mode)", | 1334 | .description = "'Smmpm' (Machine-level Pointer Masking for M-mode)", |
| 1335 | .dependencies = featureSet(&[_]Feature{}), | 1335 | .dependencies = featureSet(&[_]Feature{}), |
| 1336 | }; | 1336 | }; |
| 1337 | result[@intFromEnum(Feature.smnpm)] = .{ | 1337 | result[@backingInt(Feature.smnpm)] = .{ |
| 1338 | .llvm_name = "smnpm", | 1338 | .llvm_name = "smnpm", |
| 1339 | .description = "'Smnpm' (Machine-level Pointer Masking for next lower privilege mode)", | 1339 | .description = "'Smnpm' (Machine-level Pointer Masking for next lower privilege mode)", |
| 1340 | .dependencies = featureSet(&[_]Feature{}), | 1340 | .dependencies = featureSet(&[_]Feature{}), |
| 1341 | }; | 1341 | }; |
| 1342 | result[@intFromEnum(Feature.smrnmi)] = .{ | 1342 | result[@backingInt(Feature.smrnmi)] = .{ |
| 1343 | .llvm_name = "smrnmi", | 1343 | .llvm_name = "smrnmi", |
| 1344 | .description = "'Smrnmi' (Resumable Non-Maskable Interrupts)", | 1344 | .description = "'Smrnmi' (Resumable Non-Maskable Interrupts)", |
| 1345 | .dependencies = featureSet(&[_]Feature{}), | 1345 | .dependencies = featureSet(&[_]Feature{}), |
| 1346 | }; | 1346 | }; |
| 1347 | result[@intFromEnum(Feature.smstateen)] = .{ | 1347 | result[@backingInt(Feature.smstateen)] = .{ |
| 1348 | .llvm_name = "smstateen", | 1348 | .llvm_name = "smstateen", |
| 1349 | .description = "'Smstateen' (Machine-mode view of the state-enable extension)", | 1349 | .description = "'Smstateen' (Machine-mode view of the state-enable extension)", |
| 1350 | .dependencies = featureSet(&[_]Feature{}), | 1350 | .dependencies = featureSet(&[_]Feature{}), |
| 1351 | }; | 1351 | }; |
| 1352 | result[@intFromEnum(Feature.ssaia)] = .{ | 1352 | result[@backingInt(Feature.ssaia)] = .{ |
| 1353 | .llvm_name = "ssaia", | 1353 | .llvm_name = "ssaia", |
| 1354 | .description = "'Ssaia' (Advanced Interrupt Architecture Supervisor Level)", | 1354 | .description = "'Ssaia' (Advanced Interrupt Architecture Supervisor Level)", |
| 1355 | .dependencies = featureSet(&[_]Feature{}), | 1355 | .dependencies = featureSet(&[_]Feature{}), |
| 1356 | }; | 1356 | }; |
| 1357 | result[@intFromEnum(Feature.ssccfg)] = .{ | 1357 | result[@backingInt(Feature.ssccfg)] = .{ |
| 1358 | .llvm_name = "ssccfg", | 1358 | .llvm_name = "ssccfg", |
| 1359 | .description = "'Ssccfg' (Counter Configuration Supervisor Level)", | 1359 | .description = "'Ssccfg' (Counter Configuration Supervisor Level)", |
| 1360 | .dependencies = featureSet(&[_]Feature{}), | 1360 | .dependencies = featureSet(&[_]Feature{}), |
| 1361 | }; | 1361 | }; |
| 1362 | result[@intFromEnum(Feature.ssccptr)] = .{ | 1362 | result[@backingInt(Feature.ssccptr)] = .{ |
| 1363 | .llvm_name = "ssccptr", | 1363 | .llvm_name = "ssccptr", |
| 1364 | .description = "'Ssccptr' (Main memory supports page table reads)", | 1364 | .description = "'Ssccptr' (Main memory supports page table reads)", |
| 1365 | .dependencies = featureSet(&[_]Feature{}), | 1365 | .dependencies = featureSet(&[_]Feature{}), |
| 1366 | }; | 1366 | }; |
| 1367 | result[@intFromEnum(Feature.sscofpmf)] = .{ | 1367 | result[@backingInt(Feature.sscofpmf)] = .{ |
| 1368 | .llvm_name = "sscofpmf", | 1368 | .llvm_name = "sscofpmf", |
| 1369 | .description = "'Sscofpmf' (Count Overflow and Mode-Based Filtering)", | 1369 | .description = "'Sscofpmf' (Count Overflow and Mode-Based Filtering)", |
| 1370 | .dependencies = featureSet(&[_]Feature{}), | 1370 | .dependencies = featureSet(&[_]Feature{}), |
| 1371 | }; | 1371 | }; |
| 1372 | result[@intFromEnum(Feature.sscounterenw)] = .{ | 1372 | result[@backingInt(Feature.sscounterenw)] = .{ |
| 1373 | .llvm_name = "sscounterenw", | 1373 | .llvm_name = "sscounterenw", |
| 1374 | .description = "'Sscounterenw' (Support writeable scounteren enable bit for any hpmcounter that is not read-only zero)", | 1374 | .description = "'Sscounterenw' (Support writeable scounteren enable bit for any hpmcounter that is not read-only zero)", |
| 1375 | .dependencies = featureSet(&[_]Feature{}), | 1375 | .dependencies = featureSet(&[_]Feature{}), |
| 1376 | }; | 1376 | }; |
| 1377 | result[@intFromEnum(Feature.sscsrind)] = .{ | 1377 | result[@backingInt(Feature.sscsrind)] = .{ |
| 1378 | .llvm_name = "sscsrind", | 1378 | .llvm_name = "sscsrind", |
| 1379 | .description = "'Sscsrind' (Indirect CSR Access Supervisor Level)", | 1379 | .description = "'Sscsrind' (Indirect CSR Access Supervisor Level)", |
| 1380 | .dependencies = featureSet(&[_]Feature{}), | 1380 | .dependencies = featureSet(&[_]Feature{}), |
| 1381 | }; | 1381 | }; |
| 1382 | result[@intFromEnum(Feature.ssctr)] = .{ | 1382 | result[@backingInt(Feature.ssctr)] = .{ |
| 1383 | .llvm_name = "ssctr", | 1383 | .llvm_name = "ssctr", |
| 1384 | .description = "'Ssctr' (Control Transfer Records Supervisor Level)", | 1384 | .description = "'Ssctr' (Control Transfer Records Supervisor Level)", |
| 1385 | .dependencies = featureSet(&[_]Feature{ | 1385 | .dependencies = featureSet(&[_]Feature{ |
| 1386 | .sscsrind, | 1386 | .sscsrind, |
| 1387 | }), | 1387 | }), |
| 1388 | }; | 1388 | }; |
| 1389 | result[@intFromEnum(Feature.ssdbltrp)] = .{ | 1389 | result[@backingInt(Feature.ssdbltrp)] = .{ |
| 1390 | .llvm_name = "ssdbltrp", | 1390 | .llvm_name = "ssdbltrp", |
| 1391 | .description = "'Ssdbltrp' (Double Trap Supervisor Level)", | 1391 | .description = "'Ssdbltrp' (Double Trap Supervisor Level)", |
| 1392 | .dependencies = featureSet(&[_]Feature{ | 1392 | .dependencies = featureSet(&[_]Feature{ |
| 1393 | .zicsr, | 1393 | .zicsr, |
| 1394 | }), | 1394 | }), |
| 1395 | }; | 1395 | }; |
| 1396 | result[@intFromEnum(Feature.ssnpm)] = .{ | 1396 | result[@backingInt(Feature.ssnpm)] = .{ |
| 1397 | .llvm_name = "ssnpm", | 1397 | .llvm_name = "ssnpm", |
| 1398 | .description = "'Ssnpm' (Supervisor-level Pointer Masking for next lower privilege mode)", | 1398 | .description = "'Ssnpm' (Supervisor-level Pointer Masking for next lower privilege mode)", |
| 1399 | .dependencies = featureSet(&[_]Feature{}), | 1399 | .dependencies = featureSet(&[_]Feature{}), |
| 1400 | }; | 1400 | }; |
| 1401 | result[@intFromEnum(Feature.sspm)] = .{ | 1401 | result[@backingInt(Feature.sspm)] = .{ |
| 1402 | .llvm_name = "sspm", | 1402 | .llvm_name = "sspm", |
| 1403 | .description = "'Sspm' (Indicates Supervisor-mode Pointer Masking)", | 1403 | .description = "'Sspm' (Indicates Supervisor-mode Pointer Masking)", |
| 1404 | .dependencies = featureSet(&[_]Feature{}), | 1404 | .dependencies = featureSet(&[_]Feature{}), |
| 1405 | }; | 1405 | }; |
| 1406 | result[@intFromEnum(Feature.ssqosid)] = .{ | 1406 | result[@backingInt(Feature.ssqosid)] = .{ |
| 1407 | .llvm_name = "ssqosid", | 1407 | .llvm_name = "ssqosid", |
| 1408 | .description = "'Ssqosid' (Quality-of-Service (QoS) Identifiers)", | 1408 | .description = "'Ssqosid' (Quality-of-Service (QoS) Identifiers)", |
| 1409 | .dependencies = featureSet(&[_]Feature{}), | 1409 | .dependencies = featureSet(&[_]Feature{}), |
| 1410 | }; | 1410 | }; |
| 1411 | result[@intFromEnum(Feature.ssstateen)] = .{ | 1411 | result[@backingInt(Feature.ssstateen)] = .{ |
| 1412 | .llvm_name = "ssstateen", | 1412 | .llvm_name = "ssstateen", |
| 1413 | .description = "'Ssstateen' (Supervisor-mode view of the state-enable extension)", | 1413 | .description = "'Ssstateen' (Supervisor-mode view of the state-enable extension)", |
| 1414 | .dependencies = featureSet(&[_]Feature{}), | 1414 | .dependencies = featureSet(&[_]Feature{}), |
| 1415 | }; | 1415 | }; |
| 1416 | result[@intFromEnum(Feature.ssstrict)] = .{ | 1416 | result[@backingInt(Feature.ssstrict)] = .{ |
| 1417 | .llvm_name = "ssstrict", | 1417 | .llvm_name = "ssstrict", |
| 1418 | .description = "'Ssstrict' (No non-conforming extensions are present)", | 1418 | .description = "'Ssstrict' (No non-conforming extensions are present)", |
| 1419 | .dependencies = featureSet(&[_]Feature{}), | 1419 | .dependencies = featureSet(&[_]Feature{}), |
| 1420 | }; | 1420 | }; |
| 1421 | result[@intFromEnum(Feature.sstc)] = .{ | 1421 | result[@backingInt(Feature.sstc)] = .{ |
| 1422 | .llvm_name = "sstc", | 1422 | .llvm_name = "sstc", |
| 1423 | .description = "'Sstc' (Supervisor-mode timer interrupts)", | 1423 | .description = "'Sstc' (Supervisor-mode timer interrupts)", |
| 1424 | .dependencies = featureSet(&[_]Feature{}), | 1424 | .dependencies = featureSet(&[_]Feature{}), |
| 1425 | }; | 1425 | }; |
| 1426 | result[@intFromEnum(Feature.sstvala)] = .{ | 1426 | result[@backingInt(Feature.sstvala)] = .{ |
| 1427 | .llvm_name = "sstvala", | 1427 | .llvm_name = "sstvala", |
| 1428 | .description = "'Sstvala' (stval provides all needed values)", | 1428 | .description = "'Sstvala' (stval provides all needed values)", |
| 1429 | .dependencies = featureSet(&[_]Feature{}), | 1429 | .dependencies = featureSet(&[_]Feature{}), |
| 1430 | }; | 1430 | }; |
| 1431 | result[@intFromEnum(Feature.sstvecd)] = .{ | 1431 | result[@backingInt(Feature.sstvecd)] = .{ |
| 1432 | .llvm_name = "sstvecd", | 1432 | .llvm_name = "sstvecd", |
| 1433 | .description = "'Sstvecd' (stvec supports Direct mode)", | 1433 | .description = "'Sstvecd' (stvec supports Direct mode)", |
| 1434 | .dependencies = featureSet(&[_]Feature{}), | 1434 | .dependencies = featureSet(&[_]Feature{}), |
| 1435 | }; | 1435 | }; |
| 1436 | result[@intFromEnum(Feature.ssu64xl)] = .{ | 1436 | result[@backingInt(Feature.ssu64xl)] = .{ |
| 1437 | .llvm_name = "ssu64xl", | 1437 | .llvm_name = "ssu64xl", |
| 1438 | .description = "'Ssu64xl' (UXLEN=64 supported)", | 1438 | .description = "'Ssu64xl' (UXLEN=64 supported)", |
| 1439 | .dependencies = featureSet(&[_]Feature{}), | 1439 | .dependencies = featureSet(&[_]Feature{}), |
| 1440 | }; | 1440 | }; |
| 1441 | result[@intFromEnum(Feature.supm)] = .{ | 1441 | result[@backingInt(Feature.supm)] = .{ |
| 1442 | .llvm_name = "supm", | 1442 | .llvm_name = "supm", |
| 1443 | .description = "'Supm' (Indicates User-mode Pointer Masking)", | 1443 | .description = "'Supm' (Indicates User-mode Pointer Masking)", |
| 1444 | .dependencies = featureSet(&[_]Feature{}), | 1444 | .dependencies = featureSet(&[_]Feature{}), |
| 1445 | }; | 1445 | }; |
| 1446 | result[@intFromEnum(Feature.svade)] = .{ | 1446 | result[@backingInt(Feature.svade)] = .{ |
| 1447 | .llvm_name = "svade", | 1447 | .llvm_name = "svade", |
| 1448 | .description = "'Svade' (Raise exceptions on improper A/D bits)", | 1448 | .description = "'Svade' (Raise exceptions on improper A/D bits)", |
| 1449 | .dependencies = featureSet(&[_]Feature{}), | 1449 | .dependencies = featureSet(&[_]Feature{}), |
| 1450 | }; | 1450 | }; |
| 1451 | result[@intFromEnum(Feature.svadu)] = .{ | 1451 | result[@backingInt(Feature.svadu)] = .{ |
| 1452 | .llvm_name = "svadu", | 1452 | .llvm_name = "svadu", |
| 1453 | .description = "'Svadu' (Hardware A/D updates)", | 1453 | .description = "'Svadu' (Hardware A/D updates)", |
| 1454 | .dependencies = featureSet(&[_]Feature{}), | 1454 | .dependencies = featureSet(&[_]Feature{}), |
| 1455 | }; | 1455 | }; |
| 1456 | result[@intFromEnum(Feature.svbare)] = .{ | 1456 | result[@backingInt(Feature.svbare)] = .{ |
| 1457 | .llvm_name = "svbare", | 1457 | .llvm_name = "svbare", |
| 1458 | .description = "'Svbare' (satp mode Bare supported)", | 1458 | .description = "'Svbare' (satp mode Bare supported)", |
| 1459 | .dependencies = featureSet(&[_]Feature{}), | 1459 | .dependencies = featureSet(&[_]Feature{}), |
| 1460 | }; | 1460 | }; |
| 1461 | result[@intFromEnum(Feature.svinval)] = .{ | 1461 | result[@backingInt(Feature.svinval)] = .{ |
| 1462 | .llvm_name = "svinval", | 1462 | .llvm_name = "svinval", |
| 1463 | .description = "'Svinval' (Fine-Grained Address-Translation Cache Invalidation)", | 1463 | .description = "'Svinval' (Fine-Grained Address-Translation Cache Invalidation)", |
| 1464 | .dependencies = featureSet(&[_]Feature{}), | 1464 | .dependencies = featureSet(&[_]Feature{}), |
| 1465 | }; | 1465 | }; |
| 1466 | result[@intFromEnum(Feature.svnapot)] = .{ | 1466 | result[@backingInt(Feature.svnapot)] = .{ |
| 1467 | .llvm_name = "svnapot", | 1467 | .llvm_name = "svnapot", |
| 1468 | .description = "'Svnapot' (NAPOT Translation Contiguity)", | 1468 | .description = "'Svnapot' (NAPOT Translation Contiguity)", |
| 1469 | .dependencies = featureSet(&[_]Feature{}), | 1469 | .dependencies = featureSet(&[_]Feature{}), |
| 1470 | }; | 1470 | }; |
| 1471 | result[@intFromEnum(Feature.svpbmt)] = .{ | 1471 | result[@backingInt(Feature.svpbmt)] = .{ |
| 1472 | .llvm_name = "svpbmt", | 1472 | .llvm_name = "svpbmt", |
| 1473 | .description = "'Svpbmt' (Page-Based Memory Types)", | 1473 | .description = "'Svpbmt' (Page-Based Memory Types)", |
| 1474 | .dependencies = featureSet(&[_]Feature{}), | 1474 | .dependencies = featureSet(&[_]Feature{}), |
| 1475 | }; | 1475 | }; |
| 1476 | result[@intFromEnum(Feature.svvptc)] = .{ | 1476 | result[@backingInt(Feature.svvptc)] = .{ |
| 1477 | .llvm_name = "svvptc", | 1477 | .llvm_name = "svvptc", |
| 1478 | .description = "'Svvptc' (Obviating Memory-Management Instructions after Marking PTEs Valid)", | 1478 | .description = "'Svvptc' (Obviating Memory-Management Instructions after Marking PTEs Valid)", |
| 1479 | .dependencies = featureSet(&[_]Feature{}), | 1479 | .dependencies = featureSet(&[_]Feature{}), |
| 1480 | }; | 1480 | }; |
| 1481 | result[@intFromEnum(Feature.tagged_globals)] = .{ | 1481 | result[@backingInt(Feature.tagged_globals)] = .{ |
| 1482 | .llvm_name = "tagged-globals", | 1482 | .llvm_name = "tagged-globals", |
| 1483 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits", | 1483 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits", |
| 1484 | .dependencies = featureSet(&[_]Feature{}), | 1484 | .dependencies = featureSet(&[_]Feature{}), |
| 1485 | }; | 1485 | }; |
| 1486 | result[@intFromEnum(Feature.unaligned_scalar_mem)] = .{ | 1486 | result[@backingInt(Feature.unaligned_scalar_mem)] = .{ |
| 1487 | .llvm_name = "unaligned-scalar-mem", | 1487 | .llvm_name = "unaligned-scalar-mem", |
| 1488 | .description = "Has reasonably performant unaligned scalar loads and stores", | 1488 | .description = "Has reasonably performant unaligned scalar loads and stores", |
| 1489 | .dependencies = featureSet(&[_]Feature{}), | 1489 | .dependencies = featureSet(&[_]Feature{}), |
| 1490 | }; | 1490 | }; |
| 1491 | result[@intFromEnum(Feature.unaligned_vector_mem)] = .{ | 1491 | result[@backingInt(Feature.unaligned_vector_mem)] = .{ |
| 1492 | .llvm_name = "unaligned-vector-mem", | 1492 | .llvm_name = "unaligned-vector-mem", |
| 1493 | .description = "Has reasonably performant unaligned vector loads and stores", | 1493 | .description = "Has reasonably performant unaligned vector loads and stores", |
| 1494 | .dependencies = featureSet(&[_]Feature{}), | 1494 | .dependencies = featureSet(&[_]Feature{}), |
| 1495 | }; | 1495 | }; |
| 1496 | result[@intFromEnum(Feature.use_postra_scheduler)] = .{ | 1496 | result[@backingInt(Feature.use_postra_scheduler)] = .{ |
| 1497 | .llvm_name = "use-postra-scheduler", | 1497 | .llvm_name = "use-postra-scheduler", |
| 1498 | .description = "Schedule again after register allocation", | 1498 | .description = "Schedule again after register allocation", |
| 1499 | .dependencies = featureSet(&[_]Feature{}), | 1499 | .dependencies = featureSet(&[_]Feature{}), |
| 1500 | }; | 1500 | }; |
| 1501 | result[@intFromEnum(Feature.v)] = .{ | 1501 | result[@backingInt(Feature.v)] = .{ |
| 1502 | .llvm_name = "v", | 1502 | .llvm_name = "v", |
| 1503 | .description = "'V' (Vector Extension for Application Processors)", | 1503 | .description = "'V' (Vector Extension for Application Processors)", |
| 1504 | .dependencies = featureSet(&[_]Feature{ | 1504 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1506,131 +1506,131 @@ pub const all_features = blk: { | ... | @@ -1506,131 +1506,131 @@ pub const all_features = blk: { |
| 1506 | .zvl128b, | 1506 | .zvl128b, |
| 1507 | }), | 1507 | }), |
| 1508 | }; | 1508 | }; |
| 1509 | result[@intFromEnum(Feature.ventana_veyron)] = .{ | 1509 | result[@backingInt(Feature.ventana_veyron)] = .{ |
| 1510 | .llvm_name = "ventana-veyron", | 1510 | .llvm_name = "ventana-veyron", |
| 1511 | .description = "Ventana Veyron-Series processors", | 1511 | .description = "Ventana Veyron-Series processors", |
| 1512 | .dependencies = featureSet(&[_]Feature{}), | 1512 | .dependencies = featureSet(&[_]Feature{}), |
| 1513 | }; | 1513 | }; |
| 1514 | result[@intFromEnum(Feature.vl_dependent_latency)] = .{ | 1514 | result[@backingInt(Feature.vl_dependent_latency)] = .{ |
| 1515 | .llvm_name = "vl-dependent-latency", | 1515 | .llvm_name = "vl-dependent-latency", |
| 1516 | .description = "Latency of vector instructions is dependent on the dynamic value of vl", | 1516 | .description = "Latency of vector instructions is dependent on the dynamic value of vl", |
| 1517 | .dependencies = featureSet(&[_]Feature{}), | 1517 | .dependencies = featureSet(&[_]Feature{}), |
| 1518 | }; | 1518 | }; |
| 1519 | result[@intFromEnum(Feature.vxrm_pipeline_flush)] = .{ | 1519 | result[@backingInt(Feature.vxrm_pipeline_flush)] = .{ |
| 1520 | .llvm_name = "vxrm-pipeline-flush", | 1520 | .llvm_name = "vxrm-pipeline-flush", |
| 1521 | .description = "VXRM writes causes pipeline flush", | 1521 | .description = "VXRM writes causes pipeline flush", |
| 1522 | .dependencies = featureSet(&[_]Feature{}), | 1522 | .dependencies = featureSet(&[_]Feature{}), |
| 1523 | }; | 1523 | }; |
| 1524 | result[@intFromEnum(Feature.xandesbfhcvt)] = .{ | 1524 | result[@backingInt(Feature.xandesbfhcvt)] = .{ |
| 1525 | .llvm_name = "xandesbfhcvt", | 1525 | .llvm_name = "xandesbfhcvt", |
| 1526 | .description = "'XAndesBFHCvt' (Andes Scalar BFLOAT16 Conversion Extension)", | 1526 | .description = "'XAndesBFHCvt' (Andes Scalar BFLOAT16 Conversion Extension)", |
| 1527 | .dependencies = featureSet(&[_]Feature{ | 1527 | .dependencies = featureSet(&[_]Feature{ |
| 1528 | .f, | 1528 | .f, |
| 1529 | }), | 1529 | }), |
| 1530 | }; | 1530 | }; |
| 1531 | result[@intFromEnum(Feature.xandesperf)] = .{ | 1531 | result[@backingInt(Feature.xandesperf)] = .{ |
| 1532 | .llvm_name = "xandesperf", | 1532 | .llvm_name = "xandesperf", |
| 1533 | .description = "'XAndesPerf' (Andes Performance Extension)", | 1533 | .description = "'XAndesPerf' (Andes Performance Extension)", |
| 1534 | .dependencies = featureSet(&[_]Feature{}), | 1534 | .dependencies = featureSet(&[_]Feature{}), |
| 1535 | }; | 1535 | }; |
| 1536 | result[@intFromEnum(Feature.xandesvbfhcvt)] = .{ | 1536 | result[@backingInt(Feature.xandesvbfhcvt)] = .{ |
| 1537 | .llvm_name = "xandesvbfhcvt", | 1537 | .llvm_name = "xandesvbfhcvt", |
| 1538 | .description = "'XAndesVBFHCvt' (Andes Vector BFLOAT16 Conversion Extension)", | 1538 | .description = "'XAndesVBFHCvt' (Andes Vector BFLOAT16 Conversion Extension)", |
| 1539 | .dependencies = featureSet(&[_]Feature{ | 1539 | .dependencies = featureSet(&[_]Feature{ |
| 1540 | .zve32f, | 1540 | .zve32f, |
| 1541 | }), | 1541 | }), |
| 1542 | }; | 1542 | }; |
| 1543 | result[@intFromEnum(Feature.xandesvdot)] = .{ | 1543 | result[@backingInt(Feature.xandesvdot)] = .{ |
| 1544 | .llvm_name = "xandesvdot", | 1544 | .llvm_name = "xandesvdot", |
| 1545 | .description = "'XAndesVDot' (Andes Vector Dot Product Extension)", | 1545 | .description = "'XAndesVDot' (Andes Vector Dot Product Extension)", |
| 1546 | .dependencies = featureSet(&[_]Feature{ | 1546 | .dependencies = featureSet(&[_]Feature{ |
| 1547 | .zve32x, | 1547 | .zve32x, |
| 1548 | }), | 1548 | }), |
| 1549 | }; | 1549 | }; |
| 1550 | result[@intFromEnum(Feature.xandesvpackfph)] = .{ | 1550 | result[@backingInt(Feature.xandesvpackfph)] = .{ |
| 1551 | .llvm_name = "xandesvpackfph", | 1551 | .llvm_name = "xandesvpackfph", |
| 1552 | .description = "'XAndesVPackFPH' (Andes Vector Packed FP16 Extension)", | 1552 | .description = "'XAndesVPackFPH' (Andes Vector Packed FP16 Extension)", |
| 1553 | .dependencies = featureSet(&[_]Feature{ | 1553 | .dependencies = featureSet(&[_]Feature{ |
| 1554 | .f, | 1554 | .f, |
| 1555 | }), | 1555 | }), |
| 1556 | }; | 1556 | }; |
| 1557 | result[@intFromEnum(Feature.xandesvsinth)] = .{ | 1557 | result[@backingInt(Feature.xandesvsinth)] = .{ |
| 1558 | .llvm_name = "xandesvsinth", | 1558 | .llvm_name = "xandesvsinth", |
| 1559 | .description = "'XAndesVSIntH' (Andes Vector Small INT Handling Extension)", | 1559 | .description = "'XAndesVSIntH' (Andes Vector Small INT Handling Extension)", |
| 1560 | .dependencies = featureSet(&[_]Feature{ | 1560 | .dependencies = featureSet(&[_]Feature{ |
| 1561 | .zve32x, | 1561 | .zve32x, |
| 1562 | }), | 1562 | }), |
| 1563 | }; | 1563 | }; |
| 1564 | result[@intFromEnum(Feature.xandesvsintload)] = .{ | 1564 | result[@backingInt(Feature.xandesvsintload)] = .{ |
| 1565 | .llvm_name = "xandesvsintload", | 1565 | .llvm_name = "xandesvsintload", |
| 1566 | .description = "'XAndesVSIntLoad' (Andes Vector INT4 Load Extension)", | 1566 | .description = "'XAndesVSIntLoad' (Andes Vector INT4 Load Extension)", |
| 1567 | .dependencies = featureSet(&[_]Feature{ | 1567 | .dependencies = featureSet(&[_]Feature{ |
| 1568 | .zve32x, | 1568 | .zve32x, |
| 1569 | }), | 1569 | }), |
| 1570 | }; | 1570 | }; |
| 1571 | result[@intFromEnum(Feature.xcvalu)] = .{ | 1571 | result[@backingInt(Feature.xcvalu)] = .{ |
| 1572 | .llvm_name = "xcvalu", | 1572 | .llvm_name = "xcvalu", |
| 1573 | .description = "'XCValu' (CORE-V ALU Operations)", | 1573 | .description = "'XCValu' (CORE-V ALU Operations)", |
| 1574 | .dependencies = featureSet(&[_]Feature{}), | 1574 | .dependencies = featureSet(&[_]Feature{}), |
| 1575 | }; | 1575 | }; |
| 1576 | result[@intFromEnum(Feature.xcvbi)] = .{ | 1576 | result[@backingInt(Feature.xcvbi)] = .{ |
| 1577 | .llvm_name = "xcvbi", | 1577 | .llvm_name = "xcvbi", |
| 1578 | .description = "'XCVbi' (CORE-V Immediate Branching)", | 1578 | .description = "'XCVbi' (CORE-V Immediate Branching)", |
| 1579 | .dependencies = featureSet(&[_]Feature{}), | 1579 | .dependencies = featureSet(&[_]Feature{}), |
| 1580 | }; | 1580 | }; |
| 1581 | result[@intFromEnum(Feature.xcvbitmanip)] = .{ | 1581 | result[@backingInt(Feature.xcvbitmanip)] = .{ |
| 1582 | .llvm_name = "xcvbitmanip", | 1582 | .llvm_name = "xcvbitmanip", |
| 1583 | .description = "'XCVbitmanip' (CORE-V Bit Manipulation)", | 1583 | .description = "'XCVbitmanip' (CORE-V Bit Manipulation)", |
| 1584 | .dependencies = featureSet(&[_]Feature{}), | 1584 | .dependencies = featureSet(&[_]Feature{}), |
| 1585 | }; | 1585 | }; |
| 1586 | result[@intFromEnum(Feature.xcvelw)] = .{ | 1586 | result[@backingInt(Feature.xcvelw)] = .{ |
| 1587 | .llvm_name = "xcvelw", | 1587 | .llvm_name = "xcvelw", |
| 1588 | .description = "'XCVelw' (CORE-V Event Load Word)", | 1588 | .description = "'XCVelw' (CORE-V Event Load Word)", |
| 1589 | .dependencies = featureSet(&[_]Feature{}), | 1589 | .dependencies = featureSet(&[_]Feature{}), |
| 1590 | }; | 1590 | }; |
| 1591 | result[@intFromEnum(Feature.xcvmac)] = .{ | 1591 | result[@backingInt(Feature.xcvmac)] = .{ |
| 1592 | .llvm_name = "xcvmac", | 1592 | .llvm_name = "xcvmac", |
| 1593 | .description = "'XCVmac' (CORE-V Multiply-Accumulate)", | 1593 | .description = "'XCVmac' (CORE-V Multiply-Accumulate)", |
| 1594 | .dependencies = featureSet(&[_]Feature{}), | 1594 | .dependencies = featureSet(&[_]Feature{}), |
| 1595 | }; | 1595 | }; |
| 1596 | result[@intFromEnum(Feature.xcvmem)] = .{ | 1596 | result[@backingInt(Feature.xcvmem)] = .{ |
| 1597 | .llvm_name = "xcvmem", | 1597 | .llvm_name = "xcvmem", |
| 1598 | .description = "'XCVmem' (CORE-V Post-incrementing Load & Store)", | 1598 | .description = "'XCVmem' (CORE-V Post-incrementing Load & Store)", |
| 1599 | .dependencies = featureSet(&[_]Feature{}), | 1599 | .dependencies = featureSet(&[_]Feature{}), |
| 1600 | }; | 1600 | }; |
| 1601 | result[@intFromEnum(Feature.xcvsimd)] = .{ | 1601 | result[@backingInt(Feature.xcvsimd)] = .{ |
| 1602 | .llvm_name = "xcvsimd", | 1602 | .llvm_name = "xcvsimd", |
| 1603 | .description = "'XCVsimd' (CORE-V SIMD ALU)", | 1603 | .description = "'XCVsimd' (CORE-V SIMD ALU)", |
| 1604 | .dependencies = featureSet(&[_]Feature{}), | 1604 | .dependencies = featureSet(&[_]Feature{}), |
| 1605 | }; | 1605 | }; |
| 1606 | result[@intFromEnum(Feature.xmipscbop)] = .{ | 1606 | result[@backingInt(Feature.xmipscbop)] = .{ |
| 1607 | .llvm_name = "xmipscbop", | 1607 | .llvm_name = "xmipscbop", |
| 1608 | .description = "'XMIPSCBOP' (MIPS Software Prefetch)", | 1608 | .description = "'XMIPSCBOP' (MIPS Software Prefetch)", |
| 1609 | .dependencies = featureSet(&[_]Feature{}), | 1609 | .dependencies = featureSet(&[_]Feature{}), |
| 1610 | }; | 1610 | }; |
| 1611 | result[@intFromEnum(Feature.xmipscmov)] = .{ | 1611 | result[@backingInt(Feature.xmipscmov)] = .{ |
| 1612 | .llvm_name = "xmipscmov", | 1612 | .llvm_name = "xmipscmov", |
| 1613 | .description = "'XMIPSCMov' (MIPS conditional move instruction (mips.ccmov))", | 1613 | .description = "'XMIPSCMov' (MIPS conditional move instruction (mips.ccmov))", |
| 1614 | .dependencies = featureSet(&[_]Feature{}), | 1614 | .dependencies = featureSet(&[_]Feature{}), |
| 1615 | }; | 1615 | }; |
| 1616 | result[@intFromEnum(Feature.xmipsexectl)] = .{ | 1616 | result[@backingInt(Feature.xmipsexectl)] = .{ |
| 1617 | .llvm_name = "xmipsexectl", | 1617 | .llvm_name = "xmipsexectl", |
| 1618 | .description = "'XMIPSEXECTL' (MIPS execution control)", | 1618 | .description = "'XMIPSEXECTL' (MIPS execution control)", |
| 1619 | .dependencies = featureSet(&[_]Feature{}), | 1619 | .dependencies = featureSet(&[_]Feature{}), |
| 1620 | }; | 1620 | }; |
| 1621 | result[@intFromEnum(Feature.xmipslsp)] = .{ | 1621 | result[@backingInt(Feature.xmipslsp)] = .{ |
| 1622 | .llvm_name = "xmipslsp", | 1622 | .llvm_name = "xmipslsp", |
| 1623 | .description = "'XMIPSLSP' (MIPS optimization for hardware load-store bonding)", | 1623 | .description = "'XMIPSLSP' (MIPS optimization for hardware load-store bonding)", |
| 1624 | .dependencies = featureSet(&[_]Feature{}), | 1624 | .dependencies = featureSet(&[_]Feature{}), |
| 1625 | }; | 1625 | }; |
| 1626 | result[@intFromEnum(Feature.xqccmp)] = .{ | 1626 | result[@backingInt(Feature.xqccmp)] = .{ |
| 1627 | .llvm_name = "xqccmp", | 1627 | .llvm_name = "xqccmp", |
| 1628 | .description = "'Xqccmp' (Qualcomm 16-bit Push/Pop and Double Moves)", | 1628 | .description = "'Xqccmp' (Qualcomm 16-bit Push/Pop and Double Moves)", |
| 1629 | .dependencies = featureSet(&[_]Feature{ | 1629 | .dependencies = featureSet(&[_]Feature{ |
| 1630 | .zca, | 1630 | .zca, |
| 1631 | }), | 1631 | }), |
| 1632 | }; | 1632 | }; |
| 1633 | result[@intFromEnum(Feature.xqci)] = .{ | 1633 | result[@backingInt(Feature.xqci)] = .{ |
| 1634 | .llvm_name = "xqci", | 1634 | .llvm_name = "xqci", |
| 1635 | .description = "'Xqci' (Qualcomm uC Extension)", | 1635 | .description = "'Xqci' (Qualcomm uC Extension)", |
| 1636 | .dependencies = featureSet(&[_]Feature{ | 1636 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1654,124 +1654,124 @@ pub const all_features = blk: { | ... | @@ -1654,124 +1654,124 @@ pub const all_features = blk: { |
| 1654 | .xqcisync, | 1654 | .xqcisync, |
| 1655 | }), | 1655 | }), |
| 1656 | }; | 1656 | }; |
| 1657 | result[@intFromEnum(Feature.xqcia)] = .{ | 1657 | result[@backingInt(Feature.xqcia)] = .{ |
| 1658 | .llvm_name = "xqcia", | 1658 | .llvm_name = "xqcia", |
| 1659 | .description = "'Xqcia' (Qualcomm uC Arithmetic Extension)", | 1659 | .description = "'Xqcia' (Qualcomm uC Arithmetic Extension)", |
| 1660 | .dependencies = featureSet(&[_]Feature{}), | 1660 | .dependencies = featureSet(&[_]Feature{}), |
| 1661 | }; | 1661 | }; |
| 1662 | result[@intFromEnum(Feature.xqciac)] = .{ | 1662 | result[@backingInt(Feature.xqciac)] = .{ |
| 1663 | .llvm_name = "xqciac", | 1663 | .llvm_name = "xqciac", |
| 1664 | .description = "'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)", | 1664 | .description = "'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)", |
| 1665 | .dependencies = featureSet(&[_]Feature{ | 1665 | .dependencies = featureSet(&[_]Feature{ |
| 1666 | .zca, | 1666 | .zca, |
| 1667 | }), | 1667 | }), |
| 1668 | }; | 1668 | }; |
| 1669 | result[@intFromEnum(Feature.xqcibi)] = .{ | 1669 | result[@backingInt(Feature.xqcibi)] = .{ |
| 1670 | .llvm_name = "xqcibi", | 1670 | .llvm_name = "xqcibi", |
| 1671 | .description = "'Xqcibi' (Qualcomm uC Branch Immediate Extension)", | 1671 | .description = "'Xqcibi' (Qualcomm uC Branch Immediate Extension)", |
| 1672 | .dependencies = featureSet(&[_]Feature{ | 1672 | .dependencies = featureSet(&[_]Feature{ |
| 1673 | .zca, | 1673 | .zca, |
| 1674 | }), | 1674 | }), |
| 1675 | }; | 1675 | }; |
| 1676 | result[@intFromEnum(Feature.xqcibm)] = .{ | 1676 | result[@backingInt(Feature.xqcibm)] = .{ |
| 1677 | .llvm_name = "xqcibm", | 1677 | .llvm_name = "xqcibm", |
| 1678 | .description = "'Xqcibm' (Qualcomm uC Bit Manipulation Extension)", | 1678 | .description = "'Xqcibm' (Qualcomm uC Bit Manipulation Extension)", |
| 1679 | .dependencies = featureSet(&[_]Feature{ | 1679 | .dependencies = featureSet(&[_]Feature{ |
| 1680 | .zca, | 1680 | .zca, |
| 1681 | }), | 1681 | }), |
| 1682 | }; | 1682 | }; |
| 1683 | result[@intFromEnum(Feature.xqcicli)] = .{ | 1683 | result[@backingInt(Feature.xqcicli)] = .{ |
| 1684 | .llvm_name = "xqcicli", | 1684 | .llvm_name = "xqcicli", |
| 1685 | .description = "'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)", | 1685 | .description = "'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)", |
| 1686 | .dependencies = featureSet(&[_]Feature{}), | 1686 | .dependencies = featureSet(&[_]Feature{}), |
| 1687 | }; | 1687 | }; |
| 1688 | result[@intFromEnum(Feature.xqcicm)] = .{ | 1688 | result[@backingInt(Feature.xqcicm)] = .{ |
| 1689 | .llvm_name = "xqcicm", | 1689 | .llvm_name = "xqcicm", |
| 1690 | .description = "'Xqcicm' (Qualcomm uC Conditional Move Extension)", | 1690 | .description = "'Xqcicm' (Qualcomm uC Conditional Move Extension)", |
| 1691 | .dependencies = featureSet(&[_]Feature{ | 1691 | .dependencies = featureSet(&[_]Feature{ |
| 1692 | .zca, | 1692 | .zca, |
| 1693 | }), | 1693 | }), |
| 1694 | }; | 1694 | }; |
| 1695 | result[@intFromEnum(Feature.xqcics)] = .{ | 1695 | result[@backingInt(Feature.xqcics)] = .{ |
| 1696 | .llvm_name = "xqcics", | 1696 | .llvm_name = "xqcics", |
| 1697 | .description = "'Xqcics' (Qualcomm uC Conditional Select Extension)", | 1697 | .description = "'Xqcics' (Qualcomm uC Conditional Select Extension)", |
| 1698 | .dependencies = featureSet(&[_]Feature{}), | 1698 | .dependencies = featureSet(&[_]Feature{}), |
| 1699 | }; | 1699 | }; |
| 1700 | result[@intFromEnum(Feature.xqcicsr)] = .{ | 1700 | result[@backingInt(Feature.xqcicsr)] = .{ |
| 1701 | .llvm_name = "xqcicsr", | 1701 | .llvm_name = "xqcicsr", |
| 1702 | .description = "'Xqcicsr' (Qualcomm uC CSR Extension)", | 1702 | .description = "'Xqcicsr' (Qualcomm uC CSR Extension)", |
| 1703 | .dependencies = featureSet(&[_]Feature{}), | 1703 | .dependencies = featureSet(&[_]Feature{}), |
| 1704 | }; | 1704 | }; |
| 1705 | result[@intFromEnum(Feature.xqciint)] = .{ | 1705 | result[@backingInt(Feature.xqciint)] = .{ |
| 1706 | .llvm_name = "xqciint", | 1706 | .llvm_name = "xqciint", |
| 1707 | .description = "'Xqciint' (Qualcomm uC Interrupts Extension)", | 1707 | .description = "'Xqciint' (Qualcomm uC Interrupts Extension)", |
| 1708 | .dependencies = featureSet(&[_]Feature{ | 1708 | .dependencies = featureSet(&[_]Feature{ |
| 1709 | .zca, | 1709 | .zca, |
| 1710 | }), | 1710 | }), |
| 1711 | }; | 1711 | }; |
| 1712 | result[@intFromEnum(Feature.xqciio)] = .{ | 1712 | result[@backingInt(Feature.xqciio)] = .{ |
| 1713 | .llvm_name = "xqciio", | 1713 | .llvm_name = "xqciio", |
| 1714 | .description = "'Xqciio' (Qualcomm uC External Input Output Extension)", | 1714 | .description = "'Xqciio' (Qualcomm uC External Input Output Extension)", |
| 1715 | .dependencies = featureSet(&[_]Feature{}), | 1715 | .dependencies = featureSet(&[_]Feature{}), |
| 1716 | }; | 1716 | }; |
| 1717 | result[@intFromEnum(Feature.xqcilb)] = .{ | 1717 | result[@backingInt(Feature.xqcilb)] = .{ |
| 1718 | .llvm_name = "xqcilb", | 1718 | .llvm_name = "xqcilb", |
| 1719 | .description = "'Xqcilb' (Qualcomm uC Long Branch Extension)", | 1719 | .description = "'Xqcilb' (Qualcomm uC Long Branch Extension)", |
| 1720 | .dependencies = featureSet(&[_]Feature{ | 1720 | .dependencies = featureSet(&[_]Feature{ |
| 1721 | .zca, | 1721 | .zca, |
| 1722 | }), | 1722 | }), |
| 1723 | }; | 1723 | }; |
| 1724 | result[@intFromEnum(Feature.xqcili)] = .{ | 1724 | result[@backingInt(Feature.xqcili)] = .{ |
| 1725 | .llvm_name = "xqcili", | 1725 | .llvm_name = "xqcili", |
| 1726 | .description = "'Xqcili' (Qualcomm uC Load Large Immediate Extension)", | 1726 | .description = "'Xqcili' (Qualcomm uC Load Large Immediate Extension)", |
| 1727 | .dependencies = featureSet(&[_]Feature{ | 1727 | .dependencies = featureSet(&[_]Feature{ |
| 1728 | .zca, | 1728 | .zca, |
| 1729 | }), | 1729 | }), |
| 1730 | }; | 1730 | }; |
| 1731 | result[@intFromEnum(Feature.xqcilia)] = .{ | 1731 | result[@backingInt(Feature.xqcilia)] = .{ |
| 1732 | .llvm_name = "xqcilia", | 1732 | .llvm_name = "xqcilia", |
| 1733 | .description = "'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)", | 1733 | .description = "'Xqcilia' (Qualcomm uC Large Immediate Arithmetic Extension)", |
| 1734 | .dependencies = featureSet(&[_]Feature{ | 1734 | .dependencies = featureSet(&[_]Feature{ |
| 1735 | .zca, | 1735 | .zca, |
| 1736 | }), | 1736 | }), |
| 1737 | }; | 1737 | }; |
| 1738 | result[@intFromEnum(Feature.xqcilo)] = .{ | 1738 | result[@backingInt(Feature.xqcilo)] = .{ |
| 1739 | .llvm_name = "xqcilo", | 1739 | .llvm_name = "xqcilo", |
| 1740 | .description = "'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)", | 1740 | .description = "'Xqcilo' (Qualcomm uC Large Offset Load Store Extension)", |
| 1741 | .dependencies = featureSet(&[_]Feature{ | 1741 | .dependencies = featureSet(&[_]Feature{ |
| 1742 | .zca, | 1742 | .zca, |
| 1743 | }), | 1743 | }), |
| 1744 | }; | 1744 | }; |
| 1745 | result[@intFromEnum(Feature.xqcilsm)] = .{ | 1745 | result[@backingInt(Feature.xqcilsm)] = .{ |
| 1746 | .llvm_name = "xqcilsm", | 1746 | .llvm_name = "xqcilsm", |
| 1747 | .description = "'Xqcilsm' (Qualcomm uC Load Store Multiple Extension)", | 1747 | .description = "'Xqcilsm' (Qualcomm uC Load Store Multiple Extension)", |
| 1748 | .dependencies = featureSet(&[_]Feature{}), | 1748 | .dependencies = featureSet(&[_]Feature{}), |
| 1749 | }; | 1749 | }; |
| 1750 | result[@intFromEnum(Feature.xqcisim)] = .{ | 1750 | result[@backingInt(Feature.xqcisim)] = .{ |
| 1751 | .llvm_name = "xqcisim", | 1751 | .llvm_name = "xqcisim", |
| 1752 | .description = "'Xqcisim' (Qualcomm uC Simulation Hint Extension)", | 1752 | .description = "'Xqcisim' (Qualcomm uC Simulation Hint Extension)", |
| 1753 | .dependencies = featureSet(&[_]Feature{ | 1753 | .dependencies = featureSet(&[_]Feature{ |
| 1754 | .zca, | 1754 | .zca, |
| 1755 | }), | 1755 | }), |
| 1756 | }; | 1756 | }; |
| 1757 | result[@intFromEnum(Feature.xqcisls)] = .{ | 1757 | result[@backingInt(Feature.xqcisls)] = .{ |
| 1758 | .llvm_name = "xqcisls", | 1758 | .llvm_name = "xqcisls", |
| 1759 | .description = "'Xqcisls' (Qualcomm uC Scaled Load Store Extension)", | 1759 | .description = "'Xqcisls' (Qualcomm uC Scaled Load Store Extension)", |
| 1760 | .dependencies = featureSet(&[_]Feature{}), | 1760 | .dependencies = featureSet(&[_]Feature{}), |
| 1761 | }; | 1761 | }; |
| 1762 | result[@intFromEnum(Feature.xqcisync)] = .{ | 1762 | result[@backingInt(Feature.xqcisync)] = .{ |
| 1763 | .llvm_name = "xqcisync", | 1763 | .llvm_name = "xqcisync", |
| 1764 | .description = "'Xqcisync' (Qualcomm uC Sync Delay Extension)", | 1764 | .description = "'Xqcisync' (Qualcomm uC Sync Delay Extension)", |
| 1765 | .dependencies = featureSet(&[_]Feature{ | 1765 | .dependencies = featureSet(&[_]Feature{ |
| 1766 | .zca, | 1766 | .zca, |
| 1767 | }), | 1767 | }), |
| 1768 | }; | 1768 | }; |
| 1769 | result[@intFromEnum(Feature.xsfcease)] = .{ | 1769 | result[@backingInt(Feature.xsfcease)] = .{ |
| 1770 | .llvm_name = "xsfcease", | 1770 | .llvm_name = "xsfcease", |
| 1771 | .description = "'XSfcease' (SiFive sf.cease Instruction)", | 1771 | .description = "'XSfcease' (SiFive sf.cease Instruction)", |
| 1772 | .dependencies = featureSet(&[_]Feature{}), | 1772 | .dependencies = featureSet(&[_]Feature{}), |
| 1773 | }; | 1773 | }; |
| 1774 | result[@intFromEnum(Feature.xsfmm128t)] = .{ | 1774 | result[@backingInt(Feature.xsfmm128t)] = .{ |
| 1775 | .llvm_name = "xsfmm128t", | 1775 | .llvm_name = "xsfmm128t", |
| 1776 | .description = "'XSfmm128t' (TE=128 configuration)", | 1776 | .description = "'XSfmm128t' (TE=128 configuration)", |
| 1777 | .dependencies = featureSet(&[_]Feature{ | 1777 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1779,7 +1779,7 @@ pub const all_features = blk: { | ... | @@ -1779,7 +1779,7 @@ pub const all_features = blk: { |
| 1779 | .zvl512b, | 1779 | .zvl512b, |
| 1780 | }), | 1780 | }), |
| 1781 | }; | 1781 | }; |
| 1782 | result[@intFromEnum(Feature.xsfmm16t)] = .{ | 1782 | result[@backingInt(Feature.xsfmm16t)] = .{ |
| 1783 | .llvm_name = "xsfmm16t", | 1783 | .llvm_name = "xsfmm16t", |
| 1784 | .description = "'XSfmm16t' (TE=16 configuration)", | 1784 | .description = "'XSfmm16t' (TE=16 configuration)", |
| 1785 | .dependencies = featureSet(&[_]Feature{ | 1785 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1787,7 +1787,7 @@ pub const all_features = blk: { | ... | @@ -1787,7 +1787,7 @@ pub const all_features = blk: { |
| 1787 | .zvl64b, | 1787 | .zvl64b, |
| 1788 | }), | 1788 | }), |
| 1789 | }; | 1789 | }; |
| 1790 | result[@intFromEnum(Feature.xsfmm32a16f)] = .{ | 1790 | result[@backingInt(Feature.xsfmm32a16f)] = .{ |
| 1791 | .llvm_name = "xsfmm32a16f", | 1791 | .llvm_name = "xsfmm32a16f", |
| 1792 | .description = "'XSfmm32a16f' (TEW=32-bit accumulation, operands - float: 16b, widen=2 (IEEE, BF))", | 1792 | .description = "'XSfmm32a16f' (TEW=32-bit accumulation, operands - float: 16b, widen=2 (IEEE, BF))", |
| 1793 | .dependencies = featureSet(&[_]Feature{ | 1793 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1795,7 +1795,7 @@ pub const all_features = blk: { | ... | @@ -1795,7 +1795,7 @@ pub const all_features = blk: { |
| 1795 | .zve32f, | 1795 | .zve32f, |
| 1796 | }), | 1796 | }), |
| 1797 | }; | 1797 | }; |
| 1798 | result[@intFromEnum(Feature.xsfmm32a32f)] = .{ | 1798 | result[@backingInt(Feature.xsfmm32a32f)] = .{ |
| 1799 | .llvm_name = "xsfmm32a32f", | 1799 | .llvm_name = "xsfmm32a32f", |
| 1800 | .description = "'XSfmm32a32f' (TEW=32-bit accumulation, operands - float: 32b)", | 1800 | .description = "'XSfmm32a32f' (TEW=32-bit accumulation, operands - float: 32b)", |
| 1801 | .dependencies = featureSet(&[_]Feature{ | 1801 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1803,7 +1803,7 @@ pub const all_features = blk: { | ... | @@ -1803,7 +1803,7 @@ pub const all_features = blk: { |
| 1803 | .zve32f, | 1803 | .zve32f, |
| 1804 | }), | 1804 | }), |
| 1805 | }; | 1805 | }; |
| 1806 | result[@intFromEnum(Feature.xsfmm32a8f)] = .{ | 1806 | result[@backingInt(Feature.xsfmm32a8f)] = .{ |
| 1807 | .llvm_name = "xsfmm32a8f", | 1807 | .llvm_name = "xsfmm32a8f", |
| 1808 | .description = "'XSfmm32a8f' (TEW=32-bit accumulation, operands - float: fp8)", | 1808 | .description = "'XSfmm32a8f' (TEW=32-bit accumulation, operands - float: fp8)", |
| 1809 | .dependencies = featureSet(&[_]Feature{ | 1809 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1811,14 +1811,14 @@ pub const all_features = blk: { | ... | @@ -1811,14 +1811,14 @@ pub const all_features = blk: { |
| 1811 | .zve32f, | 1811 | .zve32f, |
| 1812 | }), | 1812 | }), |
| 1813 | }; | 1813 | }; |
| 1814 | result[@intFromEnum(Feature.xsfmm32a8i)] = .{ | 1814 | result[@backingInt(Feature.xsfmm32a8i)] = .{ |
| 1815 | .llvm_name = "xsfmm32a8i", | 1815 | .llvm_name = "xsfmm32a8i", |
| 1816 | .description = "'XSfmm32a8i' (TEW=32-bit accumulation, operands - int: 8b)", | 1816 | .description = "'XSfmm32a8i' (TEW=32-bit accumulation, operands - int: 8b)", |
| 1817 | .dependencies = featureSet(&[_]Feature{ | 1817 | .dependencies = featureSet(&[_]Feature{ |
| 1818 | .xsfmmbase, | 1818 | .xsfmmbase, |
| 1819 | }), | 1819 | }), |
| 1820 | }; | 1820 | }; |
| 1821 | result[@intFromEnum(Feature.xsfmm32t)] = .{ | 1821 | result[@backingInt(Feature.xsfmm32t)] = .{ |
| 1822 | .llvm_name = "xsfmm32t", | 1822 | .llvm_name = "xsfmm32t", |
| 1823 | .description = "'XSfmm32t' (TE=32 configuration)", | 1823 | .description = "'XSfmm32t' (TE=32 configuration)", |
| 1824 | .dependencies = featureSet(&[_]Feature{ | 1824 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1826,7 +1826,7 @@ pub const all_features = blk: { | ... | @@ -1826,7 +1826,7 @@ pub const all_features = blk: { |
| 1826 | .zvl128b, | 1826 | .zvl128b, |
| 1827 | }), | 1827 | }), |
| 1828 | }; | 1828 | }; |
| 1829 | result[@intFromEnum(Feature.xsfmm64a64f)] = .{ | 1829 | result[@backingInt(Feature.xsfmm64a64f)] = .{ |
| 1830 | .llvm_name = "xsfmm64a64f", | 1830 | .llvm_name = "xsfmm64a64f", |
| 1831 | .description = "'XSfmm64a64f' (TEW=64-bit accumulation, operands - float: fp64)", | 1831 | .description = "'XSfmm64a64f' (TEW=64-bit accumulation, operands - float: fp64)", |
| 1832 | .dependencies = featureSet(&[_]Feature{ | 1832 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1834,7 +1834,7 @@ pub const all_features = blk: { | ... | @@ -1834,7 +1834,7 @@ pub const all_features = blk: { |
| 1834 | .zve64d, | 1834 | .zve64d, |
| 1835 | }), | 1835 | }), |
| 1836 | }; | 1836 | }; |
| 1837 | result[@intFromEnum(Feature.xsfmm64t)] = .{ | 1837 | result[@backingInt(Feature.xsfmm64t)] = .{ |
| 1838 | .llvm_name = "xsfmm64t", | 1838 | .llvm_name = "xsfmm64t", |
| 1839 | .description = "'XSfmm64t' (TE=64 configuration)", | 1839 | .description = "'XSfmm64t' (TE=64 configuration)", |
| 1840 | .dependencies = featureSet(&[_]Feature{ | 1840 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1842,47 +1842,47 @@ pub const all_features = blk: { | ... | @@ -1842,47 +1842,47 @@ pub const all_features = blk: { |
| 1842 | .zvl256b, | 1842 | .zvl256b, |
| 1843 | }), | 1843 | }), |
| 1844 | }; | 1844 | }; |
| 1845 | result[@intFromEnum(Feature.xsfmmbase)] = .{ | 1845 | result[@backingInt(Feature.xsfmmbase)] = .{ |
| 1846 | .llvm_name = "xsfmmbase", | 1846 | .llvm_name = "xsfmmbase", |
| 1847 | .description = "'XSfmmbase' (All non arithmetic instructions for all TEWs and sf.vtzero)", | 1847 | .description = "'XSfmmbase' (All non arithmetic instructions for all TEWs and sf.vtzero)", |
| 1848 | .dependencies = featureSet(&[_]Feature{ | 1848 | .dependencies = featureSet(&[_]Feature{ |
| 1849 | .zve32x, | 1849 | .zve32x, |
| 1850 | }), | 1850 | }), |
| 1851 | }; | 1851 | }; |
| 1852 | result[@intFromEnum(Feature.xsfvcp)] = .{ | 1852 | result[@backingInt(Feature.xsfvcp)] = .{ |
| 1853 | .llvm_name = "xsfvcp", | 1853 | .llvm_name = "xsfvcp", |
| 1854 | .description = "'XSfvcp' (SiFive Custom Vector Coprocessor Interface Instructions)", | 1854 | .description = "'XSfvcp' (SiFive Custom Vector Coprocessor Interface Instructions)", |
| 1855 | .dependencies = featureSet(&[_]Feature{ | 1855 | .dependencies = featureSet(&[_]Feature{ |
| 1856 | .zve32x, | 1856 | .zve32x, |
| 1857 | }), | 1857 | }), |
| 1858 | }; | 1858 | }; |
| 1859 | result[@intFromEnum(Feature.xsfvfbfexp16e)] = .{ | 1859 | result[@backingInt(Feature.xsfvfbfexp16e)] = .{ |
| 1860 | .llvm_name = "xsfvfbfexp16e", | 1860 | .llvm_name = "xsfvfbfexp16e", |
| 1861 | .description = "'XSfvfbfexp16e' (SiFive Vector Floating-Point Exponential Function Instruction, BFloat16)", | 1861 | .description = "'XSfvfbfexp16e' (SiFive Vector Floating-Point Exponential Function Instruction, BFloat16)", |
| 1862 | .dependencies = featureSet(&[_]Feature{}), | 1862 | .dependencies = featureSet(&[_]Feature{}), |
| 1863 | }; | 1863 | }; |
| 1864 | result[@intFromEnum(Feature.xsfvfexp16e)] = .{ | 1864 | result[@backingInt(Feature.xsfvfexp16e)] = .{ |
| 1865 | .llvm_name = "xsfvfexp16e", | 1865 | .llvm_name = "xsfvfexp16e", |
| 1866 | .description = "'XSfvfexp16e' (SiFive Vector Floating-Point Exponential Function Instruction, Half Precision)", | 1866 | .description = "'XSfvfexp16e' (SiFive Vector Floating-Point Exponential Function Instruction, Half Precision)", |
| 1867 | .dependencies = featureSet(&[_]Feature{ | 1867 | .dependencies = featureSet(&[_]Feature{ |
| 1868 | .zvfh, | 1868 | .zvfh, |
| 1869 | }), | 1869 | }), |
| 1870 | }; | 1870 | }; |
| 1871 | result[@intFromEnum(Feature.xsfvfexp32e)] = .{ | 1871 | result[@backingInt(Feature.xsfvfexp32e)] = .{ |
| 1872 | .llvm_name = "xsfvfexp32e", | 1872 | .llvm_name = "xsfvfexp32e", |
| 1873 | .description = "'XSfvfexp32e' (SiFive Vector Floating-Point Exponential Function Instruction, Single Precision)", | 1873 | .description = "'XSfvfexp32e' (SiFive Vector Floating-Point Exponential Function Instruction, Single Precision)", |
| 1874 | .dependencies = featureSet(&[_]Feature{ | 1874 | .dependencies = featureSet(&[_]Feature{ |
| 1875 | .zve32f, | 1875 | .zve32f, |
| 1876 | }), | 1876 | }), |
| 1877 | }; | 1877 | }; |
| 1878 | result[@intFromEnum(Feature.xsfvfexpa)] = .{ | 1878 | result[@backingInt(Feature.xsfvfexpa)] = .{ |
| 1879 | .llvm_name = "xsfvfexpa", | 1879 | .llvm_name = "xsfvfexpa", |
| 1880 | .description = "'XSfvfexpa' (SiFive Vector Floating-Point Exponential Approximation Instruction)", | 1880 | .description = "'XSfvfexpa' (SiFive Vector Floating-Point Exponential Approximation Instruction)", |
| 1881 | .dependencies = featureSet(&[_]Feature{ | 1881 | .dependencies = featureSet(&[_]Feature{ |
| 1882 | .zve32f, | 1882 | .zve32f, |
| 1883 | }), | 1883 | }), |
| 1884 | }; | 1884 | }; |
| 1885 | result[@intFromEnum(Feature.xsfvfexpa64e)] = .{ | 1885 | result[@backingInt(Feature.xsfvfexpa64e)] = .{ |
| 1886 | .llvm_name = "xsfvfexpa64e", | 1886 | .llvm_name = "xsfvfexpa64e", |
| 1887 | .description = "'XSfvfexpa64e' (SiFive Vector Floating-Point Exponential Approximation Instruction with Double-Precision)", | 1887 | .description = "'XSfvfexpa64e' (SiFive Vector Floating-Point Exponential Approximation Instruction with Double-Precision)", |
| 1888 | .dependencies = featureSet(&[_]Feature{ | 1888 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1890,14 +1890,14 @@ pub const all_features = blk: { | ... | @@ -1890,14 +1890,14 @@ pub const all_features = blk: { |
| 1890 | .zve64d, | 1890 | .zve64d, |
| 1891 | }), | 1891 | }), |
| 1892 | }; | 1892 | }; |
| 1893 | result[@intFromEnum(Feature.xsfvfnrclipxfqf)] = .{ | 1893 | result[@backingInt(Feature.xsfvfnrclipxfqf)] = .{ |
| 1894 | .llvm_name = "xsfvfnrclipxfqf", | 1894 | .llvm_name = "xsfvfnrclipxfqf", |
| 1895 | .description = "'XSfvfnrclipxfqf' (SiFive FP32-to-int8 Ranged Clip Instructions)", | 1895 | .description = "'XSfvfnrclipxfqf' (SiFive FP32-to-int8 Ranged Clip Instructions)", |
| 1896 | .dependencies = featureSet(&[_]Feature{ | 1896 | .dependencies = featureSet(&[_]Feature{ |
| 1897 | .zve32f, | 1897 | .zve32f, |
| 1898 | }), | 1898 | }), |
| 1899 | }; | 1899 | }; |
| 1900 | result[@intFromEnum(Feature.xsfvfwmaccqqq)] = .{ | 1900 | result[@backingInt(Feature.xsfvfwmaccqqq)] = .{ |
| 1901 | .llvm_name = "xsfvfwmaccqqq", | 1901 | .llvm_name = "xsfvfwmaccqqq", |
| 1902 | .description = "'XSfvfwmaccqqq' (SiFive Matrix Multiply Accumulate Instruction (4-by-4))", | 1902 | .description = "'XSfvfwmaccqqq' (SiFive Matrix Multiply Accumulate Instruction (4-by-4))", |
| 1903 | .dependencies = featureSet(&[_]Feature{ | 1903 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1905,7 +1905,7 @@ pub const all_features = blk: { | ... | @@ -1905,7 +1905,7 @@ pub const all_features = blk: { |
| 1905 | .zvl128b, | 1905 | .zvl128b, |
| 1906 | }), | 1906 | }), |
| 1907 | }; | 1907 | }; |
| 1908 | result[@intFromEnum(Feature.xsfvqmaccdod)] = .{ | 1908 | result[@backingInt(Feature.xsfvqmaccdod)] = .{ |
| 1909 | .llvm_name = "xsfvqmaccdod", | 1909 | .llvm_name = "xsfvqmaccdod", |
| 1910 | .description = "'XSfvqmaccdod' (SiFive Int8 Matrix Multiplication Instructions (2-by-8 and 8-by-2))", | 1910 | .description = "'XSfvqmaccdod' (SiFive Int8 Matrix Multiplication Instructions (2-by-8 and 8-by-2))", |
| 1911 | .dependencies = featureSet(&[_]Feature{ | 1911 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1913,7 +1913,7 @@ pub const all_features = blk: { | ... | @@ -1913,7 +1913,7 @@ pub const all_features = blk: { |
| 1913 | .zvl128b, | 1913 | .zvl128b, |
| 1914 | }), | 1914 | }), |
| 1915 | }; | 1915 | }; |
| 1916 | result[@intFromEnum(Feature.xsfvqmaccqoq)] = .{ | 1916 | result[@backingInt(Feature.xsfvqmaccqoq)] = .{ |
| 1917 | .llvm_name = "xsfvqmaccqoq", | 1917 | .llvm_name = "xsfvqmaccqoq", |
| 1918 | .description = "'XSfvqmaccqoq' (SiFive Int8 Matrix Multiplication Instructions (4-by-8 and 8-by-4))", | 1918 | .description = "'XSfvqmaccqoq' (SiFive Int8 Matrix Multiplication Instructions (4-by-8 and 8-by-4))", |
| 1919 | .dependencies = featureSet(&[_]Feature{ | 1919 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1921,189 +1921,189 @@ pub const all_features = blk: { | ... | @@ -1921,189 +1921,189 @@ pub const all_features = blk: { |
| 1921 | .zvl256b, | 1921 | .zvl256b, |
| 1922 | }), | 1922 | }), |
| 1923 | }; | 1923 | }; |
| 1924 | result[@intFromEnum(Feature.xsifivecdiscarddlone)] = .{ | 1924 | result[@backingInt(Feature.xsifivecdiscarddlone)] = .{ |
| 1925 | .llvm_name = "xsifivecdiscarddlone", | 1925 | .llvm_name = "xsifivecdiscarddlone", |
| 1926 | .description = "'XSiFivecdiscarddlone' (SiFive sf.cdiscard.d.l1 Instruction)", | 1926 | .description = "'XSiFivecdiscarddlone' (SiFive sf.cdiscard.d.l1 Instruction)", |
| 1927 | .dependencies = featureSet(&[_]Feature{}), | 1927 | .dependencies = featureSet(&[_]Feature{}), |
| 1928 | }; | 1928 | }; |
| 1929 | result[@intFromEnum(Feature.xsifivecflushdlone)] = .{ | 1929 | result[@backingInt(Feature.xsifivecflushdlone)] = .{ |
| 1930 | .llvm_name = "xsifivecflushdlone", | 1930 | .llvm_name = "xsifivecflushdlone", |
| 1931 | .description = "'XSiFivecflushdlone' (SiFive sf.cflush.d.l1 Instruction)", | 1931 | .description = "'XSiFivecflushdlone' (SiFive sf.cflush.d.l1 Instruction)", |
| 1932 | .dependencies = featureSet(&[_]Feature{}), | 1932 | .dependencies = featureSet(&[_]Feature{}), |
| 1933 | }; | 1933 | }; |
| 1934 | result[@intFromEnum(Feature.xsmtvdot)] = .{ | 1934 | result[@backingInt(Feature.xsmtvdot)] = .{ |
| 1935 | .llvm_name = "xsmtvdot", | 1935 | .llvm_name = "xsmtvdot", |
| 1936 | .description = "'XSMTVDot' (SpacemiT Vector Dot Product Extension)", | 1936 | .description = "'XSMTVDot' (SpacemiT Vector Dot Product Extension)", |
| 1937 | .dependencies = featureSet(&[_]Feature{ | 1937 | .dependencies = featureSet(&[_]Feature{ |
| 1938 | .zve32f, | 1938 | .zve32f, |
| 1939 | }), | 1939 | }), |
| 1940 | }; | 1940 | }; |
| 1941 | result[@intFromEnum(Feature.xtheadba)] = .{ | 1941 | result[@backingInt(Feature.xtheadba)] = .{ |
| 1942 | .llvm_name = "xtheadba", | 1942 | .llvm_name = "xtheadba", |
| 1943 | .description = "'XTHeadBa' (T-Head address calculation instructions)", | 1943 | .description = "'XTHeadBa' (T-Head address calculation instructions)", |
| 1944 | .dependencies = featureSet(&[_]Feature{}), | 1944 | .dependencies = featureSet(&[_]Feature{}), |
| 1945 | }; | 1945 | }; |
| 1946 | result[@intFromEnum(Feature.xtheadbb)] = .{ | 1946 | result[@backingInt(Feature.xtheadbb)] = .{ |
| 1947 | .llvm_name = "xtheadbb", | 1947 | .llvm_name = "xtheadbb", |
| 1948 | .description = "'XTHeadBb' (T-Head basic bit-manipulation instructions)", | 1948 | .description = "'XTHeadBb' (T-Head basic bit-manipulation instructions)", |
| 1949 | .dependencies = featureSet(&[_]Feature{}), | 1949 | .dependencies = featureSet(&[_]Feature{}), |
| 1950 | }; | 1950 | }; |
| 1951 | result[@intFromEnum(Feature.xtheadbs)] = .{ | 1951 | result[@backingInt(Feature.xtheadbs)] = .{ |
| 1952 | .llvm_name = "xtheadbs", | 1952 | .llvm_name = "xtheadbs", |
| 1953 | .description = "'XTHeadBs' (T-Head single-bit instructions)", | 1953 | .description = "'XTHeadBs' (T-Head single-bit instructions)", |
| 1954 | .dependencies = featureSet(&[_]Feature{}), | 1954 | .dependencies = featureSet(&[_]Feature{}), |
| 1955 | }; | 1955 | }; |
| 1956 | result[@intFromEnum(Feature.xtheadcmo)] = .{ | 1956 | result[@backingInt(Feature.xtheadcmo)] = .{ |
| 1957 | .llvm_name = "xtheadcmo", | 1957 | .llvm_name = "xtheadcmo", |
| 1958 | .description = "'XTHeadCmo' (T-Head cache management instructions)", | 1958 | .description = "'XTHeadCmo' (T-Head cache management instructions)", |
| 1959 | .dependencies = featureSet(&[_]Feature{}), | 1959 | .dependencies = featureSet(&[_]Feature{}), |
| 1960 | }; | 1960 | }; |
| 1961 | result[@intFromEnum(Feature.xtheadcondmov)] = .{ | 1961 | result[@backingInt(Feature.xtheadcondmov)] = .{ |
| 1962 | .llvm_name = "xtheadcondmov", | 1962 | .llvm_name = "xtheadcondmov", |
| 1963 | .description = "'XTHeadCondMov' (T-Head conditional move instructions)", | 1963 | .description = "'XTHeadCondMov' (T-Head conditional move instructions)", |
| 1964 | .dependencies = featureSet(&[_]Feature{}), | 1964 | .dependencies = featureSet(&[_]Feature{}), |
| 1965 | }; | 1965 | }; |
| 1966 | result[@intFromEnum(Feature.xtheadfmemidx)] = .{ | 1966 | result[@backingInt(Feature.xtheadfmemidx)] = .{ |
| 1967 | .llvm_name = "xtheadfmemidx", | 1967 | .llvm_name = "xtheadfmemidx", |
| 1968 | .description = "'XTHeadFMemIdx' (T-Head FP Indexed Memory Operations)", | 1968 | .description = "'XTHeadFMemIdx' (T-Head FP Indexed Memory Operations)", |
| 1969 | .dependencies = featureSet(&[_]Feature{}), | 1969 | .dependencies = featureSet(&[_]Feature{}), |
| 1970 | }; | 1970 | }; |
| 1971 | result[@intFromEnum(Feature.xtheadmac)] = .{ | 1971 | result[@backingInt(Feature.xtheadmac)] = .{ |
| 1972 | .llvm_name = "xtheadmac", | 1972 | .llvm_name = "xtheadmac", |
| 1973 | .description = "'XTHeadMac' (T-Head Multiply-Accumulate Instructions)", | 1973 | .description = "'XTHeadMac' (T-Head Multiply-Accumulate Instructions)", |
| 1974 | .dependencies = featureSet(&[_]Feature{}), | 1974 | .dependencies = featureSet(&[_]Feature{}), |
| 1975 | }; | 1975 | }; |
| 1976 | result[@intFromEnum(Feature.xtheadmemidx)] = .{ | 1976 | result[@backingInt(Feature.xtheadmemidx)] = .{ |
| 1977 | .llvm_name = "xtheadmemidx", | 1977 | .llvm_name = "xtheadmemidx", |
| 1978 | .description = "'XTHeadMemIdx' (T-Head Indexed Memory Operations)", | 1978 | .description = "'XTHeadMemIdx' (T-Head Indexed Memory Operations)", |
| 1979 | .dependencies = featureSet(&[_]Feature{}), | 1979 | .dependencies = featureSet(&[_]Feature{}), |
| 1980 | }; | 1980 | }; |
| 1981 | result[@intFromEnum(Feature.xtheadmempair)] = .{ | 1981 | result[@backingInt(Feature.xtheadmempair)] = .{ |
| 1982 | .llvm_name = "xtheadmempair", | 1982 | .llvm_name = "xtheadmempair", |
| 1983 | .description = "'XTHeadMemPair' (T-Head two-GPR Memory Operations)", | 1983 | .description = "'XTHeadMemPair' (T-Head two-GPR Memory Operations)", |
| 1984 | .dependencies = featureSet(&[_]Feature{}), | 1984 | .dependencies = featureSet(&[_]Feature{}), |
| 1985 | }; | 1985 | }; |
| 1986 | result[@intFromEnum(Feature.xtheadsync)] = .{ | 1986 | result[@backingInt(Feature.xtheadsync)] = .{ |
| 1987 | .llvm_name = "xtheadsync", | 1987 | .llvm_name = "xtheadsync", |
| 1988 | .description = "'XTHeadSync' (T-Head multicore synchronization instructions)", | 1988 | .description = "'XTHeadSync' (T-Head multicore synchronization instructions)", |
| 1989 | .dependencies = featureSet(&[_]Feature{}), | 1989 | .dependencies = featureSet(&[_]Feature{}), |
| 1990 | }; | 1990 | }; |
| 1991 | result[@intFromEnum(Feature.xtheadvdot)] = .{ | 1991 | result[@backingInt(Feature.xtheadvdot)] = .{ |
| 1992 | .llvm_name = "xtheadvdot", | 1992 | .llvm_name = "xtheadvdot", |
| 1993 | .description = "'XTHeadVdot' (T-Head Vector Extensions for Dot)", | 1993 | .description = "'XTHeadVdot' (T-Head Vector Extensions for Dot)", |
| 1994 | .dependencies = featureSet(&[_]Feature{ | 1994 | .dependencies = featureSet(&[_]Feature{ |
| 1995 | .v, | 1995 | .v, |
| 1996 | }), | 1996 | }), |
| 1997 | }; | 1997 | }; |
| 1998 | result[@intFromEnum(Feature.xventanacondops)] = .{ | 1998 | result[@backingInt(Feature.xventanacondops)] = .{ |
| 1999 | .llvm_name = "xventanacondops", | 1999 | .llvm_name = "xventanacondops", |
| 2000 | .description = "'XVentanaCondOps' (Ventana Conditional Ops)", | 2000 | .description = "'XVentanaCondOps' (Ventana Conditional Ops)", |
| 2001 | .dependencies = featureSet(&[_]Feature{}), | 2001 | .dependencies = featureSet(&[_]Feature{}), |
| 2002 | }; | 2002 | }; |
| 2003 | result[@intFromEnum(Feature.xwchc)] = .{ | 2003 | result[@backingInt(Feature.xwchc)] = .{ |
| 2004 | .llvm_name = "xwchc", | 2004 | .llvm_name = "xwchc", |
| 2005 | .description = "'Xwchc' (WCH/QingKe additional compressed opcodes)", | 2005 | .description = "'Xwchc' (WCH/QingKe additional compressed opcodes)", |
| 2006 | .dependencies = featureSet(&[_]Feature{ | 2006 | .dependencies = featureSet(&[_]Feature{ |
| 2007 | .zca, | 2007 | .zca, |
| 2008 | }), | 2008 | }), |
| 2009 | }; | 2009 | }; |
| 2010 | result[@intFromEnum(Feature.za128rs)] = .{ | 2010 | result[@backingInt(Feature.za128rs)] = .{ |
| 2011 | .llvm_name = "za128rs", | 2011 | .llvm_name = "za128rs", |
| 2012 | .description = "'Za128rs' (Reservation Set Size of at Most 128 Bytes)", | 2012 | .description = "'Za128rs' (Reservation Set Size of at Most 128 Bytes)", |
| 2013 | .dependencies = featureSet(&[_]Feature{}), | 2013 | .dependencies = featureSet(&[_]Feature{}), |
| 2014 | }; | 2014 | }; |
| 2015 | result[@intFromEnum(Feature.za64rs)] = .{ | 2015 | result[@backingInt(Feature.za64rs)] = .{ |
| 2016 | .llvm_name = "za64rs", | 2016 | .llvm_name = "za64rs", |
| 2017 | .description = "'Za64rs' (Reservation Set Size of at Most 64 Bytes)", | 2017 | .description = "'Za64rs' (Reservation Set Size of at Most 64 Bytes)", |
| 2018 | .dependencies = featureSet(&[_]Feature{}), | 2018 | .dependencies = featureSet(&[_]Feature{}), |
| 2019 | }; | 2019 | }; |
| 2020 | result[@intFromEnum(Feature.zaamo)] = .{ | 2020 | result[@backingInt(Feature.zaamo)] = .{ |
| 2021 | .llvm_name = "zaamo", | 2021 | .llvm_name = "zaamo", |
| 2022 | .description = "'Zaamo' (Atomic Memory Operations)", | 2022 | .description = "'Zaamo' (Atomic Memory Operations)", |
| 2023 | .dependencies = featureSet(&[_]Feature{}), | 2023 | .dependencies = featureSet(&[_]Feature{}), |
| 2024 | }; | 2024 | }; |
| 2025 | result[@intFromEnum(Feature.zabha)] = .{ | 2025 | result[@backingInt(Feature.zabha)] = .{ |
| 2026 | .llvm_name = "zabha", | 2026 | .llvm_name = "zabha", |
| 2027 | .description = "'Zabha' (Byte and Halfword Atomic Memory Operations)", | 2027 | .description = "'Zabha' (Byte and Halfword Atomic Memory Operations)", |
| 2028 | .dependencies = featureSet(&[_]Feature{ | 2028 | .dependencies = featureSet(&[_]Feature{ |
| 2029 | .zaamo, | 2029 | .zaamo, |
| 2030 | }), | 2030 | }), |
| 2031 | }; | 2031 | }; |
| 2032 | result[@intFromEnum(Feature.zacas)] = .{ | 2032 | result[@backingInt(Feature.zacas)] = .{ |
| 2033 | .llvm_name = "zacas", | 2033 | .llvm_name = "zacas", |
| 2034 | .description = "'Zacas' (Atomic Compare-And-Swap Instructions)", | 2034 | .description = "'Zacas' (Atomic Compare-And-Swap Instructions)", |
| 2035 | .dependencies = featureSet(&[_]Feature{ | 2035 | .dependencies = featureSet(&[_]Feature{ |
| 2036 | .zaamo, | 2036 | .zaamo, |
| 2037 | }), | 2037 | }), |
| 2038 | }; | 2038 | }; |
| 2039 | result[@intFromEnum(Feature.zalasr)] = .{ | 2039 | result[@backingInt(Feature.zalasr)] = .{ |
| 2040 | .llvm_name = "zalasr", | 2040 | .llvm_name = "zalasr", |
| 2041 | .description = "'Zalasr' (Load-Acquire and Store-Release Instructions)", | 2041 | .description = "'Zalasr' (Load-Acquire and Store-Release Instructions)", |
| 2042 | .dependencies = featureSet(&[_]Feature{}), | 2042 | .dependencies = featureSet(&[_]Feature{}), |
| 2043 | }; | 2043 | }; |
| 2044 | result[@intFromEnum(Feature.zalrsc)] = .{ | 2044 | result[@backingInt(Feature.zalrsc)] = .{ |
| 2045 | .llvm_name = "zalrsc", | 2045 | .llvm_name = "zalrsc", |
| 2046 | .description = "'Zalrsc' (Load-Reserved/Store-Conditional)", | 2046 | .description = "'Zalrsc' (Load-Reserved/Store-Conditional)", |
| 2047 | .dependencies = featureSet(&[_]Feature{}), | 2047 | .dependencies = featureSet(&[_]Feature{}), |
| 2048 | }; | 2048 | }; |
| 2049 | result[@intFromEnum(Feature.zama16b)] = .{ | 2049 | result[@backingInt(Feature.zama16b)] = .{ |
| 2050 | .llvm_name = "zama16b", | 2050 | .llvm_name = "zama16b", |
| 2051 | .description = "'Zama16b' (Atomic 16-byte misaligned loads, stores and AMOs)", | 2051 | .description = "'Zama16b' (Atomic 16-byte misaligned loads, stores and AMOs)", |
| 2052 | .dependencies = featureSet(&[_]Feature{}), | 2052 | .dependencies = featureSet(&[_]Feature{}), |
| 2053 | }; | 2053 | }; |
| 2054 | result[@intFromEnum(Feature.zawrs)] = .{ | 2054 | result[@backingInt(Feature.zawrs)] = .{ |
| 2055 | .llvm_name = "zawrs", | 2055 | .llvm_name = "zawrs", |
| 2056 | .description = "'Zawrs' (Wait on Reservation Set)", | 2056 | .description = "'Zawrs' (Wait on Reservation Set)", |
| 2057 | .dependencies = featureSet(&[_]Feature{}), | 2057 | .dependencies = featureSet(&[_]Feature{}), |
| 2058 | }; | 2058 | }; |
| 2059 | result[@intFromEnum(Feature.zba)] = .{ | 2059 | result[@backingInt(Feature.zba)] = .{ |
| 2060 | .llvm_name = "zba", | 2060 | .llvm_name = "zba", |
| 2061 | .description = "'Zba' (Address Generation Instructions)", | 2061 | .description = "'Zba' (Address Generation Instructions)", |
| 2062 | .dependencies = featureSet(&[_]Feature{}), | 2062 | .dependencies = featureSet(&[_]Feature{}), |
| 2063 | }; | 2063 | }; |
| 2064 | result[@intFromEnum(Feature.zbb)] = .{ | 2064 | result[@backingInt(Feature.zbb)] = .{ |
| 2065 | .llvm_name = "zbb", | 2065 | .llvm_name = "zbb", |
| 2066 | .description = "'Zbb' (Basic Bit-Manipulation)", | 2066 | .description = "'Zbb' (Basic Bit-Manipulation)", |
| 2067 | .dependencies = featureSet(&[_]Feature{}), | 2067 | .dependencies = featureSet(&[_]Feature{}), |
| 2068 | }; | 2068 | }; |
| 2069 | result[@intFromEnum(Feature.zbc)] = .{ | 2069 | result[@backingInt(Feature.zbc)] = .{ |
| 2070 | .llvm_name = "zbc", | 2070 | .llvm_name = "zbc", |
| 2071 | .description = "'Zbc' (Carry-Less Multiplication)", | 2071 | .description = "'Zbc' (Carry-Less Multiplication)", |
| 2072 | .dependencies = featureSet(&[_]Feature{}), | 2072 | .dependencies = featureSet(&[_]Feature{}), |
| 2073 | }; | 2073 | }; |
| 2074 | result[@intFromEnum(Feature.zbkb)] = .{ | 2074 | result[@backingInt(Feature.zbkb)] = .{ |
| 2075 | .llvm_name = "zbkb", | 2075 | .llvm_name = "zbkb", |
| 2076 | .description = "'Zbkb' (Bitmanip instructions for Cryptography)", | 2076 | .description = "'Zbkb' (Bitmanip instructions for Cryptography)", |
| 2077 | .dependencies = featureSet(&[_]Feature{}), | 2077 | .dependencies = featureSet(&[_]Feature{}), |
| 2078 | }; | 2078 | }; |
| 2079 | result[@intFromEnum(Feature.zbkc)] = .{ | 2079 | result[@backingInt(Feature.zbkc)] = .{ |
| 2080 | .llvm_name = "zbkc", | 2080 | .llvm_name = "zbkc", |
| 2081 | .description = "'Zbkc' (Carry-less multiply instructions for Cryptography)", | 2081 | .description = "'Zbkc' (Carry-less multiply instructions for Cryptography)", |
| 2082 | .dependencies = featureSet(&[_]Feature{}), | 2082 | .dependencies = featureSet(&[_]Feature{}), |
| 2083 | }; | 2083 | }; |
| 2084 | result[@intFromEnum(Feature.zbkx)] = .{ | 2084 | result[@backingInt(Feature.zbkx)] = .{ |
| 2085 | .llvm_name = "zbkx", | 2085 | .llvm_name = "zbkx", |
| 2086 | .description = "'Zbkx' (Crossbar permutation instructions)", | 2086 | .description = "'Zbkx' (Crossbar permutation instructions)", |
| 2087 | .dependencies = featureSet(&[_]Feature{}), | 2087 | .dependencies = featureSet(&[_]Feature{}), |
| 2088 | }; | 2088 | }; |
| 2089 | result[@intFromEnum(Feature.zbs)] = .{ | 2089 | result[@backingInt(Feature.zbs)] = .{ |
| 2090 | .llvm_name = "zbs", | 2090 | .llvm_name = "zbs", |
| 2091 | .description = "'Zbs' (Single-Bit Instructions)", | 2091 | .description = "'Zbs' (Single-Bit Instructions)", |
| 2092 | .dependencies = featureSet(&[_]Feature{}), | 2092 | .dependencies = featureSet(&[_]Feature{}), |
| 2093 | }; | 2093 | }; |
| 2094 | result[@intFromEnum(Feature.zca)] = .{ | 2094 | result[@backingInt(Feature.zca)] = .{ |
| 2095 | .llvm_name = "zca", | 2095 | .llvm_name = "zca", |
| 2096 | .description = "'Zca' (part of the C extension, excluding compressed floating point loads/stores)", | 2096 | .description = "'Zca' (part of the C extension, excluding compressed floating point loads/stores)", |
| 2097 | .dependencies = featureSet(&[_]Feature{}), | 2097 | .dependencies = featureSet(&[_]Feature{}), |
| 2098 | }; | 2098 | }; |
| 2099 | result[@intFromEnum(Feature.zcb)] = .{ | 2099 | result[@backingInt(Feature.zcb)] = .{ |
| 2100 | .llvm_name = "zcb", | 2100 | .llvm_name = "zcb", |
| 2101 | .description = "'Zcb' (Compressed basic bit manipulation instructions)", | 2101 | .description = "'Zcb' (Compressed basic bit manipulation instructions)", |
| 2102 | .dependencies = featureSet(&[_]Feature{ | 2102 | .dependencies = featureSet(&[_]Feature{ |
| 2103 | .zca, | 2103 | .zca, |
| 2104 | }), | 2104 | }), |
| 2105 | }; | 2105 | }; |
| 2106 | result[@intFromEnum(Feature.zcd)] = .{ | 2106 | result[@backingInt(Feature.zcd)] = .{ |
| 2107 | .llvm_name = "zcd", | 2107 | .llvm_name = "zcd", |
| 2108 | .description = "'Zcd' (Compressed Double-Precision Floating-Point Instructions)", | 2108 | .description = "'Zcd' (Compressed Double-Precision Floating-Point Instructions)", |
| 2109 | .dependencies = featureSet(&[_]Feature{ | 2109 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2111,7 +2111,7 @@ pub const all_features = blk: { | ... | @@ -2111,7 +2111,7 @@ pub const all_features = blk: { |
| 2111 | .zca, | 2111 | .zca, |
| 2112 | }), | 2112 | }), |
| 2113 | }; | 2113 | }; |
| 2114 | result[@intFromEnum(Feature.zce)] = .{ | 2114 | result[@backingInt(Feature.zce)] = .{ |
| 2115 | .llvm_name = "zce", | 2115 | .llvm_name = "zce", |
| 2116 | .description = "'Zce' (Compressed extensions for microcontrollers)", | 2116 | .description = "'Zce' (Compressed extensions for microcontrollers)", |
| 2117 | .dependencies = featureSet(&[_]Feature{ | 2117 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2120,7 +2120,7 @@ pub const all_features = blk: { | ... | @@ -2120,7 +2120,7 @@ pub const all_features = blk: { |
| 2120 | .zcmt, | 2120 | .zcmt, |
| 2121 | }), | 2121 | }), |
| 2122 | }; | 2122 | }; |
| 2123 | result[@intFromEnum(Feature.zcf)] = .{ | 2123 | result[@backingInt(Feature.zcf)] = .{ |
| 2124 | .llvm_name = "zcf", | 2124 | .llvm_name = "zcf", |
| 2125 | .description = "'Zcf' (Compressed Single-Precision Floating-Point Instructions)", | 2125 | .description = "'Zcf' (Compressed Single-Precision Floating-Point Instructions)", |
| 2126 | .dependencies = featureSet(&[_]Feature{ | 2126 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2128,7 +2128,7 @@ pub const all_features = blk: { | ... | @@ -2128,7 +2128,7 @@ pub const all_features = blk: { |
| 2128 | .zca, | 2128 | .zca, |
| 2129 | }), | 2129 | }), |
| 2130 | }; | 2130 | }; |
| 2131 | result[@intFromEnum(Feature.zclsd)] = .{ | 2131 | result[@backingInt(Feature.zclsd)] = .{ |
| 2132 | .llvm_name = "zclsd", | 2132 | .llvm_name = "zclsd", |
| 2133 | .description = "'Zclsd' (Compressed Load/Store Pair Instructions)", | 2133 | .description = "'Zclsd' (Compressed Load/Store Pair Instructions)", |
| 2134 | .dependencies = featureSet(&[_]Feature{ | 2134 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2136,21 +2136,21 @@ pub const all_features = blk: { | ... | @@ -2136,21 +2136,21 @@ pub const all_features = blk: { |
| 2136 | .zilsd, | 2136 | .zilsd, |
| 2137 | }), | 2137 | }), |
| 2138 | }; | 2138 | }; |
| 2139 | result[@intFromEnum(Feature.zcmop)] = .{ | 2139 | result[@backingInt(Feature.zcmop)] = .{ |
| 2140 | .llvm_name = "zcmop", | 2140 | .llvm_name = "zcmop", |
| 2141 | .description = "'Zcmop' (Compressed May-Be-Operations)", | 2141 | .description = "'Zcmop' (Compressed May-Be-Operations)", |
| 2142 | .dependencies = featureSet(&[_]Feature{ | 2142 | .dependencies = featureSet(&[_]Feature{ |
| 2143 | .zca, | 2143 | .zca, |
| 2144 | }), | 2144 | }), |
| 2145 | }; | 2145 | }; |
| 2146 | result[@intFromEnum(Feature.zcmp)] = .{ | 2146 | result[@backingInt(Feature.zcmp)] = .{ |
| 2147 | .llvm_name = "zcmp", | 2147 | .llvm_name = "zcmp", |
| 2148 | .description = "'Zcmp' (sequenced instructions for code-size reduction)", | 2148 | .description = "'Zcmp' (sequenced instructions for code-size reduction)", |
| 2149 | .dependencies = featureSet(&[_]Feature{ | 2149 | .dependencies = featureSet(&[_]Feature{ |
| 2150 | .zca, | 2150 | .zca, |
| 2151 | }), | 2151 | }), |
| 2152 | }; | 2152 | }; |
| 2153 | result[@intFromEnum(Feature.zcmt)] = .{ | 2153 | result[@backingInt(Feature.zcmt)] = .{ |
| 2154 | .llvm_name = "zcmt", | 2154 | .llvm_name = "zcmt", |
| 2155 | .description = "'Zcmt' (table jump instructions for code-size reduction)", | 2155 | .description = "'Zcmt' (table jump instructions for code-size reduction)", |
| 2156 | .dependencies = featureSet(&[_]Feature{ | 2156 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2158,172 +2158,172 @@ pub const all_features = blk: { | ... | @@ -2158,172 +2158,172 @@ pub const all_features = blk: { |
| 2158 | .zicsr, | 2158 | .zicsr, |
| 2159 | }), | 2159 | }), |
| 2160 | }; | 2160 | }; |
| 2161 | result[@intFromEnum(Feature.zdinx)] = .{ | 2161 | result[@backingInt(Feature.zdinx)] = .{ |
| 2162 | .llvm_name = "zdinx", | 2162 | .llvm_name = "zdinx", |
| 2163 | .description = "'Zdinx' (Double in Integer)", | 2163 | .description = "'Zdinx' (Double in Integer)", |
| 2164 | .dependencies = featureSet(&[_]Feature{ | 2164 | .dependencies = featureSet(&[_]Feature{ |
| 2165 | .zfinx, | 2165 | .zfinx, |
| 2166 | }), | 2166 | }), |
| 2167 | }; | 2167 | }; |
| 2168 | result[@intFromEnum(Feature.zexth_fusion)] = .{ | 2168 | result[@backingInt(Feature.zexth_fusion)] = .{ |
| 2169 | .llvm_name = "zexth-fusion", | 2169 | .llvm_name = "zexth-fusion", |
| 2170 | .description = "Enable SLLI+SRLI to be fused to zero extension of halfword", | 2170 | .description = "Enable SLLI+SRLI to be fused to zero extension of halfword", |
| 2171 | .dependencies = featureSet(&[_]Feature{}), | 2171 | .dependencies = featureSet(&[_]Feature{}), |
| 2172 | }; | 2172 | }; |
| 2173 | result[@intFromEnum(Feature.zextw_fusion)] = .{ | 2173 | result[@backingInt(Feature.zextw_fusion)] = .{ |
| 2174 | .llvm_name = "zextw-fusion", | 2174 | .llvm_name = "zextw-fusion", |
| 2175 | .description = "Enable SLLI+SRLI to be fused to zero extension of word", | 2175 | .description = "Enable SLLI+SRLI to be fused to zero extension of word", |
| 2176 | .dependencies = featureSet(&[_]Feature{}), | 2176 | .dependencies = featureSet(&[_]Feature{}), |
| 2177 | }; | 2177 | }; |
| 2178 | result[@intFromEnum(Feature.zfa)] = .{ | 2178 | result[@backingInt(Feature.zfa)] = .{ |
| 2179 | .llvm_name = "zfa", | 2179 | .llvm_name = "zfa", |
| 2180 | .description = "'Zfa' (Additional Floating-Point)", | 2180 | .description = "'Zfa' (Additional Floating-Point)", |
| 2181 | .dependencies = featureSet(&[_]Feature{ | 2181 | .dependencies = featureSet(&[_]Feature{ |
| 2182 | .f, | 2182 | .f, |
| 2183 | }), | 2183 | }), |
| 2184 | }; | 2184 | }; |
| 2185 | result[@intFromEnum(Feature.zfbfmin)] = .{ | 2185 | result[@backingInt(Feature.zfbfmin)] = .{ |
| 2186 | .llvm_name = "zfbfmin", | 2186 | .llvm_name = "zfbfmin", |
| 2187 | .description = "'Zfbfmin' (Scalar BF16 Converts)", | 2187 | .description = "'Zfbfmin' (Scalar BF16 Converts)", |
| 2188 | .dependencies = featureSet(&[_]Feature{ | 2188 | .dependencies = featureSet(&[_]Feature{ |
| 2189 | .f, | 2189 | .f, |
| 2190 | }), | 2190 | }), |
| 2191 | }; | 2191 | }; |
| 2192 | result[@intFromEnum(Feature.zfh)] = .{ | 2192 | result[@backingInt(Feature.zfh)] = .{ |
| 2193 | .llvm_name = "zfh", | 2193 | .llvm_name = "zfh", |
| 2194 | .description = "'Zfh' (Half-Precision Floating-Point)", | 2194 | .description = "'Zfh' (Half-Precision Floating-Point)", |
| 2195 | .dependencies = featureSet(&[_]Feature{ | 2195 | .dependencies = featureSet(&[_]Feature{ |
| 2196 | .zfhmin, | 2196 | .zfhmin, |
| 2197 | }), | 2197 | }), |
| 2198 | }; | 2198 | }; |
| 2199 | result[@intFromEnum(Feature.zfhmin)] = .{ | 2199 | result[@backingInt(Feature.zfhmin)] = .{ |
| 2200 | .llvm_name = "zfhmin", | 2200 | .llvm_name = "zfhmin", |
| 2201 | .description = "'Zfhmin' (Half-Precision Floating-Point Minimal)", | 2201 | .description = "'Zfhmin' (Half-Precision Floating-Point Minimal)", |
| 2202 | .dependencies = featureSet(&[_]Feature{ | 2202 | .dependencies = featureSet(&[_]Feature{ |
| 2203 | .f, | 2203 | .f, |
| 2204 | }), | 2204 | }), |
| 2205 | }; | 2205 | }; |
| 2206 | result[@intFromEnum(Feature.zfinx)] = .{ | 2206 | result[@backingInt(Feature.zfinx)] = .{ |
| 2207 | .llvm_name = "zfinx", | 2207 | .llvm_name = "zfinx", |
| 2208 | .description = "'Zfinx' (Float in Integer)", | 2208 | .description = "'Zfinx' (Float in Integer)", |
| 2209 | .dependencies = featureSet(&[_]Feature{ | 2209 | .dependencies = featureSet(&[_]Feature{ |
| 2210 | .zicsr, | 2210 | .zicsr, |
| 2211 | }), | 2211 | }), |
| 2212 | }; | 2212 | }; |
| 2213 | result[@intFromEnum(Feature.zhinx)] = .{ | 2213 | result[@backingInt(Feature.zhinx)] = .{ |
| 2214 | .llvm_name = "zhinx", | 2214 | .llvm_name = "zhinx", |
| 2215 | .description = "'Zhinx' (Half Float in Integer)", | 2215 | .description = "'Zhinx' (Half Float in Integer)", |
| 2216 | .dependencies = featureSet(&[_]Feature{ | 2216 | .dependencies = featureSet(&[_]Feature{ |
| 2217 | .zhinxmin, | 2217 | .zhinxmin, |
| 2218 | }), | 2218 | }), |
| 2219 | }; | 2219 | }; |
| 2220 | result[@intFromEnum(Feature.zhinxmin)] = .{ | 2220 | result[@backingInt(Feature.zhinxmin)] = .{ |
| 2221 | .llvm_name = "zhinxmin", | 2221 | .llvm_name = "zhinxmin", |
| 2222 | .description = "'Zhinxmin' (Half Float in Integer Minimal)", | 2222 | .description = "'Zhinxmin' (Half Float in Integer Minimal)", |
| 2223 | .dependencies = featureSet(&[_]Feature{ | 2223 | .dependencies = featureSet(&[_]Feature{ |
| 2224 | .zfinx, | 2224 | .zfinx, |
| 2225 | }), | 2225 | }), |
| 2226 | }; | 2226 | }; |
| 2227 | result[@intFromEnum(Feature.zic64b)] = .{ | 2227 | result[@backingInt(Feature.zic64b)] = .{ |
| 2228 | .llvm_name = "zic64b", | 2228 | .llvm_name = "zic64b", |
| 2229 | .description = "'Zic64b' (Cache Block Size Is 64 Bytes)", | 2229 | .description = "'Zic64b' (Cache Block Size Is 64 Bytes)", |
| 2230 | .dependencies = featureSet(&[_]Feature{}), | 2230 | .dependencies = featureSet(&[_]Feature{}), |
| 2231 | }; | 2231 | }; |
| 2232 | result[@intFromEnum(Feature.zicbom)] = .{ | 2232 | result[@backingInt(Feature.zicbom)] = .{ |
| 2233 | .llvm_name = "zicbom", | 2233 | .llvm_name = "zicbom", |
| 2234 | .description = "'Zicbom' (Cache-Block Management Instructions)", | 2234 | .description = "'Zicbom' (Cache-Block Management Instructions)", |
| 2235 | .dependencies = featureSet(&[_]Feature{}), | 2235 | .dependencies = featureSet(&[_]Feature{}), |
| 2236 | }; | 2236 | }; |
| 2237 | result[@intFromEnum(Feature.zicbop)] = .{ | 2237 | result[@backingInt(Feature.zicbop)] = .{ |
| 2238 | .llvm_name = "zicbop", | 2238 | .llvm_name = "zicbop", |
| 2239 | .description = "'Zicbop' (Cache-Block Prefetch Instructions)", | 2239 | .description = "'Zicbop' (Cache-Block Prefetch Instructions)", |
| 2240 | .dependencies = featureSet(&[_]Feature{}), | 2240 | .dependencies = featureSet(&[_]Feature{}), |
| 2241 | }; | 2241 | }; |
| 2242 | result[@intFromEnum(Feature.zicboz)] = .{ | 2242 | result[@backingInt(Feature.zicboz)] = .{ |
| 2243 | .llvm_name = "zicboz", | 2243 | .llvm_name = "zicboz", |
| 2244 | .description = "'Zicboz' (Cache-Block Zero Instructions)", | 2244 | .description = "'Zicboz' (Cache-Block Zero Instructions)", |
| 2245 | .dependencies = featureSet(&[_]Feature{}), | 2245 | .dependencies = featureSet(&[_]Feature{}), |
| 2246 | }; | 2246 | }; |
| 2247 | result[@intFromEnum(Feature.ziccamoa)] = .{ | 2247 | result[@backingInt(Feature.ziccamoa)] = .{ |
| 2248 | .llvm_name = "ziccamoa", | 2248 | .llvm_name = "ziccamoa", |
| 2249 | .description = "'Ziccamoa' (Main Memory Supports All Atomics in A)", | 2249 | .description = "'Ziccamoa' (Main Memory Supports All Atomics in A)", |
| 2250 | .dependencies = featureSet(&[_]Feature{}), | 2250 | .dependencies = featureSet(&[_]Feature{}), |
| 2251 | }; | 2251 | }; |
| 2252 | result[@intFromEnum(Feature.ziccamoc)] = .{ | 2252 | result[@backingInt(Feature.ziccamoc)] = .{ |
| 2253 | .llvm_name = "ziccamoc", | 2253 | .llvm_name = "ziccamoc", |
| 2254 | .description = "'Ziccamoc' (Main Memory Supports Atomics in Zacas)", | 2254 | .description = "'Ziccamoc' (Main Memory Supports Atomics in Zacas)", |
| 2255 | .dependencies = featureSet(&[_]Feature{}), | 2255 | .dependencies = featureSet(&[_]Feature{}), |
| 2256 | }; | 2256 | }; |
| 2257 | result[@intFromEnum(Feature.ziccif)] = .{ | 2257 | result[@backingInt(Feature.ziccif)] = .{ |
| 2258 | .llvm_name = "ziccif", | 2258 | .llvm_name = "ziccif", |
| 2259 | .description = "'Ziccif' (Main Memory Supports Instruction Fetch with Atomicity Requirement)", | 2259 | .description = "'Ziccif' (Main Memory Supports Instruction Fetch with Atomicity Requirement)", |
| 2260 | .dependencies = featureSet(&[_]Feature{}), | 2260 | .dependencies = featureSet(&[_]Feature{}), |
| 2261 | }; | 2261 | }; |
| 2262 | result[@intFromEnum(Feature.zicclsm)] = .{ | 2262 | result[@backingInt(Feature.zicclsm)] = .{ |
| 2263 | .llvm_name = "zicclsm", | 2263 | .llvm_name = "zicclsm", |
| 2264 | .description = "'Zicclsm' (Main Memory Supports Misaligned Loads/Stores)", | 2264 | .description = "'Zicclsm' (Main Memory Supports Misaligned Loads/Stores)", |
| 2265 | .dependencies = featureSet(&[_]Feature{}), | 2265 | .dependencies = featureSet(&[_]Feature{}), |
| 2266 | }; | 2266 | }; |
| 2267 | result[@intFromEnum(Feature.ziccrse)] = .{ | 2267 | result[@backingInt(Feature.ziccrse)] = .{ |
| 2268 | .llvm_name = "ziccrse", | 2268 | .llvm_name = "ziccrse", |
| 2269 | .description = "'Ziccrse' (Main Memory Supports Forward Progress on LR/SC Sequences)", | 2269 | .description = "'Ziccrse' (Main Memory Supports Forward Progress on LR/SC Sequences)", |
| 2270 | .dependencies = featureSet(&[_]Feature{}), | 2270 | .dependencies = featureSet(&[_]Feature{}), |
| 2271 | }; | 2271 | }; |
| 2272 | result[@intFromEnum(Feature.zicntr)] = .{ | 2272 | result[@backingInt(Feature.zicntr)] = .{ |
| 2273 | .llvm_name = "zicntr", | 2273 | .llvm_name = "zicntr", |
| 2274 | .description = "'Zicntr' (Base Counters and Timers)", | 2274 | .description = "'Zicntr' (Base Counters and Timers)", |
| 2275 | .dependencies = featureSet(&[_]Feature{ | 2275 | .dependencies = featureSet(&[_]Feature{ |
| 2276 | .zicsr, | 2276 | .zicsr, |
| 2277 | }), | 2277 | }), |
| 2278 | }; | 2278 | }; |
| 2279 | result[@intFromEnum(Feature.zicond)] = .{ | 2279 | result[@backingInt(Feature.zicond)] = .{ |
| 2280 | .llvm_name = "zicond", | 2280 | .llvm_name = "zicond", |
| 2281 | .description = "'Zicond' (Integer Conditional Operations)", | 2281 | .description = "'Zicond' (Integer Conditional Operations)", |
| 2282 | .dependencies = featureSet(&[_]Feature{}), | 2282 | .dependencies = featureSet(&[_]Feature{}), |
| 2283 | }; | 2283 | }; |
| 2284 | result[@intFromEnum(Feature.zicsr)] = .{ | 2284 | result[@backingInt(Feature.zicsr)] = .{ |
| 2285 | .llvm_name = "zicsr", | 2285 | .llvm_name = "zicsr", |
| 2286 | .description = "'Zicsr' (CSRs)", | 2286 | .description = "'Zicsr' (CSRs)", |
| 2287 | .dependencies = featureSet(&[_]Feature{}), | 2287 | .dependencies = featureSet(&[_]Feature{}), |
| 2288 | }; | 2288 | }; |
| 2289 | result[@intFromEnum(Feature.zifencei)] = .{ | 2289 | result[@backingInt(Feature.zifencei)] = .{ |
| 2290 | .llvm_name = "zifencei", | 2290 | .llvm_name = "zifencei", |
| 2291 | .description = "'Zifencei' (fence.i)", | 2291 | .description = "'Zifencei' (fence.i)", |
| 2292 | .dependencies = featureSet(&[_]Feature{}), | 2292 | .dependencies = featureSet(&[_]Feature{}), |
| 2293 | }; | 2293 | }; |
| 2294 | result[@intFromEnum(Feature.zihintntl)] = .{ | 2294 | result[@backingInt(Feature.zihintntl)] = .{ |
| 2295 | .llvm_name = "zihintntl", | 2295 | .llvm_name = "zihintntl", |
| 2296 | .description = "'Zihintntl' (Non-Temporal Locality Hints)", | 2296 | .description = "'Zihintntl' (Non-Temporal Locality Hints)", |
| 2297 | .dependencies = featureSet(&[_]Feature{}), | 2297 | .dependencies = featureSet(&[_]Feature{}), |
| 2298 | }; | 2298 | }; |
| 2299 | result[@intFromEnum(Feature.zihintpause)] = .{ | 2299 | result[@backingInt(Feature.zihintpause)] = .{ |
| 2300 | .llvm_name = "zihintpause", | 2300 | .llvm_name = "zihintpause", |
| 2301 | .description = "'Zihintpause' (Pause Hint)", | 2301 | .description = "'Zihintpause' (Pause Hint)", |
| 2302 | .dependencies = featureSet(&[_]Feature{}), | 2302 | .dependencies = featureSet(&[_]Feature{}), |
| 2303 | }; | 2303 | }; |
| 2304 | result[@intFromEnum(Feature.zihpm)] = .{ | 2304 | result[@backingInt(Feature.zihpm)] = .{ |
| 2305 | .llvm_name = "zihpm", | 2305 | .llvm_name = "zihpm", |
| 2306 | .description = "'Zihpm' (Hardware Performance Counters)", | 2306 | .description = "'Zihpm' (Hardware Performance Counters)", |
| 2307 | .dependencies = featureSet(&[_]Feature{ | 2307 | .dependencies = featureSet(&[_]Feature{ |
| 2308 | .zicsr, | 2308 | .zicsr, |
| 2309 | }), | 2309 | }), |
| 2310 | }; | 2310 | }; |
| 2311 | result[@intFromEnum(Feature.zilsd)] = .{ | 2311 | result[@backingInt(Feature.zilsd)] = .{ |
| 2312 | .llvm_name = "zilsd", | 2312 | .llvm_name = "zilsd", |
| 2313 | .description = "'Zilsd' (Load/Store Pair Instructions)", | 2313 | .description = "'Zilsd' (Load/Store Pair Instructions)", |
| 2314 | .dependencies = featureSet(&[_]Feature{}), | 2314 | .dependencies = featureSet(&[_]Feature{}), |
| 2315 | }; | 2315 | }; |
| 2316 | result[@intFromEnum(Feature.zilsd_4byte_align)] = .{ | 2316 | result[@backingInt(Feature.zilsd_4byte_align)] = .{ |
| 2317 | .llvm_name = "zilsd-4byte-align", | 2317 | .llvm_name = "zilsd-4byte-align", |
| 2318 | .description = "Allow 4-byte alignment for Zilsd LD/SD instructions", | 2318 | .description = "Allow 4-byte alignment for Zilsd LD/SD instructions", |
| 2319 | .dependencies = featureSet(&[_]Feature{}), | 2319 | .dependencies = featureSet(&[_]Feature{}), |
| 2320 | }; | 2320 | }; |
| 2321 | result[@intFromEnum(Feature.zimop)] = .{ | 2321 | result[@backingInt(Feature.zimop)] = .{ |
| 2322 | .llvm_name = "zimop", | 2322 | .llvm_name = "zimop", |
| 2323 | .description = "'Zimop' (May-Be-Operations)", | 2323 | .description = "'Zimop' (May-Be-Operations)", |
| 2324 | .dependencies = featureSet(&[_]Feature{}), | 2324 | .dependencies = featureSet(&[_]Feature{}), |
| 2325 | }; | 2325 | }; |
| 2326 | result[@intFromEnum(Feature.zk)] = .{ | 2326 | result[@backingInt(Feature.zk)] = .{ |
| 2327 | .llvm_name = "zk", | 2327 | .llvm_name = "zk", |
| 2328 | .description = "'Zk' (Standard scalar cryptography extension)", | 2328 | .description = "'Zk' (Standard scalar cryptography extension)", |
| 2329 | .dependencies = featureSet(&[_]Feature{ | 2329 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2332,7 +2332,7 @@ pub const all_features = blk: { | ... | @@ -2332,7 +2332,7 @@ pub const all_features = blk: { |
| 2332 | .zkt, | 2332 | .zkt, |
| 2333 | }), | 2333 | }), |
| 2334 | }; | 2334 | }; |
| 2335 | result[@intFromEnum(Feature.zkn)] = .{ | 2335 | result[@backingInt(Feature.zkn)] = .{ |
| 2336 | .llvm_name = "zkn", | 2336 | .llvm_name = "zkn", |
| 2337 | .description = "'Zkn' (NIST Algorithm Suite)", | 2337 | .description = "'Zkn' (NIST Algorithm Suite)", |
| 2338 | .dependencies = featureSet(&[_]Feature{ | 2338 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2344,27 +2344,27 @@ pub const all_features = blk: { | ... | @@ -2344,27 +2344,27 @@ pub const all_features = blk: { |
| 2344 | .zknh, | 2344 | .zknh, |
| 2345 | }), | 2345 | }), |
| 2346 | }; | 2346 | }; |
| 2347 | result[@intFromEnum(Feature.zknd)] = .{ | 2347 | result[@backingInt(Feature.zknd)] = .{ |
| 2348 | .llvm_name = "zknd", | 2348 | .llvm_name = "zknd", |
| 2349 | .description = "'Zknd' (NIST Suite: AES Decryption)", | 2349 | .description = "'Zknd' (NIST Suite: AES Decryption)", |
| 2350 | .dependencies = featureSet(&[_]Feature{}), | 2350 | .dependencies = featureSet(&[_]Feature{}), |
| 2351 | }; | 2351 | }; |
| 2352 | result[@intFromEnum(Feature.zkne)] = .{ | 2352 | result[@backingInt(Feature.zkne)] = .{ |
| 2353 | .llvm_name = "zkne", | 2353 | .llvm_name = "zkne", |
| 2354 | .description = "'Zkne' (NIST Suite: AES Encryption)", | 2354 | .description = "'Zkne' (NIST Suite: AES Encryption)", |
| 2355 | .dependencies = featureSet(&[_]Feature{}), | 2355 | .dependencies = featureSet(&[_]Feature{}), |
| 2356 | }; | 2356 | }; |
| 2357 | result[@intFromEnum(Feature.zknh)] = .{ | 2357 | result[@backingInt(Feature.zknh)] = .{ |
| 2358 | .llvm_name = "zknh", | 2358 | .llvm_name = "zknh", |
| 2359 | .description = "'Zknh' (NIST Suite: Hash Function Instructions)", | 2359 | .description = "'Zknh' (NIST Suite: Hash Function Instructions)", |
| 2360 | .dependencies = featureSet(&[_]Feature{}), | 2360 | .dependencies = featureSet(&[_]Feature{}), |
| 2361 | }; | 2361 | }; |
| 2362 | result[@intFromEnum(Feature.zkr)] = .{ | 2362 | result[@backingInt(Feature.zkr)] = .{ |
| 2363 | .llvm_name = "zkr", | 2363 | .llvm_name = "zkr", |
| 2364 | .description = "'Zkr' (Entropy Source Extension)", | 2364 | .description = "'Zkr' (Entropy Source Extension)", |
| 2365 | .dependencies = featureSet(&[_]Feature{}), | 2365 | .dependencies = featureSet(&[_]Feature{}), |
| 2366 | }; | 2366 | }; |
| 2367 | result[@intFromEnum(Feature.zks)] = .{ | 2367 | result[@backingInt(Feature.zks)] = .{ |
| 2368 | .llvm_name = "zks", | 2368 | .llvm_name = "zks", |
| 2369 | .description = "'Zks' (ShangMi Algorithm Suite)", | 2369 | .description = "'Zks' (ShangMi Algorithm Suite)", |
| 2370 | .dependencies = featureSet(&[_]Feature{ | 2370 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2375,46 +2375,46 @@ pub const all_features = blk: { | ... | @@ -2375,46 +2375,46 @@ pub const all_features = blk: { |
| 2375 | .zksh, | 2375 | .zksh, |
| 2376 | }), | 2376 | }), |
| 2377 | }; | 2377 | }; |
| 2378 | result[@intFromEnum(Feature.zksed)] = .{ | 2378 | result[@backingInt(Feature.zksed)] = .{ |
| 2379 | .llvm_name = "zksed", | 2379 | .llvm_name = "zksed", |
| 2380 | .description = "'Zksed' (ShangMi Suite: SM4 Block Cipher Instructions)", | 2380 | .description = "'Zksed' (ShangMi Suite: SM4 Block Cipher Instructions)", |
| 2381 | .dependencies = featureSet(&[_]Feature{}), | 2381 | .dependencies = featureSet(&[_]Feature{}), |
| 2382 | }; | 2382 | }; |
| 2383 | result[@intFromEnum(Feature.zksh)] = .{ | 2383 | result[@backingInt(Feature.zksh)] = .{ |
| 2384 | .llvm_name = "zksh", | 2384 | .llvm_name = "zksh", |
| 2385 | .description = "'Zksh' (ShangMi Suite: SM3 Hash Function Instructions)", | 2385 | .description = "'Zksh' (ShangMi Suite: SM3 Hash Function Instructions)", |
| 2386 | .dependencies = featureSet(&[_]Feature{}), | 2386 | .dependencies = featureSet(&[_]Feature{}), |
| 2387 | }; | 2387 | }; |
| 2388 | result[@intFromEnum(Feature.zkt)] = .{ | 2388 | result[@backingInt(Feature.zkt)] = .{ |
| 2389 | .llvm_name = "zkt", | 2389 | .llvm_name = "zkt", |
| 2390 | .description = "'Zkt' (Data Independent Execution Latency)", | 2390 | .description = "'Zkt' (Data Independent Execution Latency)", |
| 2391 | .dependencies = featureSet(&[_]Feature{}), | 2391 | .dependencies = featureSet(&[_]Feature{}), |
| 2392 | }; | 2392 | }; |
| 2393 | result[@intFromEnum(Feature.zmmul)] = .{ | 2393 | result[@backingInt(Feature.zmmul)] = .{ |
| 2394 | .llvm_name = "zmmul", | 2394 | .llvm_name = "zmmul", |
| 2395 | .description = "'Zmmul' (Integer Multiplication)", | 2395 | .description = "'Zmmul' (Integer Multiplication)", |
| 2396 | .dependencies = featureSet(&[_]Feature{}), | 2396 | .dependencies = featureSet(&[_]Feature{}), |
| 2397 | }; | 2397 | }; |
| 2398 | result[@intFromEnum(Feature.ztso)] = .{ | 2398 | result[@backingInt(Feature.ztso)] = .{ |
| 2399 | .llvm_name = "ztso", | 2399 | .llvm_name = "ztso", |
| 2400 | .description = "'Ztso' (Memory Model - Total Store Order)", | 2400 | .description = "'Ztso' (Memory Model - Total Store Order)", |
| 2401 | .dependencies = featureSet(&[_]Feature{}), | 2401 | .dependencies = featureSet(&[_]Feature{}), |
| 2402 | }; | 2402 | }; |
| 2403 | result[@intFromEnum(Feature.zvbb)] = .{ | 2403 | result[@backingInt(Feature.zvbb)] = .{ |
| 2404 | .llvm_name = "zvbb", | 2404 | .llvm_name = "zvbb", |
| 2405 | .description = "'Zvbb' (Vector basic bit-manipulation instructions)", | 2405 | .description = "'Zvbb' (Vector basic bit-manipulation instructions)", |
| 2406 | .dependencies = featureSet(&[_]Feature{ | 2406 | .dependencies = featureSet(&[_]Feature{ |
| 2407 | .zvkb, | 2407 | .zvkb, |
| 2408 | }), | 2408 | }), |
| 2409 | }; | 2409 | }; |
| 2410 | result[@intFromEnum(Feature.zvbc)] = .{ | 2410 | result[@backingInt(Feature.zvbc)] = .{ |
| 2411 | .llvm_name = "zvbc", | 2411 | .llvm_name = "zvbc", |
| 2412 | .description = "'Zvbc' (Vector Carryless Multiplication)", | 2412 | .description = "'Zvbc' (Vector Carryless Multiplication)", |
| 2413 | .dependencies = featureSet(&[_]Feature{ | 2413 | .dependencies = featureSet(&[_]Feature{ |
| 2414 | .zve64x, | 2414 | .zve64x, |
| 2415 | }), | 2415 | }), |
| 2416 | }; | 2416 | }; |
| 2417 | result[@intFromEnum(Feature.zve32f)] = .{ | 2417 | result[@backingInt(Feature.zve32f)] = .{ |
| 2418 | .llvm_name = "zve32f", | 2418 | .llvm_name = "zve32f", |
| 2419 | .description = "'Zve32f' (Vector Extensions for Embedded Processors with maximal 32 EEW and F extension)", | 2419 | .description = "'Zve32f' (Vector Extensions for Embedded Processors with maximal 32 EEW and F extension)", |
| 2420 | .dependencies = featureSet(&[_]Feature{ | 2420 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2422,7 +2422,7 @@ pub const all_features = blk: { | ... | @@ -2422,7 +2422,7 @@ pub const all_features = blk: { |
| 2422 | .zve32x, | 2422 | .zve32x, |
| 2423 | }), | 2423 | }), |
| 2424 | }; | 2424 | }; |
| 2425 | result[@intFromEnum(Feature.zve32x)] = .{ | 2425 | result[@backingInt(Feature.zve32x)] = .{ |
| 2426 | .llvm_name = "zve32x", | 2426 | .llvm_name = "zve32x", |
| 2427 | .description = "'Zve32x' (Vector Extensions for Embedded Processors with maximal 32 EEW)", | 2427 | .description = "'Zve32x' (Vector Extensions for Embedded Processors with maximal 32 EEW)", |
| 2428 | .dependencies = featureSet(&[_]Feature{ | 2428 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2430,7 +2430,7 @@ pub const all_features = blk: { | ... | @@ -2430,7 +2430,7 @@ pub const all_features = blk: { |
| 2430 | .zvl32b, | 2430 | .zvl32b, |
| 2431 | }), | 2431 | }), |
| 2432 | }; | 2432 | }; |
| 2433 | result[@intFromEnum(Feature.zve64d)] = .{ | 2433 | result[@backingInt(Feature.zve64d)] = .{ |
| 2434 | .llvm_name = "zve64d", | 2434 | .llvm_name = "zve64d", |
| 2435 | .description = "'Zve64d' (Vector Extensions for Embedded Processors with maximal 64 EEW, F and D extension)", | 2435 | .description = "'Zve64d' (Vector Extensions for Embedded Processors with maximal 64 EEW, F and D extension)", |
| 2436 | .dependencies = featureSet(&[_]Feature{ | 2436 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2438,7 +2438,7 @@ pub const all_features = blk: { | ... | @@ -2438,7 +2438,7 @@ pub const all_features = blk: { |
| 2438 | .zve64f, | 2438 | .zve64f, |
| 2439 | }), | 2439 | }), |
| 2440 | }; | 2440 | }; |
| 2441 | result[@intFromEnum(Feature.zve64f)] = .{ | 2441 | result[@backingInt(Feature.zve64f)] = .{ |
| 2442 | .llvm_name = "zve64f", | 2442 | .llvm_name = "zve64f", |
| 2443 | .description = "'Zve64f' (Vector Extensions for Embedded Processors with maximal 64 EEW and F extension)", | 2443 | .description = "'Zve64f' (Vector Extensions for Embedded Processors with maximal 64 EEW and F extension)", |
| 2444 | .dependencies = featureSet(&[_]Feature{ | 2444 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2446,7 +2446,7 @@ pub const all_features = blk: { | ... | @@ -2446,7 +2446,7 @@ pub const all_features = blk: { |
| 2446 | .zve64x, | 2446 | .zve64x, |
| 2447 | }), | 2447 | }), |
| 2448 | }; | 2448 | }; |
| 2449 | result[@intFromEnum(Feature.zve64x)] = .{ | 2449 | result[@backingInt(Feature.zve64x)] = .{ |
| 2450 | .llvm_name = "zve64x", | 2450 | .llvm_name = "zve64x", |
| 2451 | .description = "'Zve64x' (Vector Extensions for Embedded Processors with maximal 64 EEW)", | 2451 | .description = "'Zve64x' (Vector Extensions for Embedded Processors with maximal 64 EEW)", |
| 2452 | .dependencies = featureSet(&[_]Feature{ | 2452 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2454,14 +2454,14 @@ pub const all_features = blk: { | ... | @@ -2454,14 +2454,14 @@ pub const all_features = blk: { |
| 2454 | .zvl64b, | 2454 | .zvl64b, |
| 2455 | }), | 2455 | }), |
| 2456 | }; | 2456 | }; |
| 2457 | result[@intFromEnum(Feature.zvfbfmin)] = .{ | 2457 | result[@backingInt(Feature.zvfbfmin)] = .{ |
| 2458 | .llvm_name = "zvfbfmin", | 2458 | .llvm_name = "zvfbfmin", |
| 2459 | .description = "'Zvfbfmin' (Vector BF16 Converts)", | 2459 | .description = "'Zvfbfmin' (Vector BF16 Converts)", |
| 2460 | .dependencies = featureSet(&[_]Feature{ | 2460 | .dependencies = featureSet(&[_]Feature{ |
| 2461 | .zve32f, | 2461 | .zve32f, |
| 2462 | }), | 2462 | }), |
| 2463 | }; | 2463 | }; |
| 2464 | result[@intFromEnum(Feature.zvfbfwma)] = .{ | 2464 | result[@backingInt(Feature.zvfbfwma)] = .{ |
| 2465 | .llvm_name = "zvfbfwma", | 2465 | .llvm_name = "zvfbfwma", |
| 2466 | .description = "'Zvfbfwma' (Vector BF16 widening mul-add)", | 2466 | .description = "'Zvfbfwma' (Vector BF16 widening mul-add)", |
| 2467 | .dependencies = featureSet(&[_]Feature{ | 2467 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2469,7 +2469,7 @@ pub const all_features = blk: { | ... | @@ -2469,7 +2469,7 @@ pub const all_features = blk: { |
| 2469 | .zvfbfmin, | 2469 | .zvfbfmin, |
| 2470 | }), | 2470 | }), |
| 2471 | }; | 2471 | }; |
| 2472 | result[@intFromEnum(Feature.zvfh)] = .{ | 2472 | result[@backingInt(Feature.zvfh)] = .{ |
| 2473 | .llvm_name = "zvfh", | 2473 | .llvm_name = "zvfh", |
| 2474 | .description = "'Zvfh' (Vector Half-Precision Floating-Point)", | 2474 | .description = "'Zvfh' (Vector Half-Precision Floating-Point)", |
| 2475 | .dependencies = featureSet(&[_]Feature{ | 2475 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2477,28 +2477,28 @@ pub const all_features = blk: { | ... | @@ -2477,28 +2477,28 @@ pub const all_features = blk: { |
| 2477 | .zvfhmin, | 2477 | .zvfhmin, |
| 2478 | }), | 2478 | }), |
| 2479 | }; | 2479 | }; |
| 2480 | result[@intFromEnum(Feature.zvfhmin)] = .{ | 2480 | result[@backingInt(Feature.zvfhmin)] = .{ |
| 2481 | .llvm_name = "zvfhmin", | 2481 | .llvm_name = "zvfhmin", |
| 2482 | .description = "'Zvfhmin' (Vector Half-Precision Floating-Point Minimal)", | 2482 | .description = "'Zvfhmin' (Vector Half-Precision Floating-Point Minimal)", |
| 2483 | .dependencies = featureSet(&[_]Feature{ | 2483 | .dependencies = featureSet(&[_]Feature{ |
| 2484 | .zve32f, | 2484 | .zve32f, |
| 2485 | }), | 2485 | }), |
| 2486 | }; | 2486 | }; |
| 2487 | result[@intFromEnum(Feature.zvkb)] = .{ | 2487 | result[@backingInt(Feature.zvkb)] = .{ |
| 2488 | .llvm_name = "zvkb", | 2488 | .llvm_name = "zvkb", |
| 2489 | .description = "'Zvkb' (Vector Bit-manipulation used in Cryptography)", | 2489 | .description = "'Zvkb' (Vector Bit-manipulation used in Cryptography)", |
| 2490 | .dependencies = featureSet(&[_]Feature{ | 2490 | .dependencies = featureSet(&[_]Feature{ |
| 2491 | .zve32x, | 2491 | .zve32x, |
| 2492 | }), | 2492 | }), |
| 2493 | }; | 2493 | }; |
| 2494 | result[@intFromEnum(Feature.zvkg)] = .{ | 2494 | result[@backingInt(Feature.zvkg)] = .{ |
| 2495 | .llvm_name = "zvkg", | 2495 | .llvm_name = "zvkg", |
| 2496 | .description = "'Zvkg' (Vector GCM instructions for Cryptography)", | 2496 | .description = "'Zvkg' (Vector GCM instructions for Cryptography)", |
| 2497 | .dependencies = featureSet(&[_]Feature{ | 2497 | .dependencies = featureSet(&[_]Feature{ |
| 2498 | .zve32x, | 2498 | .zve32x, |
| 2499 | }), | 2499 | }), |
| 2500 | }; | 2500 | }; |
| 2501 | result[@intFromEnum(Feature.zvkn)] = .{ | 2501 | result[@backingInt(Feature.zvkn)] = .{ |
| 2502 | .llvm_name = "zvkn", | 2502 | .llvm_name = "zvkn", |
| 2503 | .description = "'Zvkn' (shorthand for 'Zvkned', 'Zvknhb', 'Zvkb', and 'Zvkt')", | 2503 | .description = "'Zvkn' (shorthand for 'Zvkned', 'Zvknhb', 'Zvkb', and 'Zvkt')", |
| 2504 | .dependencies = featureSet(&[_]Feature{ | 2504 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2508,7 +2508,7 @@ pub const all_features = blk: { | ... | @@ -2508,7 +2508,7 @@ pub const all_features = blk: { |
| 2508 | .zvkt, | 2508 | .zvkt, |
| 2509 | }), | 2509 | }), |
| 2510 | }; | 2510 | }; |
| 2511 | result[@intFromEnum(Feature.zvknc)] = .{ | 2511 | result[@backingInt(Feature.zvknc)] = .{ |
| 2512 | .llvm_name = "zvknc", | 2512 | .llvm_name = "zvknc", |
| 2513 | .description = "'Zvknc' (shorthand for 'Zvknc' and 'Zvbc')", | 2513 | .description = "'Zvknc' (shorthand for 'Zvknc' and 'Zvbc')", |
| 2514 | .dependencies = featureSet(&[_]Feature{ | 2514 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2516,14 +2516,14 @@ pub const all_features = blk: { | ... | @@ -2516,14 +2516,14 @@ pub const all_features = blk: { |
| 2516 | .zvkn, | 2516 | .zvkn, |
| 2517 | }), | 2517 | }), |
| 2518 | }; | 2518 | }; |
| 2519 | result[@intFromEnum(Feature.zvkned)] = .{ | 2519 | result[@backingInt(Feature.zvkned)] = .{ |
| 2520 | .llvm_name = "zvkned", | 2520 | .llvm_name = "zvkned", |
| 2521 | .description = "'Zvkned' (Vector AES Encryption & Decryption (Single Round))", | 2521 | .description = "'Zvkned' (Vector AES Encryption & Decryption (Single Round))", |
| 2522 | .dependencies = featureSet(&[_]Feature{ | 2522 | .dependencies = featureSet(&[_]Feature{ |
| 2523 | .zve32x, | 2523 | .zve32x, |
| 2524 | }), | 2524 | }), |
| 2525 | }; | 2525 | }; |
| 2526 | result[@intFromEnum(Feature.zvkng)] = .{ | 2526 | result[@backingInt(Feature.zvkng)] = .{ |
| 2527 | .llvm_name = "zvkng", | 2527 | .llvm_name = "zvkng", |
| 2528 | .description = "'Zvkng' (shorthand for 'Zvkn' and 'Zvkg')", | 2528 | .description = "'Zvkng' (shorthand for 'Zvkn' and 'Zvkg')", |
| 2529 | .dependencies = featureSet(&[_]Feature{ | 2529 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2531,21 +2531,21 @@ pub const all_features = blk: { | ... | @@ -2531,21 +2531,21 @@ pub const all_features = blk: { |
| 2531 | .zvkn, | 2531 | .zvkn, |
| 2532 | }), | 2532 | }), |
| 2533 | }; | 2533 | }; |
| 2534 | result[@intFromEnum(Feature.zvknha)] = .{ | 2534 | result[@backingInt(Feature.zvknha)] = .{ |
| 2535 | .llvm_name = "zvknha", | 2535 | .llvm_name = "zvknha", |
| 2536 | .description = "'Zvknha' (Vector SHA-2 (SHA-256 only))", | 2536 | .description = "'Zvknha' (Vector SHA-2 (SHA-256 only))", |
| 2537 | .dependencies = featureSet(&[_]Feature{ | 2537 | .dependencies = featureSet(&[_]Feature{ |
| 2538 | .zve32x, | 2538 | .zve32x, |
| 2539 | }), | 2539 | }), |
| 2540 | }; | 2540 | }; |
| 2541 | result[@intFromEnum(Feature.zvknhb)] = .{ | 2541 | result[@backingInt(Feature.zvknhb)] = .{ |
| 2542 | .llvm_name = "zvknhb", | 2542 | .llvm_name = "zvknhb", |
| 2543 | .description = "'Zvknhb' (Vector SHA-2 (SHA-256 and SHA-512))", | 2543 | .description = "'Zvknhb' (Vector SHA-2 (SHA-256 and SHA-512))", |
| 2544 | .dependencies = featureSet(&[_]Feature{ | 2544 | .dependencies = featureSet(&[_]Feature{ |
| 2545 | .zve64x, | 2545 | .zve64x, |
| 2546 | }), | 2546 | }), |
| 2547 | }; | 2547 | }; |
| 2548 | result[@intFromEnum(Feature.zvks)] = .{ | 2548 | result[@backingInt(Feature.zvks)] = .{ |
| 2549 | .llvm_name = "zvks", | 2549 | .llvm_name = "zvks", |
| 2550 | .description = "'Zvks' (shorthand for 'Zvksed', 'Zvksh', 'Zvkb', and 'Zvkt')", | 2550 | .description = "'Zvks' (shorthand for 'Zvksed', 'Zvksh', 'Zvkb', and 'Zvkt')", |
| 2551 | .dependencies = featureSet(&[_]Feature{ | 2551 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2555,7 +2555,7 @@ pub const all_features = blk: { | ... | @@ -2555,7 +2555,7 @@ pub const all_features = blk: { |
| 2555 | .zvkt, | 2555 | .zvkt, |
| 2556 | }), | 2556 | }), |
| 2557 | }; | 2557 | }; |
| 2558 | result[@intFromEnum(Feature.zvksc)] = .{ | 2558 | result[@backingInt(Feature.zvksc)] = .{ |
| 2559 | .llvm_name = "zvksc", | 2559 | .llvm_name = "zvksc", |
| 2560 | .description = "'Zvksc' (shorthand for 'Zvks' and 'Zvbc')", | 2560 | .description = "'Zvksc' (shorthand for 'Zvks' and 'Zvbc')", |
| 2561 | .dependencies = featureSet(&[_]Feature{ | 2561 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2563,14 +2563,14 @@ pub const all_features = blk: { | ... | @@ -2563,14 +2563,14 @@ pub const all_features = blk: { |
| 2563 | .zvks, | 2563 | .zvks, |
| 2564 | }), | 2564 | }), |
| 2565 | }; | 2565 | }; |
| 2566 | result[@intFromEnum(Feature.zvksed)] = .{ | 2566 | result[@backingInt(Feature.zvksed)] = .{ |
| 2567 | .llvm_name = "zvksed", | 2567 | .llvm_name = "zvksed", |
| 2568 | .description = "'Zvksed' (SM4 Block Cipher Instructions)", | 2568 | .description = "'Zvksed' (SM4 Block Cipher Instructions)", |
| 2569 | .dependencies = featureSet(&[_]Feature{ | 2569 | .dependencies = featureSet(&[_]Feature{ |
| 2570 | .zve32x, | 2570 | .zve32x, |
| 2571 | }), | 2571 | }), |
| 2572 | }; | 2572 | }; |
| 2573 | result[@intFromEnum(Feature.zvksg)] = .{ | 2573 | result[@backingInt(Feature.zvksg)] = .{ |
| 2574 | .llvm_name = "zvksg", | 2574 | .llvm_name = "zvksg", |
| 2575 | .description = "'Zvksg' (shorthand for 'Zvks' and 'Zvkg')", | 2575 | .description = "'Zvksg' (shorthand for 'Zvks' and 'Zvkg')", |
| 2576 | .dependencies = featureSet(&[_]Feature{ | 2576 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -2578,94 +2578,94 @@ pub const all_features = blk: { | ... | @@ -2578,94 +2578,94 @@ pub const all_features = blk: { |
| 2578 | .zvks, | 2578 | .zvks, |
| 2579 | }), | 2579 | }), |
| 2580 | }; | 2580 | }; |
| 2581 | result[@intFromEnum(Feature.zvksh)] = .{ | 2581 | result[@backingInt(Feature.zvksh)] = .{ |
| 2582 | .llvm_name = "zvksh", | 2582 | .llvm_name = "zvksh", |
| 2583 | .description = "'Zvksh' (SM3 Hash Function Instructions)", | 2583 | .description = "'Zvksh' (SM3 Hash Function Instructions)", |
| 2584 | .dependencies = featureSet(&[_]Feature{ | 2584 | .dependencies = featureSet(&[_]Feature{ |
| 2585 | .zve32x, | 2585 | .zve32x, |
| 2586 | }), | 2586 | }), |
| 2587 | }; | 2587 | }; |
| 2588 | result[@intFromEnum(Feature.zvkt)] = .{ | 2588 | result[@backingInt(Feature.zvkt)] = .{ |
| 2589 | .llvm_name = "zvkt", | 2589 | .llvm_name = "zvkt", |
| 2590 | .description = "'Zvkt' (Vector Data-Independent Execution Latency)", | 2590 | .description = "'Zvkt' (Vector Data-Independent Execution Latency)", |
| 2591 | .dependencies = featureSet(&[_]Feature{}), | 2591 | .dependencies = featureSet(&[_]Feature{}), |
| 2592 | }; | 2592 | }; |
| 2593 | result[@intFromEnum(Feature.zvl1024b)] = .{ | 2593 | result[@backingInt(Feature.zvl1024b)] = .{ |
| 2594 | .llvm_name = "zvl1024b", | 2594 | .llvm_name = "zvl1024b", |
| 2595 | .description = "'Zvl1024b' (Minimum Vector Length 1024)", | 2595 | .description = "'Zvl1024b' (Minimum Vector Length 1024)", |
| 2596 | .dependencies = featureSet(&[_]Feature{ | 2596 | .dependencies = featureSet(&[_]Feature{ |
| 2597 | .zvl512b, | 2597 | .zvl512b, |
| 2598 | }), | 2598 | }), |
| 2599 | }; | 2599 | }; |
| 2600 | result[@intFromEnum(Feature.zvl128b)] = .{ | 2600 | result[@backingInt(Feature.zvl128b)] = .{ |
| 2601 | .llvm_name = "zvl128b", | 2601 | .llvm_name = "zvl128b", |
| 2602 | .description = "'Zvl128b' (Minimum Vector Length 128)", | 2602 | .description = "'Zvl128b' (Minimum Vector Length 128)", |
| 2603 | .dependencies = featureSet(&[_]Feature{ | 2603 | .dependencies = featureSet(&[_]Feature{ |
| 2604 | .zvl64b, | 2604 | .zvl64b, |
| 2605 | }), | 2605 | }), |
| 2606 | }; | 2606 | }; |
| 2607 | result[@intFromEnum(Feature.zvl16384b)] = .{ | 2607 | result[@backingInt(Feature.zvl16384b)] = .{ |
| 2608 | .llvm_name = "zvl16384b", | 2608 | .llvm_name = "zvl16384b", |
| 2609 | .description = "'Zvl16384b' (Minimum Vector Length 16384)", | 2609 | .description = "'Zvl16384b' (Minimum Vector Length 16384)", |
| 2610 | .dependencies = featureSet(&[_]Feature{ | 2610 | .dependencies = featureSet(&[_]Feature{ |
| 2611 | .zvl8192b, | 2611 | .zvl8192b, |
| 2612 | }), | 2612 | }), |
| 2613 | }; | 2613 | }; |
| 2614 | result[@intFromEnum(Feature.zvl2048b)] = .{ | 2614 | result[@backingInt(Feature.zvl2048b)] = .{ |
| 2615 | .llvm_name = "zvl2048b", | 2615 | .llvm_name = "zvl2048b", |
| 2616 | .description = "'Zvl2048b' (Minimum Vector Length 2048)", | 2616 | .description = "'Zvl2048b' (Minimum Vector Length 2048)", |
| 2617 | .dependencies = featureSet(&[_]Feature{ | 2617 | .dependencies = featureSet(&[_]Feature{ |
| 2618 | .zvl1024b, | 2618 | .zvl1024b, |
| 2619 | }), | 2619 | }), |
| 2620 | }; | 2620 | }; |
| 2621 | result[@intFromEnum(Feature.zvl256b)] = .{ | 2621 | result[@backingInt(Feature.zvl256b)] = .{ |
| 2622 | .llvm_name = "zvl256b", | 2622 | .llvm_name = "zvl256b", |
| 2623 | .description = "'Zvl256b' (Minimum Vector Length 256)", | 2623 | .description = "'Zvl256b' (Minimum Vector Length 256)", |
| 2624 | .dependencies = featureSet(&[_]Feature{ | 2624 | .dependencies = featureSet(&[_]Feature{ |
| 2625 | .zvl128b, | 2625 | .zvl128b, |
| 2626 | }), | 2626 | }), |
| 2627 | }; | 2627 | }; |
| 2628 | result[@intFromEnum(Feature.zvl32768b)] = .{ | 2628 | result[@backingInt(Feature.zvl32768b)] = .{ |
| 2629 | .llvm_name = "zvl32768b", | 2629 | .llvm_name = "zvl32768b", |
| 2630 | .description = "'Zvl32768b' (Minimum Vector Length 32768)", | 2630 | .description = "'Zvl32768b' (Minimum Vector Length 32768)", |
| 2631 | .dependencies = featureSet(&[_]Feature{ | 2631 | .dependencies = featureSet(&[_]Feature{ |
| 2632 | .zvl16384b, | 2632 | .zvl16384b, |
| 2633 | }), | 2633 | }), |
| 2634 | }; | 2634 | }; |
| 2635 | result[@intFromEnum(Feature.zvl32b)] = .{ | 2635 | result[@backingInt(Feature.zvl32b)] = .{ |
| 2636 | .llvm_name = "zvl32b", | 2636 | .llvm_name = "zvl32b", |
| 2637 | .description = "'Zvl32b' (Minimum Vector Length 32)", | 2637 | .description = "'Zvl32b' (Minimum Vector Length 32)", |
| 2638 | .dependencies = featureSet(&[_]Feature{}), | 2638 | .dependencies = featureSet(&[_]Feature{}), |
| 2639 | }; | 2639 | }; |
| 2640 | result[@intFromEnum(Feature.zvl4096b)] = .{ | 2640 | result[@backingInt(Feature.zvl4096b)] = .{ |
| 2641 | .llvm_name = "zvl4096b", | 2641 | .llvm_name = "zvl4096b", |
| 2642 | .description = "'Zvl4096b' (Minimum Vector Length 4096)", | 2642 | .description = "'Zvl4096b' (Minimum Vector Length 4096)", |
| 2643 | .dependencies = featureSet(&[_]Feature{ | 2643 | .dependencies = featureSet(&[_]Feature{ |
| 2644 | .zvl2048b, | 2644 | .zvl2048b, |
| 2645 | }), | 2645 | }), |
| 2646 | }; | 2646 | }; |
| 2647 | result[@intFromEnum(Feature.zvl512b)] = .{ | 2647 | result[@backingInt(Feature.zvl512b)] = .{ |
| 2648 | .llvm_name = "zvl512b", | 2648 | .llvm_name = "zvl512b", |
| 2649 | .description = "'Zvl512b' (Minimum Vector Length 512)", | 2649 | .description = "'Zvl512b' (Minimum Vector Length 512)", |
| 2650 | .dependencies = featureSet(&[_]Feature{ | 2650 | .dependencies = featureSet(&[_]Feature{ |
| 2651 | .zvl256b, | 2651 | .zvl256b, |
| 2652 | }), | 2652 | }), |
| 2653 | }; | 2653 | }; |
| 2654 | result[@intFromEnum(Feature.zvl64b)] = .{ | 2654 | result[@backingInt(Feature.zvl64b)] = .{ |
| 2655 | .llvm_name = "zvl64b", | 2655 | .llvm_name = "zvl64b", |
| 2656 | .description = "'Zvl64b' (Minimum Vector Length 64)", | 2656 | .description = "'Zvl64b' (Minimum Vector Length 64)", |
| 2657 | .dependencies = featureSet(&[_]Feature{ | 2657 | .dependencies = featureSet(&[_]Feature{ |
| 2658 | .zvl32b, | 2658 | .zvl32b, |
| 2659 | }), | 2659 | }), |
| 2660 | }; | 2660 | }; |
| 2661 | result[@intFromEnum(Feature.zvl65536b)] = .{ | 2661 | result[@backingInt(Feature.zvl65536b)] = .{ |
| 2662 | .llvm_name = "zvl65536b", | 2662 | .llvm_name = "zvl65536b", |
| 2663 | .description = "'Zvl65536b' (Minimum Vector Length 65536)", | 2663 | .description = "'Zvl65536b' (Minimum Vector Length 65536)", |
| 2664 | .dependencies = featureSet(&[_]Feature{ | 2664 | .dependencies = featureSet(&[_]Feature{ |
| 2665 | .zvl32768b, | 2665 | .zvl32768b, |
| 2666 | }), | 2666 | }), |
| 2667 | }; | 2667 | }; |
| 2668 | result[@intFromEnum(Feature.zvl8192b)] = .{ | 2668 | result[@backingInt(Feature.zvl8192b)] = .{ |
| 2669 | .llvm_name = "zvl8192b", | 2669 | .llvm_name = "zvl8192b", |
| 2670 | .description = "'Zvl8192b' (Minimum Vector Length 8192)", | 2670 | .description = "'Zvl8192b' (Minimum Vector Length 8192)", |
| 2671 | .dependencies = featureSet(&[_]Feature{ | 2671 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/s390x.zig+49-49| ... | @@ -65,247 +65,247 @@ pub const all_features = blk: { | ... | @@ -65,247 +65,247 @@ pub const all_features = blk: { |
| 65 | const len = @typeInfo(Feature).@"enum".field_names.len; | 65 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 66 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 66 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 67 | var result: [len]CpuFeature = undefined; | 67 | var result: [len]CpuFeature = undefined; |
| 68 | result[@intFromEnum(Feature.backchain)] = .{ | 68 | result[@backingInt(Feature.backchain)] = .{ |
| 69 | .llvm_name = "backchain", | 69 | .llvm_name = "backchain", |
| 70 | .description = "Store the address of the caller's frame into the callee's stack frame", | 70 | .description = "Store the address of the caller's frame into the callee's stack frame", |
| 71 | .dependencies = featureSet(&[_]Feature{}), | 71 | .dependencies = featureSet(&[_]Feature{}), |
| 72 | }; | 72 | }; |
| 73 | result[@intFromEnum(Feature.bear_enhancement)] = .{ | 73 | result[@backingInt(Feature.bear_enhancement)] = .{ |
| 74 | .llvm_name = "bear-enhancement", | 74 | .llvm_name = "bear-enhancement", |
| 75 | .description = "Assume that the BEAR-enhancement facility is installed", | 75 | .description = "Assume that the BEAR-enhancement facility is installed", |
| 76 | .dependencies = featureSet(&[_]Feature{}), | 76 | .dependencies = featureSet(&[_]Feature{}), |
| 77 | }; | 77 | }; |
| 78 | result[@intFromEnum(Feature.concurrent_functions)] = .{ | 78 | result[@backingInt(Feature.concurrent_functions)] = .{ |
| 79 | .llvm_name = "concurrent-functions", | 79 | .llvm_name = "concurrent-functions", |
| 80 | .description = "Assume that the concurrent-functions facility is installed", | 80 | .description = "Assume that the concurrent-functions facility is installed", |
| 81 | .dependencies = featureSet(&[_]Feature{}), | 81 | .dependencies = featureSet(&[_]Feature{}), |
| 82 | }; | 82 | }; |
| 83 | result[@intFromEnum(Feature.deflate_conversion)] = .{ | 83 | result[@backingInt(Feature.deflate_conversion)] = .{ |
| 84 | .llvm_name = "deflate-conversion", | 84 | .llvm_name = "deflate-conversion", |
| 85 | .description = "Assume that the deflate-conversion facility is installed", | 85 | .description = "Assume that the deflate-conversion facility is installed", |
| 86 | .dependencies = featureSet(&[_]Feature{}), | 86 | .dependencies = featureSet(&[_]Feature{}), |
| 87 | }; | 87 | }; |
| 88 | result[@intFromEnum(Feature.dfp_packed_conversion)] = .{ | 88 | result[@backingInt(Feature.dfp_packed_conversion)] = .{ |
| 89 | .llvm_name = "dfp-packed-conversion", | 89 | .llvm_name = "dfp-packed-conversion", |
| 90 | .description = "Assume that the DFP packed-conversion facility is installed", | 90 | .description = "Assume that the DFP packed-conversion facility is installed", |
| 91 | .dependencies = featureSet(&[_]Feature{}), | 91 | .dependencies = featureSet(&[_]Feature{}), |
| 92 | }; | 92 | }; |
| 93 | result[@intFromEnum(Feature.dfp_zoned_conversion)] = .{ | 93 | result[@backingInt(Feature.dfp_zoned_conversion)] = .{ |
| 94 | .llvm_name = "dfp-zoned-conversion", | 94 | .llvm_name = "dfp-zoned-conversion", |
| 95 | .description = "Assume that the DFP zoned-conversion facility is installed", | 95 | .description = "Assume that the DFP zoned-conversion facility is installed", |
| 96 | .dependencies = featureSet(&[_]Feature{}), | 96 | .dependencies = featureSet(&[_]Feature{}), |
| 97 | }; | 97 | }; |
| 98 | result[@intFromEnum(Feature.distinct_ops)] = .{ | 98 | result[@backingInt(Feature.distinct_ops)] = .{ |
| 99 | .llvm_name = "distinct-ops", | 99 | .llvm_name = "distinct-ops", |
| 100 | .description = "Assume that the distinct-operands facility is installed", | 100 | .description = "Assume that the distinct-operands facility is installed", |
| 101 | .dependencies = featureSet(&[_]Feature{}), | 101 | .dependencies = featureSet(&[_]Feature{}), |
| 102 | }; | 102 | }; |
| 103 | result[@intFromEnum(Feature.enhanced_dat_2)] = .{ | 103 | result[@backingInt(Feature.enhanced_dat_2)] = .{ |
| 104 | .llvm_name = "enhanced-dat-2", | 104 | .llvm_name = "enhanced-dat-2", |
| 105 | .description = "Assume that the enhanced-DAT facility 2 is installed", | 105 | .description = "Assume that the enhanced-DAT facility 2 is installed", |
| 106 | .dependencies = featureSet(&[_]Feature{}), | 106 | .dependencies = featureSet(&[_]Feature{}), |
| 107 | }; | 107 | }; |
| 108 | result[@intFromEnum(Feature.enhanced_sort)] = .{ | 108 | result[@backingInt(Feature.enhanced_sort)] = .{ |
| 109 | .llvm_name = "enhanced-sort", | 109 | .llvm_name = "enhanced-sort", |
| 110 | .description = "Assume that the enhanced-sort facility is installed", | 110 | .description = "Assume that the enhanced-sort facility is installed", |
| 111 | .dependencies = featureSet(&[_]Feature{}), | 111 | .dependencies = featureSet(&[_]Feature{}), |
| 112 | }; | 112 | }; |
| 113 | result[@intFromEnum(Feature.execution_hint)] = .{ | 113 | result[@backingInt(Feature.execution_hint)] = .{ |
| 114 | .llvm_name = "execution-hint", | 114 | .llvm_name = "execution-hint", |
| 115 | .description = "Assume that the execution-hint facility is installed", | 115 | .description = "Assume that the execution-hint facility is installed", |
| 116 | .dependencies = featureSet(&[_]Feature{}), | 116 | .dependencies = featureSet(&[_]Feature{}), |
| 117 | }; | 117 | }; |
| 118 | result[@intFromEnum(Feature.fast_serialization)] = .{ | 118 | result[@backingInt(Feature.fast_serialization)] = .{ |
| 119 | .llvm_name = "fast-serialization", | 119 | .llvm_name = "fast-serialization", |
| 120 | .description = "Assume that the fast-serialization facility is installed", | 120 | .description = "Assume that the fast-serialization facility is installed", |
| 121 | .dependencies = featureSet(&[_]Feature{}), | 121 | .dependencies = featureSet(&[_]Feature{}), |
| 122 | }; | 122 | }; |
| 123 | result[@intFromEnum(Feature.fp_extension)] = .{ | 123 | result[@backingInt(Feature.fp_extension)] = .{ |
| 124 | .llvm_name = "fp-extension", | 124 | .llvm_name = "fp-extension", |
| 125 | .description = "Assume that the floating-point extension facility is installed", | 125 | .description = "Assume that the floating-point extension facility is installed", |
| 126 | .dependencies = featureSet(&[_]Feature{}), | 126 | .dependencies = featureSet(&[_]Feature{}), |
| 127 | }; | 127 | }; |
| 128 | result[@intFromEnum(Feature.guarded_storage)] = .{ | 128 | result[@backingInt(Feature.guarded_storage)] = .{ |
| 129 | .llvm_name = "guarded-storage", | 129 | .llvm_name = "guarded-storage", |
| 130 | .description = "Assume that the guarded-storage facility is installed", | 130 | .description = "Assume that the guarded-storage facility is installed", |
| 131 | .dependencies = featureSet(&[_]Feature{}), | 131 | .dependencies = featureSet(&[_]Feature{}), |
| 132 | }; | 132 | }; |
| 133 | result[@intFromEnum(Feature.high_word)] = .{ | 133 | result[@backingInt(Feature.high_word)] = .{ |
| 134 | .llvm_name = "high-word", | 134 | .llvm_name = "high-word", |
| 135 | .description = "Assume that the high-word facility is installed", | 135 | .description = "Assume that the high-word facility is installed", |
| 136 | .dependencies = featureSet(&[_]Feature{}), | 136 | .dependencies = featureSet(&[_]Feature{}), |
| 137 | }; | 137 | }; |
| 138 | result[@intFromEnum(Feature.insert_reference_bits_multiple)] = .{ | 138 | result[@backingInt(Feature.insert_reference_bits_multiple)] = .{ |
| 139 | .llvm_name = "insert-reference-bits-multiple", | 139 | .llvm_name = "insert-reference-bits-multiple", |
| 140 | .description = "Assume that the insert-reference-bits-multiple facility is installed", | 140 | .description = "Assume that the insert-reference-bits-multiple facility is installed", |
| 141 | .dependencies = featureSet(&[_]Feature{}), | 141 | .dependencies = featureSet(&[_]Feature{}), |
| 142 | }; | 142 | }; |
| 143 | result[@intFromEnum(Feature.interlocked_access1)] = .{ | 143 | result[@backingInt(Feature.interlocked_access1)] = .{ |
| 144 | .llvm_name = "interlocked-access1", | 144 | .llvm_name = "interlocked-access1", |
| 145 | .description = "Assume that interlocked-access facility 1 is installed", | 145 | .description = "Assume that interlocked-access facility 1 is installed", |
| 146 | .dependencies = featureSet(&[_]Feature{}), | 146 | .dependencies = featureSet(&[_]Feature{}), |
| 147 | }; | 147 | }; |
| 148 | result[@intFromEnum(Feature.load_and_trap)] = .{ | 148 | result[@backingInt(Feature.load_and_trap)] = .{ |
| 149 | .llvm_name = "load-and-trap", | 149 | .llvm_name = "load-and-trap", |
| 150 | .description = "Assume that the load-and-trap facility is installed", | 150 | .description = "Assume that the load-and-trap facility is installed", |
| 151 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "load-and-zero-rightmost-byte", | 154 | .llvm_name = "load-and-zero-rightmost-byte", |
| 155 | .description = "Assume that the load-and-zero-rightmost-byte facility is installed", | 155 | .description = "Assume that the load-and-zero-rightmost-byte facility is installed", |
| 156 | .dependencies = featureSet(&[_]Feature{}), | 156 | .dependencies = featureSet(&[_]Feature{}), |
| 157 | }; | 157 | }; |
| 158 | result[@intFromEnum(Feature.load_store_on_cond)] = .{ | 158 | result[@backingInt(Feature.load_store_on_cond)] = .{ |
| 159 | .llvm_name = "load-store-on-cond", | 159 | .llvm_name = "load-store-on-cond", |
| 160 | .description = "Assume that the load/store-on-condition facility is installed", | 160 | .description = "Assume that the load/store-on-condition facility is installed", |
| 161 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "load-store-on-cond-2", | 164 | .llvm_name = "load-store-on-cond-2", |
| 165 | .description = "Assume that the load/store-on-condition facility 2 is installed", | 165 | .description = "Assume that the load/store-on-condition facility 2 is installed", |
| 166 | .dependencies = featureSet(&[_]Feature{}), | 166 | .dependencies = featureSet(&[_]Feature{}), |
| 167 | }; | 167 | }; |
| 168 | result[@intFromEnum(Feature.message_security_assist_extension12)] = .{ | 168 | result[@backingInt(Feature.message_security_assist_extension12)] = .{ |
| 169 | .llvm_name = "message-security-assist-extension12", | 169 | .llvm_name = "message-security-assist-extension12", |
| 170 | .description = "Assume that the message-security-assist extension facility 12 is installed", | 170 | .description = "Assume that the message-security-assist extension facility 12 is installed", |
| 171 | .dependencies = featureSet(&[_]Feature{}), | 171 | .dependencies = featureSet(&[_]Feature{}), |
| 172 | }; | 172 | }; |
| 173 | result[@intFromEnum(Feature.message_security_assist_extension3)] = .{ | 173 | result[@backingInt(Feature.message_security_assist_extension3)] = .{ |
| 174 | .llvm_name = "message-security-assist-extension3", | 174 | .llvm_name = "message-security-assist-extension3", |
| 175 | .description = "Assume that the message-security-assist extension facility 3 is installed", | 175 | .description = "Assume that the message-security-assist extension facility 3 is installed", |
| 176 | .dependencies = featureSet(&[_]Feature{}), | 176 | .dependencies = featureSet(&[_]Feature{}), |
| 177 | }; | 177 | }; |
| 178 | result[@intFromEnum(Feature.message_security_assist_extension4)] = .{ | 178 | result[@backingInt(Feature.message_security_assist_extension4)] = .{ |
| 179 | .llvm_name = "message-security-assist-extension4", | 179 | .llvm_name = "message-security-assist-extension4", |
| 180 | .description = "Assume that the message-security-assist extension facility 4 is installed", | 180 | .description = "Assume that the message-security-assist extension facility 4 is installed", |
| 181 | .dependencies = featureSet(&[_]Feature{}), | 181 | .dependencies = featureSet(&[_]Feature{}), |
| 182 | }; | 182 | }; |
| 183 | result[@intFromEnum(Feature.message_security_assist_extension5)] = .{ | 183 | result[@backingInt(Feature.message_security_assist_extension5)] = .{ |
| 184 | .llvm_name = "message-security-assist-extension5", | 184 | .llvm_name = "message-security-assist-extension5", |
| 185 | .description = "Assume that the message-security-assist extension facility 5 is installed", | 185 | .description = "Assume that the message-security-assist extension facility 5 is installed", |
| 186 | .dependencies = featureSet(&[_]Feature{}), | 186 | .dependencies = featureSet(&[_]Feature{}), |
| 187 | }; | 187 | }; |
| 188 | result[@intFromEnum(Feature.message_security_assist_extension7)] = .{ | 188 | result[@backingInt(Feature.message_security_assist_extension7)] = .{ |
| 189 | .llvm_name = "message-security-assist-extension7", | 189 | .llvm_name = "message-security-assist-extension7", |
| 190 | .description = "Assume that the message-security-assist extension facility 7 is installed", | 190 | .description = "Assume that the message-security-assist extension facility 7 is installed", |
| 191 | .dependencies = featureSet(&[_]Feature{}), | 191 | .dependencies = featureSet(&[_]Feature{}), |
| 192 | }; | 192 | }; |
| 193 | result[@intFromEnum(Feature.message_security_assist_extension8)] = .{ | 193 | result[@backingInt(Feature.message_security_assist_extension8)] = .{ |
| 194 | .llvm_name = "message-security-assist-extension8", | 194 | .llvm_name = "message-security-assist-extension8", |
| 195 | .description = "Assume that the message-security-assist extension facility 8 is installed", | 195 | .description = "Assume that the message-security-assist extension facility 8 is installed", |
| 196 | .dependencies = featureSet(&[_]Feature{}), | 196 | .dependencies = featureSet(&[_]Feature{}), |
| 197 | }; | 197 | }; |
| 198 | result[@intFromEnum(Feature.message_security_assist_extension9)] = .{ | 198 | result[@backingInt(Feature.message_security_assist_extension9)] = .{ |
| 199 | .llvm_name = "message-security-assist-extension9", | 199 | .llvm_name = "message-security-assist-extension9", |
| 200 | .description = "Assume that the message-security-assist extension facility 9 is installed", | 200 | .description = "Assume that the message-security-assist extension facility 9 is installed", |
| 201 | .dependencies = featureSet(&[_]Feature{}), | 201 | .dependencies = featureSet(&[_]Feature{}), |
| 202 | }; | 202 | }; |
| 203 | result[@intFromEnum(Feature.miscellaneous_extensions)] = .{ | 203 | result[@backingInt(Feature.miscellaneous_extensions)] = .{ |
| 204 | .llvm_name = "miscellaneous-extensions", | 204 | .llvm_name = "miscellaneous-extensions", |
| 205 | .description = "Assume that the miscellaneous-extensions facility is installed", | 205 | .description = "Assume that the miscellaneous-extensions facility is installed", |
| 206 | .dependencies = featureSet(&[_]Feature{}), | 206 | .dependencies = featureSet(&[_]Feature{}), |
| 207 | }; | 207 | }; |
| 208 | result[@intFromEnum(Feature.miscellaneous_extensions_2)] = .{ | 208 | result[@backingInt(Feature.miscellaneous_extensions_2)] = .{ |
| 209 | .llvm_name = "miscellaneous-extensions-2", | 209 | .llvm_name = "miscellaneous-extensions-2", |
| 210 | .description = "Assume that the miscellaneous-extensions facility 2 is installed", | 210 | .description = "Assume that the miscellaneous-extensions facility 2 is installed", |
| 211 | .dependencies = featureSet(&[_]Feature{}), | 211 | .dependencies = featureSet(&[_]Feature{}), |
| 212 | }; | 212 | }; |
| 213 | result[@intFromEnum(Feature.miscellaneous_extensions_3)] = .{ | 213 | result[@backingInt(Feature.miscellaneous_extensions_3)] = .{ |
| 214 | .llvm_name = "miscellaneous-extensions-3", | 214 | .llvm_name = "miscellaneous-extensions-3", |
| 215 | .description = "Assume that the miscellaneous-extensions facility 3 is installed", | 215 | .description = "Assume that the miscellaneous-extensions facility 3 is installed", |
| 216 | .dependencies = featureSet(&[_]Feature{}), | 216 | .dependencies = featureSet(&[_]Feature{}), |
| 217 | }; | 217 | }; |
| 218 | result[@intFromEnum(Feature.miscellaneous_extensions_4)] = .{ | 218 | result[@backingInt(Feature.miscellaneous_extensions_4)] = .{ |
| 219 | .llvm_name = "miscellaneous-extensions-4", | 219 | .llvm_name = "miscellaneous-extensions-4", |
| 220 | .description = "Assume that the miscellaneous-extensions facility 4 is installed", | 220 | .description = "Assume that the miscellaneous-extensions facility 4 is installed", |
| 221 | .dependencies = featureSet(&[_]Feature{}), | 221 | .dependencies = featureSet(&[_]Feature{}), |
| 222 | }; | 222 | }; |
| 223 | result[@intFromEnum(Feature.nnp_assist)] = .{ | 223 | result[@backingInt(Feature.nnp_assist)] = .{ |
| 224 | .llvm_name = "nnp-assist", | 224 | .llvm_name = "nnp-assist", |
| 225 | .description = "Assume that the NNP-assist facility is installed", | 225 | .description = "Assume that the NNP-assist facility is installed", |
| 226 | .dependencies = featureSet(&[_]Feature{}), | 226 | .dependencies = featureSet(&[_]Feature{}), |
| 227 | }; | 227 | }; |
| 228 | result[@intFromEnum(Feature.population_count)] = .{ | 228 | result[@backingInt(Feature.population_count)] = .{ |
| 229 | .llvm_name = "population-count", | 229 | .llvm_name = "population-count", |
| 230 | .description = "Assume that the population-count facility is installed", | 230 | .description = "Assume that the population-count facility is installed", |
| 231 | .dependencies = featureSet(&[_]Feature{}), | 231 | .dependencies = featureSet(&[_]Feature{}), |
| 232 | }; | 232 | }; |
| 233 | result[@intFromEnum(Feature.processor_activity_instrumentation)] = .{ | 233 | result[@backingInt(Feature.processor_activity_instrumentation)] = .{ |
| 234 | .llvm_name = "processor-activity-instrumentation", | 234 | .llvm_name = "processor-activity-instrumentation", |
| 235 | .description = "Assume that the processor-activity-instrumentation facility is installed", | 235 | .description = "Assume that the processor-activity-instrumentation facility is installed", |
| 236 | .dependencies = featureSet(&[_]Feature{}), | 236 | .dependencies = featureSet(&[_]Feature{}), |
| 237 | }; | 237 | }; |
| 238 | result[@intFromEnum(Feature.processor_assist)] = .{ | 238 | result[@backingInt(Feature.processor_assist)] = .{ |
| 239 | .llvm_name = "processor-assist", | 239 | .llvm_name = "processor-assist", |
| 240 | .description = "Assume that the processor-assist facility is installed", | 240 | .description = "Assume that the processor-assist facility is installed", |
| 241 | .dependencies = featureSet(&[_]Feature{}), | 241 | .dependencies = featureSet(&[_]Feature{}), |
| 242 | }; | 242 | }; |
| 243 | result[@intFromEnum(Feature.reset_dat_protection)] = .{ | 243 | result[@backingInt(Feature.reset_dat_protection)] = .{ |
| 244 | .llvm_name = "reset-dat-protection", | 244 | .llvm_name = "reset-dat-protection", |
| 245 | .description = "Assume that the reset-DAT-protection facility is installed", | 245 | .description = "Assume that the reset-DAT-protection facility is installed", |
| 246 | .dependencies = featureSet(&[_]Feature{}), | 246 | .dependencies = featureSet(&[_]Feature{}), |
| 247 | }; | 247 | }; |
| 248 | result[@intFromEnum(Feature.reset_reference_bits_multiple)] = .{ | 248 | result[@backingInt(Feature.reset_reference_bits_multiple)] = .{ |
| 249 | .llvm_name = "reset-reference-bits-multiple", | 249 | .llvm_name = "reset-reference-bits-multiple", |
| 250 | .description = "Assume that the reset-reference-bits-multiple facility is installed", | 250 | .description = "Assume that the reset-reference-bits-multiple facility is installed", |
| 251 | .dependencies = featureSet(&[_]Feature{}), | 251 | .dependencies = featureSet(&[_]Feature{}), |
| 252 | }; | 252 | }; |
| 253 | result[@intFromEnum(Feature.soft_float)] = .{ | 253 | result[@backingInt(Feature.soft_float)] = .{ |
| 254 | .llvm_name = "soft-float", | 254 | .llvm_name = "soft-float", |
| 255 | .description = "Use software emulation for floating point", | 255 | .description = "Use software emulation for floating point", |
| 256 | .dependencies = featureSet(&[_]Feature{}), | 256 | .dependencies = featureSet(&[_]Feature{}), |
| 257 | }; | 257 | }; |
| 258 | result[@intFromEnum(Feature.test_pending_external_interruption)] = .{ | 258 | result[@backingInt(Feature.test_pending_external_interruption)] = .{ |
| 259 | .llvm_name = "test-pending-external-interruption", | 259 | .llvm_name = "test-pending-external-interruption", |
| 260 | .description = "Assume that the test-pending-external-interruption facility is installed", | 260 | .description = "Assume that the test-pending-external-interruption facility is installed", |
| 261 | .dependencies = featureSet(&[_]Feature{}), | 261 | .dependencies = featureSet(&[_]Feature{}), |
| 262 | }; | 262 | }; |
| 263 | result[@intFromEnum(Feature.transactional_execution)] = .{ | 263 | result[@backingInt(Feature.transactional_execution)] = .{ |
| 264 | .llvm_name = "transactional-execution", | 264 | .llvm_name = "transactional-execution", |
| 265 | .description = "Assume that the transactional-execution facility is installed", | 265 | .description = "Assume that the transactional-execution facility is installed", |
| 266 | .dependencies = featureSet(&[_]Feature{}), | 266 | .dependencies = featureSet(&[_]Feature{}), |
| 267 | }; | 267 | }; |
| 268 | result[@intFromEnum(Feature.unaligned_symbols)] = .{ | 268 | result[@backingInt(Feature.unaligned_symbols)] = .{ |
| 269 | .llvm_name = "unaligned-symbols", | 269 | .llvm_name = "unaligned-symbols", |
| 270 | .description = "Don't apply the ABI minimum alignment to external symbols.", | 270 | .description = "Don't apply the ABI minimum alignment to external symbols.", |
| 271 | .dependencies = featureSet(&[_]Feature{}), | 271 | .dependencies = featureSet(&[_]Feature{}), |
| 272 | }; | 272 | }; |
| 273 | result[@intFromEnum(Feature.vector)] = .{ | 273 | result[@backingInt(Feature.vector)] = .{ |
| 274 | .llvm_name = "vector", | 274 | .llvm_name = "vector", |
| 275 | .description = "Assume that the vectory facility is installed", | 275 | .description = "Assume that the vectory facility is installed", |
| 276 | .dependencies = featureSet(&[_]Feature{}), | 276 | .dependencies = featureSet(&[_]Feature{}), |
| 277 | }; | 277 | }; |
| 278 | result[@intFromEnum(Feature.vector_enhancements_1)] = .{ | 278 | result[@backingInt(Feature.vector_enhancements_1)] = .{ |
| 279 | .llvm_name = "vector-enhancements-1", | 279 | .llvm_name = "vector-enhancements-1", |
| 280 | .description = "Assume that the vector enhancements facility 1 is installed", | 280 | .description = "Assume that the vector enhancements facility 1 is installed", |
| 281 | .dependencies = featureSet(&[_]Feature{}), | 281 | .dependencies = featureSet(&[_]Feature{}), |
| 282 | }; | 282 | }; |
| 283 | result[@intFromEnum(Feature.vector_enhancements_2)] = .{ | 283 | result[@backingInt(Feature.vector_enhancements_2)] = .{ |
| 284 | .llvm_name = "vector-enhancements-2", | 284 | .llvm_name = "vector-enhancements-2", |
| 285 | .description = "Assume that the vector enhancements facility 2 is installed", | 285 | .description = "Assume that the vector enhancements facility 2 is installed", |
| 286 | .dependencies = featureSet(&[_]Feature{}), | 286 | .dependencies = featureSet(&[_]Feature{}), |
| 287 | }; | 287 | }; |
| 288 | result[@intFromEnum(Feature.vector_enhancements_3)] = .{ | 288 | result[@backingInt(Feature.vector_enhancements_3)] = .{ |
| 289 | .llvm_name = "vector-enhancements-3", | 289 | .llvm_name = "vector-enhancements-3", |
| 290 | .description = "Assume that the vector enhancements facility 3 is installed", | 290 | .description = "Assume that the vector enhancements facility 3 is installed", |
| 291 | .dependencies = featureSet(&[_]Feature{}), | 291 | .dependencies = featureSet(&[_]Feature{}), |
| 292 | }; | 292 | }; |
| 293 | result[@intFromEnum(Feature.vector_packed_decimal)] = .{ | 293 | result[@backingInt(Feature.vector_packed_decimal)] = .{ |
| 294 | .llvm_name = "vector-packed-decimal", | 294 | .llvm_name = "vector-packed-decimal", |
| 295 | .description = "Assume that the vector packed decimal facility is installed", | 295 | .description = "Assume that the vector packed decimal facility is installed", |
| 296 | .dependencies = featureSet(&[_]Feature{}), | 296 | .dependencies = featureSet(&[_]Feature{}), |
| 297 | }; | 297 | }; |
| 298 | result[@intFromEnum(Feature.vector_packed_decimal_enhancement)] = .{ | 298 | result[@backingInt(Feature.vector_packed_decimal_enhancement)] = .{ |
| 299 | .llvm_name = "vector-packed-decimal-enhancement", | 299 | .llvm_name = "vector-packed-decimal-enhancement", |
| 300 | .description = "Assume that the vector packed decimal enhancement facility is installed", | 300 | .description = "Assume that the vector packed decimal enhancement facility is installed", |
| 301 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "vector-packed-decimal-enhancement-2", | 304 | .llvm_name = "vector-packed-decimal-enhancement-2", |
| 305 | .description = "Assume that the vector packed decimal enhancement facility 2 is installed", | 305 | .description = "Assume that the vector packed decimal enhancement facility 2 is installed", |
| 306 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "vector-packed-decimal-enhancement-3", | 309 | .llvm_name = "vector-packed-decimal-enhancement-3", |
| 310 | .description = "Assume that the vector packed decimal enhancement facility 3 is installed", | 310 | .description = "Assume that the vector packed decimal enhancement facility 3 is installed", |
| 311 | .dependencies = featureSet(&[_]Feature{}), | 311 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/sparc.zig+59-59| ... | @@ -75,111 +75,111 @@ pub const all_features = blk: { | ... | @@ -75,111 +75,111 @@ pub const all_features = blk: { |
| 75 | const len = @typeInfo(Feature).@"enum".field_names.len; | 75 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 76 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 76 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 77 | var result: [len]CpuFeature = undefined; | 77 | var result: [len]CpuFeature = undefined; |
| 78 | result[@intFromEnum(Feature.@"64bit")] = .{ | 78 | result[@backingInt(Feature.@"64bit")] = .{ |
| 79 | .llvm_name = "64bit", | 79 | .llvm_name = "64bit", |
| 80 | .description = "Enable 64-bit mode", | 80 | .description = "Enable 64-bit mode", |
| 81 | .dependencies = featureSet(&[_]Feature{ | 81 | .dependencies = featureSet(&[_]Feature{ |
| 82 | .v9, | 82 | .v9, |
| 83 | }), | 83 | }), |
| 84 | }; | 84 | }; |
| 85 | result[@intFromEnum(Feature.crypto)] = .{ | 85 | result[@backingInt(Feature.crypto)] = .{ |
| 86 | .llvm_name = "crypto", | 86 | .llvm_name = "crypto", |
| 87 | .description = "Enable cryptographic extensions", | 87 | .description = "Enable cryptographic extensions", |
| 88 | .dependencies = featureSet(&[_]Feature{ | 88 | .dependencies = featureSet(&[_]Feature{ |
| 89 | .osa2011, | 89 | .osa2011, |
| 90 | }), | 90 | }), |
| 91 | }; | 91 | }; |
| 92 | result[@intFromEnum(Feature.deprecated_v8)] = .{ | 92 | result[@backingInt(Feature.deprecated_v8)] = .{ |
| 93 | .llvm_name = "deprecated-v8", | 93 | .llvm_name = "deprecated-v8", |
| 94 | .description = "Enable deprecated V8 instructions in V9 mode", | 94 | .description = "Enable deprecated V8 instructions in V9 mode", |
| 95 | .dependencies = featureSet(&[_]Feature{}), | 95 | .dependencies = featureSet(&[_]Feature{}), |
| 96 | }; | 96 | }; |
| 97 | result[@intFromEnum(Feature.detectroundchange)] = .{ | 97 | result[@backingInt(Feature.detectroundchange)] = .{ |
| 98 | .llvm_name = "detectroundchange", | 98 | .llvm_name = "detectroundchange", |
| 99 | .description = "LEON3 erratum detection: Detects any rounding mode change request: use only the round-to-nearest rounding mode", | 99 | .description = "LEON3 erratum detection: Detects any rounding mode change request: use only the round-to-nearest rounding mode", |
| 100 | .dependencies = featureSet(&[_]Feature{}), | 100 | .dependencies = featureSet(&[_]Feature{}), |
| 101 | }; | 101 | }; |
| 102 | result[@intFromEnum(Feature.fix_tn0009)] = .{ | 102 | result[@backingInt(Feature.fix_tn0009)] = .{ |
| 103 | .llvm_name = "fix-tn0009", | 103 | .llvm_name = "fix-tn0009", |
| 104 | .description = "Enable workaround for errata described in GRLIB-TN-0009", | 104 | .description = "Enable workaround for errata described in GRLIB-TN-0009", |
| 105 | .dependencies = featureSet(&[_]Feature{}), | 105 | .dependencies = featureSet(&[_]Feature{}), |
| 106 | }; | 106 | }; |
| 107 | result[@intFromEnum(Feature.fix_tn0010)] = .{ | 107 | result[@backingInt(Feature.fix_tn0010)] = .{ |
| 108 | .llvm_name = "fix-tn0010", | 108 | .llvm_name = "fix-tn0010", |
| 109 | .description = "Enable workaround for errata described in GRLIB-TN-0010", | 109 | .description = "Enable workaround for errata described in GRLIB-TN-0010", |
| 110 | .dependencies = featureSet(&[_]Feature{}), | 110 | .dependencies = featureSet(&[_]Feature{}), |
| 111 | }; | 111 | }; |
| 112 | result[@intFromEnum(Feature.fix_tn0011)] = .{ | 112 | result[@backingInt(Feature.fix_tn0011)] = .{ |
| 113 | .llvm_name = "fix-tn0011", | 113 | .llvm_name = "fix-tn0011", |
| 114 | .description = "Enable workaround for errata described in GRLIB-TN-0011", | 114 | .description = "Enable workaround for errata described in GRLIB-TN-0011", |
| 115 | .dependencies = featureSet(&[_]Feature{}), | 115 | .dependencies = featureSet(&[_]Feature{}), |
| 116 | }; | 116 | }; |
| 117 | result[@intFromEnum(Feature.fix_tn0012)] = .{ | 117 | result[@backingInt(Feature.fix_tn0012)] = .{ |
| 118 | .llvm_name = "fix-tn0012", | 118 | .llvm_name = "fix-tn0012", |
| 119 | .description = "Enable workaround for errata described in GRLIB-TN-0012", | 119 | .description = "Enable workaround for errata described in GRLIB-TN-0012", |
| 120 | .dependencies = featureSet(&[_]Feature{}), | 120 | .dependencies = featureSet(&[_]Feature{}), |
| 121 | }; | 121 | }; |
| 122 | result[@intFromEnum(Feature.fix_tn0013)] = .{ | 122 | result[@backingInt(Feature.fix_tn0013)] = .{ |
| 123 | .llvm_name = "fix-tn0013", | 123 | .llvm_name = "fix-tn0013", |
| 124 | .description = "Enable workaround for errata described in GRLIB-TN-0013", | 124 | .description = "Enable workaround for errata described in GRLIB-TN-0013", |
| 125 | .dependencies = featureSet(&[_]Feature{}), | 125 | .dependencies = featureSet(&[_]Feature{}), |
| 126 | }; | 126 | }; |
| 127 | result[@intFromEnum(Feature.fixallfdivsqrt)] = .{ | 127 | result[@backingInt(Feature.fixallfdivsqrt)] = .{ |
| 128 | .llvm_name = "fixallfdivsqrt", | 128 | .llvm_name = "fixallfdivsqrt", |
| 129 | .description = "LEON erratum fix: Fix FDIVS/FDIVD/FSQRTS/FSQRTD instructions with NOPs and floating-point store", | 129 | .description = "LEON erratum fix: Fix FDIVS/FDIVD/FSQRTS/FSQRTD instructions with NOPs and floating-point store", |
| 130 | .dependencies = featureSet(&[_]Feature{}), | 130 | .dependencies = featureSet(&[_]Feature{}), |
| 131 | }; | 131 | }; |
| 132 | result[@intFromEnum(Feature.hard_quad_float)] = .{ | 132 | result[@backingInt(Feature.hard_quad_float)] = .{ |
| 133 | .llvm_name = "hard-quad-float", | 133 | .llvm_name = "hard-quad-float", |
| 134 | .description = "Enable quad-word floating point instructions", | 134 | .description = "Enable quad-word floating point instructions", |
| 135 | .dependencies = featureSet(&[_]Feature{}), | 135 | .dependencies = featureSet(&[_]Feature{}), |
| 136 | }; | 136 | }; |
| 137 | result[@intFromEnum(Feature.hasleoncasa)] = .{ | 137 | result[@backingInt(Feature.hasleoncasa)] = .{ |
| 138 | .llvm_name = "hasleoncasa", | 138 | .llvm_name = "hasleoncasa", |
| 139 | .description = "Enable CASA instruction for LEON3 and LEON4 processors", | 139 | .description = "Enable CASA instruction for LEON3 and LEON4 processors", |
| 140 | .dependencies = featureSet(&[_]Feature{}), | 140 | .dependencies = featureSet(&[_]Feature{}), |
| 141 | }; | 141 | }; |
| 142 | result[@intFromEnum(Feature.hasumacsmac)] = .{ | 142 | result[@backingInt(Feature.hasumacsmac)] = .{ |
| 143 | .llvm_name = "hasumacsmac", | 143 | .llvm_name = "hasumacsmac", |
| 144 | .description = "Enable UMAC and SMAC for LEON3 and LEON4 processors", | 144 | .description = "Enable UMAC and SMAC for LEON3 and LEON4 processors", |
| 145 | .dependencies = featureSet(&[_]Feature{}), | 145 | .dependencies = featureSet(&[_]Feature{}), |
| 146 | }; | 146 | }; |
| 147 | result[@intFromEnum(Feature.insertnopload)] = .{ | 147 | result[@backingInt(Feature.insertnopload)] = .{ |
| 148 | .llvm_name = "insertnopload", | 148 | .llvm_name = "insertnopload", |
| 149 | .description = "LEON3 erratum fix: Insert a NOP instruction after every single-cycle load instruction when the next instruction is another load/store instruction", | 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 | .dependencies = featureSet(&[_]Feature{}), | 150 | .dependencies = featureSet(&[_]Feature{}), |
| 151 | }; | 151 | }; |
| 152 | result[@intFromEnum(Feature.leon)] = .{ | 152 | result[@backingInt(Feature.leon)] = .{ |
| 153 | .llvm_name = "leon", | 153 | .llvm_name = "leon", |
| 154 | .description = "Enable LEON extensions", | 154 | .description = "Enable LEON extensions", |
| 155 | .dependencies = featureSet(&[_]Feature{}), | 155 | .dependencies = featureSet(&[_]Feature{}), |
| 156 | }; | 156 | }; |
| 157 | result[@intFromEnum(Feature.leoncyclecounter)] = .{ | 157 | result[@backingInt(Feature.leoncyclecounter)] = .{ |
| 158 | .llvm_name = "leoncyclecounter", | 158 | .llvm_name = "leoncyclecounter", |
| 159 | .description = "Use the Leon cycle counter register", | 159 | .description = "Use the Leon cycle counter register", |
| 160 | .dependencies = featureSet(&[_]Feature{}), | 160 | .dependencies = featureSet(&[_]Feature{}), |
| 161 | }; | 161 | }; |
| 162 | result[@intFromEnum(Feature.leonpwrpsr)] = .{ | 162 | result[@backingInt(Feature.leonpwrpsr)] = .{ |
| 163 | .llvm_name = "leonpwrpsr", | 163 | .llvm_name = "leonpwrpsr", |
| 164 | .description = "Enable the PWRPSR instruction", | 164 | .description = "Enable the PWRPSR instruction", |
| 165 | .dependencies = featureSet(&[_]Feature{}), | 165 | .dependencies = featureSet(&[_]Feature{}), |
| 166 | }; | 166 | }; |
| 167 | result[@intFromEnum(Feature.no_fmuls)] = .{ | 167 | result[@backingInt(Feature.no_fmuls)] = .{ |
| 168 | .llvm_name = "no-fmuls", | 168 | .llvm_name = "no-fmuls", |
| 169 | .description = "Disable the fmuls instruction.", | 169 | .description = "Disable the fmuls instruction.", |
| 170 | .dependencies = featureSet(&[_]Feature{}), | 170 | .dependencies = featureSet(&[_]Feature{}), |
| 171 | }; | 171 | }; |
| 172 | result[@intFromEnum(Feature.no_fsmuld)] = .{ | 172 | result[@backingInt(Feature.no_fsmuld)] = .{ |
| 173 | .llvm_name = "no-fsmuld", | 173 | .llvm_name = "no-fsmuld", |
| 174 | .description = "Disable the fsmuld instruction.", | 174 | .description = "Disable the fsmuld instruction.", |
| 175 | .dependencies = featureSet(&[_]Feature{}), | 175 | .dependencies = featureSet(&[_]Feature{}), |
| 176 | }; | 176 | }; |
| 177 | result[@intFromEnum(Feature.no_predictor)] = .{ | 177 | result[@backingInt(Feature.no_predictor)] = .{ |
| 178 | .llvm_name = "no-predictor", | 178 | .llvm_name = "no-predictor", |
| 179 | .description = "Processor has no branch predictor, branches stall execution", | 179 | .description = "Processor has no branch predictor, branches stall execution", |
| 180 | .dependencies = featureSet(&[_]Feature{}), | 180 | .dependencies = featureSet(&[_]Feature{}), |
| 181 | }; | 181 | }; |
| 182 | result[@intFromEnum(Feature.osa2011)] = .{ | 182 | result[@backingInt(Feature.osa2011)] = .{ |
| 183 | .llvm_name = "osa2011", | 183 | .llvm_name = "osa2011", |
| 184 | .description = "Enable Oracle SPARC Architecture 2011 extensions", | 184 | .description = "Enable Oracle SPARC Architecture 2011 extensions", |
| 185 | .dependencies = featureSet(&[_]Feature{ | 185 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -188,164 +188,164 @@ pub const all_features = blk: { | ... | @@ -188,164 +188,164 @@ pub const all_features = blk: { |
| 188 | .vis3, | 188 | .vis3, |
| 189 | }), | 189 | }), |
| 190 | }; | 190 | }; |
| 191 | result[@intFromEnum(Feature.popc)] = .{ | 191 | result[@backingInt(Feature.popc)] = .{ |
| 192 | .llvm_name = "popc", | 192 | .llvm_name = "popc", |
| 193 | .description = "Use the popc (population count) instruction", | 193 | .description = "Use the popc (population count) instruction", |
| 194 | .dependencies = featureSet(&[_]Feature{}), | 194 | .dependencies = featureSet(&[_]Feature{}), |
| 195 | }; | 195 | }; |
| 196 | result[@intFromEnum(Feature.reserve_g1)] = .{ | 196 | result[@backingInt(Feature.reserve_g1)] = .{ |
| 197 | .llvm_name = "reserve-g1", | 197 | .llvm_name = "reserve-g1", |
| 198 | .description = "Reserve G1, making it unavailable as a GPR", | 198 | .description = "Reserve G1, making it unavailable as a GPR", |
| 199 | .dependencies = featureSet(&[_]Feature{}), | 199 | .dependencies = featureSet(&[_]Feature{}), |
| 200 | }; | 200 | }; |
| 201 | result[@intFromEnum(Feature.reserve_g2)] = .{ | 201 | result[@backingInt(Feature.reserve_g2)] = .{ |
| 202 | .llvm_name = "reserve-g2", | 202 | .llvm_name = "reserve-g2", |
| 203 | .description = "Reserve G2, making it unavailable as a GPR", | 203 | .description = "Reserve G2, making it unavailable as a GPR", |
| 204 | .dependencies = featureSet(&[_]Feature{}), | 204 | .dependencies = featureSet(&[_]Feature{}), |
| 205 | }; | 205 | }; |
| 206 | result[@intFromEnum(Feature.reserve_g3)] = .{ | 206 | result[@backingInt(Feature.reserve_g3)] = .{ |
| 207 | .llvm_name = "reserve-g3", | 207 | .llvm_name = "reserve-g3", |
| 208 | .description = "Reserve G3, making it unavailable as a GPR", | 208 | .description = "Reserve G3, making it unavailable as a GPR", |
| 209 | .dependencies = featureSet(&[_]Feature{}), | 209 | .dependencies = featureSet(&[_]Feature{}), |
| 210 | }; | 210 | }; |
| 211 | result[@intFromEnum(Feature.reserve_g4)] = .{ | 211 | result[@backingInt(Feature.reserve_g4)] = .{ |
| 212 | .llvm_name = "reserve-g4", | 212 | .llvm_name = "reserve-g4", |
| 213 | .description = "Reserve G4, making it unavailable as a GPR", | 213 | .description = "Reserve G4, making it unavailable as a GPR", |
| 214 | .dependencies = featureSet(&[_]Feature{}), | 214 | .dependencies = featureSet(&[_]Feature{}), |
| 215 | }; | 215 | }; |
| 216 | result[@intFromEnum(Feature.reserve_g5)] = .{ | 216 | result[@backingInt(Feature.reserve_g5)] = .{ |
| 217 | .llvm_name = "reserve-g5", | 217 | .llvm_name = "reserve-g5", |
| 218 | .description = "Reserve G5, making it unavailable as a GPR", | 218 | .description = "Reserve G5, making it unavailable as a GPR", |
| 219 | .dependencies = featureSet(&[_]Feature{}), | 219 | .dependencies = featureSet(&[_]Feature{}), |
| 220 | }; | 220 | }; |
| 221 | result[@intFromEnum(Feature.reserve_g6)] = .{ | 221 | result[@backingInt(Feature.reserve_g6)] = .{ |
| 222 | .llvm_name = "reserve-g6", | 222 | .llvm_name = "reserve-g6", |
| 223 | .description = "Reserve G6, making it unavailable as a GPR", | 223 | .description = "Reserve G6, making it unavailable as a GPR", |
| 224 | .dependencies = featureSet(&[_]Feature{}), | 224 | .dependencies = featureSet(&[_]Feature{}), |
| 225 | }; | 225 | }; |
| 226 | result[@intFromEnum(Feature.reserve_g7)] = .{ | 226 | result[@backingInt(Feature.reserve_g7)] = .{ |
| 227 | .llvm_name = "reserve-g7", | 227 | .llvm_name = "reserve-g7", |
| 228 | .description = "Reserve G7, making it unavailable as a GPR", | 228 | .description = "Reserve G7, making it unavailable as a GPR", |
| 229 | .dependencies = featureSet(&[_]Feature{}), | 229 | .dependencies = featureSet(&[_]Feature{}), |
| 230 | }; | 230 | }; |
| 231 | result[@intFromEnum(Feature.reserve_i0)] = .{ | 231 | result[@backingInt(Feature.reserve_i0)] = .{ |
| 232 | .llvm_name = "reserve-i0", | 232 | .llvm_name = "reserve-i0", |
| 233 | .description = "Reserve I0, making it unavailable as a GPR", | 233 | .description = "Reserve I0, making it unavailable as a GPR", |
| 234 | .dependencies = featureSet(&[_]Feature{}), | 234 | .dependencies = featureSet(&[_]Feature{}), |
| 235 | }; | 235 | }; |
| 236 | result[@intFromEnum(Feature.reserve_i1)] = .{ | 236 | result[@backingInt(Feature.reserve_i1)] = .{ |
| 237 | .llvm_name = "reserve-i1", | 237 | .llvm_name = "reserve-i1", |
| 238 | .description = "Reserve I1, making it unavailable as a GPR", | 238 | .description = "Reserve I1, making it unavailable as a GPR", |
| 239 | .dependencies = featureSet(&[_]Feature{}), | 239 | .dependencies = featureSet(&[_]Feature{}), |
| 240 | }; | 240 | }; |
| 241 | result[@intFromEnum(Feature.reserve_i2)] = .{ | 241 | result[@backingInt(Feature.reserve_i2)] = .{ |
| 242 | .llvm_name = "reserve-i2", | 242 | .llvm_name = "reserve-i2", |
| 243 | .description = "Reserve I2, making it unavailable as a GPR", | 243 | .description = "Reserve I2, making it unavailable as a GPR", |
| 244 | .dependencies = featureSet(&[_]Feature{}), | 244 | .dependencies = featureSet(&[_]Feature{}), |
| 245 | }; | 245 | }; |
| 246 | result[@intFromEnum(Feature.reserve_i3)] = .{ | 246 | result[@backingInt(Feature.reserve_i3)] = .{ |
| 247 | .llvm_name = "reserve-i3", | 247 | .llvm_name = "reserve-i3", |
| 248 | .description = "Reserve I3, making it unavailable as a GPR", | 248 | .description = "Reserve I3, making it unavailable as a GPR", |
| 249 | .dependencies = featureSet(&[_]Feature{}), | 249 | .dependencies = featureSet(&[_]Feature{}), |
| 250 | }; | 250 | }; |
| 251 | result[@intFromEnum(Feature.reserve_i4)] = .{ | 251 | result[@backingInt(Feature.reserve_i4)] = .{ |
| 252 | .llvm_name = "reserve-i4", | 252 | .llvm_name = "reserve-i4", |
| 253 | .description = "Reserve I4, making it unavailable as a GPR", | 253 | .description = "Reserve I4, making it unavailable as a GPR", |
| 254 | .dependencies = featureSet(&[_]Feature{}), | 254 | .dependencies = featureSet(&[_]Feature{}), |
| 255 | }; | 255 | }; |
| 256 | result[@intFromEnum(Feature.reserve_i5)] = .{ | 256 | result[@backingInt(Feature.reserve_i5)] = .{ |
| 257 | .llvm_name = "reserve-i5", | 257 | .llvm_name = "reserve-i5", |
| 258 | .description = "Reserve I5, making it unavailable as a GPR", | 258 | .description = "Reserve I5, making it unavailable as a GPR", |
| 259 | .dependencies = featureSet(&[_]Feature{}), | 259 | .dependencies = featureSet(&[_]Feature{}), |
| 260 | }; | 260 | }; |
| 261 | result[@intFromEnum(Feature.reserve_l0)] = .{ | 261 | result[@backingInt(Feature.reserve_l0)] = .{ |
| 262 | .llvm_name = "reserve-l0", | 262 | .llvm_name = "reserve-l0", |
| 263 | .description = "Reserve L0, making it unavailable as a GPR", | 263 | .description = "Reserve L0, making it unavailable as a GPR", |
| 264 | .dependencies = featureSet(&[_]Feature{}), | 264 | .dependencies = featureSet(&[_]Feature{}), |
| 265 | }; | 265 | }; |
| 266 | result[@intFromEnum(Feature.reserve_l1)] = .{ | 266 | result[@backingInt(Feature.reserve_l1)] = .{ |
| 267 | .llvm_name = "reserve-l1", | 267 | .llvm_name = "reserve-l1", |
| 268 | .description = "Reserve L1, making it unavailable as a GPR", | 268 | .description = "Reserve L1, making it unavailable as a GPR", |
| 269 | .dependencies = featureSet(&[_]Feature{}), | 269 | .dependencies = featureSet(&[_]Feature{}), |
| 270 | }; | 270 | }; |
| 271 | result[@intFromEnum(Feature.reserve_l2)] = .{ | 271 | result[@backingInt(Feature.reserve_l2)] = .{ |
| 272 | .llvm_name = "reserve-l2", | 272 | .llvm_name = "reserve-l2", |
| 273 | .description = "Reserve L2, making it unavailable as a GPR", | 273 | .description = "Reserve L2, making it unavailable as a GPR", |
| 274 | .dependencies = featureSet(&[_]Feature{}), | 274 | .dependencies = featureSet(&[_]Feature{}), |
| 275 | }; | 275 | }; |
| 276 | result[@intFromEnum(Feature.reserve_l3)] = .{ | 276 | result[@backingInt(Feature.reserve_l3)] = .{ |
| 277 | .llvm_name = "reserve-l3", | 277 | .llvm_name = "reserve-l3", |
| 278 | .description = "Reserve L3, making it unavailable as a GPR", | 278 | .description = "Reserve L3, making it unavailable as a GPR", |
| 279 | .dependencies = featureSet(&[_]Feature{}), | 279 | .dependencies = featureSet(&[_]Feature{}), |
| 280 | }; | 280 | }; |
| 281 | result[@intFromEnum(Feature.reserve_l4)] = .{ | 281 | result[@backingInt(Feature.reserve_l4)] = .{ |
| 282 | .llvm_name = "reserve-l4", | 282 | .llvm_name = "reserve-l4", |
| 283 | .description = "Reserve L4, making it unavailable as a GPR", | 283 | .description = "Reserve L4, making it unavailable as a GPR", |
| 284 | .dependencies = featureSet(&[_]Feature{}), | 284 | .dependencies = featureSet(&[_]Feature{}), |
| 285 | }; | 285 | }; |
| 286 | result[@intFromEnum(Feature.reserve_l5)] = .{ | 286 | result[@backingInt(Feature.reserve_l5)] = .{ |
| 287 | .llvm_name = "reserve-l5", | 287 | .llvm_name = "reserve-l5", |
| 288 | .description = "Reserve L5, making it unavailable as a GPR", | 288 | .description = "Reserve L5, making it unavailable as a GPR", |
| 289 | .dependencies = featureSet(&[_]Feature{}), | 289 | .dependencies = featureSet(&[_]Feature{}), |
| 290 | }; | 290 | }; |
| 291 | result[@intFromEnum(Feature.reserve_l6)] = .{ | 291 | result[@backingInt(Feature.reserve_l6)] = .{ |
| 292 | .llvm_name = "reserve-l6", | 292 | .llvm_name = "reserve-l6", |
| 293 | .description = "Reserve L6, making it unavailable as a GPR", | 293 | .description = "Reserve L6, making it unavailable as a GPR", |
| 294 | .dependencies = featureSet(&[_]Feature{}), | 294 | .dependencies = featureSet(&[_]Feature{}), |
| 295 | }; | 295 | }; |
| 296 | result[@intFromEnum(Feature.reserve_l7)] = .{ | 296 | result[@backingInt(Feature.reserve_l7)] = .{ |
| 297 | .llvm_name = "reserve-l7", | 297 | .llvm_name = "reserve-l7", |
| 298 | .description = "Reserve L7, making it unavailable as a GPR", | 298 | .description = "Reserve L7, making it unavailable as a GPR", |
| 299 | .dependencies = featureSet(&[_]Feature{}), | 299 | .dependencies = featureSet(&[_]Feature{}), |
| 300 | }; | 300 | }; |
| 301 | result[@intFromEnum(Feature.reserve_o0)] = .{ | 301 | result[@backingInt(Feature.reserve_o0)] = .{ |
| 302 | .llvm_name = "reserve-o0", | 302 | .llvm_name = "reserve-o0", |
| 303 | .description = "Reserve O0, making it unavailable as a GPR", | 303 | .description = "Reserve O0, making it unavailable as a GPR", |
| 304 | .dependencies = featureSet(&[_]Feature{}), | 304 | .dependencies = featureSet(&[_]Feature{}), |
| 305 | }; | 305 | }; |
| 306 | result[@intFromEnum(Feature.reserve_o1)] = .{ | 306 | result[@backingInt(Feature.reserve_o1)] = .{ |
| 307 | .llvm_name = "reserve-o1", | 307 | .llvm_name = "reserve-o1", |
| 308 | .description = "Reserve O1, making it unavailable as a GPR", | 308 | .description = "Reserve O1, making it unavailable as a GPR", |
| 309 | .dependencies = featureSet(&[_]Feature{}), | 309 | .dependencies = featureSet(&[_]Feature{}), |
| 310 | }; | 310 | }; |
| 311 | result[@intFromEnum(Feature.reserve_o2)] = .{ | 311 | result[@backingInt(Feature.reserve_o2)] = .{ |
| 312 | .llvm_name = "reserve-o2", | 312 | .llvm_name = "reserve-o2", |
| 313 | .description = "Reserve O2, making it unavailable as a GPR", | 313 | .description = "Reserve O2, making it unavailable as a GPR", |
| 314 | .dependencies = featureSet(&[_]Feature{}), | 314 | .dependencies = featureSet(&[_]Feature{}), |
| 315 | }; | 315 | }; |
| 316 | result[@intFromEnum(Feature.reserve_o3)] = .{ | 316 | result[@backingInt(Feature.reserve_o3)] = .{ |
| 317 | .llvm_name = "reserve-o3", | 317 | .llvm_name = "reserve-o3", |
| 318 | .description = "Reserve O3, making it unavailable as a GPR", | 318 | .description = "Reserve O3, making it unavailable as a GPR", |
| 319 | .dependencies = featureSet(&[_]Feature{}), | 319 | .dependencies = featureSet(&[_]Feature{}), |
| 320 | }; | 320 | }; |
| 321 | result[@intFromEnum(Feature.reserve_o4)] = .{ | 321 | result[@backingInt(Feature.reserve_o4)] = .{ |
| 322 | .llvm_name = "reserve-o4", | 322 | .llvm_name = "reserve-o4", |
| 323 | .description = "Reserve O4, making it unavailable as a GPR", | 323 | .description = "Reserve O4, making it unavailable as a GPR", |
| 324 | .dependencies = featureSet(&[_]Feature{}), | 324 | .dependencies = featureSet(&[_]Feature{}), |
| 325 | }; | 325 | }; |
| 326 | result[@intFromEnum(Feature.reserve_o5)] = .{ | 326 | result[@backingInt(Feature.reserve_o5)] = .{ |
| 327 | .llvm_name = "reserve-o5", | 327 | .llvm_name = "reserve-o5", |
| 328 | .description = "Reserve O5, making it unavailable as a GPR", | 328 | .description = "Reserve O5, making it unavailable as a GPR", |
| 329 | .dependencies = featureSet(&[_]Feature{}), | 329 | .dependencies = featureSet(&[_]Feature{}), |
| 330 | }; | 330 | }; |
| 331 | result[@intFromEnum(Feature.slow_rdpc)] = .{ | 331 | result[@backingInt(Feature.slow_rdpc)] = .{ |
| 332 | .llvm_name = "slow-rdpc", | 332 | .llvm_name = "slow-rdpc", |
| 333 | .description = "rd %pc, %XX is slow", | 333 | .description = "rd %pc, %XX is slow", |
| 334 | .dependencies = featureSet(&[_]Feature{ | 334 | .dependencies = featureSet(&[_]Feature{ |
| 335 | .v9, | 335 | .v9, |
| 336 | }), | 336 | }), |
| 337 | }; | 337 | }; |
| 338 | result[@intFromEnum(Feature.soft_float)] = .{ | 338 | result[@backingInt(Feature.soft_float)] = .{ |
| 339 | .llvm_name = "soft-float", | 339 | .llvm_name = "soft-float", |
| 340 | .description = "Use software emulation for floating point", | 340 | .description = "Use software emulation for floating point", |
| 341 | .dependencies = featureSet(&[_]Feature{}), | 341 | .dependencies = featureSet(&[_]Feature{}), |
| 342 | }; | 342 | }; |
| 343 | result[@intFromEnum(Feature.soft_mul_div)] = .{ | 343 | result[@backingInt(Feature.soft_mul_div)] = .{ |
| 344 | .llvm_name = "soft-mul-div", | 344 | .llvm_name = "soft-mul-div", |
| 345 | .description = "Use software emulation for integer multiply and divide", | 345 | .description = "Use software emulation for integer multiply and divide", |
| 346 | .dependencies = featureSet(&[_]Feature{}), | 346 | .dependencies = featureSet(&[_]Feature{}), |
| 347 | }; | 347 | }; |
| 348 | result[@intFromEnum(Feature.ua2005)] = .{ | 348 | result[@backingInt(Feature.ua2005)] = .{ |
| 349 | .llvm_name = "ua2005", | 349 | .llvm_name = "ua2005", |
| 350 | .description = "Enable UltraSPARC Architecture 2005 extensions", | 350 | .description = "Enable UltraSPARC Architecture 2005 extensions", |
| 351 | .dependencies = featureSet(&[_]Feature{ | 351 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -353,7 +353,7 @@ pub const all_features = blk: { | ... | @@ -353,7 +353,7 @@ pub const all_features = blk: { |
| 353 | .vis2, | 353 | .vis2, |
| 354 | }), | 354 | }), |
| 355 | }; | 355 | }; |
| 356 | result[@intFromEnum(Feature.ua2007)] = .{ | 356 | result[@backingInt(Feature.ua2007)] = .{ |
| 357 | .llvm_name = "ua2007", | 357 | .llvm_name = "ua2007", |
| 358 | .description = "Enable UltraSPARC Architecture 2007 extensions", | 358 | .description = "Enable UltraSPARC Architecture 2007 extensions", |
| 359 | .dependencies = featureSet(&[_]Feature{ | 359 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -361,31 +361,31 @@ pub const all_features = blk: { | ... | @@ -361,31 +361,31 @@ pub const all_features = blk: { |
| 361 | .vis2, | 361 | .vis2, |
| 362 | }), | 362 | }), |
| 363 | }; | 363 | }; |
| 364 | result[@intFromEnum(Feature.v8plus)] = .{ | 364 | result[@backingInt(Feature.v8plus)] = .{ |
| 365 | .llvm_name = "v8plus", | 365 | .llvm_name = "v8plus", |
| 366 | .description = "Enable V8+ mode, allowing use of 64-bit V9 instructions in 32-bit code", | 366 | .description = "Enable V8+ mode, allowing use of 64-bit V9 instructions in 32-bit code", |
| 367 | .dependencies = featureSet(&[_]Feature{}), | 367 | .dependencies = featureSet(&[_]Feature{}), |
| 368 | }; | 368 | }; |
| 369 | result[@intFromEnum(Feature.v9)] = .{ | 369 | result[@backingInt(Feature.v9)] = .{ |
| 370 | .llvm_name = "v9", | 370 | .llvm_name = "v9", |
| 371 | .description = "Enable SPARC-V9 instructions", | 371 | .description = "Enable SPARC-V9 instructions", |
| 372 | .dependencies = featureSet(&[_]Feature{}), | 372 | .dependencies = featureSet(&[_]Feature{}), |
| 373 | }; | 373 | }; |
| 374 | result[@intFromEnum(Feature.vis)] = .{ | 374 | result[@backingInt(Feature.vis)] = .{ |
| 375 | .llvm_name = "vis", | 375 | .llvm_name = "vis", |
| 376 | .description = "Enable UltraSPARC Visual Instruction Set extensions", | 376 | .description = "Enable UltraSPARC Visual Instruction Set extensions", |
| 377 | .dependencies = featureSet(&[_]Feature{ | 377 | .dependencies = featureSet(&[_]Feature{ |
| 378 | .v9, | 378 | .v9, |
| 379 | }), | 379 | }), |
| 380 | }; | 380 | }; |
| 381 | result[@intFromEnum(Feature.vis2)] = .{ | 381 | result[@backingInt(Feature.vis2)] = .{ |
| 382 | .llvm_name = "vis2", | 382 | .llvm_name = "vis2", |
| 383 | .description = "Enable Visual Instruction Set extensions II", | 383 | .description = "Enable Visual Instruction Set extensions II", |
| 384 | .dependencies = featureSet(&[_]Feature{ | 384 | .dependencies = featureSet(&[_]Feature{ |
| 385 | .v9, | 385 | .v9, |
| 386 | }), | 386 | }), |
| 387 | }; | 387 | }; |
| 388 | result[@intFromEnum(Feature.vis3)] = .{ | 388 | result[@backingInt(Feature.vis3)] = .{ |
| 389 | .llvm_name = "vis3", | 389 | .llvm_name = "vis3", |
| 390 | .description = "Enable Visual Instruction Set extensions III", | 390 | .description = "Enable Visual Instruction Set extensions III", |
| 391 | .dependencies = featureSet(&[_]Feature{ | 391 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/spirv.zig+228-228| ... | @@ -245,7 +245,7 @@ pub const all_features = blk: { | ... | @@ -245,7 +245,7 @@ pub const all_features = blk: { |
| 245 | const len = @typeInfo(Feature).@"enum".field_names.len; | 245 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 246 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 246 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 247 | var result: [len]CpuFeature = undefined; | 247 | var result: [len]CpuFeature = undefined; |
| 248 | result[@intFromEnum(Feature.abort_khr)] = .{ | 248 | result[@backingInt(Feature.abort_khr)] = .{ |
| 249 | .llvm_name = null, | 249 | .llvm_name = null, |
| 250 | .description = "Enable abort_khr capability", | 250 | .description = "Enable abort_khr capability", |
| 251 | .dependencies = featureSet(&[_]Feature{ | 251 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -253,7 +253,7 @@ pub const all_features = blk: { | ... | @@ -253,7 +253,7 @@ pub const all_features = blk: { |
| 253 | .v1_0, | 253 | .v1_0, |
| 254 | }), | 254 | }), |
| 255 | }; | 255 | }; |
| 256 | result[@intFromEnum(Feature.arithmetic_fence_ext)] = .{ | 256 | result[@backingInt(Feature.arithmetic_fence_ext)] = .{ |
| 257 | .llvm_name = null, | 257 | .llvm_name = null, |
| 258 | .description = "Enable arithmetic_fence_ext capability", | 258 | .description = "Enable arithmetic_fence_ext capability", |
| 259 | .dependencies = featureSet(&[_]Feature{ | 259 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -261,7 +261,7 @@ pub const all_features = blk: { | ... | @@ -261,7 +261,7 @@ pub const all_features = blk: { |
| 261 | .v1_0, | 261 | .v1_0, |
| 262 | }), | 262 | }), |
| 263 | }; | 263 | }; |
| 264 | result[@intFromEnum(Feature.atomic_float16add_ext)] = .{ | 264 | result[@backingInt(Feature.atomic_float16add_ext)] = .{ |
| 265 | .llvm_name = null, | 265 | .llvm_name = null, |
| 266 | .description = "Enable atomic_float16add_ext capability", | 266 | .description = "Enable atomic_float16add_ext capability", |
| 267 | .dependencies = featureSet(&[_]Feature{ | 267 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -269,7 +269,7 @@ pub const all_features = blk: { | ... | @@ -269,7 +269,7 @@ pub const all_features = blk: { |
| 269 | .v1_0, | 269 | .v1_0, |
| 270 | }), | 270 | }), |
| 271 | }; | 271 | }; |
| 272 | result[@intFromEnum(Feature.atomic_float16min_max_ext)] = .{ | 272 | result[@backingInt(Feature.atomic_float16min_max_ext)] = .{ |
| 273 | .llvm_name = null, | 273 | .llvm_name = null, |
| 274 | .description = "Enable atomic_float16min_max_ext capability", | 274 | .description = "Enable atomic_float16min_max_ext capability", |
| 275 | .dependencies = featureSet(&[_]Feature{ | 275 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -277,7 +277,7 @@ pub const all_features = blk: { | ... | @@ -277,7 +277,7 @@ pub const all_features = blk: { |
| 277 | .v1_0, | 277 | .v1_0, |
| 278 | }), | 278 | }), |
| 279 | }; | 279 | }; |
| 280 | result[@intFromEnum(Feature.atomic_float32add_ext)] = .{ | 280 | result[@backingInt(Feature.atomic_float32add_ext)] = .{ |
| 281 | .llvm_name = null, | 281 | .llvm_name = null, |
| 282 | .description = "Enable atomic_float32add_ext capability", | 282 | .description = "Enable atomic_float32add_ext capability", |
| 283 | .dependencies = featureSet(&[_]Feature{ | 283 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -285,7 +285,7 @@ pub const all_features = blk: { | ... | @@ -285,7 +285,7 @@ pub const all_features = blk: { |
| 285 | .v1_0, | 285 | .v1_0, |
| 286 | }), | 286 | }), |
| 287 | }; | 287 | }; |
| 288 | result[@intFromEnum(Feature.atomic_float32min_max_ext)] = .{ | 288 | result[@backingInt(Feature.atomic_float32min_max_ext)] = .{ |
| 289 | .llvm_name = null, | 289 | .llvm_name = null, |
| 290 | .description = "Enable atomic_float32min_max_ext capability", | 290 | .description = "Enable atomic_float32min_max_ext capability", |
| 291 | .dependencies = featureSet(&[_]Feature{ | 291 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -293,7 +293,7 @@ pub const all_features = blk: { | ... | @@ -293,7 +293,7 @@ pub const all_features = blk: { |
| 293 | .v1_0, | 293 | .v1_0, |
| 294 | }), | 294 | }), |
| 295 | }; | 295 | }; |
| 296 | result[@intFromEnum(Feature.atomic_float64add_ext)] = .{ | 296 | result[@backingInt(Feature.atomic_float64add_ext)] = .{ |
| 297 | .llvm_name = null, | 297 | .llvm_name = null, |
| 298 | .description = "Enable atomic_float64add_ext capability", | 298 | .description = "Enable atomic_float64add_ext capability", |
| 299 | .dependencies = featureSet(&[_]Feature{ | 299 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -301,7 +301,7 @@ pub const all_features = blk: { | ... | @@ -301,7 +301,7 @@ pub const all_features = blk: { |
| 301 | .v1_0, | 301 | .v1_0, |
| 302 | }), | 302 | }), |
| 303 | }; | 303 | }; |
| 304 | result[@intFromEnum(Feature.atomic_float64min_max_ext)] = .{ | 304 | result[@backingInt(Feature.atomic_float64min_max_ext)] = .{ |
| 305 | .llvm_name = null, | 305 | .llvm_name = null, |
| 306 | .description = "Enable atomic_float64min_max_ext capability", | 306 | .description = "Enable atomic_float64min_max_ext capability", |
| 307 | .dependencies = featureSet(&[_]Feature{ | 307 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -309,14 +309,14 @@ pub const all_features = blk: { | ... | @@ -309,14 +309,14 @@ pub const all_features = blk: { |
| 309 | .v1_0, | 309 | .v1_0, |
| 310 | }), | 310 | }), |
| 311 | }; | 311 | }; |
| 312 | result[@intFromEnum(Feature.atomic_storage)] = .{ | 312 | result[@backingInt(Feature.atomic_storage)] = .{ |
| 313 | .llvm_name = null, | 313 | .llvm_name = null, |
| 314 | .description = "Enable atomic_storage capability", | 314 | .description = "Enable atomic_storage capability", |
| 315 | .dependencies = featureSet(&[_]Feature{ | 315 | .dependencies = featureSet(&[_]Feature{ |
| 316 | .v1_0, | 316 | .v1_0, |
| 317 | }), | 317 | }), |
| 318 | }; | 318 | }; |
| 319 | result[@intFromEnum(Feature.atomic_storage_ops)] = .{ | 319 | result[@backingInt(Feature.atomic_storage_ops)] = .{ |
| 320 | .llvm_name = null, | 320 | .llvm_name = null, |
| 321 | .description = "Enable atomic_storage_ops capability", | 321 | .description = "Enable atomic_storage_ops capability", |
| 322 | .dependencies = featureSet(&[_]Feature{ | 322 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -324,7 +324,7 @@ pub const all_features = blk: { | ... | @@ -324,7 +324,7 @@ pub const all_features = blk: { |
| 324 | .v1_0, | 324 | .v1_0, |
| 325 | }), | 325 | }), |
| 326 | }; | 326 | }; |
| 327 | result[@intFromEnum(Feature.b_float16cooperative_matrix_khr)] = .{ | 327 | result[@backingInt(Feature.b_float16cooperative_matrix_khr)] = .{ |
| 328 | .llvm_name = null, | 328 | .llvm_name = null, |
| 329 | .description = "Enable b_float16cooperative_matrix_khr capability", | 329 | .description = "Enable b_float16cooperative_matrix_khr capability", |
| 330 | .dependencies = featureSet(&[_]Feature{ | 330 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -332,7 +332,7 @@ pub const all_features = blk: { | ... | @@ -332,7 +332,7 @@ pub const all_features = blk: { |
| 332 | .v1_0, | 332 | .v1_0, |
| 333 | }), | 333 | }), |
| 334 | }; | 334 | }; |
| 335 | result[@intFromEnum(Feature.b_float16dot_product_khr)] = .{ | 335 | result[@backingInt(Feature.b_float16dot_product_khr)] = .{ |
| 336 | .llvm_name = null, | 336 | .llvm_name = null, |
| 337 | .description = "Enable b_float16dot_product_khr capability", | 337 | .description = "Enable b_float16dot_product_khr capability", |
| 338 | .dependencies = featureSet(&[_]Feature{ | 338 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -340,7 +340,7 @@ pub const all_features = blk: { | ... | @@ -340,7 +340,7 @@ pub const all_features = blk: { |
| 340 | .v1_0, | 340 | .v1_0, |
| 341 | }), | 341 | }), |
| 342 | }; | 342 | }; |
| 343 | result[@intFromEnum(Feature.b_float16type_khr)] = .{ | 343 | result[@backingInt(Feature.b_float16type_khr)] = .{ |
| 344 | .llvm_name = null, | 344 | .llvm_name = null, |
| 345 | .description = "Enable b_float16type_khr capability", | 345 | .description = "Enable b_float16type_khr capability", |
| 346 | .dependencies = featureSet(&[_]Feature{ | 346 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -348,7 +348,7 @@ pub const all_features = blk: { | ... | @@ -348,7 +348,7 @@ pub const all_features = blk: { |
| 348 | .v1_0, | 348 | .v1_0, |
| 349 | }), | 349 | }), |
| 350 | }; | 350 | }; |
| 351 | result[@intFromEnum(Feature.bit_instructions)] = .{ | 351 | result[@backingInt(Feature.bit_instructions)] = .{ |
| 352 | .llvm_name = null, | 352 | .llvm_name = null, |
| 353 | .description = "Enable bit_instructions capability", | 353 | .description = "Enable bit_instructions capability", |
| 354 | .dependencies = featureSet(&[_]Feature{ | 354 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -356,14 +356,14 @@ pub const all_features = blk: { | ... | @@ -356,14 +356,14 @@ pub const all_features = blk: { |
| 356 | .v1_0, | 356 | .v1_0, |
| 357 | }), | 357 | }), |
| 358 | }; | 358 | }; |
| 359 | result[@intFromEnum(Feature.clip_distance)] = .{ | 359 | result[@backingInt(Feature.clip_distance)] = .{ |
| 360 | .llvm_name = null, | 360 | .llvm_name = null, |
| 361 | .description = "Enable clip_distance capability", | 361 | .description = "Enable clip_distance capability", |
| 362 | .dependencies = featureSet(&[_]Feature{ | 362 | .dependencies = featureSet(&[_]Feature{ |
| 363 | .v1_0, | 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 | .llvm_name = null, | 367 | .llvm_name = null, |
| 368 | .description = "Enable compute_derivative_group_linear_khr capability", | 368 | .description = "Enable compute_derivative_group_linear_khr capability", |
| 369 | .dependencies = featureSet(&[_]Feature{ | 369 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -371,7 +371,7 @@ pub const all_features = blk: { | ... | @@ -371,7 +371,7 @@ pub const all_features = blk: { |
| 371 | .v1_0, | 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 | .llvm_name = null, | 375 | .llvm_name = null, |
| 376 | .description = "Enable compute_derivative_group_quads_khr capability", | 376 | .description = "Enable compute_derivative_group_quads_khr capability", |
| 377 | .dependencies = featureSet(&[_]Feature{ | 377 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -379,7 +379,7 @@ pub const all_features = blk: { | ... | @@ -379,7 +379,7 @@ pub const all_features = blk: { |
| 379 | .v1_0, | 379 | .v1_0, |
| 380 | }), | 380 | }), |
| 381 | }; | 381 | }; |
| 382 | result[@intFromEnum(Feature.constant_data_khr)] = .{ | 382 | result[@backingInt(Feature.constant_data_khr)] = .{ |
| 383 | .llvm_name = null, | 383 | .llvm_name = null, |
| 384 | .description = "Enable constant_data_khr capability", | 384 | .description = "Enable constant_data_khr capability", |
| 385 | .dependencies = featureSet(&[_]Feature{ | 385 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -387,7 +387,7 @@ pub const all_features = blk: { | ... | @@ -387,7 +387,7 @@ pub const all_features = blk: { |
| 387 | .v1_0, | 387 | .v1_0, |
| 388 | }), | 388 | }), |
| 389 | }; | 389 | }; |
| 390 | result[@intFromEnum(Feature.cooperative_matrix_khr)] = .{ | 390 | result[@backingInt(Feature.cooperative_matrix_khr)] = .{ |
| 391 | .llvm_name = null, | 391 | .llvm_name = null, |
| 392 | .description = "Enable cooperative_matrix_khr capability", | 392 | .description = "Enable cooperative_matrix_khr capability", |
| 393 | .dependencies = featureSet(&[_]Feature{ | 393 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -395,14 +395,14 @@ pub const all_features = blk: { | ... | @@ -395,14 +395,14 @@ pub const all_features = blk: { |
| 395 | .v1_0, | 395 | .v1_0, |
| 396 | }), | 396 | }), |
| 397 | }; | 397 | }; |
| 398 | result[@intFromEnum(Feature.cull_distance)] = .{ | 398 | result[@backingInt(Feature.cull_distance)] = .{ |
| 399 | .llvm_name = null, | 399 | .llvm_name = null, |
| 400 | .description = "Enable cull_distance capability", | 400 | .description = "Enable cull_distance capability", |
| 401 | .dependencies = featureSet(&[_]Feature{ | 401 | .dependencies = featureSet(&[_]Feature{ |
| 402 | .v1_0, | 402 | .v1_0, |
| 403 | }), | 403 | }), |
| 404 | }; | 404 | }; |
| 405 | result[@intFromEnum(Feature.demote_to_helper_invocation)] = .{ | 405 | result[@backingInt(Feature.demote_to_helper_invocation)] = .{ |
| 406 | .llvm_name = null, | 406 | .llvm_name = null, |
| 407 | .description = "Enable demote_to_helper_invocation capability", | 407 | .description = "Enable demote_to_helper_invocation capability", |
| 408 | .dependencies = featureSet(&[_]Feature{ | 408 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -410,7 +410,7 @@ pub const all_features = blk: { | ... | @@ -410,7 +410,7 @@ pub const all_features = blk: { |
| 410 | .v1_6, | 410 | .v1_6, |
| 411 | }), | 411 | }), |
| 412 | }; | 412 | }; |
| 413 | result[@intFromEnum(Feature.denorm_flush_to_zero)] = .{ | 413 | result[@backingInt(Feature.denorm_flush_to_zero)] = .{ |
| 414 | .llvm_name = null, | 414 | .llvm_name = null, |
| 415 | .description = "Enable denorm_flush_to_zero capability", | 415 | .description = "Enable denorm_flush_to_zero capability", |
| 416 | .dependencies = featureSet(&[_]Feature{ | 416 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -418,7 +418,7 @@ pub const all_features = blk: { | ... | @@ -418,7 +418,7 @@ pub const all_features = blk: { |
| 418 | .v1_4, | 418 | .v1_4, |
| 419 | }), | 419 | }), |
| 420 | }; | 420 | }; |
| 421 | result[@intFromEnum(Feature.denorm_preserve)] = .{ | 421 | result[@backingInt(Feature.denorm_preserve)] = .{ |
| 422 | .llvm_name = null, | 422 | .llvm_name = null, |
| 423 | .description = "Enable denorm_preserve capability", | 423 | .description = "Enable denorm_preserve capability", |
| 424 | .dependencies = featureSet(&[_]Feature{ | 424 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -426,14 +426,14 @@ pub const all_features = blk: { | ... | @@ -426,14 +426,14 @@ pub const all_features = blk: { |
| 426 | .v1_4, | 426 | .v1_4, |
| 427 | }), | 427 | }), |
| 428 | }; | 428 | }; |
| 429 | result[@intFromEnum(Feature.derivative_control)] = .{ | 429 | result[@backingInt(Feature.derivative_control)] = .{ |
| 430 | .llvm_name = null, | 430 | .llvm_name = null, |
| 431 | .description = "Enable derivative_control capability", | 431 | .description = "Enable derivative_control capability", |
| 432 | .dependencies = featureSet(&[_]Feature{ | 432 | .dependencies = featureSet(&[_]Feature{ |
| 433 | .v1_0, | 433 | .v1_0, |
| 434 | }), | 434 | }), |
| 435 | }; | 435 | }; |
| 436 | result[@intFromEnum(Feature.descriptor_heap_ext)] = .{ | 436 | result[@backingInt(Feature.descriptor_heap_ext)] = .{ |
| 437 | .llvm_name = null, | 437 | .llvm_name = null, |
| 438 | .description = "Enable descriptor_heap_ext capability", | 438 | .description = "Enable descriptor_heap_ext capability", |
| 439 | .dependencies = featureSet(&[_]Feature{ | 439 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -441,14 +441,14 @@ pub const all_features = blk: { | ... | @@ -441,14 +441,14 @@ pub const all_features = blk: { |
| 441 | .v1_0, | 441 | .v1_0, |
| 442 | }), | 442 | }), |
| 443 | }; | 443 | }; |
| 444 | result[@intFromEnum(Feature.device_enqueue)] = .{ | 444 | result[@backingInt(Feature.device_enqueue)] = .{ |
| 445 | .llvm_name = null, | 445 | .llvm_name = null, |
| 446 | .description = "Enable device_enqueue capability", | 446 | .description = "Enable device_enqueue capability", |
| 447 | .dependencies = featureSet(&[_]Feature{ | 447 | .dependencies = featureSet(&[_]Feature{ |
| 448 | .v1_0, | 448 | .v1_0, |
| 449 | }), | 449 | }), |
| 450 | }; | 450 | }; |
| 451 | result[@intFromEnum(Feature.device_group)] = .{ | 451 | result[@backingInt(Feature.device_group)] = .{ |
| 452 | .llvm_name = null, | 452 | .llvm_name = null, |
| 453 | .description = "Enable device_group capability", | 453 | .description = "Enable device_group capability", |
| 454 | .dependencies = featureSet(&[_]Feature{ | 454 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -456,7 +456,7 @@ pub const all_features = blk: { | ... | @@ -456,7 +456,7 @@ pub const all_features = blk: { |
| 456 | .v1_3, | 456 | .v1_3, |
| 457 | }), | 457 | }), |
| 458 | }; | 458 | }; |
| 459 | result[@intFromEnum(Feature.dot_product)] = .{ | 459 | result[@backingInt(Feature.dot_product)] = .{ |
| 460 | .llvm_name = null, | 460 | .llvm_name = null, |
| 461 | .description = "Enable dot_product capability", | 461 | .description = "Enable dot_product capability", |
| 462 | .dependencies = featureSet(&[_]Feature{ | 462 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -464,7 +464,7 @@ pub const all_features = blk: { | ... | @@ -464,7 +464,7 @@ pub const all_features = blk: { |
| 464 | .v1_6, | 464 | .v1_6, |
| 465 | }), | 465 | }), |
| 466 | }; | 466 | }; |
| 467 | result[@intFromEnum(Feature.dot_product_input4x8bit)] = .{ | 467 | result[@backingInt(Feature.dot_product_input4x8bit)] = .{ |
| 468 | .llvm_name = null, | 468 | .llvm_name = null, |
| 469 | .description = "Enable dot_product_input4x8bit capability", | 469 | .description = "Enable dot_product_input4x8bit capability", |
| 470 | .dependencies = featureSet(&[_]Feature{ | 470 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -472,7 +472,7 @@ pub const all_features = blk: { | ... | @@ -472,7 +472,7 @@ pub const all_features = blk: { |
| 472 | .v1_6, | 472 | .v1_6, |
| 473 | }), | 473 | }), |
| 474 | }; | 474 | }; |
| 475 | result[@intFromEnum(Feature.dot_product_input4x8bit_packed)] = .{ | 475 | result[@backingInt(Feature.dot_product_input4x8bit_packed)] = .{ |
| 476 | .llvm_name = null, | 476 | .llvm_name = null, |
| 477 | .description = "Enable dot_product_input4x8bit_packed capability", | 477 | .description = "Enable dot_product_input4x8bit_packed capability", |
| 478 | .dependencies = featureSet(&[_]Feature{ | 478 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -480,7 +480,7 @@ pub const all_features = blk: { | ... | @@ -480,7 +480,7 @@ pub const all_features = blk: { |
| 480 | .v1_6, | 480 | .v1_6, |
| 481 | }), | 481 | }), |
| 482 | }; | 482 | }; |
| 483 | result[@intFromEnum(Feature.dot_product_input_all)] = .{ | 483 | result[@backingInt(Feature.dot_product_input_all)] = .{ |
| 484 | .llvm_name = null, | 484 | .llvm_name = null, |
| 485 | .description = "Enable dot_product_input_all capability", | 485 | .description = "Enable dot_product_input_all capability", |
| 486 | .dependencies = featureSet(&[_]Feature{ | 486 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -488,7 +488,7 @@ pub const all_features = blk: { | ... | @@ -488,7 +488,7 @@ pub const all_features = blk: { |
| 488 | .v1_6, | 488 | .v1_6, |
| 489 | }), | 489 | }), |
| 490 | }; | 490 | }; |
| 491 | result[@intFromEnum(Feature.draw_parameters)] = .{ | 491 | result[@backingInt(Feature.draw_parameters)] = .{ |
| 492 | .llvm_name = null, | 492 | .llvm_name = null, |
| 493 | .description = "Enable draw_parameters capability", | 493 | .description = "Enable draw_parameters capability", |
| 494 | .dependencies = featureSet(&[_]Feature{ | 494 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -496,7 +496,7 @@ pub const all_features = blk: { | ... | @@ -496,7 +496,7 @@ pub const all_features = blk: { |
| 496 | .v1_3, | 496 | .v1_3, |
| 497 | }), | 497 | }), |
| 498 | }; | 498 | }; |
| 499 | result[@intFromEnum(Feature.expect_assume_khr)] = .{ | 499 | result[@backingInt(Feature.expect_assume_khr)] = .{ |
| 500 | .llvm_name = null, | 500 | .llvm_name = null, |
| 501 | .description = "Enable expect_assume_khr capability", | 501 | .description = "Enable expect_assume_khr capability", |
| 502 | .dependencies = featureSet(&[_]Feature{ | 502 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -504,28 +504,28 @@ pub const all_features = blk: { | ... | @@ -504,28 +504,28 @@ pub const all_features = blk: { |
| 504 | .v1_0, | 504 | .v1_0, |
| 505 | }), | 505 | }), |
| 506 | }; | 506 | }; |
| 507 | result[@intFromEnum(Feature.float16)] = .{ | 507 | result[@backingInt(Feature.float16)] = .{ |
| 508 | .llvm_name = null, | 508 | .llvm_name = null, |
| 509 | .description = "Enable float16 capability", | 509 | .description = "Enable float16 capability", |
| 510 | .dependencies = featureSet(&[_]Feature{ | 510 | .dependencies = featureSet(&[_]Feature{ |
| 511 | .v1_0, | 511 | .v1_0, |
| 512 | }), | 512 | }), |
| 513 | }; | 513 | }; |
| 514 | result[@intFromEnum(Feature.float16buffer)] = .{ | 514 | result[@backingInt(Feature.float16buffer)] = .{ |
| 515 | .llvm_name = null, | 515 | .llvm_name = null, |
| 516 | .description = "Enable float16buffer capability", | 516 | .description = "Enable float16buffer capability", |
| 517 | .dependencies = featureSet(&[_]Feature{ | 517 | .dependencies = featureSet(&[_]Feature{ |
| 518 | .v1_0, | 518 | .v1_0, |
| 519 | }), | 519 | }), |
| 520 | }; | 520 | }; |
| 521 | result[@intFromEnum(Feature.float64)] = .{ | 521 | result[@backingInt(Feature.float64)] = .{ |
| 522 | .llvm_name = null, | 522 | .llvm_name = null, |
| 523 | .description = "Enable float64 capability", | 523 | .description = "Enable float64 capability", |
| 524 | .dependencies = featureSet(&[_]Feature{ | 524 | .dependencies = featureSet(&[_]Feature{ |
| 525 | .v1_0, | 525 | .v1_0, |
| 526 | }), | 526 | }), |
| 527 | }; | 527 | }; |
| 528 | result[@intFromEnum(Feature.float8cooperative_matrix_ext)] = .{ | 528 | result[@backingInt(Feature.float8cooperative_matrix_ext)] = .{ |
| 529 | .llvm_name = null, | 529 | .llvm_name = null, |
| 530 | .description = "Enable float8cooperative_matrix_ext capability", | 530 | .description = "Enable float8cooperative_matrix_ext capability", |
| 531 | .dependencies = featureSet(&[_]Feature{ | 531 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -533,7 +533,7 @@ pub const all_features = blk: { | ... | @@ -533,7 +533,7 @@ pub const all_features = blk: { |
| 533 | .v1_0, | 533 | .v1_0, |
| 534 | }), | 534 | }), |
| 535 | }; | 535 | }; |
| 536 | result[@intFromEnum(Feature.float8ext)] = .{ | 536 | result[@backingInt(Feature.float8ext)] = .{ |
| 537 | .llvm_name = null, | 537 | .llvm_name = null, |
| 538 | .description = "Enable float8ext capability", | 538 | .description = "Enable float8ext capability", |
| 539 | .dependencies = featureSet(&[_]Feature{ | 539 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -541,7 +541,7 @@ pub const all_features = blk: { | ... | @@ -541,7 +541,7 @@ pub const all_features = blk: { |
| 541 | .v1_0, | 541 | .v1_0, |
| 542 | }), | 542 | }), |
| 543 | }; | 543 | }; |
| 544 | result[@intFromEnum(Feature.float_controls2)] = .{ | 544 | result[@backingInt(Feature.float_controls2)] = .{ |
| 545 | .llvm_name = null, | 545 | .llvm_name = null, |
| 546 | .description = "Enable float_controls2 capability", | 546 | .description = "Enable float_controls2 capability", |
| 547 | .dependencies = featureSet(&[_]Feature{ | 547 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -549,7 +549,7 @@ pub const all_features = blk: { | ... | @@ -549,7 +549,7 @@ pub const all_features = blk: { |
| 549 | .v1_0, | 549 | .v1_0, |
| 550 | }), | 550 | }), |
| 551 | }; | 551 | }; |
| 552 | result[@intFromEnum(Feature.fmakhr)] = .{ | 552 | result[@backingInt(Feature.fmakhr)] = .{ |
| 553 | .llvm_name = null, | 553 | .llvm_name = null, |
| 554 | .description = "Enable fmakhr capability", | 554 | .description = "Enable fmakhr capability", |
| 555 | .dependencies = featureSet(&[_]Feature{ | 555 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -557,7 +557,7 @@ pub const all_features = blk: { | ... | @@ -557,7 +557,7 @@ pub const all_features = blk: { |
| 557 | .v1_0, | 557 | .v1_0, |
| 558 | }), | 558 | }), |
| 559 | }; | 559 | }; |
| 560 | result[@intFromEnum(Feature.fragment_barycentric_khr)] = .{ | 560 | result[@backingInt(Feature.fragment_barycentric_khr)] = .{ |
| 561 | .llvm_name = null, | 561 | .llvm_name = null, |
| 562 | .description = "Enable fragment_barycentric_khr capability", | 562 | .description = "Enable fragment_barycentric_khr capability", |
| 563 | .dependencies = featureSet(&[_]Feature{ | 563 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -565,7 +565,7 @@ pub const all_features = blk: { | ... | @@ -565,7 +565,7 @@ pub const all_features = blk: { |
| 565 | .v1_0, | 565 | .v1_0, |
| 566 | }), | 566 | }), |
| 567 | }; | 567 | }; |
| 568 | result[@intFromEnum(Feature.fragment_density_ext)] = .{ | 568 | result[@backingInt(Feature.fragment_density_ext)] = .{ |
| 569 | .llvm_name = null, | 569 | .llvm_name = null, |
| 570 | .description = "Enable fragment_density_ext capability", | 570 | .description = "Enable fragment_density_ext capability", |
| 571 | .dependencies = featureSet(&[_]Feature{ | 571 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -573,7 +573,7 @@ pub const all_features = blk: { | ... | @@ -573,7 +573,7 @@ pub const all_features = blk: { |
| 573 | .v1_0, | 573 | .v1_0, |
| 574 | }), | 574 | }), |
| 575 | }; | 575 | }; |
| 576 | result[@intFromEnum(Feature.fragment_fully_covered_ext)] = .{ | 576 | result[@backingInt(Feature.fragment_fully_covered_ext)] = .{ |
| 577 | .llvm_name = null, | 577 | .llvm_name = null, |
| 578 | .description = "Enable fragment_fully_covered_ext capability", | 578 | .description = "Enable fragment_fully_covered_ext capability", |
| 579 | .dependencies = featureSet(&[_]Feature{ | 579 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -581,7 +581,7 @@ pub const all_features = blk: { | ... | @@ -581,7 +581,7 @@ pub const all_features = blk: { |
| 581 | .v1_0, | 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 | .llvm_name = null, | 585 | .llvm_name = null, |
| 586 | .description = "Enable fragment_shader_pixel_interlock_ext capability", | 586 | .description = "Enable fragment_shader_pixel_interlock_ext capability", |
| 587 | .dependencies = featureSet(&[_]Feature{ | 587 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -589,7 +589,7 @@ pub const all_features = blk: { | ... | @@ -589,7 +589,7 @@ pub const all_features = blk: { |
| 589 | .v1_0, | 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 | .llvm_name = null, | 593 | .llvm_name = null, |
| 594 | .description = "Enable fragment_shader_sample_interlock_ext capability", | 594 | .description = "Enable fragment_shader_sample_interlock_ext capability", |
| 595 | .dependencies = featureSet(&[_]Feature{ | 595 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -597,7 +597,7 @@ pub const all_features = blk: { | ... | @@ -597,7 +597,7 @@ pub const all_features = blk: { |
| 597 | .v1_0, | 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 | .llvm_name = null, | 601 | .llvm_name = null, |
| 602 | .description = "Enable fragment_shader_shading_rate_interlock_ext capability", | 602 | .description = "Enable fragment_shader_shading_rate_interlock_ext capability", |
| 603 | .dependencies = featureSet(&[_]Feature{ | 603 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -605,7 +605,7 @@ pub const all_features = blk: { | ... | @@ -605,7 +605,7 @@ pub const all_features = blk: { |
| 605 | .v1_0, | 605 | .v1_0, |
| 606 | }), | 606 | }), |
| 607 | }; | 607 | }; |
| 608 | result[@intFromEnum(Feature.fragment_shading_rate_khr)] = .{ | 608 | result[@backingInt(Feature.fragment_shading_rate_khr)] = .{ |
| 609 | .llvm_name = null, | 609 | .llvm_name = null, |
| 610 | .description = "Enable fragment_shading_rate_khr capability", | 610 | .description = "Enable fragment_shading_rate_khr capability", |
| 611 | .dependencies = featureSet(&[_]Feature{ | 611 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -613,63 +613,63 @@ pub const all_features = blk: { | ... | @@ -613,63 +613,63 @@ pub const all_features = blk: { |
| 613 | .v1_0, | 613 | .v1_0, |
| 614 | }), | 614 | }), |
| 615 | }; | 615 | }; |
| 616 | result[@intFromEnum(Feature.generic_pointer)] = .{ | 616 | result[@backingInt(Feature.generic_pointer)] = .{ |
| 617 | .llvm_name = null, | 617 | .llvm_name = null, |
| 618 | .description = "Enable generic_pointer capability", | 618 | .description = "Enable generic_pointer capability", |
| 619 | .dependencies = featureSet(&[_]Feature{ | 619 | .dependencies = featureSet(&[_]Feature{ |
| 620 | .v1_0, | 620 | .v1_0, |
| 621 | }), | 621 | }), |
| 622 | }; | 622 | }; |
| 623 | result[@intFromEnum(Feature.geometry)] = .{ | 623 | result[@backingInt(Feature.geometry)] = .{ |
| 624 | .llvm_name = null, | 624 | .llvm_name = null, |
| 625 | .description = "Enable geometry capability", | 625 | .description = "Enable geometry capability", |
| 626 | .dependencies = featureSet(&[_]Feature{ | 626 | .dependencies = featureSet(&[_]Feature{ |
| 627 | .v1_0, | 627 | .v1_0, |
| 628 | }), | 628 | }), |
| 629 | }; | 629 | }; |
| 630 | result[@intFromEnum(Feature.geometry_point_size)] = .{ | 630 | result[@backingInt(Feature.geometry_point_size)] = .{ |
| 631 | .llvm_name = null, | 631 | .llvm_name = null, |
| 632 | .description = "Enable geometry_point_size capability", | 632 | .description = "Enable geometry_point_size capability", |
| 633 | .dependencies = featureSet(&[_]Feature{ | 633 | .dependencies = featureSet(&[_]Feature{ |
| 634 | .v1_0, | 634 | .v1_0, |
| 635 | }), | 635 | }), |
| 636 | }; | 636 | }; |
| 637 | result[@intFromEnum(Feature.geometry_streams)] = .{ | 637 | result[@backingInt(Feature.geometry_streams)] = .{ |
| 638 | .llvm_name = null, | 638 | .llvm_name = null, |
| 639 | .description = "Enable geometry_streams capability", | 639 | .description = "Enable geometry_streams capability", |
| 640 | .dependencies = featureSet(&[_]Feature{ | 640 | .dependencies = featureSet(&[_]Feature{ |
| 641 | .v1_0, | 641 | .v1_0, |
| 642 | }), | 642 | }), |
| 643 | }; | 643 | }; |
| 644 | result[@intFromEnum(Feature.group_non_uniform)] = .{ | 644 | result[@backingInt(Feature.group_non_uniform)] = .{ |
| 645 | .llvm_name = null, | 645 | .llvm_name = null, |
| 646 | .description = "Enable group_non_uniform capability", | 646 | .description = "Enable group_non_uniform capability", |
| 647 | .dependencies = featureSet(&[_]Feature{ | 647 | .dependencies = featureSet(&[_]Feature{ |
| 648 | .v1_3, | 648 | .v1_3, |
| 649 | }), | 649 | }), |
| 650 | }; | 650 | }; |
| 651 | result[@intFromEnum(Feature.group_non_uniform_arithmetic)] = .{ | 651 | result[@backingInt(Feature.group_non_uniform_arithmetic)] = .{ |
| 652 | .llvm_name = null, | 652 | .llvm_name = null, |
| 653 | .description = "Enable group_non_uniform_arithmetic capability", | 653 | .description = "Enable group_non_uniform_arithmetic capability", |
| 654 | .dependencies = featureSet(&[_]Feature{ | 654 | .dependencies = featureSet(&[_]Feature{ |
| 655 | .v1_3, | 655 | .v1_3, |
| 656 | }), | 656 | }), |
| 657 | }; | 657 | }; |
| 658 | result[@intFromEnum(Feature.group_non_uniform_ballot)] = .{ | 658 | result[@backingInt(Feature.group_non_uniform_ballot)] = .{ |
| 659 | .llvm_name = null, | 659 | .llvm_name = null, |
| 660 | .description = "Enable group_non_uniform_ballot capability", | 660 | .description = "Enable group_non_uniform_ballot capability", |
| 661 | .dependencies = featureSet(&[_]Feature{ | 661 | .dependencies = featureSet(&[_]Feature{ |
| 662 | .v1_3, | 662 | .v1_3, |
| 663 | }), | 663 | }), |
| 664 | }; | 664 | }; |
| 665 | result[@intFromEnum(Feature.group_non_uniform_clustered)] = .{ | 665 | result[@backingInt(Feature.group_non_uniform_clustered)] = .{ |
| 666 | .llvm_name = null, | 666 | .llvm_name = null, |
| 667 | .description = "Enable group_non_uniform_clustered capability", | 667 | .description = "Enable group_non_uniform_clustered capability", |
| 668 | .dependencies = featureSet(&[_]Feature{ | 668 | .dependencies = featureSet(&[_]Feature{ |
| 669 | .v1_3, | 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 | .llvm_name = null, | 673 | .llvm_name = null, |
| 674 | .description = "Enable group_non_uniform_partitioned_ext capability", | 674 | .description = "Enable group_non_uniform_partitioned_ext capability", |
| 675 | .dependencies = featureSet(&[_]Feature{ | 675 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -677,14 +677,14 @@ pub const all_features = blk: { | ... | @@ -677,14 +677,14 @@ pub const all_features = blk: { |
| 677 | .v1_0, | 677 | .v1_0, |
| 678 | }), | 678 | }), |
| 679 | }; | 679 | }; |
| 680 | result[@intFromEnum(Feature.group_non_uniform_quad)] = .{ | 680 | result[@backingInt(Feature.group_non_uniform_quad)] = .{ |
| 681 | .llvm_name = null, | 681 | .llvm_name = null, |
| 682 | .description = "Enable group_non_uniform_quad capability", | 682 | .description = "Enable group_non_uniform_quad capability", |
| 683 | .dependencies = featureSet(&[_]Feature{ | 683 | .dependencies = featureSet(&[_]Feature{ |
| 684 | .v1_3, | 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 | .llvm_name = null, | 688 | .llvm_name = null, |
| 689 | .description = "Enable group_non_uniform_rotate_khr capability", | 689 | .description = "Enable group_non_uniform_rotate_khr capability", |
| 690 | .dependencies = featureSet(&[_]Feature{ | 690 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -692,28 +692,28 @@ pub const all_features = blk: { | ... | @@ -692,28 +692,28 @@ pub const all_features = blk: { |
| 692 | .v1_0, | 692 | .v1_0, |
| 693 | }), | 693 | }), |
| 694 | }; | 694 | }; |
| 695 | result[@intFromEnum(Feature.group_non_uniform_shuffle)] = .{ | 695 | result[@backingInt(Feature.group_non_uniform_shuffle)] = .{ |
| 696 | .llvm_name = null, | 696 | .llvm_name = null, |
| 697 | .description = "Enable group_non_uniform_shuffle capability", | 697 | .description = "Enable group_non_uniform_shuffle capability", |
| 698 | .dependencies = featureSet(&[_]Feature{ | 698 | .dependencies = featureSet(&[_]Feature{ |
| 699 | .v1_3, | 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 | .llvm_name = null, | 703 | .llvm_name = null, |
| 704 | .description = "Enable group_non_uniform_shuffle_relative capability", | 704 | .description = "Enable group_non_uniform_shuffle_relative capability", |
| 705 | .dependencies = featureSet(&[_]Feature{ | 705 | .dependencies = featureSet(&[_]Feature{ |
| 706 | .v1_3, | 706 | .v1_3, |
| 707 | }), | 707 | }), |
| 708 | }; | 708 | }; |
| 709 | result[@intFromEnum(Feature.group_non_uniform_vote)] = .{ | 709 | result[@backingInt(Feature.group_non_uniform_vote)] = .{ |
| 710 | .llvm_name = null, | 710 | .llvm_name = null, |
| 711 | .description = "Enable group_non_uniform_vote capability", | 711 | .description = "Enable group_non_uniform_vote capability", |
| 712 | .dependencies = featureSet(&[_]Feature{ | 712 | .dependencies = featureSet(&[_]Feature{ |
| 713 | .v1_3, | 713 | .v1_3, |
| 714 | }), | 714 | }), |
| 715 | }; | 715 | }; |
| 716 | result[@intFromEnum(Feature.group_uniform_arithmetic_khr)] = .{ | 716 | result[@backingInt(Feature.group_uniform_arithmetic_khr)] = .{ |
| 717 | .llvm_name = null, | 717 | .llvm_name = null, |
| 718 | .description = "Enable group_uniform_arithmetic_khr capability", | 718 | .description = "Enable group_uniform_arithmetic_khr capability", |
| 719 | .dependencies = featureSet(&[_]Feature{ | 719 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -721,84 +721,84 @@ pub const all_features = blk: { | ... | @@ -721,84 +721,84 @@ pub const all_features = blk: { |
| 721 | .v1_0, | 721 | .v1_0, |
| 722 | }), | 722 | }), |
| 723 | }; | 723 | }; |
| 724 | result[@intFromEnum(Feature.groups)] = .{ | 724 | result[@backingInt(Feature.groups)] = .{ |
| 725 | .llvm_name = null, | 725 | .llvm_name = null, |
| 726 | .description = "Enable groups capability", | 726 | .description = "Enable groups capability", |
| 727 | .dependencies = featureSet(&[_]Feature{ | 727 | .dependencies = featureSet(&[_]Feature{ |
| 728 | .v1_0, | 728 | .v1_0, |
| 729 | }), | 729 | }), |
| 730 | }; | 730 | }; |
| 731 | result[@intFromEnum(Feature.image_basic)] = .{ | 731 | result[@backingInt(Feature.image_basic)] = .{ |
| 732 | .llvm_name = null, | 732 | .llvm_name = null, |
| 733 | .description = "Enable image_basic capability", | 733 | .description = "Enable image_basic capability", |
| 734 | .dependencies = featureSet(&[_]Feature{ | 734 | .dependencies = featureSet(&[_]Feature{ |
| 735 | .v1_0, | 735 | .v1_0, |
| 736 | }), | 736 | }), |
| 737 | }; | 737 | }; |
| 738 | result[@intFromEnum(Feature.image_buffer)] = .{ | 738 | result[@backingInt(Feature.image_buffer)] = .{ |
| 739 | .llvm_name = null, | 739 | .llvm_name = null, |
| 740 | .description = "Enable image_buffer capability", | 740 | .description = "Enable image_buffer capability", |
| 741 | .dependencies = featureSet(&[_]Feature{ | 741 | .dependencies = featureSet(&[_]Feature{ |
| 742 | .v1_0, | 742 | .v1_0, |
| 743 | }), | 743 | }), |
| 744 | }; | 744 | }; |
| 745 | result[@intFromEnum(Feature.image_cube_array)] = .{ | 745 | result[@backingInt(Feature.image_cube_array)] = .{ |
| 746 | .llvm_name = null, | 746 | .llvm_name = null, |
| 747 | .description = "Enable image_cube_array capability", | 747 | .description = "Enable image_cube_array capability", |
| 748 | .dependencies = featureSet(&[_]Feature{ | 748 | .dependencies = featureSet(&[_]Feature{ |
| 749 | .v1_0, | 749 | .v1_0, |
| 750 | }), | 750 | }), |
| 751 | }; | 751 | }; |
| 752 | result[@intFromEnum(Feature.image_gather_extended)] = .{ | 752 | result[@backingInt(Feature.image_gather_extended)] = .{ |
| 753 | .llvm_name = null, | 753 | .llvm_name = null, |
| 754 | .description = "Enable image_gather_extended capability", | 754 | .description = "Enable image_gather_extended capability", |
| 755 | .dependencies = featureSet(&[_]Feature{ | 755 | .dependencies = featureSet(&[_]Feature{ |
| 756 | .v1_0, | 756 | .v1_0, |
| 757 | }), | 757 | }), |
| 758 | }; | 758 | }; |
| 759 | result[@intFromEnum(Feature.image_mipmap)] = .{ | 759 | result[@backingInt(Feature.image_mipmap)] = .{ |
| 760 | .llvm_name = null, | 760 | .llvm_name = null, |
| 761 | .description = "Enable image_mipmap capability", | 761 | .description = "Enable image_mipmap capability", |
| 762 | .dependencies = featureSet(&[_]Feature{ | 762 | .dependencies = featureSet(&[_]Feature{ |
| 763 | .v1_0, | 763 | .v1_0, |
| 764 | }), | 764 | }), |
| 765 | }; | 765 | }; |
| 766 | result[@intFromEnum(Feature.image_ms_array)] = .{ | 766 | result[@backingInt(Feature.image_ms_array)] = .{ |
| 767 | .llvm_name = null, | 767 | .llvm_name = null, |
| 768 | .description = "Enable image_ms_array capability", | 768 | .description = "Enable image_ms_array capability", |
| 769 | .dependencies = featureSet(&[_]Feature{ | 769 | .dependencies = featureSet(&[_]Feature{ |
| 770 | .v1_0, | 770 | .v1_0, |
| 771 | }), | 771 | }), |
| 772 | }; | 772 | }; |
| 773 | result[@intFromEnum(Feature.image_query)] = .{ | 773 | result[@backingInt(Feature.image_query)] = .{ |
| 774 | .llvm_name = null, | 774 | .llvm_name = null, |
| 775 | .description = "Enable image_query capability", | 775 | .description = "Enable image_query capability", |
| 776 | .dependencies = featureSet(&[_]Feature{ | 776 | .dependencies = featureSet(&[_]Feature{ |
| 777 | .v1_0, | 777 | .v1_0, |
| 778 | }), | 778 | }), |
| 779 | }; | 779 | }; |
| 780 | result[@intFromEnum(Feature.image_read_write)] = .{ | 780 | result[@backingInt(Feature.image_read_write)] = .{ |
| 781 | .llvm_name = null, | 781 | .llvm_name = null, |
| 782 | .description = "Enable image_read_write capability", | 782 | .description = "Enable image_read_write capability", |
| 783 | .dependencies = featureSet(&[_]Feature{ | 783 | .dependencies = featureSet(&[_]Feature{ |
| 784 | .v1_0, | 784 | .v1_0, |
| 785 | }), | 785 | }), |
| 786 | }; | 786 | }; |
| 787 | result[@intFromEnum(Feature.image_rect)] = .{ | 787 | result[@backingInt(Feature.image_rect)] = .{ |
| 788 | .llvm_name = null, | 788 | .llvm_name = null, |
| 789 | .description = "Enable image_rect capability", | 789 | .description = "Enable image_rect capability", |
| 790 | .dependencies = featureSet(&[_]Feature{ | 790 | .dependencies = featureSet(&[_]Feature{ |
| 791 | .v1_0, | 791 | .v1_0, |
| 792 | }), | 792 | }), |
| 793 | }; | 793 | }; |
| 794 | result[@intFromEnum(Feature.input_attachment)] = .{ | 794 | result[@backingInt(Feature.input_attachment)] = .{ |
| 795 | .llvm_name = null, | 795 | .llvm_name = null, |
| 796 | .description = "Enable input_attachment capability", | 796 | .description = "Enable input_attachment capability", |
| 797 | .dependencies = featureSet(&[_]Feature{ | 797 | .dependencies = featureSet(&[_]Feature{ |
| 798 | .v1_0, | 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 | .llvm_name = null, | 802 | .llvm_name = null, |
| 803 | .description = "Enable input_attachment_array_dynamic_indexing capability", | 803 | .description = "Enable input_attachment_array_dynamic_indexing capability", |
| 804 | .dependencies = featureSet(&[_]Feature{ | 804 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -806,7 +806,7 @@ pub const all_features = blk: { | ... | @@ -806,7 +806,7 @@ pub const all_features = blk: { |
| 806 | .v1_5, | 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 | .llvm_name = null, | 810 | .llvm_name = null, |
| 811 | .description = "Enable input_attachment_array_non_uniform_indexing capability", | 811 | .description = "Enable input_attachment_array_non_uniform_indexing capability", |
| 812 | .dependencies = featureSet(&[_]Feature{ | 812 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -814,28 +814,28 @@ pub const all_features = blk: { | ... | @@ -814,28 +814,28 @@ pub const all_features = blk: { |
| 814 | .v1_5, | 814 | .v1_5, |
| 815 | }), | 815 | }), |
| 816 | }; | 816 | }; |
| 817 | result[@intFromEnum(Feature.int16)] = .{ | 817 | result[@backingInt(Feature.int16)] = .{ |
| 818 | .llvm_name = null, | 818 | .llvm_name = null, |
| 819 | .description = "Enable int16 capability", | 819 | .description = "Enable int16 capability", |
| 820 | .dependencies = featureSet(&[_]Feature{ | 820 | .dependencies = featureSet(&[_]Feature{ |
| 821 | .v1_0, | 821 | .v1_0, |
| 822 | }), | 822 | }), |
| 823 | }; | 823 | }; |
| 824 | result[@intFromEnum(Feature.int64)] = .{ | 824 | result[@backingInt(Feature.int64)] = .{ |
| 825 | .llvm_name = null, | 825 | .llvm_name = null, |
| 826 | .description = "Enable int64 capability", | 826 | .description = "Enable int64 capability", |
| 827 | .dependencies = featureSet(&[_]Feature{ | 827 | .dependencies = featureSet(&[_]Feature{ |
| 828 | .v1_0, | 828 | .v1_0, |
| 829 | }), | 829 | }), |
| 830 | }; | 830 | }; |
| 831 | result[@intFromEnum(Feature.int64atomics)] = .{ | 831 | result[@backingInt(Feature.int64atomics)] = .{ |
| 832 | .llvm_name = null, | 832 | .llvm_name = null, |
| 833 | .description = "Enable int64atomics capability", | 833 | .description = "Enable int64atomics capability", |
| 834 | .dependencies = featureSet(&[_]Feature{ | 834 | .dependencies = featureSet(&[_]Feature{ |
| 835 | .v1_0, | 835 | .v1_0, |
| 836 | }), | 836 | }), |
| 837 | }; | 837 | }; |
| 838 | result[@intFromEnum(Feature.int64image_ext)] = .{ | 838 | result[@backingInt(Feature.int64image_ext)] = .{ |
| 839 | .llvm_name = null, | 839 | .llvm_name = null, |
| 840 | .description = "Enable int64image_ext capability", | 840 | .description = "Enable int64image_ext capability", |
| 841 | .dependencies = featureSet(&[_]Feature{ | 841 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -843,28 +843,28 @@ pub const all_features = blk: { | ... | @@ -843,28 +843,28 @@ pub const all_features = blk: { |
| 843 | .v1_0, | 843 | .v1_0, |
| 844 | }), | 844 | }), |
| 845 | }; | 845 | }; |
| 846 | result[@intFromEnum(Feature.int8)] = .{ | 846 | result[@backingInt(Feature.int8)] = .{ |
| 847 | .llvm_name = null, | 847 | .llvm_name = null, |
| 848 | .description = "Enable int8 capability", | 848 | .description = "Enable int8 capability", |
| 849 | .dependencies = featureSet(&[_]Feature{ | 849 | .dependencies = featureSet(&[_]Feature{ |
| 850 | .v1_0, | 850 | .v1_0, |
| 851 | }), | 851 | }), |
| 852 | }; | 852 | }; |
| 853 | result[@intFromEnum(Feature.interpolation_function)] = .{ | 853 | result[@backingInt(Feature.interpolation_function)] = .{ |
| 854 | .llvm_name = null, | 854 | .llvm_name = null, |
| 855 | .description = "Enable interpolation_function capability", | 855 | .description = "Enable interpolation_function capability", |
| 856 | .dependencies = featureSet(&[_]Feature{ | 856 | .dependencies = featureSet(&[_]Feature{ |
| 857 | .v1_0, | 857 | .v1_0, |
| 858 | }), | 858 | }), |
| 859 | }; | 859 | }; |
| 860 | result[@intFromEnum(Feature.literal_sampler)] = .{ | 860 | result[@backingInt(Feature.literal_sampler)] = .{ |
| 861 | .llvm_name = null, | 861 | .llvm_name = null, |
| 862 | .description = "Enable literal_sampler capability", | 862 | .description = "Enable literal_sampler capability", |
| 863 | .dependencies = featureSet(&[_]Feature{ | 863 | .dependencies = featureSet(&[_]Feature{ |
| 864 | .v1_0, | 864 | .v1_0, |
| 865 | }), | 865 | }), |
| 866 | }; | 866 | }; |
| 867 | result[@intFromEnum(Feature.long_vector_ext)] = .{ | 867 | result[@backingInt(Feature.long_vector_ext)] = .{ |
| 868 | .llvm_name = null, | 868 | .llvm_name = null, |
| 869 | .description = "Enable long_vector_ext capability", | 869 | .description = "Enable long_vector_ext capability", |
| 870 | .dependencies = featureSet(&[_]Feature{ | 870 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -872,14 +872,14 @@ pub const all_features = blk: { | ... | @@ -872,14 +872,14 @@ pub const all_features = blk: { |
| 872 | .v1_0, | 872 | .v1_0, |
| 873 | }), | 873 | }), |
| 874 | }; | 874 | }; |
| 875 | result[@intFromEnum(Feature.matrix)] = .{ | 875 | result[@backingInt(Feature.matrix)] = .{ |
| 876 | .llvm_name = null, | 876 | .llvm_name = null, |
| 877 | .description = "Enable matrix capability", | 877 | .description = "Enable matrix capability", |
| 878 | .dependencies = featureSet(&[_]Feature{ | 878 | .dependencies = featureSet(&[_]Feature{ |
| 879 | .v1_0, | 879 | .v1_0, |
| 880 | }), | 880 | }), |
| 881 | }; | 881 | }; |
| 882 | result[@intFromEnum(Feature.mesh_shading_ext)] = .{ | 882 | result[@backingInt(Feature.mesh_shading_ext)] = .{ |
| 883 | .llvm_name = null, | 883 | .llvm_name = null, |
| 884 | .description = "Enable mesh_shading_ext capability", | 884 | .description = "Enable mesh_shading_ext capability", |
| 885 | .dependencies = featureSet(&[_]Feature{ | 885 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -887,14 +887,14 @@ pub const all_features = blk: { | ... | @@ -887,14 +887,14 @@ pub const all_features = blk: { |
| 887 | .v1_0, | 887 | .v1_0, |
| 888 | }), | 888 | }), |
| 889 | }; | 889 | }; |
| 890 | result[@intFromEnum(Feature.min_lod)] = .{ | 890 | result[@backingInt(Feature.min_lod)] = .{ |
| 891 | .llvm_name = null, | 891 | .llvm_name = null, |
| 892 | .description = "Enable min_lod capability", | 892 | .description = "Enable min_lod capability", |
| 893 | .dependencies = featureSet(&[_]Feature{ | 893 | .dependencies = featureSet(&[_]Feature{ |
| 894 | .v1_0, | 894 | .v1_0, |
| 895 | }), | 895 | }), |
| 896 | }; | 896 | }; |
| 897 | result[@intFromEnum(Feature.multi_view)] = .{ | 897 | result[@backingInt(Feature.multi_view)] = .{ |
| 898 | .llvm_name = null, | 898 | .llvm_name = null, |
| 899 | .description = "Enable multi_view capability", | 899 | .description = "Enable multi_view capability", |
| 900 | .dependencies = featureSet(&[_]Feature{ | 900 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -902,21 +902,21 @@ pub const all_features = blk: { | ... | @@ -902,21 +902,21 @@ pub const all_features = blk: { |
| 902 | .v1_3, | 902 | .v1_3, |
| 903 | }), | 903 | }), |
| 904 | }; | 904 | }; |
| 905 | result[@intFromEnum(Feature.multi_viewport)] = .{ | 905 | result[@backingInt(Feature.multi_viewport)] = .{ |
| 906 | .llvm_name = null, | 906 | .llvm_name = null, |
| 907 | .description = "Enable multi_viewport capability", | 907 | .description = "Enable multi_viewport capability", |
| 908 | .dependencies = featureSet(&[_]Feature{ | 908 | .dependencies = featureSet(&[_]Feature{ |
| 909 | .v1_0, | 909 | .v1_0, |
| 910 | }), | 910 | }), |
| 911 | }; | 911 | }; |
| 912 | result[@intFromEnum(Feature.named_barrier)] = .{ | 912 | result[@backingInt(Feature.named_barrier)] = .{ |
| 913 | .llvm_name = null, | 913 | .llvm_name = null, |
| 914 | .description = "Enable named_barrier capability", | 914 | .description = "Enable named_barrier capability", |
| 915 | .dependencies = featureSet(&[_]Feature{ | 915 | .dependencies = featureSet(&[_]Feature{ |
| 916 | .v1_1, | 916 | .v1_1, |
| 917 | }), | 917 | }), |
| 918 | }; | 918 | }; |
| 919 | result[@intFromEnum(Feature.opt_none_ext)] = .{ | 919 | result[@backingInt(Feature.opt_none_ext)] = .{ |
| 920 | .llvm_name = null, | 920 | .llvm_name = null, |
| 921 | .description = "Enable opt_none_ext capability", | 921 | .description = "Enable opt_none_ext capability", |
| 922 | .dependencies = featureSet(&[_]Feature{ | 922 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -924,21 +924,21 @@ pub const all_features = blk: { | ... | @@ -924,21 +924,21 @@ pub const all_features = blk: { |
| 924 | .v1_0, | 924 | .v1_0, |
| 925 | }), | 925 | }), |
| 926 | }; | 926 | }; |
| 927 | result[@intFromEnum(Feature.pipe_storage)] = .{ | 927 | result[@backingInt(Feature.pipe_storage)] = .{ |
| 928 | .llvm_name = null, | 928 | .llvm_name = null, |
| 929 | .description = "Enable pipe_storage capability", | 929 | .description = "Enable pipe_storage capability", |
| 930 | .dependencies = featureSet(&[_]Feature{ | 930 | .dependencies = featureSet(&[_]Feature{ |
| 931 | .v1_1, | 931 | .v1_1, |
| 932 | }), | 932 | }), |
| 933 | }; | 933 | }; |
| 934 | result[@intFromEnum(Feature.pipes)] = .{ | 934 | result[@backingInt(Feature.pipes)] = .{ |
| 935 | .llvm_name = null, | 935 | .llvm_name = null, |
| 936 | .description = "Enable pipes capability", | 936 | .description = "Enable pipes capability", |
| 937 | .dependencies = featureSet(&[_]Feature{ | 937 | .dependencies = featureSet(&[_]Feature{ |
| 938 | .v1_0, | 938 | .v1_0, |
| 939 | }), | 939 | }), |
| 940 | }; | 940 | }; |
| 941 | result[@intFromEnum(Feature.poison_freeze_khr)] = .{ | 941 | result[@backingInt(Feature.poison_freeze_khr)] = .{ |
| 942 | .llvm_name = null, | 942 | .llvm_name = null, |
| 943 | .description = "Enable poison_freeze_khr capability", | 943 | .description = "Enable poison_freeze_khr capability", |
| 944 | .dependencies = featureSet(&[_]Feature{ | 944 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -946,7 +946,7 @@ pub const all_features = blk: { | ... | @@ -946,7 +946,7 @@ pub const all_features = blk: { |
| 946 | .v1_0, | 946 | .v1_0, |
| 947 | }), | 947 | }), |
| 948 | }; | 948 | }; |
| 949 | result[@intFromEnum(Feature.quad_control_khr)] = .{ | 949 | result[@backingInt(Feature.quad_control_khr)] = .{ |
| 950 | .llvm_name = null, | 950 | .llvm_name = null, |
| 951 | .description = "Enable quad_control_khr capability", | 951 | .description = "Enable quad_control_khr capability", |
| 952 | .dependencies = featureSet(&[_]Feature{ | 952 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -954,7 +954,7 @@ pub const all_features = blk: { | ... | @@ -954,7 +954,7 @@ pub const all_features = blk: { |
| 954 | .v1_0, | 954 | .v1_0, |
| 955 | }), | 955 | }), |
| 956 | }; | 956 | }; |
| 957 | result[@intFromEnum(Feature.ray_cull_mask_khr)] = .{ | 957 | result[@backingInt(Feature.ray_cull_mask_khr)] = .{ |
| 958 | .llvm_name = null, | 958 | .llvm_name = null, |
| 959 | .description = "Enable ray_cull_mask_khr capability", | 959 | .description = "Enable ray_cull_mask_khr capability", |
| 960 | .dependencies = featureSet(&[_]Feature{ | 960 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -962,7 +962,7 @@ pub const all_features = blk: { | ... | @@ -962,7 +962,7 @@ pub const all_features = blk: { |
| 962 | .v1_0, | 962 | .v1_0, |
| 963 | }), | 963 | }), |
| 964 | }; | 964 | }; |
| 965 | result[@intFromEnum(Feature.ray_query_khr)] = .{ | 965 | result[@backingInt(Feature.ray_query_khr)] = .{ |
| 966 | .llvm_name = null, | 966 | .llvm_name = null, |
| 967 | .description = "Enable ray_query_khr capability", | 967 | .description = "Enable ray_query_khr capability", |
| 968 | .dependencies = featureSet(&[_]Feature{ | 968 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -970,7 +970,7 @@ pub const all_features = blk: { | ... | @@ -970,7 +970,7 @@ pub const all_features = blk: { |
| 970 | .v1_0, | 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 | .llvm_name = null, | 974 | .llvm_name = null, |
| 975 | .description = "Enable ray_query_position_fetch_khr capability", | 975 | .description = "Enable ray_query_position_fetch_khr capability", |
| 976 | .dependencies = featureSet(&[_]Feature{ | 976 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -978,7 +978,7 @@ pub const all_features = blk: { | ... | @@ -978,7 +978,7 @@ pub const all_features = blk: { |
| 978 | .v1_0, | 978 | .v1_0, |
| 979 | }), | 979 | }), |
| 980 | }; | 980 | }; |
| 981 | result[@intFromEnum(Feature.ray_query_provisional_khr)] = .{ | 981 | result[@backingInt(Feature.ray_query_provisional_khr)] = .{ |
| 982 | .llvm_name = null, | 982 | .llvm_name = null, |
| 983 | .description = "Enable ray_query_provisional_khr capability", | 983 | .description = "Enable ray_query_provisional_khr capability", |
| 984 | .dependencies = featureSet(&[_]Feature{ | 984 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -986,7 +986,7 @@ pub const all_features = blk: { | ... | @@ -986,7 +986,7 @@ pub const all_features = blk: { |
| 986 | .v1_0, | 986 | .v1_0, |
| 987 | }), | 987 | }), |
| 988 | }; | 988 | }; |
| 989 | result[@intFromEnum(Feature.ray_tracing_khr)] = .{ | 989 | result[@backingInt(Feature.ray_tracing_khr)] = .{ |
| 990 | .llvm_name = null, | 990 | .llvm_name = null, |
| 991 | .description = "Enable ray_tracing_khr capability", | 991 | .description = "Enable ray_tracing_khr capability", |
| 992 | .dependencies = featureSet(&[_]Feature{ | 992 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -994,7 +994,7 @@ pub const all_features = blk: { | ... | @@ -994,7 +994,7 @@ pub const all_features = blk: { |
| 994 | .v1_0, | 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 | .llvm_name = null, | 998 | .llvm_name = null, |
| 999 | .description = "Enable ray_tracing_opacity_micromap_ext capability", | 999 | .description = "Enable ray_tracing_opacity_micromap_ext capability", |
| 1000 | .dependencies = featureSet(&[_]Feature{ | 1000 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1002,7 +1002,7 @@ pub const all_features = blk: { | ... | @@ -1002,7 +1002,7 @@ pub const all_features = blk: { |
| 1002 | .v1_0, | 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 | .llvm_name = null, | 1006 | .llvm_name = null, |
| 1007 | .description = "Enable ray_tracing_position_fetch_khr capability", | 1007 | .description = "Enable ray_tracing_position_fetch_khr capability", |
| 1008 | .dependencies = featureSet(&[_]Feature{ | 1008 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1010,7 +1010,7 @@ pub const all_features = blk: { | ... | @@ -1010,7 +1010,7 @@ pub const all_features = blk: { |
| 1010 | .v1_0, | 1010 | .v1_0, |
| 1011 | }), | 1011 | }), |
| 1012 | }; | 1012 | }; |
| 1013 | result[@intFromEnum(Feature.ray_tracing_provisional_khr)] = .{ | 1013 | result[@backingInt(Feature.ray_tracing_provisional_khr)] = .{ |
| 1014 | .llvm_name = null, | 1014 | .llvm_name = null, |
| 1015 | .description = "Enable ray_tracing_provisional_khr capability", | 1015 | .description = "Enable ray_tracing_provisional_khr capability", |
| 1016 | .dependencies = featureSet(&[_]Feature{ | 1016 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1018,7 +1018,7 @@ pub const all_features = blk: { | ... | @@ -1018,7 +1018,7 @@ pub const all_features = blk: { |
| 1018 | .v1_0, | 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 | .llvm_name = null, | 1022 | .llvm_name = null, |
| 1023 | .description = "Enable ray_traversal_primitive_culling_khr capability", | 1023 | .description = "Enable ray_traversal_primitive_culling_khr capability", |
| 1024 | .dependencies = featureSet(&[_]Feature{ | 1024 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1027,7 +1027,7 @@ pub const all_features = blk: { | ... | @@ -1027,7 +1027,7 @@ pub const all_features = blk: { |
| 1027 | .v1_0, | 1027 | .v1_0, |
| 1028 | }), | 1028 | }), |
| 1029 | }; | 1029 | }; |
| 1030 | result[@intFromEnum(Feature.replicated_composites_ext)] = .{ | 1030 | result[@backingInt(Feature.replicated_composites_ext)] = .{ |
| 1031 | .llvm_name = null, | 1031 | .llvm_name = null, |
| 1032 | .description = "Enable replicated_composites_ext capability", | 1032 | .description = "Enable replicated_composites_ext capability", |
| 1033 | .dependencies = featureSet(&[_]Feature{ | 1033 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1035,7 +1035,7 @@ pub const all_features = blk: { | ... | @@ -1035,7 +1035,7 @@ pub const all_features = blk: { |
| 1035 | .v1_0, | 1035 | .v1_0, |
| 1036 | }), | 1036 | }), |
| 1037 | }; | 1037 | }; |
| 1038 | result[@intFromEnum(Feature.runtime_descriptor_array)] = .{ | 1038 | result[@backingInt(Feature.runtime_descriptor_array)] = .{ |
| 1039 | .llvm_name = null, | 1039 | .llvm_name = null, |
| 1040 | .description = "Enable runtime_descriptor_array capability", | 1040 | .description = "Enable runtime_descriptor_array capability", |
| 1041 | .dependencies = featureSet(&[_]Feature{ | 1041 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1043,7 +1043,7 @@ pub const all_features = blk: { | ... | @@ -1043,7 +1043,7 @@ pub const all_features = blk: { |
| 1043 | .v1_5, | 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 | .llvm_name = null, | 1047 | .llvm_name = null, |
| 1048 | .description = "Enable sample_mask_post_depth_coverage capability", | 1048 | .description = "Enable sample_mask_post_depth_coverage capability", |
| 1049 | .dependencies = featureSet(&[_]Feature{ | 1049 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1051,35 +1051,35 @@ pub const all_features = blk: { | ... | @@ -1051,35 +1051,35 @@ pub const all_features = blk: { |
| 1051 | .v1_0, | 1051 | .v1_0, |
| 1052 | }), | 1052 | }), |
| 1053 | }; | 1053 | }; |
| 1054 | result[@intFromEnum(Feature.sample_rate_shading)] = .{ | 1054 | result[@backingInt(Feature.sample_rate_shading)] = .{ |
| 1055 | .llvm_name = null, | 1055 | .llvm_name = null, |
| 1056 | .description = "Enable sample_rate_shading capability", | 1056 | .description = "Enable sample_rate_shading capability", |
| 1057 | .dependencies = featureSet(&[_]Feature{ | 1057 | .dependencies = featureSet(&[_]Feature{ |
| 1058 | .v1_0, | 1058 | .v1_0, |
| 1059 | }), | 1059 | }), |
| 1060 | }; | 1060 | }; |
| 1061 | result[@intFromEnum(Feature.sampled_buffer)] = .{ | 1061 | result[@backingInt(Feature.sampled_buffer)] = .{ |
| 1062 | .llvm_name = null, | 1062 | .llvm_name = null, |
| 1063 | .description = "Enable sampled_buffer capability", | 1063 | .description = "Enable sampled_buffer capability", |
| 1064 | .dependencies = featureSet(&[_]Feature{ | 1064 | .dependencies = featureSet(&[_]Feature{ |
| 1065 | .v1_0, | 1065 | .v1_0, |
| 1066 | }), | 1066 | }), |
| 1067 | }; | 1067 | }; |
| 1068 | result[@intFromEnum(Feature.sampled_cube_array)] = .{ | 1068 | result[@backingInt(Feature.sampled_cube_array)] = .{ |
| 1069 | .llvm_name = null, | 1069 | .llvm_name = null, |
| 1070 | .description = "Enable sampled_cube_array capability", | 1070 | .description = "Enable sampled_cube_array capability", |
| 1071 | .dependencies = featureSet(&[_]Feature{ | 1071 | .dependencies = featureSet(&[_]Feature{ |
| 1072 | .v1_0, | 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 | .llvm_name = null, | 1076 | .llvm_name = null, |
| 1077 | .description = "Enable sampled_image_array_dynamic_indexing capability", | 1077 | .description = "Enable sampled_image_array_dynamic_indexing capability", |
| 1078 | .dependencies = featureSet(&[_]Feature{ | 1078 | .dependencies = featureSet(&[_]Feature{ |
| 1079 | .v1_0, | 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 | .llvm_name = null, | 1083 | .llvm_name = null, |
| 1084 | .description = "Enable sampled_image_array_non_uniform_indexing capability", | 1084 | .description = "Enable sampled_image_array_non_uniform_indexing capability", |
| 1085 | .dependencies = featureSet(&[_]Feature{ | 1085 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1087,14 +1087,14 @@ pub const all_features = blk: { | ... | @@ -1087,14 +1087,14 @@ pub const all_features = blk: { |
| 1087 | .v1_5, | 1087 | .v1_5, |
| 1088 | }), | 1088 | }), |
| 1089 | }; | 1089 | }; |
| 1090 | result[@intFromEnum(Feature.sampled_rect)] = .{ | 1090 | result[@backingInt(Feature.sampled_rect)] = .{ |
| 1091 | .llvm_name = null, | 1091 | .llvm_name = null, |
| 1092 | .description = "Enable sampled_rect capability", | 1092 | .description = "Enable sampled_rect capability", |
| 1093 | .dependencies = featureSet(&[_]Feature{ | 1093 | .dependencies = featureSet(&[_]Feature{ |
| 1094 | .v1_0, | 1094 | .v1_0, |
| 1095 | }), | 1095 | }), |
| 1096 | }; | 1096 | }; |
| 1097 | result[@intFromEnum(Feature.shader64bit_indexing_ext)] = .{ | 1097 | result[@backingInt(Feature.shader64bit_indexing_ext)] = .{ |
| 1098 | .llvm_name = null, | 1098 | .llvm_name = null, |
| 1099 | .description = "Enable shader64bit_indexing_ext capability", | 1099 | .description = "Enable shader64bit_indexing_ext capability", |
| 1100 | .dependencies = featureSet(&[_]Feature{ | 1100 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1102,7 +1102,7 @@ pub const all_features = blk: { | ... | @@ -1102,7 +1102,7 @@ pub const all_features = blk: { |
| 1102 | .v1_0, | 1102 | .v1_0, |
| 1103 | }), | 1103 | }), |
| 1104 | }; | 1104 | }; |
| 1105 | result[@intFromEnum(Feature.shader_clock_khr)] = .{ | 1105 | result[@backingInt(Feature.shader_clock_khr)] = .{ |
| 1106 | .llvm_name = null, | 1106 | .llvm_name = null, |
| 1107 | .description = "Enable shader_clock_khr capability", | 1107 | .description = "Enable shader_clock_khr capability", |
| 1108 | .dependencies = featureSet(&[_]Feature{ | 1108 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1110,7 +1110,7 @@ pub const all_features = blk: { | ... | @@ -1110,7 +1110,7 @@ pub const all_features = blk: { |
| 1110 | .v1_0, | 1110 | .v1_0, |
| 1111 | }), | 1111 | }), |
| 1112 | }; | 1112 | }; |
| 1113 | result[@intFromEnum(Feature.shader_invocation_reorder_ext)] = .{ | 1113 | result[@backingInt(Feature.shader_invocation_reorder_ext)] = .{ |
| 1114 | .llvm_name = null, | 1114 | .llvm_name = null, |
| 1115 | .description = "Enable shader_invocation_reorder_ext capability", | 1115 | .description = "Enable shader_invocation_reorder_ext capability", |
| 1116 | .dependencies = featureSet(&[_]Feature{ | 1116 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1118,14 +1118,14 @@ pub const all_features = blk: { | ... | @@ -1118,14 +1118,14 @@ pub const all_features = blk: { |
| 1118 | .v1_0, | 1118 | .v1_0, |
| 1119 | }), | 1119 | }), |
| 1120 | }; | 1120 | }; |
| 1121 | result[@intFromEnum(Feature.shader_layer)] = .{ | 1121 | result[@backingInt(Feature.shader_layer)] = .{ |
| 1122 | .llvm_name = null, | 1122 | .llvm_name = null, |
| 1123 | .description = "Enable shader_layer capability", | 1123 | .description = "Enable shader_layer capability", |
| 1124 | .dependencies = featureSet(&[_]Feature{ | 1124 | .dependencies = featureSet(&[_]Feature{ |
| 1125 | .v1_5, | 1125 | .v1_5, |
| 1126 | }), | 1126 | }), |
| 1127 | }; | 1127 | }; |
| 1128 | result[@intFromEnum(Feature.shader_non_uniform)] = .{ | 1128 | result[@backingInt(Feature.shader_non_uniform)] = .{ |
| 1129 | .llvm_name = null, | 1129 | .llvm_name = null, |
| 1130 | .description = "Enable shader_non_uniform capability", | 1130 | .description = "Enable shader_non_uniform capability", |
| 1131 | .dependencies = featureSet(&[_]Feature{ | 1131 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1133,14 +1133,14 @@ pub const all_features = blk: { | ... | @@ -1133,14 +1133,14 @@ pub const all_features = blk: { |
| 1133 | .v1_5, | 1133 | .v1_5, |
| 1134 | }), | 1134 | }), |
| 1135 | }; | 1135 | }; |
| 1136 | result[@intFromEnum(Feature.shader_viewport_index)] = .{ | 1136 | result[@backingInt(Feature.shader_viewport_index)] = .{ |
| 1137 | .llvm_name = null, | 1137 | .llvm_name = null, |
| 1138 | .description = "Enable shader_viewport_index capability", | 1138 | .description = "Enable shader_viewport_index capability", |
| 1139 | .dependencies = featureSet(&[_]Feature{ | 1139 | .dependencies = featureSet(&[_]Feature{ |
| 1140 | .v1_5, | 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 | .llvm_name = null, | 1144 | .llvm_name = null, |
| 1145 | .description = "Enable shader_viewport_index_layer_ext capability", | 1145 | .description = "Enable shader_viewport_index_layer_ext capability", |
| 1146 | .dependencies = featureSet(&[_]Feature{ | 1146 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1148,7 +1148,7 @@ pub const all_features = blk: { | ... | @@ -1148,7 +1148,7 @@ pub const all_features = blk: { |
| 1148 | .v1_0, | 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 | .llvm_name = null, | 1152 | .llvm_name = null, |
| 1153 | .description = "Enable signed_zero_inf_nan_preserve capability", | 1153 | .description = "Enable signed_zero_inf_nan_preserve capability", |
| 1154 | .dependencies = featureSet(&[_]Feature{ | 1154 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1156,309 +1156,309 @@ pub const all_features = blk: { | ... | @@ -1156,309 +1156,309 @@ pub const all_features = blk: { |
| 1156 | .v1_4, | 1156 | .v1_4, |
| 1157 | }), | 1157 | }), |
| 1158 | }; | 1158 | }; |
| 1159 | result[@intFromEnum(Feature.sparse_residency)] = .{ | 1159 | result[@backingInt(Feature.sparse_residency)] = .{ |
| 1160 | .llvm_name = null, | 1160 | .llvm_name = null, |
| 1161 | .description = "Enable sparse_residency capability", | 1161 | .description = "Enable sparse_residency capability", |
| 1162 | .dependencies = featureSet(&[_]Feature{ | 1162 | .dependencies = featureSet(&[_]Feature{ |
| 1163 | .v1_0, | 1163 | .v1_0, |
| 1164 | }), | 1164 | }), |
| 1165 | }; | 1165 | }; |
| 1166 | result[@intFromEnum(Feature.SPV_EXT_arithmetic_fence)] = .{ | 1166 | result[@backingInt(Feature.SPV_EXT_arithmetic_fence)] = .{ |
| 1167 | .llvm_name = null, | 1167 | .llvm_name = null, |
| 1168 | .description = "Enable SPV_EXT_arithmetic_fence extension", | 1168 | .description = "Enable SPV_EXT_arithmetic_fence extension", |
| 1169 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1172 | .llvm_name = null, |
| 1173 | .description = "Enable SPV_EXT_demote_to_helper_invocation extension", | 1173 | .description = "Enable SPV_EXT_demote_to_helper_invocation extension", |
| 1174 | .dependencies = featureSet(&[_]Feature{}), | 1174 | .dependencies = featureSet(&[_]Feature{}), |
| 1175 | }; | 1175 | }; |
| 1176 | result[@intFromEnum(Feature.SPV_EXT_descriptor_heap)] = .{ | 1176 | result[@backingInt(Feature.SPV_EXT_descriptor_heap)] = .{ |
| 1177 | .llvm_name = null, | 1177 | .llvm_name = null, |
| 1178 | .description = "Enable SPV_EXT_descriptor_heap extension", | 1178 | .description = "Enable SPV_EXT_descriptor_heap extension", |
| 1179 | .dependencies = featureSet(&[_]Feature{}), | 1179 | .dependencies = featureSet(&[_]Feature{}), |
| 1180 | }; | 1180 | }; |
| 1181 | result[@intFromEnum(Feature.SPV_EXT_descriptor_indexing)] = .{ | 1181 | result[@backingInt(Feature.SPV_EXT_descriptor_indexing)] = .{ |
| 1182 | .llvm_name = null, | 1182 | .llvm_name = null, |
| 1183 | .description = "Enable SPV_EXT_descriptor_indexing extension", | 1183 | .description = "Enable SPV_EXT_descriptor_indexing extension", |
| 1184 | .dependencies = featureSet(&[_]Feature{}), | 1184 | .dependencies = featureSet(&[_]Feature{}), |
| 1185 | }; | 1185 | }; |
| 1186 | result[@intFromEnum(Feature.SPV_EXT_float8)] = .{ | 1186 | result[@backingInt(Feature.SPV_EXT_float8)] = .{ |
| 1187 | .llvm_name = null, | 1187 | .llvm_name = null, |
| 1188 | .description = "Enable SPV_EXT_float8 extension", | 1188 | .description = "Enable SPV_EXT_float8 extension", |
| 1189 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1192 | .llvm_name = null, |
| 1193 | .description = "Enable SPV_EXT_fragment_fully_covered extension", | 1193 | .description = "Enable SPV_EXT_fragment_fully_covered extension", |
| 1194 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1197 | .llvm_name = null, |
| 1198 | .description = "Enable SPV_EXT_fragment_invocation_density extension", | 1198 | .description = "Enable SPV_EXT_fragment_invocation_density extension", |
| 1199 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1202 | .llvm_name = null, |
| 1203 | .description = "Enable SPV_EXT_fragment_shader_interlock extension", | 1203 | .description = "Enable SPV_EXT_fragment_shader_interlock extension", |
| 1204 | .dependencies = featureSet(&[_]Feature{}), | 1204 | .dependencies = featureSet(&[_]Feature{}), |
| 1205 | }; | 1205 | }; |
| 1206 | result[@intFromEnum(Feature.SPV_EXT_long_vector)] = .{ | 1206 | result[@backingInt(Feature.SPV_EXT_long_vector)] = .{ |
| 1207 | .llvm_name = null, | 1207 | .llvm_name = null, |
| 1208 | .description = "Enable SPV_EXT_long_vector extension", | 1208 | .description = "Enable SPV_EXT_long_vector extension", |
| 1209 | .dependencies = featureSet(&[_]Feature{}), | 1209 | .dependencies = featureSet(&[_]Feature{}), |
| 1210 | }; | 1210 | }; |
| 1211 | result[@intFromEnum(Feature.SPV_EXT_mesh_shader)] = .{ | 1211 | result[@backingInt(Feature.SPV_EXT_mesh_shader)] = .{ |
| 1212 | .llvm_name = null, | 1212 | .llvm_name = null, |
| 1213 | .description = "Enable SPV_EXT_mesh_shader extension", | 1213 | .description = "Enable SPV_EXT_mesh_shader extension", |
| 1214 | .dependencies = featureSet(&[_]Feature{}), | 1214 | .dependencies = featureSet(&[_]Feature{}), |
| 1215 | }; | 1215 | }; |
| 1216 | result[@intFromEnum(Feature.SPV_EXT_opacity_micromap)] = .{ | 1216 | result[@backingInt(Feature.SPV_EXT_opacity_micromap)] = .{ |
| 1217 | .llvm_name = null, | 1217 | .llvm_name = null, |
| 1218 | .description = "Enable SPV_EXT_opacity_micromap extension", | 1218 | .description = "Enable SPV_EXT_opacity_micromap extension", |
| 1219 | .dependencies = featureSet(&[_]Feature{}), | 1219 | .dependencies = featureSet(&[_]Feature{}), |
| 1220 | }; | 1220 | }; |
| 1221 | result[@intFromEnum(Feature.SPV_EXT_optnone)] = .{ | 1221 | result[@backingInt(Feature.SPV_EXT_optnone)] = .{ |
| 1222 | .llvm_name = null, | 1222 | .llvm_name = null, |
| 1223 | .description = "Enable SPV_EXT_optnone extension", | 1223 | .description = "Enable SPV_EXT_optnone extension", |
| 1224 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1227 | .llvm_name = null, |
| 1228 | .description = "Enable SPV_EXT_physical_storage_buffer extension", | 1228 | .description = "Enable SPV_EXT_physical_storage_buffer extension", |
| 1229 | .dependencies = featureSet(&[_]Feature{}), | 1229 | .dependencies = featureSet(&[_]Feature{}), |
| 1230 | }; | 1230 | }; |
| 1231 | result[@intFromEnum(Feature.SPV_EXT_replicated_composites)] = .{ | 1231 | result[@backingInt(Feature.SPV_EXT_replicated_composites)] = .{ |
| 1232 | .llvm_name = null, | 1232 | .llvm_name = null, |
| 1233 | .description = "Enable SPV_EXT_replicated_composites extension", | 1233 | .description = "Enable SPV_EXT_replicated_composites extension", |
| 1234 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1237 | .llvm_name = null, |
| 1238 | .description = "Enable SPV_EXT_shader_64bit_indexing extension", | 1238 | .description = "Enable SPV_EXT_shader_64bit_indexing extension", |
| 1239 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1242 | .llvm_name = null, |
| 1243 | .description = "Enable SPV_EXT_shader_atomic_float16_add extension", | 1243 | .description = "Enable SPV_EXT_shader_atomic_float16_add extension", |
| 1244 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1247 | .llvm_name = null, |
| 1248 | .description = "Enable SPV_EXT_shader_atomic_float_add extension", | 1248 | .description = "Enable SPV_EXT_shader_atomic_float_add extension", |
| 1249 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1252 | .llvm_name = null, |
| 1253 | .description = "Enable SPV_EXT_shader_atomic_float_min_max extension", | 1253 | .description = "Enable SPV_EXT_shader_atomic_float_min_max extension", |
| 1254 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1257 | .llvm_name = null, |
| 1258 | .description = "Enable SPV_EXT_shader_image_int64 extension", | 1258 | .description = "Enable SPV_EXT_shader_image_int64 extension", |
| 1259 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1262 | .llvm_name = null, |
| 1263 | .description = "Enable SPV_EXT_shader_invocation_reorder extension", | 1263 | .description = "Enable SPV_EXT_shader_invocation_reorder extension", |
| 1264 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1267 | .llvm_name = null, |
| 1268 | .description = "Enable SPV_EXT_shader_stencil_export extension", | 1268 | .description = "Enable SPV_EXT_shader_stencil_export extension", |
| 1269 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1272 | .llvm_name = null, |
| 1273 | .description = "Enable SPV_EXT_shader_subgroup_partitioned extension", | 1273 | .description = "Enable SPV_EXT_shader_subgroup_partitioned extension", |
| 1274 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1277 | .llvm_name = null, |
| 1278 | .description = "Enable SPV_EXT_shader_tile_image extension", | 1278 | .description = "Enable SPV_EXT_shader_tile_image extension", |
| 1279 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1282 | .llvm_name = null, |
| 1283 | .description = "Enable SPV_EXT_shader_viewport_index_layer extension", | 1283 | .description = "Enable SPV_EXT_shader_viewport_index_layer extension", |
| 1284 | .dependencies = featureSet(&[_]Feature{}), | 1284 | .dependencies = featureSet(&[_]Feature{}), |
| 1285 | }; | 1285 | }; |
| 1286 | result[@intFromEnum(Feature.SPV_KHR_16bit_storage)] = .{ | 1286 | result[@backingInt(Feature.SPV_KHR_16bit_storage)] = .{ |
| 1287 | .llvm_name = null, | 1287 | .llvm_name = null, |
| 1288 | .description = "Enable SPV_KHR_16bit_storage extension", | 1288 | .description = "Enable SPV_KHR_16bit_storage extension", |
| 1289 | .dependencies = featureSet(&[_]Feature{}), | 1289 | .dependencies = featureSet(&[_]Feature{}), |
| 1290 | }; | 1290 | }; |
| 1291 | result[@intFromEnum(Feature.SPV_KHR_8bit_storage)] = .{ | 1291 | result[@backingInt(Feature.SPV_KHR_8bit_storage)] = .{ |
| 1292 | .llvm_name = null, | 1292 | .llvm_name = null, |
| 1293 | .description = "Enable SPV_KHR_8bit_storage extension", | 1293 | .description = "Enable SPV_KHR_8bit_storage extension", |
| 1294 | .dependencies = featureSet(&[_]Feature{}), | 1294 | .dependencies = featureSet(&[_]Feature{}), |
| 1295 | }; | 1295 | }; |
| 1296 | result[@intFromEnum(Feature.SPV_KHR_abort)] = .{ | 1296 | result[@backingInt(Feature.SPV_KHR_abort)] = .{ |
| 1297 | .llvm_name = null, | 1297 | .llvm_name = null, |
| 1298 | .description = "Enable SPV_KHR_abort extension", | 1298 | .description = "Enable SPV_KHR_abort extension", |
| 1299 | .dependencies = featureSet(&[_]Feature{}), | 1299 | .dependencies = featureSet(&[_]Feature{}), |
| 1300 | }; | 1300 | }; |
| 1301 | result[@intFromEnum(Feature.SPV_KHR_bfloat16)] = .{ | 1301 | result[@backingInt(Feature.SPV_KHR_bfloat16)] = .{ |
| 1302 | .llvm_name = null, | 1302 | .llvm_name = null, |
| 1303 | .description = "Enable SPV_KHR_bfloat16 extension", | 1303 | .description = "Enable SPV_KHR_bfloat16 extension", |
| 1304 | .dependencies = featureSet(&[_]Feature{}), | 1304 | .dependencies = featureSet(&[_]Feature{}), |
| 1305 | }; | 1305 | }; |
| 1306 | result[@intFromEnum(Feature.SPV_KHR_bit_instructions)] = .{ | 1306 | result[@backingInt(Feature.SPV_KHR_bit_instructions)] = .{ |
| 1307 | .llvm_name = null, | 1307 | .llvm_name = null, |
| 1308 | .description = "Enable SPV_KHR_bit_instructions extension", | 1308 | .description = "Enable SPV_KHR_bit_instructions extension", |
| 1309 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1312 | .llvm_name = null, |
| 1313 | .description = "Enable SPV_KHR_compute_shader_derivatives extension", | 1313 | .description = "Enable SPV_KHR_compute_shader_derivatives extension", |
| 1314 | .dependencies = featureSet(&[_]Feature{}), | 1314 | .dependencies = featureSet(&[_]Feature{}), |
| 1315 | }; | 1315 | }; |
| 1316 | result[@intFromEnum(Feature.SPV_KHR_constant_data)] = .{ | 1316 | result[@backingInt(Feature.SPV_KHR_constant_data)] = .{ |
| 1317 | .llvm_name = null, | 1317 | .llvm_name = null, |
| 1318 | .description = "Enable SPV_KHR_constant_data extension", | 1318 | .description = "Enable SPV_KHR_constant_data extension", |
| 1319 | .dependencies = featureSet(&[_]Feature{}), | 1319 | .dependencies = featureSet(&[_]Feature{}), |
| 1320 | }; | 1320 | }; |
| 1321 | result[@intFromEnum(Feature.SPV_KHR_cooperative_matrix)] = .{ | 1321 | result[@backingInt(Feature.SPV_KHR_cooperative_matrix)] = .{ |
| 1322 | .llvm_name = null, | 1322 | .llvm_name = null, |
| 1323 | .description = "Enable SPV_KHR_cooperative_matrix extension", | 1323 | .description = "Enable SPV_KHR_cooperative_matrix extension", |
| 1324 | .dependencies = featureSet(&[_]Feature{}), | 1324 | .dependencies = featureSet(&[_]Feature{}), |
| 1325 | }; | 1325 | }; |
| 1326 | result[@intFromEnum(Feature.SPV_KHR_device_group)] = .{ | 1326 | result[@backingInt(Feature.SPV_KHR_device_group)] = .{ |
| 1327 | .llvm_name = null, | 1327 | .llvm_name = null, |
| 1328 | .description = "Enable SPV_KHR_device_group extension", | 1328 | .description = "Enable SPV_KHR_device_group extension", |
| 1329 | .dependencies = featureSet(&[_]Feature{}), | 1329 | .dependencies = featureSet(&[_]Feature{}), |
| 1330 | }; | 1330 | }; |
| 1331 | result[@intFromEnum(Feature.SPV_KHR_expect_assume)] = .{ | 1331 | result[@backingInt(Feature.SPV_KHR_expect_assume)] = .{ |
| 1332 | .llvm_name = null, | 1332 | .llvm_name = null, |
| 1333 | .description = "Enable SPV_KHR_expect_assume extension", | 1333 | .description = "Enable SPV_KHR_expect_assume extension", |
| 1334 | .dependencies = featureSet(&[_]Feature{}), | 1334 | .dependencies = featureSet(&[_]Feature{}), |
| 1335 | }; | 1335 | }; |
| 1336 | result[@intFromEnum(Feature.SPV_KHR_float_controls)] = .{ | 1336 | result[@backingInt(Feature.SPV_KHR_float_controls)] = .{ |
| 1337 | .llvm_name = null, | 1337 | .llvm_name = null, |
| 1338 | .description = "Enable SPV_KHR_float_controls extension", | 1338 | .description = "Enable SPV_KHR_float_controls extension", |
| 1339 | .dependencies = featureSet(&[_]Feature{}), | 1339 | .dependencies = featureSet(&[_]Feature{}), |
| 1340 | }; | 1340 | }; |
| 1341 | result[@intFromEnum(Feature.SPV_KHR_float_controls2)] = .{ | 1341 | result[@backingInt(Feature.SPV_KHR_float_controls2)] = .{ |
| 1342 | .llvm_name = null, | 1342 | .llvm_name = null, |
| 1343 | .description = "Enable SPV_KHR_float_controls2 extension", | 1343 | .description = "Enable SPV_KHR_float_controls2 extension", |
| 1344 | .dependencies = featureSet(&[_]Feature{}), | 1344 | .dependencies = featureSet(&[_]Feature{}), |
| 1345 | }; | 1345 | }; |
| 1346 | result[@intFromEnum(Feature.SPV_KHR_fma)] = .{ | 1346 | result[@backingInt(Feature.SPV_KHR_fma)] = .{ |
| 1347 | .llvm_name = null, | 1347 | .llvm_name = null, |
| 1348 | .description = "Enable SPV_KHR_fma extension", | 1348 | .description = "Enable SPV_KHR_fma extension", |
| 1349 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1352 | .llvm_name = null, |
| 1353 | .description = "Enable SPV_KHR_fragment_shader_barycentric extension", | 1353 | .description = "Enable SPV_KHR_fragment_shader_barycentric extension", |
| 1354 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1357 | .llvm_name = null, |
| 1358 | .description = "Enable SPV_KHR_fragment_shading_rate extension", | 1358 | .description = "Enable SPV_KHR_fragment_shading_rate extension", |
| 1359 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1362 | .llvm_name = null, |
| 1363 | .description = "Enable SPV_KHR_integer_dot_product extension", | 1363 | .description = "Enable SPV_KHR_integer_dot_product extension", |
| 1364 | .dependencies = featureSet(&[_]Feature{}), | 1364 | .dependencies = featureSet(&[_]Feature{}), |
| 1365 | }; | 1365 | }; |
| 1366 | result[@intFromEnum(Feature.SPV_KHR_multiview)] = .{ | 1366 | result[@backingInt(Feature.SPV_KHR_multiview)] = .{ |
| 1367 | .llvm_name = null, | 1367 | .llvm_name = null, |
| 1368 | .description = "Enable SPV_KHR_multiview extension", | 1368 | .description = "Enable SPV_KHR_multiview extension", |
| 1369 | .dependencies = featureSet(&[_]Feature{}), | 1369 | .dependencies = featureSet(&[_]Feature{}), |
| 1370 | }; | 1370 | }; |
| 1371 | result[@intFromEnum(Feature.SPV_KHR_poison_freeze)] = .{ | 1371 | result[@backingInt(Feature.SPV_KHR_poison_freeze)] = .{ |
| 1372 | .llvm_name = null, | 1372 | .llvm_name = null, |
| 1373 | .description = "Enable SPV_KHR_poison_freeze extension", | 1373 | .description = "Enable SPV_KHR_poison_freeze extension", |
| 1374 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1377 | .llvm_name = null, |
| 1378 | .description = "Enable SPV_KHR_post_depth_coverage extension", | 1378 | .description = "Enable SPV_KHR_post_depth_coverage extension", |
| 1379 | .dependencies = featureSet(&[_]Feature{}), | 1379 | .dependencies = featureSet(&[_]Feature{}), |
| 1380 | }; | 1380 | }; |
| 1381 | result[@intFromEnum(Feature.SPV_KHR_quad_control)] = .{ | 1381 | result[@backingInt(Feature.SPV_KHR_quad_control)] = .{ |
| 1382 | .llvm_name = null, | 1382 | .llvm_name = null, |
| 1383 | .description = "Enable SPV_KHR_quad_control extension", | 1383 | .description = "Enable SPV_KHR_quad_control extension", |
| 1384 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1387 | .llvm_name = null, |
| 1388 | .description = "Enable SPV_KHR_ray_cull_mask extension", | 1388 | .description = "Enable SPV_KHR_ray_cull_mask extension", |
| 1389 | .dependencies = featureSet(&[_]Feature{}), | 1389 | .dependencies = featureSet(&[_]Feature{}), |
| 1390 | }; | 1390 | }; |
| 1391 | result[@intFromEnum(Feature.SPV_KHR_ray_query)] = .{ | 1391 | result[@backingInt(Feature.SPV_KHR_ray_query)] = .{ |
| 1392 | .llvm_name = null, | 1392 | .llvm_name = null, |
| 1393 | .description = "Enable SPV_KHR_ray_query extension", | 1393 | .description = "Enable SPV_KHR_ray_query extension", |
| 1394 | .dependencies = featureSet(&[_]Feature{}), | 1394 | .dependencies = featureSet(&[_]Feature{}), |
| 1395 | }; | 1395 | }; |
| 1396 | result[@intFromEnum(Feature.SPV_KHR_ray_tracing)] = .{ | 1396 | result[@backingInt(Feature.SPV_KHR_ray_tracing)] = .{ |
| 1397 | .llvm_name = null, | 1397 | .llvm_name = null, |
| 1398 | .description = "Enable SPV_KHR_ray_tracing extension", | 1398 | .description = "Enable SPV_KHR_ray_tracing extension", |
| 1399 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1402 | .llvm_name = null, |
| 1403 | .description = "Enable SPV_KHR_ray_tracing_position_fetch extension", | 1403 | .description = "Enable SPV_KHR_ray_tracing_position_fetch extension", |
| 1404 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1407 | .llvm_name = null, |
| 1408 | .description = "Enable SPV_KHR_shader_atomic_counter_ops extension", | 1408 | .description = "Enable SPV_KHR_shader_atomic_counter_ops extension", |
| 1409 | .dependencies = featureSet(&[_]Feature{}), | 1409 | .dependencies = featureSet(&[_]Feature{}), |
| 1410 | }; | 1410 | }; |
| 1411 | result[@intFromEnum(Feature.SPV_KHR_shader_ballot)] = .{ | 1411 | result[@backingInt(Feature.SPV_KHR_shader_ballot)] = .{ |
| 1412 | .llvm_name = null, | 1412 | .llvm_name = null, |
| 1413 | .description = "Enable SPV_KHR_shader_ballot extension", | 1413 | .description = "Enable SPV_KHR_shader_ballot extension", |
| 1414 | .dependencies = featureSet(&[_]Feature{}), | 1414 | .dependencies = featureSet(&[_]Feature{}), |
| 1415 | }; | 1415 | }; |
| 1416 | result[@intFromEnum(Feature.SPV_KHR_shader_clock)] = .{ | 1416 | result[@backingInt(Feature.SPV_KHR_shader_clock)] = .{ |
| 1417 | .llvm_name = null, | 1417 | .llvm_name = null, |
| 1418 | .description = "Enable SPV_KHR_shader_clock extension", | 1418 | .description = "Enable SPV_KHR_shader_clock extension", |
| 1419 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1422 | .llvm_name = null, |
| 1423 | .description = "Enable SPV_KHR_shader_draw_parameters extension", | 1423 | .description = "Enable SPV_KHR_shader_draw_parameters extension", |
| 1424 | .dependencies = featureSet(&[_]Feature{}), | 1424 | .dependencies = featureSet(&[_]Feature{}), |
| 1425 | }; | 1425 | }; |
| 1426 | result[@intFromEnum(Feature.SPV_KHR_subgroup_rotate)] = .{ | 1426 | result[@backingInt(Feature.SPV_KHR_subgroup_rotate)] = .{ |
| 1427 | .llvm_name = null, | 1427 | .llvm_name = null, |
| 1428 | .description = "Enable SPV_KHR_subgroup_rotate extension", | 1428 | .description = "Enable SPV_KHR_subgroup_rotate extension", |
| 1429 | .dependencies = featureSet(&[_]Feature{}), | 1429 | .dependencies = featureSet(&[_]Feature{}), |
| 1430 | }; | 1430 | }; |
| 1431 | result[@intFromEnum(Feature.SPV_KHR_subgroup_vote)] = .{ | 1431 | result[@backingInt(Feature.SPV_KHR_subgroup_vote)] = .{ |
| 1432 | .llvm_name = null, | 1432 | .llvm_name = null, |
| 1433 | .description = "Enable SPV_KHR_subgroup_vote extension", | 1433 | .description = "Enable SPV_KHR_subgroup_vote extension", |
| 1434 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1437 | .llvm_name = null, |
| 1438 | .description = "Enable SPV_KHR_uniform_group_instructions extension", | 1438 | .description = "Enable SPV_KHR_uniform_group_instructions extension", |
| 1439 | .dependencies = featureSet(&[_]Feature{}), | 1439 | .dependencies = featureSet(&[_]Feature{}), |
| 1440 | }; | 1440 | }; |
| 1441 | result[@intFromEnum(Feature.SPV_KHR_untyped_pointers)] = .{ | 1441 | result[@backingInt(Feature.SPV_KHR_untyped_pointers)] = .{ |
| 1442 | .llvm_name = null, | 1442 | .llvm_name = null, |
| 1443 | .description = "Enable SPV_KHR_untyped_pointers extension", | 1443 | .description = "Enable SPV_KHR_untyped_pointers extension", |
| 1444 | .dependencies = featureSet(&[_]Feature{}), | 1444 | .dependencies = featureSet(&[_]Feature{}), |
| 1445 | }; | 1445 | }; |
| 1446 | result[@intFromEnum(Feature.SPV_KHR_variable_pointers)] = .{ | 1446 | result[@backingInt(Feature.SPV_KHR_variable_pointers)] = .{ |
| 1447 | .llvm_name = null, | 1447 | .llvm_name = null, |
| 1448 | .description = "Enable SPV_KHR_variable_pointers extension", | 1448 | .description = "Enable SPV_KHR_variable_pointers extension", |
| 1449 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1452 | .llvm_name = null, |
| 1453 | .description = "Enable SPV_KHR_vulkan_memory_model extension", | 1453 | .description = "Enable SPV_KHR_vulkan_memory_model extension", |
| 1454 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 1457 | .llvm_name = null, |
| 1458 | .description = "Enable SPV_KHR_workgroup_memory_explicit_layout extension", | 1458 | .description = "Enable SPV_KHR_workgroup_memory_explicit_layout extension", |
| 1459 | .dependencies = featureSet(&[_]Feature{}), | 1459 | .dependencies = featureSet(&[_]Feature{}), |
| 1460 | }; | 1460 | }; |
| 1461 | result[@intFromEnum(Feature.stencil_export_ext)] = .{ | 1461 | result[@backingInt(Feature.stencil_export_ext)] = .{ |
| 1462 | .llvm_name = null, | 1462 | .llvm_name = null, |
| 1463 | .description = "Enable stencil_export_ext capability", | 1463 | .description = "Enable stencil_export_ext capability", |
| 1464 | .dependencies = featureSet(&[_]Feature{ | 1464 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1466,7 +1466,7 @@ pub const all_features = blk: { | ... | @@ -1466,7 +1466,7 @@ pub const all_features = blk: { |
| 1466 | .v1_0, | 1466 | .v1_0, |
| 1467 | }), | 1467 | }), |
| 1468 | }; | 1468 | }; |
| 1469 | result[@intFromEnum(Feature.storage_buffer16bit_access)] = .{ | 1469 | result[@backingInt(Feature.storage_buffer16bit_access)] = .{ |
| 1470 | .llvm_name = null, | 1470 | .llvm_name = null, |
| 1471 | .description = "Enable storage_buffer16bit_access capability", | 1471 | .description = "Enable storage_buffer16bit_access capability", |
| 1472 | .dependencies = featureSet(&[_]Feature{ | 1472 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1474,7 +1474,7 @@ pub const all_features = blk: { | ... | @@ -1474,7 +1474,7 @@ pub const all_features = blk: { |
| 1474 | .v1_3, | 1474 | .v1_3, |
| 1475 | }), | 1475 | }), |
| 1476 | }; | 1476 | }; |
| 1477 | result[@intFromEnum(Feature.storage_buffer8bit_access)] = .{ | 1477 | result[@backingInt(Feature.storage_buffer8bit_access)] = .{ |
| 1478 | .llvm_name = null, | 1478 | .llvm_name = null, |
| 1479 | .description = "Enable storage_buffer8bit_access capability", | 1479 | .description = "Enable storage_buffer8bit_access capability", |
| 1480 | .dependencies = featureSet(&[_]Feature{ | 1480 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1482,14 +1482,14 @@ pub const all_features = blk: { | ... | @@ -1482,14 +1482,14 @@ pub const all_features = blk: { |
| 1482 | .v1_5, | 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 | .llvm_name = null, | 1486 | .llvm_name = null, |
| 1487 | .description = "Enable storage_buffer_array_dynamic_indexing capability", | 1487 | .description = "Enable storage_buffer_array_dynamic_indexing capability", |
| 1488 | .dependencies = featureSet(&[_]Feature{ | 1488 | .dependencies = featureSet(&[_]Feature{ |
| 1489 | .v1_0, | 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 | .llvm_name = null, | 1493 | .llvm_name = null, |
| 1494 | .description = "Enable storage_buffer_array_non_uniform_indexing capability", | 1494 | .description = "Enable storage_buffer_array_non_uniform_indexing capability", |
| 1495 | .dependencies = featureSet(&[_]Feature{ | 1495 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1497,14 +1497,14 @@ pub const all_features = blk: { | ... | @@ -1497,14 +1497,14 @@ pub const all_features = blk: { |
| 1497 | .v1_5, | 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 | .llvm_name = null, | 1501 | .llvm_name = null, |
| 1502 | .description = "Enable storage_image_array_dynamic_indexing capability", | 1502 | .description = "Enable storage_image_array_dynamic_indexing capability", |
| 1503 | .dependencies = featureSet(&[_]Feature{ | 1503 | .dependencies = featureSet(&[_]Feature{ |
| 1504 | .v1_0, | 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 | .llvm_name = null, | 1508 | .llvm_name = null, |
| 1509 | .description = "Enable storage_image_array_non_uniform_indexing capability", | 1509 | .description = "Enable storage_image_array_non_uniform_indexing capability", |
| 1510 | .dependencies = featureSet(&[_]Feature{ | 1510 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1512,35 +1512,35 @@ pub const all_features = blk: { | ... | @@ -1512,35 +1512,35 @@ pub const all_features = blk: { |
| 1512 | .v1_5, | 1512 | .v1_5, |
| 1513 | }), | 1513 | }), |
| 1514 | }; | 1514 | }; |
| 1515 | result[@intFromEnum(Feature.storage_image_extended_formats)] = .{ | 1515 | result[@backingInt(Feature.storage_image_extended_formats)] = .{ |
| 1516 | .llvm_name = null, | 1516 | .llvm_name = null, |
| 1517 | .description = "Enable storage_image_extended_formats capability", | 1517 | .description = "Enable storage_image_extended_formats capability", |
| 1518 | .dependencies = featureSet(&[_]Feature{ | 1518 | .dependencies = featureSet(&[_]Feature{ |
| 1519 | .v1_0, | 1519 | .v1_0, |
| 1520 | }), | 1520 | }), |
| 1521 | }; | 1521 | }; |
| 1522 | result[@intFromEnum(Feature.storage_image_multisample)] = .{ | 1522 | result[@backingInt(Feature.storage_image_multisample)] = .{ |
| 1523 | .llvm_name = null, | 1523 | .llvm_name = null, |
| 1524 | .description = "Enable storage_image_multisample capability", | 1524 | .description = "Enable storage_image_multisample capability", |
| 1525 | .dependencies = featureSet(&[_]Feature{ | 1525 | .dependencies = featureSet(&[_]Feature{ |
| 1526 | .v1_0, | 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 | .llvm_name = null, | 1530 | .llvm_name = null, |
| 1531 | .description = "Enable storage_image_read_without_format capability", | 1531 | .description = "Enable storage_image_read_without_format capability", |
| 1532 | .dependencies = featureSet(&[_]Feature{ | 1532 | .dependencies = featureSet(&[_]Feature{ |
| 1533 | .v1_0, | 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 | .llvm_name = null, | 1537 | .llvm_name = null, |
| 1538 | .description = "Enable storage_image_write_without_format capability", | 1538 | .description = "Enable storage_image_write_without_format capability", |
| 1539 | .dependencies = featureSet(&[_]Feature{ | 1539 | .dependencies = featureSet(&[_]Feature{ |
| 1540 | .v1_0, | 1540 | .v1_0, |
| 1541 | }), | 1541 | }), |
| 1542 | }; | 1542 | }; |
| 1543 | result[@intFromEnum(Feature.storage_input_output16)] = .{ | 1543 | result[@backingInt(Feature.storage_input_output16)] = .{ |
| 1544 | .llvm_name = null, | 1544 | .llvm_name = null, |
| 1545 | .description = "Enable storage_input_output16 capability", | 1545 | .description = "Enable storage_input_output16 capability", |
| 1546 | .dependencies = featureSet(&[_]Feature{ | 1546 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1548,7 +1548,7 @@ pub const all_features = blk: { | ... | @@ -1548,7 +1548,7 @@ pub const all_features = blk: { |
| 1548 | .v1_3, | 1548 | .v1_3, |
| 1549 | }), | 1549 | }), |
| 1550 | }; | 1550 | }; |
| 1551 | result[@intFromEnum(Feature.storage_push_constant16)] = .{ | 1551 | result[@backingInt(Feature.storage_push_constant16)] = .{ |
| 1552 | .llvm_name = null, | 1552 | .llvm_name = null, |
| 1553 | .description = "Enable storage_push_constant16 capability", | 1553 | .description = "Enable storage_push_constant16 capability", |
| 1554 | .dependencies = featureSet(&[_]Feature{ | 1554 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1556,7 +1556,7 @@ pub const all_features = blk: { | ... | @@ -1556,7 +1556,7 @@ pub const all_features = blk: { |
| 1556 | .v1_3, | 1556 | .v1_3, |
| 1557 | }), | 1557 | }), |
| 1558 | }; | 1558 | }; |
| 1559 | result[@intFromEnum(Feature.storage_push_constant8)] = .{ | 1559 | result[@backingInt(Feature.storage_push_constant8)] = .{ |
| 1560 | .llvm_name = null, | 1560 | .llvm_name = null, |
| 1561 | .description = "Enable storage_push_constant8 capability", | 1561 | .description = "Enable storage_push_constant8 capability", |
| 1562 | .dependencies = featureSet(&[_]Feature{ | 1562 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1564,7 +1564,7 @@ pub const all_features = blk: { | ... | @@ -1564,7 +1564,7 @@ pub const all_features = blk: { |
| 1564 | .v1_5, | 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 | .llvm_name = null, | 1568 | .llvm_name = null, |
| 1569 | .description = "Enable storage_texel_buffer_array_dynamic_indexing capability", | 1569 | .description = "Enable storage_texel_buffer_array_dynamic_indexing capability", |
| 1570 | .dependencies = featureSet(&[_]Feature{ | 1570 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1572,7 +1572,7 @@ pub const all_features = blk: { | ... | @@ -1572,7 +1572,7 @@ pub const all_features = blk: { |
| 1572 | .v1_5, | 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 | .llvm_name = null, | 1576 | .llvm_name = null, |
| 1577 | .description = "Enable storage_texel_buffer_array_non_uniform_indexing capability", | 1577 | .description = "Enable storage_texel_buffer_array_non_uniform_indexing capability", |
| 1578 | .dependencies = featureSet(&[_]Feature{ | 1578 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1580,7 +1580,7 @@ pub const all_features = blk: { | ... | @@ -1580,7 +1580,7 @@ pub const all_features = blk: { |
| 1580 | .v1_5, | 1580 | .v1_5, |
| 1581 | }), | 1581 | }), |
| 1582 | }; | 1582 | }; |
| 1583 | result[@intFromEnum(Feature.subgroup_ballot_khr)] = .{ | 1583 | result[@backingInt(Feature.subgroup_ballot_khr)] = .{ |
| 1584 | .llvm_name = null, | 1584 | .llvm_name = null, |
| 1585 | .description = "Enable subgroup_ballot_khr capability", | 1585 | .description = "Enable subgroup_ballot_khr capability", |
| 1586 | .dependencies = featureSet(&[_]Feature{ | 1586 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1588,14 +1588,14 @@ pub const all_features = blk: { | ... | @@ -1588,14 +1588,14 @@ pub const all_features = blk: { |
| 1588 | .v1_0, | 1588 | .v1_0, |
| 1589 | }), | 1589 | }), |
| 1590 | }; | 1590 | }; |
| 1591 | result[@intFromEnum(Feature.subgroup_dispatch)] = .{ | 1591 | result[@backingInt(Feature.subgroup_dispatch)] = .{ |
| 1592 | .llvm_name = null, | 1592 | .llvm_name = null, |
| 1593 | .description = "Enable subgroup_dispatch capability", | 1593 | .description = "Enable subgroup_dispatch capability", |
| 1594 | .dependencies = featureSet(&[_]Feature{ | 1594 | .dependencies = featureSet(&[_]Feature{ |
| 1595 | .v1_1, | 1595 | .v1_1, |
| 1596 | }), | 1596 | }), |
| 1597 | }; | 1597 | }; |
| 1598 | result[@intFromEnum(Feature.subgroup_vote_khr)] = .{ | 1598 | result[@backingInt(Feature.subgroup_vote_khr)] = .{ |
| 1599 | .llvm_name = null, | 1599 | .llvm_name = null, |
| 1600 | .description = "Enable subgroup_vote_khr capability", | 1600 | .description = "Enable subgroup_vote_khr capability", |
| 1601 | .dependencies = featureSet(&[_]Feature{ | 1601 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1603,21 +1603,21 @@ pub const all_features = blk: { | ... | @@ -1603,21 +1603,21 @@ pub const all_features = blk: { |
| 1603 | .v1_0, | 1603 | .v1_0, |
| 1604 | }), | 1604 | }), |
| 1605 | }; | 1605 | }; |
| 1606 | result[@intFromEnum(Feature.tessellation)] = .{ | 1606 | result[@backingInt(Feature.tessellation)] = .{ |
| 1607 | .llvm_name = null, | 1607 | .llvm_name = null, |
| 1608 | .description = "Enable tessellation capability", | 1608 | .description = "Enable tessellation capability", |
| 1609 | .dependencies = featureSet(&[_]Feature{ | 1609 | .dependencies = featureSet(&[_]Feature{ |
| 1610 | .v1_0, | 1610 | .v1_0, |
| 1611 | }), | 1611 | }), |
| 1612 | }; | 1612 | }; |
| 1613 | result[@intFromEnum(Feature.tessellation_point_size)] = .{ | 1613 | result[@backingInt(Feature.tessellation_point_size)] = .{ |
| 1614 | .llvm_name = null, | 1614 | .llvm_name = null, |
| 1615 | .description = "Enable tessellation_point_size capability", | 1615 | .description = "Enable tessellation_point_size capability", |
| 1616 | .dependencies = featureSet(&[_]Feature{ | 1616 | .dependencies = featureSet(&[_]Feature{ |
| 1617 | .v1_0, | 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 | .llvm_name = null, | 1621 | .llvm_name = null, |
| 1622 | .description = "Enable tile_image_color_read_access_ext capability", | 1622 | .description = "Enable tile_image_color_read_access_ext capability", |
| 1623 | .dependencies = featureSet(&[_]Feature{ | 1623 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1625,7 +1625,7 @@ pub const all_features = blk: { | ... | @@ -1625,7 +1625,7 @@ pub const all_features = blk: { |
| 1625 | .v1_0, | 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 | .llvm_name = null, | 1629 | .llvm_name = null, |
| 1630 | .description = "Enable tile_image_depth_read_access_ext capability", | 1630 | .description = "Enable tile_image_depth_read_access_ext capability", |
| 1631 | .dependencies = featureSet(&[_]Feature{ | 1631 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1633,7 +1633,7 @@ pub const all_features = blk: { | ... | @@ -1633,7 +1633,7 @@ pub const all_features = blk: { |
| 1633 | .v1_0, | 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 | .llvm_name = null, | 1637 | .llvm_name = null, |
| 1638 | .description = "Enable tile_image_stencil_read_access_ext capability", | 1638 | .description = "Enable tile_image_stencil_read_access_ext capability", |
| 1639 | .dependencies = featureSet(&[_]Feature{ | 1639 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1641,14 +1641,14 @@ pub const all_features = blk: { | ... | @@ -1641,14 +1641,14 @@ pub const all_features = blk: { |
| 1641 | .v1_0, | 1641 | .v1_0, |
| 1642 | }), | 1642 | }), |
| 1643 | }; | 1643 | }; |
| 1644 | result[@intFromEnum(Feature.transform_feedback)] = .{ | 1644 | result[@backingInt(Feature.transform_feedback)] = .{ |
| 1645 | .llvm_name = null, | 1645 | .llvm_name = null, |
| 1646 | .description = "Enable transform_feedback capability", | 1646 | .description = "Enable transform_feedback capability", |
| 1647 | .dependencies = featureSet(&[_]Feature{ | 1647 | .dependencies = featureSet(&[_]Feature{ |
| 1648 | .v1_0, | 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 | .llvm_name = null, | 1652 | .llvm_name = null, |
| 1653 | .description = "Enable uniform_and_storage_buffer16bit_access capability", | 1653 | .description = "Enable uniform_and_storage_buffer16bit_access capability", |
| 1654 | .dependencies = featureSet(&[_]Feature{ | 1654 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1656,7 +1656,7 @@ pub const all_features = blk: { | ... | @@ -1656,7 +1656,7 @@ pub const all_features = blk: { |
| 1656 | .v1_3, | 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 | .llvm_name = null, | 1660 | .llvm_name = null, |
| 1661 | .description = "Enable uniform_and_storage_buffer8bit_access capability", | 1661 | .description = "Enable uniform_and_storage_buffer8bit_access capability", |
| 1662 | .dependencies = featureSet(&[_]Feature{ | 1662 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1664,14 +1664,14 @@ pub const all_features = blk: { | ... | @@ -1664,14 +1664,14 @@ pub const all_features = blk: { |
| 1664 | .v1_5, | 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 | .llvm_name = null, | 1668 | .llvm_name = null, |
| 1669 | .description = "Enable uniform_buffer_array_dynamic_indexing capability", | 1669 | .description = "Enable uniform_buffer_array_dynamic_indexing capability", |
| 1670 | .dependencies = featureSet(&[_]Feature{ | 1670 | .dependencies = featureSet(&[_]Feature{ |
| 1671 | .v1_0, | 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 | .llvm_name = null, | 1675 | .llvm_name = null, |
| 1676 | .description = "Enable uniform_buffer_array_non_uniform_indexing capability", | 1676 | .description = "Enable uniform_buffer_array_non_uniform_indexing capability", |
| 1677 | .dependencies = featureSet(&[_]Feature{ | 1677 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1679,14 +1679,14 @@ pub const all_features = blk: { | ... | @@ -1679,14 +1679,14 @@ pub const all_features = blk: { |
| 1679 | .v1_5, | 1679 | .v1_5, |
| 1680 | }), | 1680 | }), |
| 1681 | }; | 1681 | }; |
| 1682 | result[@intFromEnum(Feature.uniform_decoration)] = .{ | 1682 | result[@backingInt(Feature.uniform_decoration)] = .{ |
| 1683 | .llvm_name = null, | 1683 | .llvm_name = null, |
| 1684 | .description = "Enable uniform_decoration capability", | 1684 | .description = "Enable uniform_decoration capability", |
| 1685 | .dependencies = featureSet(&[_]Feature{ | 1685 | .dependencies = featureSet(&[_]Feature{ |
| 1686 | .v1_6, | 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 | .llvm_name = null, | 1690 | .llvm_name = null, |
| 1691 | .description = "Enable uniform_texel_buffer_array_dynamic_indexing capability", | 1691 | .description = "Enable uniform_texel_buffer_array_dynamic_indexing capability", |
| 1692 | .dependencies = featureSet(&[_]Feature{ | 1692 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1694,7 +1694,7 @@ pub const all_features = blk: { | ... | @@ -1694,7 +1694,7 @@ pub const all_features = blk: { |
| 1694 | .v1_5, | 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 | .llvm_name = null, | 1698 | .llvm_name = null, |
| 1699 | .description = "Enable uniform_texel_buffer_array_non_uniform_indexing capability", | 1699 | .description = "Enable uniform_texel_buffer_array_non_uniform_indexing capability", |
| 1700 | .dependencies = featureSet(&[_]Feature{ | 1700 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1702,7 +1702,7 @@ pub const all_features = blk: { | ... | @@ -1702,7 +1702,7 @@ pub const all_features = blk: { |
| 1702 | .v1_5, | 1702 | .v1_5, |
| 1703 | }), | 1703 | }), |
| 1704 | }; | 1704 | }; |
| 1705 | result[@intFromEnum(Feature.untyped_pointers_khr)] = .{ | 1705 | result[@backingInt(Feature.untyped_pointers_khr)] = .{ |
| 1706 | .llvm_name = null, | 1706 | .llvm_name = null, |
| 1707 | .description = "Enable untyped_pointers_khr capability", | 1707 | .description = "Enable untyped_pointers_khr capability", |
| 1708 | .dependencies = featureSet(&[_]Feature{ | 1708 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1710,54 +1710,54 @@ pub const all_features = blk: { | ... | @@ -1710,54 +1710,54 @@ pub const all_features = blk: { |
| 1710 | .v1_0, | 1710 | .v1_0, |
| 1711 | }), | 1711 | }), |
| 1712 | }; | 1712 | }; |
| 1713 | result[@intFromEnum(Feature.v1_0)] = .{ | 1713 | result[@backingInt(Feature.v1_0)] = .{ |
| 1714 | .llvm_name = null, | 1714 | .llvm_name = null, |
| 1715 | .description = "Enable v1_0 extension", | 1715 | .description = "Enable v1_0 extension", |
| 1716 | .dependencies = featureSet(&[_]Feature{}), | 1716 | .dependencies = featureSet(&[_]Feature{}), |
| 1717 | }; | 1717 | }; |
| 1718 | result[@intFromEnum(Feature.v1_1)] = .{ | 1718 | result[@backingInt(Feature.v1_1)] = .{ |
| 1719 | .llvm_name = null, | 1719 | .llvm_name = null, |
| 1720 | .description = "Enable v1_1 extension", | 1720 | .description = "Enable v1_1 extension", |
| 1721 | .dependencies = featureSet(&[_]Feature{ | 1721 | .dependencies = featureSet(&[_]Feature{ |
| 1722 | .v1_0, | 1722 | .v1_0, |
| 1723 | }), | 1723 | }), |
| 1724 | }; | 1724 | }; |
| 1725 | result[@intFromEnum(Feature.v1_2)] = .{ | 1725 | result[@backingInt(Feature.v1_2)] = .{ |
| 1726 | .llvm_name = null, | 1726 | .llvm_name = null, |
| 1727 | .description = "Enable v1_2 extension", | 1727 | .description = "Enable v1_2 extension", |
| 1728 | .dependencies = featureSet(&[_]Feature{ | 1728 | .dependencies = featureSet(&[_]Feature{ |
| 1729 | .v1_1, | 1729 | .v1_1, |
| 1730 | }), | 1730 | }), |
| 1731 | }; | 1731 | }; |
| 1732 | result[@intFromEnum(Feature.v1_3)] = .{ | 1732 | result[@backingInt(Feature.v1_3)] = .{ |
| 1733 | .llvm_name = null, | 1733 | .llvm_name = null, |
| 1734 | .description = "Enable v1_3 extension", | 1734 | .description = "Enable v1_3 extension", |
| 1735 | .dependencies = featureSet(&[_]Feature{ | 1735 | .dependencies = featureSet(&[_]Feature{ |
| 1736 | .v1_2, | 1736 | .v1_2, |
| 1737 | }), | 1737 | }), |
| 1738 | }; | 1738 | }; |
| 1739 | result[@intFromEnum(Feature.v1_4)] = .{ | 1739 | result[@backingInt(Feature.v1_4)] = .{ |
| 1740 | .llvm_name = null, | 1740 | .llvm_name = null, |
| 1741 | .description = "Enable v1_4 extension", | 1741 | .description = "Enable v1_4 extension", |
| 1742 | .dependencies = featureSet(&[_]Feature{ | 1742 | .dependencies = featureSet(&[_]Feature{ |
| 1743 | .v1_3, | 1743 | .v1_3, |
| 1744 | }), | 1744 | }), |
| 1745 | }; | 1745 | }; |
| 1746 | result[@intFromEnum(Feature.v1_5)] = .{ | 1746 | result[@backingInt(Feature.v1_5)] = .{ |
| 1747 | .llvm_name = null, | 1747 | .llvm_name = null, |
| 1748 | .description = "Enable v1_5 extension", | 1748 | .description = "Enable v1_5 extension", |
| 1749 | .dependencies = featureSet(&[_]Feature{ | 1749 | .dependencies = featureSet(&[_]Feature{ |
| 1750 | .v1_4, | 1750 | .v1_4, |
| 1751 | }), | 1751 | }), |
| 1752 | }; | 1752 | }; |
| 1753 | result[@intFromEnum(Feature.v1_6)] = .{ | 1753 | result[@backingInt(Feature.v1_6)] = .{ |
| 1754 | .llvm_name = null, | 1754 | .llvm_name = null, |
| 1755 | .description = "Enable v1_6 extension", | 1755 | .description = "Enable v1_6 extension", |
| 1756 | .dependencies = featureSet(&[_]Feature{ | 1756 | .dependencies = featureSet(&[_]Feature{ |
| 1757 | .v1_5, | 1757 | .v1_5, |
| 1758 | }), | 1758 | }), |
| 1759 | }; | 1759 | }; |
| 1760 | result[@intFromEnum(Feature.variable_pointers)] = .{ | 1760 | result[@backingInt(Feature.variable_pointers)] = .{ |
| 1761 | .llvm_name = null, | 1761 | .llvm_name = null, |
| 1762 | .description = "Enable variable_pointers capability", | 1762 | .description = "Enable variable_pointers capability", |
| 1763 | .dependencies = featureSet(&[_]Feature{ | 1763 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1765,7 +1765,7 @@ pub const all_features = blk: { | ... | @@ -1765,7 +1765,7 @@ pub const all_features = blk: { |
| 1765 | .v1_3, | 1765 | .v1_3, |
| 1766 | }), | 1766 | }), |
| 1767 | }; | 1767 | }; |
| 1768 | result[@intFromEnum(Feature.variable_pointers_storage_buffer)] = .{ | 1768 | result[@backingInt(Feature.variable_pointers_storage_buffer)] = .{ |
| 1769 | .llvm_name = null, | 1769 | .llvm_name = null, |
| 1770 | .description = "Enable variable_pointers_storage_buffer capability", | 1770 | .description = "Enable variable_pointers_storage_buffer capability", |
| 1771 | .dependencies = featureSet(&[_]Feature{ | 1771 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1773,14 +1773,14 @@ pub const all_features = blk: { | ... | @@ -1773,14 +1773,14 @@ pub const all_features = blk: { |
| 1773 | .v1_3, | 1773 | .v1_3, |
| 1774 | }), | 1774 | }), |
| 1775 | }; | 1775 | }; |
| 1776 | result[@intFromEnum(Feature.vector16)] = .{ | 1776 | result[@backingInt(Feature.vector16)] = .{ |
| 1777 | .llvm_name = null, | 1777 | .llvm_name = null, |
| 1778 | .description = "Enable vector16 capability", | 1778 | .description = "Enable vector16 capability", |
| 1779 | .dependencies = featureSet(&[_]Feature{ | 1779 | .dependencies = featureSet(&[_]Feature{ |
| 1780 | .v1_0, | 1780 | .v1_0, |
| 1781 | }), | 1781 | }), |
| 1782 | }; | 1782 | }; |
| 1783 | result[@intFromEnum(Feature.vulkan_memory_model)] = .{ | 1783 | result[@backingInt(Feature.vulkan_memory_model)] = .{ |
| 1784 | .llvm_name = null, | 1784 | .llvm_name = null, |
| 1785 | .description = "Enable vulkan_memory_model capability", | 1785 | .description = "Enable vulkan_memory_model capability", |
| 1786 | .dependencies = featureSet(&[_]Feature{ | 1786 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1788,7 +1788,7 @@ pub const all_features = blk: { | ... | @@ -1788,7 +1788,7 @@ pub const all_features = blk: { |
| 1788 | .v1_5, | 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 | .llvm_name = null, | 1792 | .llvm_name = null, |
| 1793 | .description = "Enable vulkan_memory_model_device_scope capability", | 1793 | .description = "Enable vulkan_memory_model_device_scope capability", |
| 1794 | .dependencies = featureSet(&[_]Feature{ | 1794 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1796,7 +1796,7 @@ pub const all_features = blk: { | ... | @@ -1796,7 +1796,7 @@ pub const all_features = blk: { |
| 1796 | .v1_5, | 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 | .llvm_name = null, | 1800 | .llvm_name = null, |
| 1801 | .description = "Enable workgroup_memory_explicit_layout16bit_access_khr capability", | 1801 | .description = "Enable workgroup_memory_explicit_layout16bit_access_khr capability", |
| 1802 | .dependencies = featureSet(&[_]Feature{ | 1802 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1804,7 +1804,7 @@ pub const all_features = blk: { | ... | @@ -1804,7 +1804,7 @@ pub const all_features = blk: { |
| 1804 | .v1_0, | 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 | .llvm_name = null, | 1808 | .llvm_name = null, |
| 1809 | .description = "Enable workgroup_memory_explicit_layout8bit_access_khr capability", | 1809 | .description = "Enable workgroup_memory_explicit_layout8bit_access_khr capability", |
| 1810 | .dependencies = featureSet(&[_]Feature{ | 1810 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1812,7 +1812,7 @@ pub const all_features = blk: { | ... | @@ -1812,7 +1812,7 @@ pub const all_features = blk: { |
| 1812 | .v1_0, | 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 | .llvm_name = null, | 1816 | .llvm_name = null, |
| 1817 | .description = "Enable workgroup_memory_explicit_layout_khr capability", | 1817 | .description = "Enable workgroup_memory_explicit_layout_khr capability", |
| 1818 | .dependencies = featureSet(&[_]Feature{ | 1818 | .dependencies = featureSet(&[_]Feature{ |
lib/std/Target/ve.zig+1-1| ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { | ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { |
| 17 | const len = @typeInfo(Feature).@"enum".field_names.len; | 17 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 19 | var result: [len]CpuFeature = undefined; | 19 | var result: [len]CpuFeature = undefined; |
| 20 | result[@intFromEnum(Feature.vpu)] = .{ | 20 | result[@backingInt(Feature.vpu)] = .{ |
| 21 | .llvm_name = "vpu", | 21 | .llvm_name = "vpu", |
| 22 | .description = "Enable the VPU", | 22 | .description = "Enable the VPU", |
| 23 | .dependencies = featureSet(&[_]Feature{}), | 23 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/wasm.zig+19-19| ... | @@ -35,103 +35,103 @@ pub const all_features = blk: { | ... | @@ -35,103 +35,103 @@ pub const all_features = blk: { |
| 35 | const len = @typeInfo(Feature).@"enum".field_names.len; | 35 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 36 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 36 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 37 | var result: [len]CpuFeature = undefined; | 37 | var result: [len]CpuFeature = undefined; |
| 38 | result[@intFromEnum(Feature.atomics)] = .{ | 38 | result[@backingInt(Feature.atomics)] = .{ |
| 39 | .llvm_name = "atomics", | 39 | .llvm_name = "atomics", |
| 40 | .description = "Enable Atomics", | 40 | .description = "Enable Atomics", |
| 41 | .dependencies = featureSet(&[_]Feature{}), | 41 | .dependencies = featureSet(&[_]Feature{}), |
| 42 | }; | 42 | }; |
| 43 | result[@intFromEnum(Feature.bulk_memory)] = .{ | 43 | result[@backingInt(Feature.bulk_memory)] = .{ |
| 44 | .llvm_name = "bulk-memory", | 44 | .llvm_name = "bulk-memory", |
| 45 | .description = "Enable bulk memory operations", | 45 | .description = "Enable bulk memory operations", |
| 46 | .dependencies = featureSet(&[_]Feature{ | 46 | .dependencies = featureSet(&[_]Feature{ |
| 47 | .bulk_memory_opt, | 47 | .bulk_memory_opt, |
| 48 | }), | 48 | }), |
| 49 | }; | 49 | }; |
| 50 | result[@intFromEnum(Feature.bulk_memory_opt)] = .{ | 50 | result[@backingInt(Feature.bulk_memory_opt)] = .{ |
| 51 | .llvm_name = "bulk-memory-opt", | 51 | .llvm_name = "bulk-memory-opt", |
| 52 | .description = "Enable bulk memory optimization operations", | 52 | .description = "Enable bulk memory optimization operations", |
| 53 | .dependencies = featureSet(&[_]Feature{}), | 53 | .dependencies = featureSet(&[_]Feature{}), |
| 54 | }; | 54 | }; |
| 55 | result[@intFromEnum(Feature.call_indirect_overlong)] = .{ | 55 | result[@backingInt(Feature.call_indirect_overlong)] = .{ |
| 56 | .llvm_name = "call-indirect-overlong", | 56 | .llvm_name = "call-indirect-overlong", |
| 57 | .description = "Enable overlong encoding for call_indirect immediates", | 57 | .description = "Enable overlong encoding for call_indirect immediates", |
| 58 | .dependencies = featureSet(&[_]Feature{}), | 58 | .dependencies = featureSet(&[_]Feature{}), |
| 59 | }; | 59 | }; |
| 60 | result[@intFromEnum(Feature.exception_handling)] = .{ | 60 | result[@backingInt(Feature.exception_handling)] = .{ |
| 61 | .llvm_name = "exception-handling", | 61 | .llvm_name = "exception-handling", |
| 62 | .description = "Enable Wasm exception handling", | 62 | .description = "Enable Wasm exception handling", |
| 63 | .dependencies = featureSet(&[_]Feature{}), | 63 | .dependencies = featureSet(&[_]Feature{}), |
| 64 | }; | 64 | }; |
| 65 | result[@intFromEnum(Feature.extended_const)] = .{ | 65 | result[@backingInt(Feature.extended_const)] = .{ |
| 66 | .llvm_name = "extended-const", | 66 | .llvm_name = "extended-const", |
| 67 | .description = "Enable extended const expressions", | 67 | .description = "Enable extended const expressions", |
| 68 | .dependencies = featureSet(&[_]Feature{}), | 68 | .dependencies = featureSet(&[_]Feature{}), |
| 69 | }; | 69 | }; |
| 70 | result[@intFromEnum(Feature.fp16)] = .{ | 70 | result[@backingInt(Feature.fp16)] = .{ |
| 71 | .llvm_name = "fp16", | 71 | .llvm_name = "fp16", |
| 72 | .description = "Enable FP16 instructions", | 72 | .description = "Enable FP16 instructions", |
| 73 | .dependencies = featureSet(&[_]Feature{}), | 73 | .dependencies = featureSet(&[_]Feature{}), |
| 74 | }; | 74 | }; |
| 75 | result[@intFromEnum(Feature.gc)] = .{ | 75 | result[@backingInt(Feature.gc)] = .{ |
| 76 | .llvm_name = "gc", | 76 | .llvm_name = "gc", |
| 77 | .description = "Enable wasm gc", | 77 | .description = "Enable wasm gc", |
| 78 | .dependencies = featureSet(&[_]Feature{}), | 78 | .dependencies = featureSet(&[_]Feature{}), |
| 79 | }; | 79 | }; |
| 80 | result[@intFromEnum(Feature.multimemory)] = .{ | 80 | result[@backingInt(Feature.multimemory)] = .{ |
| 81 | .llvm_name = "multimemory", | 81 | .llvm_name = "multimemory", |
| 82 | .description = "Enable multiple memories", | 82 | .description = "Enable multiple memories", |
| 83 | .dependencies = featureSet(&[_]Feature{}), | 83 | .dependencies = featureSet(&[_]Feature{}), |
| 84 | }; | 84 | }; |
| 85 | result[@intFromEnum(Feature.multivalue)] = .{ | 85 | result[@backingInt(Feature.multivalue)] = .{ |
| 86 | .llvm_name = "multivalue", | 86 | .llvm_name = "multivalue", |
| 87 | .description = "Enable multivalue blocks, instructions, and functions", | 87 | .description = "Enable multivalue blocks, instructions, and functions", |
| 88 | .dependencies = featureSet(&[_]Feature{}), | 88 | .dependencies = featureSet(&[_]Feature{}), |
| 89 | }; | 89 | }; |
| 90 | result[@intFromEnum(Feature.mutable_globals)] = .{ | 90 | result[@backingInt(Feature.mutable_globals)] = .{ |
| 91 | .llvm_name = "mutable-globals", | 91 | .llvm_name = "mutable-globals", |
| 92 | .description = "Enable mutable globals", | 92 | .description = "Enable mutable globals", |
| 93 | .dependencies = featureSet(&[_]Feature{}), | 93 | .dependencies = featureSet(&[_]Feature{}), |
| 94 | }; | 94 | }; |
| 95 | result[@intFromEnum(Feature.nontrapping_bulk_memory_len0)] = .{ | 95 | result[@backingInt(Feature.nontrapping_bulk_memory_len0)] = .{ |
| 96 | .llvm_name = null, | 96 | .llvm_name = null, |
| 97 | .description = "Bulk memory operations with a zero length do not trap", | 97 | .description = "Bulk memory operations with a zero length do not trap", |
| 98 | .dependencies = featureSet(&[_]Feature{ | 98 | .dependencies = featureSet(&[_]Feature{ |
| 99 | .bulk_memory_opt, | 99 | .bulk_memory_opt, |
| 100 | }), | 100 | }), |
| 101 | }; | 101 | }; |
| 102 | result[@intFromEnum(Feature.nontrapping_fptoint)] = .{ | 102 | result[@backingInt(Feature.nontrapping_fptoint)] = .{ |
| 103 | .llvm_name = "nontrapping-fptoint", | 103 | .llvm_name = "nontrapping-fptoint", |
| 104 | .description = "Enable non-trapping float-to-int conversion operators", | 104 | .description = "Enable non-trapping float-to-int conversion operators", |
| 105 | .dependencies = featureSet(&[_]Feature{}), | 105 | .dependencies = featureSet(&[_]Feature{}), |
| 106 | }; | 106 | }; |
| 107 | result[@intFromEnum(Feature.reference_types)] = .{ | 107 | result[@backingInt(Feature.reference_types)] = .{ |
| 108 | .llvm_name = "reference-types", | 108 | .llvm_name = "reference-types", |
| 109 | .description = "Enable reference types", | 109 | .description = "Enable reference types", |
| 110 | .dependencies = featureSet(&[_]Feature{ | 110 | .dependencies = featureSet(&[_]Feature{ |
| 111 | .call_indirect_overlong, | 111 | .call_indirect_overlong, |
| 112 | }), | 112 | }), |
| 113 | }; | 113 | }; |
| 114 | result[@intFromEnum(Feature.relaxed_simd)] = .{ | 114 | result[@backingInt(Feature.relaxed_simd)] = .{ |
| 115 | .llvm_name = "relaxed-simd", | 115 | .llvm_name = "relaxed-simd", |
| 116 | .description = "Enable relaxed-simd instructions", | 116 | .description = "Enable relaxed-simd instructions", |
| 117 | .dependencies = featureSet(&[_]Feature{}), | 117 | .dependencies = featureSet(&[_]Feature{}), |
| 118 | }; | 118 | }; |
| 119 | result[@intFromEnum(Feature.sign_ext)] = .{ | 119 | result[@backingInt(Feature.sign_ext)] = .{ |
| 120 | .llvm_name = "sign-ext", | 120 | .llvm_name = "sign-ext", |
| 121 | .description = "Enable sign extension operators", | 121 | .description = "Enable sign extension operators", |
| 122 | .dependencies = featureSet(&[_]Feature{}), | 122 | .dependencies = featureSet(&[_]Feature{}), |
| 123 | }; | 123 | }; |
| 124 | result[@intFromEnum(Feature.simd128)] = .{ | 124 | result[@backingInt(Feature.simd128)] = .{ |
| 125 | .llvm_name = "simd128", | 125 | .llvm_name = "simd128", |
| 126 | .description = "Enable 128-bit SIMD", | 126 | .description = "Enable 128-bit SIMD", |
| 127 | .dependencies = featureSet(&[_]Feature{}), | 127 | .dependencies = featureSet(&[_]Feature{}), |
| 128 | }; | 128 | }; |
| 129 | result[@intFromEnum(Feature.tail_call)] = .{ | 129 | result[@backingInt(Feature.tail_call)] = .{ |
| 130 | .llvm_name = "tail-call", | 130 | .llvm_name = "tail-call", |
| 131 | .description = "Enable tail call instructions", | 131 | .description = "Enable tail call instructions", |
| 132 | .dependencies = featureSet(&[_]Feature{}), | 132 | .dependencies = featureSet(&[_]Feature{}), |
| 133 | }; | 133 | }; |
| 134 | result[@intFromEnum(Feature.wide_arithmetic)] = .{ | 134 | result[@backingInt(Feature.wide_arithmetic)] = .{ |
| 135 | .llvm_name = "wide-arithmetic", | 135 | .llvm_name = "wide-arithmetic", |
| 136 | .description = "Enable wide-arithmetic instructions", | 136 | .description = "Enable wide-arithmetic instructions", |
| 137 | .dependencies = featureSet(&[_]Feature{}), | 137 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/x86.zig+202-202| ... | @@ -218,121 +218,121 @@ pub const all_features = blk: { | ... | @@ -218,121 +218,121 @@ pub const all_features = blk: { |
| 218 | const len = @typeInfo(Feature).@"enum".field_names.len; | 218 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 219 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 219 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 220 | var result: [len]CpuFeature = undefined; | 220 | var result: [len]CpuFeature = undefined; |
| 221 | result[@intFromEnum(Feature.@"16bit_mode")] = .{ | 221 | result[@backingInt(Feature.@"16bit_mode")] = .{ |
| 222 | .llvm_name = "16bit-mode", | 222 | .llvm_name = "16bit-mode", |
| 223 | .description = "16-bit mode (i8086)", | 223 | .description = "16-bit mode (i8086)", |
| 224 | .dependencies = featureSet(&[_]Feature{}), | 224 | .dependencies = featureSet(&[_]Feature{}), |
| 225 | }; | 225 | }; |
| 226 | result[@intFromEnum(Feature.@"32bit_mode")] = .{ | 226 | result[@backingInt(Feature.@"32bit_mode")] = .{ |
| 227 | .llvm_name = "32bit-mode", | 227 | .llvm_name = "32bit-mode", |
| 228 | .description = "32-bit mode (80386)", | 228 | .description = "32-bit mode (80386)", |
| 229 | .dependencies = featureSet(&[_]Feature{}), | 229 | .dependencies = featureSet(&[_]Feature{}), |
| 230 | }; | 230 | }; |
| 231 | result[@intFromEnum(Feature.@"3dnow")] = .{ | 231 | result[@backingInt(Feature.@"3dnow")] = .{ |
| 232 | .llvm_name = null, | 232 | .llvm_name = null, |
| 233 | .description = "Enable 3DNow! instructions", | 233 | .description = "Enable 3DNow! instructions", |
| 234 | .dependencies = featureSet(&[_]Feature{ | 234 | .dependencies = featureSet(&[_]Feature{ |
| 235 | .mmx, | 235 | .mmx, |
| 236 | }), | 236 | }), |
| 237 | }; | 237 | }; |
| 238 | result[@intFromEnum(Feature.@"3dnowa")] = .{ | 238 | result[@backingInt(Feature.@"3dnowa")] = .{ |
| 239 | .llvm_name = null, | 239 | .llvm_name = null, |
| 240 | .description = "Enable 3DNow! Athlon instructions", | 240 | .description = "Enable 3DNow! Athlon instructions", |
| 241 | .dependencies = featureSet(&[_]Feature{ | 241 | .dependencies = featureSet(&[_]Feature{ |
| 242 | .@"3dnow", | 242 | .@"3dnow", |
| 243 | }), | 243 | }), |
| 244 | }; | 244 | }; |
| 245 | result[@intFromEnum(Feature.@"64bit")] = .{ | 245 | result[@backingInt(Feature.@"64bit")] = .{ |
| 246 | .llvm_name = "64bit", | 246 | .llvm_name = "64bit", |
| 247 | .description = "Support 64-bit instructions", | 247 | .description = "Support 64-bit instructions", |
| 248 | .dependencies = featureSet(&[_]Feature{}), | 248 | .dependencies = featureSet(&[_]Feature{}), |
| 249 | }; | 249 | }; |
| 250 | result[@intFromEnum(Feature.adx)] = .{ | 250 | result[@backingInt(Feature.adx)] = .{ |
| 251 | .llvm_name = "adx", | 251 | .llvm_name = "adx", |
| 252 | .description = "Support ADX instructions", | 252 | .description = "Support ADX instructions", |
| 253 | .dependencies = featureSet(&[_]Feature{}), | 253 | .dependencies = featureSet(&[_]Feature{}), |
| 254 | }; | 254 | }; |
| 255 | result[@intFromEnum(Feature.aes)] = .{ | 255 | result[@backingInt(Feature.aes)] = .{ |
| 256 | .llvm_name = "aes", | 256 | .llvm_name = "aes", |
| 257 | .description = "Enable AES instructions", | 257 | .description = "Enable AES instructions", |
| 258 | .dependencies = featureSet(&[_]Feature{ | 258 | .dependencies = featureSet(&[_]Feature{ |
| 259 | .sse2, | 259 | .sse2, |
| 260 | }), | 260 | }), |
| 261 | }; | 261 | }; |
| 262 | result[@intFromEnum(Feature.allow_light_256_bit)] = .{ | 262 | result[@backingInt(Feature.allow_light_256_bit)] = .{ |
| 263 | .llvm_name = "allow-light-256-bit", | 263 | .llvm_name = "allow-light-256-bit", |
| 264 | .description = "Enable generation of 256-bit load/stores even if we prefer 128-bit", | 264 | .description = "Enable generation of 256-bit load/stores even if we prefer 128-bit", |
| 265 | .dependencies = featureSet(&[_]Feature{}), | 265 | .dependencies = featureSet(&[_]Feature{}), |
| 266 | }; | 266 | }; |
| 267 | result[@intFromEnum(Feature.amx_avx512)] = .{ | 267 | result[@backingInt(Feature.amx_avx512)] = .{ |
| 268 | .llvm_name = "amx-avx512", | 268 | .llvm_name = "amx-avx512", |
| 269 | .description = "Support AMX-AVX512 instructions", | 269 | .description = "Support AMX-AVX512 instructions", |
| 270 | .dependencies = featureSet(&[_]Feature{ | 270 | .dependencies = featureSet(&[_]Feature{ |
| 271 | .amx_tile, | 271 | .amx_tile, |
| 272 | }), | 272 | }), |
| 273 | }; | 273 | }; |
| 274 | result[@intFromEnum(Feature.amx_bf16)] = .{ | 274 | result[@backingInt(Feature.amx_bf16)] = .{ |
| 275 | .llvm_name = "amx-bf16", | 275 | .llvm_name = "amx-bf16", |
| 276 | .description = "Support AMX-BF16 instructions", | 276 | .description = "Support AMX-BF16 instructions", |
| 277 | .dependencies = featureSet(&[_]Feature{ | 277 | .dependencies = featureSet(&[_]Feature{ |
| 278 | .amx_tile, | 278 | .amx_tile, |
| 279 | }), | 279 | }), |
| 280 | }; | 280 | }; |
| 281 | result[@intFromEnum(Feature.amx_complex)] = .{ | 281 | result[@backingInt(Feature.amx_complex)] = .{ |
| 282 | .llvm_name = "amx-complex", | 282 | .llvm_name = "amx-complex", |
| 283 | .description = "Support AMX-COMPLEX instructions", | 283 | .description = "Support AMX-COMPLEX instructions", |
| 284 | .dependencies = featureSet(&[_]Feature{ | 284 | .dependencies = featureSet(&[_]Feature{ |
| 285 | .amx_tile, | 285 | .amx_tile, |
| 286 | }), | 286 | }), |
| 287 | }; | 287 | }; |
| 288 | result[@intFromEnum(Feature.amx_fp16)] = .{ | 288 | result[@backingInt(Feature.amx_fp16)] = .{ |
| 289 | .llvm_name = "amx-fp16", | 289 | .llvm_name = "amx-fp16", |
| 290 | .description = "Support AMX amx-fp16 instructions", | 290 | .description = "Support AMX amx-fp16 instructions", |
| 291 | .dependencies = featureSet(&[_]Feature{ | 291 | .dependencies = featureSet(&[_]Feature{ |
| 292 | .amx_tile, | 292 | .amx_tile, |
| 293 | }), | 293 | }), |
| 294 | }; | 294 | }; |
| 295 | result[@intFromEnum(Feature.amx_fp8)] = .{ | 295 | result[@backingInt(Feature.amx_fp8)] = .{ |
| 296 | .llvm_name = "amx-fp8", | 296 | .llvm_name = "amx-fp8", |
| 297 | .description = "Support AMX-FP8 instructions", | 297 | .description = "Support AMX-FP8 instructions", |
| 298 | .dependencies = featureSet(&[_]Feature{ | 298 | .dependencies = featureSet(&[_]Feature{ |
| 299 | .amx_tile, | 299 | .amx_tile, |
| 300 | }), | 300 | }), |
| 301 | }; | 301 | }; |
| 302 | result[@intFromEnum(Feature.amx_int8)] = .{ | 302 | result[@backingInt(Feature.amx_int8)] = .{ |
| 303 | .llvm_name = "amx-int8", | 303 | .llvm_name = "amx-int8", |
| 304 | .description = "Support AMX-INT8 instructions", | 304 | .description = "Support AMX-INT8 instructions", |
| 305 | .dependencies = featureSet(&[_]Feature{ | 305 | .dependencies = featureSet(&[_]Feature{ |
| 306 | .amx_tile, | 306 | .amx_tile, |
| 307 | }), | 307 | }), |
| 308 | }; | 308 | }; |
| 309 | result[@intFromEnum(Feature.amx_movrs)] = .{ | 309 | result[@backingInt(Feature.amx_movrs)] = .{ |
| 310 | .llvm_name = "amx-movrs", | 310 | .llvm_name = "amx-movrs", |
| 311 | .description = "Support AMX-MOVRS instructions", | 311 | .description = "Support AMX-MOVRS instructions", |
| 312 | .dependencies = featureSet(&[_]Feature{ | 312 | .dependencies = featureSet(&[_]Feature{ |
| 313 | .amx_tile, | 313 | .amx_tile, |
| 314 | }), | 314 | }), |
| 315 | }; | 315 | }; |
| 316 | result[@intFromEnum(Feature.amx_tf32)] = .{ | 316 | result[@backingInt(Feature.amx_tf32)] = .{ |
| 317 | .llvm_name = "amx-tf32", | 317 | .llvm_name = "amx-tf32", |
| 318 | .description = "Support AMX-TF32 instructions", | 318 | .description = "Support AMX-TF32 instructions", |
| 319 | .dependencies = featureSet(&[_]Feature{ | 319 | .dependencies = featureSet(&[_]Feature{ |
| 320 | .amx_tile, | 320 | .amx_tile, |
| 321 | }), | 321 | }), |
| 322 | }; | 322 | }; |
| 323 | result[@intFromEnum(Feature.amx_tile)] = .{ | 323 | result[@backingInt(Feature.amx_tile)] = .{ |
| 324 | .llvm_name = "amx-tile", | 324 | .llvm_name = "amx-tile", |
| 325 | .description = "Support AMX-TILE instructions", | 325 | .description = "Support AMX-TILE instructions", |
| 326 | .dependencies = featureSet(&[_]Feature{}), | 326 | .dependencies = featureSet(&[_]Feature{}), |
| 327 | }; | 327 | }; |
| 328 | result[@intFromEnum(Feature.avx)] = .{ | 328 | result[@backingInt(Feature.avx)] = .{ |
| 329 | .llvm_name = "avx", | 329 | .llvm_name = "avx", |
| 330 | .description = "Enable AVX instructions", | 330 | .description = "Enable AVX instructions", |
| 331 | .dependencies = featureSet(&[_]Feature{ | 331 | .dependencies = featureSet(&[_]Feature{ |
| 332 | .sse4_2, | 332 | .sse4_2, |
| 333 | }), | 333 | }), |
| 334 | }; | 334 | }; |
| 335 | result[@intFromEnum(Feature.avx10_1)] = .{ | 335 | result[@backingInt(Feature.avx10_1)] = .{ |
| 336 | .llvm_name = "avx10.1", | 336 | .llvm_name = "avx10.1", |
| 337 | .description = "Support AVX10.1 instruction", | 337 | .description = "Support AVX10.1 instruction", |
| 338 | .dependencies = featureSet(&[_]Feature{ | 338 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -349,63 +349,63 @@ pub const all_features = blk: { | ... | @@ -349,63 +349,63 @@ pub const all_features = blk: { |
| 349 | .avx512vpopcntdq, | 349 | .avx512vpopcntdq, |
| 350 | }), | 350 | }), |
| 351 | }; | 351 | }; |
| 352 | result[@intFromEnum(Feature.avx10_2)] = .{ | 352 | result[@backingInt(Feature.avx10_2)] = .{ |
| 353 | .llvm_name = "avx10.2", | 353 | .llvm_name = "avx10.2", |
| 354 | .description = "Support AVX10.2 instruction", | 354 | .description = "Support AVX10.2 instruction", |
| 355 | .dependencies = featureSet(&[_]Feature{ | 355 | .dependencies = featureSet(&[_]Feature{ |
| 356 | .avx10_1, | 356 | .avx10_1, |
| 357 | }), | 357 | }), |
| 358 | }; | 358 | }; |
| 359 | result[@intFromEnum(Feature.avx2)] = .{ | 359 | result[@backingInt(Feature.avx2)] = .{ |
| 360 | .llvm_name = "avx2", | 360 | .llvm_name = "avx2", |
| 361 | .description = "Enable AVX2 instructions", | 361 | .description = "Enable AVX2 instructions", |
| 362 | .dependencies = featureSet(&[_]Feature{ | 362 | .dependencies = featureSet(&[_]Feature{ |
| 363 | .avx, | 363 | .avx, |
| 364 | }), | 364 | }), |
| 365 | }; | 365 | }; |
| 366 | result[@intFromEnum(Feature.avx512bf16)] = .{ | 366 | result[@backingInt(Feature.avx512bf16)] = .{ |
| 367 | .llvm_name = "avx512bf16", | 367 | .llvm_name = "avx512bf16", |
| 368 | .description = "Support bfloat16 floating point", | 368 | .description = "Support bfloat16 floating point", |
| 369 | .dependencies = featureSet(&[_]Feature{ | 369 | .dependencies = featureSet(&[_]Feature{ |
| 370 | .avx512bw, | 370 | .avx512bw, |
| 371 | }), | 371 | }), |
| 372 | }; | 372 | }; |
| 373 | result[@intFromEnum(Feature.avx512bitalg)] = .{ | 373 | result[@backingInt(Feature.avx512bitalg)] = .{ |
| 374 | .llvm_name = "avx512bitalg", | 374 | .llvm_name = "avx512bitalg", |
| 375 | .description = "Enable AVX-512 Bit Algorithms", | 375 | .description = "Enable AVX-512 Bit Algorithms", |
| 376 | .dependencies = featureSet(&[_]Feature{ | 376 | .dependencies = featureSet(&[_]Feature{ |
| 377 | .avx512bw, | 377 | .avx512bw, |
| 378 | }), | 378 | }), |
| 379 | }; | 379 | }; |
| 380 | result[@intFromEnum(Feature.avx512bw)] = .{ | 380 | result[@backingInt(Feature.avx512bw)] = .{ |
| 381 | .llvm_name = "avx512bw", | 381 | .llvm_name = "avx512bw", |
| 382 | .description = "Enable AVX-512 Byte and Word Instructions", | 382 | .description = "Enable AVX-512 Byte and Word Instructions", |
| 383 | .dependencies = featureSet(&[_]Feature{ | 383 | .dependencies = featureSet(&[_]Feature{ |
| 384 | .avx512f, | 384 | .avx512f, |
| 385 | }), | 385 | }), |
| 386 | }; | 386 | }; |
| 387 | result[@intFromEnum(Feature.avx512cd)] = .{ | 387 | result[@backingInt(Feature.avx512cd)] = .{ |
| 388 | .llvm_name = "avx512cd", | 388 | .llvm_name = "avx512cd", |
| 389 | .description = "Enable AVX-512 Conflict Detection Instructions", | 389 | .description = "Enable AVX-512 Conflict Detection Instructions", |
| 390 | .dependencies = featureSet(&[_]Feature{ | 390 | .dependencies = featureSet(&[_]Feature{ |
| 391 | .avx512f, | 391 | .avx512f, |
| 392 | }), | 392 | }), |
| 393 | }; | 393 | }; |
| 394 | result[@intFromEnum(Feature.avx512dq)] = .{ | 394 | result[@backingInt(Feature.avx512dq)] = .{ |
| 395 | .llvm_name = "avx512dq", | 395 | .llvm_name = "avx512dq", |
| 396 | .description = "Enable AVX-512 Doubleword and Quadword Instructions", | 396 | .description = "Enable AVX-512 Doubleword and Quadword Instructions", |
| 397 | .dependencies = featureSet(&[_]Feature{ | 397 | .dependencies = featureSet(&[_]Feature{ |
| 398 | .avx512f, | 398 | .avx512f, |
| 399 | }), | 399 | }), |
| 400 | }; | 400 | }; |
| 401 | result[@intFromEnum(Feature.avx512er)] = .{ | 401 | result[@backingInt(Feature.avx512er)] = .{ |
| 402 | .llvm_name = null, | 402 | .llvm_name = null, |
| 403 | .description = "Enable AVX-512 Exponential and Reciprocal Instructions", | 403 | .description = "Enable AVX-512 Exponential and Reciprocal Instructions", |
| 404 | .dependencies = featureSet(&[_]Feature{ | 404 | .dependencies = featureSet(&[_]Feature{ |
| 405 | .avx512f, | 405 | .avx512f, |
| 406 | }), | 406 | }), |
| 407 | }; | 407 | }; |
| 408 | result[@intFromEnum(Feature.avx512f)] = .{ | 408 | result[@backingInt(Feature.avx512f)] = .{ |
| 409 | .llvm_name = "avx512f", | 409 | .llvm_name = "avx512f", |
| 410 | .description = "Enable AVX-512 instructions", | 410 | .description = "Enable AVX-512 instructions", |
| 411 | .dependencies = featureSet(&[_]Feature{ | 411 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -414,341 +414,341 @@ pub const all_features = blk: { | ... | @@ -414,341 +414,341 @@ pub const all_features = blk: { |
| 414 | .fma, | 414 | .fma, |
| 415 | }), | 415 | }), |
| 416 | }; | 416 | }; |
| 417 | result[@intFromEnum(Feature.avx512fp16)] = .{ | 417 | result[@backingInt(Feature.avx512fp16)] = .{ |
| 418 | .llvm_name = "avx512fp16", | 418 | .llvm_name = "avx512fp16", |
| 419 | .description = "Support 16-bit floating point", | 419 | .description = "Support 16-bit floating point", |
| 420 | .dependencies = featureSet(&[_]Feature{ | 420 | .dependencies = featureSet(&[_]Feature{ |
| 421 | .avx512bw, | 421 | .avx512bw, |
| 422 | }), | 422 | }), |
| 423 | }; | 423 | }; |
| 424 | result[@intFromEnum(Feature.avx512ifma)] = .{ | 424 | result[@backingInt(Feature.avx512ifma)] = .{ |
| 425 | .llvm_name = "avx512ifma", | 425 | .llvm_name = "avx512ifma", |
| 426 | .description = "Enable AVX-512 Integer Fused Multiple-Add", | 426 | .description = "Enable AVX-512 Integer Fused Multiple-Add", |
| 427 | .dependencies = featureSet(&[_]Feature{ | 427 | .dependencies = featureSet(&[_]Feature{ |
| 428 | .avx512f, | 428 | .avx512f, |
| 429 | }), | 429 | }), |
| 430 | }; | 430 | }; |
| 431 | result[@intFromEnum(Feature.avx512pf)] = .{ | 431 | result[@backingInt(Feature.avx512pf)] = .{ |
| 432 | .llvm_name = null, | 432 | .llvm_name = null, |
| 433 | .description = "Enable AVX-512 PreFetch Instructions", | 433 | .description = "Enable AVX-512 PreFetch Instructions", |
| 434 | .dependencies = featureSet(&[_]Feature{ | 434 | .dependencies = featureSet(&[_]Feature{ |
| 435 | .avx512f, | 435 | .avx512f, |
| 436 | }), | 436 | }), |
| 437 | }; | 437 | }; |
| 438 | result[@intFromEnum(Feature.avx512vbmi)] = .{ | 438 | result[@backingInt(Feature.avx512vbmi)] = .{ |
| 439 | .llvm_name = "avx512vbmi", | 439 | .llvm_name = "avx512vbmi", |
| 440 | .description = "Enable AVX-512 Vector Byte Manipulation Instructions", | 440 | .description = "Enable AVX-512 Vector Byte Manipulation Instructions", |
| 441 | .dependencies = featureSet(&[_]Feature{ | 441 | .dependencies = featureSet(&[_]Feature{ |
| 442 | .avx512bw, | 442 | .avx512bw, |
| 443 | }), | 443 | }), |
| 444 | }; | 444 | }; |
| 445 | result[@intFromEnum(Feature.avx512vbmi2)] = .{ | 445 | result[@backingInt(Feature.avx512vbmi2)] = .{ |
| 446 | .llvm_name = "avx512vbmi2", | 446 | .llvm_name = "avx512vbmi2", |
| 447 | .description = "Enable AVX-512 further Vector Byte Manipulation Instructions", | 447 | .description = "Enable AVX-512 further Vector Byte Manipulation Instructions", |
| 448 | .dependencies = featureSet(&[_]Feature{ | 448 | .dependencies = featureSet(&[_]Feature{ |
| 449 | .avx512bw, | 449 | .avx512bw, |
| 450 | }), | 450 | }), |
| 451 | }; | 451 | }; |
| 452 | result[@intFromEnum(Feature.avx512vl)] = .{ | 452 | result[@backingInt(Feature.avx512vl)] = .{ |
| 453 | .llvm_name = "avx512vl", | 453 | .llvm_name = "avx512vl", |
| 454 | .description = "Enable AVX-512 Vector Length eXtensions", | 454 | .description = "Enable AVX-512 Vector Length eXtensions", |
| 455 | .dependencies = featureSet(&[_]Feature{ | 455 | .dependencies = featureSet(&[_]Feature{ |
| 456 | .avx512f, | 456 | .avx512f, |
| 457 | }), | 457 | }), |
| 458 | }; | 458 | }; |
| 459 | result[@intFromEnum(Feature.avx512vnni)] = .{ | 459 | result[@backingInt(Feature.avx512vnni)] = .{ |
| 460 | .llvm_name = "avx512vnni", | 460 | .llvm_name = "avx512vnni", |
| 461 | .description = "Enable AVX-512 Vector Neural Network Instructions", | 461 | .description = "Enable AVX-512 Vector Neural Network Instructions", |
| 462 | .dependencies = featureSet(&[_]Feature{ | 462 | .dependencies = featureSet(&[_]Feature{ |
| 463 | .avx512f, | 463 | .avx512f, |
| 464 | }), | 464 | }), |
| 465 | }; | 465 | }; |
| 466 | result[@intFromEnum(Feature.avx512vp2intersect)] = .{ | 466 | result[@backingInt(Feature.avx512vp2intersect)] = .{ |
| 467 | .llvm_name = "avx512vp2intersect", | 467 | .llvm_name = "avx512vp2intersect", |
| 468 | .description = "Enable AVX-512 vp2intersect", | 468 | .description = "Enable AVX-512 vp2intersect", |
| 469 | .dependencies = featureSet(&[_]Feature{ | 469 | .dependencies = featureSet(&[_]Feature{ |
| 470 | .avx512f, | 470 | .avx512f, |
| 471 | }), | 471 | }), |
| 472 | }; | 472 | }; |
| 473 | result[@intFromEnum(Feature.avx512vpopcntdq)] = .{ | 473 | result[@backingInt(Feature.avx512vpopcntdq)] = .{ |
| 474 | .llvm_name = "avx512vpopcntdq", | 474 | .llvm_name = "avx512vpopcntdq", |
| 475 | .description = "Enable AVX-512 Population Count Instructions", | 475 | .description = "Enable AVX-512 Population Count Instructions", |
| 476 | .dependencies = featureSet(&[_]Feature{ | 476 | .dependencies = featureSet(&[_]Feature{ |
| 477 | .avx512f, | 477 | .avx512f, |
| 478 | }), | 478 | }), |
| 479 | }; | 479 | }; |
| 480 | result[@intFromEnum(Feature.avxifma)] = .{ | 480 | result[@backingInt(Feature.avxifma)] = .{ |
| 481 | .llvm_name = "avxifma", | 481 | .llvm_name = "avxifma", |
| 482 | .description = "Enable AVX-IFMA", | 482 | .description = "Enable AVX-IFMA", |
| 483 | .dependencies = featureSet(&[_]Feature{ | 483 | .dependencies = featureSet(&[_]Feature{ |
| 484 | .avx2, | 484 | .avx2, |
| 485 | }), | 485 | }), |
| 486 | }; | 486 | }; |
| 487 | result[@intFromEnum(Feature.avxneconvert)] = .{ | 487 | result[@backingInt(Feature.avxneconvert)] = .{ |
| 488 | .llvm_name = "avxneconvert", | 488 | .llvm_name = "avxneconvert", |
| 489 | .description = "Support AVX-NE-CONVERT instructions", | 489 | .description = "Support AVX-NE-CONVERT instructions", |
| 490 | .dependencies = featureSet(&[_]Feature{ | 490 | .dependencies = featureSet(&[_]Feature{ |
| 491 | .avx2, | 491 | .avx2, |
| 492 | }), | 492 | }), |
| 493 | }; | 493 | }; |
| 494 | result[@intFromEnum(Feature.avxvnni)] = .{ | 494 | result[@backingInt(Feature.avxvnni)] = .{ |
| 495 | .llvm_name = "avxvnni", | 495 | .llvm_name = "avxvnni", |
| 496 | .description = "Support AVX_VNNI encoding", | 496 | .description = "Support AVX_VNNI encoding", |
| 497 | .dependencies = featureSet(&[_]Feature{ | 497 | .dependencies = featureSet(&[_]Feature{ |
| 498 | .avx2, | 498 | .avx2, |
| 499 | }), | 499 | }), |
| 500 | }; | 500 | }; |
| 501 | result[@intFromEnum(Feature.avxvnniint16)] = .{ | 501 | result[@backingInt(Feature.avxvnniint16)] = .{ |
| 502 | .llvm_name = "avxvnniint16", | 502 | .llvm_name = "avxvnniint16", |
| 503 | .description = "Enable AVX-VNNI-INT16", | 503 | .description = "Enable AVX-VNNI-INT16", |
| 504 | .dependencies = featureSet(&[_]Feature{ | 504 | .dependencies = featureSet(&[_]Feature{ |
| 505 | .avx2, | 505 | .avx2, |
| 506 | }), | 506 | }), |
| 507 | }; | 507 | }; |
| 508 | result[@intFromEnum(Feature.avxvnniint8)] = .{ | 508 | result[@backingInt(Feature.avxvnniint8)] = .{ |
| 509 | .llvm_name = "avxvnniint8", | 509 | .llvm_name = "avxvnniint8", |
| 510 | .description = "Enable AVX-VNNI-INT8", | 510 | .description = "Enable AVX-VNNI-INT8", |
| 511 | .dependencies = featureSet(&[_]Feature{ | 511 | .dependencies = featureSet(&[_]Feature{ |
| 512 | .avx2, | 512 | .avx2, |
| 513 | }), | 513 | }), |
| 514 | }; | 514 | }; |
| 515 | result[@intFromEnum(Feature.bmi)] = .{ | 515 | result[@backingInt(Feature.bmi)] = .{ |
| 516 | .llvm_name = "bmi", | 516 | .llvm_name = "bmi", |
| 517 | .description = "Support BMI instructions", | 517 | .description = "Support BMI instructions", |
| 518 | .dependencies = featureSet(&[_]Feature{}), | 518 | .dependencies = featureSet(&[_]Feature{}), |
| 519 | }; | 519 | }; |
| 520 | result[@intFromEnum(Feature.bmi2)] = .{ | 520 | result[@backingInt(Feature.bmi2)] = .{ |
| 521 | .llvm_name = "bmi2", | 521 | .llvm_name = "bmi2", |
| 522 | .description = "Support BMI2 instructions", | 522 | .description = "Support BMI2 instructions", |
| 523 | .dependencies = featureSet(&[_]Feature{}), | 523 | .dependencies = featureSet(&[_]Feature{}), |
| 524 | }; | 524 | }; |
| 525 | result[@intFromEnum(Feature.branch_hint)] = .{ | 525 | result[@backingInt(Feature.branch_hint)] = .{ |
| 526 | .llvm_name = "branch-hint", | 526 | .llvm_name = "branch-hint", |
| 527 | .description = "Target has branch hint feature", | 527 | .description = "Target has branch hint feature", |
| 528 | .dependencies = featureSet(&[_]Feature{}), | 528 | .dependencies = featureSet(&[_]Feature{}), |
| 529 | }; | 529 | }; |
| 530 | result[@intFromEnum(Feature.branchfusion)] = .{ | 530 | result[@backingInt(Feature.branchfusion)] = .{ |
| 531 | .llvm_name = "branchfusion", | 531 | .llvm_name = "branchfusion", |
| 532 | .description = "CMP/TEST can be fused with conditional branches", | 532 | .description = "CMP/TEST can be fused with conditional branches", |
| 533 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = null, | 536 | .llvm_name = null, |
| 537 | .description = "BSF/BSR may clobber the lower 32-bits of the result register when the source is zero", | 537 | .description = "BSF/BSR may clobber the lower 32-bits of the result register when the source is zero", |
| 538 | .dependencies = featureSet(&[_]Feature{}), | 538 | .dependencies = featureSet(&[_]Feature{}), |
| 539 | }; | 539 | }; |
| 540 | result[@intFromEnum(Feature.ccmp)] = .{ | 540 | result[@backingInt(Feature.ccmp)] = .{ |
| 541 | .llvm_name = "ccmp", | 541 | .llvm_name = "ccmp", |
| 542 | .description = "Support conditional cmp & test instructions", | 542 | .description = "Support conditional cmp & test instructions", |
| 543 | .dependencies = featureSet(&[_]Feature{}), | 543 | .dependencies = featureSet(&[_]Feature{}), |
| 544 | }; | 544 | }; |
| 545 | result[@intFromEnum(Feature.cf)] = .{ | 545 | result[@backingInt(Feature.cf)] = .{ |
| 546 | .llvm_name = "cf", | 546 | .llvm_name = "cf", |
| 547 | .description = "Support conditional faulting", | 547 | .description = "Support conditional faulting", |
| 548 | .dependencies = featureSet(&[_]Feature{}), | 548 | .dependencies = featureSet(&[_]Feature{}), |
| 549 | }; | 549 | }; |
| 550 | result[@intFromEnum(Feature.cldemote)] = .{ | 550 | result[@backingInt(Feature.cldemote)] = .{ |
| 551 | .llvm_name = "cldemote", | 551 | .llvm_name = "cldemote", |
| 552 | .description = "Enable Cache Line Demote", | 552 | .description = "Enable Cache Line Demote", |
| 553 | .dependencies = featureSet(&[_]Feature{}), | 553 | .dependencies = featureSet(&[_]Feature{}), |
| 554 | }; | 554 | }; |
| 555 | result[@intFromEnum(Feature.clflushopt)] = .{ | 555 | result[@backingInt(Feature.clflushopt)] = .{ |
| 556 | .llvm_name = "clflushopt", | 556 | .llvm_name = "clflushopt", |
| 557 | .description = "Flush A Cache Line Optimized", | 557 | .description = "Flush A Cache Line Optimized", |
| 558 | .dependencies = featureSet(&[_]Feature{}), | 558 | .dependencies = featureSet(&[_]Feature{}), |
| 559 | }; | 559 | }; |
| 560 | result[@intFromEnum(Feature.clwb)] = .{ | 560 | result[@backingInt(Feature.clwb)] = .{ |
| 561 | .llvm_name = "clwb", | 561 | .llvm_name = "clwb", |
| 562 | .description = "Cache Line Write Back", | 562 | .description = "Cache Line Write Back", |
| 563 | .dependencies = featureSet(&[_]Feature{}), | 563 | .dependencies = featureSet(&[_]Feature{}), |
| 564 | }; | 564 | }; |
| 565 | result[@intFromEnum(Feature.clzero)] = .{ | 565 | result[@backingInt(Feature.clzero)] = .{ |
| 566 | .llvm_name = "clzero", | 566 | .llvm_name = "clzero", |
| 567 | .description = "Enable Cache Line Zero", | 567 | .description = "Enable Cache Line Zero", |
| 568 | .dependencies = featureSet(&[_]Feature{}), | 568 | .dependencies = featureSet(&[_]Feature{}), |
| 569 | }; | 569 | }; |
| 570 | result[@intFromEnum(Feature.cmov)] = .{ | 570 | result[@backingInt(Feature.cmov)] = .{ |
| 571 | .llvm_name = "cmov", | 571 | .llvm_name = "cmov", |
| 572 | .description = "Enable conditional move instructions", | 572 | .description = "Enable conditional move instructions", |
| 573 | .dependencies = featureSet(&[_]Feature{}), | 573 | .dependencies = featureSet(&[_]Feature{}), |
| 574 | }; | 574 | }; |
| 575 | result[@intFromEnum(Feature.cmpccxadd)] = .{ | 575 | result[@backingInt(Feature.cmpccxadd)] = .{ |
| 576 | .llvm_name = "cmpccxadd", | 576 | .llvm_name = "cmpccxadd", |
| 577 | .description = "Support CMPCCXADD instructions", | 577 | .description = "Support CMPCCXADD instructions", |
| 578 | .dependencies = featureSet(&[_]Feature{}), | 578 | .dependencies = featureSet(&[_]Feature{}), |
| 579 | }; | 579 | }; |
| 580 | result[@intFromEnum(Feature.crc32)] = .{ | 580 | result[@backingInt(Feature.crc32)] = .{ |
| 581 | .llvm_name = "crc32", | 581 | .llvm_name = "crc32", |
| 582 | .description = "Enable SSE 4.2 CRC32 instruction (used when SSE4.2 is supported but function is GPR only)", | 582 | .description = "Enable SSE 4.2 CRC32 instruction (used when SSE4.2 is supported but function is GPR only)", |
| 583 | .dependencies = featureSet(&[_]Feature{}), | 583 | .dependencies = featureSet(&[_]Feature{}), |
| 584 | }; | 584 | }; |
| 585 | result[@intFromEnum(Feature.cx16)] = .{ | 585 | result[@backingInt(Feature.cx16)] = .{ |
| 586 | .llvm_name = "cx16", | 586 | .llvm_name = "cx16", |
| 587 | .description = "64-bit with cmpxchg16b (this is true for most x86-64 chips, but not the first AMD chips)", | 587 | .description = "64-bit with cmpxchg16b (this is true for most x86-64 chips, but not the first AMD chips)", |
| 588 | .dependencies = featureSet(&[_]Feature{ | 588 | .dependencies = featureSet(&[_]Feature{ |
| 589 | .cx8, | 589 | .cx8, |
| 590 | }), | 590 | }), |
| 591 | }; | 591 | }; |
| 592 | result[@intFromEnum(Feature.cx8)] = .{ | 592 | result[@backingInt(Feature.cx8)] = .{ |
| 593 | .llvm_name = "cx8", | 593 | .llvm_name = "cx8", |
| 594 | .description = "Support CMPXCHG8B instructions", | 594 | .description = "Support CMPXCHG8B instructions", |
| 595 | .dependencies = featureSet(&[_]Feature{}), | 595 | .dependencies = featureSet(&[_]Feature{}), |
| 596 | }; | 596 | }; |
| 597 | result[@intFromEnum(Feature.egpr)] = .{ | 597 | result[@backingInt(Feature.egpr)] = .{ |
| 598 | .llvm_name = "egpr", | 598 | .llvm_name = "egpr", |
| 599 | .description = "Support extended general purpose register", | 599 | .description = "Support extended general purpose register", |
| 600 | .dependencies = featureSet(&[_]Feature{}), | 600 | .dependencies = featureSet(&[_]Feature{}), |
| 601 | }; | 601 | }; |
| 602 | result[@intFromEnum(Feature.enqcmd)] = .{ | 602 | result[@backingInt(Feature.enqcmd)] = .{ |
| 603 | .llvm_name = "enqcmd", | 603 | .llvm_name = "enqcmd", |
| 604 | .description = "Has ENQCMD instructions", | 604 | .description = "Has ENQCMD instructions", |
| 605 | .dependencies = featureSet(&[_]Feature{}), | 605 | .dependencies = featureSet(&[_]Feature{}), |
| 606 | }; | 606 | }; |
| 607 | result[@intFromEnum(Feature.ermsb)] = .{ | 607 | result[@backingInt(Feature.ermsb)] = .{ |
| 608 | .llvm_name = "ermsb", | 608 | .llvm_name = "ermsb", |
| 609 | .description = "REP MOVS/STOS are fast", | 609 | .description = "REP MOVS/STOS are fast", |
| 610 | .dependencies = featureSet(&[_]Feature{}), | 610 | .dependencies = featureSet(&[_]Feature{}), |
| 611 | }; | 611 | }; |
| 612 | result[@intFromEnum(Feature.f16c)] = .{ | 612 | result[@backingInt(Feature.f16c)] = .{ |
| 613 | .llvm_name = "f16c", | 613 | .llvm_name = "f16c", |
| 614 | .description = "Support 16-bit floating point conversion instructions", | 614 | .description = "Support 16-bit floating point conversion instructions", |
| 615 | .dependencies = featureSet(&[_]Feature{ | 615 | .dependencies = featureSet(&[_]Feature{ |
| 616 | .avx, | 616 | .avx, |
| 617 | }), | 617 | }), |
| 618 | }; | 618 | }; |
| 619 | result[@intFromEnum(Feature.false_deps_getmant)] = .{ | 619 | result[@backingInt(Feature.false_deps_getmant)] = .{ |
| 620 | .llvm_name = "false-deps-getmant", | 620 | .llvm_name = "false-deps-getmant", |
| 621 | .description = "VGETMANTSS/SD/SH and VGETMANDPS/PD(memory version) has a false dependency on dest register", | 621 | .description = "VGETMANTSS/SD/SH and VGETMANDPS/PD(memory version) has a false dependency on dest register", |
| 622 | .dependencies = featureSet(&[_]Feature{}), | 622 | .dependencies = featureSet(&[_]Feature{}), |
| 623 | }; | 623 | }; |
| 624 | result[@intFromEnum(Feature.false_deps_lzcnt_tzcnt)] = .{ | 624 | result[@backingInt(Feature.false_deps_lzcnt_tzcnt)] = .{ |
| 625 | .llvm_name = "false-deps-lzcnt-tzcnt", | 625 | .llvm_name = "false-deps-lzcnt-tzcnt", |
| 626 | .description = "LZCNT/TZCNT have a false dependency on dest register", | 626 | .description = "LZCNT/TZCNT have a false dependency on dest register", |
| 627 | .dependencies = featureSet(&[_]Feature{}), | 627 | .dependencies = featureSet(&[_]Feature{}), |
| 628 | }; | 628 | }; |
| 629 | result[@intFromEnum(Feature.false_deps_mulc)] = .{ | 629 | result[@backingInt(Feature.false_deps_mulc)] = .{ |
| 630 | .llvm_name = "false-deps-mulc", | 630 | .llvm_name = "false-deps-mulc", |
| 631 | .description = "VF[C]MULCPH/SH has a false dependency on dest register", | 631 | .description = "VF[C]MULCPH/SH has a false dependency on dest register", |
| 632 | .dependencies = featureSet(&[_]Feature{}), | 632 | .dependencies = featureSet(&[_]Feature{}), |
| 633 | }; | 633 | }; |
| 634 | result[@intFromEnum(Feature.false_deps_mullq)] = .{ | 634 | result[@backingInt(Feature.false_deps_mullq)] = .{ |
| 635 | .llvm_name = "false-deps-mullq", | 635 | .llvm_name = "false-deps-mullq", |
| 636 | .description = "VPMULLQ has a false dependency on dest register", | 636 | .description = "VPMULLQ has a false dependency on dest register", |
| 637 | .dependencies = featureSet(&[_]Feature{}), | 637 | .dependencies = featureSet(&[_]Feature{}), |
| 638 | }; | 638 | }; |
| 639 | result[@intFromEnum(Feature.false_deps_perm)] = .{ | 639 | result[@backingInt(Feature.false_deps_perm)] = .{ |
| 640 | .llvm_name = "false-deps-perm", | 640 | .llvm_name = "false-deps-perm", |
| 641 | .description = "VPERMD/Q/PS/PD has a false dependency on dest register", | 641 | .description = "VPERMD/Q/PS/PD has a false dependency on dest register", |
| 642 | .dependencies = featureSet(&[_]Feature{}), | 642 | .dependencies = featureSet(&[_]Feature{}), |
| 643 | }; | 643 | }; |
| 644 | result[@intFromEnum(Feature.false_deps_popcnt)] = .{ | 644 | result[@backingInt(Feature.false_deps_popcnt)] = .{ |
| 645 | .llvm_name = "false-deps-popcnt", | 645 | .llvm_name = "false-deps-popcnt", |
| 646 | .description = "POPCNT has a false dependency on dest register", | 646 | .description = "POPCNT has a false dependency on dest register", |
| 647 | .dependencies = featureSet(&[_]Feature{}), | 647 | .dependencies = featureSet(&[_]Feature{}), |
| 648 | }; | 648 | }; |
| 649 | result[@intFromEnum(Feature.false_deps_range)] = .{ | 649 | result[@backingInt(Feature.false_deps_range)] = .{ |
| 650 | .llvm_name = "false-deps-range", | 650 | .llvm_name = "false-deps-range", |
| 651 | .description = "VRANGEPD/PS/SD/SS has a false dependency on dest register", | 651 | .description = "VRANGEPD/PS/SD/SS has a false dependency on dest register", |
| 652 | .dependencies = featureSet(&[_]Feature{}), | 652 | .dependencies = featureSet(&[_]Feature{}), |
| 653 | }; | 653 | }; |
| 654 | result[@intFromEnum(Feature.fast_11bytenop)] = .{ | 654 | result[@backingInt(Feature.fast_11bytenop)] = .{ |
| 655 | .llvm_name = "fast-11bytenop", | 655 | .llvm_name = "fast-11bytenop", |
| 656 | .description = "Target can quickly decode up to 11 byte NOPs", | 656 | .description = "Target can quickly decode up to 11 byte NOPs", |
| 657 | .dependencies = featureSet(&[_]Feature{}), | 657 | .dependencies = featureSet(&[_]Feature{}), |
| 658 | }; | 658 | }; |
| 659 | result[@intFromEnum(Feature.fast_15bytenop)] = .{ | 659 | result[@backingInt(Feature.fast_15bytenop)] = .{ |
| 660 | .llvm_name = "fast-15bytenop", | 660 | .llvm_name = "fast-15bytenop", |
| 661 | .description = "Target can quickly decode up to 15 byte NOPs", | 661 | .description = "Target can quickly decode up to 15 byte NOPs", |
| 662 | .dependencies = featureSet(&[_]Feature{}), | 662 | .dependencies = featureSet(&[_]Feature{}), |
| 663 | }; | 663 | }; |
| 664 | result[@intFromEnum(Feature.fast_7bytenop)] = .{ | 664 | result[@backingInt(Feature.fast_7bytenop)] = .{ |
| 665 | .llvm_name = "fast-7bytenop", | 665 | .llvm_name = "fast-7bytenop", |
| 666 | .description = "Target can quickly decode up to 7 byte NOPs", | 666 | .description = "Target can quickly decode up to 7 byte NOPs", |
| 667 | .dependencies = featureSet(&[_]Feature{}), | 667 | .dependencies = featureSet(&[_]Feature{}), |
| 668 | }; | 668 | }; |
| 669 | result[@intFromEnum(Feature.fast_bextr)] = .{ | 669 | result[@backingInt(Feature.fast_bextr)] = .{ |
| 670 | .llvm_name = "fast-bextr", | 670 | .llvm_name = "fast-bextr", |
| 671 | .description = "Indicates that the BEXTR instruction is implemented as a single uop with good throughput", | 671 | .description = "Indicates that the BEXTR instruction is implemented as a single uop with good throughput", |
| 672 | .dependencies = featureSet(&[_]Feature{}), | 672 | .dependencies = featureSet(&[_]Feature{}), |
| 673 | }; | 673 | }; |
| 674 | result[@intFromEnum(Feature.fast_dpwssd)] = .{ | 674 | result[@backingInt(Feature.fast_dpwssd)] = .{ |
| 675 | .llvm_name = "fast-dpwssd", | 675 | .llvm_name = "fast-dpwssd", |
| 676 | .description = "Prefer vpdpwssd instruction over vpmaddwd+vpaddd instruction sequence", | 676 | .description = "Prefer vpdpwssd instruction over vpmaddwd+vpaddd instruction sequence", |
| 677 | .dependencies = featureSet(&[_]Feature{}), | 677 | .dependencies = featureSet(&[_]Feature{}), |
| 678 | }; | 678 | }; |
| 679 | result[@intFromEnum(Feature.fast_gather)] = .{ | 679 | result[@backingInt(Feature.fast_gather)] = .{ |
| 680 | .llvm_name = "fast-gather", | 680 | .llvm_name = "fast-gather", |
| 681 | .description = "Indicates if gather is reasonably fast (this is true for Skylake client and all AVX-512 CPUs)", | 681 | .description = "Indicates if gather is reasonably fast (this is true for Skylake client and all AVX-512 CPUs)", |
| 682 | .dependencies = featureSet(&[_]Feature{}), | 682 | .dependencies = featureSet(&[_]Feature{}), |
| 683 | }; | 683 | }; |
| 684 | result[@intFromEnum(Feature.fast_hops)] = .{ | 684 | result[@backingInt(Feature.fast_hops)] = .{ |
| 685 | .llvm_name = "fast-hops", | 685 | .llvm_name = "fast-hops", |
| 686 | .description = "Prefer horizontal vector math instructions (haddp, phsub, etc.) over normal vector instructions with shuffles", | 686 | .description = "Prefer horizontal vector math instructions (haddp, phsub, etc.) over normal vector instructions with shuffles", |
| 687 | .dependencies = featureSet(&[_]Feature{}), | 687 | .dependencies = featureSet(&[_]Feature{}), |
| 688 | }; | 688 | }; |
| 689 | result[@intFromEnum(Feature.fast_imm16)] = .{ | 689 | result[@backingInt(Feature.fast_imm16)] = .{ |
| 690 | .llvm_name = "fast-imm16", | 690 | .llvm_name = "fast-imm16", |
| 691 | .description = "Prefer a i16 instruction with i16 immediate over extension to i32", | 691 | .description = "Prefer a i16 instruction with i16 immediate over extension to i32", |
| 692 | .dependencies = featureSet(&[_]Feature{}), | 692 | .dependencies = featureSet(&[_]Feature{}), |
| 693 | }; | 693 | }; |
| 694 | result[@intFromEnum(Feature.fast_lzcnt)] = .{ | 694 | result[@backingInt(Feature.fast_lzcnt)] = .{ |
| 695 | .llvm_name = "fast-lzcnt", | 695 | .llvm_name = "fast-lzcnt", |
| 696 | .description = "LZCNT instructions are as fast as most simple integer ops", | 696 | .description = "LZCNT instructions are as fast as most simple integer ops", |
| 697 | .dependencies = featureSet(&[_]Feature{}), | 697 | .dependencies = featureSet(&[_]Feature{}), |
| 698 | }; | 698 | }; |
| 699 | result[@intFromEnum(Feature.fast_movbe)] = .{ | 699 | result[@backingInt(Feature.fast_movbe)] = .{ |
| 700 | .llvm_name = "fast-movbe", | 700 | .llvm_name = "fast-movbe", |
| 701 | .description = "Prefer a movbe over a single-use load + bswap / single-use bswap + store", | 701 | .description = "Prefer a movbe over a single-use load + bswap / single-use bswap + store", |
| 702 | .dependencies = featureSet(&[_]Feature{}), | 702 | .dependencies = featureSet(&[_]Feature{}), |
| 703 | }; | 703 | }; |
| 704 | result[@intFromEnum(Feature.fast_scalar_fsqrt)] = .{ | 704 | result[@backingInt(Feature.fast_scalar_fsqrt)] = .{ |
| 705 | .llvm_name = "fast-scalar-fsqrt", | 705 | .llvm_name = "fast-scalar-fsqrt", |
| 706 | .description = "Scalar SQRT is fast (disable Newton-Raphson)", | 706 | .description = "Scalar SQRT is fast (disable Newton-Raphson)", |
| 707 | .dependencies = featureSet(&[_]Feature{}), | 707 | .dependencies = featureSet(&[_]Feature{}), |
| 708 | }; | 708 | }; |
| 709 | result[@intFromEnum(Feature.fast_scalar_shift_masks)] = .{ | 709 | result[@backingInt(Feature.fast_scalar_shift_masks)] = .{ |
| 710 | .llvm_name = "fast-scalar-shift-masks", | 710 | .llvm_name = "fast-scalar-shift-masks", |
| 711 | .description = "Prefer a left/right scalar logical shift pair over a shift+and pair", | 711 | .description = "Prefer a left/right scalar logical shift pair over a shift+and pair", |
| 712 | .dependencies = featureSet(&[_]Feature{}), | 712 | .dependencies = featureSet(&[_]Feature{}), |
| 713 | }; | 713 | }; |
| 714 | result[@intFromEnum(Feature.fast_shld_rotate)] = .{ | 714 | result[@backingInt(Feature.fast_shld_rotate)] = .{ |
| 715 | .llvm_name = "fast-shld-rotate", | 715 | .llvm_name = "fast-shld-rotate", |
| 716 | .description = "SHLD can be used as a faster rotate", | 716 | .description = "SHLD can be used as a faster rotate", |
| 717 | .dependencies = featureSet(&[_]Feature{}), | 717 | .dependencies = featureSet(&[_]Feature{}), |
| 718 | }; | 718 | }; |
| 719 | result[@intFromEnum(Feature.fast_variable_crosslane_shuffle)] = .{ | 719 | result[@backingInt(Feature.fast_variable_crosslane_shuffle)] = .{ |
| 720 | .llvm_name = "fast-variable-crosslane-shuffle", | 720 | .llvm_name = "fast-variable-crosslane-shuffle", |
| 721 | .description = "Cross-lane shuffles with variable masks are fast", | 721 | .description = "Cross-lane shuffles with variable masks are fast", |
| 722 | .dependencies = featureSet(&[_]Feature{}), | 722 | .dependencies = featureSet(&[_]Feature{}), |
| 723 | }; | 723 | }; |
| 724 | result[@intFromEnum(Feature.fast_variable_perlane_shuffle)] = .{ | 724 | result[@backingInt(Feature.fast_variable_perlane_shuffle)] = .{ |
| 725 | .llvm_name = "fast-variable-perlane-shuffle", | 725 | .llvm_name = "fast-variable-perlane-shuffle", |
| 726 | .description = "Per-lane shuffles with variable masks are fast", | 726 | .description = "Per-lane shuffles with variable masks are fast", |
| 727 | .dependencies = featureSet(&[_]Feature{}), | 727 | .dependencies = featureSet(&[_]Feature{}), |
| 728 | }; | 728 | }; |
| 729 | result[@intFromEnum(Feature.fast_vector_fsqrt)] = .{ | 729 | result[@backingInt(Feature.fast_vector_fsqrt)] = .{ |
| 730 | .llvm_name = "fast-vector-fsqrt", | 730 | .llvm_name = "fast-vector-fsqrt", |
| 731 | .description = "Vector SQRT is fast (disable Newton-Raphson)", | 731 | .description = "Vector SQRT is fast (disable Newton-Raphson)", |
| 732 | .dependencies = featureSet(&[_]Feature{}), | 732 | .dependencies = featureSet(&[_]Feature{}), |
| 733 | }; | 733 | }; |
| 734 | result[@intFromEnum(Feature.fast_vector_shift_masks)] = .{ | 734 | result[@backingInt(Feature.fast_vector_shift_masks)] = .{ |
| 735 | .llvm_name = "fast-vector-shift-masks", | 735 | .llvm_name = "fast-vector-shift-masks", |
| 736 | .description = "Prefer a left/right vector logical shift pair over a shift+and pair", | 736 | .description = "Prefer a left/right vector logical shift pair over a shift+and pair", |
| 737 | .dependencies = featureSet(&[_]Feature{}), | 737 | .dependencies = featureSet(&[_]Feature{}), |
| 738 | }; | 738 | }; |
| 739 | result[@intFromEnum(Feature.faster_shift_than_shuffle)] = .{ | 739 | result[@backingInt(Feature.faster_shift_than_shuffle)] = .{ |
| 740 | .llvm_name = "faster-shift-than-shuffle", | 740 | .llvm_name = "faster-shift-than-shuffle", |
| 741 | .description = "Shifts are faster (or as fast) as shuffle", | 741 | .description = "Shifts are faster (or as fast) as shuffle", |
| 742 | .dependencies = featureSet(&[_]Feature{}), | 742 | .dependencies = featureSet(&[_]Feature{}), |
| 743 | }; | 743 | }; |
| 744 | result[@intFromEnum(Feature.fma)] = .{ | 744 | result[@backingInt(Feature.fma)] = .{ |
| 745 | .llvm_name = "fma", | 745 | .llvm_name = "fma", |
| 746 | .description = "Enable three-operand fused multiple-add", | 746 | .description = "Enable three-operand fused multiple-add", |
| 747 | .dependencies = featureSet(&[_]Feature{ | 747 | .dependencies = featureSet(&[_]Feature{ |
| 748 | .avx, | 748 | .avx, |
| 749 | }), | 749 | }), |
| 750 | }; | 750 | }; |
| 751 | result[@intFromEnum(Feature.fma4)] = .{ | 751 | result[@backingInt(Feature.fma4)] = .{ |
| 752 | .llvm_name = "fma4", | 752 | .llvm_name = "fma4", |
| 753 | .description = "Enable four-operand fused multiple-add", | 753 | .description = "Enable four-operand fused multiple-add", |
| 754 | .dependencies = featureSet(&[_]Feature{ | 754 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -756,288 +756,288 @@ pub const all_features = blk: { | ... | @@ -756,288 +756,288 @@ pub const all_features = blk: { |
| 756 | .sse4a, | 756 | .sse4a, |
| 757 | }), | 757 | }), |
| 758 | }; | 758 | }; |
| 759 | result[@intFromEnum(Feature.fsgsbase)] = .{ | 759 | result[@backingInt(Feature.fsgsbase)] = .{ |
| 760 | .llvm_name = "fsgsbase", | 760 | .llvm_name = "fsgsbase", |
| 761 | .description = "Support FS/GS Base instructions", | 761 | .description = "Support FS/GS Base instructions", |
| 762 | .dependencies = featureSet(&[_]Feature{}), | 762 | .dependencies = featureSet(&[_]Feature{}), |
| 763 | }; | 763 | }; |
| 764 | result[@intFromEnum(Feature.fsrm)] = .{ | 764 | result[@backingInt(Feature.fsrm)] = .{ |
| 765 | .llvm_name = "fsrm", | 765 | .llvm_name = "fsrm", |
| 766 | .description = "REP MOVSB of short lengths is faster", | 766 | .description = "REP MOVSB of short lengths is faster", |
| 767 | .dependencies = featureSet(&[_]Feature{}), | 767 | .dependencies = featureSet(&[_]Feature{}), |
| 768 | }; | 768 | }; |
| 769 | result[@intFromEnum(Feature.fxsr)] = .{ | 769 | result[@backingInt(Feature.fxsr)] = .{ |
| 770 | .llvm_name = "fxsr", | 770 | .llvm_name = "fxsr", |
| 771 | .description = "Support fxsave/fxrestore instructions", | 771 | .description = "Support fxsave/fxrestore instructions", |
| 772 | .dependencies = featureSet(&[_]Feature{}), | 772 | .dependencies = featureSet(&[_]Feature{}), |
| 773 | }; | 773 | }; |
| 774 | result[@intFromEnum(Feature.gfni)] = .{ | 774 | result[@backingInt(Feature.gfni)] = .{ |
| 775 | .llvm_name = "gfni", | 775 | .llvm_name = "gfni", |
| 776 | .description = "Enable Galois Field Arithmetic Instructions", | 776 | .description = "Enable Galois Field Arithmetic Instructions", |
| 777 | .dependencies = featureSet(&[_]Feature{ | 777 | .dependencies = featureSet(&[_]Feature{ |
| 778 | .sse2, | 778 | .sse2, |
| 779 | }), | 779 | }), |
| 780 | }; | 780 | }; |
| 781 | result[@intFromEnum(Feature.harden_sls_ijmp)] = .{ | 781 | result[@backingInt(Feature.harden_sls_ijmp)] = .{ |
| 782 | .llvm_name = "harden-sls-ijmp", | 782 | .llvm_name = "harden-sls-ijmp", |
| 783 | .description = "Harden against straight line speculation across indirect JMP instructions.", | 783 | .description = "Harden against straight line speculation across indirect JMP instructions.", |
| 784 | .dependencies = featureSet(&[_]Feature{}), | 784 | .dependencies = featureSet(&[_]Feature{}), |
| 785 | }; | 785 | }; |
| 786 | result[@intFromEnum(Feature.harden_sls_ret)] = .{ | 786 | result[@backingInt(Feature.harden_sls_ret)] = .{ |
| 787 | .llvm_name = "harden-sls-ret", | 787 | .llvm_name = "harden-sls-ret", |
| 788 | .description = "Harden against straight line speculation across RET instructions.", | 788 | .description = "Harden against straight line speculation across RET instructions.", |
| 789 | .dependencies = featureSet(&[_]Feature{}), | 789 | .dependencies = featureSet(&[_]Feature{}), |
| 790 | }; | 790 | }; |
| 791 | result[@intFromEnum(Feature.hreset)] = .{ | 791 | result[@backingInt(Feature.hreset)] = .{ |
| 792 | .llvm_name = "hreset", | 792 | .llvm_name = "hreset", |
| 793 | .description = "Has hreset instruction", | 793 | .description = "Has hreset instruction", |
| 794 | .dependencies = featureSet(&[_]Feature{}), | 794 | .dependencies = featureSet(&[_]Feature{}), |
| 795 | }; | 795 | }; |
| 796 | result[@intFromEnum(Feature.idivl_to_divb)] = .{ | 796 | result[@backingInt(Feature.idivl_to_divb)] = .{ |
| 797 | .llvm_name = "idivl-to-divb", | 797 | .llvm_name = "idivl-to-divb", |
| 798 | .description = "Use 8-bit divide for positive values less than 256", | 798 | .description = "Use 8-bit divide for positive values less than 256", |
| 799 | .dependencies = featureSet(&[_]Feature{}), | 799 | .dependencies = featureSet(&[_]Feature{}), |
| 800 | }; | 800 | }; |
| 801 | result[@intFromEnum(Feature.idivq_to_divl)] = .{ | 801 | result[@backingInt(Feature.idivq_to_divl)] = .{ |
| 802 | .llvm_name = "idivq-to-divl", | 802 | .llvm_name = "idivq-to-divl", |
| 803 | .description = "Use 32-bit divide for positive values less than 2^32", | 803 | .description = "Use 32-bit divide for positive values less than 2^32", |
| 804 | .dependencies = featureSet(&[_]Feature{}), | 804 | .dependencies = featureSet(&[_]Feature{}), |
| 805 | }; | 805 | }; |
| 806 | result[@intFromEnum(Feature.inline_asm_use_gpr32)] = .{ | 806 | result[@backingInt(Feature.inline_asm_use_gpr32)] = .{ |
| 807 | .llvm_name = "inline-asm-use-gpr32", | 807 | .llvm_name = "inline-asm-use-gpr32", |
| 808 | .description = "Enable use of GPR32 in inline assembly for APX", | 808 | .description = "Enable use of GPR32 in inline assembly for APX", |
| 809 | .dependencies = featureSet(&[_]Feature{}), | 809 | .dependencies = featureSet(&[_]Feature{}), |
| 810 | }; | 810 | }; |
| 811 | result[@intFromEnum(Feature.invpcid)] = .{ | 811 | result[@backingInt(Feature.invpcid)] = .{ |
| 812 | .llvm_name = "invpcid", | 812 | .llvm_name = "invpcid", |
| 813 | .description = "Invalidate Process-Context Identifier", | 813 | .description = "Invalidate Process-Context Identifier", |
| 814 | .dependencies = featureSet(&[_]Feature{}), | 814 | .dependencies = featureSet(&[_]Feature{}), |
| 815 | }; | 815 | }; |
| 816 | result[@intFromEnum(Feature.kl)] = .{ | 816 | result[@backingInt(Feature.kl)] = .{ |
| 817 | .llvm_name = "kl", | 817 | .llvm_name = "kl", |
| 818 | .description = "Support Key Locker kl Instructions", | 818 | .description = "Support Key Locker kl Instructions", |
| 819 | .dependencies = featureSet(&[_]Feature{ | 819 | .dependencies = featureSet(&[_]Feature{ |
| 820 | .sse2, | 820 | .sse2, |
| 821 | }), | 821 | }), |
| 822 | }; | 822 | }; |
| 823 | result[@intFromEnum(Feature.lea_sp)] = .{ | 823 | result[@backingInt(Feature.lea_sp)] = .{ |
| 824 | .llvm_name = "lea-sp", | 824 | .llvm_name = "lea-sp", |
| 825 | .description = "Use LEA for adjusting the stack pointer (this is an optimization for Intel Atom processors)", | 825 | .description = "Use LEA for adjusting the stack pointer (this is an optimization for Intel Atom processors)", |
| 826 | .dependencies = featureSet(&[_]Feature{}), | 826 | .dependencies = featureSet(&[_]Feature{}), |
| 827 | }; | 827 | }; |
| 828 | result[@intFromEnum(Feature.lea_uses_ag)] = .{ | 828 | result[@backingInt(Feature.lea_uses_ag)] = .{ |
| 829 | .llvm_name = "lea-uses-ag", | 829 | .llvm_name = "lea-uses-ag", |
| 830 | .description = "LEA instruction needs inputs at AG stage", | 830 | .description = "LEA instruction needs inputs at AG stage", |
| 831 | .dependencies = featureSet(&[_]Feature{}), | 831 | .dependencies = featureSet(&[_]Feature{}), |
| 832 | }; | 832 | }; |
| 833 | result[@intFromEnum(Feature.lvi_cfi)] = .{ | 833 | result[@backingInt(Feature.lvi_cfi)] = .{ |
| 834 | .llvm_name = "lvi-cfi", | 834 | .llvm_name = "lvi-cfi", |
| 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.", | 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 | .dependencies = featureSet(&[_]Feature{}), | 836 | .dependencies = featureSet(&[_]Feature{}), |
| 837 | }; | 837 | }; |
| 838 | result[@intFromEnum(Feature.lvi_load_hardening)] = .{ | 838 | result[@backingInt(Feature.lvi_load_hardening)] = .{ |
| 839 | .llvm_name = "lvi-load-hardening", | 839 | .llvm_name = "lvi-load-hardening", |
| 840 | .description = "Insert LFENCE instructions to prevent data speculatively injected into loads from being used maliciously.", | 840 | .description = "Insert LFENCE instructions to prevent data speculatively injected into loads from being used maliciously.", |
| 841 | .dependencies = featureSet(&[_]Feature{}), | 841 | .dependencies = featureSet(&[_]Feature{}), |
| 842 | }; | 842 | }; |
| 843 | result[@intFromEnum(Feature.lwp)] = .{ | 843 | result[@backingInt(Feature.lwp)] = .{ |
| 844 | .llvm_name = "lwp", | 844 | .llvm_name = "lwp", |
| 845 | .description = "Enable LWP instructions", | 845 | .description = "Enable LWP instructions", |
| 846 | .dependencies = featureSet(&[_]Feature{}), | 846 | .dependencies = featureSet(&[_]Feature{}), |
| 847 | }; | 847 | }; |
| 848 | result[@intFromEnum(Feature.lzcnt)] = .{ | 848 | result[@backingInt(Feature.lzcnt)] = .{ |
| 849 | .llvm_name = "lzcnt", | 849 | .llvm_name = "lzcnt", |
| 850 | .description = "Support LZCNT instruction", | 850 | .description = "Support LZCNT instruction", |
| 851 | .dependencies = featureSet(&[_]Feature{}), | 851 | .dependencies = featureSet(&[_]Feature{}), |
| 852 | }; | 852 | }; |
| 853 | result[@intFromEnum(Feature.macrofusion)] = .{ | 853 | result[@backingInt(Feature.macrofusion)] = .{ |
| 854 | .llvm_name = "macrofusion", | 854 | .llvm_name = "macrofusion", |
| 855 | .description = "Various instructions can be fused with conditional branches", | 855 | .description = "Various instructions can be fused with conditional branches", |
| 856 | .dependencies = featureSet(&[_]Feature{}), | 856 | .dependencies = featureSet(&[_]Feature{}), |
| 857 | }; | 857 | }; |
| 858 | result[@intFromEnum(Feature.mmx)] = .{ | 858 | result[@backingInt(Feature.mmx)] = .{ |
| 859 | .llvm_name = "mmx", | 859 | .llvm_name = "mmx", |
| 860 | .description = "Enable MMX instructions", | 860 | .description = "Enable MMX instructions", |
| 861 | .dependencies = featureSet(&[_]Feature{}), | 861 | .dependencies = featureSet(&[_]Feature{}), |
| 862 | }; | 862 | }; |
| 863 | result[@intFromEnum(Feature.movbe)] = .{ | 863 | result[@backingInt(Feature.movbe)] = .{ |
| 864 | .llvm_name = "movbe", | 864 | .llvm_name = "movbe", |
| 865 | .description = "Support MOVBE instruction", | 865 | .description = "Support MOVBE instruction", |
| 866 | .dependencies = featureSet(&[_]Feature{}), | 866 | .dependencies = featureSet(&[_]Feature{}), |
| 867 | }; | 867 | }; |
| 868 | result[@intFromEnum(Feature.movdir64b)] = .{ | 868 | result[@backingInt(Feature.movdir64b)] = .{ |
| 869 | .llvm_name = "movdir64b", | 869 | .llvm_name = "movdir64b", |
| 870 | .description = "Support movdir64b instruction (direct store 64 bytes)", | 870 | .description = "Support movdir64b instruction (direct store 64 bytes)", |
| 871 | .dependencies = featureSet(&[_]Feature{}), | 871 | .dependencies = featureSet(&[_]Feature{}), |
| 872 | }; | 872 | }; |
| 873 | result[@intFromEnum(Feature.movdiri)] = .{ | 873 | result[@backingInt(Feature.movdiri)] = .{ |
| 874 | .llvm_name = "movdiri", | 874 | .llvm_name = "movdiri", |
| 875 | .description = "Support movdiri instruction (direct store integer)", | 875 | .description = "Support movdiri instruction (direct store integer)", |
| 876 | .dependencies = featureSet(&[_]Feature{}), | 876 | .dependencies = featureSet(&[_]Feature{}), |
| 877 | }; | 877 | }; |
| 878 | result[@intFromEnum(Feature.movrs)] = .{ | 878 | result[@backingInt(Feature.movrs)] = .{ |
| 879 | .llvm_name = "movrs", | 879 | .llvm_name = "movrs", |
| 880 | .description = "Enable MOVRS", | 880 | .description = "Enable MOVRS", |
| 881 | .dependencies = featureSet(&[_]Feature{}), | 881 | .dependencies = featureSet(&[_]Feature{}), |
| 882 | }; | 882 | }; |
| 883 | result[@intFromEnum(Feature.mwaitx)] = .{ | 883 | result[@backingInt(Feature.mwaitx)] = .{ |
| 884 | .llvm_name = "mwaitx", | 884 | .llvm_name = "mwaitx", |
| 885 | .description = "Enable MONITORX/MWAITX timer functionality", | 885 | .description = "Enable MONITORX/MWAITX timer functionality", |
| 886 | .dependencies = featureSet(&[_]Feature{}), | 886 | .dependencies = featureSet(&[_]Feature{}), |
| 887 | }; | 887 | }; |
| 888 | result[@intFromEnum(Feature.ndd)] = .{ | 888 | result[@backingInt(Feature.ndd)] = .{ |
| 889 | .llvm_name = "ndd", | 889 | .llvm_name = "ndd", |
| 890 | .description = "Support non-destructive destination", | 890 | .description = "Support non-destructive destination", |
| 891 | .dependencies = featureSet(&[_]Feature{}), | 891 | .dependencies = featureSet(&[_]Feature{}), |
| 892 | }; | 892 | }; |
| 893 | result[@intFromEnum(Feature.nf)] = .{ | 893 | result[@backingInt(Feature.nf)] = .{ |
| 894 | .llvm_name = "nf", | 894 | .llvm_name = "nf", |
| 895 | .description = "Support status flags update suppression", | 895 | .description = "Support status flags update suppression", |
| 896 | .dependencies = featureSet(&[_]Feature{}), | 896 | .dependencies = featureSet(&[_]Feature{}), |
| 897 | }; | 897 | }; |
| 898 | result[@intFromEnum(Feature.no_bypass_delay)] = .{ | 898 | result[@backingInt(Feature.no_bypass_delay)] = .{ |
| 899 | .llvm_name = "no-bypass-delay", | 899 | .llvm_name = "no-bypass-delay", |
| 900 | .description = "Has no bypass delay when using the 'wrong' domain", | 900 | .description = "Has no bypass delay when using the 'wrong' domain", |
| 901 | .dependencies = featureSet(&[_]Feature{}), | 901 | .dependencies = featureSet(&[_]Feature{}), |
| 902 | }; | 902 | }; |
| 903 | result[@intFromEnum(Feature.no_bypass_delay_blend)] = .{ | 903 | result[@backingInt(Feature.no_bypass_delay_blend)] = .{ |
| 904 | .llvm_name = "no-bypass-delay-blend", | 904 | .llvm_name = "no-bypass-delay-blend", |
| 905 | .description = "Has no bypass delay when using the 'wrong' blend type", | 905 | .description = "Has no bypass delay when using the 'wrong' blend type", |
| 906 | .dependencies = featureSet(&[_]Feature{}), | 906 | .dependencies = featureSet(&[_]Feature{}), |
| 907 | }; | 907 | }; |
| 908 | result[@intFromEnum(Feature.no_bypass_delay_mov)] = .{ | 908 | result[@backingInt(Feature.no_bypass_delay_mov)] = .{ |
| 909 | .llvm_name = "no-bypass-delay-mov", | 909 | .llvm_name = "no-bypass-delay-mov", |
| 910 | .description = "Has no bypass delay when using the 'wrong' mov type", | 910 | .description = "Has no bypass delay when using the 'wrong' mov type", |
| 911 | .dependencies = featureSet(&[_]Feature{}), | 911 | .dependencies = featureSet(&[_]Feature{}), |
| 912 | }; | 912 | }; |
| 913 | result[@intFromEnum(Feature.no_bypass_delay_shuffle)] = .{ | 913 | result[@backingInt(Feature.no_bypass_delay_shuffle)] = .{ |
| 914 | .llvm_name = "no-bypass-delay-shuffle", | 914 | .llvm_name = "no-bypass-delay-shuffle", |
| 915 | .description = "Has no bypass delay when using the 'wrong' shuffle type", | 915 | .description = "Has no bypass delay when using the 'wrong' shuffle type", |
| 916 | .dependencies = featureSet(&[_]Feature{}), | 916 | .dependencies = featureSet(&[_]Feature{}), |
| 917 | }; | 917 | }; |
| 918 | result[@intFromEnum(Feature.nopl)] = .{ | 918 | result[@backingInt(Feature.nopl)] = .{ |
| 919 | .llvm_name = "nopl", | 919 | .llvm_name = "nopl", |
| 920 | .description = "Enable NOPL instruction (generally pentium pro+)", | 920 | .description = "Enable NOPL instruction (generally pentium pro+)", |
| 921 | .dependencies = featureSet(&[_]Feature{}), | 921 | .dependencies = featureSet(&[_]Feature{}), |
| 922 | }; | 922 | }; |
| 923 | result[@intFromEnum(Feature.pad_short_functions)] = .{ | 923 | result[@backingInt(Feature.pad_short_functions)] = .{ |
| 924 | .llvm_name = "pad-short-functions", | 924 | .llvm_name = "pad-short-functions", |
| 925 | .description = "Pad short functions (to prevent a stall when returning too early)", | 925 | .description = "Pad short functions (to prevent a stall when returning too early)", |
| 926 | .dependencies = featureSet(&[_]Feature{}), | 926 | .dependencies = featureSet(&[_]Feature{}), |
| 927 | }; | 927 | }; |
| 928 | result[@intFromEnum(Feature.pclmul)] = .{ | 928 | result[@backingInt(Feature.pclmul)] = .{ |
| 929 | .llvm_name = "pclmul", | 929 | .llvm_name = "pclmul", |
| 930 | .description = "Enable packed carry-less multiplication instructions", | 930 | .description = "Enable packed carry-less multiplication instructions", |
| 931 | .dependencies = featureSet(&[_]Feature{ | 931 | .dependencies = featureSet(&[_]Feature{ |
| 932 | .sse2, | 932 | .sse2, |
| 933 | }), | 933 | }), |
| 934 | }; | 934 | }; |
| 935 | result[@intFromEnum(Feature.pconfig)] = .{ | 935 | result[@backingInt(Feature.pconfig)] = .{ |
| 936 | .llvm_name = "pconfig", | 936 | .llvm_name = "pconfig", |
| 937 | .description = "platform configuration instruction", | 937 | .description = "platform configuration instruction", |
| 938 | .dependencies = featureSet(&[_]Feature{}), | 938 | .dependencies = featureSet(&[_]Feature{}), |
| 939 | }; | 939 | }; |
| 940 | result[@intFromEnum(Feature.pku)] = .{ | 940 | result[@backingInt(Feature.pku)] = .{ |
| 941 | .llvm_name = "pku", | 941 | .llvm_name = "pku", |
| 942 | .description = "Enable protection keys", | 942 | .description = "Enable protection keys", |
| 943 | .dependencies = featureSet(&[_]Feature{}), | 943 | .dependencies = featureSet(&[_]Feature{}), |
| 944 | }; | 944 | }; |
| 945 | result[@intFromEnum(Feature.popcnt)] = .{ | 945 | result[@backingInt(Feature.popcnt)] = .{ |
| 946 | .llvm_name = "popcnt", | 946 | .llvm_name = "popcnt", |
| 947 | .description = "Support POPCNT instruction", | 947 | .description = "Support POPCNT instruction", |
| 948 | .dependencies = featureSet(&[_]Feature{}), | 948 | .dependencies = featureSet(&[_]Feature{}), |
| 949 | }; | 949 | }; |
| 950 | result[@intFromEnum(Feature.ppx)] = .{ | 950 | result[@backingInt(Feature.ppx)] = .{ |
| 951 | .llvm_name = "ppx", | 951 | .llvm_name = "ppx", |
| 952 | .description = "Support Push-Pop Acceleration", | 952 | .description = "Support Push-Pop Acceleration", |
| 953 | .dependencies = featureSet(&[_]Feature{}), | 953 | .dependencies = featureSet(&[_]Feature{}), |
| 954 | }; | 954 | }; |
| 955 | result[@intFromEnum(Feature.prefer_128_bit)] = .{ | 955 | result[@backingInt(Feature.prefer_128_bit)] = .{ |
| 956 | .llvm_name = "prefer-128-bit", | 956 | .llvm_name = "prefer-128-bit", |
| 957 | .description = "Prefer 128-bit AVX instructions", | 957 | .description = "Prefer 128-bit AVX instructions", |
| 958 | .dependencies = featureSet(&[_]Feature{}), | 958 | .dependencies = featureSet(&[_]Feature{}), |
| 959 | }; | 959 | }; |
| 960 | result[@intFromEnum(Feature.prefer_256_bit)] = .{ | 960 | result[@backingInt(Feature.prefer_256_bit)] = .{ |
| 961 | .llvm_name = "prefer-256-bit", | 961 | .llvm_name = "prefer-256-bit", |
| 962 | .description = "Prefer 256-bit AVX instructions", | 962 | .description = "Prefer 256-bit AVX instructions", |
| 963 | .dependencies = featureSet(&[_]Feature{}), | 963 | .dependencies = featureSet(&[_]Feature{}), |
| 964 | }; | 964 | }; |
| 965 | result[@intFromEnum(Feature.prefer_legacy_setcc)] = .{ | 965 | result[@backingInt(Feature.prefer_legacy_setcc)] = .{ |
| 966 | .llvm_name = "prefer-legacy-setcc", | 966 | .llvm_name = "prefer-legacy-setcc", |
| 967 | .description = "Prefer to emit legacy SetCC.", | 967 | .description = "Prefer to emit legacy SetCC.", |
| 968 | .dependencies = featureSet(&[_]Feature{}), | 968 | .dependencies = featureSet(&[_]Feature{}), |
| 969 | }; | 969 | }; |
| 970 | result[@intFromEnum(Feature.prefer_mask_registers)] = .{ | 970 | result[@backingInt(Feature.prefer_mask_registers)] = .{ |
| 971 | .llvm_name = "prefer-mask-registers", | 971 | .llvm_name = "prefer-mask-registers", |
| 972 | .description = "Prefer AVX512 mask registers over PTEST/MOVMSK", | 972 | .description = "Prefer AVX512 mask registers over PTEST/MOVMSK", |
| 973 | .dependencies = featureSet(&[_]Feature{}), | 973 | .dependencies = featureSet(&[_]Feature{}), |
| 974 | }; | 974 | }; |
| 975 | result[@intFromEnum(Feature.prefer_movmsk_over_vtest)] = .{ | 975 | result[@backingInt(Feature.prefer_movmsk_over_vtest)] = .{ |
| 976 | .llvm_name = "prefer-movmsk-over-vtest", | 976 | .llvm_name = "prefer-movmsk-over-vtest", |
| 977 | .description = "Prefer movmsk over vtest instruction", | 977 | .description = "Prefer movmsk over vtest instruction", |
| 978 | .dependencies = featureSet(&[_]Feature{}), | 978 | .dependencies = featureSet(&[_]Feature{}), |
| 979 | }; | 979 | }; |
| 980 | result[@intFromEnum(Feature.prefer_no_gather)] = .{ | 980 | result[@backingInt(Feature.prefer_no_gather)] = .{ |
| 981 | .llvm_name = "prefer-no-gather", | 981 | .llvm_name = "prefer-no-gather", |
| 982 | .description = "Prefer no gather instructions", | 982 | .description = "Prefer no gather instructions", |
| 983 | .dependencies = featureSet(&[_]Feature{}), | 983 | .dependencies = featureSet(&[_]Feature{}), |
| 984 | }; | 984 | }; |
| 985 | result[@intFromEnum(Feature.prefer_no_scatter)] = .{ | 985 | result[@backingInt(Feature.prefer_no_scatter)] = .{ |
| 986 | .llvm_name = "prefer-no-scatter", | 986 | .llvm_name = "prefer-no-scatter", |
| 987 | .description = "Prefer no scatter instructions", | 987 | .description = "Prefer no scatter instructions", |
| 988 | .dependencies = featureSet(&[_]Feature{}), | 988 | .dependencies = featureSet(&[_]Feature{}), |
| 989 | }; | 989 | }; |
| 990 | result[@intFromEnum(Feature.prefetchi)] = .{ | 990 | result[@backingInt(Feature.prefetchi)] = .{ |
| 991 | .llvm_name = "prefetchi", | 991 | .llvm_name = "prefetchi", |
| 992 | .description = "Prefetch instruction with T0 or T1 Hint", | 992 | .description = "Prefetch instruction with T0 or T1 Hint", |
| 993 | .dependencies = featureSet(&[_]Feature{}), | 993 | .dependencies = featureSet(&[_]Feature{}), |
| 994 | }; | 994 | }; |
| 995 | result[@intFromEnum(Feature.prefetchwt1)] = .{ | 995 | result[@backingInt(Feature.prefetchwt1)] = .{ |
| 996 | .llvm_name = null, | 996 | .llvm_name = null, |
| 997 | .description = "Prefetch with Intent to Write and T1 Hint", | 997 | .description = "Prefetch with Intent to Write and T1 Hint", |
| 998 | .dependencies = featureSet(&[_]Feature{}), | 998 | .dependencies = featureSet(&[_]Feature{}), |
| 999 | }; | 999 | }; |
| 1000 | result[@intFromEnum(Feature.prfchw)] = .{ | 1000 | result[@backingInt(Feature.prfchw)] = .{ |
| 1001 | .llvm_name = "prfchw", | 1001 | .llvm_name = "prfchw", |
| 1002 | .description = "Support PRFCHW instructions", | 1002 | .description = "Support PRFCHW instructions", |
| 1003 | .dependencies = featureSet(&[_]Feature{}), | 1003 | .dependencies = featureSet(&[_]Feature{}), |
| 1004 | }; | 1004 | }; |
| 1005 | result[@intFromEnum(Feature.ptwrite)] = .{ | 1005 | result[@backingInt(Feature.ptwrite)] = .{ |
| 1006 | .llvm_name = "ptwrite", | 1006 | .llvm_name = "ptwrite", |
| 1007 | .description = "Support ptwrite instruction", | 1007 | .description = "Support ptwrite instruction", |
| 1008 | .dependencies = featureSet(&[_]Feature{}), | 1008 | .dependencies = featureSet(&[_]Feature{}), |
| 1009 | }; | 1009 | }; |
| 1010 | result[@intFromEnum(Feature.push2pop2)] = .{ | 1010 | result[@backingInt(Feature.push2pop2)] = .{ |
| 1011 | .llvm_name = "push2pop2", | 1011 | .llvm_name = "push2pop2", |
| 1012 | .description = "Support PUSH2/POP2 instructions", | 1012 | .description = "Support PUSH2/POP2 instructions", |
| 1013 | .dependencies = featureSet(&[_]Feature{}), | 1013 | .dependencies = featureSet(&[_]Feature{}), |
| 1014 | }; | 1014 | }; |
| 1015 | result[@intFromEnum(Feature.raoint)] = .{ | 1015 | result[@backingInt(Feature.raoint)] = .{ |
| 1016 | .llvm_name = "raoint", | 1016 | .llvm_name = "raoint", |
| 1017 | .description = "Support RAO-INT instructions", | 1017 | .description = "Support RAO-INT instructions", |
| 1018 | .dependencies = featureSet(&[_]Feature{}), | 1018 | .dependencies = featureSet(&[_]Feature{}), |
| 1019 | }; | 1019 | }; |
| 1020 | result[@intFromEnum(Feature.rdpid)] = .{ | 1020 | result[@backingInt(Feature.rdpid)] = .{ |
| 1021 | .llvm_name = "rdpid", | 1021 | .llvm_name = "rdpid", |
| 1022 | .description = "Support RDPID instructions", | 1022 | .description = "Support RDPID instructions", |
| 1023 | .dependencies = featureSet(&[_]Feature{}), | 1023 | .dependencies = featureSet(&[_]Feature{}), |
| 1024 | }; | 1024 | }; |
| 1025 | result[@intFromEnum(Feature.rdpru)] = .{ | 1025 | result[@backingInt(Feature.rdpru)] = .{ |
| 1026 | .llvm_name = "rdpru", | 1026 | .llvm_name = "rdpru", |
| 1027 | .description = "Support RDPRU instructions", | 1027 | .description = "Support RDPRU instructions", |
| 1028 | .dependencies = featureSet(&[_]Feature{}), | 1028 | .dependencies = featureSet(&[_]Feature{}), |
| 1029 | }; | 1029 | }; |
| 1030 | result[@intFromEnum(Feature.rdrnd)] = .{ | 1030 | result[@backingInt(Feature.rdrnd)] = .{ |
| 1031 | .llvm_name = "rdrnd", | 1031 | .llvm_name = "rdrnd", |
| 1032 | .description = "Support RDRAND instruction", | 1032 | .description = "Support RDRAND instruction", |
| 1033 | .dependencies = featureSet(&[_]Feature{}), | 1033 | .dependencies = featureSet(&[_]Feature{}), |
| 1034 | }; | 1034 | }; |
| 1035 | result[@intFromEnum(Feature.rdseed)] = .{ | 1035 | result[@backingInt(Feature.rdseed)] = .{ |
| 1036 | .llvm_name = "rdseed", | 1036 | .llvm_name = "rdseed", |
| 1037 | .description = "Support RDSEED instruction", | 1037 | .description = "Support RDSEED instruction", |
| 1038 | .dependencies = featureSet(&[_]Feature{}), | 1038 | .dependencies = featureSet(&[_]Feature{}), |
| 1039 | }; | 1039 | }; |
| 1040 | result[@intFromEnum(Feature.retpoline)] = .{ | 1040 | result[@backingInt(Feature.retpoline)] = .{ |
| 1041 | .llvm_name = "retpoline", | 1041 | .llvm_name = "retpoline", |
| 1042 | .description = "Remove speculation of indirect branches from the generated code, either by avoiding them entirely or lowering them with a speculation blocking construct", | 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 | .dependencies = featureSet(&[_]Feature{ | 1043 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1045,180 +1045,180 @@ pub const all_features = blk: { | ... | @@ -1045,180 +1045,180 @@ pub const all_features = blk: { |
| 1045 | .retpoline_indirect_calls, | 1045 | .retpoline_indirect_calls, |
| 1046 | }), | 1046 | }), |
| 1047 | }; | 1047 | }; |
| 1048 | result[@intFromEnum(Feature.retpoline_external_thunk)] = .{ | 1048 | result[@backingInt(Feature.retpoline_external_thunk)] = .{ |
| 1049 | .llvm_name = "retpoline-external-thunk", | 1049 | .llvm_name = "retpoline-external-thunk", |
| 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", | 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 | .dependencies = featureSet(&[_]Feature{ | 1051 | .dependencies = featureSet(&[_]Feature{ |
| 1052 | .retpoline_indirect_calls, | 1052 | .retpoline_indirect_calls, |
| 1053 | }), | 1053 | }), |
| 1054 | }; | 1054 | }; |
| 1055 | result[@intFromEnum(Feature.retpoline_indirect_branches)] = .{ | 1055 | result[@backingInt(Feature.retpoline_indirect_branches)] = .{ |
| 1056 | .llvm_name = "retpoline-indirect-branches", | 1056 | .llvm_name = "retpoline-indirect-branches", |
| 1057 | .description = "Remove speculation of indirect branches from the generated code", | 1057 | .description = "Remove speculation of indirect branches from the generated code", |
| 1058 | .dependencies = featureSet(&[_]Feature{}), | 1058 | .dependencies = featureSet(&[_]Feature{}), |
| 1059 | }; | 1059 | }; |
| 1060 | result[@intFromEnum(Feature.retpoline_indirect_calls)] = .{ | 1060 | result[@backingInt(Feature.retpoline_indirect_calls)] = .{ |
| 1061 | .llvm_name = "retpoline-indirect-calls", | 1061 | .llvm_name = "retpoline-indirect-calls", |
| 1062 | .description = "Remove speculation of indirect calls from the generated code", | 1062 | .description = "Remove speculation of indirect calls from the generated code", |
| 1063 | .dependencies = featureSet(&[_]Feature{}), | 1063 | .dependencies = featureSet(&[_]Feature{}), |
| 1064 | }; | 1064 | }; |
| 1065 | result[@intFromEnum(Feature.rtm)] = .{ | 1065 | result[@backingInt(Feature.rtm)] = .{ |
| 1066 | .llvm_name = "rtm", | 1066 | .llvm_name = "rtm", |
| 1067 | .description = "Support RTM instructions", | 1067 | .description = "Support RTM instructions", |
| 1068 | .dependencies = featureSet(&[_]Feature{}), | 1068 | .dependencies = featureSet(&[_]Feature{}), |
| 1069 | }; | 1069 | }; |
| 1070 | result[@intFromEnum(Feature.sahf)] = .{ | 1070 | result[@backingInt(Feature.sahf)] = .{ |
| 1071 | .llvm_name = "sahf", | 1071 | .llvm_name = "sahf", |
| 1072 | .description = "Support LAHF and SAHF instructions in 64-bit mode", | 1072 | .description = "Support LAHF and SAHF instructions in 64-bit mode", |
| 1073 | .dependencies = featureSet(&[_]Feature{}), | 1073 | .dependencies = featureSet(&[_]Feature{}), |
| 1074 | }; | 1074 | }; |
| 1075 | result[@intFromEnum(Feature.sbb_dep_breaking)] = .{ | 1075 | result[@backingInt(Feature.sbb_dep_breaking)] = .{ |
| 1076 | .llvm_name = "sbb-dep-breaking", | 1076 | .llvm_name = "sbb-dep-breaking", |
| 1077 | .description = "SBB with same register has no source dependency", | 1077 | .description = "SBB with same register has no source dependency", |
| 1078 | .dependencies = featureSet(&[_]Feature{}), | 1078 | .dependencies = featureSet(&[_]Feature{}), |
| 1079 | }; | 1079 | }; |
| 1080 | result[@intFromEnum(Feature.serialize)] = .{ | 1080 | result[@backingInt(Feature.serialize)] = .{ |
| 1081 | .llvm_name = "serialize", | 1081 | .llvm_name = "serialize", |
| 1082 | .description = "Has serialize instruction", | 1082 | .description = "Has serialize instruction", |
| 1083 | .dependencies = featureSet(&[_]Feature{}), | 1083 | .dependencies = featureSet(&[_]Feature{}), |
| 1084 | }; | 1084 | }; |
| 1085 | result[@intFromEnum(Feature.seses)] = .{ | 1085 | result[@backingInt(Feature.seses)] = .{ |
| 1086 | .llvm_name = "seses", | 1086 | .llvm_name = "seses", |
| 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.", | 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 | .dependencies = featureSet(&[_]Feature{ | 1088 | .dependencies = featureSet(&[_]Feature{ |
| 1089 | .lvi_cfi, | 1089 | .lvi_cfi, |
| 1090 | }), | 1090 | }), |
| 1091 | }; | 1091 | }; |
| 1092 | result[@intFromEnum(Feature.sgx)] = .{ | 1092 | result[@backingInt(Feature.sgx)] = .{ |
| 1093 | .llvm_name = "sgx", | 1093 | .llvm_name = "sgx", |
| 1094 | .description = "Enable Software Guard Extensions", | 1094 | .description = "Enable Software Guard Extensions", |
| 1095 | .dependencies = featureSet(&[_]Feature{}), | 1095 | .dependencies = featureSet(&[_]Feature{}), |
| 1096 | }; | 1096 | }; |
| 1097 | result[@intFromEnum(Feature.sha)] = .{ | 1097 | result[@backingInt(Feature.sha)] = .{ |
| 1098 | .llvm_name = "sha", | 1098 | .llvm_name = "sha", |
| 1099 | .description = "Enable SHA instructions", | 1099 | .description = "Enable SHA instructions", |
| 1100 | .dependencies = featureSet(&[_]Feature{ | 1100 | .dependencies = featureSet(&[_]Feature{ |
| 1101 | .sse2, | 1101 | .sse2, |
| 1102 | }), | 1102 | }), |
| 1103 | }; | 1103 | }; |
| 1104 | result[@intFromEnum(Feature.sha512)] = .{ | 1104 | result[@backingInt(Feature.sha512)] = .{ |
| 1105 | .llvm_name = "sha512", | 1105 | .llvm_name = "sha512", |
| 1106 | .description = "Support SHA512 instructions", | 1106 | .description = "Support SHA512 instructions", |
| 1107 | .dependencies = featureSet(&[_]Feature{ | 1107 | .dependencies = featureSet(&[_]Feature{ |
| 1108 | .avx2, | 1108 | .avx2, |
| 1109 | }), | 1109 | }), |
| 1110 | }; | 1110 | }; |
| 1111 | result[@intFromEnum(Feature.shstk)] = .{ | 1111 | result[@backingInt(Feature.shstk)] = .{ |
| 1112 | .llvm_name = "shstk", | 1112 | .llvm_name = "shstk", |
| 1113 | .description = "Support CET Shadow-Stack instructions", | 1113 | .description = "Support CET Shadow-Stack instructions", |
| 1114 | .dependencies = featureSet(&[_]Feature{}), | 1114 | .dependencies = featureSet(&[_]Feature{}), |
| 1115 | }; | 1115 | }; |
| 1116 | result[@intFromEnum(Feature.slow_3ops_lea)] = .{ | 1116 | result[@backingInt(Feature.slow_3ops_lea)] = .{ |
| 1117 | .llvm_name = "slow-3ops-lea", | 1117 | .llvm_name = "slow-3ops-lea", |
| 1118 | .description = "LEA instruction with 3 ops or certain registers is slow", | 1118 | .description = "LEA instruction with 3 ops or certain registers is slow", |
| 1119 | .dependencies = featureSet(&[_]Feature{}), | 1119 | .dependencies = featureSet(&[_]Feature{}), |
| 1120 | }; | 1120 | }; |
| 1121 | result[@intFromEnum(Feature.slow_incdec)] = .{ | 1121 | result[@backingInt(Feature.slow_incdec)] = .{ |
| 1122 | .llvm_name = "slow-incdec", | 1122 | .llvm_name = "slow-incdec", |
| 1123 | .description = "INC and DEC instructions are slower than ADD and SUB", | 1123 | .description = "INC and DEC instructions are slower than ADD and SUB", |
| 1124 | .dependencies = featureSet(&[_]Feature{}), | 1124 | .dependencies = featureSet(&[_]Feature{}), |
| 1125 | }; | 1125 | }; |
| 1126 | result[@intFromEnum(Feature.slow_lea)] = .{ | 1126 | result[@backingInt(Feature.slow_lea)] = .{ |
| 1127 | .llvm_name = "slow-lea", | 1127 | .llvm_name = "slow-lea", |
| 1128 | .description = "LEA instruction with certain arguments is slow", | 1128 | .description = "LEA instruction with certain arguments is slow", |
| 1129 | .dependencies = featureSet(&[_]Feature{}), | 1129 | .dependencies = featureSet(&[_]Feature{}), |
| 1130 | }; | 1130 | }; |
| 1131 | result[@intFromEnum(Feature.slow_pmaddwd)] = .{ | 1131 | result[@backingInt(Feature.slow_pmaddwd)] = .{ |
| 1132 | .llvm_name = "slow-pmaddwd", | 1132 | .llvm_name = "slow-pmaddwd", |
| 1133 | .description = "PMADDWD is slower than PMULLD", | 1133 | .description = "PMADDWD is slower than PMULLD", |
| 1134 | .dependencies = featureSet(&[_]Feature{}), | 1134 | .dependencies = featureSet(&[_]Feature{}), |
| 1135 | }; | 1135 | }; |
| 1136 | result[@intFromEnum(Feature.slow_pmulld)] = .{ | 1136 | result[@backingInt(Feature.slow_pmulld)] = .{ |
| 1137 | .llvm_name = "slow-pmulld", | 1137 | .llvm_name = "slow-pmulld", |
| 1138 | .description = "PMULLD instruction is slow (compared to PMULLW/PMULHW and PMULUDQ)", | 1138 | .description = "PMULLD instruction is slow (compared to PMULLW/PMULHW and PMULUDQ)", |
| 1139 | .dependencies = featureSet(&[_]Feature{}), | 1139 | .dependencies = featureSet(&[_]Feature{}), |
| 1140 | }; | 1140 | }; |
| 1141 | result[@intFromEnum(Feature.slow_pmullq)] = .{ | 1141 | result[@backingInt(Feature.slow_pmullq)] = .{ |
| 1142 | .llvm_name = "slow-pmullq", | 1142 | .llvm_name = "slow-pmullq", |
| 1143 | .description = "PMULLQ instruction is slow", | 1143 | .description = "PMULLQ instruction is slow", |
| 1144 | .dependencies = featureSet(&[_]Feature{}), | 1144 | .dependencies = featureSet(&[_]Feature{}), |
| 1145 | }; | 1145 | }; |
| 1146 | result[@intFromEnum(Feature.slow_shld)] = .{ | 1146 | result[@backingInt(Feature.slow_shld)] = .{ |
| 1147 | .llvm_name = "slow-shld", | 1147 | .llvm_name = "slow-shld", |
| 1148 | .description = "SHLD instruction is slow", | 1148 | .description = "SHLD instruction is slow", |
| 1149 | .dependencies = featureSet(&[_]Feature{}), | 1149 | .dependencies = featureSet(&[_]Feature{}), |
| 1150 | }; | 1150 | }; |
| 1151 | result[@intFromEnum(Feature.slow_two_mem_ops)] = .{ | 1151 | result[@backingInt(Feature.slow_two_mem_ops)] = .{ |
| 1152 | .llvm_name = "slow-two-mem-ops", | 1152 | .llvm_name = "slow-two-mem-ops", |
| 1153 | .description = "Two memory operand instructions are slow", | 1153 | .description = "Two memory operand instructions are slow", |
| 1154 | .dependencies = featureSet(&[_]Feature{}), | 1154 | .dependencies = featureSet(&[_]Feature{}), |
| 1155 | }; | 1155 | }; |
| 1156 | result[@intFromEnum(Feature.slow_unaligned_mem_16)] = .{ | 1156 | result[@backingInt(Feature.slow_unaligned_mem_16)] = .{ |
| 1157 | .llvm_name = "slow-unaligned-mem-16", | 1157 | .llvm_name = "slow-unaligned-mem-16", |
| 1158 | .description = "Slow unaligned 16-byte memory access", | 1158 | .description = "Slow unaligned 16-byte memory access", |
| 1159 | .dependencies = featureSet(&[_]Feature{}), | 1159 | .dependencies = featureSet(&[_]Feature{}), |
| 1160 | }; | 1160 | }; |
| 1161 | result[@intFromEnum(Feature.slow_unaligned_mem_32)] = .{ | 1161 | result[@backingInt(Feature.slow_unaligned_mem_32)] = .{ |
| 1162 | .llvm_name = "slow-unaligned-mem-32", | 1162 | .llvm_name = "slow-unaligned-mem-32", |
| 1163 | .description = "Slow unaligned 32-byte memory access", | 1163 | .description = "Slow unaligned 32-byte memory access", |
| 1164 | .dependencies = featureSet(&[_]Feature{}), | 1164 | .dependencies = featureSet(&[_]Feature{}), |
| 1165 | }; | 1165 | }; |
| 1166 | result[@intFromEnum(Feature.sm3)] = .{ | 1166 | result[@backingInt(Feature.sm3)] = .{ |
| 1167 | .llvm_name = "sm3", | 1167 | .llvm_name = "sm3", |
| 1168 | .description = "Support SM3 instructions", | 1168 | .description = "Support SM3 instructions", |
| 1169 | .dependencies = featureSet(&[_]Feature{ | 1169 | .dependencies = featureSet(&[_]Feature{ |
| 1170 | .avx, | 1170 | .avx, |
| 1171 | }), | 1171 | }), |
| 1172 | }; | 1172 | }; |
| 1173 | result[@intFromEnum(Feature.sm4)] = .{ | 1173 | result[@backingInt(Feature.sm4)] = .{ |
| 1174 | .llvm_name = "sm4", | 1174 | .llvm_name = "sm4", |
| 1175 | .description = "Support SM4 instructions", | 1175 | .description = "Support SM4 instructions", |
| 1176 | .dependencies = featureSet(&[_]Feature{ | 1176 | .dependencies = featureSet(&[_]Feature{ |
| 1177 | .avx2, | 1177 | .avx2, |
| 1178 | }), | 1178 | }), |
| 1179 | }; | 1179 | }; |
| 1180 | result[@intFromEnum(Feature.smap)] = .{ | 1180 | result[@backingInt(Feature.smap)] = .{ |
| 1181 | .llvm_name = null, | 1181 | .llvm_name = null, |
| 1182 | .description = "Enable Supervisor Mode Access Prevention", | 1182 | .description = "Enable Supervisor Mode Access Prevention", |
| 1183 | .dependencies = featureSet(&[_]Feature{}), | 1183 | .dependencies = featureSet(&[_]Feature{}), |
| 1184 | }; | 1184 | }; |
| 1185 | result[@intFromEnum(Feature.smep)] = .{ | 1185 | result[@backingInt(Feature.smep)] = .{ |
| 1186 | .llvm_name = null, | 1186 | .llvm_name = null, |
| 1187 | .description = "Enable Supervisor Mode Execution Prevention", | 1187 | .description = "Enable Supervisor Mode Execution Prevention", |
| 1188 | .dependencies = featureSet(&[_]Feature{}), | 1188 | .dependencies = featureSet(&[_]Feature{}), |
| 1189 | }; | 1189 | }; |
| 1190 | result[@intFromEnum(Feature.soft_float)] = .{ | 1190 | result[@backingInt(Feature.soft_float)] = .{ |
| 1191 | .llvm_name = "soft-float", | 1191 | .llvm_name = "soft-float", |
| 1192 | .description = "Use software floating point features", | 1192 | .description = "Use software floating point features", |
| 1193 | .dependencies = featureSet(&[_]Feature{}), | 1193 | .dependencies = featureSet(&[_]Feature{}), |
| 1194 | }; | 1194 | }; |
| 1195 | result[@intFromEnum(Feature.sse)] = .{ | 1195 | result[@backingInt(Feature.sse)] = .{ |
| 1196 | .llvm_name = "sse", | 1196 | .llvm_name = "sse", |
| 1197 | .description = "Enable SSE instructions", | 1197 | .description = "Enable SSE instructions", |
| 1198 | .dependencies = featureSet(&[_]Feature{}), | 1198 | .dependencies = featureSet(&[_]Feature{}), |
| 1199 | }; | 1199 | }; |
| 1200 | result[@intFromEnum(Feature.sse2)] = .{ | 1200 | result[@backingInt(Feature.sse2)] = .{ |
| 1201 | .llvm_name = "sse2", | 1201 | .llvm_name = "sse2", |
| 1202 | .description = "Enable SSE2 instructions", | 1202 | .description = "Enable SSE2 instructions", |
| 1203 | .dependencies = featureSet(&[_]Feature{ | 1203 | .dependencies = featureSet(&[_]Feature{ |
| 1204 | .sse, | 1204 | .sse, |
| 1205 | }), | 1205 | }), |
| 1206 | }; | 1206 | }; |
| 1207 | result[@intFromEnum(Feature.sse3)] = .{ | 1207 | result[@backingInt(Feature.sse3)] = .{ |
| 1208 | .llvm_name = "sse3", | 1208 | .llvm_name = "sse3", |
| 1209 | .description = "Enable SSE3 instructions", | 1209 | .description = "Enable SSE3 instructions", |
| 1210 | .dependencies = featureSet(&[_]Feature{ | 1210 | .dependencies = featureSet(&[_]Feature{ |
| 1211 | .sse2, | 1211 | .sse2, |
| 1212 | }), | 1212 | }), |
| 1213 | }; | 1213 | }; |
| 1214 | result[@intFromEnum(Feature.sse4_1)] = .{ | 1214 | result[@backingInt(Feature.sse4_1)] = .{ |
| 1215 | .llvm_name = "sse4.1", | 1215 | .llvm_name = "sse4.1", |
| 1216 | .description = "Enable SSE 4.1 instructions", | 1216 | .description = "Enable SSE 4.1 instructions", |
| 1217 | .dependencies = featureSet(&[_]Feature{ | 1217 | .dependencies = featureSet(&[_]Feature{ |
| 1218 | .ssse3, | 1218 | .ssse3, |
| 1219 | }), | 1219 | }), |
| 1220 | }; | 1220 | }; |
| 1221 | result[@intFromEnum(Feature.sse4_2)] = .{ | 1221 | result[@backingInt(Feature.sse4_2)] = .{ |
| 1222 | .llvm_name = "sse4.2", | 1222 | .llvm_name = "sse4.2", |
| 1223 | .description = "Enable SSE 4.2 instructions", | 1223 | .description = "Enable SSE 4.2 instructions", |
| 1224 | .dependencies = featureSet(&[_]Feature{ | 1224 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1226,66 +1226,66 @@ pub const all_features = blk: { | ... | @@ -1226,66 +1226,66 @@ pub const all_features = blk: { |
| 1226 | .sse4_1, | 1226 | .sse4_1, |
| 1227 | }), | 1227 | }), |
| 1228 | }; | 1228 | }; |
| 1229 | result[@intFromEnum(Feature.sse4a)] = .{ | 1229 | result[@backingInt(Feature.sse4a)] = .{ |
| 1230 | .llvm_name = "sse4a", | 1230 | .llvm_name = "sse4a", |
| 1231 | .description = "Support SSE 4a instructions", | 1231 | .description = "Support SSE 4a instructions", |
| 1232 | .dependencies = featureSet(&[_]Feature{ | 1232 | .dependencies = featureSet(&[_]Feature{ |
| 1233 | .sse3, | 1233 | .sse3, |
| 1234 | }), | 1234 | }), |
| 1235 | }; | 1235 | }; |
| 1236 | result[@intFromEnum(Feature.sse_unaligned_mem)] = .{ | 1236 | result[@backingInt(Feature.sse_unaligned_mem)] = .{ |
| 1237 | .llvm_name = "sse-unaligned-mem", | 1237 | .llvm_name = "sse-unaligned-mem", |
| 1238 | .description = "Allow unaligned memory operands with SSE instructions (this may require setting a configuration bit in the processor)", | 1238 | .description = "Allow unaligned memory operands with SSE instructions (this may require setting a configuration bit in the processor)", |
| 1239 | .dependencies = featureSet(&[_]Feature{}), | 1239 | .dependencies = featureSet(&[_]Feature{}), |
| 1240 | }; | 1240 | }; |
| 1241 | result[@intFromEnum(Feature.ssse3)] = .{ | 1241 | result[@backingInt(Feature.ssse3)] = .{ |
| 1242 | .llvm_name = "ssse3", | 1242 | .llvm_name = "ssse3", |
| 1243 | .description = "Enable SSSE3 instructions", | 1243 | .description = "Enable SSSE3 instructions", |
| 1244 | .dependencies = featureSet(&[_]Feature{ | 1244 | .dependencies = featureSet(&[_]Feature{ |
| 1245 | .sse3, | 1245 | .sse3, |
| 1246 | }), | 1246 | }), |
| 1247 | }; | 1247 | }; |
| 1248 | result[@intFromEnum(Feature.tagged_globals)] = .{ | 1248 | result[@backingInt(Feature.tagged_globals)] = .{ |
| 1249 | .llvm_name = "tagged-globals", | 1249 | .llvm_name = "tagged-globals", |
| 1250 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits.", | 1250 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits.", |
| 1251 | .dependencies = featureSet(&[_]Feature{}), | 1251 | .dependencies = featureSet(&[_]Feature{}), |
| 1252 | }; | 1252 | }; |
| 1253 | result[@intFromEnum(Feature.tbm)] = .{ | 1253 | result[@backingInt(Feature.tbm)] = .{ |
| 1254 | .llvm_name = "tbm", | 1254 | .llvm_name = "tbm", |
| 1255 | .description = "Enable TBM instructions", | 1255 | .description = "Enable TBM instructions", |
| 1256 | .dependencies = featureSet(&[_]Feature{}), | 1256 | .dependencies = featureSet(&[_]Feature{}), |
| 1257 | }; | 1257 | }; |
| 1258 | result[@intFromEnum(Feature.tsxldtrk)] = .{ | 1258 | result[@backingInt(Feature.tsxldtrk)] = .{ |
| 1259 | .llvm_name = "tsxldtrk", | 1259 | .llvm_name = "tsxldtrk", |
| 1260 | .description = "Support TSXLDTRK instructions", | 1260 | .description = "Support TSXLDTRK instructions", |
| 1261 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "tuning-fast-imm-vector-shift", | 1264 | .llvm_name = "tuning-fast-imm-vector-shift", |
| 1265 | .description = "Vector shifts are fast (2/cycle) as opposed to slow (1/cycle)", | 1265 | .description = "Vector shifts are fast (2/cycle) as opposed to slow (1/cycle)", |
| 1266 | .dependencies = featureSet(&[_]Feature{}), | 1266 | .dependencies = featureSet(&[_]Feature{}), |
| 1267 | }; | 1267 | }; |
| 1268 | result[@intFromEnum(Feature.uintr)] = .{ | 1268 | result[@backingInt(Feature.uintr)] = .{ |
| 1269 | .llvm_name = "uintr", | 1269 | .llvm_name = "uintr", |
| 1270 | .description = "Has UINTR Instructions", | 1270 | .description = "Has UINTR Instructions", |
| 1271 | .dependencies = featureSet(&[_]Feature{}), | 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 | .llvm_name = "use-glm-div-sqrt-costs", | 1274 | .llvm_name = "use-glm-div-sqrt-costs", |
| 1275 | .description = "Use Goldmont specific floating point div/sqrt costs", | 1275 | .description = "Use Goldmont specific floating point div/sqrt costs", |
| 1276 | .dependencies = featureSet(&[_]Feature{}), | 1276 | .dependencies = featureSet(&[_]Feature{}), |
| 1277 | }; | 1277 | }; |
| 1278 | result[@intFromEnum(Feature.use_slm_arith_costs)] = .{ | 1278 | result[@backingInt(Feature.use_slm_arith_costs)] = .{ |
| 1279 | .llvm_name = "use-slm-arith-costs", | 1279 | .llvm_name = "use-slm-arith-costs", |
| 1280 | .description = "Use Silvermont specific arithmetic costs", | 1280 | .description = "Use Silvermont specific arithmetic costs", |
| 1281 | .dependencies = featureSet(&[_]Feature{}), | 1281 | .dependencies = featureSet(&[_]Feature{}), |
| 1282 | }; | 1282 | }; |
| 1283 | result[@intFromEnum(Feature.usermsr)] = .{ | 1283 | result[@backingInt(Feature.usermsr)] = .{ |
| 1284 | .llvm_name = "usermsr", | 1284 | .llvm_name = "usermsr", |
| 1285 | .description = "Support USERMSR instructions", | 1285 | .description = "Support USERMSR instructions", |
| 1286 | .dependencies = featureSet(&[_]Feature{}), | 1286 | .dependencies = featureSet(&[_]Feature{}), |
| 1287 | }; | 1287 | }; |
| 1288 | result[@intFromEnum(Feature.vaes)] = .{ | 1288 | result[@backingInt(Feature.vaes)] = .{ |
| 1289 | .llvm_name = "vaes", | 1289 | .llvm_name = "vaes", |
| 1290 | .description = "Promote selected AES instructions to AVX512/AVX registers", | 1290 | .description = "Promote selected AES instructions to AVX512/AVX registers", |
| 1291 | .dependencies = featureSet(&[_]Feature{ | 1291 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1293,7 +1293,7 @@ pub const all_features = blk: { | ... | @@ -1293,7 +1293,7 @@ pub const all_features = blk: { |
| 1293 | .avx2, | 1293 | .avx2, |
| 1294 | }), | 1294 | }), |
| 1295 | }; | 1295 | }; |
| 1296 | result[@intFromEnum(Feature.vpclmulqdq)] = .{ | 1296 | result[@backingInt(Feature.vpclmulqdq)] = .{ |
| 1297 | .llvm_name = "vpclmulqdq", | 1297 | .llvm_name = "vpclmulqdq", |
| 1298 | .description = "Enable vpclmulqdq instructions", | 1298 | .description = "Enable vpclmulqdq instructions", |
| 1299 | .dependencies = featureSet(&[_]Feature{ | 1299 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1301,72 +1301,72 @@ pub const all_features = blk: { | ... | @@ -1301,72 +1301,72 @@ pub const all_features = blk: { |
| 1301 | .pclmul, | 1301 | .pclmul, |
| 1302 | }), | 1302 | }), |
| 1303 | }; | 1303 | }; |
| 1304 | result[@intFromEnum(Feature.vzeroupper)] = .{ | 1304 | result[@backingInt(Feature.vzeroupper)] = .{ |
| 1305 | .llvm_name = "vzeroupper", | 1305 | .llvm_name = "vzeroupper", |
| 1306 | .description = "Should insert vzeroupper instructions", | 1306 | .description = "Should insert vzeroupper instructions", |
| 1307 | .dependencies = featureSet(&[_]Feature{}), | 1307 | .dependencies = featureSet(&[_]Feature{}), |
| 1308 | }; | 1308 | }; |
| 1309 | result[@intFromEnum(Feature.waitpkg)] = .{ | 1309 | result[@backingInt(Feature.waitpkg)] = .{ |
| 1310 | .llvm_name = "waitpkg", | 1310 | .llvm_name = "waitpkg", |
| 1311 | .description = "Wait and pause enhancements", | 1311 | .description = "Wait and pause enhancements", |
| 1312 | .dependencies = featureSet(&[_]Feature{}), | 1312 | .dependencies = featureSet(&[_]Feature{}), |
| 1313 | }; | 1313 | }; |
| 1314 | result[@intFromEnum(Feature.wbnoinvd)] = .{ | 1314 | result[@backingInt(Feature.wbnoinvd)] = .{ |
| 1315 | .llvm_name = "wbnoinvd", | 1315 | .llvm_name = "wbnoinvd", |
| 1316 | .description = "Write Back No Invalidate", | 1316 | .description = "Write Back No Invalidate", |
| 1317 | .dependencies = featureSet(&[_]Feature{}), | 1317 | .dependencies = featureSet(&[_]Feature{}), |
| 1318 | }; | 1318 | }; |
| 1319 | result[@intFromEnum(Feature.widekl)] = .{ | 1319 | result[@backingInt(Feature.widekl)] = .{ |
| 1320 | .llvm_name = "widekl", | 1320 | .llvm_name = "widekl", |
| 1321 | .description = "Support Key Locker wide Instructions", | 1321 | .description = "Support Key Locker wide Instructions", |
| 1322 | .dependencies = featureSet(&[_]Feature{ | 1322 | .dependencies = featureSet(&[_]Feature{ |
| 1323 | .kl, | 1323 | .kl, |
| 1324 | }), | 1324 | }), |
| 1325 | }; | 1325 | }; |
| 1326 | result[@intFromEnum(Feature.x32)] = .{ | 1326 | result[@backingInt(Feature.x32)] = .{ |
| 1327 | .llvm_name = "x32", | 1327 | .llvm_name = "x32", |
| 1328 | .description = "64-bit with ILP32 programming model (e.g. x32 ABI)", | 1328 | .description = "64-bit with ILP32 programming model (e.g. x32 ABI)", |
| 1329 | .dependencies = featureSet(&[_]Feature{}), | 1329 | .dependencies = featureSet(&[_]Feature{}), |
| 1330 | }; | 1330 | }; |
| 1331 | result[@intFromEnum(Feature.x87)] = .{ | 1331 | result[@backingInt(Feature.x87)] = .{ |
| 1332 | .llvm_name = "x87", | 1332 | .llvm_name = "x87", |
| 1333 | .description = "Enable X87 float instructions", | 1333 | .description = "Enable X87 float instructions", |
| 1334 | .dependencies = featureSet(&[_]Feature{}), | 1334 | .dependencies = featureSet(&[_]Feature{}), |
| 1335 | }; | 1335 | }; |
| 1336 | result[@intFromEnum(Feature.xop)] = .{ | 1336 | result[@backingInt(Feature.xop)] = .{ |
| 1337 | .llvm_name = "xop", | 1337 | .llvm_name = "xop", |
| 1338 | .description = "Enable XOP instructions", | 1338 | .description = "Enable XOP instructions", |
| 1339 | .dependencies = featureSet(&[_]Feature{ | 1339 | .dependencies = featureSet(&[_]Feature{ |
| 1340 | .fma4, | 1340 | .fma4, |
| 1341 | }), | 1341 | }), |
| 1342 | }; | 1342 | }; |
| 1343 | result[@intFromEnum(Feature.xsave)] = .{ | 1343 | result[@backingInt(Feature.xsave)] = .{ |
| 1344 | .llvm_name = "xsave", | 1344 | .llvm_name = "xsave", |
| 1345 | .description = "Support xsave instructions", | 1345 | .description = "Support xsave instructions", |
| 1346 | .dependencies = featureSet(&[_]Feature{}), | 1346 | .dependencies = featureSet(&[_]Feature{}), |
| 1347 | }; | 1347 | }; |
| 1348 | result[@intFromEnum(Feature.xsavec)] = .{ | 1348 | result[@backingInt(Feature.xsavec)] = .{ |
| 1349 | .llvm_name = "xsavec", | 1349 | .llvm_name = "xsavec", |
| 1350 | .description = "Support xsavec instructions", | 1350 | .description = "Support xsavec instructions", |
| 1351 | .dependencies = featureSet(&[_]Feature{ | 1351 | .dependencies = featureSet(&[_]Feature{ |
| 1352 | .xsave, | 1352 | .xsave, |
| 1353 | }), | 1353 | }), |
| 1354 | }; | 1354 | }; |
| 1355 | result[@intFromEnum(Feature.xsaveopt)] = .{ | 1355 | result[@backingInt(Feature.xsaveopt)] = .{ |
| 1356 | .llvm_name = "xsaveopt", | 1356 | .llvm_name = "xsaveopt", |
| 1357 | .description = "Support xsaveopt instructions", | 1357 | .description = "Support xsaveopt instructions", |
| 1358 | .dependencies = featureSet(&[_]Feature{ | 1358 | .dependencies = featureSet(&[_]Feature{ |
| 1359 | .xsave, | 1359 | .xsave, |
| 1360 | }), | 1360 | }), |
| 1361 | }; | 1361 | }; |
| 1362 | result[@intFromEnum(Feature.xsaves)] = .{ | 1362 | result[@backingInt(Feature.xsaves)] = .{ |
| 1363 | .llvm_name = "xsaves", | 1363 | .llvm_name = "xsaves", |
| 1364 | .description = "Support xsaves instructions", | 1364 | .description = "Support xsaves instructions", |
| 1365 | .dependencies = featureSet(&[_]Feature{ | 1365 | .dependencies = featureSet(&[_]Feature{ |
| 1366 | .xsave, | 1366 | .xsave, |
| 1367 | }), | 1367 | }), |
| 1368 | }; | 1368 | }; |
| 1369 | result[@intFromEnum(Feature.zu)] = .{ | 1369 | result[@backingInt(Feature.zu)] = .{ |
| 1370 | .llvm_name = "zu", | 1370 | .llvm_name = "zu", |
| 1371 | .description = "Support zero-upper SETcc/IMUL", | 1371 | .description = "Support zero-upper SETcc/IMUL", |
| 1372 | .dependencies = featureSet(&[_]Feature{}), | 1372 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/Target/xtensa.zig+37-37| ... | @@ -53,197 +53,197 @@ pub const all_features = blk: { | ... | @@ -53,197 +53,197 @@ pub const all_features = blk: { |
| 53 | const len = @typeInfo(Feature).@"enum".field_names.len; | 53 | const len = @typeInfo(Feature).@"enum".field_names.len; |
| 54 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 54 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 55 | var result: [len]CpuFeature = undefined; | 55 | var result: [len]CpuFeature = undefined; |
| 56 | result[@intFromEnum(Feature.bool)] = .{ | 56 | result[@backingInt(Feature.bool)] = .{ |
| 57 | .llvm_name = "bool", | 57 | .llvm_name = "bool", |
| 58 | .description = "Enable Xtensa Boolean extension", | 58 | .description = "Enable Xtensa Boolean extension", |
| 59 | .dependencies = featureSet(&[_]Feature{}), | 59 | .dependencies = featureSet(&[_]Feature{}), |
| 60 | }; | 60 | }; |
| 61 | result[@intFromEnum(Feature.clamps)] = .{ | 61 | result[@backingInt(Feature.clamps)] = .{ |
| 62 | .llvm_name = "clamps", | 62 | .llvm_name = "clamps", |
| 63 | .description = "Enable Xtensa CLAMPS option", | 63 | .description = "Enable Xtensa CLAMPS option", |
| 64 | .dependencies = featureSet(&[_]Feature{}), | 64 | .dependencies = featureSet(&[_]Feature{}), |
| 65 | }; | 65 | }; |
| 66 | result[@intFromEnum(Feature.coprocessor)] = .{ | 66 | result[@backingInt(Feature.coprocessor)] = .{ |
| 67 | .llvm_name = "coprocessor", | 67 | .llvm_name = "coprocessor", |
| 68 | .description = "Enable Xtensa Coprocessor option", | 68 | .description = "Enable Xtensa Coprocessor option", |
| 69 | .dependencies = featureSet(&[_]Feature{}), | 69 | .dependencies = featureSet(&[_]Feature{}), |
| 70 | }; | 70 | }; |
| 71 | result[@intFromEnum(Feature.dcache)] = .{ | 71 | result[@backingInt(Feature.dcache)] = .{ |
| 72 | .llvm_name = "dcache", | 72 | .llvm_name = "dcache", |
| 73 | .description = "Enable Xtensa Data Cache option", | 73 | .description = "Enable Xtensa Data Cache option", |
| 74 | .dependencies = featureSet(&[_]Feature{}), | 74 | .dependencies = featureSet(&[_]Feature{}), |
| 75 | }; | 75 | }; |
| 76 | result[@intFromEnum(Feature.debug)] = .{ | 76 | result[@backingInt(Feature.debug)] = .{ |
| 77 | .llvm_name = "debug", | 77 | .llvm_name = "debug", |
| 78 | .description = "Enable Xtensa Debug option", | 78 | .description = "Enable Xtensa Debug option", |
| 79 | .dependencies = featureSet(&[_]Feature{}), | 79 | .dependencies = featureSet(&[_]Feature{}), |
| 80 | }; | 80 | }; |
| 81 | result[@intFromEnum(Feature.density)] = .{ | 81 | result[@backingInt(Feature.density)] = .{ |
| 82 | .llvm_name = "density", | 82 | .llvm_name = "density", |
| 83 | .description = "Enable Density instructions", | 83 | .description = "Enable Density instructions", |
| 84 | .dependencies = featureSet(&[_]Feature{}), | 84 | .dependencies = featureSet(&[_]Feature{}), |
| 85 | }; | 85 | }; |
| 86 | result[@intFromEnum(Feature.dfpaccel)] = .{ | 86 | result[@backingInt(Feature.dfpaccel)] = .{ |
| 87 | .llvm_name = "dfpaccel", | 87 | .llvm_name = "dfpaccel", |
| 88 | .description = "Enable Xtensa Double Precision FP acceleration", | 88 | .description = "Enable Xtensa Double Precision FP acceleration", |
| 89 | .dependencies = featureSet(&[_]Feature{}), | 89 | .dependencies = featureSet(&[_]Feature{}), |
| 90 | }; | 90 | }; |
| 91 | result[@intFromEnum(Feature.div32)] = .{ | 91 | result[@backingInt(Feature.div32)] = .{ |
| 92 | .llvm_name = "div32", | 92 | .llvm_name = "div32", |
| 93 | .description = "Enable Xtensa Div32 option", | 93 | .description = "Enable Xtensa Div32 option", |
| 94 | .dependencies = featureSet(&[_]Feature{}), | 94 | .dependencies = featureSet(&[_]Feature{}), |
| 95 | }; | 95 | }; |
| 96 | result[@intFromEnum(Feature.exception)] = .{ | 96 | result[@backingInt(Feature.exception)] = .{ |
| 97 | .llvm_name = "exception", | 97 | .llvm_name = "exception", |
| 98 | .description = "Enable Xtensa Exception option", | 98 | .description = "Enable Xtensa Exception option", |
| 99 | .dependencies = featureSet(&[_]Feature{}), | 99 | .dependencies = featureSet(&[_]Feature{}), |
| 100 | }; | 100 | }; |
| 101 | result[@intFromEnum(Feature.extendedl32r)] = .{ | 101 | result[@backingInt(Feature.extendedl32r)] = .{ |
| 102 | .llvm_name = "extendedl32r", | 102 | .llvm_name = "extendedl32r", |
| 103 | .description = "Enable Xtensa Extended L32R option", | 103 | .description = "Enable Xtensa Extended L32R option", |
| 104 | .dependencies = featureSet(&[_]Feature{}), | 104 | .dependencies = featureSet(&[_]Feature{}), |
| 105 | }; | 105 | }; |
| 106 | result[@intFromEnum(Feature.forced_atomics)] = .{ | 106 | result[@backingInt(Feature.forced_atomics)] = .{ |
| 107 | .llvm_name = "forced-atomics", | 107 | .llvm_name = "forced-atomics", |
| 108 | .description = "Assume that lock-free native-width atomics are available", | 108 | .description = "Assume that lock-free native-width atomics are available", |
| 109 | .dependencies = featureSet(&[_]Feature{}), | 109 | .dependencies = featureSet(&[_]Feature{}), |
| 110 | }; | 110 | }; |
| 111 | result[@intFromEnum(Feature.fp)] = .{ | 111 | result[@backingInt(Feature.fp)] = .{ |
| 112 | .llvm_name = "fp", | 112 | .llvm_name = "fp", |
| 113 | .description = "Enable Xtensa Single FP instructions", | 113 | .description = "Enable Xtensa Single FP instructions", |
| 114 | .dependencies = featureSet(&[_]Feature{}), | 114 | .dependencies = featureSet(&[_]Feature{}), |
| 115 | }; | 115 | }; |
| 116 | result[@intFromEnum(Feature.highpriinterrupts)] = .{ | 116 | result[@backingInt(Feature.highpriinterrupts)] = .{ |
| 117 | .llvm_name = "highpriinterrupts", | 117 | .llvm_name = "highpriinterrupts", |
| 118 | .description = "Enable Xtensa HighPriInterrupts option", | 118 | .description = "Enable Xtensa HighPriInterrupts option", |
| 119 | .dependencies = featureSet(&[_]Feature{}), | 119 | .dependencies = featureSet(&[_]Feature{}), |
| 120 | }; | 120 | }; |
| 121 | result[@intFromEnum(Feature.highpriinterrupts_level3)] = .{ | 121 | result[@backingInt(Feature.highpriinterrupts_level3)] = .{ |
| 122 | .llvm_name = "highpriinterrupts-level3", | 122 | .llvm_name = "highpriinterrupts-level3", |
| 123 | .description = "Enable Xtensa HighPriInterrupts Level3", | 123 | .description = "Enable Xtensa HighPriInterrupts Level3", |
| 124 | .dependencies = featureSet(&[_]Feature{ | 124 | .dependencies = featureSet(&[_]Feature{ |
| 125 | .highpriinterrupts, | 125 | .highpriinterrupts, |
| 126 | }), | 126 | }), |
| 127 | }; | 127 | }; |
| 128 | result[@intFromEnum(Feature.highpriinterrupts_level4)] = .{ | 128 | result[@backingInt(Feature.highpriinterrupts_level4)] = .{ |
| 129 | .llvm_name = "highpriinterrupts-level4", | 129 | .llvm_name = "highpriinterrupts-level4", |
| 130 | .description = "Enable Xtensa HighPriInterrupts Level4", | 130 | .description = "Enable Xtensa HighPriInterrupts Level4", |
| 131 | .dependencies = featureSet(&[_]Feature{ | 131 | .dependencies = featureSet(&[_]Feature{ |
| 132 | .highpriinterrupts, | 132 | .highpriinterrupts, |
| 133 | }), | 133 | }), |
| 134 | }; | 134 | }; |
| 135 | result[@intFromEnum(Feature.highpriinterrupts_level5)] = .{ | 135 | result[@backingInt(Feature.highpriinterrupts_level5)] = .{ |
| 136 | .llvm_name = "highpriinterrupts-level5", | 136 | .llvm_name = "highpriinterrupts-level5", |
| 137 | .description = "Enable Xtensa HighPriInterrupts Level5", | 137 | .description = "Enable Xtensa HighPriInterrupts Level5", |
| 138 | .dependencies = featureSet(&[_]Feature{ | 138 | .dependencies = featureSet(&[_]Feature{ |
| 139 | .highpriinterrupts, | 139 | .highpriinterrupts, |
| 140 | }), | 140 | }), |
| 141 | }; | 141 | }; |
| 142 | result[@intFromEnum(Feature.highpriinterrupts_level6)] = .{ | 142 | result[@backingInt(Feature.highpriinterrupts_level6)] = .{ |
| 143 | .llvm_name = "highpriinterrupts-level6", | 143 | .llvm_name = "highpriinterrupts-level6", |
| 144 | .description = "Enable Xtensa HighPriInterrupts Level6", | 144 | .description = "Enable Xtensa HighPriInterrupts Level6", |
| 145 | .dependencies = featureSet(&[_]Feature{ | 145 | .dependencies = featureSet(&[_]Feature{ |
| 146 | .highpriinterrupts, | 146 | .highpriinterrupts, |
| 147 | }), | 147 | }), |
| 148 | }; | 148 | }; |
| 149 | result[@intFromEnum(Feature.highpriinterrupts_level7)] = .{ | 149 | result[@backingInt(Feature.highpriinterrupts_level7)] = .{ |
| 150 | .llvm_name = "highpriinterrupts-level7", | 150 | .llvm_name = "highpriinterrupts-level7", |
| 151 | .description = "Enable Xtensa HighPriInterrupts Level7", | 151 | .description = "Enable Xtensa HighPriInterrupts Level7", |
| 152 | .dependencies = featureSet(&[_]Feature{ | 152 | .dependencies = featureSet(&[_]Feature{ |
| 153 | .highpriinterrupts, | 153 | .highpriinterrupts, |
| 154 | }), | 154 | }), |
| 155 | }; | 155 | }; |
| 156 | result[@intFromEnum(Feature.interrupt)] = .{ | 156 | result[@backingInt(Feature.interrupt)] = .{ |
| 157 | .llvm_name = "interrupt", | 157 | .llvm_name = "interrupt", |
| 158 | .description = "Enable Xtensa Interrupt option", | 158 | .description = "Enable Xtensa Interrupt option", |
| 159 | .dependencies = featureSet(&[_]Feature{}), | 159 | .dependencies = featureSet(&[_]Feature{}), |
| 160 | }; | 160 | }; |
| 161 | result[@intFromEnum(Feature.loop)] = .{ | 161 | result[@backingInt(Feature.loop)] = .{ |
| 162 | .llvm_name = "loop", | 162 | .llvm_name = "loop", |
| 163 | .description = "Enable Xtensa Loop extension", | 163 | .description = "Enable Xtensa Loop extension", |
| 164 | .dependencies = featureSet(&[_]Feature{}), | 164 | .dependencies = featureSet(&[_]Feature{}), |
| 165 | }; | 165 | }; |
| 166 | result[@intFromEnum(Feature.mac16)] = .{ | 166 | result[@backingInt(Feature.mac16)] = .{ |
| 167 | .llvm_name = "mac16", | 167 | .llvm_name = "mac16", |
| 168 | .description = "Enable Xtensa MAC16 instructions", | 168 | .description = "Enable Xtensa MAC16 instructions", |
| 169 | .dependencies = featureSet(&[_]Feature{}), | 169 | .dependencies = featureSet(&[_]Feature{}), |
| 170 | }; | 170 | }; |
| 171 | result[@intFromEnum(Feature.minmax)] = .{ | 171 | result[@backingInt(Feature.minmax)] = .{ |
| 172 | .llvm_name = "minmax", | 172 | .llvm_name = "minmax", |
| 173 | .description = "Enable Xtensa MINMAX option", | 173 | .description = "Enable Xtensa MINMAX option", |
| 174 | .dependencies = featureSet(&[_]Feature{}), | 174 | .dependencies = featureSet(&[_]Feature{}), |
| 175 | }; | 175 | }; |
| 176 | result[@intFromEnum(Feature.miscsr)] = .{ | 176 | result[@backingInt(Feature.miscsr)] = .{ |
| 177 | .llvm_name = "miscsr", | 177 | .llvm_name = "miscsr", |
| 178 | .description = "Enable Xtensa Miscellaneous SR option", | 178 | .description = "Enable Xtensa Miscellaneous SR option", |
| 179 | .dependencies = featureSet(&[_]Feature{}), | 179 | .dependencies = featureSet(&[_]Feature{}), |
| 180 | }; | 180 | }; |
| 181 | result[@intFromEnum(Feature.mul16)] = .{ | 181 | result[@backingInt(Feature.mul16)] = .{ |
| 182 | .llvm_name = "mul16", | 182 | .llvm_name = "mul16", |
| 183 | .description = "Enable Xtensa Mul16 option", | 183 | .description = "Enable Xtensa Mul16 option", |
| 184 | .dependencies = featureSet(&[_]Feature{}), | 184 | .dependencies = featureSet(&[_]Feature{}), |
| 185 | }; | 185 | }; |
| 186 | result[@intFromEnum(Feature.mul32)] = .{ | 186 | result[@backingInt(Feature.mul32)] = .{ |
| 187 | .llvm_name = "mul32", | 187 | .llvm_name = "mul32", |
| 188 | .description = "Enable Xtensa Mul32 option", | 188 | .description = "Enable Xtensa Mul32 option", |
| 189 | .dependencies = featureSet(&[_]Feature{}), | 189 | .dependencies = featureSet(&[_]Feature{}), |
| 190 | }; | 190 | }; |
| 191 | result[@intFromEnum(Feature.mul32high)] = .{ | 191 | result[@backingInt(Feature.mul32high)] = .{ |
| 192 | .llvm_name = "mul32high", | 192 | .llvm_name = "mul32high", |
| 193 | .description = "Enable Xtensa Mul32High option", | 193 | .description = "Enable Xtensa Mul32High option", |
| 194 | .dependencies = featureSet(&[_]Feature{}), | 194 | .dependencies = featureSet(&[_]Feature{}), |
| 195 | }; | 195 | }; |
| 196 | result[@intFromEnum(Feature.nsa)] = .{ | 196 | result[@backingInt(Feature.nsa)] = .{ |
| 197 | .llvm_name = "nsa", | 197 | .llvm_name = "nsa", |
| 198 | .description = "Enable Xtensa NSA option", | 198 | .description = "Enable Xtensa NSA option", |
| 199 | .dependencies = featureSet(&[_]Feature{}), | 199 | .dependencies = featureSet(&[_]Feature{}), |
| 200 | }; | 200 | }; |
| 201 | result[@intFromEnum(Feature.prid)] = .{ | 201 | result[@backingInt(Feature.prid)] = .{ |
| 202 | .llvm_name = "prid", | 202 | .llvm_name = "prid", |
| 203 | .description = "Enable Xtensa Processor ID option", | 203 | .description = "Enable Xtensa Processor ID option", |
| 204 | .dependencies = featureSet(&[_]Feature{}), | 204 | .dependencies = featureSet(&[_]Feature{}), |
| 205 | }; | 205 | }; |
| 206 | result[@intFromEnum(Feature.regprotect)] = .{ | 206 | result[@backingInt(Feature.regprotect)] = .{ |
| 207 | .llvm_name = "regprotect", | 207 | .llvm_name = "regprotect", |
| 208 | .description = "Enable Xtensa Region Protection option", | 208 | .description = "Enable Xtensa Region Protection option", |
| 209 | .dependencies = featureSet(&[_]Feature{}), | 209 | .dependencies = featureSet(&[_]Feature{}), |
| 210 | }; | 210 | }; |
| 211 | result[@intFromEnum(Feature.rvector)] = .{ | 211 | result[@backingInt(Feature.rvector)] = .{ |
| 212 | .llvm_name = "rvector", | 212 | .llvm_name = "rvector", |
| 213 | .description = "Enable Xtensa Relocatable Vector option", | 213 | .description = "Enable Xtensa Relocatable Vector option", |
| 214 | .dependencies = featureSet(&[_]Feature{}), | 214 | .dependencies = featureSet(&[_]Feature{}), |
| 215 | }; | 215 | }; |
| 216 | result[@intFromEnum(Feature.s32c1i)] = .{ | 216 | result[@backingInt(Feature.s32c1i)] = .{ |
| 217 | .llvm_name = "s32c1i", | 217 | .llvm_name = "s32c1i", |
| 218 | .description = "Enable Xtensa S32C1I option", | 218 | .description = "Enable Xtensa S32C1I option", |
| 219 | .dependencies = featureSet(&[_]Feature{}), | 219 | .dependencies = featureSet(&[_]Feature{}), |
| 220 | }; | 220 | }; |
| 221 | result[@intFromEnum(Feature.sext)] = .{ | 221 | result[@backingInt(Feature.sext)] = .{ |
| 222 | .llvm_name = "sext", | 222 | .llvm_name = "sext", |
| 223 | .description = "Enable Xtensa Sign Extend option", | 223 | .description = "Enable Xtensa Sign Extend option", |
| 224 | .dependencies = featureSet(&[_]Feature{}), | 224 | .dependencies = featureSet(&[_]Feature{}), |
| 225 | }; | 225 | }; |
| 226 | result[@intFromEnum(Feature.threadptr)] = .{ | 226 | result[@backingInt(Feature.threadptr)] = .{ |
| 227 | .llvm_name = "threadptr", | 227 | .llvm_name = "threadptr", |
| 228 | .description = "Enable Xtensa THREADPTR option", | 228 | .description = "Enable Xtensa THREADPTR option", |
| 229 | .dependencies = featureSet(&[_]Feature{}), | 229 | .dependencies = featureSet(&[_]Feature{}), |
| 230 | }; | 230 | }; |
| 231 | result[@intFromEnum(Feature.timers1)] = .{ | 231 | result[@backingInt(Feature.timers1)] = .{ |
| 232 | .llvm_name = "timers1", | 232 | .llvm_name = "timers1", |
| 233 | .description = "Enable Xtensa Timers 1", | 233 | .description = "Enable Xtensa Timers 1", |
| 234 | .dependencies = featureSet(&[_]Feature{}), | 234 | .dependencies = featureSet(&[_]Feature{}), |
| 235 | }; | 235 | }; |
| 236 | result[@intFromEnum(Feature.timers2)] = .{ | 236 | result[@backingInt(Feature.timers2)] = .{ |
| 237 | .llvm_name = "timers2", | 237 | .llvm_name = "timers2", |
| 238 | .description = "Enable Xtensa Timers 2", | 238 | .description = "Enable Xtensa Timers 2", |
| 239 | .dependencies = featureSet(&[_]Feature{}), | 239 | .dependencies = featureSet(&[_]Feature{}), |
| 240 | }; | 240 | }; |
| 241 | result[@intFromEnum(Feature.timers3)] = .{ | 241 | result[@backingInt(Feature.timers3)] = .{ |
| 242 | .llvm_name = "timers3", | 242 | .llvm_name = "timers3", |
| 243 | .description = "Enable Xtensa Timers 3", | 243 | .description = "Enable Xtensa Timers 3", |
| 244 | .dependencies = featureSet(&[_]Feature{}), | 244 | .dependencies = featureSet(&[_]Feature{}), |
| 245 | }; | 245 | }; |
| 246 | result[@intFromEnum(Feature.windowed)] = .{ | 246 | result[@backingInt(Feature.windowed)] = .{ |
| 247 | .llvm_name = "windowed", | 247 | .llvm_name = "windowed", |
| 248 | .description = "Enable Xtensa Windowed Register option", | 248 | .description = "Enable Xtensa Windowed Register option", |
| 249 | .dependencies = featureSet(&[_]Feature{}), | 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,7 +67,7 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 67 | return; | 67 | return; |
| 68 | } else { | 68 | } else { |
| 69 | const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr); | 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 | .SUCCESS => return, | 71 | .SUCCESS => return, |
| 72 | .RANGE => unreachable, | 72 | .RANGE => unreachable, |
| 73 | else => |e| return posix.unexpectedErrno(e), | 73 | else => |e| return posix.unexpectedErrno(e), |
| ... | @@ -101,14 +101,14 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { | ... | @@ -101,14 +101,14 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 101 | if (self.getHandle() != std.c.pthread_self()) return error.Unsupported; | 101 | if (self.getHandle() != std.c.pthread_self()) return error.Unsupported; |
| 102 | 102 | ||
| 103 | const err = std.c.pthread_setname_np(name_with_terminator.ptr); | 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 | .SUCCESS => return, | 105 | .SUCCESS => return, |
| 106 | else => |e| return posix.unexpectedErrno(e), | 106 | else => |e| return posix.unexpectedErrno(e), |
| 107 | } | 107 | } |
| 108 | }, | 108 | }, |
| 109 | .serenity => if (use_pthreads) { | 109 | .serenity => if (use_pthreads) { |
| 110 | const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr); | 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 | .SUCCESS => return, | 112 | .SUCCESS => return, |
| 113 | .NAMETOOLONG => unreachable, | 113 | .NAMETOOLONG => unreachable, |
| 114 | .SRCH => unreachable, | 114 | .SRCH => unreachable, |
| ... | @@ -117,7 +117,7 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { | ... | @@ -117,7 +117,7 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 117 | }, | 117 | }, |
| 118 | .netbsd, .illumos => if (use_pthreads) { | 118 | .netbsd, .illumos => if (use_pthreads) { |
| 119 | const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr, null); | 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 | .SUCCESS => return, | 121 | .SUCCESS => return, |
| 122 | .INVAL => unreachable, | 122 | .INVAL => unreachable, |
| 123 | .SRCH => unreachable, | 123 | .SRCH => unreachable, |
| ... | @@ -135,7 +135,7 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { | ... | @@ -135,7 +135,7 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 135 | }, | 135 | }, |
| 136 | .dragonfly => if (use_pthreads) { | 136 | .dragonfly => if (use_pthreads) { |
| 137 | const err = std.c.pthread_setname_np(self.getHandle(), name_with_terminator.ptr); | 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 | .SUCCESS => return, | 139 | .SUCCESS => return, |
| 140 | .INVAL => unreachable, | 140 | .INVAL => unreachable, |
| 141 | .FAULT => unreachable, | 141 | .FAULT => unreachable, |
| ... | @@ -168,7 +168,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co | ... | @@ -168,7 +168,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 168 | return std.mem.sliceTo(buffer, 0); | 168 | return std.mem.sliceTo(buffer, 0); |
| 169 | } else { | 169 | } else { |
| 170 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); | 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 | .SUCCESS => return std.mem.sliceTo(buffer, 0), | 172 | .SUCCESS => return std.mem.sliceTo(buffer, 0), |
| 173 | .RANGE => unreachable, | 173 | .RANGE => unreachable, |
| 174 | else => |e| return posix.unexpectedErrno(e), | 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,7 +211,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 211 | }, | 211 | }, |
| 212 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => if (use_pthreads) { | 212 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => if (use_pthreads) { |
| 213 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); | 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 | .SUCCESS => return std.mem.sliceTo(buffer, 0), | 215 | .SUCCESS => return std.mem.sliceTo(buffer, 0), |
| 216 | .SRCH => unreachable, | 216 | .SRCH => unreachable, |
| 217 | else => |e| return posix.unexpectedErrno(e), | 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,7 +219,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 219 | }, | 219 | }, |
| 220 | .serenity => if (use_pthreads) { | 220 | .serenity => if (use_pthreads) { |
| 221 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); | 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 | .SUCCESS => return, | 223 | .SUCCESS => return, |
| 224 | .NAMETOOLONG => unreachable, | 224 | .NAMETOOLONG => unreachable, |
| 225 | .SRCH => unreachable, | 225 | .SRCH => unreachable, |
| ... | @@ -229,7 +229,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co | ... | @@ -229,7 +229,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 229 | }, | 229 | }, |
| 230 | .netbsd, .illumos => if (use_pthreads) { | 230 | .netbsd, .illumos => if (use_pthreads) { |
| 231 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); | 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 | .SUCCESS => return std.mem.sliceTo(buffer, 0), | 233 | .SUCCESS => return std.mem.sliceTo(buffer, 0), |
| 234 | .INVAL => unreachable, | 234 | .INVAL => unreachable, |
| 235 | .SRCH => unreachable, | 235 | .SRCH => unreachable, |
| ... | @@ -245,7 +245,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co | ... | @@ -245,7 +245,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 245 | }, | 245 | }, |
| 246 | .dragonfly => if (use_pthreads) { | 246 | .dragonfly => if (use_pthreads) { |
| 247 | const err = std.c.pthread_getname_np(self.getHandle(), buffer.ptr, max_name_len + 1); | 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 | .SUCCESS => return std.mem.sliceTo(buffer, 0), | 249 | .SUCCESS => return std.mem.sliceTo(buffer, 0), |
| 250 | .INVAL => unreachable, | 250 | .INVAL => unreachable, |
| 251 | .FAULT => unreachable, | 251 | .FAULT => unreachable, |
| ... | @@ -429,7 +429,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { | ... | @@ -429,7 +429,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { |
| 429 | 429 | ||
| 430 | const status = @call(.auto, f, args); | 430 | const status = @call(.auto, f, args); |
| 431 | switch (Impl) { | 431 | switch (Impl) { |
| 432 | WindowsThreadImpl => return @enumFromInt(status), | 432 | WindowsThreadImpl => return @fromBackingInt(@intCast(status)), |
| 433 | LinuxThreadImpl => return status, | 433 | LinuxThreadImpl => return status, |
| 434 | // pthreads don't support exit status, ignore value | 434 | // pthreads don't support exit status, ignore value |
| 435 | PosixThreadImpl => return default_value, | 435 | PosixThreadImpl => return default_value, |
| ... | @@ -598,7 +598,7 @@ const WindowsThreadImpl = struct { | ... | @@ -598,7 +598,7 @@ const WindowsThreadImpl = struct { |
| 598 | instance, | 598 | instance, |
| 599 | .{ .CREATE_SUSPENDED = true }, | 599 | .{ .CREATE_SUSPENDED = true }, |
| 600 | 0, | 600 | 0, |
| 601 | @enumFromInt(stack_size), | 601 | @fromBackingInt(@intCast(stack_size)), |
| 602 | .default, | 602 | .default, |
| 603 | &attr_list, | 603 | &attr_list, |
| 604 | )) { | 604 | )) { |
| ... | @@ -712,7 +712,7 @@ const PosixThreadImpl = struct { | ... | @@ -712,7 +712,7 @@ const PosixThreadImpl = struct { |
| 712 | // The "proper" way to get the cpu count would be to query | 712 | // The "proper" way to get the cpu count would be to query |
| 713 | // /dev/kstat via ioctls, and traverse a linked list for each | 713 | // /dev/kstat via ioctls, and traverse a linked list for each |
| 714 | // cpu. (illumos) | 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 | return switch (posix.errno(rc)) { | 716 | return switch (posix.errno(rc)) { |
| 717 | .SUCCESS => @as(usize, @intCast(rc)), | 717 | .SUCCESS => @as(usize, @intCast(rc)), |
| 718 | else => |err| posix.unexpectedErrno(err), | 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,7 +74,7 @@ pub inline fn versionCheck(comptime version: std.SemanticVersion) bool { |
| 74 | 74 | ||
| 75 | /// Get the errno if rc is -1 and SUCCESS if rc is not -1. | 75 | /// Get the errno if rc is -1 and SUCCESS if rc is not -1. |
| 76 | pub fn errno(rc: anytype) E { | 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 | pub const ino_t = switch (native_os) { | 80 | pub const ino_t = switch (native_os) { |
| ... | @@ -3720,16 +3720,16 @@ pub const W = switch (native_os) { | ... | @@ -3720,16 +3720,16 @@ pub const W = switch (native_os) { |
| 3720 | return @as(u8, @intCast(x >> 8)); | 3720 | return @as(u8, @intCast(x >> 8)); |
| 3721 | } | 3721 | } |
| 3722 | pub fn TERMSIG(x: u32) SIG { | 3722 | pub fn TERMSIG(x: u32) SIG { |
| 3723 | return @enumFromInt(status(x)); | 3723 | return @fromBackingInt(@intCast(status(x))); |
| 3724 | } | 3724 | } |
| 3725 | pub fn STOPSIG(x: u32) SIG { | 3725 | pub fn STOPSIG(x: u32) SIG { |
| 3726 | return @enumFromInt(x >> 8); | 3726 | return @fromBackingInt(@intCast(x >> 8)); |
| 3727 | } | 3727 | } |
| 3728 | pub fn IFEXITED(x: u32) bool { | 3728 | pub fn IFEXITED(x: u32) bool { |
| 3729 | return status(x) == 0; | 3729 | return status(x) == 0; |
| 3730 | } | 3730 | } |
| 3731 | pub fn IFSTOPPED(x: u32) bool { | 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 | pub fn IFSIGNALED(x: u32) bool { | 3734 | pub fn IFSIGNALED(x: u32) bool { |
| 3735 | return status(x) != stopped and status(x) != 0; | 3735 | return status(x) != stopped and status(x) != 0; |
| ... | @@ -3753,10 +3753,10 @@ pub const W = switch (native_os) { | ... | @@ -3753,10 +3753,10 @@ pub const W = switch (native_os) { |
| 3753 | return @as(u8, @intCast((s & 0xff00) >> 8)); | 3753 | return @as(u8, @intCast((s & 0xff00) >> 8)); |
| 3754 | } | 3754 | } |
| 3755 | pub fn TERMSIG(s: u32) SIG { | 3755 | pub fn TERMSIG(s: u32) SIG { |
| 3756 | return @enumFromInt(s & 0x7f); | 3756 | return @fromBackingInt(@intCast(s & 0x7f)); |
| 3757 | } | 3757 | } |
| 3758 | pub fn STOPSIG(s: u32) SIG { | 3758 | pub fn STOPSIG(s: u32) SIG { |
| 3759 | return @enumFromInt(EXITSTATUS(s)); | 3759 | return @fromBackingInt(@intCast(EXITSTATUS(s))); |
| 3760 | } | 3760 | } |
| 3761 | pub fn IFEXITED(s: u32) bool { | 3761 | pub fn IFEXITED(s: u32) bool { |
| 3762 | return (s & 0x7f) == 0; | 3762 | return (s & 0x7f) == 0; |
| ... | @@ -3781,10 +3781,10 @@ pub const W = switch (native_os) { | ... | @@ -3781,10 +3781,10 @@ pub const W = switch (native_os) { |
| 3781 | return @as(u8, @intCast((s >> 8) & 0xff)); | 3781 | return @as(u8, @intCast((s >> 8) & 0xff)); |
| 3782 | } | 3782 | } |
| 3783 | pub fn TERMSIG(s: u32) SIG { | 3783 | pub fn TERMSIG(s: u32) SIG { |
| 3784 | return @enumFromInt(s & 0x7f); | 3784 | return @fromBackingInt(@intCast(s & 0x7f)); |
| 3785 | } | 3785 | } |
| 3786 | pub fn STOPSIG(s: u32) SIG { | 3786 | pub fn STOPSIG(s: u32) SIG { |
| 3787 | return @enumFromInt(EXITSTATUS(s)); | 3787 | return @fromBackingInt(@intCast(EXITSTATUS(s))); |
| 3788 | } | 3788 | } |
| 3789 | pub fn IFEXITED(s: u32) bool { | 3789 | pub fn IFEXITED(s: u32) bool { |
| 3790 | return (s & 0x7f) == 0; | 3790 | return (s & 0x7f) == 0; |
| ... | @@ -3815,10 +3815,10 @@ pub const W = switch (native_os) { | ... | @@ -3815,10 +3815,10 @@ pub const W = switch (native_os) { |
| 3815 | return @as(u8, @intCast((s >> 8) & 0xff)); | 3815 | return @as(u8, @intCast((s >> 8) & 0xff)); |
| 3816 | } | 3816 | } |
| 3817 | pub fn TERMSIG(s: u32) SIG { | 3817 | pub fn TERMSIG(s: u32) SIG { |
| 3818 | return @enumFromInt(s & 0x7f); | 3818 | return @fromBackingInt(@intCast(s & 0x7f)); |
| 3819 | } | 3819 | } |
| 3820 | pub fn STOPSIG(s: u32) SIG { | 3820 | pub fn STOPSIG(s: u32) SIG { |
| 3821 | return @enumFromInt(EXITSTATUS(s)); | 3821 | return @fromBackingInt(@intCast(EXITSTATUS(s))); |
| 3822 | } | 3822 | } |
| 3823 | pub fn IFEXITED(s: u32) bool { | 3823 | pub fn IFEXITED(s: u32) bool { |
| 3824 | return (s & 0x7f) == 0; | 3824 | return (s & 0x7f) == 0; |
| ... | @@ -3849,10 +3849,10 @@ pub const W = switch (native_os) { | ... | @@ -3849,10 +3849,10 @@ pub const W = switch (native_os) { |
| 3849 | return @as(u8, @intCast((s & 0xff00) >> 8)); | 3849 | return @as(u8, @intCast((s & 0xff00) >> 8)); |
| 3850 | } | 3850 | } |
| 3851 | pub fn TERMSIG(s: u32) SIG { | 3851 | pub fn TERMSIG(s: u32) SIG { |
| 3852 | return @enumFromInt(s & 0x7f); | 3852 | return @fromBackingInt(@intCast(s & 0x7f)); |
| 3853 | } | 3853 | } |
| 3854 | pub fn STOPSIG(s: u32) SIG { | 3854 | pub fn STOPSIG(s: u32) SIG { |
| 3855 | return @enumFromInt(EXITSTATUS(s)); | 3855 | return @fromBackingInt(@intCast(EXITSTATUS(s))); |
| 3856 | } | 3856 | } |
| 3857 | pub fn IFEXITED(s: u32) bool { | 3857 | pub fn IFEXITED(s: u32) bool { |
| 3858 | return (s & 0x7f) == 0; | 3858 | return (s & 0x7f) == 0; |
| ... | @@ -3877,11 +3877,11 @@ pub const W = switch (native_os) { | ... | @@ -3877,11 +3877,11 @@ pub const W = switch (native_os) { |
| 3877 | } | 3877 | } |
| 3878 | 3878 | ||
| 3879 | pub fn TERMSIG(s: u32) SIG { | 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 | pub fn STOPSIG(s: u32) SIG { | 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 | pub fn IFEXITED(s: u32) bool { | 3887 | pub fn IFEXITED(s: u32) bool { |
| ... | @@ -3905,10 +3905,10 @@ pub const W = switch (native_os) { | ... | @@ -3905,10 +3905,10 @@ pub const W = switch (native_os) { |
| 3905 | return @as(u8, @intCast((s >> 8) & 0xff)); | 3905 | return @as(u8, @intCast((s >> 8) & 0xff)); |
| 3906 | } | 3906 | } |
| 3907 | pub fn TERMSIG(s: u32) SIG { | 3907 | pub fn TERMSIG(s: u32) SIG { |
| 3908 | return @enumFromInt(s & 0x7f); | 3908 | return @fromBackingInt(@intCast(s & 0x7f)); |
| 3909 | } | 3909 | } |
| 3910 | pub fn STOPSIG(s: u32) SIG { | 3910 | pub fn STOPSIG(s: u32) SIG { |
| 3911 | return @enumFromInt(EXITSTATUS(s)); | 3911 | return @fromBackingInt(@intCast(EXITSTATUS(s))); |
| 3912 | } | 3912 | } |
| 3913 | pub fn IFEXITED(s: u32) bool { | 3913 | pub fn IFEXITED(s: u32) bool { |
| 3914 | return (s & 0x7f) == 0; | 3914 | return (s & 0x7f) == 0; |
| ... | @@ -3940,11 +3940,11 @@ pub const W = switch (native_os) { | ... | @@ -3940,11 +3940,11 @@ pub const W = switch (native_os) { |
| 3940 | } | 3940 | } |
| 3941 | 3941 | ||
| 3942 | pub fn STOPSIG(s: u32) SIG { | 3942 | pub fn STOPSIG(s: u32) SIG { |
| 3943 | return @enumFromInt(EXITSTATUS(s)); | 3943 | return @fromBackingInt(@intCast(EXITSTATUS(s))); |
| 3944 | } | 3944 | } |
| 3945 | 3945 | ||
| 3946 | pub fn TERMSIG(s: u32) SIG { | 3946 | pub fn TERMSIG(s: u32) SIG { |
| 3947 | return @enumFromInt(s & 0x7f); | 3947 | return @fromBackingInt(@intCast(s & 0x7f)); |
| 3948 | } | 3948 | } |
| 3949 | 3949 | ||
| 3950 | pub fn IFEXITED(s: u32) bool { | 3950 | pub fn IFEXITED(s: u32) bool { |
| ... | @@ -10551,7 +10551,7 @@ const sigrt_private = struct { | ... | @@ -10551,7 +10551,7 @@ const sigrt_private = struct { |
| 10551 | return switch (native_os) { | 10551 | return switch (native_os) { |
| 10552 | .freebsd => 65, | 10552 | .freebsd => 65, |
| 10553 | .netbsd => 33, | 10553 | .netbsd => 33, |
| 10554 | .illumos => @truncate(sysconf(@intFromEnum(_SC.SIGRT_MIN))), | 10554 | .illumos => @truncate(sysconf(@backingInt(_SC.SIGRT_MIN))), |
| 10555 | .haiku => @truncate(@as(c_uint, @bitCast(private.__signal_get_sigrtmin()))), | 10555 | .haiku => @truncate(@as(c_uint, @bitCast(private.__signal_get_sigrtmin()))), |
| 10556 | else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin()))), | 10556 | else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin()))), |
| 10557 | }; | 10557 | }; |
| ... | @@ -10561,7 +10561,7 @@ const sigrt_private = struct { | ... | @@ -10561,7 +10561,7 @@ const sigrt_private = struct { |
| 10561 | return switch (native_os) { | 10561 | return switch (native_os) { |
| 10562 | .freebsd => 126, | 10562 | .freebsd => 126, |
| 10563 | .netbsd => 63, | 10563 | .netbsd => 63, |
| 10564 | .illumos => @truncate(sysconf(@intFromEnum(_SC.SIGRT_MAX))), | 10564 | .illumos => @truncate(sysconf(@backingInt(_SC.SIGRT_MAX))), |
| 10565 | .haiku => @truncate(@as(c_uint, @bitCast(private.__signal_get_sigrtmax()))), | 10565 | .haiku => @truncate(@as(c_uint, @bitCast(private.__signal_get_sigrtmax()))), |
| 10566 | else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmax()))), | 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,10 +1138,10 @@ pub const mach_msg_return_t = enum(kern_return_t) { |
| 1138 | error_code: mach_msg_return_t, | 1138 | error_code: mach_msg_return_t, |
| 1139 | resource_error: ?MACH.MSG, | 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 | switch (return_code) { | 1142 | switch (return_code) { |
| 1143 | .RCV_HEADER_ERROR, .RCV_BODY_ERROR => { | 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 | return .{ | 1145 | return .{ |
| 1146 | .error_code = return_code, | 1146 | .error_code = return_code, |
| 1147 | .resource_error = resource_error, | 1147 | .resource_error = resource_error, |
lib/std/c/illumos.zig+1-1| ... | @@ -322,7 +322,7 @@ const IoCtlCommand = enum(u32) { | ... | @@ -322,7 +322,7 @@ const IoCtlCommand = enum(u32) { |
| 322 | fn ioImpl(cmd: IoCtlCommand, io_type: u8, nr: u8, comptime IOT: type) i32 { | 322 | fn ioImpl(cmd: IoCtlCommand, io_type: u8, nr: u8, comptime IOT: type) i32 { |
| 323 | const size = @as(u32, @intCast(@as(u8, @truncate(@sizeOf(IOT))))) << 16; | 323 | const size = @as(u32, @intCast(@as(u8, @truncate(@sizeOf(IOT))))) << 16; |
| 324 | const t = @as(u32, @intCast(io_type)) << 8; | 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 | pub fn IO(io_type: u8, nr: u8) i32 { | 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,8 +99,8 @@ pub const Header = extern struct { |
| 99 | 99 | ||
| 100 | // OptionalHeader.magic values | 100 | // OptionalHeader.magic values |
| 101 | // see https://msdn.microsoft.com/en-us/library/windows/desktop/ms680339(v=vs.85).aspx | 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); | 102 | pub const IMAGE_NT_OPTIONAL_HDR32_MAGIC = @backingInt(OptionalHeader.Magic.PE32); |
| 103 | pub const IMAGE_NT_OPTIONAL_HDR64_MAGIC = @intFromEnum(OptionalHeader.Magic.@"PE32+"); | 103 | pub const IMAGE_NT_OPTIONAL_HDR64_MAGIC = @backingInt(OptionalHeader.Magic.@"PE32+"); |
| 104 | 104 | ||
| 105 | pub const DllFlags = packed struct(u16) { | 105 | pub const DllFlags = packed struct(u16) { |
| 106 | _reserved_0: u5 = 0, | 106 | _reserved_0: u5 = 0, |
| ... | @@ -655,12 +655,12 @@ pub const SectionHeader = extern struct { | ... | @@ -655,12 +655,12 @@ pub const SectionHeader = extern struct { |
| 655 | 655 | ||
| 656 | pub fn toByteUnits(a: Align) ?u16 { | 656 | pub fn toByteUnits(a: Align) ?u16 { |
| 657 | if (a == .NONE) return null; | 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 | pub fn fromByteUnits(n: u16) Align { | 661 | pub fn fromByteUnits(n: u16) Align { |
| 662 | std.debug.assert(std.math.isPowerOfTwo(n)); | 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 | pub fn alignment(a: Align) ?std.mem.Alignment { | 666 | pub fn alignment(a: Align) ?std.mem.Alignment { |
| ... | @@ -1058,9 +1058,9 @@ pub const Coff = struct { | ... | @@ -1058,9 +1058,9 @@ pub const Coff = struct { |
| 1058 | assert(self.is_image); | 1058 | assert(self.is_image); |
| 1059 | 1059 | ||
| 1060 | const data_dirs = self.getDataDirectories(); | 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 | var reader: std.Io.Reader = .fixed(self.data); | 1064 | var reader: std.Io.Reader = .fixed(self.data); |
| 1065 | 1065 | ||
| 1066 | if (self.is_loaded) { | 1066 | if (self.is_loaded) { |
| ... | @@ -1125,7 +1125,7 @@ pub const Coff = struct { | ... | @@ -1125,7 +1125,7 @@ pub const Coff = struct { |
| 1125 | 1125 | ||
| 1126 | pub fn getImageBase(self: Coff) u64 { | 1126 | pub fn getImageBase(self: Coff) u64 { |
| 1127 | const hdr = self.getOptionalHeader(); | 1127 | const hdr = self.getOptionalHeader(); |
| 1128 | return switch (@intFromEnum(hdr.magic)) { | 1128 | return switch (@backingInt(hdr.magic)) { |
| 1129 | IMAGE_NT_OPTIONAL_HDR32_MAGIC => self.getOptionalHeader32().image_base, | 1129 | IMAGE_NT_OPTIONAL_HDR32_MAGIC => self.getOptionalHeader32().image_base, |
| 1130 | IMAGE_NT_OPTIONAL_HDR64_MAGIC => self.getOptionalHeader64().image_base, | 1130 | IMAGE_NT_OPTIONAL_HDR64_MAGIC => self.getOptionalHeader64().image_base, |
| 1131 | else => unreachable, // We assume we have validated the header already | 1131 | else => unreachable, // We assume we have validated the header already |
| ... | @@ -1134,7 +1134,7 @@ pub const Coff = struct { | ... | @@ -1134,7 +1134,7 @@ pub const Coff = struct { |
| 1134 | 1134 | ||
| 1135 | pub fn getNumberOfDataDirectories(self: Coff) u32 { | 1135 | pub fn getNumberOfDataDirectories(self: Coff) u32 { |
| 1136 | const hdr = self.getOptionalHeader(); | 1136 | const hdr = self.getOptionalHeader(); |
| 1137 | return switch (@intFromEnum(hdr.magic)) { | 1137 | return switch (@backingInt(hdr.magic)) { |
| 1138 | IMAGE_NT_OPTIONAL_HDR32_MAGIC => self.getOptionalHeader32().number_of_rva_and_sizes, | 1138 | IMAGE_NT_OPTIONAL_HDR32_MAGIC => self.getOptionalHeader32().number_of_rva_and_sizes, |
| 1139 | IMAGE_NT_OPTIONAL_HDR64_MAGIC => self.getOptionalHeader64().number_of_rva_and_sizes, | 1139 | IMAGE_NT_OPTIONAL_HDR64_MAGIC => self.getOptionalHeader64().number_of_rva_and_sizes, |
| 1140 | else => unreachable, // We assume we have validated the header already | 1140 | else => unreachable, // We assume we have validated the header already |
| ... | @@ -1143,7 +1143,7 @@ pub const Coff = struct { | ... | @@ -1143,7 +1143,7 @@ pub const Coff = struct { |
| 1143 | 1143 | ||
| 1144 | pub fn getDataDirectories(self: *const Coff) []align(1) const ImageDataDirectory { | 1144 | pub fn getDataDirectories(self: *const Coff) []align(1) const ImageDataDirectory { |
| 1145 | const hdr = self.getOptionalHeader(); | 1145 | const hdr = self.getOptionalHeader(); |
| 1146 | const size: usize = switch (@intFromEnum(hdr.magic)) { | 1146 | const size: usize = switch (@backingInt(hdr.magic)) { |
| 1147 | IMAGE_NT_OPTIONAL_HDR32_MAGIC => @sizeOf(OptionalHeader.PE32), | 1147 | IMAGE_NT_OPTIONAL_HDR32_MAGIC => @sizeOf(OptionalHeader.PE32), |
| 1148 | IMAGE_NT_OPTIONAL_HDR64_MAGIC => @sizeOf(OptionalHeader.@"PE32+"), | 1148 | IMAGE_NT_OPTIONAL_HDR64_MAGIC => @sizeOf(OptionalHeader.@"PE32+"), |
| 1149 | else => unreachable, // We assume we have validated the header already | 1149 | else => unreachable, // We assume we have validated the header already |
| ... | @@ -1268,9 +1268,9 @@ pub const Symtab = struct { | ... | @@ -1268,9 +1268,9 @@ pub const Symtab = struct { |
| 1268 | return .{ | 1268 | return .{ |
| 1269 | .name = raw[0..8].*, | 1269 | .name = raw[0..8].*, |
| 1270 | .value = mem.readInt(u32, raw[8..12], .little), | 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 | .type = @as(SymType, @bitCast(mem.readInt(u16, raw[14..16], .little))), | 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 | .number_of_aux_symbols = raw[17], | 1274 | .number_of_aux_symbols = raw[17], |
| 1275 | }; | 1275 | }; |
| 1276 | } | 1276 | } |
| ... | @@ -1298,7 +1298,7 @@ pub const Symtab = struct { | ... | @@ -1298,7 +1298,7 @@ pub const Symtab = struct { |
| 1298 | fn asWeakExtDef(raw: []const u8) WeakExternalDefinition { | 1298 | fn asWeakExtDef(raw: []const u8) WeakExternalDefinition { |
| 1299 | return .{ | 1299 | return .{ |
| 1300 | .tag_index = mem.readInt(u32, raw[0..4], .little), | 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 | .unused = raw[8..18].*, | 1302 | .unused = raw[8..18].*, |
| 1303 | }; | 1303 | }; |
| 1304 | } | 1304 | } |
| ... | @@ -1316,7 +1316,7 @@ pub const Symtab = struct { | ... | @@ -1316,7 +1316,7 @@ pub const Symtab = struct { |
| 1316 | .number_of_linenumbers = mem.readInt(u16, raw[6..8], .little), | 1316 | .number_of_linenumbers = mem.readInt(u16, raw[6..8], .little), |
| 1317 | .checksum = mem.readInt(u32, raw[8..12], .little), | 1317 | .checksum = mem.readInt(u32, raw[8..12], .little), |
| 1318 | .number = mem.readInt(u16, raw[12..14], .little), | 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 | .unused = raw[15..18].*, | 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,7 +1679,7 @@ pub const Raw = struct { |
| 1679 | const is_pattern = rem_splat != splat and vec.len == pattern.len; | 1679 | const is_pattern = rem_splat != splat and vec.len == pattern.len; |
| 1680 | if (is_pattern) assert(pattern.len != 0); // exceeded countSplat | 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 | rem_data_elem = rem_data_elem[vec.len..]; | 1683 | rem_data_elem = rem_data_elem[vec.len..]; |
| 1684 | block_limit = block_limit.subtract(vec.len).?; | 1684 | block_limit = block_limit.subtract(vec.len).?; |
| 1685 | 1685 | ||
| ... | @@ -1701,7 +1701,7 @@ pub const Raw = struct { | ... | @@ -1701,7 +1701,7 @@ pub const Raw = struct { |
| 1701 | } | 1701 | } |
| 1702 | if (block_limit == .nothing) break; | 1702 | if (block_limit == .nothing) break; |
| 1703 | } else { | 1703 | } else { |
| 1704 | const out_splat = @intFromEnum(block_limit) / pattern.len; | 1704 | const out_splat = @backingInt(block_limit) / pattern.len; |
| 1705 | assert(out_splat >= 2); | 1705 | assert(out_splat >= 2); |
| 1706 | 1706 | ||
| 1707 | try r.output.writeSplatAll(vecs[0..vecs_n], out_splat); | 1707 | try r.output.writeSplatAll(vecs[0..vecs_n], out_splat); |
| ... | @@ -2155,7 +2155,7 @@ pub const Huffman = struct { | ... | @@ -2155,7 +2155,7 @@ pub const Huffman = struct { |
| 2155 | const bytes = block_limit.sliceConst(rem_data_elem); | 2155 | const bytes = block_limit.sliceConst(rem_data_elem); |
| 2156 | const is_pattern = rem_splat != splat and bytes.len == pattern.len; | 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 | assert(mul != 0); | 2159 | assert(mul != 0); |
| 2160 | if (is_pattern) assert(mul <= rem_splat + 1); // one more for `rem_data` | 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,11 +2231,11 @@ pub const Huffman = struct { |
| 2231 | @subWithOverflow(data.len - (rem_data.len - @intFromBool(in_pattern)), 1); | 2231 | @subWithOverflow(data.len - (rem_data.len - @intFromBool(in_pattern)), 1); |
| 2232 | const is_elem = in_data == 0 and data[vec_elem_i].len == rem_data_elem.len; | 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 | block_limit = block_limit.subtract(rem_data_elem.len) orelse { | 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)]); | 2236 | try h.bit_writer.output.writeAll(rem_data_elem[0..@backingInt(block_limit)]); |
| 2237 | h.hasher.update(rem_data_elem[0..@intFromEnum(block_limit)]); | 2237 | h.hasher.update(rem_data_elem[0..@backingInt(block_limit)]); |
| 2238 | rem_data_elem = rem_data_elem[@intFromEnum(block_limit)..]; | 2238 | rem_data_elem = rem_data_elem[@backingInt(block_limit)..]; |
| 2239 | assert(rem_data_elem.len != 0); | 2239 | assert(rem_data_elem.len != 0); |
| 2240 | break; | 2240 | break; |
| 2241 | }; | 2241 | }; |
| ... | @@ -2259,7 +2259,7 @@ pub const Huffman = struct { | ... | @@ -2259,7 +2259,7 @@ pub const Huffman = struct { |
| 2259 | vec_n += 1; | 2259 | vec_n += 1; |
| 2260 | } else vec_splat: { | 2260 | } else vec_splat: { |
| 2261 | // For `pattern.len == 0`, the value of `vec_splat` does not matter. | 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 | if (pattern.len != 0) assert(vec_splat <= rem_splat + 1); | 2263 | if (pattern.len != 0) assert(vec_splat <= rem_splat + 1); |
| 2264 | vlimit = vlimit.subtract(pattern.len * vec_splat).?; | 2264 | vlimit = vlimit.subtract(pattern.len * vec_splat).?; |
| 2265 | vec_n += 1; | 2265 | vec_n += 1; |
| ... | @@ -2267,7 +2267,7 @@ pub const Huffman = struct { | ... | @@ -2267,7 +2267,7 @@ pub const Huffman = struct { |
| 2267 | }; | 2267 | }; |
| 2268 | 2268 | ||
| 2269 | const n = if (vec_n != 0) n: { | 2269 | const n = if (vec_n != 0) n: { |
| 2270 | assert(@intFromEnum(block_limit) - @intFromEnum(vlimit) == | 2270 | assert(@backingInt(block_limit) - @backingInt(vlimit) == |
| 2271 | Writer.countSplat(rem_data[0..vec_n], vec_splat)); | 2271 | Writer.countSplat(rem_data[0..vec_n], vec_splat)); |
| 2272 | break :n try h.bit_writer.output.writeSplat(rem_data[0..vec_n], vec_splat); | 2272 | break :n try h.bit_writer.output.writeSplat(rem_data[0..vec_n], vec_splat); |
| 2273 | } else 0; // Still go into the case below to advance the vector | 2273 | } else 0; // Still go into the case below to advance the vector |
| ... | @@ -2278,8 +2278,8 @@ pub const Huffman = struct { | ... | @@ -2278,8 +2278,8 @@ pub const Huffman = struct { |
| 2278 | const elem = rem_data[0]; | 2278 | const elem = rem_data[0]; |
| 2279 | rem_data = rem_data[1..]; | 2279 | rem_data = rem_data[1..]; |
| 2280 | consumed = consumed.subtract(elem.len) orelse { | 2280 | consumed = consumed.subtract(elem.len) orelse { |
| 2281 | h.hasher.update(elem[0..@intFromEnum(consumed)]); | 2281 | h.hasher.update(elem[0..@backingInt(consumed)]); |
| 2282 | rem_data_elem = elem[@intFromEnum(consumed)..]; | 2282 | rem_data_elem = elem[@backingInt(consumed)..]; |
| 2283 | break; | 2283 | break; |
| 2284 | }; | 2284 | }; |
| 2285 | h.hasher.update(elem); | 2285 | h.hasher.update(elem); |
| ... | @@ -2297,8 +2297,8 @@ pub const Huffman = struct { | ... | @@ -2297,8 +2297,8 @@ pub const Huffman = struct { |
| 2297 | break; | 2297 | break; |
| 2298 | } | 2298 | } |
| 2299 | 2299 | ||
| 2300 | const splatted = @intFromEnum(consumed) / pattern.len; | 2300 | const splatted = @backingInt(consumed) / pattern.len; |
| 2301 | const partial = @intFromEnum(consumed) % pattern.len; | 2301 | const partial = @backingInt(consumed) % pattern.len; |
| 2302 | for (0..splatted) |_| h.hasher.update(pattern); | 2302 | for (0..splatted) |_| h.hasher.update(pattern); |
| 2303 | h.hasher.update(pattern[0..partial]); | 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,7 +131,7 @@ fn discardDirect(r: *Reader, limit: std.Io.Limit) Reader.Error!usize { |
| 131 | error.WriteFailed => unreachable, | 131 | error.WriteFailed => unreachable, |
| 132 | error.ReadFailed, error.EndOfStream => |e| return e, | 132 | error.ReadFailed, error.EndOfStream => |e| return e, |
| 133 | }; | 133 | }; |
| 134 | assert(n <= @intFromEnum(limit)); | 134 | assert(n <= @backingInt(limit)); |
| 135 | return n; | 135 | return n; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| ... | @@ -268,7 +268,7 @@ fn streamFallible(d: *Decompress, w: *Writer, limit: std.Io.Limit) Reader.Stream | ... | @@ -268,7 +268,7 @@ fn streamFallible(d: *Decompress, w: *Writer, limit: std.Io.Limit) Reader.Stream |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader.StreamError)!usize { | 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 | const in = d.input; | 272 | const in = d.input; |
| 273 | sw: switch (d.state) { | 273 | sw: switch (d.state) { |
| 274 | .protocol_header => switch (d.container_metadata.container()) { | 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,7 +316,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 316 | }, | 316 | }, |
| 317 | .block_header => { | 317 | .block_header => { |
| 318 | d.final_block = (try d.takeIntBits(u1)) != 0; | 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 | switch (block_type) { | 320 | switch (block_type) { |
| 321 | .stored => { | 321 | .stored => { |
| 322 | d.alignBitsForward(); | 322 | d.alignBitsForward(); |
| ... | @@ -380,7 +380,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader | ... | @@ -380,7 +380,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 380 | d.state = .{ .stored_block = @intCast(remaining_len - n) }; | 380 | d.state = .{ .stored_block = @intCast(remaining_len - n) }; |
| 381 | } | 381 | } |
| 382 | w.advance(n); | 382 | w.advance(n); |
| 383 | return @intFromEnum(limit) - remaining + n; | 383 | return @backingInt(limit) - remaining + n; |
| 384 | }, | 384 | }, |
| 385 | .fixed_block => while (true) { | 385 | .fixed_block => while (true) { |
| 386 | // Consume bytes | 386 | // Consume bytes |
| ... | @@ -408,7 +408,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader | ... | @@ -408,7 +408,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 408 | try w.writeBytePreserve(flate.history_len, byte); | 408 | try w.writeBytePreserve(flate.history_len, byte); |
| 409 | } else { | 409 | } else { |
| 410 | d.state = .{ .fixed_block_literal = byte }; | 410 | d.state = .{ .fixed_block_literal = byte }; |
| 411 | return @intFromEnum(limit) - remaining; | 411 | return @backingInt(limit) - remaining; |
| 412 | } | 412 | } |
| 413 | }, | 413 | }, |
| 414 | .fixed_block_literal => |symbol| { | 414 | .fixed_block_literal => |symbol| { |
| ... | @@ -426,7 +426,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader | ... | @@ -426,7 +426,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 426 | continue :sw .fixed_block; | 426 | continue :sw .fixed_block; |
| 427 | } else { | 427 | } else { |
| 428 | d.state = .{ .fixed_block_match = length }; | 428 | d.state = .{ .fixed_block_match = length }; |
| 429 | return @intFromEnum(limit) - remaining; | 429 | return @backingInt(limit) - remaining; |
| 430 | } | 430 | } |
| 431 | }, | 431 | }, |
| 432 | // In larger archives most blocks are usually dynamic, so | 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,7 +457,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 457 | try w.writeBytePreserve(flate.history_len, byte); | 457 | try w.writeBytePreserve(flate.history_len, byte); |
| 458 | } else { | 458 | } else { |
| 459 | d.state = .{ .dynamic_block_literal = byte }; | 459 | d.state = .{ .dynamic_block_literal = byte }; |
| 460 | return @intFromEnum(limit) - remaining; | 460 | return @backingInt(limit) - remaining; |
| 461 | } | 461 | } |
| 462 | }, | 462 | }, |
| 463 | .dynamic_block_literal => |symbol| { | 463 | .dynamic_block_literal => |symbol| { |
| ... | @@ -476,7 +476,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader | ... | @@ -476,7 +476,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 476 | continue :sw .dynamic_block; | 476 | continue :sw .dynamic_block; |
| 477 | } else { | 477 | } else { |
| 478 | d.state = .{ .dynamic_block_match = length }; | 478 | d.state = .{ .dynamic_block_match = length }; |
| 479 | return @intFromEnum(limit) - remaining; | 479 | return @backingInt(limit) - remaining; |
| 480 | } | 480 | } |
| 481 | }, | 481 | }, |
| 482 | .protocol_footer => { | 482 | .protocol_footer => { |
| ... | @@ -492,7 +492,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader | ... | @@ -492,7 +492,7 @@ fn streamInner(d: *Decompress, w: *Writer, limit: std.Io.Limit) (Error || Reader |
| 492 | .raw => {}, | 492 | .raw => {}, |
| 493 | } | 493 | } |
| 494 | d.state = .end; | 494 | d.state = .end; |
| 495 | return @intFromEnum(limit) - remaining; | 495 | return @backingInt(limit) - remaining; |
| 496 | }, | 496 | }, |
| 497 | .end => return error.EndOfStream, | 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,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 | if (filter_id != .lzma2) return error.Unsupported; | 223 | if (filter_id != .lzma2) return error.Unsupported; |
| 224 | 224 | ||
| 225 | const properties_size = try input.takeLeb128(u64); | 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,7 +175,7 @@ fn discardDirect(r: *Reader, limit: std.Io.Limit) Reader.Error!usize { |
| 175 | error.WriteFailed => unreachable, | 175 | error.WriteFailed => unreachable, |
| 176 | error.ReadFailed, error.EndOfStream => |e| return e, | 176 | error.ReadFailed, error.EndOfStream => |e| return e, |
| 177 | }; | 177 | }; |
| 178 | assert(n <= @intFromEnum(limit)); | 178 | assert(n <= @backingInt(limit)); |
| 179 | return n; | 179 | return n; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| ... | @@ -297,7 +297,7 @@ fn readInFrame(d: *Decompress, w: *Writer, limit: Limit, state: *State.InFrame) | ... | @@ -297,7 +297,7 @@ fn readInFrame(d: *Decompress, w: *Writer, limit: Limit, state: *State.InFrame) |
| 297 | const block_size = block_header.size; | 297 | const block_size = block_header.size; |
| 298 | const frame_block_size_max = state.frame.block_size_max; | 298 | const frame_block_size_max = state.frame.block_size_max; |
| 299 | if (frame_block_size_max < block_size) return error.BlockOversize; | 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 | var bytes_written: usize = 0; | 301 | var bytes_written: usize = 0; |
| 302 | switch (block_header.type) { | 302 | switch (block_header.type) { |
| 303 | .raw => { | 303 | .raw => { |
| ... | @@ -320,7 +320,7 @@ fn readInFrame(d: *Decompress, w: *Writer, limit: Limit, state: *State.InFrame) | ... | @@ -320,7 +320,7 @@ fn readInFrame(d: *Decompress, w: *Writer, limit: Limit, state: *State.InFrame) |
| 320 | try decode.prepare(in, &remaining, literals, sequences_header); | 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 | return error.SequenceBufferUndersize; | 324 | return error.SequenceBufferUndersize; |
| 325 | const seq_slice = remaining.slice(&sequence_buffer); | 325 | const seq_slice = remaining.slice(&sequence_buffer); |
| 326 | try in.readSliceAll(seq_slice); | 326 | try in.readSliceAll(seq_slice); |
| ... | @@ -409,16 +409,16 @@ pub const Frame = struct { | ... | @@ -409,16 +409,16 @@ pub const Frame = struct { |
| 409 | _, | 409 | _, |
| 410 | 410 | ||
| 411 | pub fn kind(m: Magic) ?Kind { | 411 | pub fn kind(m: Magic) ?Kind { |
| 412 | return switch (@intFromEnum(m)) { | 412 | return switch (@backingInt(m)) { |
| 413 | @intFromEnum(Magic.zstandard) => .zstandard, | 413 | @backingInt(Magic.zstandard) => .zstandard, |
| 414 | @intFromEnum(Skippable.magic_min)...@intFromEnum(Skippable.magic_max) => .skippable, | 414 | @backingInt(Skippable.magic_min)...@backingInt(Skippable.magic_max) => .skippable, |
| 415 | else => null, | 415 | else => null, |
| 416 | }; | 416 | }; |
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | pub fn isSkippable(m: Magic) bool { | 419 | pub fn isSkippable(m: Magic) bool { |
| 420 | return switch (@intFromEnum(m)) { | 420 | return switch (@backingInt(m)) { |
| 421 | @intFromEnum(Skippable.magic_min)...@intFromEnum(Skippable.magic_max) => true, | 421 | @backingInt(Skippable.magic_min)...@backingInt(Skippable.magic_max) => true, |
| 422 | else => false, | 422 | else => false, |
| 423 | }; | 423 | }; |
| 424 | } | 424 | } |
| ... | @@ -902,8 +902,8 @@ pub const Frame = struct { | ... | @@ -902,8 +902,8 @@ pub const Frame = struct { |
| 902 | }; | 902 | }; |
| 903 | 903 | ||
| 904 | pub const Skippable = struct { | 904 | pub const Skippable = struct { |
| 905 | pub const magic_min: Magic = @enumFromInt(0x184D2A50); | 905 | pub const magic_min: Magic = @fromBackingInt(@intCast(0x184D2A50)); |
| 906 | pub const magic_max: Magic = @enumFromInt(0x184D2A5F); | 906 | pub const magic_max: Magic = @fromBackingInt(@intCast(0x184D2A5F)); |
| 907 | 907 | ||
| 908 | pub const Header = struct { | 908 | pub const Header = struct { |
| 909 | magic_number: u32, | 909 | magic_number: u32, |
| ... | @@ -1001,7 +1001,7 @@ pub const LiteralsSection = struct { | ... | @@ -1001,7 +1001,7 @@ pub const LiteralsSection = struct { |
| 1001 | pub fn decode(in: *Reader, remaining: *Limit) !Header { | 1001 | pub fn decode(in: *Reader, remaining: *Limit) !Header { |
| 1002 | remaining.* = remaining.subtract(1) orelse return error.EndOfStream; | 1002 | remaining.* = remaining.subtract(1) orelse return error.EndOfStream; |
| 1003 | const byte0 = try in.takeByte(); | 1003 | const byte0 = try in.takeByte(); |
| 1004 | const block_type: BlockType = @enumFromInt(byte0 & 0b11); | 1004 | const block_type: BlockType = @fromBackingInt(@intCast(byte0 & 0b11)); |
| 1005 | const size_format: u2 = @intCast((byte0 & 0b1100) >> 2); | 1005 | const size_format: u2 = @intCast((byte0 & 0b1100) >> 2); |
| 1006 | var regenerated_size: u20 = undefined; | 1006 | var regenerated_size: u20 = undefined; |
| 1007 | var compressed_size: ?u18 = null; | 1007 | var compressed_size: ?u18 = null; |
| ... | @@ -1330,7 +1330,7 @@ pub const LiteralsSection = struct { | ... | @@ -1330,7 +1330,7 @@ pub const LiteralsSection = struct { |
| 1330 | try HuffmanTree.decode(in, remaining) | 1330 | try HuffmanTree.decode(in, remaining) |
| 1331 | else | 1331 | else |
| 1332 | null; | 1332 | null; |
| 1333 | const huffman_tree_size = @intFromEnum(before_remaining) - @intFromEnum(remaining.*); | 1333 | const huffman_tree_size = @backingInt(before_remaining) - @backingInt(remaining.*); |
| 1334 | const total_streams_size = std.math.sub(usize, header.compressed_size.?, huffman_tree_size) catch | 1334 | const total_streams_size = std.math.sub(usize, header.compressed_size.?, huffman_tree_size) catch |
| 1335 | return error.MalformedLiteralsSection; | 1335 | return error.MalformedLiteralsSection; |
| 1336 | if (total_streams_size > buffer.len) return error.MalformedLiteralsSection; | 1336 | if (total_streams_size > buffer.len) return error.MalformedLiteralsSection; |
| ... | @@ -1398,9 +1398,9 @@ pub const SequencesSection = struct { | ... | @@ -1398,9 +1398,9 @@ pub const SequencesSection = struct { |
| 1398 | 1398 | ||
| 1399 | const compression_modes = try in.takeByte(); | 1399 | const compression_modes = try in.takeByte(); |
| 1400 | 1400 | ||
| 1401 | const matches_mode: Header.Mode = @enumFromInt((compression_modes & 0b00001100) >> 2); | 1401 | const matches_mode: Header.Mode = @fromBackingInt(@intCast((compression_modes & 0b00001100) >> 2)); |
| 1402 | const offsets_mode: Header.Mode = @enumFromInt((compression_modes & 0b00110000) >> 4); | 1402 | const offsets_mode: Header.Mode = @fromBackingInt(@intCast((compression_modes & 0b00110000) >> 4)); |
| 1403 | const literal_mode: Header.Mode = @enumFromInt((compression_modes & 0b11000000) >> 6); | 1403 | const literal_mode: Header.Mode = @fromBackingInt(@intCast((compression_modes & 0b11000000) >> 6)); |
| 1404 | if (compression_modes & 0b11 != 0) return error.ReservedBitSet; | 1404 | if (compression_modes & 0b11 != 0) return error.ReservedBitSet; |
| 1405 | 1405 | ||
| 1406 | return .{ | 1406 | return .{ |
lib/std/crypto/Certificate.zig+2-2| ... | @@ -327,7 +327,7 @@ pub const Parsed = struct { | ... | @@ -327,7 +327,7 @@ pub const Parsed = struct { |
| 327 | while (name_i < general_names.slice.end) { | 327 | while (name_i < general_names.slice.end) { |
| 328 | const general_name = try der.Element.parse(subject_alt_name, name_i); | 328 | const general_name = try der.Element.parse(subject_alt_name, name_i); |
| 329 | name_i = general_name.slice.end; | 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 | .dNSName => { | 331 | .dNSName => { |
| 332 | const dns_name = subject_alt_name[general_name.slice.start..general_name.slice.end]; | 332 | const dns_name = subject_alt_name[general_name.slice.start..general_name.slice.end]; |
| 333 | if (checkHostName(host_name, dns_name)) return; | 333 | if (checkHostName(host_name, dns_name)) return; |
| ... | @@ -642,7 +642,7 @@ const Date = struct { | ... | @@ -642,7 +642,7 @@ const Date = struct { |
| 642 | while (month < date.month) : (month += 1) { | 642 | while (month < date.month) : (month += 1) { |
| 643 | const days: u64 = std.time.epoch.getDaysInMonth( | 643 | const days: u64 = std.time.epoch.getDaysInMonth( |
| 644 | date.year, | 644 | date.year, |
| 645 | @enumFromInt(month), | 645 | @fromBackingInt(@intCast(month)), |
| 646 | ); | 646 | ); |
| 647 | sec += days * std.time.epoch.secs_per_day; | 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,7 +55,7 @@ fn scanReader(cb: *Bundle, gpa: Allocator, reader: *Io.Reader, now_sec: i64) !vo |
| 55 | 55 | ||
| 56 | const table_header = try reader.takeStruct(TableHeader, .big); | 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 | continue; | 59 | continue; |
| 60 | } | 60 | } |
| 61 | 61 |
lib/std/crypto/argon2.zig+2-2| ... | @@ -119,7 +119,7 @@ fn initHash( | ... | @@ -119,7 +119,7 @@ fn initHash( |
| 119 | mem.writeInt(u32, parameters[8..12], params.m, .little); | 119 | mem.writeInt(u32, parameters[8..12], params.m, .little); |
| 120 | mem.writeInt(u32, parameters[12..16], params.t, .little); | 120 | mem.writeInt(u32, parameters[12..16], params.t, .little); |
| 121 | mem.writeInt(u32, parameters[16..20], version, .little); | 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 | b2.update(&parameters); | 123 | b2.update(&parameters); |
| 124 | mem.writeInt(u32, &tmp, @as(u32, @intCast(password.len)), .little); | 124 | mem.writeInt(u32, &tmp, @as(u32, @intCast(password.len)), .little); |
| 125 | b2.update(&tmp); | 125 | b2.update(&tmp); |
| ... | @@ -290,7 +290,7 @@ fn processSegment( | ... | @@ -290,7 +290,7 @@ fn processSegment( |
| 290 | in[2] = slice; | 290 | in[2] = slice; |
| 291 | in[3] = memory; | 291 | in[3] = memory; |
| 292 | in[4] = passes; | 292 | in[4] = passes; |
| 293 | in[5] = @intFromEnum(mode); | 293 | in[5] = @backingInt(mode); |
| 294 | } | 294 | } |
| 295 | var index: u32 = 0; | 295 | var index: u32 = 0; |
| 296 | if (n == 0 and slice == 0) { | 296 | if (n == 0 and slice == 0) { |
lib/std/crypto/codecs/asn1.zig+6-6| ... | @@ -86,14 +86,14 @@ pub const Tag = struct { | ... | @@ -86,14 +86,14 @@ pub const Tag = struct { |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | return Tag{ | 88 | return Tag{ |
| 89 | .number = @enumFromInt(number), | 89 | .number = @fromBackingInt(@intCast(number)), |
| 90 | .constructed = tag1.constructed, | 90 | .constructed = tag1.constructed, |
| 91 | .class = tag1.class, | 91 | .class = tag1.class, |
| 92 | }; | 92 | }; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | pub fn encodeToSlice(self: Tag, buf: *[max_encoded_len]u8) []const u8 { | 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 | var tag1: FirstTag = .{ | 97 | var tag1: FirstTag = .{ |
| 98 | .number = undefined, | 98 | .number = undefined, |
| 99 | .constructed = self.constructed, | 99 | .constructed = self.constructed, |
| ... | @@ -175,7 +175,7 @@ test Tag { | ... | @@ -175,7 +175,7 @@ test Tag { |
| 175 | const buf = [_]u8{0xa3}; | 175 | const buf = [_]u8{0xa3}; |
| 176 | var reader: std.Io.Reader = .fixed(&buf); | 176 | var reader: std.Io.Reader = .fixed(&buf); |
| 177 | const t = Tag.decode(&reader); | 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 | test "Tag.encode produces the exact bytes from X.690" { | 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,7 +190,7 @@ test "Tag.encode produces the exact bytes from X.690" { |
| 190 | .{ .number = 65535, .expected = &.{ 0x1f, 0x83, 0xff, 0x7f } }, | 190 | .{ .number = 65535, .expected = &.{ 0x1f, 0x83, 0xff, 0x7f } }, |
| 191 | }; | 191 | }; |
| 192 | for (cases) |c| { | 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 | var buf: [Tag.max_encoded_len]u8 = undefined; | 194 | var buf: [Tag.max_encoded_len]u8 = undefined; |
| 195 | try std.testing.expectEqualSlices(u8, c.expected, tag.encodeToSlice(&buf)); | 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,7 +198,7 @@ test "Tag.encode produces the exact bytes from X.690" { |
| 198 | 198 | ||
| 199 | test "Tag.encode/decode round trip" { | 199 | test "Tag.encode/decode round trip" { |
| 200 | for ([_]u16{ 0, 30, 31, 32, 127, 128, 16383, 16384, 65535 }) |n| { | 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 | var buf: [Tag.max_encoded_len]u8 = undefined; | 202 | var buf: [Tag.max_encoded_len]u8 = undefined; |
| 203 | const encoded = tag.encodeToSlice(&buf); | 203 | const encoded = tag.encodeToSlice(&buf); |
| 204 | var reader: std.Io.Reader = .fixed(encoded); | 204 | var reader: std.Io.Reader = .fixed(encoded); |
| ... | @@ -346,7 +346,7 @@ pub const FieldTag = struct { | ... | @@ -346,7 +346,7 @@ pub const FieldTag = struct { |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | pub fn toTag(self: FieldTag) Tag { | 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,7 +191,7 @@ pub fn StaticMap(comptime Enum: type) type { |
| 191 | @compileError("Field '" ++ f_name ++ "' missing Oid.StaticMap entry"); | 191 | @compileError("Field '" ++ f_name ++ "' missing Oid.StaticMap entry"); |
| 192 | } | 192 | } |
| 193 | const encoded = &encodeComptime(@field(key_pairs, f_name)); | 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 | static_key_pairs[i] = .{ encoded, tag }; | 195 | static_key_pairs[i] = .{ encoded, tag }; |
| 196 | enum_to_oid.set(tag, encoded); | 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,7 +72,7 @@ pub fn any(self: *Decoder, comptime T: type) !T { |
| 72 | if (@hasDecl(T, "oids")) { | 72 | if (@hasDecl(T, "oids")) { |
| 73 | return T.oids.oidToEnum(bytes) orelse return error.UnknownOid; | 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 | .optional => |o| return self.any(o.child) catch return null, | 77 | .optional => |o| return self.any(o.child) catch return null, |
| 78 | else => @compileError("cannot decode type " ++ @typeName(T)), | 78 | else => @compileError("cannot decode type " ++ @typeName(T)), |
| ... | @@ -94,7 +94,7 @@ pub fn element( | ... | @@ -94,7 +94,7 @@ pub fn element( |
| 94 | const res = try Element.decode(self.bytes, self.index); | 94 | const res = try Element.decode(self.bytes, self.index); |
| 95 | var e = expected; | 95 | var e = expected; |
| 96 | if (self.field_tag) |ft| { | 96 | if (self.field_tag) |ft| { |
| 97 | e.number = @enumFromInt(ft.number); | 97 | e.number = @fromBackingInt(@intCast(ft.number)); |
| 98 | e.class = ft.class; | 98 | e.class = ft.class; |
| 99 | } | 99 | } |
| 100 | if (!e.match(res.tag)) { | 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,7 +68,7 @@ fn anyTag(self: *Encoder, tag_: Tag, val: anytype) !void { |
| 68 | if (@hasDecl(T, "oids")) { | 68 | if (@hasDecl(T, "oids")) { |
| 69 | return self.any(T.oids.enumToOid(val)); | 69 | return self.any(T.oids.enumToOid(val)); |
| 70 | } else { | 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 | .optional => if (val) |v| return try self.anyTag(tag_, v) else return, | 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,7 +91,7 @@ fn mergedTag(self: *Encoder, tag_: Tag) Tag { |
| 91 | var res = tag_; | 91 | var res = tag_; |
| 92 | if (self.field_tag) |ft| { | 92 | if (self.field_tag) |ft| { |
| 93 | if (!ft.explicit) { | 93 | if (!ft.explicit) { |
| 94 | res.number = @enumFromInt(ft.number); | 94 | res.number = @fromBackingInt(@intCast(ft.number)); |
| 95 | res.class = ft.class; | 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,8 +48,8 @@ pub const hello_retry_request_sequence = [32]u8{ |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | pub const close_notify_alert = [_]u8{ | 50 | pub const close_notify_alert = [_]u8{ |
| 51 | @intFromEnum(Alert.Level.warning), | 51 | @backingInt(Alert.Level.warning), |
| 52 | @intFromEnum(Alert.Description.close_notify), | 52 | @backingInt(Alert.Description.close_notify), |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | pub const ProtocolVersion = enum(u16) { | 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,7 +595,7 @@ pub fn hmac(comptime Hmac: type, message: []const u8, key: [Hmac.key_length]u8) |
| 595 | } | 595 | } |
| 596 | 596 | ||
| 597 | pub fn extension(et: ExtensionType, bytes: anytype) [2 + 2 + bytes.len]u8 { | 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 | pub fn array( | 601 | pub fn array( |
| ... | @@ -614,7 +614,7 @@ pub fn array( | ... | @@ -614,7 +614,7 @@ pub fn array( |
| 614 | arr[len_size + elem_size * index ..][0..elem_size], | 614 | arr[len_size + elem_size * index ..][0..elem_size], |
| 615 | switch (@typeInfo(Elem)) { | 615 | switch (@typeInfo(Elem)) { |
| 616 | .int => @as(Elem, elem), | 616 | .int => @as(Elem, elem), |
| 617 | .@"enum" => @intFromEnum(@as(Elem, elem)), | 617 | .@"enum" => @backingInt(@as(Elem, elem)), |
| 618 | else => @bitCast(@as(Elem, elem)), | 618 | else => @bitCast(@as(Elem, elem)), |
| 619 | }, | 619 | }, |
| 620 | .big, | 620 | .big, |
| ... | @@ -711,7 +711,7 @@ pub const Decoder = struct { | ... | @@ -711,7 +711,7 @@ pub const Decoder = struct { |
| 711 | }, | 711 | }, |
| 712 | .@"enum" => |info| { | 712 | .@"enum" => |info| { |
| 713 | if (info.mode == .exhaustive) @compileError("exhaustive enum cannot be used"); | 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 | else => @compileError("unsupported type: " ++ @typeName(T)), | 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,16 +237,16 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 237 | })) ++ tls.extension(.key_share, array( | 237 | })) ++ tls.extension(.key_share, array( |
| 238 | u16, | 238 | u16, |
| 239 | u8, | 239 | u8, |
| 240 | int(u16, @intFromEnum(tls.NamedGroup.x25519_ml_kem768)) ++ | 240 | int(u16, @backingInt(tls.NamedGroup.x25519_ml_kem768)) ++ |
| 241 | array(u16, u8, key_share.ml_kem768_kp.public_key.toBytes() ++ key_share.x25519_kp.public_key) ++ | 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 | array(u16, u8, key_share.secp256r1_kp.public_key.toUncompressedSec1()) ++ | 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 | array(u16, u8, key_share.secp384r1_kp.public_key.toUncompressedSec1()) ++ | 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 | array(u16, u8, key_share.x25519_kp.public_key), | 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 | int(u16, 2 + 1 + 2 + host_len) ++ // byte length of this extension payload | 250 | int(u16, 2 + 1 + 2 + host_len) ++ // byte length of this extension payload |
| 251 | int(u16, 1 + 2 + host_len) ++ // server_name_list byte count | 251 | int(u16, 1 + 2 + host_len) ++ // server_name_list byte count |
| 252 | .{0x00} ++ // name_type | 252 | .{0x00} ++ // name_type |
| ... | @@ -262,19 +262,19 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client | ... | @@ -262,19 +262,19 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 262 | server_name_extension; | 262 | server_name_extension; |
| 263 | 263 | ||
| 264 | const client_hello = | 264 | const client_hello = |
| 265 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | 265 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ |
| 266 | client_hello_rand ++ | 266 | client_hello_rand ++ |
| 267 | [1]u8{32} ++ legacy_session_id ++ | 267 | [1]u8{32} ++ legacy_session_id ++ |
| 268 | cipher_suites ++ | 268 | cipher_suites ++ |
| 269 | array(u8, tls.CompressionMethod, .{.null}) ++ | 269 | array(u8, tls.CompressionMethod, .{.null}) ++ |
| 270 | extensions_header; | 270 | extensions_header; |
| 271 | 271 | ||
| 272 | const out_handshake = .{@intFromEnum(tls.HandshakeType.client_hello)} ++ | 272 | const out_handshake = .{@backingInt(tls.HandshakeType.client_hello)} ++ |
| 273 | int(u24, @intCast(client_hello.len - server_name_extension.len + server_name_extension_len)) ++ | 273 | int(u24, @intCast(client_hello.len - server_name_extension.len + server_name_extension_len)) ++ |
| 274 | client_hello; | 274 | client_hello; |
| 275 | 275 | ||
| 276 | const cleartext_header_buf = .{@intFromEnum(tls.ContentType.handshake)} ++ | 276 | const cleartext_header_buf = .{@backingInt(tls.ContentType.handshake)} ++ |
| 277 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_0)) ++ | 277 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_0)) ++ |
| 278 | int(u16, @intCast(out_handshake.len - server_name_extension.len + server_name_extension_len)) ++ | 278 | int(u16, @intCast(out_handshake.len - server_name_extension.len + server_name_extension_len)) ++ |
| 279 | out_handshake; | 279 | out_handshake; |
| 280 | const cleartext_header = switch (options.host) { | 280 | const cleartext_header = switch (options.host) { |
| ... | @@ -389,7 +389,7 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client | ... | @@ -389,7 +389,7 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 389 | } | 389 | } |
| 390 | read_seq += 1; | 390 | read_seq += 1; |
| 391 | cleartext_fragment_end -= 1; | 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 | if (ct != .handshake) return error.TlsUnexpectedMessage; | 393 | if (ct != .handshake) return error.TlsUnexpectedMessage; |
| 394 | break :content .{ tls.Decoder.fromTheirSlice(@constCast(cleartext_buf[cleartext_fragment_start..cleartext_fragment_end])), ct }; | 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,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 | switch (tls_version) { | 499 | switch (tls_version) { |
| 500 | .tls_1_3 => if (!mem.eql(u8, legacy_session_id_echo, &legacy_session_id)) return error.TlsIllegalParameter, | 500 | .tls_1_3 => if (!mem.eql(u8, legacy_session_id_echo, &legacy_session_id)) return error.TlsIllegalParameter, |
| 501 | .tls_1_2 => if (mem.eql(u8, server_hello_rand[24..31], "DOWNGRD") and | 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,14 +739,14 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 739 | else => return error.TlsIllegalParameter, | 739 | else => return error.TlsIllegalParameter, |
| 740 | }; | 740 | }; |
| 741 | 741 | ||
| 742 | const client_key_exchange_prefix = .{@intFromEnum(tls.ContentType.handshake)} ++ | 742 | const client_key_exchange_prefix = .{@backingInt(tls.ContentType.handshake)} ++ |
| 743 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | 743 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ |
| 744 | int(u16, @intCast(public_key_bytes.len + 5)) ++ // record length | 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 | int(u24, @intCast(public_key_bytes.len + 1)) ++ // handshake message length | 746 | int(u24, @intCast(public_key_bytes.len + 1)) ++ // handshake message length |
| 747 | .{@as(u8, @intCast(public_key_bytes.len))}; // public key length | 747 | .{@as(u8, @intCast(public_key_bytes.len))}; // public key length |
| 748 | const client_change_cipher_spec_msg = .{@intFromEnum(tls.ContentType.change_cipher_spec)} ++ | 748 | const client_change_cipher_spec_msg = .{@backingInt(tls.ContentType.change_cipher_spec)} ++ |
| 749 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | 749 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ |
| 750 | array(u16, tls.ChangeCipherSpecType, .{.change_cipher_spec}); | 750 | array(u16, tls.ChangeCipherSpecType, .{.change_cipher_spec}); |
| 751 | const pre_master_secret = key_share.getSharedSecret().?; | 751 | const pre_master_secret = key_share.getSharedSecret().?; |
| 752 | switch (handshake_cipher) { | 752 | switch (handshake_cipher) { |
| ... | @@ -771,7 +771,7 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client | ... | @@ -771,7 +771,7 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 771 | &.{ "key expansion", &server_hello_rand, &client_hello_rand }, | 771 | &.{ "key expansion", &server_hello_rand, &client_hello_rand }, |
| 772 | @sizeOf(P.Tls_1_2), | 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 | array(u24, u8, hmacExpandLabel( | 775 | array(u24, u8, hmacExpandLabel( |
| 776 | P.Hmac, | 776 | P.Hmac, |
| 777 | &master_secret, | 777 | &master_secret, |
| ... | @@ -795,8 +795,8 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client | ... | @@ -795,8 +795,8 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 795 | const operand: V = pad ++ @as([8]u8, @bitCast(@byteSwap(write_seq))); | 795 | const operand: V = pad ++ @as([8]u8, @bitCast(@byteSwap(write_seq))); |
| 796 | break :nonce @as(V, pv.app_cipher.client_write_IV ++ pv.app_cipher.client_salt) ^ operand; | 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)} ++ | 798 | var client_verify_msg = .{@backingInt(tls.ContentType.handshake)} ++ |
| 799 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | 799 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ |
| 800 | array(u16, u8, nonce[P.fixed_iv_length..].* ++ | 800 | array(u16, u8, nonce[P.fixed_iv_length..].* ++ |
| 801 | @as([client_verify_cleartext.len + P.mac_length]u8, undefined)); | 801 | @as([client_verify_cleartext.len + P.mac_length]u8, undefined)); |
| 802 | P.AEAD.encrypt( | 802 | P.AEAD.encrypt( |
| ... | @@ -846,8 +846,8 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client | ... | @@ -846,8 +846,8 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 846 | if (cipher_state == .cleartext) return error.TlsUnexpectedMessage; | 846 | if (cipher_state == .cleartext) return error.TlsUnexpectedMessage; |
| 847 | if (handshake_state != .finished) return error.TlsUnexpectedMessage; | 847 | if (handshake_state != .finished) return error.TlsUnexpectedMessage; |
| 848 | // This message is to trick buggy proxies into behaving correctly. | 848 | // This message is to trick buggy proxies into behaving correctly. |
| 849 | const client_change_cipher_spec_msg = .{@intFromEnum(tls.ContentType.change_cipher_spec)} ++ | 849 | const client_change_cipher_spec_msg = .{@backingInt(tls.ContentType.change_cipher_spec)} ++ |
| 850 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | 850 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ |
| 851 | array(u16, tls.ChangeCipherSpecType, .{.change_cipher_spec}); | 851 | array(u16, tls.ChangeCipherSpecType, .{.change_cipher_spec}); |
| 852 | const app_cipher = app_cipher: switch (handshake_cipher) { | 852 | const app_cipher = app_cipher: switch (handshake_cipher) { |
| 853 | inline else => |*p, tag| switch (tls_version) { | 853 | inline else => |*p, tag| switch (tls_version) { |
| ... | @@ -861,14 +861,14 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client | ... | @@ -861,14 +861,14 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client |
| 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; | 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 | const handshake_hash = p.transcript_hash.finalResult(); | 862 | const handshake_hash = p.transcript_hash.finalResult(); |
| 863 | const verify_data = tls.hmac(P.Hmac, &handshake_hash, pv.client_finished_key); | 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 | array(u24, u8, verify_data) ++ | 865 | array(u24, u8, verify_data) ++ |
| 866 | .{@intFromEnum(tls.ContentType.handshake)}; | 866 | .{@backingInt(tls.ContentType.handshake)}; |
| 867 | 867 | ||
| 868 | const wrapped_len = out_cleartext.len + P.AEAD.tag_length; | 868 | const wrapped_len = out_cleartext.len + P.AEAD.tag_length; |
| 869 | 869 | ||
| 870 | var finished_msg = .{@intFromEnum(tls.ContentType.application_data)} ++ | 870 | var finished_msg = .{@backingInt(tls.ContentType.application_data)} ++ |
| 871 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | 871 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ |
| 872 | array(u16, u8, @as([wrapped_len]u8, undefined)); | 872 | array(u16, u8, @as([wrapped_len]u8, undefined)); |
| 873 | 873 | ||
| 874 | const ad = finished_msg[0..tls.record_header_len]; | 874 | const ad = finished_msg[0..tls.record_header_len]; |
| ... | @@ -1051,14 +1051,14 @@ fn prepareCiphertextRecord( | ... | @@ -1051,14 +1051,14 @@ fn prepareCiphertextRecord( |
| 1051 | }; | 1051 | }; |
| 1052 | 1052 | ||
| 1053 | @memcpy(cleartext_buf[0..encrypted_content_len], bytes[bytes_i..][0..encrypted_content_len]); | 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 | bytes_i += encrypted_content_len; | 1055 | bytes_i += encrypted_content_len; |
| 1056 | const ciphertext_len = encrypted_content_len + 1; | 1056 | const ciphertext_len = encrypted_content_len + 1; |
| 1057 | const cleartext = cleartext_buf[0..ciphertext_len]; | 1057 | const cleartext = cleartext_buf[0..ciphertext_len]; |
| 1058 | 1058 | ||
| 1059 | const ad = ciphertext_buf[ciphertext_end..][0..tls.record_header_len]; | 1059 | const ad = ciphertext_buf[ciphertext_end..][0..tls.record_header_len]; |
| 1060 | ad.* = .{@intFromEnum(tls.ContentType.application_data)} ++ | 1060 | ad.* = .{@backingInt(tls.ContentType.application_data)} ++ |
| 1061 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | 1061 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ |
| 1062 | int(u16, ciphertext_len + P.AEAD.tag_length); | 1062 | int(u16, ciphertext_len + P.AEAD.tag_length); |
| 1063 | ciphertext_end += ad.len; | 1063 | ciphertext_end += ad.len; |
| 1064 | const ciphertext = ciphertext_buf[ciphertext_end..][0..ciphertext_len]; | 1064 | const ciphertext = ciphertext_buf[ciphertext_end..][0..ciphertext_len]; |
| ... | @@ -1096,8 +1096,8 @@ fn prepareCiphertextRecord( | ... | @@ -1096,8 +1096,8 @@ fn prepareCiphertextRecord( |
| 1096 | 1096 | ||
| 1097 | const record_header = ciphertext_buf[ciphertext_end..][0..tls.record_header_len]; | 1097 | const record_header = ciphertext_buf[ciphertext_end..][0..tls.record_header_len]; |
| 1098 | ciphertext_end += tls.record_header_len; | 1098 | ciphertext_end += tls.record_header_len; |
| 1099 | record_header.* = .{@intFromEnum(inner_content_type)} ++ | 1099 | record_header.* = .{@backingInt(inner_content_type)} ++ |
| 1100 | int(u16, @intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ | 1100 | int(u16, @backingInt(tls.ProtocolVersion.tls_1_2)) ++ |
| 1101 | int(u16, P.record_iv_length + message_len + P.mac_length); | 1101 | int(u16, P.record_iv_length + message_len + P.mac_length); |
| 1102 | const ad = mem.toBytes(big(c.write_seq)) ++ record_header[0 .. 1 + 2] ++ int(u16, message_len); | 1102 | const ad = mem.toBytes(big(c.write_seq)) ++ record_header[0 .. 1 + 2] ++ int(u16, message_len); |
| 1103 | const record_iv = ciphertext_buf[ciphertext_end..][0..P.record_iv_length]; | 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,7 +1160,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { |
| 1160 | }, | 1160 | }, |
| 1161 | error.ReadFailed => |e| return e, | 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 | const legacy_version = mem.readInt(u16, record_header[1..][0..2], .big); | 1164 | const legacy_version = mem.readInt(u16, record_header[1..][0..2], .big); |
| 1165 | _ = legacy_version; | 1165 | _ = legacy_version; |
| 1166 | const record_len = mem.readInt(u16, record_header[3..][0..2], .big); | 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,7 +1197,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { |
| 1197 | // TODO use scalar, non-slice version | 1197 | // TODO use scalar, non-slice version |
| 1198 | const msg = mem.trimEnd(u8, cleartext, "\x00"); | 1198 | const msg = mem.trimEnd(u8, cleartext, "\x00"); |
| 1199 | if (msg.len == 0) return failRead(c, error.TlsDecodeError); | 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 | .tls_1_2 => { | 1202 | .tls_1_2 => { |
| 1203 | const pv = &p.tls_1_2; | 1203 | const pv = &p.tls_1_2; |
| ... | @@ -1234,8 +1234,8 @@ fn readIndirect(c: *Client) Reader.Error!usize { | ... | @@ -1234,8 +1234,8 @@ fn readIndirect(c: *Client) Reader.Error!usize { |
| 1234 | .alert => { | 1234 | .alert => { |
| 1235 | if (cleartext.len != 2) return failRead(c, error.TlsDecodeError); | 1235 | if (cleartext.len != 2) return failRead(c, error.TlsDecodeError); |
| 1236 | const alert: tls.Alert = .{ | 1236 | const alert: tls.Alert = .{ |
| 1237 | .level = @enumFromInt(cleartext[0]), | 1237 | .level = @fromBackingInt(@intCast(cleartext[0])), |
| 1238 | .description = @enumFromInt(cleartext[1]), | 1238 | .description = @fromBackingInt(@intCast(cleartext[1])), |
| 1239 | }; | 1239 | }; |
| 1240 | switch (alert.description) { | 1240 | switch (alert.description) { |
| 1241 | .close_notify => { | 1241 | .close_notify => { |
| ... | @@ -1255,7 +1255,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { | ... | @@ -1255,7 +1255,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { |
| 1255 | .handshake => { | 1255 | .handshake => { |
| 1256 | var ct_i: usize = 0; | 1256 | var ct_i: usize = 0; |
| 1257 | while (true) { | 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 | ct_i += 1; | 1259 | ct_i += 1; |
| 1260 | const handshake_len = mem.readInt(u24, cleartext[ct_i..][0..3], .big); | 1260 | const handshake_len = mem.readInt(u24, cleartext[ct_i..][0..3], .big); |
| 1261 | ct_i += 3; | 1261 | ct_i += 3; |
| ... | @@ -1286,7 +1286,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { | ... | @@ -1286,7 +1286,7 @@ fn readIndirect(c: *Client) Reader.Error!usize { |
| 1286 | } | 1286 | } |
| 1287 | c.read_seq = 0; | 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 | .update_requested => { | 1290 | .update_requested => { |
| 1291 | switch (c.application_cipher) { | 1291 | switch (c.application_cipher) { |
| 1292 | inline else => |*p| { | 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,7 +844,7 @@ pub fn writeErrorReturnTrace(et: *const std.builtin.StackTrace, t: Io.Terminal) |
| 844 | // writing the stack trace. | 844 | // writing the stack trace. |
| 845 | const len = @min(et.instruction_addresses.len, et.index); | 845 | const len = @min(et.instruction_addresses.len, et.index); |
| 846 | const skipped = et.index - len; | 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 | /// Write a previously captured stack trace to `writer`, annotated with source locations. | 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,13 +41,13 @@ pub const String = enum(u32) { |
| 41 | 41 | ||
| 42 | pub fn eql(self: @This(), a: String, b: String, b_index: usize) bool { | 42 | pub fn eql(self: @This(), a: String, b: String, b_index: usize) bool { |
| 43 | _ = b_index; | 43 | _ = b_index; |
| 44 | const a_slice = span(self.string_bytes[@intFromEnum(a)..]); | 44 | const a_slice = span(self.string_bytes[@backingInt(a)..]); |
| 45 | const b_slice = span(self.string_bytes[@intFromEnum(b)..]); | 45 | const b_slice = span(self.string_bytes[@backingInt(b)..]); |
| 46 | return std.mem.eql(u8, a_slice, b_slice); | 46 | return std.mem.eql(u8, a_slice, b_slice); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | pub fn hash(self: @This(), a: String) u32 { | 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,7 +56,7 @@ pub const String = enum(u32) { |
| 56 | 56 | ||
| 57 | pub fn eql(self: @This(), a_slice: []const u8, b: String, b_index: usize) bool { | 57 | pub fn eql(self: @This(), a_slice: []const u8, b: String, b_index: usize) bool { |
| 58 | _ = b_index; | 58 | _ = b_index; |
| 59 | const b_slice = span(self.string_bytes[@intFromEnum(b)..]); | 59 | const b_slice = span(self.string_bytes[@backingInt(b)..]); |
| 60 | return std.mem.eql(u8, a_slice, b_slice); | 60 | return std.mem.eql(u8, a_slice, b_slice); |
| 61 | } | 61 | } |
| 62 | pub fn hash(self: @This(), a: []const u8) u32 { | 62 | pub fn hash(self: @This(), a: []const u8) u32 { |
| ... | @@ -91,15 +91,15 @@ pub const File = extern struct { | ... | @@ -91,15 +91,15 @@ pub const File = extern struct { |
| 91 | string_bytes: []const u8, | 91 | string_bytes: []const u8, |
| 92 | 92 | ||
| 93 | pub fn hash(self: MapContext, a: File) u32 { | 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 | return @truncate(Hash.hash(a.directory_index, a_basename)); | 95 | return @truncate(Hash.hash(a.directory_index, a_basename)); |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | pub fn eql(self: MapContext, a: File, b: File, b_index: usize) bool { | 98 | pub fn eql(self: MapContext, a: File, b: File, b_index: usize) bool { |
| 99 | _ = b_index; | 99 | _ = b_index; |
| 100 | if (a.directory_index != b.directory_index) return false; | 100 | if (a.directory_index != b.directory_index) return false; |
| 101 | const a_basename = span(self.string_bytes[@intFromEnum(a.basename)..]); | 101 | const a_basename = span(self.string_bytes[@backingInt(a.basename)..]); |
| 102 | const b_basename = span(self.string_bytes[@intFromEnum(b.basename)..]); | 102 | const b_basename = span(self.string_bytes[@backingInt(b.basename)..]); |
| 103 | return std.mem.eql(u8, a_basename, b_basename); | 103 | return std.mem.eql(u8, a_basename, b_basename); |
| 104 | } | 104 | } |
| 105 | }; | 105 | }; |
| ... | @@ -120,7 +120,7 @@ pub const File = extern struct { | ... | @@ -120,7 +120,7 @@ pub const File = extern struct { |
| 120 | pub fn eql(self: @This(), a: Entry, b: File, b_index: usize) bool { | 120 | pub fn eql(self: @This(), a: Entry, b: File, b_index: usize) bool { |
| 121 | _ = b_index; | 121 | _ = b_index; |
| 122 | if (a.directory_index != b.directory_index) return false; | 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 | return std.mem.eql(u8, a.basename, b_basename); | 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,11 +134,11 @@ pub fn deinit(cov: *Coverage, gpa: Allocator) void { |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | pub fn fileAt(cov: *Coverage, index: File.Index) *File { | 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 | pub fn stringAt(cov: *Coverage, index: String) [:0]const u8 { | 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 | pub const ResolveAddressesDwarfError = Dwarf.ScanError || Io.Cancelable; | 144 | pub const ResolveAddressesDwarfError = Dwarf.ScanError || Io.Cancelable; |
| ... | @@ -232,7 +232,7 @@ pub fn resolveAddressesDwarf( | ... | @@ -232,7 +232,7 @@ pub fn resolveAddressesDwarf( |
| 232 | .basename = addStringAssumeCapacity(cov, file_entry.path), | 232 | .basename = addStringAssumeCapacity(cov, file_entry.path), |
| 233 | }; | 233 | }; |
| 234 | out.* = .{ | 234 | out.* = .{ |
| 235 | .file = @enumFromInt(file_gop.index), | 235 | .file = @fromBackingInt(@intCast(file_gop.index)), |
| 236 | .line = entry.line, | 236 | .line = entry.line, |
| 237 | .column = entry.column, | 237 | .column = entry.column, |
| 238 | }; | 238 | }; |
| ... | @@ -240,7 +240,7 @@ pub fn resolveAddressesDwarf( | ... | @@ -240,7 +240,7 @@ pub fn resolveAddressesDwarf( |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | pub fn addStringAssumeCapacity(cov: *Coverage, s: []const u8) String { | 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 | cov.string_bytes.appendSliceAssumeCapacity(s); | 244 | cov.string_bytes.appendSliceAssumeCapacity(s); |
| 245 | cov.string_bytes.appendAssumeCapacity(0); | 245 | cov.string_bytes.appendAssumeCapacity(0); |
| 246 | return result; | 246 | return result; |
lib/std/debug/Dwarf.zig+1-1| ... | @@ -323,7 +323,7 @@ const Func = struct { | ... | @@ -323,7 +323,7 @@ const Func = struct { |
| 323 | }; | 323 | }; |
| 324 | 324 | ||
| 325 | pub fn section(di: Dwarf, dwarf_section: Section.Id) ?[]const u8 { | 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 | pub fn deinit(di: *Dwarf, gpa: Allocator) void { | 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,7 +459,7 @@ pub const Instruction = union(enum) { |
| 459 | .def_cfa_offset_sf => .{ .def_cfa_offset_sf = try reader.takeLeb128(i64) }, | 459 | .def_cfa_offset_sf => .{ .def_cfa_offset_sf = try reader.takeLeb128(i64) }, |
| 460 | .def_cfa_expression => .{ .def_cfa_expr = try reader.takeLeb128(usize) }, | 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 | 0x1C...0x3F => return error.UnimplementedUserOpcode, | 463 | 0x1C...0x3F => return error.UnimplementedUserOpcode, |
| 464 | else => return error.InvalidOpcode, | 464 | else => return error.InvalidOpcode, |
| 465 | }, | 465 | }, |
lib/std/debug/ElfFile.zig+1-1| ... | @@ -504,7 +504,7 @@ fn loadInner( | ... | @@ -504,7 +504,7 @@ fn loadInner( |
| 504 | @typeInfo(Section.Id).@"enum".field_values, | 504 | @typeInfo(Section.Id).@"enum".field_values, |
| 505 | ) |s_name, s_value| { | 505 | ) |s_name, s_value| { |
| 506 | if (std.mem.eql(u8, "." ++ s_name, name)) { | 506 | if (std.mem.eql(u8, "." ++ s_name, name)) { |
| 507 | break @enumFromInt(s_value); | 507 | break @fromBackingInt(@intCast(s_value)); |
| 508 | } | 508 | } |
| 509 | } else continue; | 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,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 | 519 | if (sections[@backingInt(Dwarf.Section.Id.debug_info)] == null or |
| 520 | sections[@intFromEnum(Dwarf.Section.Id.debug_abbrev)] == null or | 520 | sections[@backingInt(Dwarf.Section.Id.debug_abbrev)] == null or |
| 521 | sections[@intFromEnum(Dwarf.Section.Id.debug_str)] == null or | 521 | sections[@backingInt(Dwarf.Section.Id.debug_str)] == null or |
| 522 | sections[@intFromEnum(Dwarf.Section.Id.debug_line)] == null) | 522 | sections[@backingInt(Dwarf.Section.Id.debug_line)] == null) |
| 523 | { | 523 | { |
| 524 | return error.MissingDebugInfo; | 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,7 +935,7 @@ pub fn getStreamById(self: *Pdb, id: u32) ?*MsfStream { |
| 935 | } | 935 | } |
| 936 | 936 | ||
| 937 | pub fn getStream(self: *Pdb, stream: pdb.StreamType) ?*MsfStream { | 937 | pub fn getStream(self: *Pdb, stream: pdb.StreamType) ?*MsfStream { |
| 938 | const id = @intFromEnum(stream); | 938 | const id = @backingInt(stream); |
| 939 | return self.getStreamById(id); | 939 | return self.getStreamById(id); |
| 940 | } | 940 | } |
| 941 | 941 | ||
| ... | @@ -1078,7 +1078,7 @@ const MsfStream = struct { | ... | @@ -1078,7 +1078,7 @@ const MsfStream = struct { |
| 1078 | return error.ReadFailed; | 1078 | return error.ReadFailed; |
| 1079 | }; | 1079 | }; |
| 1080 | 1080 | ||
| 1081 | var remaining = @intFromEnum(limit); | 1081 | var remaining = @backingInt(limit); |
| 1082 | while (remaining != 0) { | 1082 | while (remaining != 0) { |
| 1083 | const stream_len: usize = @min(remaining, ms.block_size - offset); | 1083 | const stream_len: usize = @min(remaining, ms.block_size - offset); |
| 1084 | const n = try ms.file_reader.interface.stream(w, .limited(stream_len)); | 1084 | const n = try ms.file_reader.interface.stream(w, .limited(stream_len)); |
| ... | @@ -1098,7 +1098,7 @@ const MsfStream = struct { | ... | @@ -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 | ms.next_read_pos += total; | 1102 | ms.next_read_pos += total; |
| 1103 | return total; | 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,7 +530,7 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: elf.Versym, vername: []const u8, str |
| 530 | var def = def_arg; | 530 | var def = def_arg; |
| 531 | const vsym_index = vsym_arg.VERSION; | 531 | const vsym_index = vsym_arg.VERSION; |
| 532 | while (true) { | 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 | if (def.next == 0) return false; | 534 | if (def.next == 0) return false; |
| 535 | def = @ptrFromInt(@intFromPtr(def) + def.next); | 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,8 +268,8 @@ pub const Versym = packed struct(u16) { |
| 268 | VERSION: u15, | 268 | VERSION: u15, |
| 269 | HIDDEN: bool, | 269 | HIDDEN: bool, |
| 270 | 270 | ||
| 271 | pub const LOCAL: Versym = @bitCast(@intFromEnum(VER_NDX.LOCAL)); | 271 | pub const LOCAL: Versym = @bitCast(@backingInt(VER_NDX.LOCAL)); |
| 272 | pub const GLOBAL: Versym = @bitCast(@intFromEnum(VER_NDX.GLOBAL)); | 272 | pub const GLOBAL: Versym = @bitCast(@backingInt(VER_NDX.GLOBAL)); |
| 273 | }; | 273 | }; |
| 274 | 274 | ||
| 275 | pub const VER_NDX = enum(u16) { | 275 | pub const VER_NDX = enum(u16) { |
| ... | @@ -291,178 +291,178 @@ pub const VER_FLG_BASE = 1; | ... | @@ -291,178 +291,178 @@ pub const VER_FLG_BASE = 1; |
| 291 | pub const VER_FLG_WEAK = 2; | 291 | pub const VER_FLG_WEAK = 2; |
| 292 | 292 | ||
| 293 | /// Deprecated, use `@intFromEnum(std.elf.PT.NULL)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.LOAD)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.DYNAMIC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.INTERP)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.NOTE)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.SHLIB)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.PHDR)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.TLS)` | 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 | /// Deprecated, use `std.elf.PT.NUM`. | 309 | /// Deprecated, use `std.elf.PT.NUM`. |
| 310 | pub const PT_NUM = PT.NUM; | 310 | pub const PT_NUM = PT.NUM; |
| 311 | /// Deprecated, use `@intFromEnum(std.elf.PT.LOOS)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.GNU_EH_FRAME)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.GNU_STACK)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.GNU_RELRO)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.LOSUNW)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.SUNWBSS)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.SUNWSTACK)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.HISUNW)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.HIOS)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.LOPROC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.PT.HIPROC)` | 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 | pub const PN_XNUM = 0xffff; | 334 | pub const PN_XNUM = 0xffff; |
| 335 | 335 | ||
| 336 | /// Deprecated, use `@intFromEnum(std.elf.SHT.NULL)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.PROGBITS)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.SYMTAB)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.STRTAB)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.RELA)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.HASH)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.DYNAMIC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.NOTE)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.NOBITS)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.REL)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.SHLIB)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.DYNSYM)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.INIT_ARRAY)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.FINI_ARRAY)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.PREINIT_ARRAY)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.GROUP)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.SYMTAB_SHNDX)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.RELR)` | 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 | /// Deprecated, use `std.elf.SHT.NUM`. | 372 | /// Deprecated, use `std.elf.SHT.NUM`. |
| 373 | pub const SHT_NUM = SHT.NUM; | 373 | pub const SHT_NUM = SHT.NUM; |
| 374 | /// Deprecated, use `@intFromEnum(std.elf.SHT.LOOS)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.LLVM_ADDRSIG)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.GNU_HASH)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.GNU_VERDEF)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.GNU_VERNEED)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.GNU_VERSYM)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.HIOS)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.LOPROC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.X86_64_UNWIND)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.HIPROC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.LOUSER)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.SHT.HIUSER)` | 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 | // Note type for .note.gnu.build_id | 399 | // Note type for .note.gnu.build_id |
| 400 | pub const NT_GNU_BUILD_ID = 3; | 400 | pub const NT_GNU_BUILD_ID = 3; |
| 401 | 401 | ||
| 402 | /// Deprecated, use `@intFromEnum(std.elf.STB.LOCAL)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STB.GLOBAL)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STB.WEAK)` | 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 | /// Deprecated, use `std.elf.STB.NUM` | 408 | /// Deprecated, use `std.elf.STB.NUM` |
| 409 | pub const STB_NUM = STB.NUM; | 409 | pub const STB_NUM = STB.NUM; |
| 410 | /// Deprecated, use `@intFromEnum(std.elf.STB.LOOS)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STB.GNU_UNIQUE)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STB.HIOS)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STB.LOPROC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STB.HIPROC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STB.MIPS_SPLIT_COMMON)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.NOTYPE)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.OBJECT)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.FUNC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.SECTION)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.FILE)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.COMMON)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.TLS)` | 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 | /// Deprecated, use `std.elf.STT.NUM` | 438 | /// Deprecated, use `std.elf.STT.NUM` |
| 439 | pub const STT_NUM = STT.NUM; | 439 | pub const STT_NUM = STT.NUM; |
| 440 | /// Deprecated, use `@intFromEnum(std.elf.STT.LOOS)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.GNU_IFUNC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.HIOS)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.LOPROC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.HIPROC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.SPARC_REGISTER)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.PARISC_MILLICODE)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.HP_OPAQUE)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.HP_STUB)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.ARM_TFUNC)` | 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 | /// Deprecated, use `@intFromEnum(std.elf.STT.ARM_16BIT)` | 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 | pub const PT = enum(Word) { | 467 | pub const PT = enum(Word) { |
| 468 | /// Program header table entry unused | 468 | /// Program header table entry unused |
| ... | @@ -487,29 +487,29 @@ pub const PT = enum(Word) { | ... | @@ -487,29 +487,29 @@ pub const PT = enum(Word) { |
| 487 | pub const NUM = @typeInfo(PT).@"enum".field_names.len; | 487 | pub const NUM = @typeInfo(PT).@"enum".field_names.len; |
| 488 | 488 | ||
| 489 | /// Start of OS-specific | 489 | /// Start of OS-specific |
| 490 | pub const LOOS: PT = @enumFromInt(0x60000000); | 490 | pub const LOOS: PT = @fromBackingInt(@intCast(0x60000000)); |
| 491 | /// End of OS-specific | 491 | /// End of OS-specific |
| 492 | pub const HIOS: PT = @enumFromInt(0x6fffffff); | 492 | pub const HIOS: PT = @fromBackingInt(@intCast(0x6fffffff)); |
| 493 | 493 | ||
| 494 | /// GCC .eh_frame_hdr segment | 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 | /// Indicates stack executability | 496 | /// Indicates stack executability |
| 497 | pub const GNU_STACK: PT = @enumFromInt(0x6474e551); | 497 | pub const GNU_STACK: PT = @fromBackingInt(@intCast(0x6474e551)); |
| 498 | /// Read-only after relocation | 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); | 501 | pub const LOSUNW: PT = @fromBackingInt(@intCast(0x6ffffffa)); |
| 502 | pub const HISUNW: PT = @enumFromInt(0x6fffffff); | 502 | pub const HISUNW: PT = @fromBackingInt(@intCast(0x6fffffff)); |
| 503 | 503 | ||
| 504 | /// Sun specific segment | 504 | /// Sun specific segment |
| 505 | pub const SUNWBSS: PT = @enumFromInt(0x6ffffffa); | 505 | pub const SUNWBSS: PT = @fromBackingInt(@intCast(0x6ffffffa)); |
| 506 | /// Stack segment | 506 | /// Stack segment |
| 507 | pub const SUNWSTACK: PT = @enumFromInt(0x6ffffffb); | 507 | pub const SUNWSTACK: PT = @fromBackingInt(@intCast(0x6ffffffb)); |
| 508 | 508 | ||
| 509 | /// Start of processor-specific | 509 | /// Start of processor-specific |
| 510 | pub const LOPROC: PT = @enumFromInt(0x70000000); | 510 | pub const LOPROC: PT = @fromBackingInt(@intCast(0x70000000)); |
| 511 | /// End of processor-specific | 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 | pub const SHT = enum(Word) { | 515 | pub const SHT = enum(Word) { |
| ... | @@ -555,34 +555,34 @@ pub const SHT = enum(Word) { | ... | @@ -555,34 +555,34 @@ pub const SHT = enum(Word) { |
| 555 | pub const NUM = @typeInfo(SHT).@"enum".field_names.len; | 555 | pub const NUM = @typeInfo(SHT).@"enum".field_names.len; |
| 556 | 556 | ||
| 557 | /// Start of OS-specific | 557 | /// Start of OS-specific |
| 558 | pub const LOOS: SHT = @enumFromInt(0x60000000); | 558 | pub const LOOS: SHT = @fromBackingInt(@intCast(0x60000000)); |
| 559 | /// End of OS-specific | 559 | /// End of OS-specific |
| 560 | pub const HIOS: SHT = @enumFromInt(0x6fffffff); | 560 | pub const HIOS: SHT = @fromBackingInt(@intCast(0x6fffffff)); |
| 561 | 561 | ||
| 562 | /// LLVM address-significance table | 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 | /// GNU hash table | 565 | /// GNU hash table |
| 566 | pub const GNU_HASH: SHT = @enumFromInt(0x6ffffff6); | 566 | pub const GNU_HASH: SHT = @fromBackingInt(@intCast(0x6ffffff6)); |
| 567 | /// GNU version definition table | 567 | /// GNU version definition table |
| 568 | pub const GNU_VERDEF: SHT = @enumFromInt(0x6ffffffd); | 568 | pub const GNU_VERDEF: SHT = @fromBackingInt(@intCast(0x6ffffffd)); |
| 569 | /// GNU needed versions table | 569 | /// GNU needed versions table |
| 570 | pub const GNU_VERNEED: SHT = @enumFromInt(0x6ffffffe); | 570 | pub const GNU_VERNEED: SHT = @fromBackingInt(@intCast(0x6ffffffe)); |
| 571 | /// GNU symbol version table | 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 | /// Start of processor-specific | 574 | /// Start of processor-specific |
| 575 | pub const LOPROC: SHT = @enumFromInt(0x70000000); | 575 | pub const LOPROC: SHT = @fromBackingInt(@intCast(0x70000000)); |
| 576 | /// End of processor-specific | 576 | /// End of processor-specific |
| 577 | pub const HIPROC: SHT = @enumFromInt(0x7fffffff); | 577 | pub const HIPROC: SHT = @fromBackingInt(@intCast(0x7fffffff)); |
| 578 | 578 | ||
| 579 | /// Unwind information | 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 | /// Start of application-specific | 582 | /// Start of application-specific |
| 583 | pub const LOUSER: SHT = @enumFromInt(0x80000000); | 583 | pub const LOUSER: SHT = @fromBackingInt(@intCast(0x80000000)); |
| 584 | /// End of application-specific | 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 | pub const STB = enum(u4) { | 588 | pub const STB = enum(u4) { |
| ... | @@ -598,19 +598,19 @@ pub const STB = enum(u4) { | ... | @@ -598,19 +598,19 @@ pub const STB = enum(u4) { |
| 598 | pub const NUM = @typeInfo(STB).@"enum".field_names.len; | 598 | pub const NUM = @typeInfo(STB).@"enum".field_names.len; |
| 599 | 599 | ||
| 600 | /// Start of OS-specific | 600 | /// Start of OS-specific |
| 601 | pub const LOOS: STB = @enumFromInt(10); | 601 | pub const LOOS: STB = @fromBackingInt(@intCast(10)); |
| 602 | /// End of OS-specific | 602 | /// End of OS-specific |
| 603 | pub const HIOS: STB = @enumFromInt(12); | 603 | pub const HIOS: STB = @fromBackingInt(@intCast(12)); |
| 604 | 604 | ||
| 605 | /// Unique symbol | 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 | /// Start of processor-specific | 608 | /// Start of processor-specific |
| 609 | pub const LOPROC: STB = @enumFromInt(13); | 609 | pub const LOPROC: STB = @fromBackingInt(@intCast(13)); |
| 610 | /// End of processor-specific | 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 | pub const STT = enum(u4) { | 616 | pub const STT = enum(u4) { |
| ... | @@ -634,27 +634,27 @@ pub const STT = enum(u4) { | ... | @@ -634,27 +634,27 @@ pub const STT = enum(u4) { |
| 634 | pub const NUM = @typeInfo(STT).@"enum".field_names.len; | 634 | pub const NUM = @typeInfo(STT).@"enum".field_names.len; |
| 635 | 635 | ||
| 636 | /// Start of OS-specific | 636 | /// Start of OS-specific |
| 637 | pub const LOOS: STT = @enumFromInt(10); | 637 | pub const LOOS: STT = @fromBackingInt(@intCast(10)); |
| 638 | /// End of OS-specific | 638 | /// End of OS-specific |
| 639 | pub const HIOS: STT = @enumFromInt(12); | 639 | pub const HIOS: STT = @fromBackingInt(@intCast(12)); |
| 640 | 640 | ||
| 641 | /// Symbol is indirect code object | 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); | 644 | pub const HP_OPAQUE: STT = @fromBackingInt(@intCast(@backingInt(LOOS) + 1)); |
| 645 | pub const HP_STUB: STT = @enumFromInt(@intFromEnum(LOOS) + 2); | 645 | pub const HP_STUB: STT = @fromBackingInt(@intCast(@backingInt(LOOS) + 2)); |
| 646 | 646 | ||
| 647 | /// Start of processor-specific | 647 | /// Start of processor-specific |
| 648 | pub const LOPROC: STT = @enumFromInt(13); | 648 | pub const LOPROC: STT = @fromBackingInt(@intCast(13)); |
| 649 | /// End of processor-specific | 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); | 656 | pub const ARM_TFUNC: STT = @fromBackingInt(@intCast(@backingInt(LOPROC) + 0)); |
| 657 | pub const ARM_16BIT: STT = @enumFromInt(@intFromEnum(HIPROC) + 2); | 657 | pub const ARM_16BIT: STT = @fromBackingInt(@intCast(@backingInt(HIPROC) + 2)); |
| 658 | }; | 658 | }; |
| 659 | 659 | ||
| 660 | pub const STV = enum(u3) { | 660 | pub const STV = enum(u3) { |
| ... | @@ -823,7 +823,7 @@ pub const Header = struct { | ... | @@ -823,7 +823,7 @@ pub const Header = struct { |
| 823 | else => @compileError("bad type"), | 823 | else => @compileError("bad type"), |
| 824 | }, | 824 | }, |
| 825 | .endian = endian, | 825 | .endian = endian, |
| 826 | .os_abi = @enumFromInt(hdr.e_ident[EI.OSABI]), | 826 | .os_abi = @fromBackingInt(@intCast(hdr.e_ident[EI.OSABI])), |
| 827 | .abi_version = hdr.e_ident[EI.ABIVERSION], | 827 | .abi_version = hdr.e_ident[EI.ABIVERSION], |
| 828 | .type = hdr.e_type, | 828 | .type = hdr.e_type, |
| 829 | .machine = hdr.e_machine, | 829 | .machine = hdr.e_machine, |
| ... | @@ -1629,11 +1629,11 @@ pub const Ident = extern struct { | ... | @@ -1629,11 +1629,11 @@ pub const Ident = extern struct { |
| 1629 | }; | 1629 | }; |
| 1630 | 1630 | ||
| 1631 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.NONE)` | 1631 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.NONE)` |
| 1632 | pub const ELFCLASSNONE = @intFromEnum(CLASS.NONE); | 1632 | pub const ELFCLASSNONE = @backingInt(CLASS.NONE); |
| 1633 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.@"32")` | 1633 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.@"32")` |
| 1634 | pub const ELFCLASS32 = @intFromEnum(CLASS.@"32"); | 1634 | pub const ELFCLASS32 = @backingInt(CLASS.@"32"); |
| 1635 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.@"64")` | 1635 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.@"64")` |
| 1636 | pub const ELFCLASS64 = @intFromEnum(CLASS.@"64"); | 1636 | pub const ELFCLASS64 = @backingInt(CLASS.@"64"); |
| 1637 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.NUM)` | 1637 | /// Deprecated, use `@intFromEnum(std.elf.CLASS.NUM)` |
| 1638 | pub const ELFCLASSNUM = CLASS.NUM; | 1638 | pub const ELFCLASSNUM = CLASS.NUM; |
| 1639 | pub const CLASS = enum(u8) { | 1639 | pub const CLASS = enum(u8) { |
| ... | @@ -1662,11 +1662,11 @@ pub const CLASS = enum(u8) { | ... | @@ -1662,11 +1662,11 @@ pub const CLASS = enum(u8) { |
| 1662 | }; | 1662 | }; |
| 1663 | 1663 | ||
| 1664 | /// Deprecated, use `@intFromEnum(std.elf.DATA.NONE)` | 1664 | /// Deprecated, use `@intFromEnum(std.elf.DATA.NONE)` |
| 1665 | pub const ELFDATANONE = @intFromEnum(DATA.NONE); | 1665 | pub const ELFDATANONE = @backingInt(DATA.NONE); |
| 1666 | /// Deprecated, use `@intFromEnum(std.elf.DATA.@"2LSB")` | 1666 | /// Deprecated, use `@intFromEnum(std.elf.DATA.@"2LSB")` |
| 1667 | pub const ELFDATA2LSB = @intFromEnum(DATA.@"2LSB"); | 1667 | pub const ELFDATA2LSB = @backingInt(DATA.@"2LSB"); |
| 1668 | /// Deprecated, use `@intFromEnum(std.elf.DATA.@"2MSB")` | 1668 | /// Deprecated, use `@intFromEnum(std.elf.DATA.@"2MSB")` |
| 1669 | pub const ELFDATA2MSB = @intFromEnum(DATA.@"2MSB"); | 1669 | pub const ELFDATA2MSB = @backingInt(DATA.@"2MSB"); |
| 1670 | /// Deprecated, use `@intFromEnum(std.elf.DATA.NUM)` | 1670 | /// Deprecated, use `@intFromEnum(std.elf.DATA.NUM)` |
| 1671 | pub const ELFDATANUM = DATA.NUM; | 1671 | pub const ELFDATANUM = DATA.NUM; |
| 1672 | pub const DATA = enum(u8) { | 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,7 +11,7 @@ pub fn fromInt(comptime E: type, integer: anytype) ?E { |
| 11 | const enum_info = @typeInfo(E).@"enum"; | 11 | const enum_info = @typeInfo(E).@"enum"; |
| 12 | if (enum_info.mode == .nonexhaustive) { | 12 | if (enum_info.mode == .nonexhaustive) { |
| 13 | if (std.math.cast(enum_info.tag_type, integer)) |tag| { | 13 | if (std.math.cast(enum_info.tag_type, integer)) |tag| { |
| 14 | return @enumFromInt(tag); | 14 | return @fromBackingInt(@intCast(tag)); |
| 15 | } | 15 | } |
| 16 | return null; | 16 | return null; |
| 17 | } | 17 | } |
| ... | @@ -21,7 +21,7 @@ pub fn fromInt(comptime E: type, integer: anytype) ?E { | ... | @@ -21,7 +21,7 @@ pub fn fromInt(comptime E: type, integer: anytype) ?E { |
| 21 | // without requiring an inline loop. | 21 | // without requiring an inline loop. |
| 22 | // This generates better machine code. | 22 | // This generates better machine code. |
| 23 | for (values(E)) |value| { | 23 | for (values(E)) |value| { |
| 24 | if (@intFromEnum(value) == integer) return value; | 24 | if (@backingInt(value) == integer) return value; |
| 25 | } | 25 | } |
| 26 | return null; | 26 | return null; |
| 27 | } | 27 | } |
| ... | @@ -43,7 +43,7 @@ pub inline fn valuesFromFields(comptime E: type, comptime field_values: []const | ... | @@ -43,7 +43,7 @@ pub inline fn valuesFromFields(comptime E: type, comptime field_values: []const |
| 43 | @setEvalBranchQuota(@typeInfo(E).@"enum".field_names.len + eval_branch_quota_cushion); | 43 | @setEvalBranchQuota(@typeInfo(E).@"enum".field_names.len + eval_branch_quota_cushion); |
| 44 | var result: [field_values.len]E = undefined; | 44 | var result: [field_values.len]E = undefined; |
| 45 | for (&result, field_values) |*r, f_value| { | 45 | for (&result, field_values) |*r, f_value| { |
| 46 | r.* = @enumFromInt(f_value); | 46 | r.* = @fromBackingInt(@intCast(f_value)); |
| 47 | } | 47 | } |
| 48 | const final = result; | 48 | const final = result; |
| 49 | return &final; | 49 | return &final; |
| ... | @@ -64,7 +64,7 @@ pub fn tagName(comptime E: type, e: E) ?[:0]const u8 { | ... | @@ -64,7 +64,7 @@ pub fn tagName(comptime E: type, e: E) ?[:0]const u8 { |
| 64 | const field_values = @typeInfo(E).@"enum".field_values; | 64 | const field_values = @typeInfo(E).@"enum".field_values; |
| 65 | @setEvalBranchQuota(field_names.len); | 65 | @setEvalBranchQuota(field_names.len); |
| 66 | return inline for (field_names, field_values) |f_name, f_value| { | 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 | } else null; | 68 | } else null; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| ... | @@ -72,7 +72,7 @@ test tagName { | ... | @@ -72,7 +72,7 @@ test tagName { |
| 72 | const E = enum(u8) { a, b, _ }; | 72 | const E = enum(u8) { a, b, _ }; |
| 73 | try testing.expect(tagName(E, .a) != null); | 73 | try testing.expect(tagName(E, .a) != null); |
| 74 | try testing.expectEqualStrings("a", tagName(E, .a).?); | 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 | /// Determines the length of a direct-mapped enum array, indexed by | 78 | /// Determines the length of a direct-mapped enum array, indexed by |
| ... | @@ -168,7 +168,7 @@ pub fn directEnumArrayDefault( | ... | @@ -168,7 +168,7 @@ pub fn directEnumArrayDefault( |
| 168 | var result: [len]Data = @splat(default orelse undefined); | 168 | var result: [len]Data = @splat(default orelse undefined); |
| 169 | inline for (@typeInfo(@TypeOf(init_values)).@"struct".field_names) |f_name| { | 169 | inline for (@typeInfo(@TypeOf(init_values)).@"struct".field_names) |f_name| { |
| 170 | const enum_value = @field(E, f_name); | 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 | result[index] = @field(init_values, f_name); | 172 | result[index] = @field(init_values, f_name); |
| 173 | } | 173 | } |
| 174 | return result; | 174 | return result; |
| ... | @@ -222,8 +222,8 @@ test fromInt { | ... | @@ -222,8 +222,8 @@ test fromInt { |
| 222 | try testing.expect(fromInt(E1, zero).? == E1.A); | 222 | try testing.expect(fromInt(E1, zero).? == E1.A); |
| 223 | try testing.expect(fromInt(E2, one).? == E2.B); | 223 | try testing.expect(fromInt(E2, one).? == E2.B); |
| 224 | try testing.expect(fromInt(E3, zero).? == E3.A); | 224 | try testing.expect(fromInt(E3, zero).? == E3.A); |
| 225 | try testing.expect(fromInt(E3, 127).? == @as(E3, @enumFromInt(127))); | 225 | try testing.expect(fromInt(E3, 127).? == @as(E3, @fromBackingInt(@intCast(127)))); |
| 226 | try testing.expect(fromInt(E3, -128).? == @as(E3, @enumFromInt(-128))); | 226 | try testing.expect(fromInt(E3, -128).? == @as(E3, @fromBackingInt(@intCast(-128)))); |
| 227 | try testing.expectEqual(null, fromInt(E1, one)); | 227 | try testing.expectEqual(null, fromInt(E1, one)); |
| 228 | try testing.expectEqual(null, fromInt(E3, 128)); | 228 | try testing.expectEqual(null, fromInt(E3, 128)); |
| 229 | try testing.expectEqual(null, fromInt(E3, -129)); | 229 | try testing.expectEqual(null, fromInt(E3, -129)); |
| ... | @@ -677,7 +677,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { | ... | @@ -677,7 +677,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 677 | const info = @typeInfo(E).@"enum"; | 677 | const info = @typeInfo(E).@"enum"; |
| 678 | inline for (info.field_names, info.field_values) |field_name, field_value| { | 678 | inline for (info.field_names, info.field_values) |field_name, field_value| { |
| 679 | const c = @field(init_counts, field_name); | 679 | const c = @field(init_counts, field_name); |
| 680 | const key: E = @enumFromInt(field_value); | 680 | const key: E = @fromBackingInt(@intCast(field_value)); |
| 681 | self.counts.set(key, c); | 681 | self.counts.set(key, c); |
| 682 | } | 682 | } |
| 683 | return self; | 683 | return self; |
| ... | @@ -746,7 +746,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { | ... | @@ -746,7 +746,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 746 | /// asserts operation will not overflow any key. | 746 | /// asserts operation will not overflow any key. |
| 747 | pub fn addSetAssertSafe(self: *Self, other: Self) void { | 747 | pub fn addSetAssertSafe(self: *Self, other: Self) void { |
| 748 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { | 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 | self.addAssertSafe(key, other.getCount(key)); | 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,7 +754,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 754 | /// Increases the all key counts by given multiset. | 754 | /// Increases the all key counts by given multiset. |
| 755 | pub fn addSet(self: *Self, other: Self) error{Overflow}!void { | 755 | pub fn addSet(self: *Self, other: Self) error{Overflow}!void { |
| 756 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { | 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 | try self.add(key, other.getCount(key)); | 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,7 +764,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 764 | /// then that key will have a key count of zero. | 764 | /// then that key will have a key count of zero. |
| 765 | pub fn removeSet(self: *Self, other: Self) void { | 765 | pub fn removeSet(self: *Self, other: Self) void { |
| 766 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { | 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 | self.remove(key, other.getCount(key)); | 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,7 +773,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 773 | /// given multiset. | 773 | /// given multiset. |
| 774 | pub fn eql(self: Self, other: Self) bool { | 774 | pub fn eql(self: Self, other: Self) bool { |
| 775 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { | 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 | if (self.getCount(key) != other.getCount(key)) { | 777 | if (self.getCount(key) != other.getCount(key)) { |
| 778 | return false; | 778 | return false; |
| 779 | } | 779 | } |
| ... | @@ -785,7 +785,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { | ... | @@ -785,7 +785,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 785 | /// equal to the given multiset. | 785 | /// equal to the given multiset. |
| 786 | pub fn subsetOf(self: Self, other: Self) bool { | 786 | pub fn subsetOf(self: Self, other: Self) bool { |
| 787 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { | 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 | if (self.getCount(key) > other.getCount(key)) { | 789 | if (self.getCount(key) > other.getCount(key)) { |
| 790 | return false; | 790 | return false; |
| 791 | } | 791 | } |
| ... | @@ -797,7 +797,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { | ... | @@ -797,7 +797,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 797 | /// equal to the given multiset. | 797 | /// equal to the given multiset. |
| 798 | pub fn supersetOf(self: Self, other: Self) bool { | 798 | pub fn supersetOf(self: Self, other: Self) bool { |
| 799 | inline for (@typeInfo(E).@"enum".field_values) |field_value| { | 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 | if (self.getCount(key) < other.getCount(key)) { | 801 | if (self.getCount(key) < other.getCount(key)) { |
| 802 | return false; | 802 | return false; |
| 803 | } | 803 | } |
| ... | @@ -1284,18 +1284,18 @@ pub fn EnumIndexer(comptime E: type) type { | ... | @@ -1284,18 +1284,18 @@ pub fn EnumIndexer(comptime E: type) type { |
| 1284 | 1284 | ||
| 1285 | pub fn indexOf(e: E) usize { | 1285 | pub fn indexOf(e: E) usize { |
| 1286 | if (backing_int_sign == .unsigned) | 1286 | if (backing_int_sign == .unsigned) |
| 1287 | return @intFromEnum(e); | 1287 | return @backingInt(e); |
| 1288 | 1288 | ||
| 1289 | return if (@intFromEnum(e) < 0) | 1289 | return if (@backingInt(e) < 0) |
| 1290 | @intCast(@intFromEnum(e) - min_value) | 1290 | @intCast(@backingInt(e) - min_value) |
| 1291 | else | 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 | pub fn keyForIndex(i: usize) E { | 1294 | pub fn keyForIndex(i: usize) E { |
| 1295 | if (backing_int_sign == .unsigned) | 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,14 +1330,14 @@ pub fn EnumIndexer(comptime E: type) type { |
| 1330 | pub const Key = E; | 1330 | pub const Key = E; |
| 1331 | pub const count: comptime_int = fields_len; | 1331 | pub const count: comptime_int = fields_len; |
| 1332 | pub fn indexOf(e: E) usize { | 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 | pub fn keyForIndex(i: usize) E { | 1335 | pub fn keyForIndex(i: usize) E { |
| 1336 | // TODO fix addition semantics. This calculation | 1336 | // TODO fix addition semantics. This calculation |
| 1337 | // gives up some safety to avoid artificially limiting | 1337 | // gives up some safety to avoid artificially limiting |
| 1338 | // the range of signed enum values to max_isize. | 1338 | // the range of signed enum values to max_isize. |
| 1339 | const enum_value = if (min < 0) @as(isize, @bitCast(i)) +% min else i + min; | 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,8 +1384,8 @@ test "EnumIndexer non-exhaustive" { |
| 1384 | }; | 1384 | }; |
| 1385 | const Indexer = EnumIndexer(E); | 1385 | const Indexer = EnumIndexer(E); |
| 1386 | 1386 | ||
| 1387 | const min_tag: E = @enumFromInt(std.math.minInt(BackingInt)); | 1387 | const min_tag: E = @fromBackingInt(@intCast(std.math.minInt(BackingInt))); |
| 1388 | const max_tag: E = @enumFromInt(std.math.maxInt(BackingInt)); | 1388 | const max_tag: E = @fromBackingInt(@intCast(std.math.maxInt(BackingInt))); |
| 1389 | 1389 | ||
| 1390 | const RangedType = @Int(.unsigned, @bitSizeOf(BackingInt)); | 1390 | const RangedType = @Int(.unsigned, @bitSizeOf(BackingInt)); |
| 1391 | const max_index: comptime_int = std.math.maxInt(RangedType); | 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,15 +947,15 @@ test "non-exhaustive enum" { |
| 947 | }; | 947 | }; |
| 948 | try expectFmt("enum: .One\n", "enum: {}\n", .{Enum.One}); | 948 | try expectFmt("enum: .One\n", "enum: {}\n", .{Enum.One}); |
| 949 | try expectFmt("enum: .Two\n", "enum: {}\n", .{Enum.Two}); | 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 | try expectFmt("enum: f\n", "enum: {x}\n", .{Enum.One}); | 951 | try expectFmt("enum: f\n", "enum: {x}\n", .{Enum.One}); |
| 952 | try expectFmt("enum: beef\n", "enum: {x}\n", .{Enum.Two}); | 952 | try expectFmt("enum: beef\n", "enum: {x}\n", .{Enum.Two}); |
| 953 | try expectFmt("enum: BEEF\n", "enum: {X}\n", .{Enum.Two}); | 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 | try expectFmt("enum: 15\n", "enum: {d}\n", .{Enum.One}); | 956 | try expectFmt("enum: 15\n", "enum: {d}\n", .{Enum.One}); |
| 957 | try expectFmt("enum: 48879\n", "enum: {d}\n", .{Enum.Two}); | 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 | test "float.scientific" { | 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,7 +106,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { |
| 106 | }, | 106 | }, |
| 107 | 107 | ||
| 108 | .bool => hash(hasher, @intFromBool(key), strat), | 108 | .bool => hash(hasher, @intFromBool(key), strat), |
| 109 | .@"enum" => hash(hasher, @intFromEnum(key), strat), | 109 | .@"enum" => hash(hasher, @backingInt(key), strat), |
| 110 | .error_set => hash(hasher, @intFromError(key), strat), | 110 | .error_set => hash(hasher, @intFromError(key), strat), |
| 111 | .@"anyframe", .@"fn" => hash(hasher, @intFromPtr(key), strat), | 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,7 +78,7 @@ pub fn defaultQueryPageSize() usize { |
| 78 | if (size > 0) return size; | 78 | if (size > 0) return size; |
| 79 | size = size: switch (builtin.os.tag) { | 79 | size = size: switch (builtin.os.tag) { |
| 80 | .linux => if (builtin.link_libc) | 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 | else | 82 | else |
| 83 | std.os.linux.getauxval(std.elf.AT_PAGESZ), | 83 | std.os.linux.getauxval(std.elf.AT_PAGESZ), |
| 84 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { | 84 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => { |
| ... | @@ -109,7 +109,7 @@ pub fn defaultQueryPageSize() usize { | ... | @@ -109,7 +109,7 @@ pub fn defaultQueryPageSize() usize { |
| 109 | } | 109 | } |
| 110 | }, | 110 | }, |
| 111 | else => if (builtin.link_libc) | 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 | else if (builtin.os.tag == .freestanding or builtin.os.tag == .other) | 113 | else if (builtin.os.tag == .freestanding or builtin.os.tag == .other) |
| 114 | @compileError("unsupported target: freestanding/other") | 114 | @compileError("unsupported target: freestanding/other") |
| 115 | else | 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,7 +765,7 @@ fn fuzzMultiThreaded(fuzz_init: FuzzContext.Init, smith: *std.testing.Smith) any |
| 765 | .@"1", | 765 | .@"1", |
| 766 | .fromByteUnits(2 * std.heap.page_size_max), | 766 | .fromByteUnits(2 * std.heap.page_size_max), |
| 767 | ), | 767 | ), |
| 768 | @enumFromInt(alloc_index), | 768 | @fromBackingInt(@intCast(alloc_index)), |
| 769 | }) catch unreachable; | 769 | }) catch unreachable; |
| 770 | }, | 770 | }, |
| 771 | .resize => group.concurrent(io, FuzzContext.doOneResize, .{ &ctx, nextLen(smith) }) catch unreachable, | 771 | .resize => group.concurrent(io, FuzzContext.doOneResize, .{ &ctx, nextLen(smith) }) catch unreachable, |
| ... | @@ -877,7 +877,7 @@ const FuzzContext = struct { | ... | @@ -877,7 +877,7 @@ const FuzzContext = struct { |
| 877 | for (ctx.allocs[0..n_allocs]) |allocation| { | 877 | for (ctx.allocs[0..n_allocs]) |allocation| { |
| 878 | const len: usize = switch (allocation.common.len) { | 878 | const len: usize = switch (allocation.common.len) { |
| 879 | .free => continue, | 879 | .free => continue, |
| 880 | _ => |len| @intFromEnum(len), | 880 | _ => |len| @backingInt(len), |
| 881 | }; | 881 | }; |
| 882 | const control = allocation.control_ptr[0..len]; | 882 | const control = allocation.control_ptr[0..len]; |
| 883 | const sample = allocation.sample_ptr[0..len]; | 883 | const sample = allocation.sample_ptr[0..len]; |
| ... | @@ -887,7 +887,7 @@ const FuzzContext = struct { | ... | @@ -887,7 +887,7 @@ const FuzzContext = struct { |
| 887 | 887 | ||
| 888 | fn doOneAlloc(ctx: *FuzzContext, len: usize, alignment: Alignment, index: Alloc.Index) void { | 888 | fn doOneAlloc(ctx: *FuzzContext, len: usize, alignment: Alignment, index: Alloc.Index) void { |
| 889 | @disableInstrumentation(); | 889 | @disableInstrumentation(); |
| 890 | assert(ctx.allocs[@intFromEnum(index)].common.len == .free); | 890 | assert(ctx.allocs[@backingInt(index)].common.len == .free); |
| 891 | 891 | ||
| 892 | const control_ptr = ctx.control_allocator.rawAlloc(len, alignment, @returnAddress()) orelse | 892 | const control_ptr = ctx.control_allocator.rawAlloc(len, alignment, @returnAddress()) orelse |
| 893 | return; | 893 | return; |
| ... | @@ -896,11 +896,11 @@ const FuzzContext = struct { | ... | @@ -896,11 +896,11 @@ const FuzzContext = struct { |
| 896 | return; | 896 | return; |
| 897 | }; | 897 | }; |
| 898 | 898 | ||
| 899 | ctx.allocs[@intFromEnum(index)] = .{ | 899 | ctx.allocs[@backingInt(index)] = .{ |
| 900 | .control_ptr = control_ptr, | 900 | .control_ptr = control_ptr, |
| 901 | .sample_ptr = sample_ptr, | 901 | .sample_ptr = sample_ptr, |
| 902 | .common = .{ | 902 | .common = .{ |
| 903 | .len = @enumFromInt(len), | 903 | .len = @fromBackingInt(@intCast(len)), |
| 904 | .alignment = alignment, | 904 | .alignment = alignment, |
| 905 | }, | 905 | }, |
| 906 | }; | 906 | }; |
| ... | @@ -918,9 +918,9 @@ const FuzzContext = struct { | ... | @@ -918,9 +918,9 @@ const FuzzContext = struct { |
| 918 | const index = @atomicRmw(Alloc.Index, &ctx.last_alloc_index, .Xchg, .none, .acquire); | 918 | const index = @atomicRmw(Alloc.Index, &ctx.last_alloc_index, .Xchg, .none, .acquire); |
| 919 | if (index == .none) return; | 919 | if (index == .none) return; |
| 920 | 920 | ||
| 921 | const allocation = &ctx.allocs[@intFromEnum(index)]; | 921 | const allocation = &ctx.allocs[@backingInt(index)]; |
| 922 | assert(allocation.common.len != .free); | 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 | const alignment = allocation.common.alignment; | 924 | const alignment = allocation.common.alignment; |
| 925 | 925 | ||
| 926 | assert(alignment.check(@intFromPtr(allocation.control_ptr))); | 926 | assert(alignment.check(@intFromPtr(allocation.control_ptr))); |
| ... | @@ -940,11 +940,11 @@ const FuzzContext = struct { | ... | @@ -940,11 +940,11 @@ const FuzzContext = struct { |
| 940 | return; | 940 | return; |
| 941 | } | 941 | } |
| 942 | 942 | ||
| 943 | ctx.allocs[@intFromEnum(index)] = .{ | 943 | ctx.allocs[@backingInt(index)] = .{ |
| 944 | .control_ptr = new_control_ptr, | 944 | .control_ptr = new_control_ptr, |
| 945 | .sample_ptr = memory.ptr, | 945 | .sample_ptr = memory.ptr, |
| 946 | .common = .{ | 946 | .common = .{ |
| 947 | .len = @enumFromInt(new_len), | 947 | .len = @fromBackingInt(@intCast(new_len)), |
| 948 | .alignment = alignment, | 948 | .alignment = alignment, |
| 949 | }, | 949 | }, |
| 950 | }; | 950 | }; |
| ... | @@ -972,9 +972,9 @@ const FuzzContext = struct { | ... | @@ -972,9 +972,9 @@ const FuzzContext = struct { |
| 972 | const index = @atomicRmw(Alloc.Index, &ctx.last_alloc_index, .Xchg, .none, .acquire); | 972 | const index = @atomicRmw(Alloc.Index, &ctx.last_alloc_index, .Xchg, .none, .acquire); |
| 973 | if (index == .none) return; | 973 | if (index == .none) return; |
| 974 | 974 | ||
| 975 | const allocation = &ctx.allocs[@intFromEnum(index)]; | 975 | const allocation = &ctx.allocs[@backingInt(index)]; |
| 976 | assert(allocation.common.len != .free); | 976 | assert(allocation.common.len != .free); |
| 977 | const len: usize = @intFromEnum(allocation.common.len); | 977 | const len: usize = @backingInt(allocation.common.len); |
| 978 | const alignment = allocation.common.alignment; | 978 | const alignment = allocation.common.alignment; |
| 979 | 979 | ||
| 980 | assert(alignment.check(@intFromPtr(allocation.control_ptr))); | 980 | assert(alignment.check(@intFromPtr(allocation.control_ptr))); |
| ... | @@ -983,7 +983,7 @@ const FuzzContext = struct { | ... | @@ -983,7 +983,7 @@ const FuzzContext = struct { |
| 983 | ctx.control_allocator.rawFree(allocation.control_ptr[0..len], alignment, @returnAddress()); | 983 | ctx.control_allocator.rawFree(allocation.control_ptr[0..len], alignment, @returnAddress()); |
| 984 | ctx.sample_allocator.rawFree(allocation.sample_ptr[0..len], alignment, @returnAddress()); | 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 | .control_ptr = undefined, | 987 | .control_ptr = undefined, |
| 988 | .sample_ptr = undefined, | 988 | .sample_ptr = undefined, |
| 989 | .common = .{ | 989 | .common = .{ |
lib/std/heap/SafeAllocator.zig+18-18| ... | @@ -359,12 +359,12 @@ const AllocFooter = struct { | ... | @@ -359,12 +359,12 @@ const AllocFooter = struct { |
| 359 | 359 | ||
| 360 | fn storedXor(m: Modify, ptr: *Modify) Modify { | 360 | fn storedXor(m: Modify, ptr: *Modify) Modify { |
| 361 | const addr_hash: u16 = @truncate(std.hash.int(@intFromPtr(ptr))); | 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 | fn isExtended(f: *AllocFooter) bool { | 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 | fn extended(f: *AllocFooter) *Extended { | 370 | fn extended(f: *AllocFooter) *Extended { |
| ... | @@ -380,13 +380,13 @@ const AllocFooter = struct { | ... | @@ -380,13 +380,13 @@ const AllocFooter = struct { |
| 380 | } | 380 | } |
| 381 | 381 | ||
| 382 | fn userLen(f: *AllocFooter) usize { | 382 | fn userLen(f: *AllocFooter) usize { |
| 383 | const len_int = @intFromEnum(f.data.len); | 383 | const len_int = @backingInt(f.data.len); |
| 384 | return if (len_int < Data.Len.extended_start) len_int else f.extended().len; | 384 | return if (len_int < Data.Len.extended_start) len_int else f.extended().len; |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | fn userAlign(f: *AllocFooter) Alignment { | 387 | fn userAlign(f: *AllocFooter) Alignment { |
| 388 | const high = (@intFromEnum(f.data.len) -| Data.Len.extended_start) << 2; | 388 | const high = (@backingInt(f.data.len) -| Data.Len.extended_start) << 2; |
| 389 | return @enumFromInt(high | f.data.alignment); | 389 | return @fromBackingInt(@intCast(high | f.data.alignment)); |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | fn bucketPrev(f: *AllocFooter, b: *Bucket, s: *SafeAllocator) ?*AllocFooter { | 392 | fn bucketPrev(f: *AllocFooter, b: *Bucket, s: *SafeAllocator) ?*AllocFooter { |
| ... | @@ -439,7 +439,7 @@ const AllocFooter = struct { | ... | @@ -439,7 +439,7 @@ const AllocFooter = struct { |
| 439 | /// Assumes the footer is in a bucket allocation; all | 439 | /// Assumes the footer is in a bucket allocation; all |
| 440 | /// large allocations require an extended header. | 440 | /// large allocations require an extended header. |
| 441 | fn requiresExtended(len: usize, alignment: Alignment) bool { | 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 | fn lenBucket(s: *SafeAllocator, is_extended: bool) usize { | 445 | fn lenBucket(s: *SafeAllocator, is_extended: bool) usize { |
| ... | @@ -592,15 +592,15 @@ const AllocFooter = struct { | ... | @@ -592,15 +592,15 @@ const AllocFooter = struct { |
| 592 | 592 | ||
| 593 | if (!is_extended) { | 593 | if (!is_extended) { |
| 594 | footer.data = .{ | 594 | footer.data = .{ |
| 595 | .len = @enumFromInt(len), | 595 | .len = @fromBackingInt(@intCast(len)), |
| 596 | .alignment = @intCast(@intFromEnum(alignment)), | 596 | .alignment = @intCast(@backingInt(alignment)), |
| 597 | .prev_extended = prev_extended, | 597 | .prev_extended = prev_extended, |
| 598 | }; | 598 | }; |
| 599 | assert(!footer.isExtended()); | 599 | assert(!footer.isExtended()); |
| 600 | } else { | 600 | } else { |
| 601 | footer.data = .{ | 601 | footer.data = .{ |
| 602 | .len = @enumFromInt(Data.Len.extended_start + (@intFromEnum(alignment) >> 2)), | 602 | .len = @fromBackingInt(@intCast(Data.Len.extended_start + (@backingInt(alignment) >> 2))), |
| 603 | .alignment = @truncate(@intFromEnum(alignment)), | 603 | .alignment = @truncate(@backingInt(alignment)), |
| 604 | .prev_extended = prev_extended, | 604 | .prev_extended = prev_extended, |
| 605 | }; | 605 | }; |
| 606 | assert(footer.isExtended()); | 606 | assert(footer.isExtended()); |
| ... | @@ -720,7 +720,7 @@ fn deinitLeakedBucket(s: *SafeAllocator, b: *Bucket, log: bool) usize { | ... | @@ -720,7 +720,7 @@ fn deinitLeakedBucket(s: *SafeAllocator, b: *Bucket, log: bool) usize { |
| 720 | 720 | ||
| 721 | footer = footer.bucketPrev(b, s) orelse break; | 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 | assert(leaks == expected.n); | 725 | assert(leaks == expected.n); |
| 726 | return leaks; | 726 | return leaks; |
| ... | @@ -875,7 +875,7 @@ fn captureStackTrace(trace_buf: []usize, ra: usize) void { | ... | @@ -875,7 +875,7 @@ fn captureStackTrace(trace_buf: []usize, ra: usize) void { |
| 875 | } | 875 | } |
| 876 | 876 | ||
| 877 | const t = std.debug.captureCurrentStackTrace(.{ .first_address = ra }, trace_buf[1..]); | 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 | @intFromBool(t.return_addresses.len == trace_buf[1..].len); | 879 | @intFromBool(t.return_addresses.len == trace_buf[1..].len); |
| 880 | trace_buf[0] = t.return_addresses.len +| skipped; | 880 | trace_buf[0] = t.return_addresses.len +| skipped; |
| 881 | } | 881 | } |
| ... | @@ -888,7 +888,7 @@ fn formatStackTrace(trace_buf: []usize) std.debug.FormatStackTrace { | ... | @@ -888,7 +888,7 @@ fn formatStackTrace(trace_buf: []usize) std.debug.FormatStackTrace { |
| 888 | break :trace .{ | 888 | break :trace .{ |
| 889 | .return_addresses = addrs[0..@min(frames, addrs.len)], | 889 | .return_addresses = addrs[0..@min(frames, addrs.len)], |
| 890 | .skipped = switch (frames) { | 890 | .skipped = switch (frames) { |
| 891 | else => @enumFromInt(frames -| addrs.len), | 891 | else => @fromBackingInt(@intCast(frames -| addrs.len)), |
| 892 | 0, math.maxInt(usize) => .unknown, | 892 | 0, math.maxInt(usize) => .unknown, |
| 893 | }, | 893 | }, |
| 894 | }; | 894 | }; |
| ... | @@ -937,7 +937,7 @@ fn allocBucket( | ... | @@ -937,7 +937,7 @@ fn allocBucket( |
| 937 | @branchHint(.unlikely); | 937 | @branchHint(.unlikely); |
| 938 | freeAllocEntry(t, b.entry); | 938 | freeAllocEntry(t, b.entry); |
| 939 | b.check(s); | 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 | return null; | 943 | return null; |
| ... | @@ -1096,7 +1096,7 @@ fn alloc(ctx: *anyopaque, len: usize, alignment: Alignment, ra: usize) ?[*]u8 { | ... | @@ -1096,7 +1096,7 @@ fn alloc(ctx: *anyopaque, len: usize, alignment: Alignment, ra: usize) ?[*]u8 { |
| 1096 | const entry = s.newAllocEntry(t, ra) catch return null; | 1096 | const entry = s.newAllocEntry(t, ra) catch return null; |
| 1097 | const bucket: *Bucket = @ptrCast(@alignCast(s.backing.rawAlloc( | 1097 | const bucket: *Bucket = @ptrCast(@alignCast(s.backing.rawAlloc( |
| 1098 | s.bucketSize(), | 1098 | s.bucketSize(), |
| 1099 | @enumFromInt(s.bucket_size_log2), | 1099 | @fromBackingInt(@intCast(s.bucket_size_log2)), |
| 1100 | ra, | 1100 | ra, |
| 1101 | ) orelse { | 1101 | ) orelse { |
| 1102 | freeAllocEntry(t, entry); | 1102 | freeAllocEntry(t, entry); |
| ... | @@ -1171,7 +1171,7 @@ fn free(ctx: *anyopaque, memory: []u8, alignment: Alignment, ra: usize) void { | ... | @@ -1171,7 +1171,7 @@ fn free(ctx: *anyopaque, memory: []u8, alignment: Alignment, ra: usize) void { |
| 1171 | freeAllocEntry(t, b.entry); | 1171 | freeAllocEntry(t, b.entry); |
| 1172 | t.mutex.unlock(); | 1172 | t.mutex.unlock(); |
| 1173 | b.check(s); | 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,8 +1346,8 @@ const Smith = std.testing.Smith; |
| 1346 | const fuzz_probs = struct { | 1346 | const fuzz_probs = struct { |
| 1347 | const alignment: []const Smith.Weight = &.{ | 1347 | const alignment: []const Smith.Weight = &.{ |
| 1348 | .rangeAtMost(Alignment, .@"1", .@"16", 32), // ~75% | 1348 | .rangeAtMost(Alignment, .@"1", .@"16", 32), // ~75% |
| 1349 | .rangeAtMost(Alignment, .@"16", @enumFromInt(@bitSizeOf(usize) - 1), 1), | 1349 | .rangeAtMost(Alignment, .@"16", @fromBackingInt(@intCast(@bitSizeOf(usize) - 1)), 1), |
| 1350 | .value(Alignment, @enumFromInt(@bitSizeOf(usize) - 1), 32), // More likely overflow cases | 1350 | .value(Alignment, @fromBackingInt(@intCast(@bitSizeOf(usize) - 1)), 32), // More likely overflow cases |
| 1351 | }; | 1351 | }; |
| 1352 | 1352 | ||
| 1353 | const eos: []const Smith.Weight = &.{ | 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,7 +216,7 @@ fn free(context: *anyopaque, memory: []u8, alignment: Alignment, ra: usize) void |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | fn sizeClassIndex(len: usize, alignment: Alignment) usize { | 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 | fn slotSize(class: usize) usize { | 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,8 +230,8 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | fn getStackTrace(self: *LargeAlloc, trace_kind: TraceKind) std.debug.StackTrace { | 232 | fn getStackTrace(self: *LargeAlloc, trace_kind: TraceKind) std.debug.StackTrace { |
| 233 | assert(@intFromEnum(trace_kind) < trace_n); | 233 | assert(@backingInt(trace_kind) < trace_n); |
| 234 | const stack_addresses = &self.stack_addresses[@intFromEnum(trace_kind)]; | 234 | const stack_addresses = &self.stack_addresses[@backingInt(trace_kind)]; |
| 235 | var len: usize = 0; | 235 | var len: usize = 0; |
| 236 | while (len < stack_n and stack_addresses[len] != 0) { | 236 | while (len < stack_n and stack_addresses[len] != 0) { |
| 237 | len += 1; | 237 | len += 1; |
| ... | @@ -243,8 +243,8 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -243,8 +243,8 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | fn captureStackTrace(self: *LargeAlloc, ret_addr: usize, trace_kind: TraceKind) void { | 245 | fn captureStackTrace(self: *LargeAlloc, ret_addr: usize, trace_kind: TraceKind) void { |
| 246 | assert(@intFromEnum(trace_kind) < trace_n); | 246 | assert(@backingInt(trace_kind) < trace_n); |
| 247 | const stack_addresses = &self.stack_addresses[@intFromEnum(trace_kind)]; | 247 | const stack_addresses = &self.stack_addresses[@backingInt(trace_kind)]; |
| 248 | collectStackTrace(ret_addr, stack_addresses); | 248 | collectStackTrace(ret_addr, stack_addresses); |
| 249 | } | 249 | } |
| 250 | }; | 250 | }; |
| ... | @@ -297,7 +297,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -297,7 +297,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 297 | ) *[stack_n]usize { | 297 | ) *[stack_n]usize { |
| 298 | const start_ptr = @as([*]u8, @ptrCast(bucket)) + bucketStackFramesStart(slot_count); | 298 | const start_ptr = @as([*]u8, @ptrCast(bucket)) + bucketStackFramesStart(slot_count); |
| 299 | const addr = start_ptr + one_trace_size * traces_per_slot * slot_index + | 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 | return @ptrCast(@alignCast(addr)); | 301 | return @ptrCast(@alignCast(addr)); |
| 302 | } | 302 | } |
| 303 | 303 | ||
| ... | @@ -586,7 +586,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -586,7 +586,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 586 | // If this would move the allocation into a small size class, | 586 | // If this would move the allocation into a small size class, |
| 587 | // refuse the request, because it would require creating small | 587 | // refuse the request, because it would require creating small |
| 588 | // allocation metadata. | 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 | if (new_size_class_index < self.buckets.len) return null; | 590 | if (new_size_class_index < self.buckets.len) return null; |
| 591 | 591 | ||
| 592 | // Do memory limit accounting with requested sizes rather than what | 592 | // Do memory limit accounting with requested sizes rather than what |
| ... | @@ -727,7 +727,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -727,7 +727,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 727 | self.total_requested_bytes = new_req_bytes; | 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 | if (size_class_index >= self.buckets.len) { | 731 | if (size_class_index >= self.buckets.len) { |
| 732 | @branchHint(.unlikely); | 732 | @branchHint(.unlikely); |
| 733 | self.large_allocations.ensureUnusedCapacity(self.backing_allocator, 1) catch return null; | 733 | self.large_allocations.ensureUnusedCapacity(self.backing_allocator, 1) catch return null; |
| ... | @@ -834,7 +834,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -834,7 +834,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 834 | if (have_mutex) std.Io.Threaded.mutexLock(&self.mutex); | 834 | if (have_mutex) std.Io.Threaded.mutexLock(&self.mutex); |
| 835 | defer if (have_mutex) std.Io.Threaded.mutexUnlock(&self.mutex); | 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 | if (size_class_index >= self.buckets.len) { | 838 | if (size_class_index >= self.buckets.len) { |
| 839 | return self.resizeLarge(memory, alignment, new_len, return_address, false) != null; | 839 | return self.resizeLarge(memory, alignment, new_len, return_address, false) != null; |
| 840 | } else { | 840 | } else { |
| ... | @@ -853,7 +853,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -853,7 +853,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 853 | if (have_mutex) std.Io.Threaded.mutexLock(&self.mutex); | 853 | if (have_mutex) std.Io.Threaded.mutexLock(&self.mutex); |
| 854 | defer if (have_mutex) std.Io.Threaded.mutexUnlock(&self.mutex); | 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 | if (size_class_index >= self.buckets.len) { | 857 | if (size_class_index >= self.buckets.len) { |
| 858 | return self.resizeLarge(memory, alignment, new_len, return_address, true); | 858 | return self.resizeLarge(memory, alignment, new_len, return_address, true); |
| 859 | } else { | 859 | } else { |
| ... | @@ -871,7 +871,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -871,7 +871,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 871 | if (have_mutex) std.Io.Threaded.mutexLock(&self.mutex); | 871 | if (have_mutex) std.Io.Threaded.mutexLock(&self.mutex); |
| 872 | defer if (have_mutex) std.Io.Threaded.mutexUnlock(&self.mutex); | 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 | if (size_class_index >= self.buckets.len) { | 875 | if (size_class_index >= self.buckets.len) { |
| 876 | @branchHint(.unlikely); | 876 | @branchHint(.unlikely); |
| 877 | self.freeLarge(old_memory, alignment, return_address); | 877 | self.freeLarge(old_memory, alignment, return_address); |
| ... | @@ -990,7 +990,7 @@ pub fn DebugAllocator(comptime config: Config) type { | ... | @@ -990,7 +990,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 990 | return_address: usize, | 990 | return_address: usize, |
| 991 | size_class_index: usize, | 991 | size_class_index: usize, |
| 992 | ) bool { | 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 | if (!config.safety) { | 994 | if (!config.safety) { |
| 995 | if (new_size_class_index != size_class_index) return false; | 995 | if (new_size_class_index != size_class_index) return false; |
| 996 | // Still account for total even if safety is off | 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,7 +247,7 @@ pub const Status = enum(u10) { |
| 247 | }; | 247 | }; |
| 248 | 248 | ||
| 249 | pub fn class(self: Status) Class { | 249 | pub fn class(self: Status) Class { |
| 250 | return switch (@intFromEnum(self)) { | 250 | return switch (@backingInt(self)) { |
| 251 | 100...199 => .informational, | 251 | 100...199 => .informational, |
| 252 | 200...299 => .success, | 252 | 200...299 => .success, |
| 253 | 300...399 => .redirect, | 253 | 300...399 => .redirect, |
| ... | @@ -338,11 +338,11 @@ pub const Reader = struct { | ... | @@ -338,11 +338,11 @@ pub const Reader = struct { |
| 338 | _, | 338 | _, |
| 339 | 339 | ||
| 340 | pub fn init(integer: u64) RemainingChunkLen { | 340 | pub fn init(integer: u64) RemainingChunkLen { |
| 341 | return @enumFromInt(integer); | 341 | return @fromBackingInt(@intCast(integer)); |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | pub fn int(rcl: RemainingChunkLen) u64 { | 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,8 +597,8 @@ pub const Reader = struct { |
| 597 | continue :len .head; | 597 | continue :len .head; |
| 598 | }, | 598 | }, |
| 599 | else => |remaining_chunk_len| { | 599 | else => |remaining_chunk_len| { |
| 600 | const n = try in.stream(w, limit.min(.limited64(@intFromEnum(remaining_chunk_len) - 2))); | 600 | const n = try in.stream(w, limit.min(.limited64(@backingInt(remaining_chunk_len) - 2))); |
| 601 | chunk_len_ptr.* = .init(@intFromEnum(remaining_chunk_len) - n); | 601 | chunk_len_ptr.* = .init(@backingInt(remaining_chunk_len) - n); |
| 602 | return n; | 602 | return n; |
| 603 | }, | 603 | }, |
| 604 | } | 604 | } |
lib/std/http/Client.zig+11-11| ... | @@ -531,7 +531,7 @@ pub const Response = struct { | ... | @@ -531,7 +531,7 @@ pub const Response = struct { |
| 531 | else => return error.HttpHeadersInvalid, | 531 | else => return error.HttpHeadersInvalid, |
| 532 | }; | 532 | }; |
| 533 | if (first_line[8] != ' ') return error.HttpHeadersInvalid; | 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 | const reason = mem.trimStart(u8, first_line[12..], " "); | 535 | const reason = mem.trimStart(u8, first_line[12..], " "); |
| 536 | 536 | ||
| 537 | res.version = version; | 537 | res.version = version; |
| ... | @@ -825,9 +825,9 @@ pub const Request = struct { | ... | @@ -825,9 +825,9 @@ pub const Request = struct { |
| 825 | 825 | ||
| 826 | pub const default_accept_encoding: [@typeInfo(http.ContentEncoding).@"enum".field_names.len]bool = b: { | 826 | pub const default_accept_encoding: [@typeInfo(http.ContentEncoding).@"enum".field_names.len]bool = b: { |
| 827 | var result: [@typeInfo(http.ContentEncoding).@"enum".field_names.len]bool = @splat(false); | 827 | var result: [@typeInfo(http.ContentEncoding).@"enum".field_names.len]bool = @splat(false); |
| 828 | result[@intFromEnum(http.ContentEncoding.gzip)] = true; | 828 | result[@backingInt(http.ContentEncoding.gzip)] = true; |
| 829 | result[@intFromEnum(http.ContentEncoding.deflate)] = true; | 829 | result[@backingInt(http.ContentEncoding.deflate)] = true; |
| 830 | result[@intFromEnum(http.ContentEncoding.identity)] = true; | 830 | result[@backingInt(http.ContentEncoding.identity)] = true; |
| 831 | break :b result; | 831 | break :b result; |
| 832 | }; | 832 | }; |
| 833 | 833 | ||
| ... | @@ -864,20 +864,20 @@ pub const Request = struct { | ... | @@ -864,20 +864,20 @@ pub const Request = struct { |
| 864 | 864 | ||
| 865 | pub fn init(n: u16) RedirectBehavior { | 865 | pub fn init(n: u16) RedirectBehavior { |
| 866 | assert(n != std.math.maxInt(u16)); | 866 | assert(n != std.math.maxInt(u16)); |
| 867 | return @enumFromInt(n); | 867 | return @fromBackingInt(@intCast(n)); |
| 868 | } | 868 | } |
| 869 | 869 | ||
| 870 | pub fn subtractOne(rb: *RedirectBehavior) void { | 870 | pub fn subtractOne(rb: *RedirectBehavior) void { |
| 871 | switch (rb.*) { | 871 | switch (rb.*) { |
| 872 | .not_allowed => unreachable, | 872 | .not_allowed => unreachable, |
| 873 | .unhandled => unreachable, | 873 | .unhandled => unreachable, |
| 874 | _ => rb.* = @enumFromInt(@intFromEnum(rb.*) - 1), | 874 | _ => rb.* = @fromBackingInt(@intCast(@backingInt(rb.*) - 1)), |
| 875 | } | 875 | } |
| 876 | } | 876 | } |
| 877 | 877 | ||
| 878 | pub fn remaining(rb: RedirectBehavior) u16 { | 878 | pub fn remaining(rb: RedirectBehavior) u16 { |
| 879 | assert(rb != .unhandled); | 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,7 +1037,7 @@ pub const Request = struct { |
| 1037 | try w.writeAll("accept-encoding: "); | 1037 | try w.writeAll("accept-encoding: "); |
| 1038 | for (r.accept_encoding, 0..) |enabled, i| { | 1038 | for (r.accept_encoding, 0..) |enabled, i| { |
| 1039 | if (!enabled) continue; | 1039 | if (!enabled) continue; |
| 1040 | const tag: http.ContentEncoding = @enumFromInt(i); | 1040 | const tag: http.ContentEncoding = @fromBackingInt(@intCast(i)); |
| 1041 | if (tag == .identity) continue; | 1041 | if (tag == .identity) continue; |
| 1042 | const tag_name = @tagName(tag); | 1042 | const tag_name = @tagName(tag); |
| 1043 | try w.ensureUnusedCapacity(tag_name.len + 2); | 1043 | try w.ensureUnusedCapacity(tag_name.len + 2); |
| ... | @@ -1188,7 +1188,7 @@ pub const Request = struct { | ... | @@ -1188,7 +1188,7 @@ pub const Request = struct { |
| 1188 | continue; | 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 | return error.HttpContentEncodingUnsupported; | 1192 | return error.HttpContentEncodingUnsupported; |
| 1193 | 1193 | ||
| 1194 | r.response_transfer_encoding = head.transfer_encoding; | 1194 | r.response_transfer_encoding = head.transfer_encoding; |
| ... | @@ -1654,7 +1654,7 @@ pub const RequestOptions = struct { | ... | @@ -1654,7 +1654,7 @@ pub const RequestOptions = struct { |
| 1654 | /// | 1654 | /// |
| 1655 | /// This will only follow redirects for repeatable requests (ie. with no | 1655 | /// This will only follow redirects for repeatable requests (ie. with no |
| 1656 | /// payload or the server has acknowledged the payload). | 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 | /// Must be an already acquired connection. | 1659 | /// Must be an already acquired connection. |
| 1660 | connection: ?*Connection = null, | 1660 | connection: ?*Connection = null, |
| ... | @@ -1813,7 +1813,7 @@ pub fn fetch(client: *Client, options: FetchOptions) FetchError!FetchResult { | ... | @@ -1813,7 +1813,7 @@ pub fn fetch(client: *Client, options: FetchOptions) FetchError!FetchResult { |
| 1813 | if (options.payload != null) .POST else .GET; | 1813 | if (options.payload != null) .POST else .GET; |
| 1814 | 1814 | ||
| 1815 | const redirect_behavior: Request.RedirectBehavior = options.redirect_behavior orelse | 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 | var req = try request(client, method, uri, .{ | 1818 | var req = try request(client, method, uri, .{ |
| 1819 | .redirect_behavior = redirect_behavior, | 1819 | .redirect_behavior = redirect_behavior, |
lib/std/http/Server.zig+5-5| ... | @@ -353,7 +353,7 @@ pub const Request = struct { | ... | @@ -353,7 +353,7 @@ pub const Request = struct { |
| 353 | 353 | ||
| 354 | const out = request.server.out; | 354 | const out = request.server.out; |
| 355 | try out.print("{s} {d} {s}\r\n", .{ | 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 | switch (options.version) { | 359 | switch (options.version) { |
| ... | @@ -424,7 +424,7 @@ pub const Request = struct { | ... | @@ -424,7 +424,7 @@ pub const Request = struct { |
| 424 | const out = request.server.out; | 424 | const out = request.server.out; |
| 425 | 425 | ||
| 426 | try out.print("{s} {d} {s}\r\n", .{ | 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 | switch (o.version) { | 430 | switch (o.version) { |
| ... | @@ -544,7 +544,7 @@ pub const Request = struct { | ... | @@ -544,7 +544,7 @@ pub const Request = struct { |
| 544 | sha1.update("258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); | 544 | sha1.update("258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); |
| 545 | var digest: [std.crypto.hash.Sha1.digest_length]u8 = undefined; | 545 | var digest: [std.crypto.hash.Sha1.digest_length]u8 = undefined; |
| 546 | sha1.final(&digest); | 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 | try out.writeAll("connection: upgrade\r\nupgrade: websocket\r\nsec-websocket-accept: "); | 548 | try out.writeAll("connection: upgrade\r\nupgrade: websocket\r\nsec-websocket-accept: "); |
| 549 | const base64_digest = try out.writableArray(28); | 549 | const base64_digest = try out.writableArray(28); |
| 550 | assert(std.base64.standard.Encoder.encode(base64_digest, &digest).len == base64_digest.len); | 550 | assert(std.base64.standard.Encoder.encode(base64_digest, &digest).len == base64_digest.len); |
| ... | @@ -723,7 +723,7 @@ pub const WebSocket = struct { | ... | @@ -723,7 +723,7 @@ pub const WebSocket = struct { |
| 723 | const len: usize = switch (h1.payload_len) { | 723 | const len: usize = switch (h1.payload_len) { |
| 724 | .len16 => try in.takeInt(u16, .big), | 724 | .len16 => try in.takeInt(u16, .big), |
| 725 | .len64 => std.math.cast(usize, try in.takeInt(u64, .big)) orelse return error.MessageOversize, | 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 | if (len > in.buffer.len) return error.MessageOversize; | 728 | if (len > in.buffer.len) return error.MessageOversize; |
| 729 | const mask: [4]u8 = (try in.takeArray(4)).*; | 729 | const mask: [4]u8 = (try in.takeArray(4)).*; |
| ... | @@ -781,7 +781,7 @@ pub const WebSocket = struct { | ... | @@ -781,7 +781,7 @@ pub const WebSocket = struct { |
| 781 | }))); | 781 | }))); |
| 782 | switch (total_len) { | 782 | switch (total_len) { |
| 783 | 0...125 => try out.writeByte(@bitCast(@as(Header1, .{ | 783 | 0...125 => try out.writeByte(@bitCast(@as(Header1, .{ |
| 784 | .payload_len = @enumFromInt(total_len), | 784 | .payload_len = @fromBackingInt(@intCast(total_len)), |
| 785 | .mask = false, | 785 | .mask = false, |
| 786 | }))), | 786 | }))), |
| 787 | 126...0xffff => { | 787 | 126...0xffff => { |
lib/std/json/Stringify.zig+5-5| ... | @@ -127,7 +127,7 @@ pub fn endObject(self: *Stringify) Error!void { | ... | @@ -127,7 +127,7 @@ pub fn endObject(self: *Stringify) Error!void { |
| 127 | fn pushIndentation(self: *Stringify, mode: IndentationMode) !void { | 127 | fn pushIndentation(self: *Stringify, mode: IndentationMode) !void { |
| 128 | switch (safety_checks) { | 128 | switch (safety_checks) { |
| 129 | .checked_to_fixed_depth => { | 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 | .assumed_correct => { | 132 | .assumed_correct => { |
| 133 | self.indent_level += 1; | 133 | self.indent_level += 1; |
| ... | @@ -137,7 +137,7 @@ fn pushIndentation(self: *Stringify, mode: IndentationMode) !void { | ... | @@ -137,7 +137,7 @@ fn pushIndentation(self: *Stringify, mode: IndentationMode) !void { |
| 137 | fn popIndentation(self: *Stringify, expected_mode: IndentationMode) void { | 137 | fn popIndentation(self: *Stringify, expected_mode: IndentationMode) void { |
| 138 | switch (safety_checks) { | 138 | switch (safety_checks) { |
| 139 | .checked_to_fixed_depth => { | 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 | .assumed_correct => { | 142 | .assumed_correct => { |
| 143 | self.indent_level -= 1; | 143 | self.indent_level -= 1; |
| ... | @@ -202,7 +202,7 @@ fn valueDone(self: *Stringify) void { | ... | @@ -202,7 +202,7 @@ fn valueDone(self: *Stringify) void { |
| 202 | fn isObjectKeyExpected(self: *const Stringify) ?bool { | 202 | fn isObjectKeyExpected(self: *const Stringify) ?bool { |
| 203 | switch (safety_checks) { | 203 | switch (safety_checks) { |
| 204 | .checked_to_fixed_depth => return self.indent_level > 0 and | 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 | self.next_punctuation != .colon, | 206 | self.next_punctuation != .colon, |
| 207 | .assumed_correct => return null, | 207 | .assumed_correct => return null, |
| 208 | } | 208 | } |
| ... | @@ -407,7 +407,7 @@ pub fn write(self: *Stringify, v: anytype) Error!void { | ... | @@ -407,7 +407,7 @@ pub fn write(self: *Stringify, v: anytype) Error!void { |
| 407 | break; | 407 | break; |
| 408 | } | 408 | } |
| 409 | } else { | 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,7 +858,7 @@ test "stringify non-exhaustive enum" { |
| 858 | _, | 858 | _, |
| 859 | }; | 859 | }; |
| 860 | try testStringify("\"foo\"", E.foo, .{}); | 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 | test "stringify enum literals" { | 864 | test "stringify enum literals" { |
lib/std/lang.zig+1-1| ... | @@ -911,7 +911,7 @@ pub const Endian = enum { | ... | @@ -911,7 +911,7 @@ pub const Endian = enum { |
| 911 | little, | 911 | little, |
| 912 | 912 | ||
| 913 | pub const native = builtin.target.cpu.arch.endian(); | 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 | /// This data structure is used by the Zig language code generation and | 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,9 +75,9 @@ fn log( |
| 75 | /// Determine if a specific log message level and scope combination are enabled for logging. | 75 | /// Determine if a specific log message level and scope combination are enabled for logging. |
| 76 | pub fn logEnabled(comptime level: Level, comptime scope: @EnumLiteral()) bool { | 76 | pub fn logEnabled(comptime level: Level, comptime scope: @EnumLiteral()) bool { |
| 77 | inline for (std.options.log_scope_levels) |scope_level| { | 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 | pub const terminalMode = std.Options.logTerminalMode; | 83 | pub const terminalMode = std.Options.logTerminalMode; |
lib/std/math.zig+1-1| ... | @@ -1643,7 +1643,7 @@ pub const CompareOperator = enum { | ... | @@ -1643,7 +1643,7 @@ pub const CompareOperator = enum { |
| 1643 | 1643 | ||
| 1644 | test reverse { | 1644 | test reverse { |
| 1645 | inline for (@typeInfo(CompareOperator).@"enum".field_values) |op_field_value| { | 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 | try testing.expect(compare(2, op, 3) == compare(3, op.reverse(), 2)); | 1647 | try testing.expect(compare(2, op, 3) == compare(3, op.reverse(), 2)); |
| 1648 | try testing.expect(compare(3, op, 3) == compare(3, op.reverse(), 3)); | 1648 | try testing.expect(compare(3, op, 3) == compare(3, op.reverse(), 3)); |
| 1649 | try testing.expect(compare(4, op, 3) == compare(3, op.reverse(), 4)); | 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,13 +92,13 @@ pub fn FloatRepr(comptime Float: type) type { |
| 92 | pub fn unbias(biased: BiasedExponent) Exponent { | 92 | pub fn unbias(biased: BiasedExponent) Exponent { |
| 93 | switch (biased) { | 93 | switch (biased) { |
| 94 | .denormal => unreachable, | 94 | .denormal => unreachable, |
| 95 | else => return @bitCast(@intFromEnum(biased) -% @intFromEnum(BiasedExponent.zero)), | 95 | else => return @bitCast(@backingInt(biased) -% @backingInt(BiasedExponent.zero)), |
| 96 | .infinite => unreachable, | 96 | .infinite => unreachable, |
| 97 | } | 97 | } |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | pub fn bias(unbiased: Exponent) BiasedExponent { | 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,12 +32,12 @@ pub const Alignment = enum(math.Log2Int(usize)) { |
| 32 | _, | 32 | _, |
| 33 | 33 | ||
| 34 | pub fn toByteUnits(a: Alignment) usize { | 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 | pub fn fromByteUnits(n: usize) Alignment { | 38 | pub fn fromByteUnits(n: usize) Alignment { |
| 39 | assert(std.math.isPowerOfTwo(n)); | 39 | assert(std.math.isPowerOfTwo(n)); |
| 40 | return @enumFromInt(@ctz(n)); | 40 | return @fromBackingInt(@intCast(@ctz(n))); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | pub fn fromByteUnitsOptional(maybe_n: ?usize) ?Alignment { | 43 | pub fn fromByteUnitsOptional(maybe_n: ?usize) ?Alignment { |
| ... | @@ -49,36 +49,36 @@ pub const Alignment = enum(math.Log2Int(usize)) { | ... | @@ -49,36 +49,36 @@ pub const Alignment = enum(math.Log2Int(usize)) { |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | pub fn order(lhs: Alignment, rhs: Alignment) std.math.Order { | 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 | pub fn compare(lhs: Alignment, op: std.math.CompareOperator, rhs: Alignment) bool { | 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 | pub fn max(lhs: Alignment, rhs: Alignment) Alignment { | 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 | pub fn min(lhs: Alignment, rhs: Alignment) Alignment { | 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 | /// Return next address with this alignment. | 67 | /// Return next address with this alignment. |
| 68 | pub fn forward(a: Alignment, address: usize) usize { | 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 | return (address + x) & ~x; | 70 | return (address + x) & ~x; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /// Return previous address with this alignment. | 73 | /// Return previous address with this alignment. |
| 74 | pub fn backward(a: Alignment, address: usize) usize { | 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 | return address & ~x; | 76 | return address & ~x; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | /// Return whether address is aligned to this amount. | 79 | /// Return whether address is aligned to this amount. |
| 80 | pub fn check(a: Alignment, address: usize) bool { | 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,7 +280,7 @@ pub fn zeroes(comptime T: type) T { |
| 280 | return @as(T, 0); | 280 | return @as(T, 0); |
| 281 | }, | 281 | }, |
| 282 | .@"enum" => { | 282 | .@"enum" => { |
| 283 | return @as(T, @enumFromInt(0)); | 283 | return @as(T, @fromBackingInt(@intCast(0))); |
| 284 | }, | 284 | }, |
| 285 | .void => { | 285 | .void => { |
| 286 | return {}; | 286 | return {}; |
| ... | @@ -2233,7 +2233,7 @@ pub fn byteSwapAllFieldsAligned(comptime S: type, comptime a: Alignment, ptr: *a | ... | @@ -2233,7 +2233,7 @@ pub fn byteSwapAllFieldsAligned(comptime S: type, comptime a: Alignment, ptr: *a |
| 2233 | .@"struct" => byteSwapAllFieldsAligned(f_type, .fromByteUnits(f_attr.@"align" orelse @alignOf(f_type)), &@field(ptr, f_name)), | 2233 | .@"struct" => byteSwapAllFieldsAligned(f_type, .fromByteUnits(f_attr.@"align" orelse @alignOf(f_type)), &@field(ptr, f_name)), |
| 2234 | .@"union", .array => byteSwapAllFieldsAligned(f_type, .fromByteUnits(f_attr.@"align" orelse @alignOf(f_type)), &@field(ptr, f_name)), | 2234 | .@"union", .array => byteSwapAllFieldsAligned(f_type, .fromByteUnits(f_attr.@"align" orelse @alignOf(f_type)), &@field(ptr, f_name)), |
| 2235 | .@"enum" => { | 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 | .bool => {}, | 2238 | .bool => {}, |
| 2239 | .float => |float| { | 2239 | .float => |float| { |
| ... | @@ -2364,7 +2364,7 @@ pub fn byteSwapAllElements(comptime Elem: type, slice: []Elem) void { | ... | @@ -2364,7 +2364,7 @@ pub fn byteSwapAllElements(comptime Elem: type, slice: []Elem) void { |
| 2364 | switch (@typeInfo(@TypeOf(elem.*))) { | 2364 | switch (@typeInfo(@TypeOf(elem.*))) { |
| 2365 | .@"struct", .@"union", .array => byteSwapAllFields(@TypeOf(elem.*), elem), | 2365 | .@"struct", .@"union", .array => byteSwapAllFields(@TypeOf(elem.*), elem), |
| 2366 | .@"enum" => { | 2366 | .@"enum" => { |
| 2367 | elem.* = @enumFromInt(@byteSwap(@intFromEnum(elem.*))); | 2367 | elem.* = @fromBackingInt(@intCast(@byteSwap(@backingInt(elem.*)))); |
| 2368 | }, | 2368 | }, |
| 2369 | .bool => {}, | 2369 | .bool => {}, |
| 2370 | .float => |float| { | 2370 | .float => |float| { |
| ... | @@ -4784,7 +4784,7 @@ pub fn doNotOptimizeAway(val: anytype) void { | ... | @@ -4784,7 +4784,7 @@ pub fn doNotOptimizeAway(val: anytype) void { |
| 4784 | const t = @typeInfo(@TypeOf(val)); | 4784 | const t = @typeInfo(@TypeOf(val)); |
| 4785 | switch (t) { | 4785 | switch (t) { |
| 4786 | .void, .null, .comptime_int, .comptime_float => return, | 4786 | .void, .null, .comptime_int, .comptime_float => return, |
| 4787 | .@"enum" => doNotOptimizeAway(@intFromEnum(val)), | 4787 | .@"enum" => doNotOptimizeAway(@backingInt(val)), |
| 4788 | .bool => doNotOptimizeAway(@intFromBool(val)), | 4788 | .bool => doNotOptimizeAway(@intFromBool(val)), |
| 4789 | .int => { | 4789 | .int => { |
| 4790 | const bits = t.int.bits; | 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,7 +253,7 @@ pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeIn |
| 253 | .error_set => struct { name: [:0]const u8 }, | 253 | .error_set => struct { name: [:0]const u8 }, |
| 254 | else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), | 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 | return switch (@typeInfo(T)) { | 257 | return switch (@typeInfo(T)) { |
| 258 | .@"struct" => |info| .{ | 258 | .@"struct" => |info| .{ |
| 259 | .name = info.field_names[idx], | 259 | .name = info.field_names[idx], |
| ... | @@ -399,7 +399,7 @@ pub fn FieldEnum(comptime T: type) type { | ... | @@ -399,7 +399,7 @@ pub fn FieldEnum(comptime T: type) type { |
| 399 | switch (@typeInfo(T)) { | 399 | switch (@typeInfo(T)) { |
| 400 | .@"union" => |@"union"| if (@"union".tag_type) |EnumTag| { | 400 | .@"union" => |@"union"| if (@"union".tag_type) |EnumTag| { |
| 401 | for (std.enums.values(EnumTag), 0..) |v, i| { | 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 | if (!std.mem.eql(u8, @tagName(v), field_names[i])) break; // fields out of order | 403 | if (!std.mem.eql(u8, @tagName(v), field_names[i])) break; // fields out of order |
| 404 | } else { | 404 | } else { |
| 405 | return EnumTag; | 405 | return EnumTag; |
lib/std/meta/trailer_flags.zig+5-5| ... | @@ -42,7 +42,7 @@ pub fn TrailerFlags(comptime Fields: type) type { | ... | @@ -42,7 +42,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 42 | pub const Self = @This(); | 42 | pub const Self = @This(); |
| 43 | 43 | ||
| 44 | pub fn has(self: Self, comptime field: FieldEnum) bool { | 44 | pub fn has(self: Self, comptime field: FieldEnum) bool { |
| 45 | const field_index = @intFromEnum(field); | 45 | const field_index = @backingInt(field); |
| 46 | return (self.bits & (1 << field_index)) != 0; | 46 | return (self.bits & (1 << field_index)) != 0; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| ... | @@ -53,7 +53,7 @@ pub fn TrailerFlags(comptime Fields: type) type { | ... | @@ -53,7 +53,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | pub fn setFlag(self: *Self, comptime field: FieldEnum) void { | 55 | pub fn setFlag(self: *Self, comptime field: FieldEnum) void { |
| 56 | const field_index = @intFromEnum(field); | 56 | const field_index = @backingInt(field); |
| 57 | self.bits |= 1 << field_index; | 57 | self.bits |= 1 << field_index; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| ... | @@ -71,7 +71,7 @@ pub fn TrailerFlags(comptime Fields: type) type { | ... | @@ -71,7 +71,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 71 | pub fn setMany(self: Self, p: [*]align(@alignOf(Fields)) u8, fields: FieldValues) void { | 71 | pub fn setMany(self: Self, p: [*]align(@alignOf(Fields)) u8, fields: FieldValues) void { |
| 72 | inline for (@typeInfo(Fields).@"struct".field_names, 0..) |field_name, i| { | 72 | inline for (@typeInfo(Fields).@"struct".field_names, 0..) |field_name, i| { |
| 73 | if (@field(fields, field_name)) |value| | 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,7 +102,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 102 | var off: usize = 0; | 102 | var off: usize = 0; |
| 103 | inline for (@typeInfo(Fields).@"struct".field_types, 0..) |field_type, i| { | 103 | inline for (@typeInfo(Fields).@"struct".field_types, 0..) |field_type, i| { |
| 104 | const active = (self.bits & (1 << i)) != 0; | 104 | const active = (self.bits & (1 << i)) != 0; |
| 105 | if (i == @intFromEnum(field)) { | 105 | if (i == @backingInt(field)) { |
| 106 | assert(active); | 106 | assert(active); |
| 107 | return mem.alignForward(usize, off, @alignOf(field_type)); | 107 | return mem.alignForward(usize, off, @alignOf(field_type)); |
| 108 | } else if (active) { | 108 | } else if (active) { |
| ... | @@ -113,7 +113,7 @@ pub fn TrailerFlags(comptime Fields: type) type { | ... | @@ -113,7 +113,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | pub fn Field(comptime field: FieldEnum) type { | 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 | pub fn sizeInBytes(self: Self) usize { | 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,7 +92,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 92 | if (self.capacity == 0) { | 92 | if (self.capacity == 0) { |
| 93 | return &[_]F{}; | 93 | return &[_]F{}; |
| 94 | } | 94 | } |
| 95 | const byte_ptr = self.ptrs[@intFromEnum(field)]; | 95 | const byte_ptr = self.ptrs[@backingInt(field)]; |
| 96 | const casted_ptr: [*]F = if (@sizeOf(F) == 0) | 96 | const casted_ptr: [*]F = if (@sizeOf(F) == 0) |
| 97 | undefined | 97 | undefined |
| 98 | else | 98 | else |
| ... | @@ -107,14 +107,14 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -107,14 +107,14 @@ pub fn MultiArrayList(comptime T: type) type { |
| 107 | else => unreachable, | 107 | else => unreachable, |
| 108 | }; | 108 | }; |
| 109 | inline for (field_names, 0..) |field_name, i| { | 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 | pub fn get(self: Slice, index: usize) T { | 114 | pub fn get(self: Slice, index: usize) T { |
| 115 | var result: Elem = undefined; | 115 | var result: Elem = undefined; |
| 116 | inline for (field_names, 0..) |field_name, i| { | 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 | return switch (@typeInfo(T)) { | 119 | return switch (@typeInfo(T)) { |
| 120 | .@"struct" => result, | 120 | .@"struct" => result, |
| ... | @@ -361,7 +361,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -361,7 +361,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 361 | }; | 361 | }; |
| 362 | const slices = self.slice(); | 362 | const slices = self.slice(); |
| 363 | inline for (field_names, 0..) |field_name, field_index| { | 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 | var i: usize = self.len - 1; | 365 | var i: usize = self.len - 1; |
| 366 | while (i > index) : (i -= 1) { | 366 | while (i > index) : (i -= 1) { |
| 367 | field_slice[i] = field_slice[i - 1]; | 367 | field_slice[i] = field_slice[i - 1]; |
| ... | @@ -387,7 +387,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -387,7 +387,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 387 | pub fn swapRemove(self: *Self, index: usize) void { | 387 | pub fn swapRemove(self: *Self, index: usize) void { |
| 388 | const slices = self.slice(); | 388 | const slices = self.slice(); |
| 389 | inline for (field_names, 0..) |_, i| { | 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 | field_slice[index] = field_slice[self.len - 1]; | 391 | field_slice[index] = field_slice[self.len - 1]; |
| 392 | field_slice[self.len - 1] = undefined; | 392 | field_slice[self.len - 1] = undefined; |
| 393 | } | 393 | } |
| ... | @@ -399,7 +399,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -399,7 +399,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 399 | pub fn orderedRemove(self: *Self, index: usize) void { | 399 | pub fn orderedRemove(self: *Self, index: usize) void { |
| 400 | const slices = self.slice(); | 400 | const slices = self.slice(); |
| 401 | inline for (field_names, 0..) |_, field_index| { | 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 | var i = index; | 403 | var i = index; |
| 404 | while (i < self.len - 1) : (i += 1) { | 404 | while (i < self.len - 1) : (i += 1) { |
| 405 | field_slice[i] = field_slice[i + 1]; | 405 | field_slice[i] = field_slice[i + 1]; |
| ... | @@ -430,7 +430,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -430,7 +430,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 430 | const start = removed + 1; | 430 | const start = removed + 1; |
| 431 | const len = end - start; // safety checks `sorted_indexes` are sorted | 431 | const len = end - start; // safety checks `sorted_indexes` are sorted |
| 432 | inline for (field_names, 0..) |_, field_index| { | 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 | @memmove(field_slice[start - shift ..][0..len], field_slice[start..][0..len]); // safety checks initial `sorted_indexes` are in range | 434 | @memmove(field_slice[start - shift ..][0..len], field_slice[start..][0..len]); // safety checks initial `sorted_indexes` are in range |
| 435 | } | 435 | } |
| 436 | shift += 1; | 436 | shift += 1; |
| ... | @@ -439,7 +439,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -439,7 +439,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 439 | const end = self.len; | 439 | const end = self.len; |
| 440 | const len = end - start; // safety checks final `sorted_indexes` are in range | 440 | const len = end - start; // safety checks final `sorted_indexes` are in range |
| 441 | inline for (field_names, 0..) |_, field_index| { | 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 | @memmove(field_slice[start - shift ..][0..len], field_slice[start..][0..len]); | 443 | @memmove(field_slice[start - shift ..][0..len], field_slice[start..][0..len]); |
| 444 | } | 444 | } |
| 445 | self.len = end - shift; | 445 | self.len = end - shift; |
| ... | @@ -465,7 +465,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -465,7 +465,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 465 | const self_slice = self.slice(); | 465 | const self_slice = self.slice(); |
| 466 | inline for (field_types, 0..) |field_type, i| { | 466 | inline for (field_types, 0..) |field_type, i| { |
| 467 | if (@sizeOf(field_type) != 0) { | 467 | if (@sizeOf(field_type) != 0) { |
| 468 | const field = @as(Field, @enumFromInt(i)); | 468 | const field = @as(Field, @fromBackingInt(@intCast(i))); |
| 469 | const dest_slice = self_slice.items(field)[new_len..]; | 469 | const dest_slice = self_slice.items(field)[new_len..]; |
| 470 | // We use memset here for more efficient codegen in safety-checked, | 470 | // We use memset here for more efficient codegen in safety-checked, |
| 471 | // valgrind-enabled builds. Otherwise the valgrind client request | 471 | // valgrind-enabled builds. Otherwise the valgrind client request |
| ... | @@ -486,7 +486,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -486,7 +486,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 486 | const other_slice = other.slice(); | 486 | const other_slice = other.slice(); |
| 487 | inline for (field_types, 0..) |field_type, i| { | 487 | inline for (field_types, 0..) |field_type, i| { |
| 488 | if (@sizeOf(field_type) != 0) { | 488 | if (@sizeOf(field_type) != 0) { |
| 489 | const field = @as(Field, @enumFromInt(i)); | 489 | const field = @as(Field, @fromBackingInt(@intCast(i))); |
| 490 | @memcpy(other_slice.items(field), self_slice.items(field)); | 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,7 +558,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 558 | const other_slice = other.slice(); | 558 | const other_slice = other.slice(); |
| 559 | inline for (field_types, 0..) |field_type, i| { | 559 | inline for (field_types, 0..) |field_type, i| { |
| 560 | if (@sizeOf(field_type) != 0) { | 560 | if (@sizeOf(field_type) != 0) { |
| 561 | const field = @as(Field, @enumFromInt(i)); | 561 | const field = @as(Field, @fromBackingInt(@intCast(i))); |
| 562 | @memcpy(other_slice.items(field), self_slice.items(field)); | 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,7 +577,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 577 | const result_slice = result.slice(); | 577 | const result_slice = result.slice(); |
| 578 | inline for (field_types, 0..) |field_type, i| { | 578 | inline for (field_types, 0..) |field_type, i| { |
| 579 | if (@sizeOf(field_type) != 0) { | 579 | if (@sizeOf(field_type) != 0) { |
| 580 | const field = @as(Field, @enumFromInt(i)); | 580 | const field = @as(Field, @fromBackingInt(@intCast(i))); |
| 581 | @memcpy(result_slice.items(field), self_slice.items(field)); | 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,7 +594,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 594 | pub fn swap(sc: @This(), a_index: usize, b_index: usize) void { | 594 | pub fn swap(sc: @This(), a_index: usize, b_index: usize) void { |
| 595 | inline for (field_types, 0..) |field_type, i| { | 595 | inline for (field_types, 0..) |field_type, i| { |
| 596 | if (@sizeOf(field_type) != 0) { | 596 | if (@sizeOf(field_type) != 0) { |
| 597 | const field: Field = @enumFromInt(i); | 597 | const field: Field = @fromBackingInt(@intCast(i)); |
| 598 | const ptr = sc.slice.items(field); | 598 | const ptr = sc.slice.items(field); |
| 599 | mem.swap(field_type, &ptr[a_index], &ptr[b_index]); | 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,85 +28,85 @@ pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t { |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | pub const E = enum(u16) { | 30 | pub const E = enum(u16) { |
| 31 | SUCCESS = @intFromEnum(wasi.errno_t.SUCCESS), | 31 | SUCCESS = @backingInt(wasi.errno_t.SUCCESS), |
| 32 | @"2BIG" = @intFromEnum(wasi.errno_t.@"2BIG"), | 32 | @"2BIG" = @backingInt(wasi.errno_t.@"2BIG"), |
| 33 | ACCES = @intFromEnum(wasi.errno_t.ACCES), | 33 | ACCES = @backingInt(wasi.errno_t.ACCES), |
| 34 | ADDRINUSE = @intFromEnum(wasi.errno_t.ADDRINUSE), | 34 | ADDRINUSE = @backingInt(wasi.errno_t.ADDRINUSE), |
| 35 | ADDRNOTAVAIL = @intFromEnum(wasi.errno_t.ADDRNOTAVAIL), | 35 | ADDRNOTAVAIL = @backingInt(wasi.errno_t.ADDRNOTAVAIL), |
| 36 | AFNOSUPPORT = @intFromEnum(wasi.errno_t.AFNOSUPPORT), | 36 | AFNOSUPPORT = @backingInt(wasi.errno_t.AFNOSUPPORT), |
| 37 | /// This is also the error code used for `WOULDBLOCK`. | 37 | /// This is also the error code used for `WOULDBLOCK`. |
| 38 | AGAIN = @intFromEnum(wasi.errno_t.AGAIN), | 38 | AGAIN = @backingInt(wasi.errno_t.AGAIN), |
| 39 | ALREADY = @intFromEnum(wasi.errno_t.ALREADY), | 39 | ALREADY = @backingInt(wasi.errno_t.ALREADY), |
| 40 | BADF = @intFromEnum(wasi.errno_t.BADF), | 40 | BADF = @backingInt(wasi.errno_t.BADF), |
| 41 | BADMSG = @intFromEnum(wasi.errno_t.BADMSG), | 41 | BADMSG = @backingInt(wasi.errno_t.BADMSG), |
| 42 | BUSY = @intFromEnum(wasi.errno_t.BUSY), | 42 | BUSY = @backingInt(wasi.errno_t.BUSY), |
| 43 | CANCELED = @intFromEnum(wasi.errno_t.CANCELED), | 43 | CANCELED = @backingInt(wasi.errno_t.CANCELED), |
| 44 | CHILD = @intFromEnum(wasi.errno_t.CHILD), | 44 | CHILD = @backingInt(wasi.errno_t.CHILD), |
| 45 | CONNABORTED = @intFromEnum(wasi.errno_t.CONNABORTED), | 45 | CONNABORTED = @backingInt(wasi.errno_t.CONNABORTED), |
| 46 | CONNREFUSED = @intFromEnum(wasi.errno_t.CONNREFUSED), | 46 | CONNREFUSED = @backingInt(wasi.errno_t.CONNREFUSED), |
| 47 | CONNRESET = @intFromEnum(wasi.errno_t.CONNRESET), | 47 | CONNRESET = @backingInt(wasi.errno_t.CONNRESET), |
| 48 | DEADLK = @intFromEnum(wasi.errno_t.DEADLK), | 48 | DEADLK = @backingInt(wasi.errno_t.DEADLK), |
| 49 | DESTADDRREQ = @intFromEnum(wasi.errno_t.DESTADDRREQ), | 49 | DESTADDRREQ = @backingInt(wasi.errno_t.DESTADDRREQ), |
| 50 | DOM = @intFromEnum(wasi.errno_t.DOM), | 50 | DOM = @backingInt(wasi.errno_t.DOM), |
| 51 | DQUOT = @intFromEnum(wasi.errno_t.DQUOT), | 51 | DQUOT = @backingInt(wasi.errno_t.DQUOT), |
| 52 | EXIST = @intFromEnum(wasi.errno_t.EXIST), | 52 | EXIST = @backingInt(wasi.errno_t.EXIST), |
| 53 | FAULT = @intFromEnum(wasi.errno_t.FAULT), | 53 | FAULT = @backingInt(wasi.errno_t.FAULT), |
| 54 | FBIG = @intFromEnum(wasi.errno_t.FBIG), | 54 | FBIG = @backingInt(wasi.errno_t.FBIG), |
| 55 | HOSTUNREACH = @intFromEnum(wasi.errno_t.HOSTUNREACH), | 55 | HOSTUNREACH = @backingInt(wasi.errno_t.HOSTUNREACH), |
| 56 | IDRM = @intFromEnum(wasi.errno_t.IDRM), | 56 | IDRM = @backingInt(wasi.errno_t.IDRM), |
| 57 | ILSEQ = @intFromEnum(wasi.errno_t.ILSEQ), | 57 | ILSEQ = @backingInt(wasi.errno_t.ILSEQ), |
| 58 | INPROGRESS = @intFromEnum(wasi.errno_t.INPROGRESS), | 58 | INPROGRESS = @backingInt(wasi.errno_t.INPROGRESS), |
| 59 | INTR = @intFromEnum(wasi.errno_t.INTR), | 59 | INTR = @backingInt(wasi.errno_t.INTR), |
| 60 | INVAL = @intFromEnum(wasi.errno_t.INVAL), | 60 | INVAL = @backingInt(wasi.errno_t.INVAL), |
| 61 | IO = @intFromEnum(wasi.errno_t.IO), | 61 | IO = @backingInt(wasi.errno_t.IO), |
| 62 | ISCONN = @intFromEnum(wasi.errno_t.ISCONN), | 62 | ISCONN = @backingInt(wasi.errno_t.ISCONN), |
| 63 | ISDIR = @intFromEnum(wasi.errno_t.ISDIR), | 63 | ISDIR = @backingInt(wasi.errno_t.ISDIR), |
| 64 | LOOP = @intFromEnum(wasi.errno_t.LOOP), | 64 | LOOP = @backingInt(wasi.errno_t.LOOP), |
| 65 | MFILE = @intFromEnum(wasi.errno_t.MFILE), | 65 | MFILE = @backingInt(wasi.errno_t.MFILE), |
| 66 | MLINK = @intFromEnum(wasi.errno_t.MLINK), | 66 | MLINK = @backingInt(wasi.errno_t.MLINK), |
| 67 | MSGSIZE = @intFromEnum(wasi.errno_t.MSGSIZE), | 67 | MSGSIZE = @backingInt(wasi.errno_t.MSGSIZE), |
| 68 | MULTIHOP = @intFromEnum(wasi.errno_t.MULTIHOP), | 68 | MULTIHOP = @backingInt(wasi.errno_t.MULTIHOP), |
| 69 | NAMETOOLONG = @intFromEnum(wasi.errno_t.NAMETOOLONG), | 69 | NAMETOOLONG = @backingInt(wasi.errno_t.NAMETOOLONG), |
| 70 | NETDOWN = @intFromEnum(wasi.errno_t.NETDOWN), | 70 | NETDOWN = @backingInt(wasi.errno_t.NETDOWN), |
| 71 | NETRESET = @intFromEnum(wasi.errno_t.NETRESET), | 71 | NETRESET = @backingInt(wasi.errno_t.NETRESET), |
| 72 | NETUNREACH = @intFromEnum(wasi.errno_t.NETUNREACH), | 72 | NETUNREACH = @backingInt(wasi.errno_t.NETUNREACH), |
| 73 | NFILE = @intFromEnum(wasi.errno_t.NFILE), | 73 | NFILE = @backingInt(wasi.errno_t.NFILE), |
| 74 | NOBUFS = @intFromEnum(wasi.errno_t.NOBUFS), | 74 | NOBUFS = @backingInt(wasi.errno_t.NOBUFS), |
| 75 | NODEV = @intFromEnum(wasi.errno_t.NODEV), | 75 | NODEV = @backingInt(wasi.errno_t.NODEV), |
| 76 | NOENT = @intFromEnum(wasi.errno_t.NOENT), | 76 | NOENT = @backingInt(wasi.errno_t.NOENT), |
| 77 | NOEXEC = @intFromEnum(wasi.errno_t.NOEXEC), | 77 | NOEXEC = @backingInt(wasi.errno_t.NOEXEC), |
| 78 | NOLCK = @intFromEnum(wasi.errno_t.NOLCK), | 78 | NOLCK = @backingInt(wasi.errno_t.NOLCK), |
| 79 | NOLINK = @intFromEnum(wasi.errno_t.NOLINK), | 79 | NOLINK = @backingInt(wasi.errno_t.NOLINK), |
| 80 | NOMEM = @intFromEnum(wasi.errno_t.NOMEM), | 80 | NOMEM = @backingInt(wasi.errno_t.NOMEM), |
| 81 | NOMSG = @intFromEnum(wasi.errno_t.NOMSG), | 81 | NOMSG = @backingInt(wasi.errno_t.NOMSG), |
| 82 | NOPROTOOPT = @intFromEnum(wasi.errno_t.NOPROTOOPT), | 82 | NOPROTOOPT = @backingInt(wasi.errno_t.NOPROTOOPT), |
| 83 | NOSPC = @intFromEnum(wasi.errno_t.NOSPC), | 83 | NOSPC = @backingInt(wasi.errno_t.NOSPC), |
| 84 | NOSYS = @intFromEnum(wasi.errno_t.NOSYS), | 84 | NOSYS = @backingInt(wasi.errno_t.NOSYS), |
| 85 | NOTCONN = @intFromEnum(wasi.errno_t.NOTCONN), | 85 | NOTCONN = @backingInt(wasi.errno_t.NOTCONN), |
| 86 | NOTDIR = @intFromEnum(wasi.errno_t.NOTDIR), | 86 | NOTDIR = @backingInt(wasi.errno_t.NOTDIR), |
| 87 | NOTEMPTY = @intFromEnum(wasi.errno_t.NOTEMPTY), | 87 | NOTEMPTY = @backingInt(wasi.errno_t.NOTEMPTY), |
| 88 | NOTRECOVERABLE = @intFromEnum(wasi.errno_t.NOTRECOVERABLE), | 88 | NOTRECOVERABLE = @backingInt(wasi.errno_t.NOTRECOVERABLE), |
| 89 | NOTSOCK = @intFromEnum(wasi.errno_t.NOTSOCK), | 89 | NOTSOCK = @backingInt(wasi.errno_t.NOTSOCK), |
| 90 | /// This is also the code used for `NOTSUP`. | 90 | /// This is also the code used for `NOTSUP`. |
| 91 | OPNOTSUPP = @intFromEnum(wasi.errno_t.OPNOTSUPP), | 91 | OPNOTSUPP = @backingInt(wasi.errno_t.OPNOTSUPP), |
| 92 | NOTTY = @intFromEnum(wasi.errno_t.NOTTY), | 92 | NOTTY = @backingInt(wasi.errno_t.NOTTY), |
| 93 | NXIO = @intFromEnum(wasi.errno_t.NXIO), | 93 | NXIO = @backingInt(wasi.errno_t.NXIO), |
| 94 | OVERFLOW = @intFromEnum(wasi.errno_t.OVERFLOW), | 94 | OVERFLOW = @backingInt(wasi.errno_t.OVERFLOW), |
| 95 | OWNERDEAD = @intFromEnum(wasi.errno_t.OWNERDEAD), | 95 | OWNERDEAD = @backingInt(wasi.errno_t.OWNERDEAD), |
| 96 | PERM = @intFromEnum(wasi.errno_t.PERM), | 96 | PERM = @backingInt(wasi.errno_t.PERM), |
| 97 | PIPE = @intFromEnum(wasi.errno_t.PIPE), | 97 | PIPE = @backingInt(wasi.errno_t.PIPE), |
| 98 | PROTO = @intFromEnum(wasi.errno_t.PROTO), | 98 | PROTO = @backingInt(wasi.errno_t.PROTO), |
| 99 | PROTONOSUPPORT = @intFromEnum(wasi.errno_t.PROTONOSUPPORT), | 99 | PROTONOSUPPORT = @backingInt(wasi.errno_t.PROTONOSUPPORT), |
| 100 | PROTOTYPE = @intFromEnum(wasi.errno_t.PROTOTYPE), | 100 | PROTOTYPE = @backingInt(wasi.errno_t.PROTOTYPE), |
| 101 | RANGE = @intFromEnum(wasi.errno_t.RANGE), | 101 | RANGE = @backingInt(wasi.errno_t.RANGE), |
| 102 | ROFS = @intFromEnum(wasi.errno_t.ROFS), | 102 | ROFS = @backingInt(wasi.errno_t.ROFS), |
| 103 | SPIPE = @intFromEnum(wasi.errno_t.SPIPE), | 103 | SPIPE = @backingInt(wasi.errno_t.SPIPE), |
| 104 | SRCH = @intFromEnum(wasi.errno_t.SRCH), | 104 | SRCH = @backingInt(wasi.errno_t.SRCH), |
| 105 | STALE = @intFromEnum(wasi.errno_t.STALE), | 105 | STALE = @backingInt(wasi.errno_t.STALE), |
| 106 | TIMEDOUT = @intFromEnum(wasi.errno_t.TIMEDOUT), | 106 | TIMEDOUT = @backingInt(wasi.errno_t.TIMEDOUT), |
| 107 | TXTBSY = @intFromEnum(wasi.errno_t.TXTBSY), | 107 | TXTBSY = @backingInt(wasi.errno_t.TXTBSY), |
| 108 | XDEV = @intFromEnum(wasi.errno_t.XDEV), | 108 | XDEV = @backingInt(wasi.errno_t.XDEV), |
| 109 | NOTCAPABLE = @intFromEnum(wasi.errno_t.NOTCAPABLE), | 109 | NOTCAPABLE = @backingInt(wasi.errno_t.NOTCAPABLE), |
| 110 | 110 | ||
| 111 | ENOSTR = 100, | 111 | ENOSTR = 100, |
| 112 | EBFONT = 101, | 112 | EBFONT = 101, |
| ... | @@ -209,10 +209,10 @@ pub const W = struct { | ... | @@ -209,10 +209,10 @@ pub const W = struct { |
| 209 | return @as(u8, @intCast((s & 0xff00) >> 8)); | 209 | return @as(u8, @intCast((s & 0xff00) >> 8)); |
| 210 | } | 210 | } |
| 211 | pub fn TERMSIG(s: u32) SIG { | 211 | pub fn TERMSIG(s: u32) SIG { |
| 212 | return @enumFromInt(s & 0x7f); | 212 | return @fromBackingInt(@intCast(s & 0x7f)); |
| 213 | } | 213 | } |
| 214 | pub fn STOPSIG(s: u32) SIG { | 214 | pub fn STOPSIG(s: u32) SIG { |
| 215 | return @enumFromInt(EXITSTATUS(s)); | 215 | return @fromBackingInt(@intCast(EXITSTATUS(s))); |
| 216 | } | 216 | } |
| 217 | pub fn IFEXITED(s: u32) bool { | 217 | pub fn IFEXITED(s: u32) bool { |
| 218 | return (s & 0x7f) == 0; | 218 | return (s & 0x7f) == 0; |
lib/std/os/linux.zig+44-44| ... | @@ -755,7 +755,7 @@ fn splitValue64(val: i64) [2]u32 { | ... | @@ -755,7 +755,7 @@ fn splitValue64(val: i64) [2]u32 { |
| 755 | pub fn errno(r: u64) E { | 755 | pub fn errno(r: u64) E { |
| 756 | const signed_r: i32 = @bitCast(@as(u32, @truncate(r))); | 756 | const signed_r: i32 = @bitCast(@as(u32, @truncate(r))); |
| 757 | const int = if (signed_r > -4096 and signed_r < 0) -signed_r else 0; | 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 | pub fn brk(addr: usize) usize { | 761 | pub fn brk(addr: usize) usize { |
| ... | @@ -822,7 +822,7 @@ pub fn fork() usize { | ... | @@ -822,7 +822,7 @@ pub fn fork() usize { |
| 822 | } else if (@hasField(SYS, "fork")) { | 822 | } else if (@hasField(SYS, "fork")) { |
| 823 | return syscall0(.fork); | 823 | return syscall0(.fork); |
| 824 | } else { | 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,7 +945,7 @@ pub fn futex2_waitv( |
| 945 | nr_futexes, | 945 | nr_futexes, |
| 946 | @as(u32, @bitCast(flags)), | 946 | @as(u32, @bitCast(flags)), |
| 947 | @intFromPtr(timeout), | 947 | @intFromPtr(timeout), |
| 948 | @intFromEnum(clockid), | 948 | @backingInt(clockid), |
| 949 | ); | 949 | ); |
| 950 | } | 950 | } |
| 951 | 951 | ||
| ... | @@ -974,7 +974,7 @@ pub fn futex2_wait( | ... | @@ -974,7 +974,7 @@ pub fn futex2_wait( |
| 974 | mask, | 974 | mask, |
| 975 | @as(u32, @bitCast(flags)), | 975 | @as(u32, @bitCast(flags)), |
| 976 | @intFromPtr(timeout), | 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,7 +1250,7 @@ pub const FSCONFIG_CMD = enum(u32) { |
| 1250 | }; | 1250 | }; |
| 1251 | 1251 | ||
| 1252 | pub fn fsconfig(fd: fd_t, cmd: FSCONFIG_CMD, key: ?[*:0]const u8, value: ?[*:0]const u8, aux: u32) usize { | 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 | pub const FSMOUNT = packed struct(u32) { | 1256 | pub const FSMOUNT = packed struct(u32) { |
| ... | @@ -1897,9 +1897,9 @@ pub const LINUX_REBOOT = struct { | ... | @@ -1897,9 +1897,9 @@ pub const LINUX_REBOOT = struct { |
| 1897 | pub fn reboot(magic: LINUX_REBOOT.MAGIC1, magic2: LINUX_REBOOT.MAGIC2, cmd: LINUX_REBOOT.CMD, arg: ?*const anyopaque) usize { | 1897 | pub fn reboot(magic: LINUX_REBOOT.MAGIC1, magic2: LINUX_REBOOT.MAGIC2, cmd: LINUX_REBOOT.CMD, arg: ?*const anyopaque) usize { |
| 1898 | return std.os.linux.syscall4( | 1898 | return std.os.linux.syscall4( |
| 1899 | .reboot, | 1899 | .reboot, |
| 1900 | @intFromEnum(magic), | 1900 | @backingInt(magic), |
| 1901 | @intFromEnum(magic2), | 1901 | @backingInt(magic2), |
| 1902 | @intFromEnum(cmd), | 1902 | @backingInt(cmd), |
| 1903 | @intFromPtr(arg), | 1903 | @intFromPtr(arg), |
| 1904 | ); | 1904 | ); |
| 1905 | } | 1905 | } |
| ... | @@ -1909,15 +1909,15 @@ pub fn getrandom(buf: [*]u8, count: usize, flags: u32) usize { | ... | @@ -1909,15 +1909,15 @@ pub fn getrandom(buf: [*]u8, count: usize, flags: u32) usize { |
| 1909 | } | 1909 | } |
| 1910 | 1910 | ||
| 1911 | pub fn kill(pid: pid_t, sig: SIG) usize { | 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 | pub fn tkill(tid: pid_t, sig: SIG) usize { | 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 | pub fn tgkill(tgid: pid_t, tid: pid_t, sig: SIG) usize { | 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 | pub fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8) usize { | 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,7 +1979,7 @@ pub fn wait4(pid: pid_t, status: *i32, flags: u32, usage: ?*rusage) usize { |
| 1979 | pub fn waitid(id_type: P, id: pid_t, infop: *siginfo_t, flags: u32, usage: ?*rusage) usize { | 1979 | pub fn waitid(id_type: P, id: pid_t, infop: *siginfo_t, flags: u32, usage: ?*rusage) usize { |
| 1980 | return syscall5( | 1980 | return syscall5( |
| 1981 | .waitid, | 1981 | .waitid, |
| 1982 | @intFromEnum(id_type), | 1982 | @backingInt(id_type), |
| 1983 | @as(u32, @bitCast(id)), | 1983 | @as(u32, @bitCast(id)), |
| 1984 | @intFromPtr(infop), | 1984 | @intFromPtr(infop), |
| 1985 | flags, | 1985 | flags, |
| ... | @@ -2146,14 +2146,14 @@ pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize { | ... | @@ -2146,14 +2146,14 @@ pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize { |
| 2146 | if (ptr) |f| { | 2146 | if (ptr) |f| { |
| 2147 | const rc = f(clk_id, tp); | 2147 | const rc = f(clk_id, tp); |
| 2148 | switch (rc) { | 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 | else => {}, | 2150 | else => {}, |
| 2151 | } | 2151 | } |
| 2152 | } | 2152 | } |
| 2153 | } | 2153 | } |
| 2154 | return syscall2( | 2154 | return syscall2( |
| 2155 | if (@hasField(SYS, "clock_gettime") and native_arch != .hexagon) .clock_gettime else .clock_gettime64, | 2155 | if (@hasField(SYS, "clock_gettime") and native_arch != .hexagon) .clock_gettime else .clock_gettime64, |
| 2156 | @intFromEnum(clk_id), | 2156 | @backingInt(clk_id), |
| 2157 | @intFromPtr(tp), | 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,13 +2165,13 @@ fn init_vdso_clock_gettime(clk: clockid_t, ts: *timespec) callconv(.c) usize { |
| 2165 | @atomicStore(?VdsoClockGettime, &vdso_clock_gettime, ptr, .monotonic); | 2165 | @atomicStore(?VdsoClockGettime, &vdso_clock_gettime, ptr, .monotonic); |
| 2166 | // Call into the VDSO if available | 2166 | // Call into the VDSO if available |
| 2167 | if (ptr) |f| return f(clk, ts); | 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 | pub fn clock_getres(clk_id: clockid_t, tp: *timespec) usize { | 2171 | pub fn clock_getres(clk_id: clockid_t, tp: *timespec) usize { |
| 2172 | return syscall2( | 2172 | return syscall2( |
| 2173 | if (@hasField(SYS, "clock_getres") and native_arch != .hexagon) .clock_getres else .clock_getres_time64, | 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 | @intFromPtr(tp), | 2175 | @intFromPtr(tp), |
| 2176 | ); | 2176 | ); |
| 2177 | } | 2177 | } |
| ... | @@ -2179,7 +2179,7 @@ pub fn clock_getres(clk_id: clockid_t, tp: *timespec) usize { | ... | @@ -2179,7 +2179,7 @@ pub fn clock_getres(clk_id: clockid_t, tp: *timespec) usize { |
| 2179 | pub fn clock_settime(clk_id: clockid_t, tp: *const timespec) usize { | 2179 | pub fn clock_settime(clk_id: clockid_t, tp: *const timespec) usize { |
| 2180 | return syscall2( | 2180 | return syscall2( |
| 2181 | if (@hasField(SYS, "clock_settime") and native_arch != .hexagon) .clock_settime else .clock_settime64, | 2181 | if (@hasField(SYS, "clock_settime") and native_arch != .hexagon) .clock_settime else .clock_settime64, |
| 2182 | @intFromEnum(clk_id), | 2182 | @backingInt(clk_id), |
| 2183 | @intFromPtr(tp), | 2183 | @intFromPtr(tp), |
| 2184 | ); | 2184 | ); |
| 2185 | } | 2185 | } |
| ... | @@ -2187,7 +2187,7 @@ pub fn clock_settime(clk_id: clockid_t, tp: *const timespec) usize { | ... | @@ -2187,7 +2187,7 @@ pub fn clock_settime(clk_id: clockid_t, tp: *const timespec) usize { |
| 2187 | pub fn clock_nanosleep(clockid: clockid_t, flags: TIMER, request: *const timespec, remain: ?*timespec) usize { | 2187 | pub fn clock_nanosleep(clockid: clockid_t, flags: TIMER, request: *const timespec, remain: ?*timespec) usize { |
| 2188 | return syscall4( | 2188 | return syscall4( |
| 2189 | if (@hasField(SYS, "clock_nanosleep") and native_arch != .hexagon) .clock_nanosleep else .clock_nanosleep_time64, | 2189 | if (@hasField(SYS, "clock_nanosleep") and native_arch != .hexagon) .clock_nanosleep else .clock_nanosleep_time64, |
| 2190 | @intFromEnum(clockid), | 2190 | @backingInt(clockid), |
| 2191 | @as(u32, @bitCast(flags)), | 2191 | @as(u32, @bitCast(flags)), |
| 2192 | @intFromPtr(request), | 2192 | @intFromPtr(request), |
| 2193 | @intFromPtr(remain), | 2193 | @intFromPtr(remain), |
| ... | @@ -2384,8 +2384,8 @@ pub fn sigprocmask(flags: u32, noalias set: ?*const sigset_t, noalias oldset: ?* | ... | @@ -2384,8 +2384,8 @@ pub fn sigprocmask(flags: u32, noalias set: ?*const sigset_t, noalias oldset: ?* |
| 2384 | } | 2384 | } |
| 2385 | 2385 | ||
| 2386 | pub fn sigaction(sig: SIG, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) usize { | 2386 | pub fn sigaction(sig: SIG, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) usize { |
| 2387 | assert(@intFromEnum(sig) > 0); | 2387 | assert(@backingInt(sig) > 0); |
| 2388 | assert(@intFromEnum(sig) < NSIG); | 2388 | assert(@backingInt(sig) < NSIG); |
| 2389 | assert(sig != .KILL); | 2389 | assert(sig != .KILL); |
| 2390 | assert(sig != .STOP); | 2390 | assert(sig != .STOP); |
| 2391 | 2391 | ||
| ... | @@ -2418,8 +2418,8 @@ pub fn sigaction(sig: SIG, noalias act: ?*const Sigaction, noalias oact: ?*Sigac | ... | @@ -2418,8 +2418,8 @@ pub fn sigaction(sig: SIG, noalias act: ?*const Sigaction, noalias oact: ?*Sigac |
| 2418 | 2418 | ||
| 2419 | const result = switch (native_arch) { | 2419 | const result = switch (native_arch) { |
| 2420 | // The sparc version of rt_sigaction needs the restorer function to be passed as an argument too. | 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), | 2421 | .sparc, .sparc64 => syscall5(.rt_sigaction, @backingInt(sig), ksa_arg, oldksa_arg, @intFromPtr(ksa.restorer), mask_size), |
| 2422 | else => syscall4(.rt_sigaction, @intFromEnum(sig), ksa_arg, oldksa_arg, mask_size), | 2422 | else => syscall4(.rt_sigaction, @backingInt(sig), ksa_arg, oldksa_arg, mask_size), |
| 2423 | }; | 2423 | }; |
| 2424 | if (errno(result) != .SUCCESS) return result; | 2424 | if (errno(result) != .SUCCESS) return result; |
| 2425 | 2425 | ||
| ... | @@ -2468,9 +2468,9 @@ pub fn sigfillset() sigset_t { | ... | @@ -2468,9 +2468,9 @@ pub fn sigfillset() sigset_t { |
| 2468 | } | 2468 | } |
| 2469 | 2469 | ||
| 2470 | fn sigset_bit_index(sig: SIG) struct { word: usize, mask: SigsetElement } { | 2470 | fn sigset_bit_index(sig: SIG) struct { word: usize, mask: SigsetElement } { |
| 2471 | assert(@intFromEnum(sig) > 0); | 2471 | assert(@backingInt(sig) > 0); |
| 2472 | assert(@intFromEnum(sig) < NSIG); | 2472 | assert(@backingInt(sig) < NSIG); |
| 2473 | const bit = @intFromEnum(sig) - 1; | 2473 | const bit = @backingInt(sig) - 1; |
| 2474 | return .{ | 2474 | return .{ |
| 2475 | .word = bit / @bitSizeOf(SigsetElement), | 2475 | .word = bit / @bitSizeOf(SigsetElement), |
| 2476 | .mask = @as(SigsetElement, 1) << @truncate(bit % @bitSizeOf(SigsetElement)), | 2476 | .mask = @as(SigsetElement, 1) << @truncate(bit % @bitSizeOf(SigsetElement)), |
| ... | @@ -2833,7 +2833,7 @@ pub fn eventfd(count: u32, flags: u32) usize { | ... | @@ -2833,7 +2833,7 @@ pub fn eventfd(count: u32, flags: u32) usize { |
| 2833 | pub fn timerfd_create(clockid: timerfd_clockid_t, flags: TFD) usize { | 2833 | pub fn timerfd_create(clockid: timerfd_clockid_t, flags: TFD) usize { |
| 2834 | return syscall2( | 2834 | return syscall2( |
| 2835 | .timerfd_create, | 2835 | .timerfd_create, |
| 2836 | @intFromEnum(clockid), | 2836 | @backingInt(clockid), |
| 2837 | @as(u32, @bitCast(flags)), | 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,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 | pub fn io_uring_register(fd: fd_t, opcode: IORING_REGISTER, arg: ?*const anyopaque, nr_args: u32) usize { | 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 | pub fn memfd_create(name: [*:0]const u8, flags: u32) usize { | 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,7 +2925,7 @@ pub fn tcgetattr(fd: fd_t, termios_p: *termios) usize { |
| 2925 | } | 2925 | } |
| 2926 | 2926 | ||
| 2927 | pub fn tcsetattr(fd: fd_t, optional_action: TCSA, termios_p: *const termios) usize { | 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 | pub fn tcgetpgrp(fd: fd_t, pgrp: *pid_t) usize { | 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,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 | pub fn bpf(cmd: BPF.Cmd, attr: *BPF.Attr, size: u32) usize { | 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 | pub fn sync() void { | 2967 | pub fn sync() void { |
| ... | @@ -2998,7 +2998,7 @@ pub fn prlimit(pid: pid_t, resource: rlimit_resource, new_limit: ?*const rlimit, | ... | @@ -2998,7 +2998,7 @@ pub fn prlimit(pid: pid_t, resource: rlimit_resource, new_limit: ?*const rlimit, |
| 2998 | return syscall4( | 2998 | return syscall4( |
| 2999 | .prlimit64, | 2999 | .prlimit64, |
| 3000 | @as(u32, @bitCast(pid)), | 3000 | @as(u32, @bitCast(pid)), |
| 3001 | @as(u32, @bitCast(@as(i32, @intFromEnum(resource)))), | 3001 | @as(u32, @bitCast(@as(i32, @backingInt(resource)))), |
| 3002 | @intFromPtr(new_limit), | 3002 | @intFromPtr(new_limit), |
| 3003 | @intFromPtr(old_limit), | 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,7 +3029,7 @@ pub fn pidfd_send_signal(pidfd: fd_t, sig: SIG, info: ?*siginfo_t, flags: u32) u |
| 3029 | return syscall4( | 3029 | return syscall4( |
| 3030 | .pidfd_send_signal, | 3030 | .pidfd_send_signal, |
| 3031 | @as(u32, @bitCast(pidfd)), | 3031 | @as(u32, @bitCast(pidfd)), |
| 3032 | @intFromEnum(sig), | 3032 | @backingInt(sig), |
| 3033 | @intFromPtr(info), | 3033 | @intFromPtr(info), |
| 3034 | flags, | 3034 | flags, |
| 3035 | ); | 3035 | ); |
| ... | @@ -4346,10 +4346,10 @@ pub const W = struct { | ... | @@ -4346,10 +4346,10 @@ pub const W = struct { |
| 4346 | return @as(u8, @intCast((s & 0xff00) >> 8)); | 4346 | return @as(u8, @intCast((s & 0xff00) >> 8)); |
| 4347 | } | 4347 | } |
| 4348 | pub fn TERMSIG(s: u32) SIG { | 4348 | pub fn TERMSIG(s: u32) SIG { |
| 4349 | return @enumFromInt(s & 0x7f); | 4349 | return @fromBackingInt(@intCast(s & 0x7f)); |
| 4350 | } | 4350 | } |
| 4351 | pub fn STOPSIG(s: u32) SIG { | 4351 | pub fn STOPSIG(s: u32) SIG { |
| 4352 | return @enumFromInt(EXITSTATUS(s)); | 4352 | return @fromBackingInt(@intCast(EXITSTATUS(s))); |
| 4353 | } | 4353 | } |
| 4354 | pub fn IFEXITED(s: u32) bool { | 4354 | pub fn IFEXITED(s: u32) bool { |
| 4355 | return (s & 0x7f) == 0; | 4355 | return (s & 0x7f) == 0; |
| ... | @@ -7258,26 +7258,26 @@ pub const IOSQE_BIT = enum(u8) { | ... | @@ -7258,26 +7258,26 @@ pub const IOSQE_BIT = enum(u8) { |
| 7258 | // io_uring_sqe.flags | 7258 | // io_uring_sqe.flags |
| 7259 | 7259 | ||
| 7260 | /// use fixed fileset | 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 | /// issue after inflight IO | 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 | /// links next sqe | 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 | /// like LINK, but stronger | 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 | /// always go async | 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 | /// select buffer from buf_group | 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 | /// don't post CQE if request succeeded | 7278 | /// don't post CQE if request succeeded |
| 7279 | /// Available since Linux 5.17 | 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 | pub const IORING_OP = enum(u8) { | 7282 | pub const IORING_OP = enum(u8) { |
| 7283 | NOP, | 7283 | NOP, |
| ... | @@ -7437,7 +7437,7 @@ pub const io_uring_cqe = extern struct { | ... | @@ -7437,7 +7437,7 @@ pub const io_uring_cqe = extern struct { |
| 7437 | 7437 | ||
| 7438 | pub fn err(self: io_uring_cqe) E { | 7438 | pub fn err(self: io_uring_cqe) E { |
| 7439 | if (self.res > -4096 and self.res < 0) { | 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 | return .SUCCESS; | 7442 | return .SUCCESS; |
| 7443 | } | 7443 | } |
| ... | @@ -7724,8 +7724,8 @@ pub const io_uring_probe = extern struct { | ... | @@ -7724,8 +7724,8 @@ pub const io_uring_probe = extern struct { |
| 7724 | 7724 | ||
| 7725 | /// Is the operation supported on the running kernel. | 7725 | /// Is the operation supported on the running kernel. |
| 7726 | pub fn is_supported(self: @This(), op: IORING_OP) bool { | 7726 | pub fn is_supported(self: @This(), op: IORING_OP) bool { |
| 7727 | const i = @intFromEnum(op); | 7727 | const i = @backingInt(op); |
| 7728 | if (i > @intFromEnum(self.last_op) or i >= self.ops_len) | 7728 | if (i > @backingInt(self.last_op) or i >= self.ops_len) |
| 7729 | return false; | 7729 | return false; |
| 7730 | return self.ops[i].is_supported(); | 7730 | return self.ops[i].is_supported(); |
| 7731 | } | 7731 | } |
| ... | @@ -10741,7 +10741,7 @@ pub const AUDIT = struct { | ... | @@ -10741,7 +10741,7 @@ pub const AUDIT = struct { |
| 10741 | LOONGARCH64 = toAudit(.LOONGARCH, @"64BIT" | LE), | 10741 | LOONGARCH64 = toAudit(.LOONGARCH, @"64BIT" | LE), |
| 10742 | 10742 | ||
| 10743 | fn toAudit(em: elf.EM, flags: u32) u32 { | 10743 | fn toAudit(em: elf.EM, flags: u32) u32 { |
| 10744 | return @intFromEnum(em) | flags; | 10744 | return @backingInt(em) | flags; |
| 10745 | } | 10745 | } |
| 10746 | 10746 | ||
| 10747 | pub const current: AUDIT.ARCH = switch (native_arch) { | 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,7 +589,7 @@ test "sendmsg/recvmsg" { |
| 589 | try testing.expectEqual(@as(u32, 2), ring.cq_ready()); | 589 | try testing.expectEqual(@as(u32, 2), ring.cq_ready()); |
| 590 | 590 | ||
| 591 | const cqe_sendmsg = try ring.copy_cqe(); | 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 | try testing.expectEqual(linux.io_uring_cqe{ | 593 | try testing.expectEqual(linux.io_uring_cqe{ |
| 594 | .user_data = 0x11111111, | 594 | .user_data = 0x11111111, |
| 595 | .res = buffer_send.len, | 595 | .res = buffer_send.len, |
| ... | @@ -597,7 +597,7 @@ test "sendmsg/recvmsg" { | ... | @@ -597,7 +597,7 @@ test "sendmsg/recvmsg" { |
| 597 | }, cqe_sendmsg); | 597 | }, cqe_sendmsg); |
| 598 | 598 | ||
| 599 | const cqe_recvmsg = try ring.copy_cqe(); | 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 | try testing.expectEqual(linux.io_uring_cqe{ | 601 | try testing.expectEqual(linux.io_uring_cqe{ |
| 602 | .user_data = 0x22222222, | 602 | .user_data = 0x22222222, |
| 603 | .res = buffer_recv.len, | 603 | .res = buffer_recv.len, |
| ... | @@ -631,7 +631,7 @@ test "timeout (after a relative time)" { | ... | @@ -631,7 +631,7 @@ test "timeout (after a relative time)" { |
| 631 | 631 | ||
| 632 | try testing.expectEqual(linux.io_uring_cqe{ | 632 | try testing.expectEqual(linux.io_uring_cqe{ |
| 633 | .user_data = 0x55555555, | 633 | .user_data = 0x55555555, |
| 634 | .res = -@as(i32, @intFromEnum(linux.E.TIME)), | 634 | .res = -@as(i32, @backingInt(linux.E.TIME)), |
| 635 | .flags = 0, | 635 | .flags = 0, |
| 636 | }, cqe); | 636 | }, cqe); |
| 637 | 637 | ||
| ... | @@ -716,7 +716,7 @@ test "timeout_remove" { | ... | @@ -716,7 +716,7 @@ test "timeout_remove" { |
| 716 | if (cqe.user_data == 0x88888888) { | 716 | if (cqe.user_data == 0x88888888) { |
| 717 | try testing.expectEqual(linux.io_uring_cqe{ | 717 | try testing.expectEqual(linux.io_uring_cqe{ |
| 718 | .user_data = 0x88888888, | 718 | .user_data = 0x88888888, |
| 719 | .res = -@as(i32, @intFromEnum(linux.E.CANCELED)), | 719 | .res = -@as(i32, @backingInt(linux.E.CANCELED)), |
| 720 | .flags = 0, | 720 | .flags = 0, |
| 721 | }, cqe); | 721 | }, cqe); |
| 722 | } else if (cqe.user_data == 0x99999999) { | 722 | } else if (cqe.user_data == 0x99999999) { |
| ... | @@ -759,16 +759,16 @@ test "accept/connect/recv/link_timeout" { | ... | @@ -759,16 +759,16 @@ test "accept/connect/recv/link_timeout" { |
| 759 | const cqe = try ring.copy_cqe(); | 759 | const cqe = try ring.copy_cqe(); |
| 760 | switch (cqe.user_data) { | 760 | switch (cqe.user_data) { |
| 761 | 0xffffffff => { | 761 | 0xffffffff => { |
| 762 | if (cqe.res != -@as(i32, @intFromEnum(linux.E.INTR)) and | 762 | if (cqe.res != -@as(i32, @backingInt(linux.E.INTR)) and |
| 763 | cqe.res != -@as(i32, @intFromEnum(linux.E.CANCELED))) | 763 | cqe.res != -@as(i32, @backingInt(linux.E.CANCELED))) |
| 764 | { | 764 | { |
| 765 | std.debug.print("Req 0x{x} got {d}\n", .{ cqe.user_data, cqe.res }); | 765 | std.debug.print("Req 0x{x} got {d}\n", .{ cqe.user_data, cqe.res }); |
| 766 | try testing.expect(false); | 766 | try testing.expect(false); |
| 767 | } | 767 | } |
| 768 | }, | 768 | }, |
| 769 | 0x22222222 => { | 769 | 0x22222222 => { |
| 770 | if (cqe.res != -@as(i32, @intFromEnum(linux.E.ALREADY)) and | 770 | if (cqe.res != -@as(i32, @backingInt(linux.E.ALREADY)) and |
| 771 | cqe.res != -@as(i32, @intFromEnum(linux.E.TIME))) | 771 | cqe.res != -@as(i32, @backingInt(linux.E.TIME))) |
| 772 | { | 772 | { |
| 773 | std.debug.print("Req 0x{x} got {d}\n", .{ cqe.user_data, cqe.res }); | 773 | std.debug.print("Req 0x{x} got {d}\n", .{ cqe.user_data, cqe.res }); |
| 774 | try testing.expect(false); | 774 | try testing.expect(false); |
| ... | @@ -922,7 +922,7 @@ test "accept/connect/recv/cancel" { | ... | @@ -922,7 +922,7 @@ test "accept/connect/recv/cancel" { |
| 922 | 922 | ||
| 923 | try testing.expectEqual(linux.io_uring_cqe{ | 923 | try testing.expectEqual(linux.io_uring_cqe{ |
| 924 | .user_data = 0xffffffff, | 924 | .user_data = 0xffffffff, |
| 925 | .res = -@as(i32, @intFromEnum(linux.E.CANCELED)), | 925 | .res = -@as(i32, @backingInt(linux.E.CANCELED)), |
| 926 | .flags = 0, | 926 | .flags = 0, |
| 927 | }, cqe_recv); | 927 | }, cqe_recv); |
| 928 | 928 |
lib/std/os/linux/aarch64.zig+9-9| ... | @@ -9,7 +9,7 @@ pub fn syscall0( | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u64 { | 9 | ) u64 { |
| 10 | return asm volatile ("svc #0" | 10 | return asm volatile ("svc #0" |
| 11 | : [ret] "={x0}" (-> u64), | 11 | : [ret] "={x0}" (-> u64), |
| 12 | : [number] "{x8}" (@intFromEnum(number)), | 12 | : [number] "{x8}" (@backingInt(number)), |
| 13 | : .{ .memory = true }); | 13 | : .{ .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u64 { | 19 | ) u64 { |
| 20 | return asm volatile ("svc #0" | 20 | return asm volatile ("svc #0" |
| 21 | : [ret] "={x0}" (-> u64), | 21 | : [ret] "={x0}" (-> u64), |
| 22 | : [number] "{x8}" (@intFromEnum(number)), | 22 | : [number] "{x8}" (@backingInt(number)), |
| 23 | [arg1] "{x0}" (arg1), | 23 | [arg1] "{x0}" (arg1), |
| 24 | : .{ .memory = true }); | 24 | : .{ .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u64 { | 31 | ) u64 { |
| 32 | return asm volatile ("svc #0" | 32 | return asm volatile ("svc #0" |
| 33 | : [ret] "={x0}" (-> u64), | 33 | : [ret] "={x0}" (-> u64), |
| 34 | : [number] "{x8}" (@intFromEnum(number)), | 34 | : [number] "{x8}" (@backingInt(number)), |
| 35 | [arg1] "{x0}" (arg1), | 35 | [arg1] "{x0}" (arg1), |
| 36 | [arg2] "{x1}" (arg2), | 36 | [arg2] "{x1}" (arg2), |
| 37 | : .{ .memory = true }); | 37 | : .{ .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u64 { | 45 | ) u64 { |
| 46 | return asm volatile ("svc #0" | 46 | return asm volatile ("svc #0" |
| 47 | : [ret] "={x0}" (-> u64), | 47 | : [ret] "={x0}" (-> u64), |
| 48 | : [number] "{x8}" (@intFromEnum(number)), | 48 | : [number] "{x8}" (@backingInt(number)), |
| 49 | [arg1] "{x0}" (arg1), | 49 | [arg1] "{x0}" (arg1), |
| 50 | [arg2] "{x1}" (arg2), | 50 | [arg2] "{x1}" (arg2), |
| 51 | [arg3] "{x2}" (arg3), | 51 | [arg3] "{x2}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u64 { | 61 | ) u64 { |
| 62 | return asm volatile ("svc #0" | 62 | return asm volatile ("svc #0" |
| 63 | : [ret] "={x0}" (-> u64), | 63 | : [ret] "={x0}" (-> u64), |
| 64 | : [number] "{x8}" (@intFromEnum(number)), | 64 | : [number] "{x8}" (@backingInt(number)), |
| 65 | [arg1] "{x0}" (arg1), | 65 | [arg1] "{x0}" (arg1), |
| 66 | [arg2] "{x1}" (arg2), | 66 | [arg2] "{x1}" (arg2), |
| 67 | [arg3] "{x2}" (arg3), | 67 | [arg3] "{x2}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u64 { | 79 | ) u64 { |
| 80 | return asm volatile ("svc #0" | 80 | return asm volatile ("svc #0" |
| 81 | : [ret] "={x0}" (-> u64), | 81 | : [ret] "={x0}" (-> u64), |
| 82 | : [number] "{x8}" (@intFromEnum(number)), | 82 | : [number] "{x8}" (@backingInt(number)), |
| 83 | [arg1] "{x0}" (arg1), | 83 | [arg1] "{x0}" (arg1), |
| 84 | [arg2] "{x1}" (arg2), | 84 | [arg2] "{x1}" (arg2), |
| 85 | [arg3] "{x2}" (arg3), | 85 | [arg3] "{x2}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u64 { | 99 | ) u64 { |
| 100 | return asm volatile ("svc #0" | 100 | return asm volatile ("svc #0" |
| 101 | : [ret] "={x0}" (-> u64), | 101 | : [ret] "={x0}" (-> u64), |
| 102 | : [number] "{x8}" (@intFromEnum(number)), | 102 | : [number] "{x8}" (@backingInt(number)), |
| 103 | [arg1] "{x0}" (arg1), | 103 | [arg1] "{x0}" (arg1), |
| 104 | [arg2] "{x1}" (arg2), | 104 | [arg2] "{x1}" (arg2), |
| 105 | [arg3] "{x2}" (arg3), | 105 | [arg3] "{x2}" (arg3), |
| ... | @@ -157,12 +157,12 @@ pub fn restore_rt() callconv(.naked) noreturn { | ... | @@ -157,12 +157,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 157 | \\ mov x8, %[number] | 157 | \\ mov x8, %[number] |
| 158 | \\ svc #0 | 158 | \\ svc #0 |
| 159 | : | 159 | : |
| 160 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | 160 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), |
| 161 | ), | 161 | ), |
| 162 | else => asm volatile ( | 162 | else => asm volatile ( |
| 163 | \\ svc #0 | 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,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u32 { | 9 | ) u32 { |
| 10 | return asm volatile ("trap_s 0" | 10 | return asm volatile ("trap_s 0" |
| 11 | : [ret] "={r0}" (-> u32), | 11 | : [ret] "={r0}" (-> u32), |
| 12 | : [number] "{r8}" (@intFromEnum(number)), | 12 | : [number] "{r8}" (@backingInt(number)), |
| 13 | : .{ .memory = true }); | 13 | : .{ .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u32 { | 19 | ) u32 { |
| 20 | return asm volatile ("trap_s 0" | 20 | return asm volatile ("trap_s 0" |
| 21 | : [ret] "={r0}" (-> u32), | 21 | : [ret] "={r0}" (-> u32), |
| 22 | : [number] "{r8}" (@intFromEnum(number)), | 22 | : [number] "{r8}" (@backingInt(number)), |
| 23 | [arg1] "{r0}" (arg1), | 23 | [arg1] "{r0}" (arg1), |
| 24 | : .{ .memory = true }); | 24 | : .{ .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u32 { | 31 | ) u32 { |
| 32 | return asm volatile ("trap_s 0" | 32 | return asm volatile ("trap_s 0" |
| 33 | : [ret] "={r0}" (-> u32), | 33 | : [ret] "={r0}" (-> u32), |
| 34 | : [number] "{r8}" (@intFromEnum(number)), | 34 | : [number] "{r8}" (@backingInt(number)), |
| 35 | [arg1] "{r0}" (arg1), | 35 | [arg1] "{r0}" (arg1), |
| 36 | [arg2] "{r1}" (arg2), | 36 | [arg2] "{r1}" (arg2), |
| 37 | : .{ .memory = true }); | 37 | : .{ .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u32 { | 45 | ) u32 { |
| 46 | return asm volatile ("trap_s 0" | 46 | return asm volatile ("trap_s 0" |
| 47 | : [ret] "={r0}" (-> u32), | 47 | : [ret] "={r0}" (-> u32), |
| 48 | : [number] "{r8}" (@intFromEnum(number)), | 48 | : [number] "{r8}" (@backingInt(number)), |
| 49 | [arg1] "{r0}" (arg1), | 49 | [arg1] "{r0}" (arg1), |
| 50 | [arg2] "{r1}" (arg2), | 50 | [arg2] "{r1}" (arg2), |
| 51 | [arg3] "{r2}" (arg3), | 51 | [arg3] "{r2}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u32 { | 61 | ) u32 { |
| 62 | return asm volatile ("trap_s 0" | 62 | return asm volatile ("trap_s 0" |
| 63 | : [ret] "={r0}" (-> u32), | 63 | : [ret] "={r0}" (-> u32), |
| 64 | : [number] "{r8}" (@intFromEnum(number)), | 64 | : [number] "{r8}" (@backingInt(number)), |
| 65 | [arg1] "{r0}" (arg1), | 65 | [arg1] "{r0}" (arg1), |
| 66 | [arg2] "{r1}" (arg2), | 66 | [arg2] "{r1}" (arg2), |
| 67 | [arg3] "{r2}" (arg3), | 67 | [arg3] "{r2}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u32 { | 79 | ) u32 { |
| 80 | return asm volatile ("trap_s 0" | 80 | return asm volatile ("trap_s 0" |
| 81 | : [ret] "={r0}" (-> u32), | 81 | : [ret] "={r0}" (-> u32), |
| 82 | : [number] "{r8}" (@intFromEnum(number)), | 82 | : [number] "{r8}" (@backingInt(number)), |
| 83 | [arg1] "{r0}" (arg1), | 83 | [arg1] "{r0}" (arg1), |
| 84 | [arg2] "{r1}" (arg2), | 84 | [arg2] "{r1}" (arg2), |
| 85 | [arg3] "{r2}" (arg3), | 85 | [arg3] "{r2}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u32 { | 99 | ) u32 { |
| 100 | return asm volatile ("trap_s 0" | 100 | return asm volatile ("trap_s 0" |
| 101 | : [ret] "={r0}" (-> u32), | 101 | : [ret] "={r0}" (-> u32), |
| 102 | : [number] "{r8}" (@intFromEnum(number)), | 102 | : [number] "{r8}" (@backingInt(number)), |
| 103 | [arg1] "{r0}" (arg1), | 103 | [arg1] "{r0}" (arg1), |
| 104 | [arg2] "{r1}" (arg2), | 104 | [arg2] "{r1}" (arg2), |
| 105 | [arg3] "{r2}" (arg3), | 105 | [arg3] "{r2}" (arg3), |
| ... | @@ -158,12 +158,12 @@ pub fn restore_rt() callconv(.naked) noreturn { | ... | @@ -158,12 +158,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 158 | \\ mov r8, %[number] | 158 | \\ mov r8, %[number] |
| 159 | \\ trap_s 0 | 159 | \\ trap_s 0 |
| 160 | : | 160 | : |
| 161 | : [number] "I" (@intFromEnum(SYS.rt_sigreturn)), | 161 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), |
| 162 | ), | 162 | ), |
| 163 | else => asm volatile ( | 163 | else => asm volatile ( |
| 164 | \\ trap_s 0 | 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,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u32 { | 9 | ) u32 { |
| 10 | return asm volatile ("svc #0" | 10 | return asm volatile ("svc #0" |
| 11 | : [ret] "={r0}" (-> u32), | 11 | : [ret] "={r0}" (-> u32), |
| 12 | : [number] "{r7}" (@intFromEnum(number)), | 12 | : [number] "{r7}" (@backingInt(number)), |
| 13 | : .{ .memory = true }); | 13 | : .{ .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u32 { | 19 | ) u32 { |
| 20 | return asm volatile ("svc #0" | 20 | return asm volatile ("svc #0" |
| 21 | : [ret] "={r0}" (-> u32), | 21 | : [ret] "={r0}" (-> u32), |
| 22 | : [number] "{r7}" (@intFromEnum(number)), | 22 | : [number] "{r7}" (@backingInt(number)), |
| 23 | [arg1] "{r0}" (arg1), | 23 | [arg1] "{r0}" (arg1), |
| 24 | : .{ .memory = true }); | 24 | : .{ .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u32 { | 31 | ) u32 { |
| 32 | return asm volatile ("svc #0" | 32 | return asm volatile ("svc #0" |
| 33 | : [ret] "={r0}" (-> u32), | 33 | : [ret] "={r0}" (-> u32), |
| 34 | : [number] "{r7}" (@intFromEnum(number)), | 34 | : [number] "{r7}" (@backingInt(number)), |
| 35 | [arg1] "{r0}" (arg1), | 35 | [arg1] "{r0}" (arg1), |
| 36 | [arg2] "{r1}" (arg2), | 36 | [arg2] "{r1}" (arg2), |
| 37 | : .{ .memory = true }); | 37 | : .{ .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u32 { | 45 | ) u32 { |
| 46 | return asm volatile ("svc #0" | 46 | return asm volatile ("svc #0" |
| 47 | : [ret] "={r0}" (-> u32), | 47 | : [ret] "={r0}" (-> u32), |
| 48 | : [number] "{r7}" (@intFromEnum(number)), | 48 | : [number] "{r7}" (@backingInt(number)), |
| 49 | [arg1] "{r0}" (arg1), | 49 | [arg1] "{r0}" (arg1), |
| 50 | [arg2] "{r1}" (arg2), | 50 | [arg2] "{r1}" (arg2), |
| 51 | [arg3] "{r2}" (arg3), | 51 | [arg3] "{r2}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u32 { | 61 | ) u32 { |
| 62 | return asm volatile ("svc #0" | 62 | return asm volatile ("svc #0" |
| 63 | : [ret] "={r0}" (-> u32), | 63 | : [ret] "={r0}" (-> u32), |
| 64 | : [number] "{r7}" (@intFromEnum(number)), | 64 | : [number] "{r7}" (@backingInt(number)), |
| 65 | [arg1] "{r0}" (arg1), | 65 | [arg1] "{r0}" (arg1), |
| 66 | [arg2] "{r1}" (arg2), | 66 | [arg2] "{r1}" (arg2), |
| 67 | [arg3] "{r2}" (arg3), | 67 | [arg3] "{r2}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u32 { | 79 | ) u32 { |
| 80 | return asm volatile ("svc #0" | 80 | return asm volatile ("svc #0" |
| 81 | : [ret] "={r0}" (-> u32), | 81 | : [ret] "={r0}" (-> u32), |
| 82 | : [number] "{r7}" (@intFromEnum(number)), | 82 | : [number] "{r7}" (@backingInt(number)), |
| 83 | [arg1] "{r0}" (arg1), | 83 | [arg1] "{r0}" (arg1), |
| 84 | [arg2] "{r1}" (arg2), | 84 | [arg2] "{r1}" (arg2), |
| 85 | [arg3] "{r2}" (arg3), | 85 | [arg3] "{r2}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u32 { | 99 | ) u32 { |
| 100 | return asm volatile ("svc #0" | 100 | return asm volatile ("svc #0" |
| 101 | : [ret] "={r0}" (-> u32), | 101 | : [ret] "={r0}" (-> u32), |
| 102 | : [number] "{r7}" (@intFromEnum(number)), | 102 | : [number] "{r7}" (@backingInt(number)), |
| 103 | [arg1] "{r0}" (arg1), | 103 | [arg1] "{r0}" (arg1), |
| 104 | [arg2] "{r1}" (arg2), | 104 | [arg2] "{r1}" (arg2), |
| 105 | [arg3] "{r2}" (arg3), | 105 | [arg3] "{r2}" (arg3), |
| ... | @@ -151,12 +151,12 @@ pub fn restore() callconv(.naked) noreturn { | ... | @@ -151,12 +151,12 @@ pub fn restore() callconv(.naked) noreturn { |
| 151 | \\ mov r7, %[number] | 151 | \\ mov r7, %[number] |
| 152 | \\ svc #0 | 152 | \\ svc #0 |
| 153 | : | 153 | : |
| 154 | : [number] "I" (@intFromEnum(SYS.sigreturn)), | 154 | : [number] "I" (@backingInt(SYS.sigreturn)), |
| 155 | ), | 155 | ), |
| 156 | else => asm volatile ( | 156 | else => asm volatile ( |
| 157 | \\ svc #0 | 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,12 +167,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 167 | \\ mov r7, %[number] | 167 | \\ mov r7, %[number] |
| 168 | \\ svc #0 | 168 | \\ svc #0 |
| 169 | : | 169 | : |
| 170 | : [number] "I" (@intFromEnum(SYS.rt_sigreturn)), | 170 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), |
| 171 | ), | 171 | ), |
| 172 | else => asm volatile ( | 172 | else => asm volatile ( |
| 173 | \\ svc #0 | 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,10 +547,10 @@ pub const Insn = packed struct { |
| 547 | 547 | ||
| 548 | return Insn{ | 548 | return Insn{ |
| 549 | .code = code | src_type, | 549 | .code = code | src_type, |
| 550 | .dst = @intFromEnum(dst), | 550 | .dst = @backingInt(dst), |
| 551 | .src = switch (imm_or_reg) { | 551 | .src = switch (imm_or_reg) { |
| 552 | .imm => 0, | 552 | .imm => 0, |
| 553 | .reg => |r| @intFromEnum(r), | 553 | .reg => |r| @backingInt(r), |
| 554 | }, | 554 | }, |
| 555 | .off = off, | 555 | .off = off, |
| 556 | .imm = switch (imm_or_reg) { | 556 | .imm = switch (imm_or_reg) { |
| ... | @@ -567,7 +567,7 @@ pub const Insn = packed struct { | ... | @@ -567,7 +567,7 @@ pub const Insn = packed struct { |
| 567 | else => @compileError("width must be 32 or 64"), | 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 | pub fn mov(dst: Reg, src: anytype) Insn { | 573 | pub fn mov(dst: Reg, src: anytype) Insn { |
| ... | @@ -623,7 +623,7 @@ pub const Insn = packed struct { | ... | @@ -623,7 +623,7 @@ pub const Insn = packed struct { |
| 623 | } | 623 | } |
| 624 | 624 | ||
| 625 | pub fn jmp(op: JmpOp, dst: Reg, src: anytype, off: i16) Insn { | 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 | pub fn ja(off: i16) Insn { | 629 | pub fn ja(off: i16) Insn { |
| ... | @@ -677,8 +677,8 @@ pub const Insn = packed struct { | ... | @@ -677,8 +677,8 @@ pub const Insn = packed struct { |
| 677 | pub fn xadd(dst: Reg, src: Reg) Insn { | 677 | pub fn xadd(dst: Reg, src: Reg) Insn { |
| 678 | return Insn{ | 678 | return Insn{ |
| 679 | .code = STX | XADD | DW, | 679 | .code = STX | XADD | DW, |
| 680 | .dst = @intFromEnum(dst), | 680 | .dst = @backingInt(dst), |
| 681 | .src = @intFromEnum(src), | 681 | .src = @backingInt(src), |
| 682 | .off = 0, | 682 | .off = 0, |
| 683 | .imm = 0, | 683 | .imm = 0, |
| 684 | }; | 684 | }; |
| ... | @@ -686,9 +686,9 @@ pub const Insn = packed struct { | ... | @@ -686,9 +686,9 @@ pub const Insn = packed struct { |
| 686 | 686 | ||
| 687 | fn ld(mode: Mode, size: Size, dst: Reg, src: Reg, imm: i32) Insn { | 687 | fn ld(mode: Mode, size: Size, dst: Reg, src: Reg, imm: i32) Insn { |
| 688 | return Insn{ | 688 | return Insn{ |
| 689 | .code = @intFromEnum(mode) | @intFromEnum(size) | LD, | 689 | .code = @backingInt(mode) | @backingInt(size) | LD, |
| 690 | .dst = @intFromEnum(dst), | 690 | .dst = @backingInt(dst), |
| 691 | .src = @intFromEnum(src), | 691 | .src = @backingInt(src), |
| 692 | .off = 0, | 692 | .off = 0, |
| 693 | .imm = imm, | 693 | .imm = imm, |
| 694 | }; | 694 | }; |
| ... | @@ -704,9 +704,9 @@ pub const Insn = packed struct { | ... | @@ -704,9 +704,9 @@ pub const Insn = packed struct { |
| 704 | 704 | ||
| 705 | pub fn ldx(size: Size, dst: Reg, src: Reg, off: i16) Insn { | 705 | pub fn ldx(size: Size, dst: Reg, src: Reg, off: i16) Insn { |
| 706 | return Insn{ | 706 | return Insn{ |
| 707 | .code = MEM | @intFromEnum(size) | LDX, | 707 | .code = MEM | @backingInt(size) | LDX, |
| 708 | .dst = @intFromEnum(dst), | 708 | .dst = @backingInt(dst), |
| 709 | .src = @intFromEnum(src), | 709 | .src = @backingInt(src), |
| 710 | .off = off, | 710 | .off = off, |
| 711 | .imm = 0, | 711 | .imm = 0, |
| 712 | }; | 712 | }; |
| ... | @@ -715,8 +715,8 @@ pub const Insn = packed struct { | ... | @@ -715,8 +715,8 @@ pub const Insn = packed struct { |
| 715 | fn ld_imm_impl1(dst: Reg, src: Reg, imm: u64) Insn { | 715 | fn ld_imm_impl1(dst: Reg, src: Reg, imm: u64) Insn { |
| 716 | return Insn{ | 716 | return Insn{ |
| 717 | .code = LD | DW | IMM, | 717 | .code = LD | DW | IMM, |
| 718 | .dst = @intFromEnum(dst), | 718 | .dst = @backingInt(dst), |
| 719 | .src = @intFromEnum(src), | 719 | .src = @backingInt(src), |
| 720 | .off = 0, | 720 | .off = 0, |
| 721 | .imm = @as(i32, @bitCast(@as(u32, @truncate(imm)))), | 721 | .imm = @as(i32, @bitCast(@as(u32, @truncate(imm)))), |
| 722 | }; | 722 | }; |
| ... | @@ -741,7 +741,7 @@ pub const Insn = packed struct { | ... | @@ -741,7 +741,7 @@ pub const Insn = packed struct { |
| 741 | } | 741 | } |
| 742 | 742 | ||
| 743 | pub fn ld_map_fd1(dst: Reg, map_fd: fd_t) Insn { | 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 | pub fn ld_map_fd2(map_fd: fd_t) Insn { | 747 | pub fn ld_map_fd2(map_fd: fd_t) Insn { |
| ... | @@ -750,8 +750,8 @@ pub const Insn = packed struct { | ... | @@ -750,8 +750,8 @@ pub const Insn = packed struct { |
| 750 | 750 | ||
| 751 | pub fn st(size: Size, dst: Reg, off: i16, imm: i32) Insn { | 751 | pub fn st(size: Size, dst: Reg, off: i16, imm: i32) Insn { |
| 752 | return Insn{ | 752 | return Insn{ |
| 753 | .code = MEM | @intFromEnum(size) | ST, | 753 | .code = MEM | @backingInt(size) | ST, |
| 754 | .dst = @intFromEnum(dst), | 754 | .dst = @backingInt(dst), |
| 755 | .src = 0, | 755 | .src = 0, |
| 756 | .off = off, | 756 | .off = off, |
| 757 | .imm = imm, | 757 | .imm = imm, |
| ... | @@ -760,9 +760,9 @@ pub const Insn = packed struct { | ... | @@ -760,9 +760,9 @@ pub const Insn = packed struct { |
| 760 | 760 | ||
| 761 | pub fn stx(size: Size, dst: Reg, off: i16, src: Reg) Insn { | 761 | pub fn stx(size: Size, dst: Reg, off: i16, src: Reg) Insn { |
| 762 | return Insn{ | 762 | return Insn{ |
| 763 | .code = MEM | @intFromEnum(size) | STX, | 763 | .code = MEM | @backingInt(size) | STX, |
| 764 | .dst = @intFromEnum(dst), | 764 | .dst = @backingInt(dst), |
| 765 | .src = @intFromEnum(src), | 765 | .src = @backingInt(src), |
| 766 | .off = off, | 766 | .off = off, |
| 767 | .imm = 0, | 767 | .imm = 0, |
| 768 | }; | 768 | }; |
| ... | @@ -774,7 +774,7 @@ pub const Insn = packed struct { | ... | @@ -774,7 +774,7 @@ pub const Insn = packed struct { |
| 774 | .big => 0xdc, | 774 | .big => 0xdc, |
| 775 | .little => 0xd4, | 775 | .little => 0xd4, |
| 776 | }, | 776 | }, |
| 777 | .dst = @intFromEnum(dst), | 777 | .dst = @backingInt(dst), |
| 778 | .src = 0, | 778 | .src = 0, |
| 779 | .off = 0, | 779 | .off = 0, |
| 780 | .imm = switch (size) { | 780 | .imm = switch (size) { |
| ... | @@ -800,7 +800,7 @@ pub const Insn = packed struct { | ... | @@ -800,7 +800,7 @@ pub const Insn = packed struct { |
| 800 | .dst = 0, | 800 | .dst = 0, |
| 801 | .src = 0, | 801 | .src = 0, |
| 802 | .off = 0, | 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,7 +1614,7 @@ pub fn map_create(map_type: MapType, key_size: u32, value_size: u32, max_entries |
| 1614 | .map_create = std.mem.zeroes(MapCreateAttr), | 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 | attr.map_create.key_size = key_size; | 1618 | attr.map_create.key_size = key_size; |
| 1619 | attr.map_create.value_size = value_size; | 1619 | attr.map_create.value_size = value_size; |
| 1620 | attr.map_create.max_entries = max_entries; | 1620 | attr.map_create.max_entries = max_entries; |
| ... | @@ -1769,7 +1769,7 @@ pub fn prog_load( | ... | @@ -1769,7 +1769,7 @@ pub fn prog_load( |
| 1769 | .prog_load = std.mem.zeroes(ProgLoadAttr), | 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 | attr.prog_load.insns = @intFromPtr(insns.ptr); | 1773 | attr.prog_load.insns = @intFromPtr(insns.ptr); |
| 1774 | attr.prog_load.insn_cnt = @as(u32, @intCast(insns.len)); | 1774 | attr.prog_load.insn_cnt = @as(u32, @intCast(insns.len)); |
| 1775 | attr.prog_load.license = @intFromPtr(license.ptr); | 1775 | attr.prog_load.license = @intFromPtr(license.ptr); |
lib/std/os/linux/csky.zig+7-7| ... | @@ -9,7 +9,7 @@ pub fn syscall0( | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u32 { | 9 | ) u32 { |
| 10 | return asm volatile ("trap 0" | 10 | return asm volatile ("trap 0" |
| 11 | : [ret] "={r0}" (-> u32), | 11 | : [ret] "={r0}" (-> u32), |
| 12 | : [number] "{r7}" (@intFromEnum(number)), | 12 | : [number] "{r7}" (@backingInt(number)), |
| 13 | : .{ .memory = true }); | 13 | : .{ .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u32 { | 19 | ) u32 { |
| 20 | return asm volatile ("trap 0" | 20 | return asm volatile ("trap 0" |
| 21 | : [ret] "={r0}" (-> u32), | 21 | : [ret] "={r0}" (-> u32), |
| 22 | : [number] "{r7}" (@intFromEnum(number)), | 22 | : [number] "{r7}" (@backingInt(number)), |
| 23 | [arg1] "{r0}" (arg1), | 23 | [arg1] "{r0}" (arg1), |
| 24 | : .{ .memory = true }); | 24 | : .{ .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u32 { | 31 | ) u32 { |
| 32 | return asm volatile ("trap 0" | 32 | return asm volatile ("trap 0" |
| 33 | : [ret] "={r0}" (-> u32), | 33 | : [ret] "={r0}" (-> u32), |
| 34 | : [number] "{r7}" (@intFromEnum(number)), | 34 | : [number] "{r7}" (@backingInt(number)), |
| 35 | [arg1] "{r0}" (arg1), | 35 | [arg1] "{r0}" (arg1), |
| 36 | [arg2] "{r1}" (arg2), | 36 | [arg2] "{r1}" (arg2), |
| 37 | : .{ .memory = true }); | 37 | : .{ .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u32 { | 45 | ) u32 { |
| 46 | return asm volatile ("trap 0" | 46 | return asm volatile ("trap 0" |
| 47 | : [ret] "={r0}" (-> u32), | 47 | : [ret] "={r0}" (-> u32), |
| 48 | : [number] "{r7}" (@intFromEnum(number)), | 48 | : [number] "{r7}" (@backingInt(number)), |
| 49 | [arg1] "{r0}" (arg1), | 49 | [arg1] "{r0}" (arg1), |
| 50 | [arg2] "{r1}" (arg2), | 50 | [arg2] "{r1}" (arg2), |
| 51 | [arg3] "{r2}" (arg3), | 51 | [arg3] "{r2}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u32 { | 61 | ) u32 { |
| 62 | return asm volatile ("trap 0" | 62 | return asm volatile ("trap 0" |
| 63 | : [ret] "={r0}" (-> u32), | 63 | : [ret] "={r0}" (-> u32), |
| 64 | : [number] "{r7}" (@intFromEnum(number)), | 64 | : [number] "{r7}" (@backingInt(number)), |
| 65 | [arg1] "{r0}" (arg1), | 65 | [arg1] "{r0}" (arg1), |
| 66 | [arg2] "{r1}" (arg2), | 66 | [arg2] "{r1}" (arg2), |
| 67 | [arg3] "{r2}" (arg3), | 67 | [arg3] "{r2}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u32 { | 79 | ) u32 { |
| 80 | return asm volatile ("trap 0" | 80 | return asm volatile ("trap 0" |
| 81 | : [ret] "={r0}" (-> u32), | 81 | : [ret] "={r0}" (-> u32), |
| 82 | : [number] "{r7}" (@intFromEnum(number)), | 82 | : [number] "{r7}" (@backingInt(number)), |
| 83 | [arg1] "{r0}" (arg1), | 83 | [arg1] "{r0}" (arg1), |
| 84 | [arg2] "{r1}" (arg2), | 84 | [arg2] "{r1}" (arg2), |
| 85 | [arg3] "{r2}" (arg3), | 85 | [arg3] "{r2}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u32 { | 99 | ) u32 { |
| 100 | return asm volatile ("trap 0" | 100 | return asm volatile ("trap 0" |
| 101 | : [ret] "={r0}" (-> u32), | 101 | : [ret] "={r0}" (-> u32), |
| 102 | : [number] "{r7}" (@intFromEnum(number)), | 102 | : [number] "{r7}" (@backingInt(number)), |
| 103 | [arg1] "{r0}" (arg1), | 103 | [arg1] "{r0}" (arg1), |
| 104 | [arg2] "{r1}" (arg2), | 104 | [arg2] "{r1}" (arg2), |
| 105 | [arg3] "{r2}" (arg3), | 105 | [arg3] "{r2}" (arg3), |
lib/std/os/linux/hexagon.zig+7-7| ... | @@ -9,7 +9,7 @@ pub fn syscall0( | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u32 { | 9 | ) u32 { |
| 10 | return asm volatile ("trap0(#1)" | 10 | return asm volatile ("trap0(#1)" |
| 11 | : [ret] "={r0}" (-> u32), | 11 | : [ret] "={r0}" (-> u32), |
| 12 | : [number] "{r6}" (@intFromEnum(number)), | 12 | : [number] "{r6}" (@backingInt(number)), |
| 13 | : .{ .memory = true }); | 13 | : .{ .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u32 { | 19 | ) u32 { |
| 20 | return asm volatile ("trap0(#1)" | 20 | return asm volatile ("trap0(#1)" |
| 21 | : [ret] "={r0}" (-> u32), | 21 | : [ret] "={r0}" (-> u32), |
| 22 | : [number] "{r6}" (@intFromEnum(number)), | 22 | : [number] "{r6}" (@backingInt(number)), |
| 23 | [arg1] "{r0}" (arg1), | 23 | [arg1] "{r0}" (arg1), |
| 24 | : .{ .memory = true }); | 24 | : .{ .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u32 { | 31 | ) u32 { |
| 32 | return asm volatile ("trap0(#1)" | 32 | return asm volatile ("trap0(#1)" |
| 33 | : [ret] "={r0}" (-> u32), | 33 | : [ret] "={r0}" (-> u32), |
| 34 | : [number] "{r6}" (@intFromEnum(number)), | 34 | : [number] "{r6}" (@backingInt(number)), |
| 35 | [arg1] "{r0}" (arg1), | 35 | [arg1] "{r0}" (arg1), |
| 36 | [arg2] "{r1}" (arg2), | 36 | [arg2] "{r1}" (arg2), |
| 37 | : .{ .memory = true }); | 37 | : .{ .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u32 { | 45 | ) u32 { |
| 46 | return asm volatile ("trap0(#1)" | 46 | return asm volatile ("trap0(#1)" |
| 47 | : [ret] "={r0}" (-> u32), | 47 | : [ret] "={r0}" (-> u32), |
| 48 | : [number] "{r6}" (@intFromEnum(number)), | 48 | : [number] "{r6}" (@backingInt(number)), |
| 49 | [arg1] "{r0}" (arg1), | 49 | [arg1] "{r0}" (arg1), |
| 50 | [arg2] "{r1}" (arg2), | 50 | [arg2] "{r1}" (arg2), |
| 51 | [arg3] "{r2}" (arg3), | 51 | [arg3] "{r2}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u32 { | 61 | ) u32 { |
| 62 | return asm volatile ("trap0(#1)" | 62 | return asm volatile ("trap0(#1)" |
| 63 | : [ret] "={r0}" (-> u32), | 63 | : [ret] "={r0}" (-> u32), |
| 64 | : [number] "{r6}" (@intFromEnum(number)), | 64 | : [number] "{r6}" (@backingInt(number)), |
| 65 | [arg1] "{r0}" (arg1), | 65 | [arg1] "{r0}" (arg1), |
| 66 | [arg2] "{r1}" (arg2), | 66 | [arg2] "{r1}" (arg2), |
| 67 | [arg3] "{r2}" (arg3), | 67 | [arg3] "{r2}" (arg3), |
| ... | @@ -72,7 +72,7 @@ pub fn syscall4( | ... | @@ -72,7 +72,7 @@ pub fn syscall4( |
| 72 | pub fn syscall5(number: SYS, arg1: u32, arg2: u32, arg3: u32, arg4: u32, arg5: u32) u32 { | 72 | pub fn syscall5(number: SYS, arg1: u32, arg2: u32, arg3: u32, arg4: u32, arg5: u32) u32 { |
| 73 | return asm volatile ("trap0(#1)" | 73 | return asm volatile ("trap0(#1)" |
| 74 | : [ret] "={r0}" (-> u32), | 74 | : [ret] "={r0}" (-> u32), |
| 75 | : [number] "{r6}" (@intFromEnum(number)), | 75 | : [number] "{r6}" (@backingInt(number)), |
| 76 | [arg1] "{r0}" (arg1), | 76 | [arg1] "{r0}" (arg1), |
| 77 | [arg2] "{r1}" (arg2), | 77 | [arg2] "{r1}" (arg2), |
| 78 | [arg3] "{r2}" (arg3), | 78 | [arg3] "{r2}" (arg3), |
| ... | @@ -92,7 +92,7 @@ pub fn syscall6( | ... | @@ -92,7 +92,7 @@ pub fn syscall6( |
| 92 | ) u32 { | 92 | ) u32 { |
| 93 | return asm volatile ("trap0(#1)" | 93 | return asm volatile ("trap0(#1)" |
| 94 | : [ret] "={r0}" (-> u32), | 94 | : [ret] "={r0}" (-> u32), |
| 95 | : [number] "{r6}" (@intFromEnum(number)), | 95 | : [number] "{r6}" (@backingInt(number)), |
| 96 | [arg1] "{r0}" (arg1), | 96 | [arg1] "{r0}" (arg1), |
| 97 | [arg2] "{r1}" (arg2), | 97 | [arg2] "{r1}" (arg2), |
| 98 | [arg3] "{r2}" (arg3), | 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,7 +615,7 @@ pub const io_uring_sqe = extern struct { |
| 615 | options: u32, | 615 | options: u32, |
| 616 | flags: u32, | 616 | flags: u32, |
| 617 | ) void { | 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 | sqe.rw_flags = flags; | 619 | sqe.rw_flags = flags; |
| 620 | sqe.splice_fd_in = @bitCast(options); | 620 | sqe.splice_fd_in = @bitCast(options); |
| 621 | } | 621 | } |
| ... | @@ -652,7 +652,7 @@ pub const io_uring_sqe = extern struct { | ... | @@ -652,7 +652,7 @@ pub const io_uring_sqe = extern struct { |
| 652 | ) void { | 652 | ) void { |
| 653 | sqe.prep_rw(.URING_CMD, fd, 0, 0, 0); | 653 | sqe.prep_rw(.URING_CMD, fd, 0, 0, 0); |
| 654 | // off is overloaded with cmd_op, https://github.com/axboe/liburing/blob/e1003e496e66f9b0ae06674869795edf772d5500/src/include/liburing/io_uring.h#L39 | 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 | // addr is overloaded, https://github.com/axboe/liburing/blob/e1003e496e66f9b0ae06674869795edf772d5500/src/include/liburing/io_uring.h#L46 | 656 | // addr is overloaded, https://github.com/axboe/liburing/blob/e1003e496e66f9b0ae06674869795edf772d5500/src/include/liburing/io_uring.h#L46 |
| 657 | sqe.addr = @bitCast(packed struct { | 657 | sqe.addr = @bitCast(packed struct { |
| 658 | level: u32, | 658 | level: u32, |
lib/std/os/linux/loongarch32.zig+7-7| ... | @@ -10,7 +10,7 @@ pub fn syscall0( | ... | @@ -10,7 +10,7 @@ pub fn syscall0( |
| 10 | return asm volatile ( | 10 | return asm volatile ( |
| 11 | \\ syscall 0 | 11 | \\ syscall 0 |
| 12 | : [ret] "={$r4}" (-> u32), | 12 | : [ret] "={$r4}" (-> u32), |
| 13 | : [number] "{$r11}" (@intFromEnum(number)), | 13 | : [number] "{$r11}" (@backingInt(number)), |
| 14 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); | 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,7 +21,7 @@ pub fn syscall1( |
| 21 | return asm volatile ( | 21 | return asm volatile ( |
| 22 | \\ syscall 0 | 22 | \\ syscall 0 |
| 23 | : [ret] "={$r4}" (-> u32), | 23 | : [ret] "={$r4}" (-> u32), |
| 24 | : [number] "{$r11}" (@intFromEnum(number)), | 24 | : [number] "{$r11}" (@backingInt(number)), |
| 25 | [arg1] "{$r4}" (arg1), | 25 | [arg1] "{$r4}" (arg1), |
| 26 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); | 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,7 +34,7 @@ pub fn syscall2( |
| 34 | return asm volatile ( | 34 | return asm volatile ( |
| 35 | \\ syscall 0 | 35 | \\ syscall 0 |
| 36 | : [ret] "={$r4}" (-> u32), | 36 | : [ret] "={$r4}" (-> u32), |
| 37 | : [number] "{$r11}" (@intFromEnum(number)), | 37 | : [number] "{$r11}" (@backingInt(number)), |
| 38 | [arg1] "{$r4}" (arg1), | 38 | [arg1] "{$r4}" (arg1), |
| 39 | [arg2] "{$r5}" (arg2), | 39 | [arg2] "{$r5}" (arg2), |
| 40 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); | 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,7 +49,7 @@ pub fn syscall3( |
| 49 | return asm volatile ( | 49 | return asm volatile ( |
| 50 | \\ syscall 0 | 50 | \\ syscall 0 |
| 51 | : [ret] "={$r4}" (-> u32), | 51 | : [ret] "={$r4}" (-> u32), |
| 52 | : [number] "{$r11}" (@intFromEnum(number)), | 52 | : [number] "{$r11}" (@backingInt(number)), |
| 53 | [arg1] "{$r4}" (arg1), | 53 | [arg1] "{$r4}" (arg1), |
| 54 | [arg2] "{$r5}" (arg2), | 54 | [arg2] "{$r5}" (arg2), |
| 55 | [arg3] "{$r6}" (arg3), | 55 | [arg3] "{$r6}" (arg3), |
| ... | @@ -66,7 +66,7 @@ pub fn syscall4( | ... | @@ -66,7 +66,7 @@ pub fn syscall4( |
| 66 | return asm volatile ( | 66 | return asm volatile ( |
| 67 | \\ syscall 0 | 67 | \\ syscall 0 |
| 68 | : [ret] "={$r4}" (-> u32), | 68 | : [ret] "={$r4}" (-> u32), |
| 69 | : [number] "{$r11}" (@intFromEnum(number)), | 69 | : [number] "{$r11}" (@backingInt(number)), |
| 70 | [arg1] "{$r4}" (arg1), | 70 | [arg1] "{$r4}" (arg1), |
| 71 | [arg2] "{$r5}" (arg2), | 71 | [arg2] "{$r5}" (arg2), |
| 72 | [arg3] "{$r6}" (arg3), | 72 | [arg3] "{$r6}" (arg3), |
| ... | @@ -85,7 +85,7 @@ pub fn syscall5( | ... | @@ -85,7 +85,7 @@ pub fn syscall5( |
| 85 | return asm volatile ( | 85 | return asm volatile ( |
| 86 | \\ syscall 0 | 86 | \\ syscall 0 |
| 87 | : [ret] "={$r4}" (-> u32), | 87 | : [ret] "={$r4}" (-> u32), |
| 88 | : [number] "{$r11}" (@intFromEnum(number)), | 88 | : [number] "{$r11}" (@backingInt(number)), |
| 89 | [arg1] "{$r4}" (arg1), | 89 | [arg1] "{$r4}" (arg1), |
| 90 | [arg2] "{$r5}" (arg2), | 90 | [arg2] "{$r5}" (arg2), |
| 91 | [arg3] "{$r6}" (arg3), | 91 | [arg3] "{$r6}" (arg3), |
| ... | @@ -106,7 +106,7 @@ pub fn syscall6( | ... | @@ -106,7 +106,7 @@ pub fn syscall6( |
| 106 | return asm volatile ( | 106 | return asm volatile ( |
| 107 | \\ syscall 0 | 107 | \\ syscall 0 |
| 108 | : [ret] "={$r4}" (-> u32), | 108 | : [ret] "={$r4}" (-> u32), |
| 109 | : [number] "{$r11}" (@intFromEnum(number)), | 109 | : [number] "{$r11}" (@backingInt(number)), |
| 110 | [arg1] "{$r4}" (arg1), | 110 | [arg1] "{$r4}" (arg1), |
| 111 | [arg2] "{$r5}" (arg2), | 111 | [arg2] "{$r5}" (arg2), |
| 112 | [arg3] "{$r6}" (arg3), | 112 | [arg3] "{$r6}" (arg3), |
lib/std/os/linux/loongarch64.zig+7-7| ... | @@ -10,7 +10,7 @@ pub fn syscall0( | ... | @@ -10,7 +10,7 @@ pub fn syscall0( |
| 10 | return asm volatile ( | 10 | return asm volatile ( |
| 11 | \\ syscall 0 | 11 | \\ syscall 0 |
| 12 | : [ret] "={$r4}" (-> u64), | 12 | : [ret] "={$r4}" (-> u64), |
| 13 | : [number] "{$r11}" (@intFromEnum(number)), | 13 | : [number] "{$r11}" (@backingInt(number)), |
| 14 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); | 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,7 +21,7 @@ pub fn syscall1( |
| 21 | return asm volatile ( | 21 | return asm volatile ( |
| 22 | \\ syscall 0 | 22 | \\ syscall 0 |
| 23 | : [ret] "={$r4}" (-> u64), | 23 | : [ret] "={$r4}" (-> u64), |
| 24 | : [number] "{$r11}" (@intFromEnum(number)), | 24 | : [number] "{$r11}" (@backingInt(number)), |
| 25 | [arg1] "{$r4}" (arg1), | 25 | [arg1] "{$r4}" (arg1), |
| 26 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); | 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,7 +34,7 @@ pub fn syscall2( |
| 34 | return asm volatile ( | 34 | return asm volatile ( |
| 35 | \\ syscall 0 | 35 | \\ syscall 0 |
| 36 | : [ret] "={$r4}" (-> u64), | 36 | : [ret] "={$r4}" (-> u64), |
| 37 | : [number] "{$r11}" (@intFromEnum(number)), | 37 | : [number] "{$r11}" (@backingInt(number)), |
| 38 | [arg1] "{$r4}" (arg1), | 38 | [arg1] "{$r4}" (arg1), |
| 39 | [arg2] "{$r5}" (arg2), | 39 | [arg2] "{$r5}" (arg2), |
| 40 | : .{ .r12 = true, .r13 = true, .r14 = true, .r15 = true, .r16 = true, .r17 = true, .r18 = true, .r19 = true, .r20 = true, .memory = true }); | 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,7 +49,7 @@ pub fn syscall3( |
| 49 | return asm volatile ( | 49 | return asm volatile ( |
| 50 | \\ syscall 0 | 50 | \\ syscall 0 |
| 51 | : [ret] "={$r4}" (-> u64), | 51 | : [ret] "={$r4}" (-> u64), |
| 52 | : [number] "{$r11}" (@intFromEnum(number)), | 52 | : [number] "{$r11}" (@backingInt(number)), |
| 53 | [arg1] "{$r4}" (arg1), | 53 | [arg1] "{$r4}" (arg1), |
| 54 | [arg2] "{$r5}" (arg2), | 54 | [arg2] "{$r5}" (arg2), |
| 55 | [arg3] "{$r6}" (arg3), | 55 | [arg3] "{$r6}" (arg3), |
| ... | @@ -66,7 +66,7 @@ pub fn syscall4( | ... | @@ -66,7 +66,7 @@ pub fn syscall4( |
| 66 | return asm volatile ( | 66 | return asm volatile ( |
| 67 | \\ syscall 0 | 67 | \\ syscall 0 |
| 68 | : [ret] "={$r4}" (-> u64), | 68 | : [ret] "={$r4}" (-> u64), |
| 69 | : [number] "{$r11}" (@intFromEnum(number)), | 69 | : [number] "{$r11}" (@backingInt(number)), |
| 70 | [arg1] "{$r4}" (arg1), | 70 | [arg1] "{$r4}" (arg1), |
| 71 | [arg2] "{$r5}" (arg2), | 71 | [arg2] "{$r5}" (arg2), |
| 72 | [arg3] "{$r6}" (arg3), | 72 | [arg3] "{$r6}" (arg3), |
| ... | @@ -85,7 +85,7 @@ pub fn syscall5( | ... | @@ -85,7 +85,7 @@ pub fn syscall5( |
| 85 | return asm volatile ( | 85 | return asm volatile ( |
| 86 | \\ syscall 0 | 86 | \\ syscall 0 |
| 87 | : [ret] "={$r4}" (-> u64), | 87 | : [ret] "={$r4}" (-> u64), |
| 88 | : [number] "{$r11}" (@intFromEnum(number)), | 88 | : [number] "{$r11}" (@backingInt(number)), |
| 89 | [arg1] "{$r4}" (arg1), | 89 | [arg1] "{$r4}" (arg1), |
| 90 | [arg2] "{$r5}" (arg2), | 90 | [arg2] "{$r5}" (arg2), |
| 91 | [arg3] "{$r6}" (arg3), | 91 | [arg3] "{$r6}" (arg3), |
| ... | @@ -106,7 +106,7 @@ pub fn syscall6( | ... | @@ -106,7 +106,7 @@ pub fn syscall6( |
| 106 | return asm volatile ( | 106 | return asm volatile ( |
| 107 | \\ syscall 0 | 107 | \\ syscall 0 |
| 108 | : [ret] "={$r4}" (-> u64), | 108 | : [ret] "={$r4}" (-> u64), |
| 109 | : [number] "{$r11}" (@intFromEnum(number)), | 109 | : [number] "{$r11}" (@backingInt(number)), |
| 110 | [arg1] "{$r4}" (arg1), | 110 | [arg1] "{$r4}" (arg1), |
| 111 | [arg2] "{$r5}" (arg2), | 111 | [arg2] "{$r5}" (arg2), |
| 112 | [arg3] "{$r6}" (arg3), | 112 | [arg3] "{$r6}" (arg3), |
lib/std/os/linux/m68k.zig+8-8| ... | @@ -9,7 +9,7 @@ pub fn syscall0( | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u32 { | 9 | ) u32 { |
| 10 | return asm volatile ("trap #0" | 10 | return asm volatile ("trap #0" |
| 11 | : [ret] "={d0}" (-> u32), | 11 | : [ret] "={d0}" (-> u32), |
| 12 | : [number] "{d0}" (@intFromEnum(number)), | 12 | : [number] "{d0}" (@backingInt(number)), |
| 13 | : .{ .memory = true }); | 13 | : .{ .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u32 { | 19 | ) u32 { |
| 20 | return asm volatile ("trap #0" | 20 | return asm volatile ("trap #0" |
| 21 | : [ret] "={d0}" (-> u32), | 21 | : [ret] "={d0}" (-> u32), |
| 22 | : [number] "{d0}" (@intFromEnum(number)), | 22 | : [number] "{d0}" (@backingInt(number)), |
| 23 | [arg1] "{d1}" (arg1), | 23 | [arg1] "{d1}" (arg1), |
| 24 | : .{ .memory = true }); | 24 | : .{ .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u32 { | 31 | ) u32 { |
| 32 | return asm volatile ("trap #0" | 32 | return asm volatile ("trap #0" |
| 33 | : [ret] "={d0}" (-> u32), | 33 | : [ret] "={d0}" (-> u32), |
| 34 | : [number] "{d0}" (@intFromEnum(number)), | 34 | : [number] "{d0}" (@backingInt(number)), |
| 35 | [arg1] "{d1}" (arg1), | 35 | [arg1] "{d1}" (arg1), |
| 36 | [arg2] "{d2}" (arg2), | 36 | [arg2] "{d2}" (arg2), |
| 37 | : .{ .memory = true }); | 37 | : .{ .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u32 { | 45 | ) u32 { |
| 46 | return asm volatile ("trap #0" | 46 | return asm volatile ("trap #0" |
| 47 | : [ret] "={d0}" (-> u32), | 47 | : [ret] "={d0}" (-> u32), |
| 48 | : [number] "{d0}" (@intFromEnum(number)), | 48 | : [number] "{d0}" (@backingInt(number)), |
| 49 | [arg1] "{d1}" (arg1), | 49 | [arg1] "{d1}" (arg1), |
| 50 | [arg2] "{d2}" (arg2), | 50 | [arg2] "{d2}" (arg2), |
| 51 | [arg3] "{d3}" (arg3), | 51 | [arg3] "{d3}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u32 { | 61 | ) u32 { |
| 62 | return asm volatile ("trap #0" | 62 | return asm volatile ("trap #0" |
| 63 | : [ret] "={d0}" (-> u32), | 63 | : [ret] "={d0}" (-> u32), |
| 64 | : [number] "{d0}" (@intFromEnum(number)), | 64 | : [number] "{d0}" (@backingInt(number)), |
| 65 | [arg1] "{d1}" (arg1), | 65 | [arg1] "{d1}" (arg1), |
| 66 | [arg2] "{d2}" (arg2), | 66 | [arg2] "{d2}" (arg2), |
| 67 | [arg3] "{d3}" (arg3), | 67 | [arg3] "{d3}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u32 { | 79 | ) u32 { |
| 80 | return asm volatile ("trap #0" | 80 | return asm volatile ("trap #0" |
| 81 | : [ret] "={d0}" (-> u32), | 81 | : [ret] "={d0}" (-> u32), |
| 82 | : [number] "{d0}" (@intFromEnum(number)), | 82 | : [number] "{d0}" (@backingInt(number)), |
| 83 | [arg1] "{d1}" (arg1), | 83 | [arg1] "{d1}" (arg1), |
| 84 | [arg2] "{d2}" (arg2), | 84 | [arg2] "{d2}" (arg2), |
| 85 | [arg3] "{d3}" (arg3), | 85 | [arg3] "{d3}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u32 { | 99 | ) u32 { |
| 100 | return asm volatile ("trap #0" | 100 | return asm volatile ("trap #0" |
| 101 | : [ret] "={d0}" (-> u32), | 101 | : [ret] "={d0}" (-> u32), |
| 102 | : [number] "{d0}" (@intFromEnum(number)), | 102 | : [number] "{d0}" (@backingInt(number)), |
| 103 | [arg1] "{d1}" (arg1), | 103 | [arg1] "{d1}" (arg1), |
| 104 | [arg2] "{d2}" (arg2), | 104 | [arg2] "{d2}" (arg2), |
| 105 | [arg3] "{d3}" (arg3), | 105 | [arg3] "{d3}" (arg3), |
| ... | @@ -167,7 +167,7 @@ pub const restore = restore_rt; | ... | @@ -167,7 +167,7 @@ pub const restore = restore_rt; |
| 167 | pub fn restore_rt() callconv(.naked) noreturn { | 167 | pub fn restore_rt() callconv(.naked) noreturn { |
| 168 | asm volatile ("trap #0" | 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,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u32 { | 9 | ) u32 { |
| 10 | return asm volatile ("brki r14, 0x8" | 10 | return asm volatile ("brki r14, 0x8" |
| 11 | : [ret] "={r3}" (-> u32), | 11 | : [ret] "={r3}" (-> u32), |
| 12 | : [number] "{r12}" (@intFromEnum(number)), | 12 | : [number] "{r12}" (@backingInt(number)), |
| 13 | : .{ .r4 = true, .memory = true }); | 13 | : .{ .r4 = true, .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u32 { | 19 | ) u32 { |
| 20 | return asm volatile ("brki r14, 0x8" | 20 | return asm volatile ("brki r14, 0x8" |
| 21 | : [ret] "={r3}" (-> u32), | 21 | : [ret] "={r3}" (-> u32), |
| 22 | : [number] "{r12}" (@intFromEnum(number)), | 22 | : [number] "{r12}" (@backingInt(number)), |
| 23 | [arg1] "{r5}" (arg1), | 23 | [arg1] "{r5}" (arg1), |
| 24 | : .{ .r4 = true, .memory = true }); | 24 | : .{ .r4 = true, .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u32 { | 31 | ) u32 { |
| 32 | return asm volatile ("brki r14, 0x8" | 32 | return asm volatile ("brki r14, 0x8" |
| 33 | : [ret] "={r3}" (-> u32), | 33 | : [ret] "={r3}" (-> u32), |
| 34 | : [number] "{r12}" (@intFromEnum(number)), | 34 | : [number] "{r12}" (@backingInt(number)), |
| 35 | [arg1] "{r5}" (arg1), | 35 | [arg1] "{r5}" (arg1), |
| 36 | [arg2] "{r6}" (arg2), | 36 | [arg2] "{r6}" (arg2), |
| 37 | : .{ .r4 = true, .memory = true }); | 37 | : .{ .r4 = true, .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u32 { | 45 | ) u32 { |
| 46 | return asm volatile ("brki r14, 0x8" | 46 | return asm volatile ("brki r14, 0x8" |
| 47 | : [ret] "={r3}" (-> u32), | 47 | : [ret] "={r3}" (-> u32), |
| 48 | : [number] "{r12}" (@intFromEnum(number)), | 48 | : [number] "{r12}" (@backingInt(number)), |
| 49 | [arg1] "{r5}" (arg1), | 49 | [arg1] "{r5}" (arg1), |
| 50 | [arg2] "{r6}" (arg2), | 50 | [arg2] "{r6}" (arg2), |
| 51 | [arg3] "{r7}" (arg3), | 51 | [arg3] "{r7}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u32 { | 61 | ) u32 { |
| 62 | return asm volatile ("brki r14, 0x8" | 62 | return asm volatile ("brki r14, 0x8" |
| 63 | : [ret] "={r3}" (-> u32), | 63 | : [ret] "={r3}" (-> u32), |
| 64 | : [number] "{r12}" (@intFromEnum(number)), | 64 | : [number] "{r12}" (@backingInt(number)), |
| 65 | [arg1] "{r5}" (arg1), | 65 | [arg1] "{r5}" (arg1), |
| 66 | [arg2] "{r6}" (arg2), | 66 | [arg2] "{r6}" (arg2), |
| 67 | [arg3] "{r7}" (arg3), | 67 | [arg3] "{r7}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u32 { | 79 | ) u32 { |
| 80 | return asm volatile ("brki r14, 0x8" | 80 | return asm volatile ("brki r14, 0x8" |
| 81 | : [ret] "={r3}" (-> u32), | 81 | : [ret] "={r3}" (-> u32), |
| 82 | : [number] "{r12}" (@intFromEnum(number)), | 82 | : [number] "{r12}" (@backingInt(number)), |
| 83 | [arg1] "{r5}" (arg1), | 83 | [arg1] "{r5}" (arg1), |
| 84 | [arg2] "{r6}" (arg2), | 84 | [arg2] "{r6}" (arg2), |
| 85 | [arg3] "{r7}" (arg3), | 85 | [arg3] "{r7}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u32 { | 99 | ) u32 { |
| 100 | return asm volatile ("brki r14, 0x8" | 100 | return asm volatile ("brki r14, 0x8" |
| 101 | : [ret] "={r3}" (-> u32), | 101 | : [ret] "={r3}" (-> u32), |
| 102 | : [number] "{r12}" (@intFromEnum(number)), | 102 | : [number] "{r12}" (@backingInt(number)), |
| 103 | [arg1] "{r5}" (arg1), | 103 | [arg1] "{r5}" (arg1), |
| 104 | [arg2] "{r6}" (arg2), | 104 | [arg2] "{r6}" (arg2), |
| 105 | [arg3] "{r7}" (arg3), | 105 | [arg3] "{r7}" (arg3), |
| ... | @@ -153,7 +153,7 @@ pub fn restore() callconv(.naked) noreturn { | ... | @@ -153,7 +153,7 @@ pub fn restore() callconv(.naked) noreturn { |
| 153 | asm volatile ( | 153 | asm volatile ( |
| 154 | \\ brki r14, 0x8 | 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,7 +161,7 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 161 | asm volatile ( | 161 | asm volatile ( |
| 162 | \\ brki r14, 0x8 | 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,7 +14,7 @@ pub fn syscall0( |
| 14 | \\ subu $v0, $zero, $v0 | 14 | \\ subu $v0, $zero, $v0 |
| 15 | \\1: | 15 | \\1: |
| 16 | : [ret] "={$2}" (-> u32), | 16 | : [ret] "={$2}" (-> u32), |
| 17 | : [number] "{$2}" (@intFromEnum(number)), | 17 | : [number] "{$2}" (@backingInt(number)), |
| 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 }); | 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,7 +29,7 @@ pub fn syscall1( |
| 29 | \\ subu $v0, $zero, $v0 | 29 | \\ subu $v0, $zero, $v0 |
| 30 | \\1: | 30 | \\1: |
| 31 | : [ret] "={$2}" (-> u32), | 31 | : [ret] "={$2}" (-> u32), |
| 32 | : [number] "{$2}" (@intFromEnum(number)), | 32 | : [number] "{$2}" (@backingInt(number)), |
| 33 | [arg1] "{$4}" (arg1), | 33 | [arg1] "{$4}" (arg1), |
| 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 }); | 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,7 +46,7 @@ pub fn syscall2( |
| 46 | \\ subu $v0, $zero, $v0 | 46 | \\ subu $v0, $zero, $v0 |
| 47 | \\1: | 47 | \\1: |
| 48 | : [ret] "={$2}" (-> u32), | 48 | : [ret] "={$2}" (-> u32), |
| 49 | : [number] "{$2}" (@intFromEnum(number)), | 49 | : [number] "{$2}" (@backingInt(number)), |
| 50 | [arg1] "{$4}" (arg1), | 50 | [arg1] "{$4}" (arg1), |
| 51 | [arg2] "{$5}" (arg2), | 51 | [arg2] "{$5}" (arg2), |
| 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 }); | 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,7 +65,7 @@ pub fn syscall3( |
| 65 | \\ subu $v0, $zero, $v0 | 65 | \\ subu $v0, $zero, $v0 |
| 66 | \\1: | 66 | \\1: |
| 67 | : [ret] "={$2}" (-> u32), | 67 | : [ret] "={$2}" (-> u32), |
| 68 | : [number] "{$2}" (@intFromEnum(number)), | 68 | : [number] "{$2}" (@backingInt(number)), |
| 69 | [arg1] "{$4}" (arg1), | 69 | [arg1] "{$4}" (arg1), |
| 70 | [arg2] "{$5}" (arg2), | 70 | [arg2] "{$5}" (arg2), |
| 71 | [arg3] "{$6}" (arg3), | 71 | [arg3] "{$6}" (arg3), |
| ... | @@ -86,7 +86,7 @@ pub fn syscall4( | ... | @@ -86,7 +86,7 @@ pub fn syscall4( |
| 86 | \\ subu $v0, $zero, $v0 | 86 | \\ subu $v0, $zero, $v0 |
| 87 | \\1: | 87 | \\1: |
| 88 | : [ret] "={$2}" (-> u32), | 88 | : [ret] "={$2}" (-> u32), |
| 89 | : [number] "{$2}" (@intFromEnum(number)), | 89 | : [number] "{$2}" (@backingInt(number)), |
| 90 | [arg1] "{$4}" (arg1), | 90 | [arg1] "{$4}" (arg1), |
| 91 | [arg2] "{$5}" (arg2), | 91 | [arg2] "{$5}" (arg2), |
| 92 | [arg3] "{$6}" (arg3), | 92 | [arg3] "{$6}" (arg3), |
| ... | @@ -115,7 +115,7 @@ pub fn syscall5( | ... | @@ -115,7 +115,7 @@ pub fn syscall5( |
| 115 | \\ subu $v0, $zero, $v0 | 115 | \\ subu $v0, $zero, $v0 |
| 116 | \\1: | 116 | \\1: |
| 117 | : [ret] "={$2}" (-> u32), | 117 | : [ret] "={$2}" (-> u32), |
| 118 | : [number] "{$2}" (@intFromEnum(number)), | 118 | : [number] "{$2}" (@backingInt(number)), |
| 119 | [arg1] "{$4}" (arg1), | 119 | [arg1] "{$4}" (arg1), |
| 120 | [arg2] "{$5}" (arg2), | 120 | [arg2] "{$5}" (arg2), |
| 121 | [arg3] "{$6}" (arg3), | 121 | [arg3] "{$6}" (arg3), |
| ... | @@ -144,7 +144,7 @@ pub fn syscall6( | ... | @@ -144,7 +144,7 @@ pub fn syscall6( |
| 144 | \\ subu $v0, $zero, $v0 | 144 | \\ subu $v0, $zero, $v0 |
| 145 | \\1: | 145 | \\1: |
| 146 | : [ret] "={$2}" (-> u32), | 146 | : [ret] "={$2}" (-> u32), |
| 147 | : [number] "{$2}" (@intFromEnum(number)), | 147 | : [number] "{$2}" (@backingInt(number)), |
| 148 | [arg1] "{$4}" (arg1), | 148 | [arg1] "{$4}" (arg1), |
| 149 | [arg2] "{$5}" (arg2), | 149 | [arg2] "{$5}" (arg2), |
| 150 | [arg3] "{$6}" (arg3), | 150 | [arg3] "{$6}" (arg3), |
| ... | @@ -176,7 +176,7 @@ pub fn syscall7( | ... | @@ -176,7 +176,7 @@ pub fn syscall7( |
| 176 | \\ subu $v0, $zero, $v0 | 176 | \\ subu $v0, $zero, $v0 |
| 177 | \\1: | 177 | \\1: |
| 178 | : [ret] "={$2}" (-> u32), | 178 | : [ret] "={$2}" (-> u32), |
| 179 | : [number] "{$2}" (@intFromEnum(number)), | 179 | : [number] "{$2}" (@backingInt(number)), |
| 180 | [arg1] "{$4}" (arg1), | 180 | [arg1] "{$4}" (arg1), |
| 181 | [arg2] "{$5}" (arg2), | 181 | [arg2] "{$5}" (arg2), |
| 182 | [arg3] "{$6}" (arg3), | 182 | [arg3] "{$6}" (arg3), |
| ... | @@ -201,7 +201,7 @@ pub fn syscall_pipe( | ... | @@ -201,7 +201,7 @@ pub fn syscall_pipe( |
| 201 | \\ sw $v1, 4($a0) | 201 | \\ sw $v1, 4($a0) |
| 202 | \\2: | 202 | \\2: |
| 203 | : [ret] "={$2}" (-> u32), | 203 | : [ret] "={$2}" (-> u32), |
| 204 | : [number] "{$2}" (@intFromEnum(SYS.pipe)), | 204 | : [number] "{$2}" (@backingInt(SYS.pipe)), |
| 205 | [fd] "{$4}" (fd), | 205 | [fd] "{$4}" (fd), |
| 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 }); | 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,7 +14,7 @@ pub fn syscall0( |
| 14 | \\ dsubu $v0, $zero, $v0 | 14 | \\ dsubu $v0, $zero, $v0 |
| 15 | \\1: | 15 | \\1: |
| 16 | : [ret] "={$2}" (-> u64), | 16 | : [ret] "={$2}" (-> u64), |
| 17 | : [number] "{$2}" (@intFromEnum(number)), | 17 | : [number] "{$2}" (@backingInt(number)), |
| 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 }); | 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,7 +29,7 @@ pub fn syscall1( |
| 29 | \\ dsubu $v0, $zero, $v0 | 29 | \\ dsubu $v0, $zero, $v0 |
| 30 | \\1: | 30 | \\1: |
| 31 | : [ret] "={$2}" (-> u64), | 31 | : [ret] "={$2}" (-> u64), |
| 32 | : [number] "{$2}" (@intFromEnum(number)), | 32 | : [number] "{$2}" (@backingInt(number)), |
| 33 | [arg1] "{$4}" (arg1), | 33 | [arg1] "{$4}" (arg1), |
| 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 }); | 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,7 +46,7 @@ pub fn syscall2( |
| 46 | \\ dsubu $v0, $zero, $v0 | 46 | \\ dsubu $v0, $zero, $v0 |
| 47 | \\1: | 47 | \\1: |
| 48 | : [ret] "={$2}" (-> u64), | 48 | : [ret] "={$2}" (-> u64), |
| 49 | : [number] "{$2}" (@intFromEnum(number)), | 49 | : [number] "{$2}" (@backingInt(number)), |
| 50 | [arg1] "{$4}" (arg1), | 50 | [arg1] "{$4}" (arg1), |
| 51 | [arg2] "{$5}" (arg2), | 51 | [arg2] "{$5}" (arg2), |
| 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 }); | 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,7 +65,7 @@ pub fn syscall3( |
| 65 | \\ dsubu $v0, $zero, $v0 | 65 | \\ dsubu $v0, $zero, $v0 |
| 66 | \\1: | 66 | \\1: |
| 67 | : [ret] "={$2}" (-> u64), | 67 | : [ret] "={$2}" (-> u64), |
| 68 | : [number] "{$2}" (@intFromEnum(number)), | 68 | : [number] "{$2}" (@backingInt(number)), |
| 69 | [arg1] "{$4}" (arg1), | 69 | [arg1] "{$4}" (arg1), |
| 70 | [arg2] "{$5}" (arg2), | 70 | [arg2] "{$5}" (arg2), |
| 71 | [arg3] "{$6}" (arg3), | 71 | [arg3] "{$6}" (arg3), |
| ... | @@ -86,7 +86,7 @@ pub fn syscall4( | ... | @@ -86,7 +86,7 @@ pub fn syscall4( |
| 86 | \\ dsubu $v0, $zero, $v0 | 86 | \\ dsubu $v0, $zero, $v0 |
| 87 | \\1: | 87 | \\1: |
| 88 | : [ret] "={$2}" (-> u64), | 88 | : [ret] "={$2}" (-> u64), |
| 89 | : [number] "{$2}" (@intFromEnum(number)), | 89 | : [number] "{$2}" (@backingInt(number)), |
| 90 | [arg1] "{$4}" (arg1), | 90 | [arg1] "{$4}" (arg1), |
| 91 | [arg2] "{$5}" (arg2), | 91 | [arg2] "{$5}" (arg2), |
| 92 | [arg3] "{$6}" (arg3), | 92 | [arg3] "{$6}" (arg3), |
| ... | @@ -109,7 +109,7 @@ pub fn syscall5( | ... | @@ -109,7 +109,7 @@ pub fn syscall5( |
| 109 | \\ dsubu $v0, $zero, $v0 | 109 | \\ dsubu $v0, $zero, $v0 |
| 110 | \\1: | 110 | \\1: |
| 111 | : [ret] "={$2}" (-> u64), | 111 | : [ret] "={$2}" (-> u64), |
| 112 | : [number] "{$2}" (@intFromEnum(number)), | 112 | : [number] "{$2}" (@backingInt(number)), |
| 113 | [arg1] "{$4}" (arg1), | 113 | [arg1] "{$4}" (arg1), |
| 114 | [arg2] "{$5}" (arg2), | 114 | [arg2] "{$5}" (arg2), |
| 115 | [arg3] "{$6}" (arg3), | 115 | [arg3] "{$6}" (arg3), |
| ... | @@ -134,7 +134,7 @@ pub fn syscall6( | ... | @@ -134,7 +134,7 @@ pub fn syscall6( |
| 134 | \\ dsubu $v0, $zero, $v0 | 134 | \\ dsubu $v0, $zero, $v0 |
| 135 | \\1: | 135 | \\1: |
| 136 | : [ret] "={$2}" (-> u64), | 136 | : [ret] "={$2}" (-> u64), |
| 137 | : [number] "{$2}" (@intFromEnum(number)), | 137 | : [number] "{$2}" (@backingInt(number)), |
| 138 | [arg1] "{$4}" (arg1), | 138 | [arg1] "{$4}" (arg1), |
| 139 | [arg2] "{$5}" (arg2), | 139 | [arg2] "{$5}" (arg2), |
| 140 | [arg3] "{$6}" (arg3), | 140 | [arg3] "{$6}" (arg3), |
| ... | @@ -158,7 +158,7 @@ pub fn syscall_pipe( | ... | @@ -158,7 +158,7 @@ pub fn syscall_pipe( |
| 158 | \\ sw $v1, 4($a0) | 158 | \\ sw $v1, 4($a0) |
| 159 | \\2: | 159 | \\2: |
| 160 | : [ret] "={$2}" (-> u64), | 160 | : [ret] "={$2}" (-> u64), |
| 161 | : [number] "{$2}" (@intFromEnum(SYS.pipe)), | 161 | : [number] "{$2}" (@backingInt(SYS.pipe)), |
| 162 | [fd] "{$4}" (fd), | 162 | [fd] "{$4}" (fd), |
| 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 }); | 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,7 +14,7 @@ pub fn syscall0( |
| 14 | \\ subu $v0, $zero, $v0 | 14 | \\ subu $v0, $zero, $v0 |
| 15 | \\1: | 15 | \\1: |
| 16 | : [ret] "={$2}" (-> u32), | 16 | : [ret] "={$2}" (-> u32), |
| 17 | : [number] "{$2}" (@intFromEnum(number)), | 17 | : [number] "{$2}" (@backingInt(number)), |
| 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 }); | 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,7 +29,7 @@ pub fn syscall1( |
| 29 | \\ subu $v0, $zero, $v0 | 29 | \\ subu $v0, $zero, $v0 |
| 30 | \\1: | 30 | \\1: |
| 31 | : [ret] "={$2}" (-> u32), | 31 | : [ret] "={$2}" (-> u32), |
| 32 | : [number] "{$2}" (@intFromEnum(number)), | 32 | : [number] "{$2}" (@backingInt(number)), |
| 33 | [arg1] "{$4}" (arg1), | 33 | [arg1] "{$4}" (arg1), |
| 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 }); | 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,7 +46,7 @@ pub fn syscall2( |
| 46 | \\ subu $v0, $zero, $v0 | 46 | \\ subu $v0, $zero, $v0 |
| 47 | \\1: | 47 | \\1: |
| 48 | : [ret] "={$2}" (-> u32), | 48 | : [ret] "={$2}" (-> u32), |
| 49 | : [number] "{$2}" (@intFromEnum(number)), | 49 | : [number] "{$2}" (@backingInt(number)), |
| 50 | [arg1] "{$4}" (arg1), | 50 | [arg1] "{$4}" (arg1), |
| 51 | [arg2] "{$5}" (arg2), | 51 | [arg2] "{$5}" (arg2), |
| 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 }); | 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,7 +65,7 @@ pub fn syscall3( |
| 65 | \\ subu $v0, $zero, $v0 | 65 | \\ subu $v0, $zero, $v0 |
| 66 | \\1: | 66 | \\1: |
| 67 | : [ret] "={$2}" (-> u32), | 67 | : [ret] "={$2}" (-> u32), |
| 68 | : [number] "{$2}" (@intFromEnum(number)), | 68 | : [number] "{$2}" (@backingInt(number)), |
| 69 | [arg1] "{$4}" (arg1), | 69 | [arg1] "{$4}" (arg1), |
| 70 | [arg2] "{$5}" (arg2), | 70 | [arg2] "{$5}" (arg2), |
| 71 | [arg3] "{$6}" (arg3), | 71 | [arg3] "{$6}" (arg3), |
| ... | @@ -86,7 +86,7 @@ pub fn syscall4( | ... | @@ -86,7 +86,7 @@ pub fn syscall4( |
| 86 | \\ subu $v0, $zero, $v0 | 86 | \\ subu $v0, $zero, $v0 |
| 87 | \\1: | 87 | \\1: |
| 88 | : [ret] "={$2}" (-> u32), | 88 | : [ret] "={$2}" (-> u32), |
| 89 | : [number] "{$2}" (@intFromEnum(number)), | 89 | : [number] "{$2}" (@backingInt(number)), |
| 90 | [arg1] "{$4}" (arg1), | 90 | [arg1] "{$4}" (arg1), |
| 91 | [arg2] "{$5}" (arg2), | 91 | [arg2] "{$5}" (arg2), |
| 92 | [arg3] "{$6}" (arg3), | 92 | [arg3] "{$6}" (arg3), |
| ... | @@ -109,7 +109,7 @@ pub fn syscall5( | ... | @@ -109,7 +109,7 @@ pub fn syscall5( |
| 109 | \\ subu $v0, $zero, $v0 | 109 | \\ subu $v0, $zero, $v0 |
| 110 | \\1: | 110 | \\1: |
| 111 | : [ret] "={$2}" (-> u32), | 111 | : [ret] "={$2}" (-> u32), |
| 112 | : [number] "{$2}" (@intFromEnum(number)), | 112 | : [number] "{$2}" (@backingInt(number)), |
| 113 | [arg1] "{$4}" (arg1), | 113 | [arg1] "{$4}" (arg1), |
| 114 | [arg2] "{$5}" (arg2), | 114 | [arg2] "{$5}" (arg2), |
| 115 | [arg3] "{$6}" (arg3), | 115 | [arg3] "{$6}" (arg3), |
| ... | @@ -134,7 +134,7 @@ pub fn syscall6( | ... | @@ -134,7 +134,7 @@ pub fn syscall6( |
| 134 | \\ subu $v0, $zero, $v0 | 134 | \\ subu $v0, $zero, $v0 |
| 135 | \\1: | 135 | \\1: |
| 136 | : [ret] "={$2}" (-> u32), | 136 | : [ret] "={$2}" (-> u32), |
| 137 | : [number] "{$2}" (@intFromEnum(number)), | 137 | : [number] "{$2}" (@backingInt(number)), |
| 138 | [arg1] "{$4}" (arg1), | 138 | [arg1] "{$4}" (arg1), |
| 139 | [arg2] "{$5}" (arg2), | 139 | [arg2] "{$5}" (arg2), |
| 140 | [arg3] "{$6}" (arg3), | 140 | [arg3] "{$6}" (arg3), |
| ... | @@ -158,7 +158,7 @@ pub fn syscall_pipe( | ... | @@ -158,7 +158,7 @@ pub fn syscall_pipe( |
| 158 | \\ sw $v1, 4($a0) | 158 | \\ sw $v1, 4($a0) |
| 159 | \\2: | 159 | \\2: |
| 160 | : [ret] "={$2}" (-> u32), | 160 | : [ret] "={$2}" (-> u32), |
| 161 | : [number] "{$2}" (@intFromEnum(SYS.pipe)), | 161 | : [number] "{$2}" (@backingInt(SYS.pipe)), |
| 162 | [fd] "{$4}" (fd), | 162 | [fd] "{$4}" (fd), |
| 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 }); | 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,7 +175,7 @@ pub fn syscall_lseek( |
| 175 | \\ dsubu $v0, $zero, $v0 | 175 | \\ dsubu $v0, $zero, $v0 |
| 176 | \\1: | 176 | \\1: |
| 177 | : [ret] "={$2}" (-> u64), | 177 | : [ret] "={$2}" (-> u64), |
| 178 | : [number] "{$2}" (@intFromEnum(SYS.lseek)), | 178 | : [number] "{$2}" (@backingInt(SYS.lseek)), |
| 179 | [fd] "{$4}" (@as(u32, @bitCast(fd))), | 179 | [fd] "{$4}" (@as(u32, @bitCast(fd))), |
| 180 | [offset] "{$5}" (@as(u64, @bitCast(offset))), | 180 | [offset] "{$5}" (@as(u64, @bitCast(offset))), |
| 181 | [whence] "{$6}" (whence), | 181 | [whence] "{$6}" (whence), |
lib/std/os/linux/or1k.zig+7-7| ... | @@ -10,7 +10,7 @@ pub fn syscall0( | ... | @@ -10,7 +10,7 @@ pub fn syscall0( |
| 10 | return asm volatile ( | 10 | return asm volatile ( |
| 11 | \\ l.sys 1 | 11 | \\ l.sys 1 |
| 12 | : [ret] "={r11}" (-> u32), | 12 | : [ret] "={r11}" (-> u32), |
| 13 | : [number] "{r11}" (@intFromEnum(number)), | 13 | : [number] "{r11}" (@backingInt(number)), |
| 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 }); | 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,7 +21,7 @@ pub fn syscall1( |
| 21 | return asm volatile ( | 21 | return asm volatile ( |
| 22 | \\ l.sys 1 | 22 | \\ l.sys 1 |
| 23 | : [ret] "={r11}" (-> u32), | 23 | : [ret] "={r11}" (-> u32), |
| 24 | : [number] "{r11}" (@intFromEnum(number)), | 24 | : [number] "{r11}" (@backingInt(number)), |
| 25 | [arg1] "{r3}" (arg1), | 25 | [arg1] "{r3}" (arg1), |
| 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 }); | 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,7 +34,7 @@ pub fn syscall2( |
| 34 | return asm volatile ( | 34 | return asm volatile ( |
| 35 | \\ l.sys 1 | 35 | \\ l.sys 1 |
| 36 | : [ret] "={r11}" (-> u32), | 36 | : [ret] "={r11}" (-> u32), |
| 37 | : [number] "{r11}" (@intFromEnum(number)), | 37 | : [number] "{r11}" (@backingInt(number)), |
| 38 | [arg1] "{r3}" (arg1), | 38 | [arg1] "{r3}" (arg1), |
| 39 | [arg2] "{r4}" (arg2), | 39 | [arg2] "{r4}" (arg2), |
| 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 }); | 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,7 +49,7 @@ pub fn syscall3( |
| 49 | return asm volatile ( | 49 | return asm volatile ( |
| 50 | \\ l.sys 1 | 50 | \\ l.sys 1 |
| 51 | : [ret] "={r11}" (-> u32), | 51 | : [ret] "={r11}" (-> u32), |
| 52 | : [number] "{r11}" (@intFromEnum(number)), | 52 | : [number] "{r11}" (@backingInt(number)), |
| 53 | [arg1] "{r3}" (arg1), | 53 | [arg1] "{r3}" (arg1), |
| 54 | [arg2] "{r4}" (arg2), | 54 | [arg2] "{r4}" (arg2), |
| 55 | [arg3] "{r5}" (arg3), | 55 | [arg3] "{r5}" (arg3), |
| ... | @@ -66,7 +66,7 @@ pub fn syscall4( | ... | @@ -66,7 +66,7 @@ pub fn syscall4( |
| 66 | return asm volatile ( | 66 | return asm volatile ( |
| 67 | \\ l.sys 1 | 67 | \\ l.sys 1 |
| 68 | : [ret] "={r11}" (-> u32), | 68 | : [ret] "={r11}" (-> u32), |
| 69 | : [number] "{r11}" (@intFromEnum(number)), | 69 | : [number] "{r11}" (@backingInt(number)), |
| 70 | [arg1] "{r3}" (arg1), | 70 | [arg1] "{r3}" (arg1), |
| 71 | [arg2] "{r4}" (arg2), | 71 | [arg2] "{r4}" (arg2), |
| 72 | [arg3] "{r5}" (arg3), | 72 | [arg3] "{r5}" (arg3), |
| ... | @@ -85,7 +85,7 @@ pub fn syscall5( | ... | @@ -85,7 +85,7 @@ pub fn syscall5( |
| 85 | return asm volatile ( | 85 | return asm volatile ( |
| 86 | \\ l.sys 1 | 86 | \\ l.sys 1 |
| 87 | : [ret] "={r11}" (-> u32), | 87 | : [ret] "={r11}" (-> u32), |
| 88 | : [number] "{r11}" (@intFromEnum(number)), | 88 | : [number] "{r11}" (@backingInt(number)), |
| 89 | [arg1] "{r3}" (arg1), | 89 | [arg1] "{r3}" (arg1), |
| 90 | [arg2] "{r4}" (arg2), | 90 | [arg2] "{r4}" (arg2), |
| 91 | [arg3] "{r5}" (arg3), | 91 | [arg3] "{r5}" (arg3), |
| ... | @@ -106,7 +106,7 @@ pub fn syscall6( | ... | @@ -106,7 +106,7 @@ pub fn syscall6( |
| 106 | return asm volatile ( | 106 | return asm volatile ( |
| 107 | \\ l.sys 1 | 107 | \\ l.sys 1 |
| 108 | : [ret] "={r11}" (-> u32), | 108 | : [ret] "={r11}" (-> u32), |
| 109 | : [number] "{r11}" (@intFromEnum(number)), | 109 | : [number] "{r11}" (@backingInt(number)), |
| 110 | [arg1] "{r3}" (arg1), | 110 | [arg1] "{r3}" (arg1), |
| 111 | [arg2] "{r4}" (arg2), | 111 | [arg2] "{r4}" (arg2), |
| 112 | [arg3] "{r5}" (arg3), | 112 | [arg3] "{r5}" (arg3), |
lib/std/os/linux/powerpc.zig+11-11| ... | @@ -19,7 +19,7 @@ pub fn syscall0( | ... | @@ -19,7 +19,7 @@ pub fn syscall0( |
| 19 | \\ 1: | 19 | \\ 1: |
| 20 | : [ret] "={r3}" (-> u32), | 20 | : [ret] "={r3}" (-> u32), |
| 21 | [r0_out] "={r0}" (r0_out), | 21 | [r0_out] "={r0}" (r0_out), |
| 22 | : [number] "{r0}" (@intFromEnum(number)), | 22 | : [number] "{r0}" (@backingInt(number)), |
| 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 }); | 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,7 +36,7 @@ pub fn syscall1( |
| 36 | \\ 1: | 36 | \\ 1: |
| 37 | : [ret] "={r3}" (-> u32), | 37 | : [ret] "={r3}" (-> u32), |
| 38 | [r0_out] "={r0}" (r0_out), | 38 | [r0_out] "={r0}" (r0_out), |
| 39 | : [number] "{r0}" (@intFromEnum(number)), | 39 | : [number] "{r0}" (@backingInt(number)), |
| 40 | [arg1] "{r3}" (arg1), | 40 | [arg1] "{r3}" (arg1), |
| 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 }); | 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,7 +57,7 @@ pub fn syscall2( |
| 57 | : [ret] "={r3}" (-> u32), | 57 | : [ret] "={r3}" (-> u32), |
| 58 | [r0_out] "={r0}" (r0_out), | 58 | [r0_out] "={r0}" (r0_out), |
| 59 | [r4_out] "={r4}" (r4_out), | 59 | [r4_out] "={r4}" (r4_out), |
| 60 | : [number] "{r0}" (@intFromEnum(number)), | 60 | : [number] "{r0}" (@backingInt(number)), |
| 61 | [arg1] "{r3}" (arg1), | 61 | [arg1] "{r3}" (arg1), |
| 62 | [arg2] "{r4}" (arg2), | 62 | [arg2] "{r4}" (arg2), |
| 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 }); | 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,7 +82,7 @@ pub fn syscall3( |
| 82 | [r0_out] "={r0}" (r0_out), | 82 | [r0_out] "={r0}" (r0_out), |
| 83 | [r4_out] "={r4}" (r4_out), | 83 | [r4_out] "={r4}" (r4_out), |
| 84 | [r5_out] "={r5}" (r5_out), | 84 | [r5_out] "={r5}" (r5_out), |
| 85 | : [number] "{r0}" (@intFromEnum(number)), | 85 | : [number] "{r0}" (@backingInt(number)), |
| 86 | [arg1] "{r3}" (arg1), | 86 | [arg1] "{r3}" (arg1), |
| 87 | [arg2] "{r4}" (arg2), | 87 | [arg2] "{r4}" (arg2), |
| 88 | [arg3] "{r5}" (arg3), | 88 | [arg3] "{r5}" (arg3), |
| ... | @@ -111,7 +111,7 @@ pub fn syscall4( | ... | @@ -111,7 +111,7 @@ pub fn syscall4( |
| 111 | [r4_out] "={r4}" (r4_out), | 111 | [r4_out] "={r4}" (r4_out), |
| 112 | [r5_out] "={r5}" (r5_out), | 112 | [r5_out] "={r5}" (r5_out), |
| 113 | [r6_out] "={r6}" (r6_out), | 113 | [r6_out] "={r6}" (r6_out), |
| 114 | : [number] "{r0}" (@intFromEnum(number)), | 114 | : [number] "{r0}" (@backingInt(number)), |
| 115 | [arg1] "{r3}" (arg1), | 115 | [arg1] "{r3}" (arg1), |
| 116 | [arg2] "{r4}" (arg2), | 116 | [arg2] "{r4}" (arg2), |
| 117 | [arg3] "{r5}" (arg3), | 117 | [arg3] "{r5}" (arg3), |
| ... | @@ -144,7 +144,7 @@ pub fn syscall5( | ... | @@ -144,7 +144,7 @@ pub fn syscall5( |
| 144 | [r5_out] "={r5}" (r5_out), | 144 | [r5_out] "={r5}" (r5_out), |
| 145 | [r6_out] "={r6}" (r6_out), | 145 | [r6_out] "={r6}" (r6_out), |
| 146 | [r7_out] "={r7}" (r7_out), | 146 | [r7_out] "={r7}" (r7_out), |
| 147 | : [number] "{r0}" (@intFromEnum(number)), | 147 | : [number] "{r0}" (@backingInt(number)), |
| 148 | [arg1] "{r3}" (arg1), | 148 | [arg1] "{r3}" (arg1), |
| 149 | [arg2] "{r4}" (arg2), | 149 | [arg2] "{r4}" (arg2), |
| 150 | [arg3] "{r5}" (arg3), | 150 | [arg3] "{r5}" (arg3), |
| ... | @@ -181,7 +181,7 @@ pub fn syscall6( | ... | @@ -181,7 +181,7 @@ pub fn syscall6( |
| 181 | [r6_out] "={r6}" (r6_out), | 181 | [r6_out] "={r6}" (r6_out), |
| 182 | [r7_out] "={r7}" (r7_out), | 182 | [r7_out] "={r7}" (r7_out), |
| 183 | [r8_out] "={r8}" (r8_out), | 183 | [r8_out] "={r8}" (r8_out), |
| 184 | : [number] "{r0}" (@intFromEnum(number)), | 184 | : [number] "{r0}" (@backingInt(number)), |
| 185 | [arg1] "{r3}" (arg1), | 185 | [arg1] "{r3}" (arg1), |
| 186 | [arg2] "{r4}" (arg2), | 186 | [arg2] "{r4}" (arg2), |
| 187 | [arg3] "{r5}" (arg3), | 187 | [arg3] "{r5}" (arg3), |
| ... | @@ -267,12 +267,12 @@ pub fn restore() callconv(.naked) noreturn { | ... | @@ -267,12 +267,12 @@ pub fn restore() callconv(.naked) noreturn { |
| 267 | \\ li 0, %[number] | 267 | \\ li 0, %[number] |
| 268 | \\ sc | 268 | \\ sc |
| 269 | : | 269 | : |
| 270 | : [number] "i" (@intFromEnum(SYS.sigreturn)), | 270 | : [number] "i" (@backingInt(SYS.sigreturn)), |
| 271 | ), | 271 | ), |
| 272 | else => asm volatile ( | 272 | else => asm volatile ( |
| 273 | \\ sc | 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,12 +283,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 283 | \\ li 0, %[number] | 283 | \\ li 0, %[number] |
| 284 | \\ sc | 284 | \\ sc |
| 285 | : | 285 | : |
| 286 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | 286 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), |
| 287 | ), | 287 | ), |
| 288 | else => asm volatile ( | 288 | else => asm volatile ( |
| 289 | \\ sc | 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,7 +19,7 @@ pub fn syscall0( |
| 19 | \\ 1: | 19 | \\ 1: |
| 20 | : [ret] "={r3}" (-> u64), | 20 | : [ret] "={r3}" (-> u64), |
| 21 | [r0_out] "={r0}" (r0_out), | 21 | [r0_out] "={r0}" (r0_out), |
| 22 | : [number] "{r0}" (@intFromEnum(number)), | 22 | : [number] "{r0}" (@backingInt(number)), |
| 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 }); | 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,7 +36,7 @@ pub fn syscall1( |
| 36 | \\ 1: | 36 | \\ 1: |
| 37 | : [ret] "={r3}" (-> u64), | 37 | : [ret] "={r3}" (-> u64), |
| 38 | [r0_out] "={r0}" (r0_out), | 38 | [r0_out] "={r0}" (r0_out), |
| 39 | : [number] "{r0}" (@intFromEnum(number)), | 39 | : [number] "{r0}" (@backingInt(number)), |
| 40 | [arg1] "{r3}" (arg1), | 40 | [arg1] "{r3}" (arg1), |
| 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 }); | 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,7 +57,7 @@ pub fn syscall2( |
| 57 | : [ret] "={r3}" (-> u64), | 57 | : [ret] "={r3}" (-> u64), |
| 58 | [r0_out] "={r0}" (r0_out), | 58 | [r0_out] "={r0}" (r0_out), |
| 59 | [r4_out] "={r4}" (r4_out), | 59 | [r4_out] "={r4}" (r4_out), |
| 60 | : [number] "{r0}" (@intFromEnum(number)), | 60 | : [number] "{r0}" (@backingInt(number)), |
| 61 | [arg1] "{r3}" (arg1), | 61 | [arg1] "{r3}" (arg1), |
| 62 | [arg2] "{r4}" (arg2), | 62 | [arg2] "{r4}" (arg2), |
| 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 }); | 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,7 +82,7 @@ pub fn syscall3( |
| 82 | [r0_out] "={r0}" (r0_out), | 82 | [r0_out] "={r0}" (r0_out), |
| 83 | [r4_out] "={r4}" (r4_out), | 83 | [r4_out] "={r4}" (r4_out), |
| 84 | [r5_out] "={r5}" (r5_out), | 84 | [r5_out] "={r5}" (r5_out), |
| 85 | : [number] "{r0}" (@intFromEnum(number)), | 85 | : [number] "{r0}" (@backingInt(number)), |
| 86 | [arg1] "{r3}" (arg1), | 86 | [arg1] "{r3}" (arg1), |
| 87 | [arg2] "{r4}" (arg2), | 87 | [arg2] "{r4}" (arg2), |
| 88 | [arg3] "{r5}" (arg3), | 88 | [arg3] "{r5}" (arg3), |
| ... | @@ -111,7 +111,7 @@ pub fn syscall4( | ... | @@ -111,7 +111,7 @@ pub fn syscall4( |
| 111 | [r4_out] "={r4}" (r4_out), | 111 | [r4_out] "={r4}" (r4_out), |
| 112 | [r5_out] "={r5}" (r5_out), | 112 | [r5_out] "={r5}" (r5_out), |
| 113 | [r6_out] "={r6}" (r6_out), | 113 | [r6_out] "={r6}" (r6_out), |
| 114 | : [number] "{r0}" (@intFromEnum(number)), | 114 | : [number] "{r0}" (@backingInt(number)), |
| 115 | [arg1] "{r3}" (arg1), | 115 | [arg1] "{r3}" (arg1), |
| 116 | [arg2] "{r4}" (arg2), | 116 | [arg2] "{r4}" (arg2), |
| 117 | [arg3] "{r5}" (arg3), | 117 | [arg3] "{r5}" (arg3), |
| ... | @@ -144,7 +144,7 @@ pub fn syscall5( | ... | @@ -144,7 +144,7 @@ pub fn syscall5( |
| 144 | [r5_out] "={r5}" (r5_out), | 144 | [r5_out] "={r5}" (r5_out), |
| 145 | [r6_out] "={r6}" (r6_out), | 145 | [r6_out] "={r6}" (r6_out), |
| 146 | [r7_out] "={r7}" (r7_out), | 146 | [r7_out] "={r7}" (r7_out), |
| 147 | : [number] "{r0}" (@intFromEnum(number)), | 147 | : [number] "{r0}" (@backingInt(number)), |
| 148 | [arg1] "{r3}" (arg1), | 148 | [arg1] "{r3}" (arg1), |
| 149 | [arg2] "{r4}" (arg2), | 149 | [arg2] "{r4}" (arg2), |
| 150 | [arg3] "{r5}" (arg3), | 150 | [arg3] "{r5}" (arg3), |
| ... | @@ -181,7 +181,7 @@ pub fn syscall6( | ... | @@ -181,7 +181,7 @@ pub fn syscall6( |
| 181 | [r6_out] "={r6}" (r6_out), | 181 | [r6_out] "={r6}" (r6_out), |
| 182 | [r7_out] "={r7}" (r7_out), | 182 | [r7_out] "={r7}" (r7_out), |
| 183 | [r8_out] "={r8}" (r8_out), | 183 | [r8_out] "={r8}" (r8_out), |
| 184 | : [number] "{r0}" (@intFromEnum(number)), | 184 | : [number] "{r0}" (@backingInt(number)), |
| 185 | [arg1] "{r3}" (arg1), | 185 | [arg1] "{r3}" (arg1), |
| 186 | [arg2] "{r4}" (arg2), | 186 | [arg2] "{r4}" (arg2), |
| 187 | [arg3] "{r5}" (arg3), | 187 | [arg3] "{r5}" (arg3), |
| ... | @@ -252,12 +252,12 @@ pub fn restore() callconv(.naked) noreturn { | ... | @@ -252,12 +252,12 @@ pub fn restore() callconv(.naked) noreturn { |
| 252 | \\ li 0, %[number] | 252 | \\ li 0, %[number] |
| 253 | \\ sc | 253 | \\ sc |
| 254 | : | 254 | : |
| 255 | : [number] "i" (@intFromEnum(SYS.sigreturn)), | 255 | : [number] "i" (@backingInt(SYS.sigreturn)), |
| 256 | ), | 256 | ), |
| 257 | else => asm volatile ( | 257 | else => asm volatile ( |
| 258 | \\ sc | 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,12 +268,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 268 | \\ li 0, %[number] | 268 | \\ li 0, %[number] |
| 269 | \\ sc | 269 | \\ sc |
| 270 | : | 270 | : |
| 271 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | 271 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), |
| 272 | ), | 272 | ), |
| 273 | else => asm volatile ( | 273 | else => asm volatile ( |
| 274 | \\ sc | 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,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u32 { | 9 | ) u32 { |
| 10 | return asm volatile ("ecall" | 10 | return asm volatile ("ecall" |
| 11 | : [ret] "={x10}" (-> u32), | 11 | : [ret] "={x10}" (-> u32), |
| 12 | : [number] "{x17}" (@intFromEnum(number)), | 12 | : [number] "{x17}" (@backingInt(number)), |
| 13 | : .{ .memory = true }); | 13 | : .{ .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u32 { | 19 | ) u32 { |
| 20 | return asm volatile ("ecall" | 20 | return asm volatile ("ecall" |
| 21 | : [ret] "={x10}" (-> u32), | 21 | : [ret] "={x10}" (-> u32), |
| 22 | : [number] "{x17}" (@intFromEnum(number)), | 22 | : [number] "{x17}" (@backingInt(number)), |
| 23 | [arg1] "{x10}" (arg1), | 23 | [arg1] "{x10}" (arg1), |
| 24 | : .{ .memory = true }); | 24 | : .{ .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u32 { | 31 | ) u32 { |
| 32 | return asm volatile ("ecall" | 32 | return asm volatile ("ecall" |
| 33 | : [ret] "={x10}" (-> u32), | 33 | : [ret] "={x10}" (-> u32), |
| 34 | : [number] "{x17}" (@intFromEnum(number)), | 34 | : [number] "{x17}" (@backingInt(number)), |
| 35 | [arg1] "{x10}" (arg1), | 35 | [arg1] "{x10}" (arg1), |
| 36 | [arg2] "{x11}" (arg2), | 36 | [arg2] "{x11}" (arg2), |
| 37 | : .{ .memory = true }); | 37 | : .{ .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u32 { | 45 | ) u32 { |
| 46 | return asm volatile ("ecall" | 46 | return asm volatile ("ecall" |
| 47 | : [ret] "={x10}" (-> u32), | 47 | : [ret] "={x10}" (-> u32), |
| 48 | : [number] "{x17}" (@intFromEnum(number)), | 48 | : [number] "{x17}" (@backingInt(number)), |
| 49 | [arg1] "{x10}" (arg1), | 49 | [arg1] "{x10}" (arg1), |
| 50 | [arg2] "{x11}" (arg2), | 50 | [arg2] "{x11}" (arg2), |
| 51 | [arg3] "{x12}" (arg3), | 51 | [arg3] "{x12}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u32 { | 61 | ) u32 { |
| 62 | return asm volatile ("ecall" | 62 | return asm volatile ("ecall" |
| 63 | : [ret] "={x10}" (-> u32), | 63 | : [ret] "={x10}" (-> u32), |
| 64 | : [number] "{x17}" (@intFromEnum(number)), | 64 | : [number] "{x17}" (@backingInt(number)), |
| 65 | [arg1] "{x10}" (arg1), | 65 | [arg1] "{x10}" (arg1), |
| 66 | [arg2] "{x11}" (arg2), | 66 | [arg2] "{x11}" (arg2), |
| 67 | [arg3] "{x12}" (arg3), | 67 | [arg3] "{x12}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u32 { | 79 | ) u32 { |
| 80 | return asm volatile ("ecall" | 80 | return asm volatile ("ecall" |
| 81 | : [ret] "={x10}" (-> u32), | 81 | : [ret] "={x10}" (-> u32), |
| 82 | : [number] "{x17}" (@intFromEnum(number)), | 82 | : [number] "{x17}" (@backingInt(number)), |
| 83 | [arg1] "{x10}" (arg1), | 83 | [arg1] "{x10}" (arg1), |
| 84 | [arg2] "{x11}" (arg2), | 84 | [arg2] "{x11}" (arg2), |
| 85 | [arg3] "{x12}" (arg3), | 85 | [arg3] "{x12}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u32 { | 99 | ) u32 { |
| 100 | return asm volatile ("ecall" | 100 | return asm volatile ("ecall" |
| 101 | : [ret] "={x10}" (-> u32), | 101 | : [ret] "={x10}" (-> u32), |
| 102 | : [number] "{x17}" (@intFromEnum(number)), | 102 | : [number] "{x17}" (@backingInt(number)), |
| 103 | [arg1] "{x10}" (arg1), | 103 | [arg1] "{x10}" (arg1), |
| 104 | [arg2] "{x11}" (arg2), | 104 | [arg2] "{x11}" (arg2), |
| 105 | [arg3] "{x12}" (arg3), | 105 | [arg3] "{x12}" (arg3), |
lib/std/os/linux/riscv64.zig+7-7| ... | @@ -9,7 +9,7 @@ pub fn syscall0( | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u64 { | 9 | ) u64 { |
| 10 | return asm volatile ("ecall" | 10 | return asm volatile ("ecall" |
| 11 | : [ret] "={x10}" (-> u64), | 11 | : [ret] "={x10}" (-> u64), |
| 12 | : [number] "{x17}" (@intFromEnum(number)), | 12 | : [number] "{x17}" (@backingInt(number)), |
| 13 | : .{ .memory = true }); | 13 | : .{ .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u64 { | 19 | ) u64 { |
| 20 | return asm volatile ("ecall" | 20 | return asm volatile ("ecall" |
| 21 | : [ret] "={x10}" (-> u64), | 21 | : [ret] "={x10}" (-> u64), |
| 22 | : [number] "{x17}" (@intFromEnum(number)), | 22 | : [number] "{x17}" (@backingInt(number)), |
| 23 | [arg1] "{x10}" (arg1), | 23 | [arg1] "{x10}" (arg1), |
| 24 | : .{ .memory = true }); | 24 | : .{ .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u64 { | 31 | ) u64 { |
| 32 | return asm volatile ("ecall" | 32 | return asm volatile ("ecall" |
| 33 | : [ret] "={x10}" (-> u64), | 33 | : [ret] "={x10}" (-> u64), |
| 34 | : [number] "{x17}" (@intFromEnum(number)), | 34 | : [number] "{x17}" (@backingInt(number)), |
| 35 | [arg1] "{x10}" (arg1), | 35 | [arg1] "{x10}" (arg1), |
| 36 | [arg2] "{x11}" (arg2), | 36 | [arg2] "{x11}" (arg2), |
| 37 | : .{ .memory = true }); | 37 | : .{ .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u64 { | 45 | ) u64 { |
| 46 | return asm volatile ("ecall" | 46 | return asm volatile ("ecall" |
| 47 | : [ret] "={x10}" (-> u64), | 47 | : [ret] "={x10}" (-> u64), |
| 48 | : [number] "{x17}" (@intFromEnum(number)), | 48 | : [number] "{x17}" (@backingInt(number)), |
| 49 | [arg1] "{x10}" (arg1), | 49 | [arg1] "{x10}" (arg1), |
| 50 | [arg2] "{x11}" (arg2), | 50 | [arg2] "{x11}" (arg2), |
| 51 | [arg3] "{x12}" (arg3), | 51 | [arg3] "{x12}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u64 { | 61 | ) u64 { |
| 62 | return asm volatile ("ecall" | 62 | return asm volatile ("ecall" |
| 63 | : [ret] "={x10}" (-> u64), | 63 | : [ret] "={x10}" (-> u64), |
| 64 | : [number] "{x17}" (@intFromEnum(number)), | 64 | : [number] "{x17}" (@backingInt(number)), |
| 65 | [arg1] "{x10}" (arg1), | 65 | [arg1] "{x10}" (arg1), |
| 66 | [arg2] "{x11}" (arg2), | 66 | [arg2] "{x11}" (arg2), |
| 67 | [arg3] "{x12}" (arg3), | 67 | [arg3] "{x12}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u64 { | 79 | ) u64 { |
| 80 | return asm volatile ("ecall" | 80 | return asm volatile ("ecall" |
| 81 | : [ret] "={x10}" (-> u64), | 81 | : [ret] "={x10}" (-> u64), |
| 82 | : [number] "{x17}" (@intFromEnum(number)), | 82 | : [number] "{x17}" (@backingInt(number)), |
| 83 | [arg1] "{x10}" (arg1), | 83 | [arg1] "{x10}" (arg1), |
| 84 | [arg2] "{x11}" (arg2), | 84 | [arg2] "{x11}" (arg2), |
| 85 | [arg3] "{x12}" (arg3), | 85 | [arg3] "{x12}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u64 { | 99 | ) u64 { |
| 100 | return asm volatile ("ecall" | 100 | return asm volatile ("ecall" |
| 101 | : [ret] "={x10}" (-> u64), | 101 | : [ret] "={x10}" (-> u64), |
| 102 | : [number] "{x17}" (@intFromEnum(number)), | 102 | : [number] "{x17}" (@backingInt(number)), |
| 103 | [arg1] "{x10}" (arg1), | 103 | [arg1] "{x10}" (arg1), |
| 104 | [arg2] "{x11}" (arg2), | 104 | [arg2] "{x11}" (arg2), |
| 105 | [arg3] "{x12}" (arg3), | 105 | [arg3] "{x12}" (arg3), |
lib/std/os/linux/s390x.zig+9-9| ... | @@ -9,7 +9,7 @@ pub fn syscall0( | ... | @@ -9,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u64 { | 9 | ) u64 { |
| 10 | return asm volatile ("svc 0" | 10 | return asm volatile ("svc 0" |
| 11 | : [ret] "={r2}" (-> u64), | 11 | : [ret] "={r2}" (-> u64), |
| 12 | : [number] "{r1}" (@intFromEnum(number)), | 12 | : [number] "{r1}" (@backingInt(number)), |
| 13 | : .{ .memory = true }); | 13 | : .{ .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u64 { | 19 | ) u64 { |
| 20 | return asm volatile ("svc 0" | 20 | return asm volatile ("svc 0" |
| 21 | : [ret] "={r2}" (-> u64), | 21 | : [ret] "={r2}" (-> u64), |
| 22 | : [number] "{r1}" (@intFromEnum(number)), | 22 | : [number] "{r1}" (@backingInt(number)), |
| 23 | [arg1] "{r2}" (arg1), | 23 | [arg1] "{r2}" (arg1), |
| 24 | : .{ .memory = true }); | 24 | : .{ .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u64 { | 31 | ) u64 { |
| 32 | return asm volatile ("svc 0" | 32 | return asm volatile ("svc 0" |
| 33 | : [ret] "={r2}" (-> u64), | 33 | : [ret] "={r2}" (-> u64), |
| 34 | : [number] "{r1}" (@intFromEnum(number)), | 34 | : [number] "{r1}" (@backingInt(number)), |
| 35 | [arg1] "{r2}" (arg1), | 35 | [arg1] "{r2}" (arg1), |
| 36 | [arg2] "{r3}" (arg2), | 36 | [arg2] "{r3}" (arg2), |
| 37 | : .{ .memory = true }); | 37 | : .{ .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u64 { | 45 | ) u64 { |
| 46 | return asm volatile ("svc 0" | 46 | return asm volatile ("svc 0" |
| 47 | : [ret] "={r2}" (-> u64), | 47 | : [ret] "={r2}" (-> u64), |
| 48 | : [number] "{r1}" (@intFromEnum(number)), | 48 | : [number] "{r1}" (@backingInt(number)), |
| 49 | [arg1] "{r2}" (arg1), | 49 | [arg1] "{r2}" (arg1), |
| 50 | [arg2] "{r3}" (arg2), | 50 | [arg2] "{r3}" (arg2), |
| 51 | [arg3] "{r4}" (arg3), | 51 | [arg3] "{r4}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u64 { | 61 | ) u64 { |
| 62 | return asm volatile ("svc 0" | 62 | return asm volatile ("svc 0" |
| 63 | : [ret] "={r2}" (-> u64), | 63 | : [ret] "={r2}" (-> u64), |
| 64 | : [number] "{r1}" (@intFromEnum(number)), | 64 | : [number] "{r1}" (@backingInt(number)), |
| 65 | [arg1] "{r2}" (arg1), | 65 | [arg1] "{r2}" (arg1), |
| 66 | [arg2] "{r3}" (arg2), | 66 | [arg2] "{r3}" (arg2), |
| 67 | [arg3] "{r4}" (arg3), | 67 | [arg3] "{r4}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u64 { | 79 | ) u64 { |
| 80 | return asm volatile ("svc 0" | 80 | return asm volatile ("svc 0" |
| 81 | : [ret] "={r2}" (-> u64), | 81 | : [ret] "={r2}" (-> u64), |
| 82 | : [number] "{r1}" (@intFromEnum(number)), | 82 | : [number] "{r1}" (@backingInt(number)), |
| 83 | [arg1] "{r2}" (arg1), | 83 | [arg1] "{r2}" (arg1), |
| 84 | [arg2] "{r3}" (arg2), | 84 | [arg2] "{r3}" (arg2), |
| 85 | [arg3] "{r4}" (arg3), | 85 | [arg3] "{r4}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u64 { | 99 | ) u64 { |
| 100 | return asm volatile ("svc 0" | 100 | return asm volatile ("svc 0" |
| 101 | : [ret] "={r2}" (-> u64), | 101 | : [ret] "={r2}" (-> u64), |
| 102 | : [number] "{r1}" (@intFromEnum(number)), | 102 | : [number] "{r1}" (@backingInt(number)), |
| 103 | [arg1] "{r2}" (arg1), | 103 | [arg1] "{r2}" (arg1), |
| 104 | [arg2] "{r3}" (arg2), | 104 | [arg2] "{r3}" (arg2), |
| 105 | [arg3] "{r4}" (arg3), | 105 | [arg3] "{r4}" (arg3), |
| ... | @@ -177,7 +177,7 @@ pub fn restore() callconv(.naked) noreturn { | ... | @@ -177,7 +177,7 @@ pub fn restore() callconv(.naked) noreturn { |
| 177 | asm volatile ( | 177 | asm volatile ( |
| 178 | \\svc 0 | 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,7 +185,7 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 185 | asm volatile ( | 185 | asm volatile ( |
| 186 | \\svc 0 | 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,7 +15,7 @@ pub fn syscall0( |
| 15 | \\ or r0, r0 | 15 | \\ or r0, r0 |
| 16 | \\ or r0, r0 | 16 | \\ or r0, r0 |
| 17 | : [ret] "={r0}" (-> u32), | 17 | : [ret] "={r0}" (-> u32), |
| 18 | : [number] "{r3}" (@intFromEnum(number)), | 18 | : [number] "{r3}" (@backingInt(number)), |
| 19 | : .{ .memory = true }); | 19 | : .{ .memory = true }); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| ... | @@ -31,7 +31,7 @@ pub fn syscall1( | ... | @@ -31,7 +31,7 @@ pub fn syscall1( |
| 31 | \\ or r0, r0 | 31 | \\ or r0, r0 |
| 32 | \\ or r0, r0 | 32 | \\ or r0, r0 |
| 33 | : [ret] "={r0}" (-> u32), | 33 | : [ret] "={r0}" (-> u32), |
| 34 | : [number] "{r3}" (@intFromEnum(number)), | 34 | : [number] "{r3}" (@backingInt(number)), |
| 35 | [arg1] "{r4}" (arg1), | 35 | [arg1] "{r4}" (arg1), |
| 36 | : .{ .memory = true }); | 36 | : .{ .memory = true }); |
| 37 | } | 37 | } |
| ... | @@ -49,7 +49,7 @@ pub fn syscall2( | ... | @@ -49,7 +49,7 @@ pub fn syscall2( |
| 49 | \\ or r0, r0 | 49 | \\ or r0, r0 |
| 50 | \\ or r0, r0 | 50 | \\ or r0, r0 |
| 51 | : [ret] "={r0}" (-> u32), | 51 | : [ret] "={r0}" (-> u32), |
| 52 | : [number] "{r3}" (@intFromEnum(number)), | 52 | : [number] "{r3}" (@backingInt(number)), |
| 53 | [arg1] "{r4}" (arg1), | 53 | [arg1] "{r4}" (arg1), |
| 54 | [arg2] "{r5}" (arg2), | 54 | [arg2] "{r5}" (arg2), |
| 55 | : .{ .memory = true }); | 55 | : .{ .memory = true }); |
| ... | @@ -69,7 +69,7 @@ pub fn syscall3( | ... | @@ -69,7 +69,7 @@ pub fn syscall3( |
| 69 | \\ or r0, r0 | 69 | \\ or r0, r0 |
| 70 | \\ or r0, r0 | 70 | \\ or r0, r0 |
| 71 | : [ret] "={r0}" (-> u32), | 71 | : [ret] "={r0}" (-> u32), |
| 72 | : [number] "{r3}" (@intFromEnum(number)), | 72 | : [number] "{r3}" (@backingInt(number)), |
| 73 | [arg1] "{r4}" (arg1), | 73 | [arg1] "{r4}" (arg1), |
| 74 | [arg2] "{r5}" (arg2), | 74 | [arg2] "{r5}" (arg2), |
| 75 | [arg3] "{r6}" (arg3), | 75 | [arg3] "{r6}" (arg3), |
| ... | @@ -91,7 +91,7 @@ pub fn syscall4( | ... | @@ -91,7 +91,7 @@ pub fn syscall4( |
| 91 | \\ or r0, r0 | 91 | \\ or r0, r0 |
| 92 | \\ or r0, r0 | 92 | \\ or r0, r0 |
| 93 | : [ret] "={r0}" (-> u32), | 93 | : [ret] "={r0}" (-> u32), |
| 94 | : [number] "{r3}" (@intFromEnum(number)), | 94 | : [number] "{r3}" (@backingInt(number)), |
| 95 | [arg1] "{r4}" (arg1), | 95 | [arg1] "{r4}" (arg1), |
| 96 | [arg2] "{r5}" (arg2), | 96 | [arg2] "{r5}" (arg2), |
| 97 | [arg3] "{r6}" (arg3), | 97 | [arg3] "{r6}" (arg3), |
| ... | @@ -115,7 +115,7 @@ pub fn syscall5( | ... | @@ -115,7 +115,7 @@ pub fn syscall5( |
| 115 | \\ or r0, r0 | 115 | \\ or r0, r0 |
| 116 | \\ or r0, r0 | 116 | \\ or r0, r0 |
| 117 | : [ret] "={r0}" (-> u32), | 117 | : [ret] "={r0}" (-> u32), |
| 118 | : [number] "{r3}" (@intFromEnum(number)), | 118 | : [number] "{r3}" (@backingInt(number)), |
| 119 | [arg1] "{r4}" (arg1), | 119 | [arg1] "{r4}" (arg1), |
| 120 | [arg2] "{r5}" (arg2), | 120 | [arg2] "{r5}" (arg2), |
| 121 | [arg3] "{r6}" (arg3), | 121 | [arg3] "{r6}" (arg3), |
| ... | @@ -141,7 +141,7 @@ pub fn syscall6( | ... | @@ -141,7 +141,7 @@ pub fn syscall6( |
| 141 | \\ or r0, r0 | 141 | \\ or r0, r0 |
| 142 | \\ or r0, r0 | 142 | \\ or r0, r0 |
| 143 | : [ret] "={r0}" (-> u32), | 143 | : [ret] "={r0}" (-> u32), |
| 144 | : [number] "{r3}" (@intFromEnum(number)), | 144 | : [number] "{r3}" (@backingInt(number)), |
| 145 | [arg1] "{r4}" (arg1), | 145 | [arg1] "{r4}" (arg1), |
| 146 | [arg2] "{r5}" (arg2), | 146 | [arg2] "{r5}" (arg2), |
| 147 | [arg3] "{r6}" (arg3), | 147 | [arg3] "{r6}" (arg3), |
| ... | @@ -217,7 +217,7 @@ pub fn restore() callconv(.naked) noreturn { | ... | @@ -217,7 +217,7 @@ pub fn restore() callconv(.naked) noreturn { |
| 217 | \\ or r0, r0 | 217 | \\ or r0, r0 |
| 218 | \\ or r0, r0 | 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,7 +230,7 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 230 | \\ or r0, r0 | 230 | \\ or r0, r0 |
| 231 | \\ or r0, r0 | 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,7 +14,7 @@ pub fn syscall0( |
| 14 | \\ neg %%o0 | 14 | \\ neg %%o0 |
| 15 | \\1: | 15 | \\1: |
| 16 | : [ret] "={o0}" (-> u32), | 16 | : [ret] "={o0}" (-> u32), |
| 17 | : [number] "{g1}" (@intFromEnum(number)), | 17 | : [number] "{g1}" (@backingInt(number)), |
| 18 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); | 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,7 +29,7 @@ pub fn syscall1( |
| 29 | \\ neg %%o0 | 29 | \\ neg %%o0 |
| 30 | \\1: | 30 | \\1: |
| 31 | : [ret] "={o0}" (-> u32), | 31 | : [ret] "={o0}" (-> u32), |
| 32 | : [number] "{g1}" (@intFromEnum(number)), | 32 | : [number] "{g1}" (@backingInt(number)), |
| 33 | [arg1] "{o0}" (arg1), | 33 | [arg1] "{o0}" (arg1), |
| 34 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); | 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,7 +46,7 @@ pub fn syscall2( |
| 46 | \\ neg %%o0 | 46 | \\ neg %%o0 |
| 47 | \\1: | 47 | \\1: |
| 48 | : [ret] "={o0}" (-> u32), | 48 | : [ret] "={o0}" (-> u32), |
| 49 | : [number] "{g1}" (@intFromEnum(number)), | 49 | : [number] "{g1}" (@backingInt(number)), |
| 50 | [arg1] "{o0}" (arg1), | 50 | [arg1] "{o0}" (arg1), |
| 51 | [arg2] "{o1}" (arg2), | 51 | [arg2] "{o1}" (arg2), |
| 52 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); | 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,7 +65,7 @@ pub fn syscall3( |
| 65 | \\ neg %%o0 | 65 | \\ neg %%o0 |
| 66 | \\1: | 66 | \\1: |
| 67 | : [ret] "={o0}" (-> u32), | 67 | : [ret] "={o0}" (-> u32), |
| 68 | : [number] "{g1}" (@intFromEnum(number)), | 68 | : [number] "{g1}" (@backingInt(number)), |
| 69 | [arg1] "{o0}" (arg1), | 69 | [arg1] "{o0}" (arg1), |
| 70 | [arg2] "{o1}" (arg2), | 70 | [arg2] "{o1}" (arg2), |
| 71 | [arg3] "{o2}" (arg3), | 71 | [arg3] "{o2}" (arg3), |
| ... | @@ -86,7 +86,7 @@ pub fn syscall4( | ... | @@ -86,7 +86,7 @@ pub fn syscall4( |
| 86 | \\ neg %%o0 | 86 | \\ neg %%o0 |
| 87 | \\1: | 87 | \\1: |
| 88 | : [ret] "={o0}" (-> u32), | 88 | : [ret] "={o0}" (-> u32), |
| 89 | : [number] "{g1}" (@intFromEnum(number)), | 89 | : [number] "{g1}" (@backingInt(number)), |
| 90 | [arg1] "{o0}" (arg1), | 90 | [arg1] "{o0}" (arg1), |
| 91 | [arg2] "{o1}" (arg2), | 91 | [arg2] "{o1}" (arg2), |
| 92 | [arg3] "{o2}" (arg3), | 92 | [arg3] "{o2}" (arg3), |
| ... | @@ -109,7 +109,7 @@ pub fn syscall5( | ... | @@ -109,7 +109,7 @@ pub fn syscall5( |
| 109 | \\ neg %%o0 | 109 | \\ neg %%o0 |
| 110 | \\1: | 110 | \\1: |
| 111 | : [ret] "={o0}" (-> u32), | 111 | : [ret] "={o0}" (-> u32), |
| 112 | : [number] "{g1}" (@intFromEnum(number)), | 112 | : [number] "{g1}" (@backingInt(number)), |
| 113 | [arg1] "{o0}" (arg1), | 113 | [arg1] "{o0}" (arg1), |
| 114 | [arg2] "{o1}" (arg2), | 114 | [arg2] "{o1}" (arg2), |
| 115 | [arg3] "{o2}" (arg3), | 115 | [arg3] "{o2}" (arg3), |
| ... | @@ -134,7 +134,7 @@ pub fn syscall6( | ... | @@ -134,7 +134,7 @@ pub fn syscall6( |
| 134 | \\ neg %%o0 | 134 | \\ neg %%o0 |
| 135 | \\1: | 135 | \\1: |
| 136 | : [ret] "={o0}" (-> u32), | 136 | : [ret] "={o0}" (-> u32), |
| 137 | : [number] "{g1}" (@intFromEnum(number)), | 137 | : [number] "{g1}" (@backingInt(number)), |
| 138 | [arg1] "{o0}" (arg1), | 138 | [arg1] "{o0}" (arg1), |
| 139 | [arg2] "{o1}" (arg2), | 139 | [arg2] "{o1}" (arg2), |
| 140 | [arg3] "{o2}" (arg3), | 140 | [arg3] "{o2}" (arg3), |
| ... | @@ -161,7 +161,7 @@ pub fn syscall_pipe( | ... | @@ -161,7 +161,7 @@ pub fn syscall_pipe( |
| 161 | \\ clr %%o0 | 161 | \\ clr %%o0 |
| 162 | \\2: | 162 | \\2: |
| 163 | : [ret] "={o0}" (-> u32), | 163 | : [ret] "={o0}" (-> u32), |
| 164 | : [number] "{g1}" (@intFromEnum(SYS.pipe)), | 164 | : [number] "{g1}" (@backingInt(SYS.pipe)), |
| 165 | [arg] "r" (fd), | 165 | [arg] "r" (fd), |
| 166 | : .{ .memory = true, .g3 = true }); | 166 | : .{ .memory = true, .g3 = true }); |
| 167 | } | 167 | } |
| ... | @@ -184,7 +184,7 @@ pub fn syscall_fork() u32 { | ... | @@ -184,7 +184,7 @@ pub fn syscall_fork() u32 { |
| 184 | \\ and %%o1, %%o0, %%o0 | 184 | \\ and %%o1, %%o0, %%o0 |
| 185 | \\2: | 185 | \\2: |
| 186 | : [ret] "={o0}" (-> u32), | 186 | : [ret] "={o0}" (-> u32), |
| 187 | : [number] "{g1}" (@intFromEnum(SYS.fork)), | 187 | : [number] "{g1}" (@backingInt(SYS.fork)), |
| 188 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); | 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,7 +265,7 @@ pub const restore = restore_rt; |
| 265 | pub fn restore_rt() callconv(.c) void { | 265 | pub fn restore_rt() callconv(.c) void { |
| 266 | return asm volatile ("t 0x10" | 266 | return asm volatile ("t 0x10" |
| 267 | : | 267 | : |
| 268 | : [number] "{g1}" (@intFromEnum(SYS.rt_sigreturn)), | 268 | : [number] "{g1}" (@backingInt(SYS.rt_sigreturn)), |
| 269 | : .{ .memory = true, .xcc = true, .o0 = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); | 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,7 +14,7 @@ pub fn syscall0( |
| 14 | \\ neg %%o0 | 14 | \\ neg %%o0 |
| 15 | \\1: | 15 | \\1: |
| 16 | : [ret] "={o0}" (-> u64), | 16 | : [ret] "={o0}" (-> u64), |
| 17 | : [number] "{g1}" (@intFromEnum(number)), | 17 | : [number] "{g1}" (@backingInt(number)), |
| 18 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); | 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,7 +29,7 @@ pub fn syscall1( |
| 29 | \\ neg %%o0 | 29 | \\ neg %%o0 |
| 30 | \\1: | 30 | \\1: |
| 31 | : [ret] "={o0}" (-> u64), | 31 | : [ret] "={o0}" (-> u64), |
| 32 | : [number] "{g1}" (@intFromEnum(number)), | 32 | : [number] "{g1}" (@backingInt(number)), |
| 33 | [arg1] "{o0}" (arg1), | 33 | [arg1] "{o0}" (arg1), |
| 34 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); | 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,7 +46,7 @@ pub fn syscall2( |
| 46 | \\ neg %%o0 | 46 | \\ neg %%o0 |
| 47 | \\1: | 47 | \\1: |
| 48 | : [ret] "={o0}" (-> u64), | 48 | : [ret] "={o0}" (-> u64), |
| 49 | : [number] "{g1}" (@intFromEnum(number)), | 49 | : [number] "{g1}" (@backingInt(number)), |
| 50 | [arg1] "{o0}" (arg1), | 50 | [arg1] "{o0}" (arg1), |
| 51 | [arg2] "{o1}" (arg2), | 51 | [arg2] "{o1}" (arg2), |
| 52 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); | 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,7 +65,7 @@ pub fn syscall3( |
| 65 | \\ neg %%o0 | 65 | \\ neg %%o0 |
| 66 | \\1: | 66 | \\1: |
| 67 | : [ret] "={o0}" (-> u64), | 67 | : [ret] "={o0}" (-> u64), |
| 68 | : [number] "{g1}" (@intFromEnum(number)), | 68 | : [number] "{g1}" (@backingInt(number)), |
| 69 | [arg1] "{o0}" (arg1), | 69 | [arg1] "{o0}" (arg1), |
| 70 | [arg2] "{o1}" (arg2), | 70 | [arg2] "{o1}" (arg2), |
| 71 | [arg3] "{o2}" (arg3), | 71 | [arg3] "{o2}" (arg3), |
| ... | @@ -86,7 +86,7 @@ pub fn syscall4( | ... | @@ -86,7 +86,7 @@ pub fn syscall4( |
| 86 | \\ neg %%o0 | 86 | \\ neg %%o0 |
| 87 | \\1: | 87 | \\1: |
| 88 | : [ret] "={o0}" (-> u64), | 88 | : [ret] "={o0}" (-> u64), |
| 89 | : [number] "{g1}" (@intFromEnum(number)), | 89 | : [number] "{g1}" (@backingInt(number)), |
| 90 | [arg1] "{o0}" (arg1), | 90 | [arg1] "{o0}" (arg1), |
| 91 | [arg2] "{o1}" (arg2), | 91 | [arg2] "{o1}" (arg2), |
| 92 | [arg3] "{o2}" (arg3), | 92 | [arg3] "{o2}" (arg3), |
| ... | @@ -109,7 +109,7 @@ pub fn syscall5( | ... | @@ -109,7 +109,7 @@ pub fn syscall5( |
| 109 | \\ neg %%o0 | 109 | \\ neg %%o0 |
| 110 | \\1: | 110 | \\1: |
| 111 | : [ret] "={o0}" (-> u64), | 111 | : [ret] "={o0}" (-> u64), |
| 112 | : [number] "{g1}" (@intFromEnum(number)), | 112 | : [number] "{g1}" (@backingInt(number)), |
| 113 | [arg1] "{o0}" (arg1), | 113 | [arg1] "{o0}" (arg1), |
| 114 | [arg2] "{o1}" (arg2), | 114 | [arg2] "{o1}" (arg2), |
| 115 | [arg3] "{o2}" (arg3), | 115 | [arg3] "{o2}" (arg3), |
| ... | @@ -134,7 +134,7 @@ pub fn syscall6( | ... | @@ -134,7 +134,7 @@ pub fn syscall6( |
| 134 | \\ neg %%o0 | 134 | \\ neg %%o0 |
| 135 | \\1: | 135 | \\1: |
| 136 | : [ret] "={o0}" (-> u64), | 136 | : [ret] "={o0}" (-> u64), |
| 137 | : [number] "{g1}" (@intFromEnum(number)), | 137 | : [number] "{g1}" (@backingInt(number)), |
| 138 | [arg1] "{o0}" (arg1), | 138 | [arg1] "{o0}" (arg1), |
| 139 | [arg2] "{o1}" (arg2), | 139 | [arg2] "{o1}" (arg2), |
| 140 | [arg3] "{o2}" (arg3), | 140 | [arg3] "{o2}" (arg3), |
| ... | @@ -161,7 +161,7 @@ pub fn syscall_pipe( | ... | @@ -161,7 +161,7 @@ pub fn syscall_pipe( |
| 161 | \\ clr %%o0 | 161 | \\ clr %%o0 |
| 162 | \\2: | 162 | \\2: |
| 163 | : [ret] "={o0}" (-> u64), | 163 | : [ret] "={o0}" (-> u64), |
| 164 | : [number] "{g1}" (@intFromEnum(SYS.pipe)), | 164 | : [number] "{g1}" (@backingInt(SYS.pipe)), |
| 165 | [arg] "r" (fd), | 165 | [arg] "r" (fd), |
| 166 | : .{ .memory = true, .g3 = true }); | 166 | : .{ .memory = true, .g3 = true }); |
| 167 | } | 167 | } |
| ... | @@ -184,7 +184,7 @@ pub fn syscall_fork() u64 { | ... | @@ -184,7 +184,7 @@ pub fn syscall_fork() u64 { |
| 184 | \\ and %%o1, %%o0, %%o0 | 184 | \\ and %%o1, %%o0, %%o0 |
| 185 | \\2: | 185 | \\2: |
| 186 | : [ret] "={o0}" (-> u64), | 186 | : [ret] "={o0}" (-> u64), |
| 187 | : [number] "{g1}" (@intFromEnum(SYS.fork)), | 187 | : [number] "{g1}" (@backingInt(SYS.fork)), |
| 188 | : .{ .memory = true, .xcc = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); | 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,7 +264,7 @@ pub const restore = restore_rt; |
| 264 | pub fn restore_rt() callconv(.c) void { | 264 | pub fn restore_rt() callconv(.c) void { |
| 265 | return asm volatile ("t 0x6d" | 265 | return asm volatile ("t 0x6d" |
| 266 | : | 266 | : |
| 267 | : [number] "{g1}" (@intFromEnum(SYS.rt_sigreturn)), | 267 | : [number] "{g1}" (@backingInt(SYS.rt_sigreturn)), |
| 268 | : .{ .memory = true, .xcc = true, .o0 = true, .o1 = true, .o2 = true, .o3 = true, .o4 = true, .o5 = true, .o7 = true }); | 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,8 +186,8 @@ test "sysinfo" { |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | comptime { | 188 | comptime { |
| 189 | assert(128 == @as(u32, @bitCast(linux.FUTEX_OP{ .cmd = @enumFromInt(0), .private = true, .realtime = false }))); | 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 = @enumFromInt(0), .private = false, .realtime = true }))); | 190 | assert(256 == @as(u32, @bitCast(linux.FUTEX_OP{ .cmd = @fromBackingInt(@intCast(0)), .private = false, .realtime = true }))); |
| 191 | 191 | ||
| 192 | // Check futex_param4 union is packed correctly | 192 | // Check futex_param4 union is packed correctly |
| 193 | const param_union = linux.futex_param4{ | 193 | const param_union = linux.futex_param4{ |
| ... | @@ -277,7 +277,7 @@ test "futex v1" { | ... | @@ -277,7 +277,7 @@ test "futex v1" { |
| 277 | 277 | ||
| 278 | comptime { | 278 | comptime { |
| 279 | assert(2 == @as(u32, @bitCast(linux.FUTEX2_FLAGS{ .size = .U32, .private = false }))); | 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 | test "futex2_waitv" { | 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,7 +12,7 @@ pub const syscall_arg_t = arm.syscall_arg_t; |
| 12 | pub fn syscall0( | 12 | pub fn syscall0( |
| 13 | number: SYS, | 13 | number: SYS, |
| 14 | ) u32 { | 14 | ) u32 { |
| 15 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | 15 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; |
| 16 | return asm volatile ( | 16 | return asm volatile ( |
| 17 | \\ str r7, [%[tmp], #4] | 17 | \\ str r7, [%[tmp], #4] |
| 18 | \\ ldr r7, [%[tmp]] | 18 | \\ ldr r7, [%[tmp]] |
| ... | @@ -27,7 +27,7 @@ pub fn syscall1( | ... | @@ -27,7 +27,7 @@ pub fn syscall1( |
| 27 | number: SYS, | 27 | number: SYS, |
| 28 | arg1: syscall_arg_t, | 28 | arg1: syscall_arg_t, |
| 29 | ) u32 { | 29 | ) u32 { |
| 30 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | 30 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; |
| 31 | return asm volatile ( | 31 | return asm volatile ( |
| 32 | \\ str r7, [%[tmp], #4] | 32 | \\ str r7, [%[tmp], #4] |
| 33 | \\ ldr r7, [%[tmp]] | 33 | \\ ldr r7, [%[tmp]] |
| ... | @@ -44,7 +44,7 @@ pub fn syscall2( | ... | @@ -44,7 +44,7 @@ pub fn syscall2( |
| 44 | arg1: syscall_arg_t, | 44 | arg1: syscall_arg_t, |
| 45 | arg2: syscall_arg_t, | 45 | arg2: syscall_arg_t, |
| 46 | ) u32 { | 46 | ) u32 { |
| 47 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | 47 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; |
| 48 | return asm volatile ( | 48 | return asm volatile ( |
| 49 | \\ str r7, [%[tmp], #4] | 49 | \\ str r7, [%[tmp], #4] |
| 50 | \\ ldr r7, [%[tmp]] | 50 | \\ ldr r7, [%[tmp]] |
| ... | @@ -63,7 +63,7 @@ pub fn syscall3( | ... | @@ -63,7 +63,7 @@ pub fn syscall3( |
| 63 | arg2: syscall_arg_t, | 63 | arg2: syscall_arg_t, |
| 64 | arg3: syscall_arg_t, | 64 | arg3: syscall_arg_t, |
| 65 | ) u32 { | 65 | ) u32 { |
| 66 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | 66 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; |
| 67 | return asm volatile ( | 67 | return asm volatile ( |
| 68 | \\ str r7, [%[tmp], #4] | 68 | \\ str r7, [%[tmp], #4] |
| 69 | \\ ldr r7, [%[tmp]] | 69 | \\ ldr r7, [%[tmp]] |
| ... | @@ -84,7 +84,7 @@ pub fn syscall4( | ... | @@ -84,7 +84,7 @@ pub fn syscall4( |
| 84 | arg3: syscall_arg_t, | 84 | arg3: syscall_arg_t, |
| 85 | arg4: syscall_arg_t, | 85 | arg4: syscall_arg_t, |
| 86 | ) u32 { | 86 | ) u32 { |
| 87 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | 87 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; |
| 88 | return asm volatile ( | 88 | return asm volatile ( |
| 89 | \\ str r7, [%[tmp], #4] | 89 | \\ str r7, [%[tmp], #4] |
| 90 | \\ ldr r7, [%[tmp]] | 90 | \\ ldr r7, [%[tmp]] |
| ... | @@ -107,7 +107,7 @@ pub fn syscall5( | ... | @@ -107,7 +107,7 @@ pub fn syscall5( |
| 107 | arg4: syscall_arg_t, | 107 | arg4: syscall_arg_t, |
| 108 | arg5: syscall_arg_t, | 108 | arg5: syscall_arg_t, |
| 109 | ) u32 { | 109 | ) u32 { |
| 110 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | 110 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; |
| 111 | return asm volatile ( | 111 | return asm volatile ( |
| 112 | \\ str r7, [%[tmp], #4] | 112 | \\ str r7, [%[tmp], #4] |
| 113 | \\ ldr r7, [%[tmp]] | 113 | \\ ldr r7, [%[tmp]] |
| ... | @@ -132,7 +132,7 @@ pub fn syscall6( | ... | @@ -132,7 +132,7 @@ pub fn syscall6( |
| 132 | arg5: syscall_arg_t, | 132 | arg5: syscall_arg_t, |
| 133 | arg6: syscall_arg_t, | 133 | arg6: syscall_arg_t, |
| 134 | ) u32 { | 134 | ) u32 { |
| 135 | var buf: [2]syscall_arg_t = .{ @intFromEnum(number), undefined }; | 135 | var buf: [2]syscall_arg_t = .{ @backingInt(number), undefined }; |
| 136 | return asm volatile ( | 136 | return asm volatile ( |
| 137 | \\ str r7, [%[tmp], #4] | 137 | \\ str r7, [%[tmp], #4] |
| 138 | \\ ldr r7, [%[tmp]] | 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,7 +84,7 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: elf.Versym, vername: []const u8, str |
| 84 | var def = def_arg; | 84 | var def = def_arg; |
| 85 | const vsym_index = vsym_arg.VERSION; | 85 | const vsym_index = vsym_arg.VERSION; |
| 86 | while (true) { | 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 | if (def.next == 0) return false; | 88 | if (def.next == 0) return false; |
| 89 | def = @ptrFromInt(@intFromPtr(def) + def.next); | 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,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u32 { | 9 | ) u32 { |
| 10 | return asm volatile ("syscall" | 10 | return asm volatile ("syscall" |
| 11 | : [ret] "={rax}" (-> u32), | 11 | : [ret] "={rax}" (-> u32), |
| 12 | : [number] "{rax}" (@intFromEnum(number)), | 12 | : [number] "{rax}" (@backingInt(number)), |
| 13 | : .{ .rcx = true, .r11 = true, .memory = true }); | 13 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u32 { | 19 | ) u32 { |
| 20 | return asm volatile ("syscall" | 20 | return asm volatile ("syscall" |
| 21 | : [ret] "={rax}" (-> u32), | 21 | : [ret] "={rax}" (-> u32), |
| 22 | : [number] "{rax}" (@intFromEnum(number)), | 22 | : [number] "{rax}" (@backingInt(number)), |
| 23 | [arg1] "{rdi}" (arg1), | 23 | [arg1] "{rdi}" (arg1), |
| 24 | : .{ .rcx = true, .r11 = true, .memory = true }); | 24 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u32 { | 31 | ) u32 { |
| 32 | return asm volatile ("syscall" | 32 | return asm volatile ("syscall" |
| 33 | : [ret] "={rax}" (-> u32), | 33 | : [ret] "={rax}" (-> u32), |
| 34 | : [number] "{rax}" (@intFromEnum(number)), | 34 | : [number] "{rax}" (@backingInt(number)), |
| 35 | [arg1] "{rdi}" (arg1), | 35 | [arg1] "{rdi}" (arg1), |
| 36 | [arg2] "{rsi}" (arg2), | 36 | [arg2] "{rsi}" (arg2), |
| 37 | : .{ .rcx = true, .r11 = true, .memory = true }); | 37 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u32 { | 45 | ) u32 { |
| 46 | return asm volatile ("syscall" | 46 | return asm volatile ("syscall" |
| 47 | : [ret] "={rax}" (-> u32), | 47 | : [ret] "={rax}" (-> u32), |
| 48 | : [number] "{rax}" (@intFromEnum(number)), | 48 | : [number] "{rax}" (@backingInt(number)), |
| 49 | [arg1] "{rdi}" (arg1), | 49 | [arg1] "{rdi}" (arg1), |
| 50 | [arg2] "{rsi}" (arg2), | 50 | [arg2] "{rsi}" (arg2), |
| 51 | [arg3] "{rdx}" (arg3), | 51 | [arg3] "{rdx}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u32 { | 61 | ) u32 { |
| 62 | return asm volatile ("syscall" | 62 | return asm volatile ("syscall" |
| 63 | : [ret] "={rax}" (-> u32), | 63 | : [ret] "={rax}" (-> u32), |
| 64 | : [number] "{rax}" (@intFromEnum(number)), | 64 | : [number] "{rax}" (@backingInt(number)), |
| 65 | [arg1] "{rdi}" (arg1), | 65 | [arg1] "{rdi}" (arg1), |
| 66 | [arg2] "{rsi}" (arg2), | 66 | [arg2] "{rsi}" (arg2), |
| 67 | [arg3] "{rdx}" (arg3), | 67 | [arg3] "{rdx}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u32 { | 79 | ) u32 { |
| 80 | return asm volatile ("syscall" | 80 | return asm volatile ("syscall" |
| 81 | : [ret] "={rax}" (-> u32), | 81 | : [ret] "={rax}" (-> u32), |
| 82 | : [number] "{rax}" (@intFromEnum(number)), | 82 | : [number] "{rax}" (@backingInt(number)), |
| 83 | [arg1] "{rdi}" (arg1), | 83 | [arg1] "{rdi}" (arg1), |
| 84 | [arg2] "{rsi}" (arg2), | 84 | [arg2] "{rsi}" (arg2), |
| 85 | [arg3] "{rdx}" (arg3), | 85 | [arg3] "{rdx}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u32 { | 99 | ) u32 { |
| 100 | return asm volatile ("syscall" | 100 | return asm volatile ("syscall" |
| 101 | : [ret] "={rax}" (-> u32), | 101 | : [ret] "={rax}" (-> u32), |
| 102 | : [number] "{rax}" (@intFromEnum(number)), | 102 | : [number] "{rax}" (@backingInt(number)), |
| 103 | [arg1] "{rdi}" (arg1), | 103 | [arg1] "{rdi}" (arg1), |
| 104 | [arg2] "{rsi}" (arg2), | 104 | [arg2] "{rsi}" (arg2), |
| 105 | [arg3] "{rdx}" (arg3), | 105 | [arg3] "{rdx}" (arg3), |
| ... | @@ -116,7 +116,7 @@ pub fn syscall_lseek( | ... | @@ -116,7 +116,7 @@ pub fn syscall_lseek( |
| 116 | ) u64 { | 116 | ) u64 { |
| 117 | return asm volatile ("syscall" | 117 | return asm volatile ("syscall" |
| 118 | : [ret] "={rax}" (-> u64), | 118 | : [ret] "={rax}" (-> u64), |
| 119 | : [number] "{rax}" (@intFromEnum(SYS.lseek)), | 119 | : [number] "{rax}" (@backingInt(SYS.lseek)), |
| 120 | [fd] "{rdi}" (@as(u32, @bitCast(fd))), | 120 | [fd] "{rdi}" (@as(u32, @bitCast(fd))), |
| 121 | [offset] "{rsi}" (@as(u64, @bitCast(offset))), | 121 | [offset] "{rsi}" (@as(u64, @bitCast(offset))), |
| 122 | [whence] "{rdx}" (whence), | 122 | [whence] "{rdx}" (whence), |
| ... | @@ -165,12 +165,12 @@ pub fn restore_rt() callconv(.naked) noreturn { | ... | @@ -165,12 +165,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 165 | \\ movl %[number], %%eax | 165 | \\ movl %[number], %%eax |
| 166 | \\ syscall | 166 | \\ syscall |
| 167 | : | 167 | : |
| 168 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | 168 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), |
| 169 | ), | 169 | ), |
| 170 | else => asm volatile ( | 170 | else => asm volatile ( |
| 171 | \\ syscall | 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,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u32 { | 9 | ) u32 { |
| 10 | return asm volatile ("int $0x80" | 10 | return asm volatile ("int $0x80" |
| 11 | : [ret] "={eax}" (-> u32), | 11 | : [ret] "={eax}" (-> u32), |
| 12 | : [number] "{eax}" (@intFromEnum(number)), | 12 | : [number] "{eax}" (@backingInt(number)), |
| 13 | : .{ .memory = true }); | 13 | : .{ .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u32 { | 19 | ) u32 { |
| 20 | return asm volatile ("int $0x80" | 20 | return asm volatile ("int $0x80" |
| 21 | : [ret] "={eax}" (-> u32), | 21 | : [ret] "={eax}" (-> u32), |
| 22 | : [number] "{eax}" (@intFromEnum(number)), | 22 | : [number] "{eax}" (@backingInt(number)), |
| 23 | [arg1] "{ebx}" (arg1), | 23 | [arg1] "{ebx}" (arg1), |
| 24 | : .{ .memory = true }); | 24 | : .{ .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u32 { | 31 | ) u32 { |
| 32 | return asm volatile ("int $0x80" | 32 | return asm volatile ("int $0x80" |
| 33 | : [ret] "={eax}" (-> u32), | 33 | : [ret] "={eax}" (-> u32), |
| 34 | : [number] "{eax}" (@intFromEnum(number)), | 34 | : [number] "{eax}" (@backingInt(number)), |
| 35 | [arg1] "{ebx}" (arg1), | 35 | [arg1] "{ebx}" (arg1), |
| 36 | [arg2] "{ecx}" (arg2), | 36 | [arg2] "{ecx}" (arg2), |
| 37 | : .{ .memory = true }); | 37 | : .{ .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u32 { | 45 | ) u32 { |
| 46 | return asm volatile ("int $0x80" | 46 | return asm volatile ("int $0x80" |
| 47 | : [ret] "={eax}" (-> u32), | 47 | : [ret] "={eax}" (-> u32), |
| 48 | : [number] "{eax}" (@intFromEnum(number)), | 48 | : [number] "{eax}" (@backingInt(number)), |
| 49 | [arg1] "{ebx}" (arg1), | 49 | [arg1] "{ebx}" (arg1), |
| 50 | [arg2] "{ecx}" (arg2), | 50 | [arg2] "{ecx}" (arg2), |
| 51 | [arg3] "{edx}" (arg3), | 51 | [arg3] "{edx}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u32 { | 61 | ) u32 { |
| 62 | return asm volatile ("int $0x80" | 62 | return asm volatile ("int $0x80" |
| 63 | : [ret] "={eax}" (-> u32), | 63 | : [ret] "={eax}" (-> u32), |
| 64 | : [number] "{eax}" (@intFromEnum(number)), | 64 | : [number] "{eax}" (@backingInt(number)), |
| 65 | [arg1] "{ebx}" (arg1), | 65 | [arg1] "{ebx}" (arg1), |
| 66 | [arg2] "{ecx}" (arg2), | 66 | [arg2] "{ecx}" (arg2), |
| 67 | [arg3] "{edx}" (arg3), | 67 | [arg3] "{edx}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u32 { | 79 | ) u32 { |
| 80 | return asm volatile ("int $0x80" | 80 | return asm volatile ("int $0x80" |
| 81 | : [ret] "={eax}" (-> u32), | 81 | : [ret] "={eax}" (-> u32), |
| 82 | : [number] "{eax}" (@intFromEnum(number)), | 82 | : [number] "{eax}" (@backingInt(number)), |
| 83 | [arg1] "{ebx}" (arg1), | 83 | [arg1] "{ebx}" (arg1), |
| 84 | [arg2] "{ecx}" (arg2), | 84 | [arg2] "{ecx}" (arg2), |
| 85 | [arg3] "{edx}" (arg3), | 85 | [arg3] "{edx}" (arg3), |
| ... | @@ -117,7 +117,7 @@ pub fn syscall6( | ... | @@ -117,7 +117,7 @@ pub fn syscall6( |
| 117 | \\ pop %%ebp | 117 | \\ pop %%ebp |
| 118 | \\ pop %%edi | 118 | \\ pop %%edi |
| 119 | : [ret] "={eax}" (-> u32), | 119 | : [ret] "={eax}" (-> u32), |
| 120 | : [number] "{eax}" (@intFromEnum(number)), | 120 | : [number] "{eax}" (@backingInt(number)), |
| 121 | [arg1] "{ebx}" (arg1), | 121 | [arg1] "{ebx}" (arg1), |
| 122 | [arg2] "{ecx}" (arg2), | 122 | [arg2] "{ecx}" (arg2), |
| 123 | [arg3] "{edx}" (arg3), | 123 | [arg3] "{edx}" (arg3), |
| ... | @@ -129,7 +129,7 @@ pub fn syscall6( | ... | @@ -129,7 +129,7 @@ pub fn syscall6( |
| 129 | pub fn socketcall(call: u32, args: [*]const u32) u32 { | 129 | pub fn socketcall(call: u32, args: [*]const u32) u32 { |
| 130 | return asm volatile ("int $0x80" | 130 | return asm volatile ("int $0x80" |
| 131 | : [ret] "={eax}" (-> u32), | 131 | : [ret] "={eax}" (-> u32), |
| 132 | : [number] "{eax}" (@intFromEnum(SYS.socketcall)), | 132 | : [number] "{eax}" (@backingInt(SYS.socketcall)), |
| 133 | [arg1] "{ebx}" (call), | 133 | [arg1] "{ebx}" (call), |
| 134 | [arg2] "{ecx}" (@intFromPtr(args)), | 134 | [arg2] "{ecx}" (@intFromPtr(args)), |
| 135 | : .{ .memory = true }); | 135 | : .{ .memory = true }); |
| ... | @@ -192,13 +192,13 @@ pub fn restore() callconv(.naked) noreturn { | ... | @@ -192,13 +192,13 @@ pub fn restore() callconv(.naked) noreturn { |
| 192 | \\ movl %[number], %%eax | 192 | \\ movl %[number], %%eax |
| 193 | \\ int $0x80 | 193 | \\ int $0x80 |
| 194 | : | 194 | : |
| 195 | : [number] "i" (@intFromEnum(SYS.sigreturn)), | 195 | : [number] "i" (@backingInt(SYS.sigreturn)), |
| 196 | ), | 196 | ), |
| 197 | else => asm volatile ( | 197 | else => asm volatile ( |
| 198 | \\ addl $4, %%esp | 198 | \\ addl $4, %%esp |
| 199 | \\ int $0x80 | 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,12 +209,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 209 | \\ movl %[number], %%eax | 209 | \\ movl %[number], %%eax |
| 210 | \\ int $0x80 | 210 | \\ int $0x80 |
| 211 | : | 211 | : |
| 212 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | 212 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), |
| 213 | ), | 213 | ), |
| 214 | else => asm volatile ( | 214 | else => asm volatile ( |
| 215 | \\ int $0x80 | 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,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u64 { | 9 | ) u64 { |
| 10 | return asm volatile ("syscall" | 10 | return asm volatile ("syscall" |
| 11 | : [ret] "={rax}" (-> u64), | 11 | : [ret] "={rax}" (-> u64), |
| 12 | : [number] "{rax}" (@intFromEnum(number)), | 12 | : [number] "{rax}" (@backingInt(number)), |
| 13 | : .{ .rcx = true, .r11 = true, .memory = true }); | 13 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u64 { | 19 | ) u64 { |
| 20 | return asm volatile ("syscall" | 20 | return asm volatile ("syscall" |
| 21 | : [ret] "={rax}" (-> u64), | 21 | : [ret] "={rax}" (-> u64), |
| 22 | : [number] "{rax}" (@intFromEnum(number)), | 22 | : [number] "{rax}" (@backingInt(number)), |
| 23 | [arg1] "{rdi}" (arg1), | 23 | [arg1] "{rdi}" (arg1), |
| 24 | : .{ .rcx = true, .r11 = true, .memory = true }); | 24 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u64 { | 31 | ) u64 { |
| 32 | return asm volatile ("syscall" | 32 | return asm volatile ("syscall" |
| 33 | : [ret] "={rax}" (-> u64), | 33 | : [ret] "={rax}" (-> u64), |
| 34 | : [number] "{rax}" (@intFromEnum(number)), | 34 | : [number] "{rax}" (@backingInt(number)), |
| 35 | [arg1] "{rdi}" (arg1), | 35 | [arg1] "{rdi}" (arg1), |
| 36 | [arg2] "{rsi}" (arg2), | 36 | [arg2] "{rsi}" (arg2), |
| 37 | : .{ .rcx = true, .r11 = true, .memory = true }); | 37 | : .{ .rcx = true, .r11 = true, .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u64 { | 45 | ) u64 { |
| 46 | return asm volatile ("syscall" | 46 | return asm volatile ("syscall" |
| 47 | : [ret] "={rax}" (-> u64), | 47 | : [ret] "={rax}" (-> u64), |
| 48 | : [number] "{rax}" (@intFromEnum(number)), | 48 | : [number] "{rax}" (@backingInt(number)), |
| 49 | [arg1] "{rdi}" (arg1), | 49 | [arg1] "{rdi}" (arg1), |
| 50 | [arg2] "{rsi}" (arg2), | 50 | [arg2] "{rsi}" (arg2), |
| 51 | [arg3] "{rdx}" (arg3), | 51 | [arg3] "{rdx}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u64 { | 61 | ) u64 { |
| 62 | return asm volatile ("syscall" | 62 | return asm volatile ("syscall" |
| 63 | : [ret] "={rax}" (-> u64), | 63 | : [ret] "={rax}" (-> u64), |
| 64 | : [number] "{rax}" (@intFromEnum(number)), | 64 | : [number] "{rax}" (@backingInt(number)), |
| 65 | [arg1] "{rdi}" (arg1), | 65 | [arg1] "{rdi}" (arg1), |
| 66 | [arg2] "{rsi}" (arg2), | 66 | [arg2] "{rsi}" (arg2), |
| 67 | [arg3] "{rdx}" (arg3), | 67 | [arg3] "{rdx}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u64 { | 79 | ) u64 { |
| 80 | return asm volatile ("syscall" | 80 | return asm volatile ("syscall" |
| 81 | : [ret] "={rax}" (-> u64), | 81 | : [ret] "={rax}" (-> u64), |
| 82 | : [number] "{rax}" (@intFromEnum(number)), | 82 | : [number] "{rax}" (@backingInt(number)), |
| 83 | [arg1] "{rdi}" (arg1), | 83 | [arg1] "{rdi}" (arg1), |
| 84 | [arg2] "{rsi}" (arg2), | 84 | [arg2] "{rsi}" (arg2), |
| 85 | [arg3] "{rdx}" (arg3), | 85 | [arg3] "{rdx}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u64 { | 99 | ) u64 { |
| 100 | return asm volatile ("syscall" | 100 | return asm volatile ("syscall" |
| 101 | : [ret] "={rax}" (-> u64), | 101 | : [ret] "={rax}" (-> u64), |
| 102 | : [number] "{rax}" (@intFromEnum(number)), | 102 | : [number] "{rax}" (@backingInt(number)), |
| 103 | [arg1] "{rdi}" (arg1), | 103 | [arg1] "{rdi}" (arg1), |
| 104 | [arg2] "{rsi}" (arg2), | 104 | [arg2] "{rsi}" (arg2), |
| 105 | [arg3] "{rdx}" (arg3), | 105 | [arg3] "{rdx}" (arg3), |
| ... | @@ -151,12 +151,12 @@ pub fn restore_rt() callconv(.naked) noreturn { | ... | @@ -151,12 +151,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 151 | \\ movl %[number], %%eax | 151 | \\ movl %[number], %%eax |
| 152 | \\ syscall | 152 | \\ syscall |
| 153 | : | 153 | : |
| 154 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), | 154 | : [number] "i" (@backingInt(SYS.rt_sigreturn)), |
| 155 | ), | 155 | ), |
| 156 | else => asm volatile ( | 156 | else => asm volatile ( |
| 157 | \\ syscall | 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,7 +9,7 @@ pub fn syscall0( |
| 9 | ) u32 { | 9 | ) u32 { |
| 10 | return asm volatile ("syscall" | 10 | return asm volatile ("syscall" |
| 11 | : [ret] "={a2}" (-> u32), | 11 | : [ret] "={a2}" (-> u32), |
| 12 | : [number] "{a2}" (@intFromEnum(number)), | 12 | : [number] "{a2}" (@backingInt(number)), |
| 13 | : .{ .memory = true }); | 13 | : .{ .memory = true }); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| ... | @@ -19,7 +19,7 @@ pub fn syscall1( | ... | @@ -19,7 +19,7 @@ pub fn syscall1( |
| 19 | ) u32 { | 19 | ) u32 { |
| 20 | return asm volatile ("syscall" | 20 | return asm volatile ("syscall" |
| 21 | : [ret] "={a2}" (-> u32), | 21 | : [ret] "={a2}" (-> u32), |
| 22 | : [number] "{a2}" (@intFromEnum(number)), | 22 | : [number] "{a2}" (@backingInt(number)), |
| 23 | [arg1] "{a6}" (arg1), | 23 | [arg1] "{a6}" (arg1), |
| 24 | : .{ .memory = true }); | 24 | : .{ .memory = true }); |
| 25 | } | 25 | } |
| ... | @@ -31,7 +31,7 @@ pub fn syscall2( | ... | @@ -31,7 +31,7 @@ pub fn syscall2( |
| 31 | ) u32 { | 31 | ) u32 { |
| 32 | return asm volatile ("syscall" | 32 | return asm volatile ("syscall" |
| 33 | : [ret] "={a2}" (-> u32), | 33 | : [ret] "={a2}" (-> u32), |
| 34 | : [number] "{a2}" (@intFromEnum(number)), | 34 | : [number] "{a2}" (@backingInt(number)), |
| 35 | [arg1] "{a6}" (arg1), | 35 | [arg1] "{a6}" (arg1), |
| 36 | [arg2] "{a3}" (arg2), | 36 | [arg2] "{a3}" (arg2), |
| 37 | : .{ .memory = true }); | 37 | : .{ .memory = true }); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3( | ... | @@ -45,7 +45,7 @@ pub fn syscall3( |
| 45 | ) u32 { | 45 | ) u32 { |
| 46 | return asm volatile ("syscall" | 46 | return asm volatile ("syscall" |
| 47 | : [ret] "={a2}" (-> u32), | 47 | : [ret] "={a2}" (-> u32), |
| 48 | : [number] "{a2}" (@intFromEnum(number)), | 48 | : [number] "{a2}" (@backingInt(number)), |
| 49 | [arg1] "{a6}" (arg1), | 49 | [arg1] "{a6}" (arg1), |
| 50 | [arg2] "{a3}" (arg2), | 50 | [arg2] "{a3}" (arg2), |
| 51 | [arg3] "{a4}" (arg3), | 51 | [arg3] "{a4}" (arg3), |
| ... | @@ -61,7 +61,7 @@ pub fn syscall4( | ... | @@ -61,7 +61,7 @@ pub fn syscall4( |
| 61 | ) u32 { | 61 | ) u32 { |
| 62 | return asm volatile ("syscall" | 62 | return asm volatile ("syscall" |
| 63 | : [ret] "={a2}" (-> u32), | 63 | : [ret] "={a2}" (-> u32), |
| 64 | : [number] "{a2}" (@intFromEnum(number)), | 64 | : [number] "{a2}" (@backingInt(number)), |
| 65 | [arg1] "{a6}" (arg1), | 65 | [arg1] "{a6}" (arg1), |
| 66 | [arg2] "{a3}" (arg2), | 66 | [arg2] "{a3}" (arg2), |
| 67 | [arg3] "{a4}" (arg3), | 67 | [arg3] "{a4}" (arg3), |
| ... | @@ -79,7 +79,7 @@ pub fn syscall5( | ... | @@ -79,7 +79,7 @@ pub fn syscall5( |
| 79 | ) u32 { | 79 | ) u32 { |
| 80 | return asm volatile ("syscall" | 80 | return asm volatile ("syscall" |
| 81 | : [ret] "={a2}" (-> u32), | 81 | : [ret] "={a2}" (-> u32), |
| 82 | : [number] "{a2}" (@intFromEnum(number)), | 82 | : [number] "{a2}" (@backingInt(number)), |
| 83 | [arg1] "{a6}" (arg1), | 83 | [arg1] "{a6}" (arg1), |
| 84 | [arg2] "{a3}" (arg2), | 84 | [arg2] "{a3}" (arg2), |
| 85 | [arg3] "{a4}" (arg3), | 85 | [arg3] "{a4}" (arg3), |
| ... | @@ -99,7 +99,7 @@ pub fn syscall6( | ... | @@ -99,7 +99,7 @@ pub fn syscall6( |
| 99 | ) u32 { | 99 | ) u32 { |
| 100 | return asm volatile ("syscall" | 100 | return asm volatile ("syscall" |
| 101 | : [ret] "={a2}" (-> u32), | 101 | : [ret] "={a2}" (-> u32), |
| 102 | : [number] "{a2}" (@intFromEnum(number)), | 102 | : [number] "{a2}" (@backingInt(number)), |
| 103 | [arg1] "{a6}" (arg1), | 103 | [arg1] "{a6}" (arg1), |
| 104 | [arg2] "{a3}" (arg2), | 104 | [arg2] "{a3}" (arg2), |
| 105 | [arg3] "{a4}" (arg3), | 105 | [arg3] "{a4}" (arg3), |
| ... | @@ -178,12 +178,12 @@ pub fn restore_rt() callconv(.naked) noreturn { | ... | @@ -178,12 +178,12 @@ pub fn restore_rt() callconv(.naked) noreturn { |
| 178 | \\ movi a2, %[number] | 178 | \\ movi a2, %[number] |
| 179 | \\ syscall | 179 | \\ syscall |
| 180 | : | 180 | : |
| 181 | : [number] "I" (@intFromEnum(SYS.rt_sigreturn)), | 181 | : [number] "I" (@backingInt(SYS.rt_sigreturn)), |
| 182 | ), | 182 | ), |
| 183 | else => asm volatile ( | 183 | else => asm volatile ( |
| 184 | \\ syscall | 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,7 +100,7 @@ pub const E = enum(u16) { |
| 100 | pub fn errno(r: usize) E { | 100 | pub fn errno(r: usize) E { |
| 101 | const signed_r: isize = @bitCast(r); | 101 | const signed_r: isize = @bitCast(r); |
| 102 | const int = if (signed_r > -4096 and signed_r < 0) -signed_r else 0; | 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 | // The max bytes that can be in the errstr buff | 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,7 +10,7 @@ pub fn syscall1(sys: plan9.SYS, arg0: usize) usize { |
| 10 | \\pop %%r11 | 10 | \\pop %%r11 |
| 11 | : [ret] "={rax}" (-> usize), | 11 | : [ret] "={rax}" (-> usize), |
| 12 | : [arg0] "{r8}" (arg0), | 12 | : [arg0] "{r8}" (arg0), |
| 13 | [syscall_number] "{rbp}" (@intFromEnum(sys)), | 13 | [syscall_number] "{rbp}" (@backingInt(sys)), |
| 14 | : .{ .rcx = true, .rax = true, .rbp = true, .r11 = true, .memory = true }); | 14 | : .{ .rcx = true, .rax = true, .rbp = true, .r11 = true, .memory = true }); |
| 15 | } | 15 | } |
| 16 | pub fn syscall2(sys: plan9.SYS, arg0: usize, arg1: usize) usize { | 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,7 +25,7 @@ pub fn syscall2(sys: plan9.SYS, arg0: usize, arg1: usize) usize { |
| 25 | : [ret] "={rax}" (-> usize), | 25 | : [ret] "={rax}" (-> usize), |
| 26 | : [arg0] "{r8}" (arg0), | 26 | : [arg0] "{r8}" (arg0), |
| 27 | [arg1] "{r9}" (arg1), | 27 | [arg1] "{r9}" (arg1), |
| 28 | [syscall_number] "{rbp}" (@intFromEnum(sys)), | 28 | [syscall_number] "{rbp}" (@backingInt(sys)), |
| 29 | : .{ .rcx = true, .rax = true, .rbp = true, .r11 = true, .memory = true }); | 29 | : .{ .rcx = true, .rax = true, .rbp = true, .r11 = true, .memory = true }); |
| 30 | } | 30 | } |
| 31 | pub fn syscall3(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize) usize { | 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,7 +43,7 @@ pub fn syscall3(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize) usize { |
| 43 | : [arg0] "{r8}" (arg0), | 43 | : [arg0] "{r8}" (arg0), |
| 44 | [arg1] "{r9}" (arg1), | 44 | [arg1] "{r9}" (arg1), |
| 45 | [arg2] "{r10}" (arg2), | 45 | [arg2] "{r10}" (arg2), |
| 46 | [syscall_number] "{rbp}" (@intFromEnum(sys)), | 46 | [syscall_number] "{rbp}" (@backingInt(sys)), |
| 47 | : .{ .rcx = true, .rax = true, .rbp = true, .r11 = true, .memory = true }); | 47 | : .{ .rcx = true, .rax = true, .rbp = true, .r11 = true, .memory = true }); |
| 48 | } | 48 | } |
| 49 | pub fn syscall4(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize, arg3: usize) usize { | 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,6 +64,6 @@ pub fn syscall4(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize, arg3: usi |
| 64 | [arg1] "{r9}" (arg1), | 64 | [arg1] "{r9}" (arg1), |
| 65 | [arg2] "{r10}" (arg2), | 65 | [arg2] "{r10}" (arg2), |
| 66 | [arg3] "{r11}" (arg3), | 66 | [arg3] "{r11}" (arg3), |
| 67 | [syscall_number] "{rbp}" (@intFromEnum(sys)), | 67 | [syscall_number] "{rbp}" (@backingInt(sys)), |
| 68 | : .{ .rcx = true, .rax = true, .rbp = true, .r11 = true, .memory = true }); | 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,7 +181,7 @@ pub const Time = extern struct { |
| 181 | var days: u9 = 0; | 181 | var days: u9 = 0; |
| 182 | var month: u4 = 0; | 182 | var month: u4 = 0; |
| 183 | while (month < max_month) : (month += 1) { | 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 | return days; | 186 | return days; |
| 187 | } | 187 | } |
lib/std/os/uefi/pool_allocator.zig+3-3| ... | @@ -117,7 +117,7 @@ fn uefi_alloc( | ... | @@ -117,7 +117,7 @@ fn uefi_alloc( |
| 117 | ) ?[*]u8 { | 117 | ) ?[*]u8 { |
| 118 | _ = ret_addr; | 118 | _ = ret_addr; |
| 119 | 119 | ||
| 120 | std.debug.assert(@intFromEnum(alignment) <= 3); | 120 | std.debug.assert(@backingInt(alignment) <= 3); |
| 121 | 121 | ||
| 122 | const slice = uefi.system_table.boot_services.?.allocatePool( | 122 | const slice = uefi.system_table.boot_services.?.allocatePool( |
| 123 | uefi.efi_pool_memory_type, | 123 | uefi.efi_pool_memory_type, |
| ... | @@ -136,7 +136,7 @@ fn uefi_resize( | ... | @@ -136,7 +136,7 @@ fn uefi_resize( |
| 136 | ) bool { | 136 | ) bool { |
| 137 | _ = ret_addr; | 137 | _ = ret_addr; |
| 138 | 138 | ||
| 139 | std.debug.assert(@intFromEnum(alignment) <= 3); | 139 | std.debug.assert(@backingInt(alignment) <= 3); |
| 140 | 140 | ||
| 141 | if (new_len > buf.len) return false; | 141 | if (new_len > buf.len) return false; |
| 142 | return true; | 142 | return true; |
| ... | @@ -151,7 +151,7 @@ fn uefi_remap( | ... | @@ -151,7 +151,7 @@ fn uefi_remap( |
| 151 | ) ?[*]u8 { | 151 | ) ?[*]u8 { |
| 152 | _ = ret_addr; | 152 | _ = ret_addr; |
| 153 | 153 | ||
| 154 | std.debug.assert(@intFromEnum(alignment) <= 3); | 154 | std.debug.assert(@backingInt(alignment) <= 3); |
| 155 | 155 | ||
| 156 | if (new_len > buf.len) return null; | 156 | if (new_len > buf.len) return null; |
| 157 | return buf.ptr; | 157 | return buf.ptr; |
lib/std/os/uefi/protocol/device_path.zig+2-2| ... | @@ -26,7 +26,7 @@ pub const DevicePath = extern struct { | ... | @@ -26,7 +26,7 @@ pub const DevicePath = extern struct { |
| 26 | 26 | ||
| 27 | /// Returns the next DevicePath node in the sequence, if any. | 27 | /// Returns the next DevicePath node in the sequence, if any. |
| 28 | pub fn next(self: *const DevicePath) ?*const DevicePath { | 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 | if (self.type == .end and subtype == .end_entire) return null; | 30 | if (self.type == .end and subtype == .end_entire) return null; |
| 31 | const bytes: [*]const u8 = @ptrCast(self); | 31 | const bytes: [*]const u8 = @ptrCast(self); |
| 32 | return @ptrCast(bytes + self.length); | 32 | return @ptrCast(bytes + self.length); |
| ... | @@ -106,7 +106,7 @@ pub const DevicePath = extern struct { | ... | @@ -106,7 +106,7 @@ pub const DevicePath = extern struct { |
| 106 | 106 | ||
| 107 | inline for (type_info.field_names, type_info.field_types) |subtype_name, subtype_type| { | 107 | inline for (type_info.field_names, type_info.field_types) |subtype_name, subtype_type| { |
| 108 | // The tag names match the union names, so just grab that off the enum | 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 | if (self.subtype == tag_val) { | 111 | if (self.subtype == tag_val) { |
| 112 | // e.g. expr = .{ .pci = @ptrCast(...) } | 112 | // e.g. expr = .{ .pci = @ptrCast(...) } |
lib/std/os/uefi/tables.zig+14-14| ... | @@ -24,11 +24,11 @@ pub const TimerDelay = enum(u32) { | ... | @@ -24,11 +24,11 @@ pub const TimerDelay = enum(u32) { |
| 24 | pub const MemoryType = enum(u32) { | 24 | pub const MemoryType = enum(u32) { |
| 25 | pub const Oem = math.IntFittingRange( | 25 | pub const Oem = math.IntFittingRange( |
| 26 | 0, | 26 | 0, |
| 27 | @intFromEnum(MemoryType.oem_end) - @intFromEnum(MemoryType.oem_start), | 27 | @backingInt(MemoryType.oem_end) - @backingInt(MemoryType.oem_start), |
| 28 | ); | 28 | ); |
| 29 | pub const Vendor = math.IntFittingRange( | 29 | pub const Vendor = math.IntFittingRange( |
| 30 | 0, | 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 | /// can only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise | 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,28 +65,28 @@ pub const MemoryType = enum(u32) { |
| 65 | _, | 65 | _, |
| 66 | 66 | ||
| 67 | pub fn fromOem(value: Oem) MemoryType { | 67 | pub fn fromOem(value: Oem) MemoryType { |
| 68 | const oem_start = @intFromEnum(MemoryType.oem_start); | 68 | const oem_start = @backingInt(MemoryType.oem_start); |
| 69 | return @enumFromInt(oem_start + value); | 69 | return @fromBackingInt(@intCast(oem_start + value)); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | pub fn toOem(memtype: MemoryType) ?Oem { | 72 | pub fn toOem(memtype: MemoryType) ?Oem { |
| 73 | const as_int = @intFromEnum(memtype); | 73 | const as_int = @backingInt(memtype); |
| 74 | const oem_start = @intFromEnum(MemoryType.oem_start); | 74 | const oem_start = @backingInt(MemoryType.oem_start); |
| 75 | if (as_int < oem_start) return null; | 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 | return @truncate(as_int - oem_start); | 77 | return @truncate(as_int - oem_start); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | pub fn fromVendor(value: Vendor) MemoryType { | 80 | pub fn fromVendor(value: Vendor) MemoryType { |
| 81 | const vendor_start = @intFromEnum(MemoryType.vendor_start); | 81 | const vendor_start = @backingInt(MemoryType.vendor_start); |
| 82 | return @enumFromInt(vendor_start + value); | 82 | return @fromBackingInt(@intCast(vendor_start + value)); |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | pub fn toVendor(memtype: MemoryType) ?Vendor { | 85 | pub fn toVendor(memtype: MemoryType) ?Vendor { |
| 86 | const as_int = @intFromEnum(memtype); | 86 | const as_int = @backingInt(memtype); |
| 87 | const vendor_start = @intFromEnum(MemoryType.vendor_start); | 87 | const vendor_start = @backingInt(MemoryType.vendor_start); |
| 88 | if (as_int < @intFromEnum(MemoryType.vendor_end)) return null; | 88 | if (as_int < @backingInt(MemoryType.vendor_end)) return null; |
| 89 | if (as_int > @intFromEnum(MemoryType.vendor_end)) return null; | 89 | if (as_int > @backingInt(MemoryType.vendor_end)) return null; |
| 90 | return @truncate(as_int - vendor_start); | 90 | return @truncate(as_int - vendor_start); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| ... | @@ -98,7 +98,7 @@ pub const MemoryType = enum(u32) { | ... | @@ -98,7 +98,7 @@ pub const MemoryType = enum(u32) { |
| 98 | else if (std.enums.tagName(MemoryType, self)) |name| | 98 | else if (std.enums.tagName(MemoryType, self)) |name| |
| 99 | try w.print("{s}", .{name}) | 99 | try w.print("{s}", .{name}) |
| 100 | else | 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,7 +77,7 @@ pub const PS = struct { |
| 77 | _, | 77 | _, |
| 78 | 78 | ||
| 79 | pub fn construct(num: NUM, thread: bool, input: bool, additive: bool) ULONG_PTR { | 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 | if (thread) val |= 0x10000; | 81 | if (thread) val |= 0x10000; |
| 82 | if (input) val |= 0x20000; | 82 | if (input) val |= 0x20000; |
| 83 | if (additive) val |= 0x40000; | 83 | if (additive) val |= 0x40000; |
| ... | @@ -739,7 +739,7 @@ pub const FILE = struct { | ... | @@ -739,7 +739,7 @@ pub const FILE = struct { |
| 739 | SYNCHRONOUS_NONALERT = 0b10, | 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 | /// The file being opened must not be a directory file or this call | 744 | /// The file being opened must not be a directory file or this call |
| 745 | /// fails. The file object being opened can represent a data file, a | 745 | /// fails. The file object being opened can represent a data file, a |
| ... | @@ -1975,7 +1975,7 @@ pub const HEAP = opaque { | ... | @@ -1975,7 +1975,7 @@ pub const HEAP = opaque { |
| 1975 | CSR_PORT, | 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 | pub const CREATE = packed struct(ULONG) { | 1981 | pub const CREATE = packed struct(ULONG) { |
| ... | @@ -1990,7 +1990,7 @@ pub const HEAP = opaque { | ... | @@ -1990,7 +1990,7 @@ pub const HEAP = opaque { |
| 1990 | /// Callers are therefore responsible for synchronizing access to hardened heaps. | 1990 | /// Callers are therefore responsible for synchronizing access to hardened heaps. |
| 1991 | HARDENED: bool = false, | 1991 | HARDENED: bool = false, |
| 1992 | Reserved10: u2 = 0, | 1992 | Reserved10: u2 = 0, |
| 1993 | CLASS: CLASS = @enumFromInt(0), | 1993 | CLASS: CLASS = @fromBackingInt(@intCast(0)), |
| 1994 | /// Create heap with 16 byte alignment (obsolete) | 1994 | /// Create heap with 16 byte alignment (obsolete) |
| 1995 | ALIGN_16: bool = false, | 1995 | ALIGN_16: bool = false, |
| 1996 | /// Create heap call tracing enabled (obsolete) | 1996 | /// Create heap call tracing enabled (obsolete) |
| ... | @@ -2035,7 +2035,7 @@ pub const HEAP = opaque { | ... | @@ -2035,7 +2035,7 @@ pub const HEAP = opaque { |
| 2035 | FLAG3: bool = false, | 2035 | FLAG3: bool = false, |
| 2036 | } = .{}, | 2036 | } = .{}, |
| 2037 | } = .{}, | 2037 | } = .{}, |
| 2038 | CLASS: CLASS = @enumFromInt(0), | 2038 | CLASS: CLASS = @fromBackingInt(@intCast(0)), |
| 2039 | Reserved16: u2 = 0, | 2039 | Reserved16: u2 = 0, |
| 2040 | TAG: u12 = 0, | 2040 | TAG: u12 = 0, |
| 2041 | Reserved30: u2 = 0, | 2041 | Reserved30: u2 = 0, |
| ... | @@ -3945,7 +3945,7 @@ pub fn unexpectedError(err: Win32Error) UnexpectedError { | ... | @@ -3945,7 +3945,7 @@ pub fn unexpectedError(err: Win32Error) UnexpectedError { |
| 3945 | pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError { | 3945 | pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError { |
| 3946 | if (std.options.unexpected_error_tracing) { | 3946 | if (std.options.unexpected_error_tracing) { |
| 3947 | std.debug.print("error.Unexpected NTSTATUS=0x{x} ({s})\n", .{ | 3947 | std.debug.print("error.Unexpected NTSTATUS=0x{x} ({s})\n", .{ |
| 3948 | @intFromEnum(status), | 3948 | @backingInt(status), |
| 3949 | std.enums.tagName(NTSTATUS, status) orelse "<unnamed>", | 3949 | std.enums.tagName(NTSTATUS, status) orelse "<unnamed>", |
| 3950 | }); | 3950 | }); |
| 3951 | std.debug.dumpCurrentStackTrace(.{ .first_address = @returnAddress() }); | 3951 | std.debug.dumpCurrentStackTrace(.{ .first_address = @returnAddress() }); |
| ... | @@ -3956,7 +3956,7 @@ pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError { | ... | @@ -3956,7 +3956,7 @@ pub fn unexpectedStatus(status: NTSTATUS) UnexpectedError { |
| 3956 | pub fn statusBug(status: NTSTATUS) UnexpectedError { | 3956 | pub fn statusBug(status: NTSTATUS) UnexpectedError { |
| 3957 | switch (builtin.mode) { | 3957 | switch (builtin.mode) { |
| 3958 | .Debug => std.debug.panic("programmer bug caused syscall status: 0x{x} ({s})", .{ | 3958 | .Debug => std.debug.panic("programmer bug caused syscall status: 0x{x} ({s})", .{ |
| 3959 | @intFromEnum(status), | 3959 | @backingInt(status), |
| 3960 | std.enums.tagName(NTSTATUS, status) orelse "<unnamed>", | 3960 | std.enums.tagName(NTSTATUS, status) orelse "<unnamed>", |
| 3961 | }), | 3961 | }), |
| 3962 | else => return error.Unexpected, | 3962 | else => return error.Unexpected, |
| ... | @@ -3966,7 +3966,7 @@ pub fn statusBug(status: NTSTATUS) UnexpectedError { | ... | @@ -3966,7 +3966,7 @@ pub fn statusBug(status: NTSTATUS) UnexpectedError { |
| 3966 | pub fn errorBug(err: Win32Error) UnexpectedError { | 3966 | pub fn errorBug(err: Win32Error) UnexpectedError { |
| 3967 | switch (builtin.mode) { | 3967 | switch (builtin.mode) { |
| 3968 | .Debug => std.debug.panic("programmer bug caused syscall error: 0x{x} ({s})", .{ | 3968 | .Debug => std.debug.panic("programmer bug caused syscall error: 0x{x} ({s})", .{ |
| 3969 | @intFromEnum(err), | 3969 | @backingInt(err), |
| 3970 | std.enums.tagName(Win32Error, err) orelse "<unnamed>", | 3970 | std.enums.tagName(Win32Error, err) orelse "<unnamed>", |
| 3971 | }), | 3971 | }), |
| 3972 | else => return error.Unexpected, | 3972 | else => return error.Unexpected, |
| ... | @@ -4091,7 +4091,7 @@ fn Bool(comptime BackingInteger: type) type { | ... | @@ -4091,7 +4091,7 @@ fn Bool(comptime BackingInteger: type) type { |
| 4091 | _, | 4091 | _, |
| 4092 | 4092 | ||
| 4093 | /// This is not the only truthy value, comparisons against this value are always a bug. | 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 | pub const Backing = BackingInteger; | 4096 | pub const Backing = BackingInteger; |
| 4097 | 4097 | ||
| ... | @@ -4100,7 +4100,7 @@ fn Bool(comptime BackingInteger: type) type { | ... | @@ -4100,7 +4100,7 @@ fn Bool(comptime BackingInteger: type) type { |
| 4100 | } | 4100 | } |
| 4101 | 4101 | ||
| 4102 | pub fn fromBool(b: bool) @This() { | 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,8 +5947,8 @@ pub const KUSER_SHARED_DATA = extern struct { |
| 5947 | pub const SharedUserData: *const KUSER_SHARED_DATA = @ptrFromInt(0x7FFE0000); | 5947 | pub const SharedUserData: *const KUSER_SHARED_DATA = @ptrFromInt(0x7FFE0000); |
| 5948 | 5948 | ||
| 5949 | pub fn IsProcessorFeaturePresent(feature: PF) bool { | 5949 | pub fn IsProcessorFeaturePresent(feature: PF) bool { |
| 5950 | if (@intFromEnum(feature) >= PROCESSOR_FEATURE_MAX) return false; | 5950 | if (@backingInt(feature) >= PROCESSOR_FEATURE_MAX) return false; |
| 5951 | return SharedUserData.ProcessorFeatures[@intFromEnum(feature)].toBool(); | 5951 | return SharedUserData.ProcessorFeatures[@backingInt(feature)].toBool(); |
| 5952 | } | 5952 | } |
| 5953 | 5953 | ||
| 5954 | // https://github.com/reactos/reactos/blob/master/sdk/include/ndk/pstypes.h#L977-L983 | 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,7 +73,7 @@ pub const CERT_STORE = struct { |
| 73 | _, | 73 | _, |
| 74 | 74 | ||
| 75 | pub fn fromString(str: LPCSTR) PROV { | 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,7 +159,7 @@ pub const HCERTCHAINENGINE = enum(usize) { |
| 159 | _, | 159 | _, |
| 160 | 160 | ||
| 161 | pub fn fromHandle(handle: HANDLE) HCERTCHAINENGINE { | 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,7 +210,7 @@ pub const CERT_CHAIN = packed struct(DWORD) { |
| 210 | _, | 210 | _, |
| 211 | 211 | ||
| 212 | pub fn fromString(str: LPCSTR) POLICY { | 212 | pub fn fromString(str: LPCSTR) POLICY { |
| 213 | return @enumFromInt(@intFromPtr(str)); | 213 | return @fromBackingInt(@intCast(@intFromPtr(str))); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | pub const PARA = extern struct { | 216 | pub const PARA = extern struct { |
lib/std/posix.zig+6-6| ... | @@ -651,7 +651,7 @@ pub fn mmap( | ... | @@ -651,7 +651,7 @@ pub fn mmap( |
| 651 | const rc = mmap_sym(ptr, length, prot, @bitCast(flags), fd, @bitCast(offset)); | 651 | const rc = mmap_sym(ptr, length, prot, @bitCast(flags), fd, @bitCast(offset)); |
| 652 | const err: E = if (builtin.link_libc) blk: { | 652 | const err: E = if (builtin.link_libc) blk: { |
| 653 | if (rc != std.c.MAP_FAILED) return @as([*]align(page_size_min) u8, @ptrCast(@alignCast(rc)))[0..length]; | 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 | } else blk: { | 655 | } else blk: { |
| 656 | const err = errno(rc); | 656 | const err = errno(rc); |
| 657 | if (err == .SUCCESS) return @as([*]align(page_size_min) u8, @ptrFromInt(rc))[0..length]; | 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,7 +687,7 @@ pub fn munmap(memory: []align(page_size_min) const u8) void { |
| 687 | .INVAL => unreachable, // Invalid parameters. | 687 | .INVAL => unreachable, // Invalid parameters. |
| 688 | .NOMEM => unreachable, // Attempted to unmap a region in the middle of an existing mapping. | 688 | .NOMEM => unreachable, // Attempted to unmap a region in the middle of an existing mapping. |
| 689 | else => |e| if (std.options.unexpected_error_tracing) { | 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 | } else unreachable, | 691 | } else unreachable, |
| 692 | } | 692 | } |
| 693 | } | 693 | } |
| ... | @@ -710,7 +710,7 @@ pub fn mremap( | ... | @@ -710,7 +710,7 @@ pub fn mremap( |
| 710 | const rc = system.mremap(old_address, old_len, new_len, flags, new_address); | 710 | const rc = system.mremap(old_address, old_len, new_len, flags, new_address); |
| 711 | const err: E = if (builtin.link_libc) blk: { | 711 | const err: E = if (builtin.link_libc) blk: { |
| 712 | if (rc != std.c.MAP_FAILED) return @as([*]align(page_size_min) u8, @ptrCast(@alignCast(rc)))[0..new_len]; | 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 | } else blk: { | 714 | } else blk: { |
| 715 | const err = errno(rc); | 715 | const err = errno(rc); |
| 716 | if (err == .SUCCESS) return @as([*]align(page_size_min) u8, @ptrFromInt(rc))[0..new_len]; | 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,7 +1299,7 @@ pub fn prctl(option: PR, args: anytype) PrctlError!u31 { |
| 1299 | inline while (i < args.len) : (i += 1) buf[i] = args[i]; | 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 | switch (errno(rc)) { | 1303 | switch (errno(rc)) { |
| 1304 | .SUCCESS => return @intCast(rc), | 1304 | .SUCCESS => return @intCast(rc), |
| 1305 | .ACCES => return error.AccessDenied, | 1305 | .ACCES => return error.AccessDenied, |
| ... | @@ -1545,7 +1545,7 @@ pub fn ptrace(request: u32, pid: pid_t, addr: usize, data: usize) PtraceError!vo | ... | @@ -1545,7 +1545,7 @@ pub fn ptrace(request: u32, pid: pid_t, addr: usize, data: usize) PtraceError!vo |
| 1545 | }, | 1545 | }, |
| 1546 | 1546 | ||
| 1547 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (errno(std.c.ptrace( | 1547 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => switch (errno(std.c.ptrace( |
| 1548 | @enumFromInt(request), | 1548 | @fromBackingInt(@intCast(request)), |
| 1549 | pid, | 1549 | pid, |
| 1550 | @ptrFromInt(addr), | 1550 | @ptrFromInt(addr), |
| 1551 | @intCast(data), | 1551 | @intCast(data), |
| ... | @@ -1668,7 +1668,7 @@ pub const UnexpectedError = std.Io.UnexpectedError; | ... | @@ -1668,7 +1668,7 @@ pub const UnexpectedError = std.Io.UnexpectedError; |
| 1668 | /// and you get an unexpected error. | 1668 | /// and you get an unexpected error. |
| 1669 | pub fn unexpectedErrno(err: E) UnexpectedError { | 1669 | pub fn unexpectedErrno(err: E) UnexpectedError { |
| 1670 | if (std.options.unexpected_error_tracing) { | 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 | std.debug.dumpCurrentStackTrace(.{}); | 1672 | std.debug.dumpCurrentStackTrace(.{}); |
| 1673 | } | 1673 | } |
| 1674 | return error.Unexpected; | 1674 | return error.Unexpected; |
lib/std/posix/test.zig+1-1| ... | @@ -333,7 +333,7 @@ test "getrlimit and setrlimit" { | ... | @@ -333,7 +333,7 @@ test "getrlimit and setrlimit" { |
| 333 | if (posix.system.rlimit_resource == void) return error.SkipZigTest; | 333 | if (posix.system.rlimit_resource == void) return error.SkipZigTest; |
| 334 | 334 | ||
| 335 | inline for (@typeInfo(posix.rlimit_resource).@"enum".field_values) |field_value| { | 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 | const limit = try posix.getrlimit(resource); | 337 | const limit = try posix.getrlimit(resource); |
| 338 | 338 | ||
| 339 | // XNU kernel does not support RLIMIT_STACK if a custom stack is active, | 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,10 +875,10 @@ pub fn exit(status: u8) noreturn { |
| 875 | // exit() is only available if exitBootServices() has not been called yet. | 875 | // exit() is only available if exitBootServices() has not been called yet. |
| 876 | // This call to exit should not fail, so we catch-ignore errors. | 876 | // This call to exit should not fail, so we catch-ignore errors. |
| 877 | if (uefi.system_table.boot_services) |bs| { | 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 | // If we can't exit, reboot the system instead. | 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 | else => posix.system.exit(status), | 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,7 +90,7 @@ pub fn suggestVectorLength(comptime T: type) ?comptime_int { |
| 90 | 90 | ||
| 91 | test "suggestVectorLengthForCpu works with signed and unsigned values" { | 91 | test "suggestVectorLengthForCpu works with signed and unsigned values" { |
| 92 | comptime var cpu = std.Target.Cpu.baseline(std.Target.Cpu.Arch.x86_64, builtin.os); | 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 | comptime cpu.features.populateDependencies(&std.Target.x86.all_features); | 94 | comptime cpu.features.populateDependencies(&std.Target.x86.all_features); |
| 95 | const expected_len: usize = switch (builtin.zig_backend) { | 95 | const expected_len: usize = switch (builtin.zig_backend) { |
| 96 | .stage2_x86_64 => 8, | 96 | .stage2_x86_64 => 8, |
lib/std/spirv.zig+3-3| ... | @@ -60,8 +60,8 @@ pub fn controlBarrier( | ... | @@ -60,8 +60,8 @@ pub fn controlBarrier( |
| 60 | asm volatile ( | 60 | asm volatile ( |
| 61 | \\OpControlBarrier %exec %mem %sem | 61 | \\OpControlBarrier %exec %mem %sem |
| 62 | : | 62 | : |
| 63 | : [exec] "" (@as(u32, @intFromEnum(execution))), | 63 | : [exec] "" (@as(u32, @backingInt(execution))), |
| 64 | [mem] "" (@as(u32, @intFromEnum(memory))), | 64 | [mem] "" (@as(u32, @backingInt(memory))), |
| 65 | [sem] "" (@as(u32, @bitCast(semantics))), | 65 | [sem] "" (@as(u32, @bitCast(semantics))), |
| 66 | ); | 66 | ); |
| 67 | } | 67 | } |
| ... | @@ -70,7 +70,7 @@ pub fn memoryBarrier(comptime memory: Scope, comptime semantics: MemorySemantics | ... | @@ -70,7 +70,7 @@ pub fn memoryBarrier(comptime memory: Scope, comptime semantics: MemorySemantics |
| 70 | asm volatile ( | 70 | asm volatile ( |
| 71 | \\OpMemoryBarrier %mem %sem | 71 | \\OpMemoryBarrier %mem %sem |
| 72 | : | 72 | : |
| 73 | : [mem] "" (@as(u32, @intFromEnum(memory))), | 73 | : [mem] "" (@as(u32, @backingInt(memory))), |
| 74 | [sem] "" (@as(u32, @bitCast(semantics))), | 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,14 +141,14 @@ fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv |
| 141 | return 0; | 141 | return 0; |
| 142 | }, | 142 | }, |
| 143 | uefi.Status => { | 143 | uefi.Status => { |
| 144 | return @intFromEnum(root.main()); | 144 | return @backingInt(root.main()); |
| 145 | }, | 145 | }, |
| 146 | uefi.Error!void => { | 146 | uefi.Error!void => { |
| 147 | root.main() catch |err| switch (err) { | 147 | root.main() catch |err| switch (err) { |
| 148 | error.Unexpected => @panic("EfiMain: unexpected error"), | 148 | error.Unexpected => @panic("EfiMain: unexpected error"), |
| 149 | else => { | 149 | else => { |
| 150 | const status = uefi.Status.fromError(@errorCast(err)); | 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,7 +117,7 @@ pub fn StaticStringMapWithEql( |
| 117 | 117 | ||
| 118 | var sorted_keys: [field_names.len][]const u8 = field_names[0..field_names.len].*; | 118 | var sorted_keys: [field_names.len][]const u8 = field_names[0..field_names.len].*; |
| 119 | var sorted_vals: [field_names.len]V = undefined; | 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 | for (field_names) |field_name| { | 122 | for (field_names) |field_name| { |
| 123 | self.min_len = @min(self.min_len, field_name.len); | 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,7 +241,7 @@ const Header = struct { |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | pub fn kind(header: Header) Kind { | 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 | if (result == .normal_alias) return .normal; | 245 | if (result == .normal_alias) return .normal; |
| 246 | return result; | 246 | return result; |
| 247 | } | 247 | } |
lib/std/testing/Smith.zig+9-9| ... | @@ -169,7 +169,7 @@ test baselineWeights { | ... | @@ -169,7 +169,7 @@ test baselineWeights { |
| 169 | fn valueFromInt(T: anytype, int: Backing(T)) T { | 169 | fn valueFromInt(T: anytype, int: Backing(T)) T { |
| 170 | @disableInstrumentation(); | 170 | @disableInstrumentation(); |
| 171 | return switch (@typeInfo(T)) { | 171 | return switch (@typeInfo(T)) { |
| 172 | .@"enum" => @enumFromInt(int), | 172 | .@"enum" => @fromBackingInt(@intCast(int)), |
| 173 | else => @bitCast(int), | 173 | else => @bitCast(int), |
| 174 | }; | 174 | }; |
| 175 | } | 175 | } |
| ... | @@ -369,7 +369,7 @@ fn UnionTagWithoutUninitializable(T: type) type { | ... | @@ -369,7 +369,7 @@ fn UnionTagWithoutUninitializable(T: type) type { |
| 369 | else => {}, | 369 | else => {}, |
| 370 | } | 370 | } |
| 371 | field_names[n_fields] = f_name; | 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 | n_fields += 1; | 373 | n_fields += 1; |
| 374 | } | 374 | } |
| 375 | return @Enum(e.tag_type, .exhaustive, field_names[0..n_fields], field_values[0..n_fields]); | 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,8 +400,8 @@ pub fn valueWithHash(s: *Smith, T: type, hash: u32) T { |
| 400 | break :v s.valueWeightedWithHash(T, baselineWeights(T), hash); | 400 | break :v s.valueWeightedWithHash(T, baselineWeights(T), hash); |
| 401 | } | 401 | } |
| 402 | break :v std.enums.fromInt(T, s.valueWithHash(e.tag_type, hash)) orelse | 402 | break :v std.enums.fromInt(T, s.valueWithHash(e.tag_type, hash)) orelse |
| 403 | @enumFromInt(e.field_values[0]); | 403 | @fromBackingInt(@intCast(e.field_values[0])); |
| 404 | } else @enumFromInt(s.valueWithHash(e.tag_type, hash)), | 404 | } else @fromBackingInt(@intCast(s.valueWithHash(e.tag_type, hash))), |
| 405 | .optional => |o| if (s.valueWithHash(bool, hash)) | 405 | .optional => |o| if (s.valueWithHash(bool, hash)) |
| 406 | null | 406 | null |
| 407 | else | 407 | else |
| ... | @@ -718,7 +718,7 @@ test value { | ... | @@ -718,7 +718,7 @@ test value { |
| 718 | io: u128 = (1 << 80) | (1 << 23), | 718 | io: u128 = (1 << 80) | (1 << 23), |
| 719 | fd: f64 = std.math.pi, | 719 | fd: f64 = std.math.pi, |
| 720 | ft: f80 = std.math.e, | 720 | ft: f80 = std.math.e, |
| 721 | eh: enum(u16) { a, _ } = @enumFromInt(999), | 721 | eh: enum(u16) { a, _ } = @fromBackingInt(@intCast(999)), |
| 722 | eo: enum(u128) { a, b, _ } = .b, | 722 | eo: enum(u128) { a, b, _ } = .b, |
| 723 | aw: [3]u32 = .{ 1 << 30, 1 << 20, 1 << 10 }, | 723 | aw: [3]u32 = .{ 1 << 30, 1 << 20, 1 << 10 }, |
| 724 | vw: @Vector(3, u32) = .{ 1 << 10, 1 << 20, 1 << 30 }, | 724 | vw: @Vector(3, u32) = .{ 1 << 10, 1 << 20, 1 << 30 }, |
| ... | @@ -747,7 +747,7 @@ test value { | ... | @@ -747,7 +747,7 @@ test value { |
| 747 | }; | 747 | }; |
| 748 | const s: S = .{}; | 748 | const s: S = .{}; |
| 749 | const ft_bits: u80 = @bitCast(s.ft); | 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 | var smith: Smith = .{ | 752 | var smith: Smith = .{ |
| 753 | .in = constructInput(&.{ | 753 | .in = constructInput(&.{ |
| ... | @@ -758,7 +758,7 @@ test value { | ... | @@ -758,7 +758,7 @@ test value { |
| 758 | .{ .int = @truncate(s.io) }, .{ .int = @intCast(s.io >> 64) }, // io | 758 | .{ .int = @truncate(s.io) }, .{ .int = @intCast(s.io >> 64) }, // io |
| 759 | .{ .int = @bitCast(s.fd) }, // fd | 759 | .{ .int = @bitCast(s.fd) }, // fd |
| 760 | .{ .int = @truncate(ft_bits) }, .{ .int = @intCast(ft_bits >> 64) }, // ft | 760 | .{ .int = @truncate(ft_bits) }, .{ .int = @intCast(ft_bits >> 64) }, // ft |
| 761 | .{ .int = @intFromEnum(s.eh) }, // eh | 761 | .{ .int = @backingInt(s.eh) }, // eh |
| 762 | .{ .int = @truncate(eo_bits) }, .{ .int = @intCast(eo_bits >> 64) }, // eo | 762 | .{ .int = @truncate(eo_bits) }, .{ .int = @intCast(eo_bits >> 64) }, // eo |
| 763 | .{ .int = s.aw[0] }, .{ .int = s.aw[1] }, .{ .int = s.aw[2] }, // aw | 763 | .{ .int = s.aw[0] }, .{ .int = s.aw[1] }, .{ .int = s.aw[2] }, // aw |
| 764 | .{ .int = s.vw[0] }, .{ .int = s.vw[1] }, .{ .int = s.vw[2] }, // vw | 764 | .{ .int = s.vw[0] }, .{ .int = s.vw[1] }, .{ .int = s.vw[2] }, // vw |
| ... | @@ -767,8 +767,8 @@ test value { | ... | @@ -767,8 +767,8 @@ test value { |
| 767 | .{ .int = s.s.q }, // s.q | 767 | .{ .int = s.s.q }, // s.q |
| 768 | //sz | 768 | //sz |
| 769 | .{ .int = @as(u8, @bitCast(s.sp)) }, // sp | 769 | .{ .int = @as(u8, @bitCast(s.sp)) }, // sp |
| 770 | .{ .int = s.si.a }, .{ .int = @intFromEnum(s.si.b) }, // si | 770 | .{ .int = s.si.a }, .{ .int = @backingInt(s.si.b) }, // si |
| 771 | .{ .int = @intFromEnum(s.u) }, .{ .int = s.u.b }, // u | 771 | .{ .int = @backingInt(s.u) }, .{ .int = s.u.b }, // u |
| 772 | .{ .int = @as(u16, @bitCast(s.up)) }, // up | 772 | .{ .int = @as(u16, @bitCast(s.up)) }, // up |
| 773 | // invalid values | 773 | // invalid values |
| 774 | .{ .int = 555 }, // invalid.ib | 774 | .{ .int = 555 }, // invalid.ib |
lib/std/time/epoch.zig+2-2| ... | @@ -81,7 +81,7 @@ pub const Month = enum(u4) { | ... | @@ -81,7 +81,7 @@ pub const Month = enum(u4) { |
| 81 | /// return the numeric calendar value for the given month | 81 | /// return the numeric calendar value for the given month |
| 82 | /// i.e. jan=1, feb=2, etc | 82 | /// i.e. jan=1, feb=2, etc |
| 83 | pub fn numeric(self: Month) u4 { | 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,7 +119,7 @@ pub const YearAndDay = struct { |
| 119 | if (days_left < days_in_month) | 119 | if (days_left < days_in_month) |
| 120 | break; | 120 | break; |
| 121 | days_left -= days_in_month; | 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 | return .{ .month = month, .day_index = @as(u5, @intCast(days_left)) }; | 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,7 +144,7 @@ pub fn IsTool(base: [2]u8, code: usize) bool { |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { | 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 | fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { | 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 +7,7 @@ pub const ClientRequest = enum(usize) { |
| 7 | }; | 7 | }; |
| 8 | 8 | ||
| 9 | fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { | 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 | fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { | 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,7 +11,7 @@ pub const ClientRequest = enum(usize) { |
| 11 | }; | 11 | }; |
| 12 | 12 | ||
| 13 | fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { | 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 | fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { | 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,7 +21,7 @@ pub const ClientRequest = enum(usize) { |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { | 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 | fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { | 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,7 +664,7 @@ pub const BlockType = enum(u8) { |
| 664 | v128 = 0x7B, | 664 | v128 = 0x7B, |
| 665 | 665 | ||
| 666 | pub fn fromValtype(valtype: Valtype) BlockType { | 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,12 +1764,12 @@ pub fn buildExeSubprocess( |
| 1764 | received_fs_inputs = true; | 1764 | received_fs_inputs = true; |
| 1765 | var it = mem.splitScalar(u8, body, 0); | 1765 | var it = mem.splitScalar(u8, body, 0); |
| 1766 | while (it.next()) |prefixed_path| { | 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 | const sub_path = try gpa.dupe(u8, prefixed_path[1..]); | 1768 | const sub_path = try gpa.dupe(u8, prefixed_path[1..]); |
| 1769 | var keep = false; | 1769 | var keep = false; |
| 1770 | defer if (!keep) gpa.free(sub_path); | 1770 | defer if (!keep) gpa.free(sub_path); |
| 1771 | keep = man.addPrefixedPathPost(.{ | 1771 | keep = man.addPrefixedPathPost(.{ |
| 1772 | .prefix = @intFromEnum(prefix), | 1772 | .prefix = @backingInt(prefix), |
| 1773 | .sub_path = sub_path, | 1773 | .sub_path = sub_path, |
| 1774 | }) catch |err| switch (err) { | 1774 | }) catch |err| switch (err) { |
| 1775 | error.Canceled, error.OutOfMemory => |e| return e, | 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,15 +41,15 @@ pub const OptionalTokenIndex = enum(u32) { |
| 41 | _, | 41 | _, |
| 42 | 42 | ||
| 43 | pub fn unwrap(oti: OptionalTokenIndex) ?TokenIndex { | 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 | pub fn fromToken(ti: TokenIndex) OptionalTokenIndex { | 47 | pub fn fromToken(ti: TokenIndex) OptionalTokenIndex { |
| 48 | return @enumFromInt(ti); | 48 | return @fromBackingInt(@intCast(ti)); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | pub fn fromOptional(oti: ?TokenIndex) OptionalTokenIndex { | 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,17 +61,17 @@ pub const TokenOffset = enum(i32) { |
| 61 | pub fn init(base: TokenIndex, destination: TokenIndex) TokenOffset { | 61 | pub fn init(base: TokenIndex, destination: TokenIndex) TokenOffset { |
| 62 | const base_i64: i64 = base; | 62 | const base_i64: i64 = base; |
| 63 | const destination_i64: i64 = destination; | 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 | pub fn toOptional(to: TokenOffset) OptionalTokenOffset { | 67 | pub fn toOptional(to: TokenOffset) OptionalTokenOffset { |
| 68 | const result: OptionalTokenOffset = @enumFromInt(@intFromEnum(to)); | 68 | const result: OptionalTokenOffset = @fromBackingInt(@intCast(@backingInt(to))); |
| 69 | assert(result != .none); | 69 | assert(result != .none); |
| 70 | return result; | 70 | return result; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | pub fn toAbsolute(offset: TokenOffset, base: TokenIndex) TokenIndex { | 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,7 +81,7 @@ pub const OptionalTokenOffset = enum(i32) { |
| 81 | _, | 81 | _, |
| 82 | 82 | ||
| 83 | pub fn unwrap(oto: OptionalTokenOffset) ?TokenOffset { | 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,15 +94,15 @@ pub fn tokenStart(tree: *const Ast, token_index: TokenIndex) ByteOffset { |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | pub fn nodeTag(tree: *const Ast, node: Node.Index) Node.Tag { | 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 | pub fn nodeMainToken(tree: *const Ast, node: Node.Index) TokenIndex { | 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 | pub fn nodeData(tree: *const Ast, node: Node.Index) Node.Data { | 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 | pub fn isTokenPrecededByTags( | 108 | pub fn isTokenPrecededByTags( |
| ... | @@ -295,11 +295,11 @@ pub fn tokenSlice(tree: Ast, token_index: TokenIndex) []const u8 { | ... | @@ -295,11 +295,11 @@ pub fn tokenSlice(tree: Ast, token_index: TokenIndex) []const u8 { |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | pub fn extraDataSlice(tree: Ast, range: Node.SubRange, comptime T: type) []const T { | 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 | pub fn extraDataSliceWithLen(tree: Ast, start: ExtraIndex, len: u32, comptime T: type) []const T { | 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 | pub fn extraData(tree: Ast, index: ExtraIndex, comptime T: type) T { | 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,8 +311,8 @@ pub fn extraData(tree: Ast, index: ExtraIndex, comptime T: type) T { |
| 311 | Node.OptionalIndex, | 311 | Node.OptionalIndex, |
| 312 | OptionalTokenIndex, | 312 | OptionalTokenIndex, |
| 313 | ExtraIndex, | 313 | ExtraIndex, |
| 314 | => @enumFromInt(tree.extra_data[@intFromEnum(index) + i]), | 314 | => @fromBackingInt(@intCast(tree.extra_data[@backingInt(index) + i])), |
| 315 | TokenIndex => tree.extra_data[@intFromEnum(index) + i], | 315 | TokenIndex => tree.extra_data[@backingInt(index) + i], |
| 316 | else => @compileError("unexpected field type: " ++ @typeName(field_type)), | 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,7 +330,7 @@ pub fn rootDecls(tree: Ast) []const Node.Index { |
| 330 | switch (tree.mode) { | 330 | switch (tree.mode) { |
| 331 | .zig => return tree.extraDataSlice(tree.nodeData(.root).extra_range, Node.Index), | 331 | .zig => return tree.extraDataSlice(tree.nodeData(.root).extra_range, Node.Index), |
| 332 | // Ensure that the returned slice points into the existing memory of the Ast | 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,7 +994,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 994 | const params = tree.extraData(extra_index, Node.SubRange); | 994 | const params = tree.extraData(extra_index, Node.SubRange); |
| 995 | assert(params.start != params.end); | 995 | assert(params.start != params.end); |
| 996 | end_offset += 1; // for the rparen | 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 | .tagged_union_enum_tag => { | 999 | .tagged_union_enum_tag => { |
| 1000 | const arg, const extra_index = tree.nodeData(n).node_and_extra; | 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,7 +1004,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1004 | n = arg; | 1004 | n = arg; |
| 1005 | } else { | 1005 | } else { |
| 1006 | end_offset += 1; // for the rbrace | 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 | .call_comma, | 1010 | .call_comma, |
| ... | @@ -1014,7 +1014,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { | ... | @@ -1014,7 +1014,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1014 | const params = tree.extraData(extra_index, Node.SubRange); | 1014 | const params = tree.extraData(extra_index, Node.SubRange); |
| 1015 | assert(params.start != params.end); | 1015 | assert(params.start != params.end); |
| 1016 | end_offset += 2; // for the comma/semicolon + rparen/rbrace | 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 | .@"switch" => { | 1019 | .@"switch" => { |
| 1020 | const condition, const extra_index = tree.nodeData(n).node_and_extra; | 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,7 +1024,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1024 | n = condition; | 1024 | n = condition; |
| 1025 | } else { | 1025 | } else { |
| 1026 | end_offset += 1; // for the rbrace | 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 | .container_decl_arg => { | 1030 | .container_decl_arg => { |
| ... | @@ -1035,7 +1035,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { | ... | @@ -1035,7 +1035,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1035 | n = arg; | 1035 | n = arg; |
| 1036 | } else { | 1036 | } else { |
| 1037 | end_offset += 1; // for the rbrace | 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 | .@"asm" => { | 1041 | .@"asm" => { |
| ... | @@ -1050,7 +1050,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { | ... | @@ -1050,7 +1050,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1050 | const elements = tree.extraData(extra_index, Node.SubRange); | 1050 | const elements = tree.extraData(extra_index, Node.SubRange); |
| 1051 | assert(elements.start != elements.end); | 1051 | assert(elements.start != elements.end); |
| 1052 | end_offset += 1; // for the rbrace | 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 | .array_init_comma, | 1055 | .array_init_comma, |
| 1056 | .struct_init_comma, | 1056 | .struct_init_comma, |
| ... | @@ -1061,7 +1061,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { | ... | @@ -1061,7 +1061,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1061 | const members = tree.extraData(extra_index, Node.SubRange); | 1061 | const members = tree.extraData(extra_index, Node.SubRange); |
| 1062 | assert(members.start != members.end); | 1062 | assert(members.start != members.end); |
| 1063 | end_offset += 2; // for the comma + rbrace | 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 | .array_init_dot, | 1066 | .array_init_dot, |
| 1067 | .struct_init_dot, | 1067 | .struct_init_dot, |
| ... | @@ -1073,7 +1073,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { | ... | @@ -1073,7 +1073,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1073 | const range = tree.nodeData(n).extra_range; | 1073 | const range = tree.nodeData(n).extra_range; |
| 1074 | assert(range.start != range.end); | 1074 | assert(range.start != range.end); |
| 1075 | end_offset += 1; // for the rbrace | 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 | .array_init_dot_comma, | 1078 | .array_init_dot_comma, |
| 1079 | .struct_init_dot_comma, | 1079 | .struct_init_dot_comma, |
| ... | @@ -1085,7 +1085,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { | ... | @@ -1085,7 +1085,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1085 | const range = tree.nodeData(n).extra_range; | 1085 | const range = tree.nodeData(n).extra_range; |
| 1086 | assert(range.start != range.end); | 1086 | assert(range.start != range.end); |
| 1087 | end_offset += 2; // for the comma/semicolon + rbrace/rparen | 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 | .call_one, | 1090 | .call_one, |
| 1091 | => { | 1091 | => { |
| ... | @@ -1285,8 +1285,8 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { | ... | @@ -1285,8 +1285,8 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1285 | }, | 1285 | }, |
| 1286 | .@"for" => { | 1286 | .@"for" => { |
| 1287 | const extra_index, const extra = tree.nodeData(n).@"for"; | 1287 | const extra_index, const extra = tree.nodeData(n).@"for"; |
| 1288 | const index = @intFromEnum(extra_index) + extra.inputs + @intFromBool(extra.has_else); | 1288 | const index = @backingInt(extra_index) + extra.inputs + @intFromBool(extra.has_else); |
| 1289 | n = @enumFromInt(tree.extra_data[index]); | 1289 | n = @fromBackingInt(@intCast(tree.extra_data[index])); |
| 1290 | }, | 1290 | }, |
| 1291 | .array_type_sentinel => { | 1291 | .array_type_sentinel => { |
| 1292 | _, const extra_index = tree.nodeData(n).node_and_extra; | 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,9 +1365,9 @@ pub fn alignedVarDecl(tree: Ast, node: Node.Index) full.VarDecl { |
| 1365 | 1365 | ||
| 1366 | pub fn assignDestructure(tree: Ast, node: Node.Index) full.AssignDestructure { | 1366 | pub fn assignDestructure(tree: Ast, node: Node.Index) full.AssignDestructure { |
| 1367 | const extra_index, const value_expr = tree.nodeData(node).extra_and_node; | 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 | return tree.fullAssignDestructureComponents(.{ | 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 | .equal_token = tree.nodeMainToken(node), | 1371 | .equal_token = tree.nodeMainToken(node), |
| 1372 | .value_expr = value_expr, | 1372 | .value_expr = value_expr, |
| 1373 | }); | 1373 | }); |
| ... | @@ -1856,7 +1856,7 @@ pub fn switchCaseOne(tree: Ast, node: Node.Index) full.SwitchCase { | ... | @@ -1856,7 +1856,7 @@ pub fn switchCaseOne(tree: Ast, node: Node.Index) full.SwitchCase { |
| 1856 | &.{} | 1856 | &.{} |
| 1857 | else | 1857 | else |
| 1858 | // Ensure that the returned slice points into the existing memory of the Ast | 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 | .arrow_token = tree.nodeMainToken(node), | 1860 | .arrow_token = tree.nodeMainToken(node), |
| 1861 | .target_expr = target_expr, | 1861 | .target_expr = target_expr, |
| 1862 | }, node); | 1862 | }, node); |
| ... | @@ -1932,7 +1932,7 @@ pub fn whileFull(tree: Ast, node: Node.Index) full.While { | ... | @@ -1932,7 +1932,7 @@ pub fn whileFull(tree: Ast, node: Node.Index) full.While { |
| 1932 | } | 1932 | } |
| 1933 | 1933 | ||
| 1934 | pub fn forSimple(tree: Ast, node: Node.Index) full.For { | 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 | return tree.fullForComponents(.{ | 1936 | return tree.fullForComponents(.{ |
| 1937 | .for_token = tree.nodeMainToken(node), | 1937 | .for_token = tree.nodeMainToken(node), |
| 1938 | .inputs = (&data[0])[0..1], | 1938 | .inputs = (&data[0])[0..1], |
| ... | @@ -1944,8 +1944,8 @@ pub fn forSimple(tree: Ast, node: Node.Index) full.For { | ... | @@ -1944,8 +1944,8 @@ pub fn forSimple(tree: Ast, node: Node.Index) full.For { |
| 1944 | pub fn forFull(tree: Ast, node: Node.Index) full.For { | 1944 | pub fn forFull(tree: Ast, node: Node.Index) full.For { |
| 1945 | const extra_index, const extra = tree.nodeData(node).@"for"; | 1945 | const extra_index, const extra = tree.nodeData(node).@"for"; |
| 1946 | const inputs = tree.extraDataSliceWithLen(extra_index, extra.inputs, Node.Index); | 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]); | 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) @enumFromInt(tree.extra_data[@intFromEnum(extra_index) + extra.inputs + 1]) else .none; | 1948 | const else_expr: Node.OptionalIndex = if (extra.has_else) @fromBackingInt(@intCast(tree.extra_data[@backingInt(extra_index) + extra.inputs + 1])) else .none; |
| 1949 | return tree.fullForComponents(.{ | 1949 | return tree.fullForComponents(.{ |
| 1950 | .for_token = tree.nodeMainToken(node), | 1950 | .for_token = tree.nodeMainToken(node), |
| 1951 | .inputs = inputs, | 1951 | .inputs = inputs, |
| ... | @@ -2922,15 +2922,15 @@ pub const Node = struct { | ... | @@ -2922,15 +2922,15 @@ pub const Node = struct { |
| 2922 | _, | 2922 | _, |
| 2923 | 2923 | ||
| 2924 | pub fn toOptional(i: Index) OptionalIndex { | 2924 | pub fn toOptional(i: Index) OptionalIndex { |
| 2925 | const result: OptionalIndex = @enumFromInt(@intFromEnum(i)); | 2925 | const result: OptionalIndex = @fromBackingInt(@intCast(@backingInt(i))); |
| 2926 | assert(result != .none); | 2926 | assert(result != .none); |
| 2927 | return result; | 2927 | return result; |
| 2928 | } | 2928 | } |
| 2929 | 2929 | ||
| 2930 | pub fn toOffset(base: Index, destination: Index) Offset { | 2930 | pub fn toOffset(base: Index, destination: Index) Offset { |
| 2931 | const base_i64: i64 = @intFromEnum(base); | 2931 | const base_i64: i64 = @backingInt(base); |
| 2932 | const destination_i64: i64 = @intFromEnum(destination); | 2932 | const destination_i64: i64 = @backingInt(destination); |
| 2933 | return @enumFromInt(destination_i64 - base_i64); | 2933 | return @fromBackingInt(@intCast(destination_i64 - base_i64)); |
| 2934 | } | 2934 | } |
| 2935 | }; | 2935 | }; |
| 2936 | 2936 | ||
| ... | @@ -2941,7 +2941,7 @@ pub const Node = struct { | ... | @@ -2941,7 +2941,7 @@ pub const Node = struct { |
| 2941 | _, | 2941 | _, |
| 2942 | 2942 | ||
| 2943 | pub fn unwrap(oi: OptionalIndex) ?Index { | 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 | pub fn fromOptional(oi: ?Index) OptionalIndex { | 2947 | pub fn fromOptional(oi: ?Index) OptionalIndex { |
| ... | @@ -2955,13 +2955,13 @@ pub const Node = struct { | ... | @@ -2955,13 +2955,13 @@ pub const Node = struct { |
| 2955 | _, | 2955 | _, |
| 2956 | 2956 | ||
| 2957 | pub fn toOptional(o: Offset) OptionalOffset { | 2957 | pub fn toOptional(o: Offset) OptionalOffset { |
| 2958 | const result: OptionalOffset = @enumFromInt(@intFromEnum(o)); | 2958 | const result: OptionalOffset = @fromBackingInt(@intCast(@backingInt(o))); |
| 2959 | assert(result != .none); | 2959 | assert(result != .none); |
| 2960 | return result; | 2960 | return result; |
| 2961 | } | 2961 | } |
| 2962 | 2962 | ||
| 2963 | pub fn toAbsolute(offset: Offset, base: Index) Index { | 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,7 +2971,7 @@ pub const Node = struct { |
| 2971 | _, | 2971 | _, |
| 2972 | 2972 | ||
| 2973 | pub fn unwrap(oo: OptionalOffset) ?Offset { | 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,7 +2191,7 @@ fn renderArrayInit( |
| 2191 | width.* = for (w) |c| { | 2191 | width.* = for (w) |c| { |
| 2192 | if (!std.ascii.isPrint(c)) | 2192 | if (!std.ascii.isPrint(c)) |
| 2193 | break .nonprint; | 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 | } else { | 2195 | } else { |
| 2196 | width.* = .nonprint; | 2196 | width.* = .nonprint; |
| 2197 | } | 2197 | } |
| ... | @@ -2264,7 +2264,7 @@ fn renderArrayInit( | ... | @@ -2264,7 +2264,7 @@ fn renderArrayInit( |
| 2264 | col = 0; | 2264 | col = 0; |
| 2265 | continue; | 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 | col += 1; | 2268 | col += 1; |
| 2269 | if (col == row_size) { | 2269 | if (col == row_size) { |
| 2270 | col = 0; | 2270 | col = 0; |
| ... | @@ -2284,7 +2284,7 @@ fn renderArrayInit( | ... | @@ -2284,7 +2284,7 @@ fn renderArrayInit( |
| 2284 | } | 2284 | } |
| 2285 | } else { | 2285 | } else { |
| 2286 | try renderExpression(r, e, .comma_space); | 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 | col += 1; | 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,13 +103,13 @@ fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void { |
| 103 | Ast.OptionalTokenIndex, | 103 | Ast.OptionalTokenIndex, |
| 104 | Ast.Node.Index, | 104 | Ast.Node.Index, |
| 105 | Ast.Node.OptionalIndex, | 105 | Ast.Node.OptionalIndex, |
| 106 | => @intFromEnum(@field(extra, field_name)), | 106 | => @backingInt(@field(extra, field_name)), |
| 107 | 107 | ||
| 108 | Ast.TokenOffset, | 108 | Ast.TokenOffset, |
| 109 | Ast.OptionalTokenOffset, | 109 | Ast.OptionalTokenOffset, |
| 110 | Ast.Node.Offset, | 110 | Ast.Node.Offset, |
| 111 | Ast.Node.OptionalOffset, | 111 | Ast.Node.OptionalOffset, |
| 112 | => @bitCast(@intFromEnum(@field(extra, field_name))), | 112 | => @bitCast(@backingInt(@field(extra, field_name))), |
| 113 | 113 | ||
| 114 | i32, | 114 | i32, |
| 115 | Zir.Inst.Call.Flags, | 115 | Zir.Inst.Call.Flags, |
| ... | @@ -207,7 +207,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { | ... | @@ -207,7 +207,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { |
| 207 | break :fatal true; | 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 | if (astgen.compile_errors.items.len == 0) { | 211 | if (astgen.compile_errors.items.len == 0) { |
| 212 | astgen.extra.items[err_index] = 0; | 212 | astgen.extra.items[err_index] = 0; |
| 213 | } else { | 213 | } else { |
| ... | @@ -223,7 +223,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { | ... | @@ -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 | if (astgen.imports.count() == 0) { | 227 | if (astgen.imports.count() == 0) { |
| 228 | astgen.extra.items[imports_index] = 0; | 228 | astgen.extra.items[imports_index] = 0; |
| 229 | } else { | 229 | } else { |
| ... | @@ -1380,7 +1380,7 @@ fn fnProtoExprInner( | ... | @@ -1380,7 +1380,7 @@ fn fnProtoExprInner( |
| 1380 | defer param_gz.unstack(); | 1380 | defer param_gz.unstack(); |
| 1381 | param_gz.is_comptime = true; | 1381 | param_gz.is_comptime = true; |
| 1382 | const param_type = try fullBodyExpr(&param_gz, scope, coerced_type_ri, param_type_node, .normal); | 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 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); | 1384 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); |
| 1385 | const name_token = param.name_token orelse tree.nodeMainToken(param_type_node); | 1385 | const name_token = param.name_token orelse tree.nodeMainToken(param_type_node); |
| 1386 | const tag: Zir.Inst.Tag = if (is_comptime) .param_comptime else .param; | 1386 | const tag: Zir.Inst.Tag = if (is_comptime) .param_comptime else .param; |
| ... | @@ -1506,7 +1506,7 @@ fn arrayInitExpr( | ... | @@ -1506,7 +1506,7 @@ fn arrayInitExpr( |
| 1506 | .tag = .array_init_elem_type, | 1506 | .tag = .array_init_elem_type, |
| 1507 | .data = .{ .bin = .{ | 1507 | .data = .{ .bin = .{ |
| 1508 | .lhs = array_ty, | 1508 | .lhs = array_ty, |
| 1509 | .rhs = @enumFromInt(i), | 1509 | .rhs = @fromBackingInt(@intCast(i)), |
| 1510 | } }, | 1510 | } }, |
| 1511 | }); | 1511 | }); |
| 1512 | _ = try expr(gz, scope, .{ .rl = .{ .ty = this_elem_ty } }, elem_init); | 1512 | _ = try expr(gz, scope, .{ .rl = .{ .ty = this_elem_ty } }, elem_init); |
| ... | @@ -1598,7 +1598,7 @@ fn arrayInitExprAnon( | ... | @@ -1598,7 +1598,7 @@ fn arrayInitExprAnon( |
| 1598 | 1598 | ||
| 1599 | for (elements) |elem_init| { | 1599 | for (elements) |elem_init| { |
| 1600 | const elem_ref = try expr(gz, scope, .{ .rl = .none }, elem_init); | 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 | extra_index += 1; | 1602 | extra_index += 1; |
| 1603 | } | 1603 | } |
| 1604 | return try gz.addPlNodePayloadIndex(.array_init_anon, node, payload_index); | 1604 | return try gz.addPlNodePayloadIndex(.array_init_anon, node, payload_index); |
| ... | @@ -1621,14 +1621,14 @@ fn arrayInitExprTyped( | ... | @@ -1621,14 +1621,14 @@ fn arrayInitExprTyped( |
| 1621 | .operands_len = @intCast(len), | 1621 | .operands_len = @intCast(len), |
| 1622 | }); | 1622 | }); |
| 1623 | var extra_index = try reserveExtra(astgen, len); | 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 | extra_index += 1; | 1625 | extra_index += 1; |
| 1626 | 1626 | ||
| 1627 | if (maybe_elem_ty_inst != .none) { | 1627 | if (maybe_elem_ty_inst != .none) { |
| 1628 | const elem_ri: ResultInfo = .{ .rl = .{ .coerced_ty = maybe_elem_ty_inst } }; | 1628 | const elem_ri: ResultInfo = .{ .rl = .{ .coerced_ty = maybe_elem_ty_inst } }; |
| 1629 | for (elements) |elem_init| { | 1629 | for (elements) |elem_init| { |
| 1630 | const elem_inst = try expr(gz, scope, elem_ri, elem_init); | 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 | extra_index += 1; | 1632 | extra_index += 1; |
| 1633 | } | 1633 | } |
| 1634 | } else { | 1634 | } else { |
| ... | @@ -1637,12 +1637,12 @@ fn arrayInitExprTyped( | ... | @@ -1637,12 +1637,12 @@ fn arrayInitExprTyped( |
| 1637 | .tag = .array_init_elem_type, | 1637 | .tag = .array_init_elem_type, |
| 1638 | .data = .{ .bin = .{ | 1638 | .data = .{ .bin = .{ |
| 1639 | .lhs = ty_inst, | 1639 | .lhs = ty_inst, |
| 1640 | .rhs = @enumFromInt(i), | 1640 | .rhs = @fromBackingInt(@intCast(i)), |
| 1641 | } }, | 1641 | } }, |
| 1642 | }) } }; | 1642 | }) } }; |
| 1643 | 1643 | ||
| 1644 | const elem_inst = try expr(gz, scope, ri, elem_init); | 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 | extra_index += 1; | 1646 | extra_index += 1; |
| 1647 | } | 1647 | } |
| 1648 | } | 1648 | } |
| ... | @@ -1673,7 +1673,7 @@ fn arrayInitExprPtr( | ... | @@ -1673,7 +1673,7 @@ fn arrayInitExprPtr( |
| 1673 | .ptr = array_ptr_inst, | 1673 | .ptr = array_ptr_inst, |
| 1674 | .index = @intCast(i), | 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 | extra_index += 1; | 1677 | extra_index += 1; |
| 1678 | _ = try expr(gz, scope, .{ .rl = .{ .ptr = .{ .inst = elem_ptr_inst } } }, elem_init); | 1678 | _ = try expr(gz, scope, .{ .rl = .{ .ptr = .{ .inst = elem_ptr_inst } } }, elem_init); |
| 1679 | } | 1679 | } |
| ... | @@ -1966,7 +1966,7 @@ fn structInitExprPtr( | ... | @@ -1966,7 +1966,7 @@ fn structInitExprPtr( |
| 1966 | .lhs = struct_ptr_inst, | 1966 | .lhs = struct_ptr_inst, |
| 1967 | .field_name_start = str_index, | 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 | extra_index += 1; | 1970 | extra_index += 1; |
| 1971 | _ = try expr(gz, scope, .{ .rl = .{ .ptr = .{ .inst = field_ptr } } }, field_init); | 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,11 +2658,11 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As |
| 2658 | // Note that this array becomes invalid after appending more items to it | 2658 | // Note that this array becomes invalid after appending more items to it |
| 2659 | // in the above while loop. | 2659 | // in the above while loop. |
| 2660 | const zir_tags = gz.astgen.instructions.items(.tag); | 2660 | const zir_tags = gz.astgen.instructions.items(.tag); |
| 2661 | switch (zir_tags[@intFromEnum(inst)]) { | 2661 | switch (zir_tags[@backingInt(inst)]) { |
| 2662 | // For some instructions, modify the zir data | 2662 | // For some instructions, modify the zir data |
| 2663 | // so we can avoid a separate ensure_result_used instruction. | 2663 | // so we can avoid a separate ensure_result_used instruction. |
| 2664 | .call, .field_call => { | 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 | comptime assert(std.meta.fieldIndex(Zir.Inst.Call, "flags") == | 2666 | comptime assert(std.meta.fieldIndex(Zir.Inst.Call, "flags") == |
| 2667 | std.meta.fieldIndex(Zir.Inst.FieldCall, "flags")); | 2667 | std.meta.fieldIndex(Zir.Inst.FieldCall, "flags")); |
| 2668 | const flags: *Zir.Inst.Call.Flags = @ptrCast(&gz.astgen.extra.items[ | 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,7 +2672,7 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As |
| 2672 | break :b true; | 2672 | break :b true; |
| 2673 | }, | 2673 | }, |
| 2674 | .builtin_call => { | 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 | const flags: *Zir.Inst.BuiltinCall.Flags = @ptrCast(&gz.astgen.extra.items[ | 2676 | const flags: *Zir.Inst.BuiltinCall.Flags = @ptrCast(&gz.astgen.extra.items[ |
| 2677 | break_extra + std.meta.fieldIndex(Zir.Inst.BuiltinCall, "flags").? | 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,7 +2888,7 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As |
| 2888 | .array_init_elem_ptr, | 2888 | .array_init_elem_ptr, |
| 2889 | => break :b false, | 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 | .breakpoint, | 2892 | .breakpoint, |
| 2893 | .disable_instrumentation, | 2893 | .disable_instrumentation, |
| 2894 | .disable_intrinsics, | 2894 | .disable_intrinsics, |
| ... | @@ -3075,7 +3075,7 @@ fn deferStmt( | ... | @@ -3075,7 +3075,7 @@ fn deferStmt( |
| 3075 | const expr_node = tree.nodeData(node).node; | 3075 | const expr_node = tree.nodeData(node).node; |
| 3076 | _ = try unusedResultExpr(&defer_gen, &defer_gen.base, expr_node); | 3076 | _ = try unusedResultExpr(&defer_gen, &defer_gen.base, expr_node); |
| 3077 | try checkUsed(gz, scope, &defer_gen.base); | 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 | const body = defer_gen.instructionsSlice(); | 3080 | const body = defer_gen.instructionsSlice(); |
| 3081 | const body_len = gz.astgen.countBodyLenAfterFixupsExtraRefs(body, &.{}); | 3081 | const body_len = gz.astgen.countBodyLenAfterFixupsExtraRefs(body, &.{}); |
| ... | @@ -3663,12 +3663,12 @@ fn assignOp( | ... | @@ -3663,12 +3663,12 @@ fn assignOp( |
| 3663 | .tag = .extended, | 3663 | .tag = .extended, |
| 3664 | .data = .{ .extended = .{ | 3664 | .data = .{ .extended = .{ |
| 3665 | .opcode = .inplace_arith_result_ty, | 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 | .add => .add_eq, | 3667 | .add => .add_eq, |
| 3668 | .sub => .sub_eq, | 3668 | .sub => .sub_eq, |
| 3669 | else => unreachable, | 3669 | else => unreachable, |
| 3670 | })), | 3670 | })), |
| 3671 | .operand = @intFromEnum(lhs), | 3671 | .operand = @backingInt(lhs), |
| 3672 | } }, | 3672 | } }, |
| 3673 | }), | 3673 | }), |
| 3674 | else => try gz.addUnNode(.typeof, lhs, infix_node), // same as LHS type | 3674 | else => try gz.addUnNode(.typeof, lhs, infix_node), // same as LHS type |
| ... | @@ -3819,20 +3819,20 @@ fn ptrType( | ... | @@ -3819,20 +3819,20 @@ fn ptrType( |
| 3819 | .src_node = gz.nodeIndexToRelative(node), | 3819 | .src_node = gz.nodeIndexToRelative(node), |
| 3820 | }); | 3820 | }); |
| 3821 | if (sentinel_ref != .none) { | 3821 | if (sentinel_ref != .none) { |
| 3822 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(sentinel_ref)); | 3822 | gz.astgen.extra.appendAssumeCapacity(@backingInt(sentinel_ref)); |
| 3823 | } | 3823 | } |
| 3824 | if (align_ref != .none) { | 3824 | if (align_ref != .none) { |
| 3825 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(align_ref)); | 3825 | gz.astgen.extra.appendAssumeCapacity(@backingInt(align_ref)); |
| 3826 | } | 3826 | } |
| 3827 | if (addrspace_ref != .none) { | 3827 | if (addrspace_ref != .none) { |
| 3828 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(addrspace_ref)); | 3828 | gz.astgen.extra.appendAssumeCapacity(@backingInt(addrspace_ref)); |
| 3829 | } | 3829 | } |
| 3830 | if (bit_start_ref != .none) { | 3830 | if (bit_start_ref != .none) { |
| 3831 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(bit_start_ref)); | 3831 | gz.astgen.extra.appendAssumeCapacity(@backingInt(bit_start_ref)); |
| 3832 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(bit_end_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 | const result = new_index.toRef(); | 3836 | const result = new_index.toRef(); |
| 3837 | gz.astgen.instructions.appendAssumeCapacity(.{ .tag = .ptr_type, .data = .{ | 3837 | gz.astgen.instructions.appendAssumeCapacity(.{ .tag = .ptr_type, .data = .{ |
| 3838 | .ptr_type = .{ | 3838 | .ptr_type = .{ |
| ... | @@ -3957,7 +3957,7 @@ const WipDecls = struct { | ... | @@ -3957,7 +3957,7 @@ const WipDecls = struct { |
| 3957 | wip.* = undefined; | 3957 | wip.* = undefined; |
| 3958 | } | 3958 | } |
| 3959 | fn nextDecl(wip: *WipDecls, decl_inst: Zir.Inst.Index) void { | 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 | wip.index += 1; | 3961 | wip.index += 1; |
| 3962 | } | 3962 | } |
| 3963 | }; | 3963 | }; |
| ... | @@ -4012,7 +4012,7 @@ fn fnDecl( | ... | @@ -4012,7 +4012,7 @@ fn fnDecl( |
| 4012 | }; | 4012 | }; |
| 4013 | const lib_name = if (fn_proto.lib_name) |lib_name_token| blk: { | 4013 | const lib_name = if (fn_proto.lib_name) |lib_name_token| blk: { |
| 4014 | const lib_name_str = try astgen.strLitAsString(lib_name_token); | 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 | if (mem.findScalar(u8, lib_name_slice, 0) != null) { | 4016 | if (mem.findScalar(u8, lib_name_slice, 0) != null) { |
| 4017 | return astgen.failTok(lib_name_token, "library name cannot contain null bytes", .{}); | 4017 | return astgen.failTok(lib_name_token, "library name cannot contain null bytes", .{}); |
| 4018 | } else if (lib_name_str.len == 0) { | 4018 | } else if (lib_name_str.len == 0) { |
| ... | @@ -4231,7 +4231,7 @@ fn fnDeclInner( | ... | @@ -4231,7 +4231,7 @@ fn fnDeclInner( |
| 4231 | var param_gz = decl_gz.makeSubBlock(scope); | 4231 | var param_gz = decl_gz.makeSubBlock(scope); |
| 4232 | defer param_gz.unstack(); | 4232 | defer param_gz.unstack(); |
| 4233 | const param_type = try fullBodyExpr(&param_gz, params_scope, coerced_type_ri, param_type_node, .normal); | 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 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); | 4235 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); |
| 4236 | const param_type_is_generic = any_param_used; | 4236 | const param_type_is_generic = any_param_used; |
| 4237 | 4237 | ||
| ... | @@ -4276,7 +4276,7 @@ fn fnDeclInner( | ... | @@ -4276,7 +4276,7 @@ fn fnDeclInner( |
| 4276 | // In this case we will send a len=0 body which can be encoded more efficiently. | 4276 | // In this case we will send a len=0 body which can be encoded more efficiently. |
| 4277 | break :inst inst; | 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 | break :inst inst; | 4280 | break :inst inst; |
| 4281 | }; | 4281 | }; |
| 4282 | const ret_body_param_refs = try astgen.fetchRemoveRefEntries(param_insts.items); | 4282 | const ret_body_param_refs = try astgen.fetchRemoveRefEntries(param_insts.items); |
| ... | @@ -4299,11 +4299,11 @@ fn fnDeclInner( | ... | @@ -4299,11 +4299,11 @@ fn fnDeclInner( |
| 4299 | // In this case we will send a len=0 body which can be encoded more efficiently. | 4299 | // In this case we will send a len=0 body which can be encoded more efficiently. |
| 4300 | break :blk inst; | 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 | break :blk inst; | 4303 | break :blk inst; |
| 4304 | } else if (has_inline_keyword) { | 4304 | } else if (has_inline_keyword) { |
| 4305 | const inst = try cc_gz.addStdLangValue(decl_node, .calling_convention_inline); | 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 | break :blk inst; | 4307 | break :blk inst; |
| 4308 | } else { | 4308 | } else { |
| 4309 | break :blk .none; | 4309 | break :blk .none; |
| ... | @@ -4428,7 +4428,7 @@ fn globalVarDecl( | ... | @@ -4428,7 +4428,7 @@ fn globalVarDecl( |
| 4428 | } else false; | 4428 | } else false; |
| 4429 | const lib_name = if (var_decl.lib_name) |lib_name_token| blk: { | 4429 | const lib_name = if (var_decl.lib_name) |lib_name_token| blk: { |
| 4430 | const lib_name_str = try astgen.strLitAsString(lib_name_token); | 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 | if (mem.findScalar(u8, lib_name_slice, 0) != null) { | 4432 | if (mem.findScalar(u8, lib_name_slice, 0) != null) { |
| 4433 | return astgen.failTok(lib_name_token, "library name cannot contain null bytes", .{}); | 4433 | return astgen.failTok(lib_name_token, "library name cannot contain null bytes", .{}); |
| 4434 | } else if (lib_name_str.len == 0) { | 4434 | } else if (lib_name_str.len == 0) { |
| ... | @@ -4650,7 +4650,7 @@ fn testDecl( | ... | @@ -4650,7 +4650,7 @@ fn testDecl( |
| 4650 | else => .empty, | 4650 | else => .empty, |
| 4651 | .string_literal => name: { | 4651 | .string_literal => name: { |
| 4652 | const name = try astgen.strLitAsString(test_name_token); | 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 | if (mem.findScalar(u8, slice, 0) != null) { | 4654 | if (mem.findScalar(u8, slice, 0) != null) { |
| 4655 | return astgen.failTok(test_name_token, "test name cannot contain null bytes", .{}); | 4655 | return astgen.failTok(test_name_token, "test name cannot contain null bytes", .{}); |
| 4656 | } else if (slice.len == 0) { | 4656 | } else if (slice.len == 0) { |
| ... | @@ -4941,7 +4941,7 @@ fn structDeclInner( | ... | @@ -4941,7 +4941,7 @@ fn structDeclInner( |
| 4941 | member.convertToNonTupleLike(astgen.tree); | 4941 | member.convertToNonTupleLike(astgen.tree); |
| 4942 | assert(!member.ast.tuple_like); | 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 | const type_node = member.ast.type_expr.unwrap() orelse { | 4947 | const type_node = member.ast.type_expr.unwrap() orelse { |
| ... | @@ -5087,13 +5087,13 @@ fn tupleDecl( | ... | @@ -5087,13 +5087,13 @@ fn tupleDecl( |
| 5087 | } | 5087 | } |
| 5088 | 5088 | ||
| 5089 | const field_type_ref = try typeExpr(gz, scope, field.ast.type_expr.unwrap().?); | 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 | if (field.ast.value_expr.unwrap()) |value_expr| { | 5092 | if (field.ast.value_expr.unwrap()) |value_expr| { |
| 5093 | const field_init_ref = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_type_ref } }, value_expr, .tuple_field_default_value); | 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 | } else { | 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,7 +5221,7 @@ fn unionDeclInner( |
| 5221 | return astgen.failTok(comptime_token, "union fields cannot be marked comptime", .{}); | 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 | if (member.ast.type_expr.unwrap()) |type_node| { | 5226 | if (member.ast.type_expr.unwrap()) |type_node| { |
| 5227 | const type_ref = try typeExpr(&block_scope, &namespace.base, type_node); | 5227 | const type_ref = try typeExpr(&block_scope, &namespace.base, type_node); |
| ... | @@ -5454,7 +5454,7 @@ fn containerDecl( | ... | @@ -5454,7 +5454,7 @@ fn containerDecl( |
| 5454 | 5454 | ||
| 5455 | astgen.src_hasher.update(tree.getNodeSource(member_node)); | 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 | if (member.ast.value_expr.unwrap()) |value_node| { | 5459 | if (member.ast.value_expr.unwrap()) |value_node| { |
| 5460 | if (tag_type_body_len == null) { | 5460 | if (tag_type_body_len == null) { |
| ... | @@ -5709,7 +5709,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi | ... | @@ -5709,7 +5709,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi |
| 5709 | } | 5709 | } |
| 5710 | gop.value_ptr.* = tok_i; | 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 | fields_len += 1; | 5713 | fields_len += 1; |
| 5714 | }, | 5714 | }, |
| 5715 | else => unreachable, | 5715 | else => unreachable, |
| ... | @@ -6343,7 +6343,7 @@ fn setCondBrPayload( | ... | @@ -6343,7 +6343,7 @@ fn setCondBrPayload( |
| 6343 | ); | 6343 | ); |
| 6344 | 6344 | ||
| 6345 | const zir_datas = astgen.instructions.items(.data); | 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 | .condition = cond, | 6347 | .condition = cond, |
| 6348 | .then_body_len = then_body_len, | 6348 | .then_body_len = then_body_len, |
| 6349 | .else_body_len = else_body_len, | 6349 | .else_body_len = else_body_len, |
| ... | @@ -7319,7 +7319,7 @@ fn switchExpr( | ... | @@ -7319,7 +7319,7 @@ fn switchExpr( |
| 7319 | // this lowering to avoiding a rather complex special case in Sema. | 7319 | // this lowering to avoiding a rather complex special case in Sema. |
| 7320 | 7320 | ||
| 7321 | assert(switch_full.label_token != null); // use `switch_block_err_union` code path instead! | 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 | block_scope.break_target = peer_break_target.block_inst; | 7323 | block_scope.break_target = peer_break_target.block_inst; |
| 7324 | block_scope.setBreakResultInfo(peer_break_target.block_ri); | 7324 | block_scope.setBreakResultInfo(peer_break_target.block_ri); |
| 7325 | }, | 7325 | }, |
| ... | @@ -7829,14 +7829,14 @@ fn switchExpr( | ... | @@ -7829,14 +7829,14 @@ fn switchExpr( |
| 7829 | .scalar_cases_len = @intCast(scalar_cases_len), | 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 | if (multi_cases_len > 0) astgen.extra.appendAssumeCapacity(multi_cases_len); | 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)); | 7835 | if (payload_capture_inst_is_placeholder) astgen.extra.appendAssumeCapacity(@backingInt(payload_capture_inst)); |
| 7836 | if (tag_capture_inst_is_placeholder) astgen.extra.appendAssumeCapacity(@intFromEnum(tag_capture_inst)); | 7836 | if (tag_capture_inst_is_placeholder) astgen.extra.appendAssumeCapacity(@backingInt(tag_capture_inst)); |
| 7837 | if (needs_non_err_handling) { | 7837 | if (needs_non_err_handling) { |
| 7838 | const catch_or_if_src_node_offset = parent_gz.nodeIndexToRelative(catch_or_if_node); | 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 | astgen.extra.appendAssumeCapacity(@bitCast(non_err_info)); | 7840 | astgen.extra.appendAssumeCapacity(@bitCast(non_err_info)); |
| 7841 | } | 7841 | } |
| 7842 | if (has_else) astgen.extra.appendAssumeCapacity(@bitCast(else_info)); | 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,7 +8484,7 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node: |
| 8484 | var big_int = try std.math.big.int.Managed.init(gpa); | 8484 | var big_int = try std.math.big.int.Managed.init(gpa); |
| 8485 | defer big_int.deinit(); | 8485 | defer big_int.deinit(); |
| 8486 | const prefix_offset: usize = if (base == .decimal) 0 else 2; | 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 | error.InvalidCharacter => unreachable, // caught in `parseNumberLiteral` | 8488 | error.InvalidCharacter => unreachable, // caught in `parseNumberLiteral` |
| 8489 | error.InvalidBase => unreachable, // we only pass 16, 8, 2, see above | 8489 | error.InvalidBase => unreachable, // we only pass 16, 8, 2, see above |
| 8490 | error.OutOfMemory => |e| return e, | 8490 | error.OutOfMemory => |e| return e, |
| ... | @@ -8586,7 +8586,7 @@ fn asmExpr( | ... | @@ -8586,7 +8586,7 @@ fn asmExpr( |
| 8586 | }, | 8586 | }, |
| 8587 | else => .{ | 8587 | else => .{ |
| 8588 | .tag = .asm_expr, | 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,7 +8903,7 @@ fn typeOf( |
| 8903 | 8903 | ||
| 8904 | for (args, 0..) |arg, i| { | 8904 | for (args, 0..) |arg, i| { |
| 8905 | const param_ref = try reachableExpr(&typeof_scope, &typeof_scope.base, .{ .rl = .none }, arg, node); | 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 | _ = try typeof_scope.addBreak(.break_inline, typeof_inst.toIndex().?, .void_value); | 8908 | _ = try typeof_scope.addBreak(.break_inline, typeof_inst.toIndex().?, .void_value); |
| 8909 | 8909 | ||
| ... | @@ -8952,7 +8952,7 @@ fn minMax( | ... | @@ -8952,7 +8952,7 @@ fn minMax( |
| 8952 | var extra_index = try reserveExtra(gz.astgen, args.len); | 8952 | var extra_index = try reserveExtra(gz.astgen, args.len); |
| 8953 | for (args) |arg| { | 8953 | for (args) |arg| { |
| 8954 | const arg_ref = try expr(gz, scope, .{ .rl = .none }, arg); | 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 | extra_index += 1; | 8956 | extra_index += 1; |
| 8957 | } | 8957 | } |
| 8958 | const tag: Zir.Inst.Extended = switch (op) { | 8958 | const tag: Zir.Inst.Extended = switch (op) { |
| ... | @@ -9023,7 +9023,7 @@ fn builtinCall( | ... | @@ -9023,7 +9023,7 @@ fn builtinCall( |
| 9023 | } | 9023 | } |
| 9024 | const str_lit_token = tree.nodeMainToken(operand_node); | 9024 | const str_lit_token = tree.nodeMainToken(operand_node); |
| 9025 | const str = try astgen.strLitAsString(str_lit_token); | 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 | if (mem.findScalar(u8, str_slice, 0) != null) { | 9027 | if (mem.findScalar(u8, str_slice, 0) != null) { |
| 9028 | return astgen.failTok(str_lit_token, "import path cannot contain null bytes", .{}); | 9028 | return astgen.failTok(str_lit_token, "import path cannot contain null bytes", .{}); |
| 9029 | } else if (str.len == 0) { | 9029 | } else if (str.len == 0) { |
| ... | @@ -9054,7 +9054,7 @@ fn builtinCall( | ... | @@ -9054,7 +9054,7 @@ fn builtinCall( |
| 9054 | var extra_index = try reserveExtra(gz.astgen, params.len); | 9054 | var extra_index = try reserveExtra(gz.astgen, params.len); |
| 9055 | for (params) |param| { | 9055 | for (params) |param| { |
| 9056 | const param_ref = try expr(gz, scope, .{ .rl = .none }, param); | 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 | extra_index += 1; | 9058 | extra_index += 1; |
| 9059 | } | 9059 | } |
| 9060 | const result = try gz.addExtendedMultiOpPayloadIndex(.compile_log, payload_index, params.len); | 9060 | const result = try gz.addExtendedMultiOpPayloadIndex(.compile_log, payload_index, params.len); |
| ... | @@ -9264,7 +9264,7 @@ fn builtinCall( | ... | @@ -9264,7 +9264,7 @@ fn builtinCall( |
| 9264 | const param_types = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_type_type } }, params[0], .fn_param_types); | 9264 | const param_types = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_type_type } }, params[0], .fn_param_types); |
| 9265 | const param_attrs_ty = try gz.addExtendedPayloadSmall( | 9265 | const param_attrs_ty = try gz.addExtendedPayloadSmall( |
| 9266 | .reify_slice_arg_ty, | 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 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[0]), .operand = param_types }, | 9268 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[0]), .operand = param_types }, |
| 9269 | ); | 9269 | ); |
| 9270 | const param_attrs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = param_attrs_ty } }, params[1], .fn_param_attrs); | 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,17 +9286,17 @@ fn builtinCall( |
| 9286 | const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .struct_field_names); | 9286 | const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .struct_field_names); |
| 9287 | const field_types_ty = try gz.addExtendedPayloadSmall( | 9287 | const field_types_ty = try gz.addExtendedPayloadSmall( |
| 9288 | .reify_slice_arg_ty, | 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 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, | 9290 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, |
| 9291 | ); | 9291 | ); |
| 9292 | const field_attrs_ty = try gz.addExtendedPayloadSmall( | 9292 | const field_attrs_ty = try gz.addExtendedPayloadSmall( |
| 9293 | .reify_slice_arg_ty, | 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 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, | 9295 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, |
| 9296 | ); | 9296 | ); |
| 9297 | const field_types = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_types_ty } }, params[3], .struct_field_types); | 9297 | const field_types = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_types_ty } }, params[3], .struct_field_types); |
| 9298 | const field_attrs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_attrs_ty } }, params[4], .struct_field_attrs); | 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 | .src_line = gz.astgen.source_line, | 9300 | .src_line = gz.astgen.source_line, |
| 9301 | .node = node, | 9301 | .node = node, |
| 9302 | .layout = layout, | 9302 | .layout = layout, |
| ... | @@ -9314,17 +9314,17 @@ fn builtinCall( | ... | @@ -9314,17 +9314,17 @@ fn builtinCall( |
| 9314 | const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .union_field_names); | 9314 | const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .union_field_names); |
| 9315 | const field_types_ty = try gz.addExtendedPayloadSmall( | 9315 | const field_types_ty = try gz.addExtendedPayloadSmall( |
| 9316 | .reify_slice_arg_ty, | 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 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, | 9318 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, |
| 9319 | ); | 9319 | ); |
| 9320 | const field_attrs_ty = try gz.addExtendedPayloadSmall( | 9320 | const field_attrs_ty = try gz.addExtendedPayloadSmall( |
| 9321 | .reify_slice_arg_ty, | 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 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, | 9323 | Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(params[2]), .operand = field_names }, |
| 9324 | ); | 9324 | ); |
| 9325 | const field_types = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_types_ty } }, params[3], .union_field_types); | 9325 | const field_types = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_types_ty } }, params[3], .union_field_types); |
| 9326 | const field_attrs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_attrs_ty } }, params[4], .union_field_attrs); | 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 | .src_line = gz.astgen.source_line, | 9328 | .src_line = gz.astgen.source_line, |
| 9329 | .node = node, | 9329 | .node = node, |
| 9330 | .layout = layout, | 9330 | .layout = layout, |
| ... | @@ -9346,7 +9346,7 @@ fn builtinCall( | ... | @@ -9346,7 +9346,7 @@ fn builtinCall( |
| 9346 | .rhs = field_names, | 9346 | .rhs = field_names, |
| 9347 | }); | 9347 | }); |
| 9348 | const field_values = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = field_values_ty } }, params[3], .enum_field_values); | 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 | .src_line = gz.astgen.source_line, | 9350 | .src_line = gz.astgen.source_line, |
| 9351 | .node = node, | 9351 | .node = node, |
| 9352 | .tag_ty = tag_ty, | 9352 | .tag_ty = tag_ty, |
| ... | @@ -9779,7 +9779,7 @@ fn floatRoundOp( | ... | @@ -9779,7 +9779,7 @@ fn floatRoundOp( |
| 9779 | .trunc => .trunc, | 9779 | .trunc => .trunc, |
| 9780 | else => unreachable, | 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 | .node = gz.nodeIndexToRelative(node), | 9783 | .node = gz.nodeIndexToRelative(node), |
| 9784 | .lhs = dest_type, | 9784 | .lhs = dest_type, |
| 9785 | .rhs = operand, | 9785 | .rhs = operand, |
| ... | @@ -9985,7 +9985,7 @@ fn callExpr( | ... | @@ -9985,7 +9985,7 @@ fn callExpr( |
| 9985 | .field => |field| assert(field.obj_ptr != .none), | 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 | const call_inst = call_index.toRef(); | 9989 | const call_inst = call_index.toRef(); |
| 9990 | try gz.astgen.instructions.append(astgen.gpa, undefined); | 9990 | try gz.astgen.instructions.append(astgen.gpa, undefined); |
| 9991 | try gz.instructions.append(astgen.gpa, call_index); | 9991 | try gz.instructions.append(astgen.gpa, call_index); |
| ... | @@ -10026,14 +10026,14 @@ fn callExpr( | ... | @@ -10026,14 +10026,14 @@ fn callExpr( |
| 10026 | .callee = callee_obj, | 10026 | .callee = callee_obj, |
| 10027 | .flags = .{ | 10027 | .flags = .{ |
| 10028 | .pop_error_return_trace = !propagate_error_trace, | 10028 | .pop_error_return_trace = !propagate_error_trace, |
| 10029 | .packed_modifier = @intCast(@intFromEnum(modifier)), | 10029 | .packed_modifier = @intCast(@backingInt(modifier)), |
| 10030 | .args_len = @intCast(call.ast.params.len), | 10030 | .args_len = @intCast(call.ast.params.len), |
| 10031 | }, | 10031 | }, |
| 10032 | }); | 10032 | }); |
| 10033 | if (call.ast.params.len != 0) { | 10033 | if (call.ast.params.len != 0) { |
| 10034 | try astgen.extra.appendSlice(astgen.gpa, astgen.scratch.items[scratch_top..]); | 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 | .tag = .call, | 10037 | .tag = .call, |
| 10038 | .data = .{ .pl_node = .{ | 10038 | .data = .{ .pl_node = .{ |
| 10039 | .src_node = gz.nodeIndexToRelative(node), | 10039 | .src_node = gz.nodeIndexToRelative(node), |
| ... | @@ -10047,14 +10047,14 @@ fn callExpr( | ... | @@ -10047,14 +10047,14 @@ fn callExpr( |
| 10047 | .field_name_start = callee_field.field_name_start, | 10047 | .field_name_start = callee_field.field_name_start, |
| 10048 | .flags = .{ | 10048 | .flags = .{ |
| 10049 | .pop_error_return_trace = !propagate_error_trace, | 10049 | .pop_error_return_trace = !propagate_error_trace, |
| 10050 | .packed_modifier = @intCast(@intFromEnum(modifier)), | 10050 | .packed_modifier = @intCast(@backingInt(modifier)), |
| 10051 | .args_len = @intCast(call.ast.params.len), | 10051 | .args_len = @intCast(call.ast.params.len), |
| 10052 | }, | 10052 | }, |
| 10053 | }); | 10053 | }); |
| 10054 | if (call.ast.params.len != 0) { | 10054 | if (call.ast.params.len != 0) { |
| 10055 | try astgen.extra.appendSlice(astgen.gpa, astgen.scratch.items[scratch_top..]); | 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 | .tag = .field_call, | 10058 | .tag = .field_call, |
| 10059 | .data = .{ .pl_node = .{ | 10059 | .data = .{ .pl_node = .{ |
| 10060 | .src_node = gz.nodeIndexToRelative(node), | 10060 | .src_node = gz.nodeIndexToRelative(node), |
| ... | @@ -10480,8 +10480,8 @@ fn rvalueInner( | ... | @@ -10480,8 +10480,8 @@ fn rvalueInner( |
| 10480 | const result = r: { | 10480 | const result = r: { |
| 10481 | if (raw_result.toIndex()) |result_index| { | 10481 | if (raw_result.toIndex()) |result_index| { |
| 10482 | const zir_tags = gz.astgen.instructions.items(.tag); | 10482 | const zir_tags = gz.astgen.instructions.items(.tag); |
| 10483 | const data = gz.astgen.instructions.items(.data)[@intFromEnum(result_index)]; | 10483 | const data = gz.astgen.instructions.items(.data)[@backingInt(result_index)]; |
| 10484 | if (zir_tags[@intFromEnum(result_index)].isAlwaysVoid(data)) { | 10484 | if (zir_tags[@backingInt(result_index)].isAlwaysVoid(data)) { |
| 10485 | break :r Zir.Inst.Ref.void_value; | 10485 | break :r Zir.Inst.Ref.void_value; |
| 10486 | } | 10486 | } |
| 10487 | } | 10487 | } |
| ... | @@ -10520,108 +10520,108 @@ fn rvalueInner( | ... | @@ -10520,108 +10520,108 @@ fn rvalueInner( |
| 10520 | }, | 10520 | }, |
| 10521 | .ty => |ty_inst| { | 10521 | .ty => |ty_inst| { |
| 10522 | // Quickly eliminate some common, unnecessary type coercion. | 10522 | // Quickly eliminate some common, unnecessary type coercion. |
| 10523 | const as_ty = @as(u64, @intFromEnum(Zir.Inst.Ref.type_type)) << 32; | 10523 | const as_ty = @as(u64, @backingInt(Zir.Inst.Ref.type_type)) << 32; |
| 10524 | const as_bool = @as(u64, @intFromEnum(Zir.Inst.Ref.bool_type)) << 32; | 10524 | const as_bool = @as(u64, @backingInt(Zir.Inst.Ref.bool_type)) << 32; |
| 10525 | const as_void = @as(u64, @intFromEnum(Zir.Inst.Ref.void_type)) << 32; | 10525 | const as_void = @as(u64, @backingInt(Zir.Inst.Ref.void_type)) << 32; |
| 10526 | const as_comptime_int = @as(u64, @intFromEnum(Zir.Inst.Ref.comptime_int_type)) << 32; | 10526 | const as_comptime_int = @as(u64, @backingInt(Zir.Inst.Ref.comptime_int_type)) << 32; |
| 10527 | const as_usize = @as(u64, @intFromEnum(Zir.Inst.Ref.usize_type)) << 32; | 10527 | const as_usize = @as(u64, @backingInt(Zir.Inst.Ref.usize_type)) << 32; |
| 10528 | const as_u1 = @as(u64, @intFromEnum(Zir.Inst.Ref.u1_type)) << 32; | 10528 | const as_u1 = @as(u64, @backingInt(Zir.Inst.Ref.u1_type)) << 32; |
| 10529 | const as_u8 = @as(u64, @intFromEnum(Zir.Inst.Ref.u8_type)) << 32; | 10529 | const as_u8 = @as(u64, @backingInt(Zir.Inst.Ref.u8_type)) << 32; |
| 10530 | switch ((@as(u64, @intFromEnum(ty_inst)) << 32) | @as(u64, @intFromEnum(result))) { | 10530 | switch ((@as(u64, @backingInt(ty_inst)) << 32) | @as(u64, @backingInt(result))) { |
| 10531 | as_ty | @intFromEnum(Zir.Inst.Ref.u1_type), | 10531 | as_ty | @backingInt(Zir.Inst.Ref.u1_type), |
| 10532 | as_ty | @intFromEnum(Zir.Inst.Ref.u8_type), | 10532 | as_ty | @backingInt(Zir.Inst.Ref.u8_type), |
| 10533 | as_ty | @intFromEnum(Zir.Inst.Ref.i8_type), | 10533 | as_ty | @backingInt(Zir.Inst.Ref.i8_type), |
| 10534 | as_ty | @intFromEnum(Zir.Inst.Ref.u16_type), | 10534 | as_ty | @backingInt(Zir.Inst.Ref.u16_type), |
| 10535 | as_ty | @intFromEnum(Zir.Inst.Ref.u29_type), | 10535 | as_ty | @backingInt(Zir.Inst.Ref.u29_type), |
| 10536 | as_ty | @intFromEnum(Zir.Inst.Ref.i16_type), | 10536 | as_ty | @backingInt(Zir.Inst.Ref.i16_type), |
| 10537 | as_ty | @intFromEnum(Zir.Inst.Ref.u32_type), | 10537 | as_ty | @backingInt(Zir.Inst.Ref.u32_type), |
| 10538 | as_ty | @intFromEnum(Zir.Inst.Ref.i32_type), | 10538 | as_ty | @backingInt(Zir.Inst.Ref.i32_type), |
| 10539 | as_ty | @intFromEnum(Zir.Inst.Ref.u64_type), | 10539 | as_ty | @backingInt(Zir.Inst.Ref.u64_type), |
| 10540 | as_ty | @intFromEnum(Zir.Inst.Ref.i64_type), | 10540 | as_ty | @backingInt(Zir.Inst.Ref.i64_type), |
| 10541 | as_ty | @intFromEnum(Zir.Inst.Ref.u128_type), | 10541 | as_ty | @backingInt(Zir.Inst.Ref.u128_type), |
| 10542 | as_ty | @intFromEnum(Zir.Inst.Ref.i128_type), | 10542 | as_ty | @backingInt(Zir.Inst.Ref.i128_type), |
| 10543 | as_ty | @intFromEnum(Zir.Inst.Ref.usize_type), | 10543 | as_ty | @backingInt(Zir.Inst.Ref.usize_type), |
| 10544 | as_ty | @intFromEnum(Zir.Inst.Ref.isize_type), | 10544 | as_ty | @backingInt(Zir.Inst.Ref.isize_type), |
| 10545 | as_ty | @intFromEnum(Zir.Inst.Ref.c_char_type), | 10545 | as_ty | @backingInt(Zir.Inst.Ref.c_char_type), |
| 10546 | as_ty | @intFromEnum(Zir.Inst.Ref.c_short_type), | 10546 | as_ty | @backingInt(Zir.Inst.Ref.c_short_type), |
| 10547 | as_ty | @intFromEnum(Zir.Inst.Ref.c_ushort_type), | 10547 | as_ty | @backingInt(Zir.Inst.Ref.c_ushort_type), |
| 10548 | as_ty | @intFromEnum(Zir.Inst.Ref.c_int_type), | 10548 | as_ty | @backingInt(Zir.Inst.Ref.c_int_type), |
| 10549 | as_ty | @intFromEnum(Zir.Inst.Ref.c_uint_type), | 10549 | as_ty | @backingInt(Zir.Inst.Ref.c_uint_type), |
| 10550 | as_ty | @intFromEnum(Zir.Inst.Ref.c_long_type), | 10550 | as_ty | @backingInt(Zir.Inst.Ref.c_long_type), |
| 10551 | as_ty | @intFromEnum(Zir.Inst.Ref.c_ulong_type), | 10551 | as_ty | @backingInt(Zir.Inst.Ref.c_ulong_type), |
| 10552 | as_ty | @intFromEnum(Zir.Inst.Ref.c_longlong_type), | 10552 | as_ty | @backingInt(Zir.Inst.Ref.c_longlong_type), |
| 10553 | as_ty | @intFromEnum(Zir.Inst.Ref.c_ulonglong_type), | 10553 | as_ty | @backingInt(Zir.Inst.Ref.c_ulonglong_type), |
| 10554 | as_ty | @intFromEnum(Zir.Inst.Ref.c_longdouble_type), | 10554 | as_ty | @backingInt(Zir.Inst.Ref.c_longdouble_type), |
| 10555 | as_ty | @intFromEnum(Zir.Inst.Ref.f16_type), | 10555 | as_ty | @backingInt(Zir.Inst.Ref.f16_type), |
| 10556 | as_ty | @intFromEnum(Zir.Inst.Ref.f32_type), | 10556 | as_ty | @backingInt(Zir.Inst.Ref.f32_type), |
| 10557 | as_ty | @intFromEnum(Zir.Inst.Ref.f64_type), | 10557 | as_ty | @backingInt(Zir.Inst.Ref.f64_type), |
| 10558 | as_ty | @intFromEnum(Zir.Inst.Ref.f80_type), | 10558 | as_ty | @backingInt(Zir.Inst.Ref.f80_type), |
| 10559 | as_ty | @intFromEnum(Zir.Inst.Ref.f128_type), | 10559 | as_ty | @backingInt(Zir.Inst.Ref.f128_type), |
| 10560 | as_ty | @intFromEnum(Zir.Inst.Ref.anyopaque_type), | 10560 | as_ty | @backingInt(Zir.Inst.Ref.anyopaque_type), |
| 10561 | as_ty | @intFromEnum(Zir.Inst.Ref.bool_type), | 10561 | as_ty | @backingInt(Zir.Inst.Ref.bool_type), |
| 10562 | as_ty | @intFromEnum(Zir.Inst.Ref.void_type), | 10562 | as_ty | @backingInt(Zir.Inst.Ref.void_type), |
| 10563 | as_ty | @intFromEnum(Zir.Inst.Ref.type_type), | 10563 | as_ty | @backingInt(Zir.Inst.Ref.type_type), |
| 10564 | as_ty | @intFromEnum(Zir.Inst.Ref.anyerror_type), | 10564 | as_ty | @backingInt(Zir.Inst.Ref.anyerror_type), |
| 10565 | as_ty | @intFromEnum(Zir.Inst.Ref.comptime_int_type), | 10565 | as_ty | @backingInt(Zir.Inst.Ref.comptime_int_type), |
| 10566 | as_ty | @intFromEnum(Zir.Inst.Ref.comptime_float_type), | 10566 | as_ty | @backingInt(Zir.Inst.Ref.comptime_float_type), |
| 10567 | as_ty | @intFromEnum(Zir.Inst.Ref.noreturn_type), | 10567 | as_ty | @backingInt(Zir.Inst.Ref.noreturn_type), |
| 10568 | as_ty | @intFromEnum(Zir.Inst.Ref.anyframe_type), | 10568 | as_ty | @backingInt(Zir.Inst.Ref.anyframe_type), |
| 10569 | as_ty | @intFromEnum(Zir.Inst.Ref.null_type), | 10569 | as_ty | @backingInt(Zir.Inst.Ref.null_type), |
| 10570 | as_ty | @intFromEnum(Zir.Inst.Ref.undefined_type), | 10570 | as_ty | @backingInt(Zir.Inst.Ref.undefined_type), |
| 10571 | as_ty | @intFromEnum(Zir.Inst.Ref.enum_literal_type), | 10571 | as_ty | @backingInt(Zir.Inst.Ref.enum_literal_type), |
| 10572 | as_ty | @intFromEnum(Zir.Inst.Ref.ptr_usize_type), | 10572 | as_ty | @backingInt(Zir.Inst.Ref.ptr_usize_type), |
| 10573 | as_ty | @intFromEnum(Zir.Inst.Ref.ptr_const_comptime_int_type), | 10573 | as_ty | @backingInt(Zir.Inst.Ref.ptr_const_comptime_int_type), |
| 10574 | as_ty | @intFromEnum(Zir.Inst.Ref.manyptr_u8_type), | 10574 | as_ty | @backingInt(Zir.Inst.Ref.manyptr_u8_type), |
| 10575 | as_ty | @intFromEnum(Zir.Inst.Ref.manyptr_const_u8_type), | 10575 | as_ty | @backingInt(Zir.Inst.Ref.manyptr_const_u8_type), |
| 10576 | as_ty | @intFromEnum(Zir.Inst.Ref.manyptr_const_u8_sentinel_0_type), | 10576 | as_ty | @backingInt(Zir.Inst.Ref.manyptr_const_u8_sentinel_0_type), |
| 10577 | as_ty | @intFromEnum(Zir.Inst.Ref.slice_const_u8_type), | 10577 | as_ty | @backingInt(Zir.Inst.Ref.slice_const_u8_type), |
| 10578 | as_ty | @intFromEnum(Zir.Inst.Ref.slice_const_u8_sentinel_0_type), | 10578 | as_ty | @backingInt(Zir.Inst.Ref.slice_const_u8_sentinel_0_type), |
| 10579 | as_ty | @intFromEnum(Zir.Inst.Ref.anyerror_void_error_union_type), | 10579 | as_ty | @backingInt(Zir.Inst.Ref.anyerror_void_error_union_type), |
| 10580 | as_ty | @intFromEnum(Zir.Inst.Ref.generic_poison_type), | 10580 | as_ty | @backingInt(Zir.Inst.Ref.generic_poison_type), |
| 10581 | as_ty | @intFromEnum(Zir.Inst.Ref.empty_tuple_type), | 10581 | as_ty | @backingInt(Zir.Inst.Ref.empty_tuple_type), |
| 10582 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.zero), | 10582 | as_comptime_int | @backingInt(Zir.Inst.Ref.zero), |
| 10583 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.one), | 10583 | as_comptime_int | @backingInt(Zir.Inst.Ref.one), |
| 10584 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.negative_one), | 10584 | as_comptime_int | @backingInt(Zir.Inst.Ref.negative_one), |
| 10585 | as_usize | @intFromEnum(Zir.Inst.Ref.undef_usize), | 10585 | as_usize | @backingInt(Zir.Inst.Ref.undef_usize), |
| 10586 | as_usize | @intFromEnum(Zir.Inst.Ref.zero_usize), | 10586 | as_usize | @backingInt(Zir.Inst.Ref.zero_usize), |
| 10587 | as_usize | @intFromEnum(Zir.Inst.Ref.one_usize), | 10587 | as_usize | @backingInt(Zir.Inst.Ref.one_usize), |
| 10588 | as_u1 | @intFromEnum(Zir.Inst.Ref.undef_u1), | 10588 | as_u1 | @backingInt(Zir.Inst.Ref.undef_u1), |
| 10589 | as_u1 | @intFromEnum(Zir.Inst.Ref.zero_u1), | 10589 | as_u1 | @backingInt(Zir.Inst.Ref.zero_u1), |
| 10590 | as_u1 | @intFromEnum(Zir.Inst.Ref.one_u1), | 10590 | as_u1 | @backingInt(Zir.Inst.Ref.one_u1), |
| 10591 | as_u8 | @intFromEnum(Zir.Inst.Ref.zero_u8), | 10591 | as_u8 | @backingInt(Zir.Inst.Ref.zero_u8), |
| 10592 | as_u8 | @intFromEnum(Zir.Inst.Ref.one_u8), | 10592 | as_u8 | @backingInt(Zir.Inst.Ref.one_u8), |
| 10593 | as_u8 | @intFromEnum(Zir.Inst.Ref.four_u8), | 10593 | as_u8 | @backingInt(Zir.Inst.Ref.four_u8), |
| 10594 | as_bool | @intFromEnum(Zir.Inst.Ref.undef_bool), | 10594 | as_bool | @backingInt(Zir.Inst.Ref.undef_bool), |
| 10595 | as_bool | @intFromEnum(Zir.Inst.Ref.bool_true), | 10595 | as_bool | @backingInt(Zir.Inst.Ref.bool_true), |
| 10596 | as_bool | @intFromEnum(Zir.Inst.Ref.bool_false), | 10596 | as_bool | @backingInt(Zir.Inst.Ref.bool_false), |
| 10597 | as_void | @intFromEnum(Zir.Inst.Ref.void_value), | 10597 | as_void | @backingInt(Zir.Inst.Ref.void_value), |
| 10598 | => return result, // type of result is already correct | 10598 | => return result, // type of result is already correct |
| 10599 | 10599 | ||
| 10600 | as_bool | @intFromEnum(Zir.Inst.Ref.undef) => return .undef_bool, | 10600 | as_bool | @backingInt(Zir.Inst.Ref.undef) => return .undef_bool, |
| 10601 | as_usize | @intFromEnum(Zir.Inst.Ref.undef) => return .undef_usize, | 10601 | as_usize | @backingInt(Zir.Inst.Ref.undef) => return .undef_usize, |
| 10602 | as_usize | @intFromEnum(Zir.Inst.Ref.undef_u1) => return .undef_usize, | 10602 | as_usize | @backingInt(Zir.Inst.Ref.undef_u1) => return .undef_usize, |
| 10603 | as_u1 | @intFromEnum(Zir.Inst.Ref.undef) => return .undef_u1, | 10603 | as_u1 | @backingInt(Zir.Inst.Ref.undef) => return .undef_u1, |
| 10604 | 10604 | ||
| 10605 | as_usize | @intFromEnum(Zir.Inst.Ref.zero) => return .zero_usize, | 10605 | as_usize | @backingInt(Zir.Inst.Ref.zero) => return .zero_usize, |
| 10606 | as_u1 | @intFromEnum(Zir.Inst.Ref.zero) => return .zero_u1, | 10606 | as_u1 | @backingInt(Zir.Inst.Ref.zero) => return .zero_u1, |
| 10607 | as_u8 | @intFromEnum(Zir.Inst.Ref.zero) => return .zero_u8, | 10607 | as_u8 | @backingInt(Zir.Inst.Ref.zero) => return .zero_u8, |
| 10608 | as_usize | @intFromEnum(Zir.Inst.Ref.one) => return .one_usize, | 10608 | as_usize | @backingInt(Zir.Inst.Ref.one) => return .one_usize, |
| 10609 | as_u1 | @intFromEnum(Zir.Inst.Ref.one) => return .one_u1, | 10609 | as_u1 | @backingInt(Zir.Inst.Ref.one) => return .one_u1, |
| 10610 | as_u8 | @intFromEnum(Zir.Inst.Ref.one) => return .one_u8, | 10610 | as_u8 | @backingInt(Zir.Inst.Ref.one) => return .one_u8, |
| 10611 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.zero_usize) => return .zero, | 10611 | as_comptime_int | @backingInt(Zir.Inst.Ref.zero_usize) => return .zero, |
| 10612 | as_u1 | @intFromEnum(Zir.Inst.Ref.zero_usize) => return .zero_u1, | 10612 | as_u1 | @backingInt(Zir.Inst.Ref.zero_usize) => return .zero_u1, |
| 10613 | as_u8 | @intFromEnum(Zir.Inst.Ref.zero_usize) => return .zero_u8, | 10613 | as_u8 | @backingInt(Zir.Inst.Ref.zero_usize) => return .zero_u8, |
| 10614 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.one_usize) => return .one, | 10614 | as_comptime_int | @backingInt(Zir.Inst.Ref.one_usize) => return .one, |
| 10615 | as_u1 | @intFromEnum(Zir.Inst.Ref.one_usize) => return .one_u1, | 10615 | as_u1 | @backingInt(Zir.Inst.Ref.one_usize) => return .one_u1, |
| 10616 | as_u8 | @intFromEnum(Zir.Inst.Ref.one_usize) => return .one_u8, | 10616 | as_u8 | @backingInt(Zir.Inst.Ref.one_usize) => return .one_u8, |
| 10617 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.zero_u1) => return .zero, | 10617 | as_comptime_int | @backingInt(Zir.Inst.Ref.zero_u1) => return .zero, |
| 10618 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.zero_u8) => return .zero, | 10618 | as_comptime_int | @backingInt(Zir.Inst.Ref.zero_u8) => return .zero, |
| 10619 | as_usize | @intFromEnum(Zir.Inst.Ref.zero_u1) => return .zero_usize, | 10619 | as_usize | @backingInt(Zir.Inst.Ref.zero_u1) => return .zero_usize, |
| 10620 | as_usize | @intFromEnum(Zir.Inst.Ref.zero_u8) => return .zero_usize, | 10620 | as_usize | @backingInt(Zir.Inst.Ref.zero_u8) => return .zero_usize, |
| 10621 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.one_u1) => return .one, | 10621 | as_comptime_int | @backingInt(Zir.Inst.Ref.one_u1) => return .one, |
| 10622 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.one_u8) => return .one, | 10622 | as_comptime_int | @backingInt(Zir.Inst.Ref.one_u8) => return .one, |
| 10623 | as_usize | @intFromEnum(Zir.Inst.Ref.one_u1) => return .one_usize, | 10623 | as_usize | @backingInt(Zir.Inst.Ref.one_u1) => return .one_usize, |
| 10624 | as_usize | @intFromEnum(Zir.Inst.Ref.one_u8) => return .one_usize, | 10624 | as_usize | @backingInt(Zir.Inst.Ref.one_u8) => return .one_usize, |
| 10625 | 10625 | ||
| 10626 | // Need an explicit type coercion instruction. | 10626 | // Need an explicit type coercion instruction. |
| 10627 | else => return gz.addPlNode(ri.zirTag(), src_node, Zir.Inst.As{ | 10627 | else => return gz.addPlNode(ri.zirTag(), src_node, Zir.Inst.As{ |
| ... | @@ -10791,7 +10791,7 @@ fn appendErrorNodeNotes( | ... | @@ -10791,7 +10791,7 @@ fn appendErrorNodeNotes( |
| 10791 | @branchHint(.cold); | 10791 | @branchHint(.cold); |
| 10792 | const gpa = astgen.gpa; | 10792 | const gpa = astgen.gpa; |
| 10793 | const string_bytes = &astgen.string_bytes; | 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 | try string_bytes.print(gpa, format ++ "\x00", args); | 10795 | try string_bytes.print(gpa, format ++ "\x00", args); |
| 10796 | const notes_index: u32 = if (notes.len != 0) blk: { | 10796 | const notes_index: u32 = if (notes.len != 0) blk: { |
| 10797 | const notes_start = astgen.extra.items.len; | 10797 | const notes_start = astgen.extra.items.len; |
| ... | @@ -10883,7 +10883,7 @@ fn appendErrorTokNotesOff( | ... | @@ -10883,7 +10883,7 @@ fn appendErrorTokNotesOff( |
| 10883 | @branchHint(.cold); | 10883 | @branchHint(.cold); |
| 10884 | const gpa = astgen.gpa; | 10884 | const gpa = astgen.gpa; |
| 10885 | const string_bytes = &astgen.string_bytes; | 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 | try string_bytes.print(gpa, format ++ "\x00", args); | 10887 | try string_bytes.print(gpa, format ++ "\x00", args); |
| 10888 | const notes_index: u32 = if (notes.len != 0) blk: { | 10888 | const notes_index: u32 = if (notes.len != 0) blk: { |
| 10889 | const notes_start = astgen.extra.items.len; | 10889 | const notes_start = astgen.extra.items.len; |
| ... | @@ -10919,7 +10919,7 @@ fn errNoteTokOff( | ... | @@ -10919,7 +10919,7 @@ fn errNoteTokOff( |
| 10919 | ) Allocator.Error!u32 { | 10919 | ) Allocator.Error!u32 { |
| 10920 | @branchHint(.cold); | 10920 | @branchHint(.cold); |
| 10921 | const string_bytes = &astgen.string_bytes; | 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 | try string_bytes.print(astgen.gpa, format ++ "\x00", args); | 10923 | try string_bytes.print(astgen.gpa, format ++ "\x00", args); |
| 10924 | return astgen.addExtra(Zir.Inst.CompileErrors.Item{ | 10924 | return astgen.addExtra(Zir.Inst.CompileErrors.Item{ |
| 10925 | .msg = msg, | 10925 | .msg = msg, |
| ... | @@ -10938,7 +10938,7 @@ fn errNoteNode( | ... | @@ -10938,7 +10938,7 @@ fn errNoteNode( |
| 10938 | ) Allocator.Error!u32 { | 10938 | ) Allocator.Error!u32 { |
| 10939 | @branchHint(.cold); | 10939 | @branchHint(.cold); |
| 10940 | const string_bytes = &astgen.string_bytes; | 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 | try string_bytes.print(astgen.gpa, format ++ "\x00", args); | 10942 | try string_bytes.print(astgen.gpa, format ++ "\x00", args); |
| 10943 | return astgen.addExtra(Zir.Inst.CompileErrors.Item{ | 10943 | return astgen.addExtra(Zir.Inst.CompileErrors.Item{ |
| 10944 | .msg = msg, | 10944 | .msg = msg, |
| ... | @@ -10962,11 +10962,11 @@ fn identAsString(astgen: *AstGen, ident_token: Ast.TokenIndex) !Zir.NullTerminat | ... | @@ -10962,11 +10962,11 @@ fn identAsString(astgen: *AstGen, ident_token: Ast.TokenIndex) !Zir.NullTerminat |
| 10962 | }); | 10962 | }); |
| 10963 | if (gop.found_existing) { | 10963 | if (gop.found_existing) { |
| 10964 | string_bytes.shrinkRetainingCapacity(str_index); | 10964 | string_bytes.shrinkRetainingCapacity(str_index); |
| 10965 | return @enumFromInt(gop.key_ptr.*); | 10965 | return @fromBackingInt(@intCast(gop.key_ptr.*)); |
| 10966 | } else { | 10966 | } else { |
| 10967 | gop.key_ptr.* = str_index; | 10967 | gop.key_ptr.* = str_index; |
| 10968 | try string_bytes.append(gpa, 0); | 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,7 +10980,7 @@ fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { |
| 10980 | try astgen.parseStrLit(str_lit_token, string_bytes, token_bytes, 0); | 10980 | try astgen.parseStrLit(str_lit_token, string_bytes, token_bytes, 0); |
| 10981 | const key: []const u8 = string_bytes.items[str_index..]; | 10981 | const key: []const u8 = string_bytes.items[str_index..]; |
| 10982 | if (std.mem.findScalar(u8, key, 0)) |_| return .{ | 10982 | if (std.mem.findScalar(u8, key, 0)) |_| return .{ |
| 10983 | .index = @enumFromInt(str_index), | 10983 | .index = @fromBackingInt(@intCast(str_index)), |
| 10984 | .len = @intCast(key.len), | 10984 | .len = @intCast(key.len), |
| 10985 | }; | 10985 | }; |
| 10986 | const gop = try astgen.string_table.getOrPutContextAdapted(gpa, key, StringIndexAdapter{ | 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,7 +10991,7 @@ fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { |
| 10991 | if (gop.found_existing) { | 10991 | if (gop.found_existing) { |
| 10992 | string_bytes.shrinkRetainingCapacity(str_index); | 10992 | string_bytes.shrinkRetainingCapacity(str_index); |
| 10993 | return .{ | 10993 | return .{ |
| 10994 | .index = @enumFromInt(gop.key_ptr.*), | 10994 | .index = @fromBackingInt(@intCast(gop.key_ptr.*)), |
| 10995 | .len = @intCast(key.len), | 10995 | .len = @intCast(key.len), |
| 10996 | }; | 10996 | }; |
| 10997 | } else { | 10997 | } else { |
| ... | @@ -11001,7 +11001,7 @@ fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { | ... | @@ -11001,7 +11001,7 @@ fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { |
| 11001 | // be null terminated for that to work. | 11001 | // be null terminated for that to work. |
| 11002 | try string_bytes.append(gpa, 0); | 11002 | try string_bytes.append(gpa, 0); |
| 11003 | return .{ | 11003 | return .{ |
| 11004 | .index = @enumFromInt(str_index), | 11004 | .index = @fromBackingInt(@intCast(str_index)), |
| 11005 | .len = @intCast(key.len), | 11005 | .len = @intCast(key.len), |
| 11006 | }; | 11006 | }; |
| 11007 | } | 11007 | } |
| ... | @@ -11035,7 +11035,7 @@ fn strLitNodeAsString(astgen: *AstGen, node: Ast.Node.Index) !IndexSlice { | ... | @@ -11035,7 +11035,7 @@ fn strLitNodeAsString(astgen: *AstGen, node: Ast.Node.Index) !IndexSlice { |
| 11035 | const len = string_bytes.items.len - str_index; | 11035 | const len = string_bytes.items.len - str_index; |
| 11036 | try string_bytes.append(gpa, 0); | 11036 | try string_bytes.append(gpa, 0); |
| 11037 | return IndexSlice{ | 11037 | return IndexSlice{ |
| 11038 | .index = @enumFromInt(str_index), | 11038 | .index = @fromBackingInt(@intCast(str_index)), |
| 11039 | .len = @intCast(len), | 11039 | .len = @intCast(len), |
| 11040 | }; | 11040 | }; |
| 11041 | } | 11041 | } |
| ... | @@ -11333,14 +11333,14 @@ const GenZir = struct { | ... | @@ -11333,14 +11333,14 @@ const GenZir = struct { |
| 11333 | if (gz.isEmpty()) return false; | 11333 | if (gz.isEmpty()) return false; |
| 11334 | const tags = gz.astgen.instructions.items(.tag); | 11334 | const tags = gz.astgen.instructions.items(.tag); |
| 11335 | const last_inst = gz.instructions.items[gz.instructions.items.len - 1]; | 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 | /// TODO all uses of this should be replaced with uses of `endsWithNoReturn`. | 11339 | /// TODO all uses of this should be replaced with uses of `endsWithNoReturn`. |
| 11340 | fn refIsNoReturn(gz: GenZir, inst_ref: Zir.Inst.Ref) bool { | 11340 | fn refIsNoReturn(gz: GenZir, inst_ref: Zir.Inst.Ref) bool { |
| 11341 | if (inst_ref == .unreachable_value) return true; | 11341 | if (inst_ref == .unreachable_value) return true; |
| 11342 | if (inst_ref.toIndex()) |inst_index| { | 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 | return false; | 11345 | return false; |
| 11346 | } | 11346 | } |
| ... | @@ -11391,7 +11391,7 @@ const GenZir = struct { | ... | @@ -11391,7 +11391,7 @@ const GenZir = struct { |
| 11391 | @typeInfo(Zir.Inst.BoolBr).@"struct".field_names.len + body_len, | 11391 | @typeInfo(Zir.Inst.BoolBr).@"struct".field_names.len + body_len, |
| 11392 | ); | 11392 | ); |
| 11393 | const zir_datas = astgen.instructions.items(.data); | 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 | .lhs = bool_br_lhs, | 11395 | .lhs = bool_br_lhs, |
| 11396 | .body_len = body_len, | 11396 | .body_len = body_len, |
| 11397 | }); | 11397 | }); |
| ... | @@ -11408,14 +11408,14 @@ const GenZir = struct { | ... | @@ -11408,14 +11408,14 @@ const GenZir = struct { |
| 11408 | const body_len = astgen.countBodyLenAfterFixups(body); | 11408 | const body_len = astgen.countBodyLenAfterFixups(body); |
| 11409 | 11409 | ||
| 11410 | const zir_tags = astgen.instructions.items(.tag); | 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 | try astgen.extra.ensureUnusedCapacity( | 11413 | try astgen.extra.ensureUnusedCapacity( |
| 11414 | gpa, | 11414 | gpa, |
| 11415 | @typeInfo(Zir.Inst.Block).@"struct".field_names.len + body_len, | 11415 | @typeInfo(Zir.Inst.Block).@"struct".field_names.len + body_len, |
| 11416 | ); | 11416 | ); |
| 11417 | const zir_datas = astgen.instructions.items(.data); | 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 | Zir.Inst.Block{ .body_len = body_len }, | 11419 | Zir.Inst.Block{ .body_len = body_len }, |
| 11420 | ); | 11420 | ); |
| 11421 | astgen.appendBodyWithFixups(body); | 11421 | astgen.appendBodyWithFixups(body); |
| ... | @@ -11431,14 +11431,14 @@ const GenZir = struct { | ... | @@ -11431,14 +11431,14 @@ const GenZir = struct { |
| 11431 | const body_len = astgen.countBodyLenAfterFixups(body); | 11431 | const body_len = astgen.countBodyLenAfterFixups(body); |
| 11432 | 11432 | ||
| 11433 | const zir_tags = astgen.instructions.items(.tag); | 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 | try astgen.extra.ensureUnusedCapacity( | 11436 | try astgen.extra.ensureUnusedCapacity( |
| 11437 | gpa, | 11437 | gpa, |
| 11438 | @typeInfo(Zir.Inst.BlockComptime).@"struct".field_names.len + body_len, | 11438 | @typeInfo(Zir.Inst.BlockComptime).@"struct".field_names.len + body_len, |
| 11439 | ); | 11439 | ); |
| 11440 | const zir_datas = astgen.instructions.items(.data); | 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 | Zir.Inst.BlockComptime{ | 11442 | Zir.Inst.BlockComptime{ |
| 11443 | .reason = comptime_reason, | 11443 | .reason = comptime_reason, |
| 11444 | .body_len = body_len, | 11444 | .body_len = body_len, |
| ... | @@ -11459,7 +11459,7 @@ const GenZir = struct { | ... | @@ -11459,7 +11459,7 @@ const GenZir = struct { |
| 11459 | @typeInfo(Zir.Inst.Try).@"struct".field_names.len + body_len, | 11459 | @typeInfo(Zir.Inst.Try).@"struct".field_names.len + body_len, |
| 11460 | ); | 11460 | ); |
| 11461 | const zir_datas = astgen.instructions.items(.data); | 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 | Zir.Inst.Try{ | 11463 | Zir.Inst.Try{ |
| 11464 | .operand = operand, | 11464 | .operand = operand, |
| 11465 | .body_len = body_len, | 11465 | .body_len = body_len, |
| ... | @@ -11507,7 +11507,7 @@ const GenZir = struct { | ... | @@ -11507,7 +11507,7 @@ const GenZir = struct { |
| 11507 | const astgen = gz.astgen; | 11507 | const astgen = gz.astgen; |
| 11508 | const gpa = astgen.gpa; | 11508 | const gpa = astgen.gpa; |
| 11509 | const ret_ref = if (args.ret_ref == .void_type) .none else args.ret_ref; | 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 | try gz.instructions.ensureUnusedCapacity(gpa, 1); | 11512 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 11513 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); | 11513 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| ... | @@ -11598,11 +11598,11 @@ const GenZir = struct { | ... | @@ -11598,11 +11598,11 @@ const GenZir = struct { |
| 11598 | if (cc_body.len != 0) { | 11598 | if (cc_body.len != 0) { |
| 11599 | astgen.extra.appendAssumeCapacity(astgen.countBodyLenAfterFixups(cc_body)); | 11599 | astgen.extra.appendAssumeCapacity(astgen.countBodyLenAfterFixups(cc_body)); |
| 11600 | astgen.appendBodyWithFixups(cc_body); | 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 | astgen.extra.items[break_extra + std.meta.fieldIndex(Zir.Inst.Break, "block_inst").?] = | 11602 | astgen.extra.items[break_extra + std.meta.fieldIndex(Zir.Inst.Break, "block_inst").?] = |
| 11603 | @intFromEnum(new_index); | 11603 | @backingInt(new_index); |
| 11604 | } else if (args.cc_ref != .none) { | 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 | if (ret_body.len != 0) { | 11607 | if (ret_body.len != 0) { |
| 11608 | astgen.extra.appendAssumeCapacity( | 11608 | astgen.extra.appendAssumeCapacity( |
| ... | @@ -11611,11 +11611,11 @@ const GenZir = struct { | ... | @@ -11611,11 +11611,11 @@ const GenZir = struct { |
| 11611 | ); | 11611 | ); |
| 11612 | astgen.appendBodyWithFixups(args.ret_param_refs); | 11612 | astgen.appendBodyWithFixups(args.ret_param_refs); |
| 11613 | astgen.appendBodyWithFixups(ret_body); | 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 | astgen.extra.items[break_extra + std.meta.fieldIndex(Zir.Inst.Break, "block_inst").?] = | 11615 | astgen.extra.items[break_extra + std.meta.fieldIndex(Zir.Inst.Break, "block_inst").?] = |
| 11616 | @intFromEnum(new_index); | 11616 | @backingInt(new_index); |
| 11617 | } else if (ret_ref != .none) { | 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 | if (args.noalias_bits != 0) { | 11621 | if (args.noalias_bits != 0) { |
| ... | @@ -11652,11 +11652,11 @@ const GenZir = struct { | ... | @@ -11652,11 +11652,11 @@ const GenZir = struct { |
| 11652 | astgen.appendBodyWithFixups(args.ret_param_refs); | 11652 | astgen.appendBodyWithFixups(args.ret_param_refs); |
| 11653 | astgen.appendBodyWithFixups(ret_body); | 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 | astgen.extra.items[break_extra + std.meta.fieldIndex(Zir.Inst.Break, "block_inst").?] = | 11656 | astgen.extra.items[break_extra + std.meta.fieldIndex(Zir.Inst.Break, "block_inst").?] = |
| 11657 | @intFromEnum(new_index); | 11657 | @backingInt(new_index); |
| 11658 | } else if (ret_ref != .none) { | 11658 | } else if (ret_ref != .none) { |
| 11659 | astgen.extra.appendAssumeCapacity(@intFromEnum(ret_ref)); | 11659 | astgen.extra.appendAssumeCapacity(@backingInt(ret_ref)); |
| 11660 | } | 11660 | } |
| 11661 | astgen.appendBodyWithFixupsExtraRefsArrayList(&astgen.extra, body, args.param_insts); | 11661 | astgen.appendBodyWithFixupsExtraRefsArrayList(&astgen.extra, body, args.param_insts); |
| 11662 | astgen.extra.appendSliceAssumeCapacity(src_locs_and_hash); | 11662 | astgen.extra.appendSliceAssumeCapacity(src_locs_and_hash); |
| ... | @@ -11704,11 +11704,11 @@ const GenZir = struct { | ... | @@ -11704,11 +11704,11 @@ const GenZir = struct { |
| 11704 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); | 11704 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11705 | try astgen.string_bytes.ensureUnusedCapacity(gpa, @sizeOf(std.math.big.Limb) * limbs.len); | 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 | astgen.instructions.appendAssumeCapacity(.{ | 11708 | astgen.instructions.appendAssumeCapacity(.{ |
| 11709 | .tag = .int_big, | 11709 | .tag = .int_big, |
| 11710 | .data = .{ .str = .{ | 11710 | .data = .{ .str = .{ |
| 11711 | .start = @enumFromInt(astgen.string_bytes.items.len), | 11711 | .start = @fromBackingInt(@intCast(astgen.string_bytes.items.len)), |
| 11712 | .len = @intCast(limbs.len), | 11712 | .len = @intCast(limbs.len), |
| 11713 | } }, | 11713 | } }, |
| 11714 | }); | 11714 | }); |
| ... | @@ -11749,7 +11749,7 @@ const GenZir = struct { | ... | @@ -11749,7 +11749,7 @@ const GenZir = struct { |
| 11749 | src_node: Ast.Node.Index, | 11749 | src_node: Ast.Node.Index, |
| 11750 | ) !Zir.Inst.Index { | 11750 | ) !Zir.Inst.Index { |
| 11751 | assert(operand != .none); | 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 | try gz.astgen.instructions.append(gz.astgen.gpa, .{ | 11753 | try gz.astgen.instructions.append(gz.astgen.gpa, .{ |
| 11754 | .tag = tag, | 11754 | .tag = tag, |
| 11755 | .data = .{ .un_node = .{ | 11755 | .data = .{ .un_node = .{ |
| ... | @@ -11772,7 +11772,7 @@ const GenZir = struct { | ... | @@ -11772,7 +11772,7 @@ const GenZir = struct { |
| 11772 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); | 11772 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11773 | 11773 | ||
| 11774 | const payload_index = try gz.astgen.addExtra(extra); | 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 | gz.astgen.instructions.appendAssumeCapacity(.{ | 11776 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 11777 | .tag = tag, | 11777 | .tag = tag, |
| 11778 | .data = .{ .pl_node = .{ | 11778 | .data = .{ .pl_node = .{ |
| ... | @@ -11829,7 +11829,7 @@ const GenZir = struct { | ... | @@ -11829,7 +11829,7 @@ const GenZir = struct { |
| 11829 | gz.astgen.appendBodyWithFixupsExtraRefsArrayList(&gz.astgen.extra, param_body, prev_param_insts); | 11829 | gz.astgen.appendBodyWithFixupsExtraRefsArrayList(&gz.astgen.extra, param_body, prev_param_insts); |
| 11830 | param_gz.unstack(); | 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 | gz.astgen.instructions.appendAssumeCapacity(.{ | 11833 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 11834 | .tag = tag, | 11834 | .tag = tag, |
| 11835 | .data = .{ .pl_tok = .{ | 11835 | .data = .{ .pl_tok = .{ |
| ... | @@ -11842,7 +11842,7 @@ const GenZir = struct { | ... | @@ -11842,7 +11842,7 @@ const GenZir = struct { |
| 11842 | } | 11842 | } |
| 11843 | 11843 | ||
| 11844 | fn addStdLangValue(gz: *GenZir, src_node: Ast.Node.Index, val: Zir.Inst.StdLangValue) !Zir.Inst.Ref { | 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 | fn addExtendedPayload(gz: *GenZir, opcode: Zir.Inst.Extended, extra: anytype) !Zir.Inst.Ref { | 11848 | fn addExtendedPayload(gz: *GenZir, opcode: Zir.Inst.Extended, extra: anytype) !Zir.Inst.Ref { |
| ... | @@ -11861,7 +11861,7 @@ const GenZir = struct { | ... | @@ -11861,7 +11861,7 @@ const GenZir = struct { |
| 11861 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); | 11861 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11862 | 11862 | ||
| 11863 | const payload_index = try gz.astgen.addExtra(extra); | 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 | gz.astgen.instructions.appendAssumeCapacity(.{ | 11865 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 11866 | .tag = .extended, | 11866 | .tag = .extended, |
| 11867 | .data = .{ .extended = .{ | 11867 | .data = .{ .extended = .{ |
| ... | @@ -11893,7 +11893,7 @@ const GenZir = struct { | ... | @@ -11893,7 +11893,7 @@ const GenZir = struct { |
| 11893 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.NodeMultiOp{ | 11893 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.NodeMultiOp{ |
| 11894 | .src_node = gz.nodeIndexToRelative(node), | 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 | astgen.instructions.appendAssumeCapacity(.{ | 11897 | astgen.instructions.appendAssumeCapacity(.{ |
| 11898 | .tag = .extended, | 11898 | .tag = .extended, |
| 11899 | .data = .{ .extended = .{ | 11899 | .data = .{ .extended = .{ |
| ... | @@ -11918,7 +11918,7 @@ const GenZir = struct { | ... | @@ -11918,7 +11918,7 @@ const GenZir = struct { |
| 11918 | 11918 | ||
| 11919 | try gz.instructions.ensureUnusedCapacity(gpa, 1); | 11919 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 11920 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); | 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 | astgen.instructions.appendAssumeCapacity(.{ | 11922 | astgen.instructions.appendAssumeCapacity(.{ |
| 11923 | .tag = .extended, | 11923 | .tag = .extended, |
| 11924 | .data = .{ .extended = .{ | 11924 | .data = .{ .extended = .{ |
| ... | @@ -11942,13 +11942,13 @@ const GenZir = struct { | ... | @@ -11942,13 +11942,13 @@ const GenZir = struct { |
| 11942 | 11942 | ||
| 11943 | try gz.instructions.ensureUnusedCapacity(gpa, 1); | 11943 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 11944 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); | 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 | astgen.instructions.appendAssumeCapacity(.{ | 11946 | astgen.instructions.appendAssumeCapacity(.{ |
| 11947 | .tag = .extended, | 11947 | .tag = .extended, |
| 11948 | .data = .{ .extended = .{ | 11948 | .data = .{ .extended = .{ |
| 11949 | .opcode = opcode, | 11949 | .opcode = opcode, |
| 11950 | .small = small, | 11950 | .small = small, |
| 11951 | .operand = @bitCast(@intFromEnum(gz.nodeIndexToRelative(src_node))), | 11951 | .operand = @bitCast(@backingInt(gz.nodeIndexToRelative(src_node))), |
| 11952 | } }, | 11952 | } }, |
| 11953 | }); | 11953 | }); |
| 11954 | gz.instructions.appendAssumeCapacity(new_index); | 11954 | gz.instructions.appendAssumeCapacity(new_index); |
| ... | @@ -11980,7 +11980,7 @@ const GenZir = struct { | ... | @@ -11980,7 +11980,7 @@ const GenZir = struct { |
| 11980 | abs_tok_index: Ast.TokenIndex, | 11980 | abs_tok_index: Ast.TokenIndex, |
| 11981 | ) !Zir.Inst.Index { | 11981 | ) !Zir.Inst.Index { |
| 11982 | const astgen = gz.astgen; | 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 | assert(operand != .none); | 11984 | assert(operand != .none); |
| 11985 | try astgen.instructions.append(astgen.gpa, .{ | 11985 | try astgen.instructions.append(astgen.gpa, .{ |
| 11986 | .tag = tag, | 11986 | .tag = tag, |
| ... | @@ -12130,7 +12130,7 @@ const GenZir = struct { | ... | @@ -12130,7 +12130,7 @@ const GenZir = struct { |
| 12130 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); | 12130 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 12131 | try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Break).@"struct".field_names.len); | 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 | gz.astgen.instructions.appendAssumeCapacity(.{ | 12134 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 12135 | .tag = tag, | 12135 | .tag = tag, |
| 12136 | .data = .{ .@"break" = .{ | 12136 | .data = .{ .@"break" = .{ |
| ... | @@ -12228,7 +12228,7 @@ const GenZir = struct { | ... | @@ -12228,7 +12228,7 @@ const GenZir = struct { |
| 12228 | .data = .{ .extended = .{ | 12228 | .data = .{ .extended = .{ |
| 12229 | .opcode = opcode, | 12229 | .opcode = opcode, |
| 12230 | .small = undefined, | 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,10 +12259,10 @@ const GenZir = struct { |
| 12259 | .src_node = gz.nodeIndexToRelative(args.node), | 12259 | .src_node = gz.nodeIndexToRelative(args.node), |
| 12260 | }); | 12260 | }); |
| 12261 | if (args.type_inst != .none) { | 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 | if (args.align_inst != .none) { | 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 | const has_type: u4 = @intFromBool(args.type_inst != .none); | 12268 | const has_type: u4 = @intFromBool(args.type_inst != .none); |
| ... | @@ -12271,7 +12271,7 @@ const GenZir = struct { | ... | @@ -12271,7 +12271,7 @@ const GenZir = struct { |
| 12271 | const is_comptime: u4 = @intFromBool(args.is_comptime); | 12271 | const is_comptime: u4 = @intFromBool(args.is_comptime); |
| 12272 | const small: u16 = has_type | (has_align << 1) | (is_const << 2) | (is_comptime << 3); | 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 | astgen.instructions.appendAssumeCapacity(.{ | 12275 | astgen.instructions.appendAssumeCapacity(.{ |
| 12276 | .tag = .extended, | 12276 | .tag = .extended, |
| 12277 | .data = .{ .extended = .{ | 12277 | .data = .{ .extended = .{ |
| ... | @@ -12326,7 +12326,7 @@ const GenZir = struct { | ... | @@ -12326,7 +12326,7 @@ const GenZir = struct { |
| 12326 | .inputs_len = @intCast(args.inputs.len), | 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 | astgen.instructions.appendAssumeCapacity(.{ | 12330 | astgen.instructions.appendAssumeCapacity(.{ |
| 12331 | .tag = .extended, | 12331 | .tag = .extended, |
| 12332 | .data = .{ .extended = .{ | 12332 | .data = .{ .extended = .{ |
| ... | @@ -12343,7 +12343,7 @@ const GenZir = struct { | ... | @@ -12343,7 +12343,7 @@ const GenZir = struct { |
| 12343 | /// Does *not* append the block instruction to the scope. | 12343 | /// Does *not* append the block instruction to the scope. |
| 12344 | /// Leaves the `payload_index` field undefined. | 12344 | /// Leaves the `payload_index` field undefined. |
| 12345 | fn makeBlockInst(gz: *GenZir, tag: Zir.Inst.Tag, node: Ast.Node.Index) !Zir.Inst.Index { | 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 | const gpa = gz.astgen.gpa; | 12347 | const gpa = gz.astgen.gpa; |
| 12348 | try gz.astgen.instructions.append(gpa, .{ | 12348 | try gz.astgen.instructions.append(gpa, .{ |
| 12349 | .tag = tag, | 12349 | .tag = tag, |
| ... | @@ -12359,7 +12359,7 @@ const GenZir = struct { | ... | @@ -12359,7 +12359,7 @@ const GenZir = struct { |
| 12359 | /// Does *not* append the block instruction to the scope. | 12359 | /// Does *not* append the block instruction to the scope. |
| 12360 | /// Leaves the `payload_index` field undefined. Use `setDeclaration` to finalize. | 12360 | /// Leaves the `payload_index` field undefined. Use `setDeclaration` to finalize. |
| 12361 | fn makeDeclaration(gz: *GenZir, node: Ast.Node.Index) !Zir.Inst.Index { | 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 | try gz.astgen.instructions.append(gz.astgen.gpa, .{ | 12363 | try gz.astgen.instructions.append(gz.astgen.gpa, .{ |
| 12364 | .tag = .declaration, | 12364 | .tag = .declaration, |
| 12365 | .data = .{ .declaration = .{ | 12365 | .data = .{ .declaration = .{ |
| ... | @@ -12375,7 +12375,7 @@ const GenZir = struct { | ... | @@ -12375,7 +12375,7 @@ const GenZir = struct { |
| 12375 | fn addCondBr(gz: *GenZir, tag: Zir.Inst.Tag, node: Ast.Node.Index) !Zir.Inst.Index { | 12375 | fn addCondBr(gz: *GenZir, tag: Zir.Inst.Tag, node: Ast.Node.Index) !Zir.Inst.Index { |
| 12376 | const gpa = gz.astgen.gpa; | 12376 | const gpa = gz.astgen.gpa; |
| 12377 | try gz.instructions.ensureUnusedCapacity(gpa, 1); | 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 | try gz.astgen.instructions.append(gpa, .{ | 12379 | try gz.astgen.instructions.append(gpa, .{ |
| 12380 | .tag = tag, | 12380 | .tag = tag, |
| 12381 | .data = .{ .pl_node = .{ | 12381 | .data = .{ .pl_node = .{ |
| ... | @@ -12436,7 +12436,7 @@ const GenZir = struct { | ... | @@ -12436,7 +12436,7 @@ const GenZir = struct { |
| 12436 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); | 12436 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); |
| 12437 | astgen.extra.appendSliceAssumeCapacity(args.remaining); | 12437 | astgen.extra.appendSliceAssumeCapacity(args.remaining); |
| 12438 | 12438 | ||
| 12439 | astgen.instructions.set(@intFromEnum(inst), .{ | 12439 | astgen.instructions.set(@backingInt(inst), .{ |
| 12440 | .tag = .extended, | 12440 | .tag = .extended, |
| 12441 | .data = .{ .extended = .{ | 12441 | .data = .{ .extended = .{ |
| 12442 | .opcode = .struct_decl, | 12442 | .opcode = .struct_decl, |
| ... | @@ -12507,7 +12507,7 @@ const GenZir = struct { | ... | @@ -12507,7 +12507,7 @@ const GenZir = struct { |
| 12507 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); | 12507 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); |
| 12508 | astgen.extra.appendSliceAssumeCapacity(args.remaining); | 12508 | astgen.extra.appendSliceAssumeCapacity(args.remaining); |
| 12509 | 12509 | ||
| 12510 | astgen.instructions.set(@intFromEnum(inst), .{ | 12510 | astgen.instructions.set(@backingInt(inst), .{ |
| 12511 | .tag = .extended, | 12511 | .tag = .extended, |
| 12512 | .data = .{ .extended = .{ | 12512 | .data = .{ .extended = .{ |
| 12513 | .opcode = .union_decl, | 12513 | .opcode = .union_decl, |
| ... | @@ -12571,7 +12571,7 @@ const GenZir = struct { | ... | @@ -12571,7 +12571,7 @@ const GenZir = struct { |
| 12571 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); | 12571 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); |
| 12572 | astgen.extra.appendSliceAssumeCapacity(args.remaining); | 12572 | astgen.extra.appendSliceAssumeCapacity(args.remaining); |
| 12573 | 12573 | ||
| 12574 | astgen.instructions.set(@intFromEnum(inst), .{ | 12574 | astgen.instructions.set(@backingInt(inst), .{ |
| 12575 | .tag = .extended, | 12575 | .tag = .extended, |
| 12576 | .data = .{ .extended = .{ | 12576 | .data = .{ .extended = .{ |
| 12577 | .opcode = .enum_decl, | 12577 | .opcode = .enum_decl, |
| ... | @@ -12620,7 +12620,7 @@ const GenZir = struct { | ... | @@ -12620,7 +12620,7 @@ const GenZir = struct { |
| 12620 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); | 12620 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.capture_names)); |
| 12621 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.decls)); | 12621 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(args.decls)); |
| 12622 | 12622 | ||
| 12623 | astgen.instructions.set(@intFromEnum(inst), .{ | 12623 | astgen.instructions.set(@backingInt(inst), .{ |
| 12624 | .tag = .extended, | 12624 | .tag = .extended, |
| 12625 | .data = .{ .extended = .{ | 12625 | .data = .{ .extended = .{ |
| 12626 | .opcode = .opaque_decl, | 12626 | .opcode = .opaque_decl, |
| ... | @@ -12643,7 +12643,7 @@ const GenZir = struct { | ... | @@ -12643,7 +12643,7 @@ const GenZir = struct { |
| 12643 | try gz.instructions.ensureUnusedCapacity(gpa, 1); | 12643 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 12644 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); | 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 | gz.astgen.instructions.appendAssumeCapacity(inst); | 12647 | gz.astgen.instructions.appendAssumeCapacity(inst); |
| 12648 | gz.instructions.appendAssumeCapacity(new_index); | 12648 | gz.instructions.appendAssumeCapacity(new_index); |
| 12649 | return new_index; | 12649 | return new_index; |
| ... | @@ -12654,7 +12654,7 @@ const GenZir = struct { | ... | @@ -12654,7 +12654,7 @@ const GenZir = struct { |
| 12654 | try gz.instructions.ensureUnusedCapacity(gpa, 1); | 12654 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 12655 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); | 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 | gz.astgen.instructions.len += 1; | 12658 | gz.astgen.instructions.len += 1; |
| 12659 | gz.instructions.appendAssumeCapacity(new_index); | 12659 | gz.instructions.appendAssumeCapacity(new_index); |
| 12660 | return new_index; | 12660 | return new_index; |
| ... | @@ -12683,7 +12683,7 @@ const GenZir = struct { | ... | @@ -12683,7 +12683,7 @@ const GenZir = struct { |
| 12683 | /// This can only be for short-lived references; the memory becomes invalidated | 12683 | /// This can only be for short-lived references; the memory becomes invalidated |
| 12684 | /// when another string is added. | 12684 | /// when another string is added. |
| 12685 | fn nullTerminatedString(astgen: AstGen, index: Zir.NullTerminatedString) [*:0]const u8 { | 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 | /// Local variables shadowing detection, including function parameters. | 12689 | /// Local variables shadowing detection, including function parameters. |
| ... | @@ -13136,7 +13136,7 @@ fn scanContainer( | ... | @@ -13136,7 +13136,7 @@ fn scanContainer( |
| 13136 | } | 13136 | } |
| 13137 | 13137 | ||
| 13138 | fn appendPlaceholder(astgen: *AstGen) Allocator.Error!Zir.Inst.Index { | 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 | try astgen.instructions.append(astgen.gpa, .{ | 13140 | try astgen.instructions.append(astgen.gpa, .{ |
| 13141 | .tag = .extended, | 13141 | .tag = .extended, |
| 13142 | .data = .{ .extended = .{ | 13142 | .data = .{ .extended = .{ |
| ... | @@ -13183,7 +13183,7 @@ fn appendPossiblyRefdBodyInst( | ... | @@ -13183,7 +13183,7 @@ fn appendPossiblyRefdBodyInst( |
| 13183 | list: *std.ArrayList(u32), | 13183 | list: *std.ArrayList(u32), |
| 13184 | body_inst: Zir.Inst.Index, | 13184 | body_inst: Zir.Inst.Index, |
| 13185 | ) void { | 13185 | ) void { |
| 13186 | list.appendAssumeCapacity(@intFromEnum(body_inst)); | 13186 | list.appendAssumeCapacity(@backingInt(body_inst)); |
| 13187 | const kv = astgen.ref_table.fetchRemove(body_inst) orelse return; | 13187 | const kv = astgen.ref_table.fetchRemove(body_inst) orelse return; |
| 13188 | const ref_inst = kv.value; | 13188 | const ref_inst = kv.value; |
| 13189 | return appendPossiblyRefdBodyInst(astgen, list, ref_inst); | 13189 | return appendPossiblyRefdBodyInst(astgen, list, ref_inst); |
| ... | @@ -13221,8 +13221,8 @@ fn emitDbgStmt(gz: *GenZir, lc: LineColumn) !void { | ... | @@ -13221,8 +13221,8 @@ fn emitDbgStmt(gz: *GenZir, lc: LineColumn) !void { |
| 13221 | if (gz.instructions.items.len > gz.instructions_top) { | 13221 | if (gz.instructions.items.len > gz.instructions_top) { |
| 13222 | const astgen = gz.astgen; | 13222 | const astgen = gz.astgen; |
| 13223 | const last = gz.instructions.items[gz.instructions.items.len - 1]; | 13223 | const last = gz.instructions.items[gz.instructions.items.len - 1]; |
| 13224 | if (astgen.instructions.items(.tag)[@intFromEnum(last)] == .dbg_stmt) { | 13224 | if (astgen.instructions.items(.tag)[@backingInt(last)] == .dbg_stmt) { |
| 13225 | astgen.instructions.items(.data)[@intFromEnum(last)].dbg_stmt = .{ | 13225 | astgen.instructions.items(.data)[@backingInt(last)].dbg_stmt = .{ |
| 13226 | .line = lc[0], | 13226 | .line = lc[0], |
| 13227 | .column = lc[1], | 13227 | .column = lc[1], |
| 13228 | }; | 13228 | }; |
| ... | @@ -13245,7 +13245,7 @@ fn emitDbgStmt(gz: *GenZir, lc: LineColumn) !void { | ... | @@ -13245,7 +13245,7 @@ fn emitDbgStmt(gz: *GenZir, lc: LineColumn) !void { |
| 13245 | fn emitDbgStmtForceCurrentIndex(gz: *GenZir, lc: LineColumn) !void { | 13245 | fn emitDbgStmtForceCurrentIndex(gz: *GenZir, lc: LineColumn) !void { |
| 13246 | const astgen = gz.astgen; | 13246 | const astgen = gz.astgen; |
| 13247 | if (gz.instructions.items.len > gz.instructions_top and | 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 | const last = astgen.instructions.len - 1; | 13250 | const last = astgen.instructions.len - 1; |
| 13251 | if (astgen.instructions.items(.tag)[last] == .dbg_stmt) { | 13251 | if (astgen.instructions.items(.tag)[last] == .dbg_stmt) { |
| ... | @@ -13523,14 +13523,14 @@ fn setDeclaration( | ... | @@ -13523,14 +13523,14 @@ fn setDeclaration( |
| 13523 | .flags_0 = flags_arr[0], | 13523 | .flags_0 = flags_arr[0], |
| 13524 | .flags_1 = flags_arr[1], | 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 | astgen.addExtraAssumeCapacity(extra); | 13527 | astgen.addExtraAssumeCapacity(extra); |
| 13528 | 13528 | ||
| 13529 | if (id.hasName()) { | 13529 | if (id.hasName()) { |
| 13530 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.name)); | 13530 | astgen.extra.appendAssumeCapacity(@backingInt(args.name)); |
| 13531 | } | 13531 | } |
| 13532 | if (id.hasLibName()) { | 13532 | if (id.hasLibName()) { |
| 13533 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.lib_name)); | 13533 | astgen.extra.appendAssumeCapacity(@backingInt(args.lib_name)); |
| 13534 | } | 13534 | } |
| 13535 | if (id.hasTypeBody()) { | 13535 | if (id.hasTypeBody()) { |
| 13536 | astgen.extra.appendAssumeCapacity(type_len); | 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,17 +107,17 @@ pub fn getMessages(eb: ErrorBundle) []const MessageIndex { |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | pub fn getErrorMessage(eb: ErrorBundle, index: MessageIndex) ErrorMessage { | 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 | pub fn getSourceLocation(eb: ErrorBundle, index: SourceLocationIndex) SourceLocation { | 113 | pub fn getSourceLocation(eb: ErrorBundle, index: SourceLocationIndex) SourceLocation { |
| 114 | assert(index != .none); | 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 | pub fn getNotes(eb: ErrorBundle, index: MessageIndex) []const MessageIndex { | 118 | pub fn getNotes(eb: ErrorBundle, index: MessageIndex) []const MessageIndex { |
| 119 | const notes_len = eb.getErrorMessage(index).notes_len; | 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 | return @as([]const MessageIndex, @ptrCast(eb.extra[start..][0..notes_len])); | 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,8 +135,8 @@ fn extraData(eb: ErrorBundle, comptime T: type, index: usize) struct { data: T, |
| 135 | inline for (field_names, field_types) |field_name, field_type| { | 135 | inline for (field_names, field_types) |field_name, field_type| { |
| 136 | @field(result, field_name) = switch (field_type) { | 136 | @field(result, field_name) = switch (field_type) { |
| 137 | u32 => eb.extra[i], | 137 | u32 => eb.extra[i], |
| 138 | MessageIndex => @as(MessageIndex, @enumFromInt(eb.extra[i])), | 138 | MessageIndex => @as(MessageIndex, @fromBackingInt(@intCast(eb.extra[i]))), |
| 139 | SourceLocationIndex => @as(SourceLocationIndex, @enumFromInt(eb.extra[i])), | 139 | SourceLocationIndex => @as(SourceLocationIndex, @fromBackingInt(@intCast(eb.extra[i]))), |
| 140 | else => @compileError("bad field type"), | 140 | else => @compileError("bad field type"), |
| 141 | }; | 141 | }; |
| 142 | i += 1; | 142 | i += 1; |
| ... | @@ -209,7 +209,7 @@ fn renderErrorMessage( | ... | @@ -209,7 +209,7 @@ fn renderErrorMessage( |
| 209 | const w = t.writer; | 209 | const w = t.writer; |
| 210 | const err_msg = eb.getErrorMessage(err_msg_index); | 210 | const err_msg = eb.getErrorMessage(err_msg_index); |
| 211 | if (err_msg.src_loc != .none) { | 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 | var prefix: Writer.Discarding = .init(&.{}); | 213 | var prefix: Writer.Discarding = .init(&.{}); |
| 214 | try w.splatByteAll(' ', indent); | 214 | try w.splatByteAll(' ', indent); |
| 215 | prefix.count += indent; | 215 | prefix.count += indent; |
| ... | @@ -445,20 +445,20 @@ pub const Wip = struct { | ... | @@ -445,20 +445,20 @@ pub const Wip = struct { |
| 445 | try wip.addRootErrorMessage(msg); | 445 | try wip.addRootErrorMessage(msg); |
| 446 | const notes_start = try wip.reserveNotes(@intCast(notes.len)); | 446 | const notes_start = try wip.reserveNotes(@intCast(notes.len)); |
| 447 | for (notes_start.., notes) |i, note| { | 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 | pub fn addErrorMessage(wip: *Wip, em: ErrorMessage) Allocator.Error!MessageIndex { | 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 | pub fn addErrorMessageAssumeCapacity(wip: *Wip, em: ErrorMessage) MessageIndex { | 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 | pub fn addSourceLocation(wip: *Wip, sl: SourceLocation) Allocator.Error!SourceLocationIndex { | 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 | pub fn addReferenceTrace(wip: *Wip, rt: ReferenceTrace) Allocator.Error!void { | 464 | pub fn addReferenceTrace(wip: *Wip, rt: ReferenceTrace) Allocator.Error!void { |
| ... | @@ -477,7 +477,7 @@ pub const Wip = struct { | ... | @@ -477,7 +477,7 @@ pub const Wip = struct { |
| 477 | const notes_start = wip.reserveNotes(@intCast(other_list.len)) catch unreachable; | 477 | const notes_start = wip.reserveNotes(@intCast(other_list.len)) catch unreachable; |
| 478 | for (notes_start.., other_list) |note, message| { | 478 | for (notes_start.., other_list) |note, message| { |
| 479 | // This line can cause `wip.extra.items` to be resized. | 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 | wip.extra.items[note] = note_index; | 481 | wip.extra.items[note] = note_index; |
| 482 | } | 482 | } |
| 483 | } | 483 | } |
| ... | @@ -512,7 +512,7 @@ pub const Wip = struct { | ... | @@ -512,7 +512,7 @@ pub const Wip = struct { |
| 512 | src_path: []const u8, | 512 | src_path: []const u8, |
| 513 | ) !void { | 513 | ) !void { |
| 514 | const Zir = std.zig.Zir; | 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 | assert(payload_index != 0); | 516 | assert(payload_index != 0); |
| 517 | 517 | ||
| 518 | const header = zir.extraData(Zir.Inst.CompileErrors, payload_index); | 518 | const header = zir.extraData(Zir.Inst.CompileErrors, payload_index); |
| ... | @@ -568,7 +568,7 @@ pub const Wip = struct { | ... | @@ -568,7 +568,7 @@ pub const Wip = struct { |
| 568 | const loc = std.zig.findLineColumn(source, span.main); | 568 | const loc = std.zig.findLineColumn(source, span.main); |
| 569 | 569 | ||
| 570 | // This line can cause `wip.extra.items` to be resized. | 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 | .msg = try eb.addString(msg), | 572 | .msg = try eb.addString(msg), |
| 573 | .src_loc = try eb.addSourceLocation(.{ | 573 | .src_loc = try eb.addSourceLocation(.{ |
| 574 | .src_path = try eb.addString(src_path), | 574 | .src_path = try eb.addString(src_path), |
| ... | @@ -607,7 +607,7 @@ pub const Wip = struct { | ... | @@ -607,7 +607,7 @@ pub const Wip = struct { |
| 607 | const end = token_start + @as(u32, @intCast(tree.tokenSlice(token).len)); | 607 | const end = token_start + @as(u32, @intCast(tree.tokenSlice(token).len)); |
| 608 | break :span .{ .start = start, .end = end, .main = start }; | 608 | break :span .{ .start = start, .end = end, .main = start }; |
| 609 | } else { | 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 | const err_loc = std.zig.findLineColumn(source, err_span.main); | 613 | const err_loc = std.zig.findLineColumn(source, err_span.main); |
| ... | @@ -636,13 +636,13 @@ pub const Wip = struct { | ... | @@ -636,13 +636,13 @@ pub const Wip = struct { |
| 636 | const end = token_start + @as(u32, @intCast(tree.tokenSlice(token).len)); | 636 | const end = token_start + @as(u32, @intCast(tree.tokenSlice(token).len)); |
| 637 | break :span .{ .start = start, .end = end, .main = start }; | 637 | break :span .{ .start = start, .end = end, .main = start }; |
| 638 | } else { | 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 | const note_loc = std.zig.findLineColumn(source, note_span.main); | 642 | const note_loc = std.zig.findLineColumn(source, note_span.main); |
| 643 | 643 | ||
| 644 | // This line can cause `wip.extra.items` to be resized. | 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 | .msg = try eb.addString(note.msg.get(zoir)), | 646 | .msg = try eb.addString(note.msg.get(zoir)), |
| 647 | .src_loc = try eb.addSourceLocation(.{ | 647 | .src_loc = try eb.addSourceLocation(.{ |
| 648 | .src_path = try eb.addString(src_path), | 648 | .src_path = try eb.addString(src_path), |
| ... | @@ -674,7 +674,7 @@ pub const Wip = struct { | ... | @@ -674,7 +674,7 @@ pub const Wip = struct { |
| 674 | }); | 674 | }); |
| 675 | const notes_start = try wip.reserveNotes(other_msg.notes_len); | 675 | const notes_start = try wip.reserveNotes(other_msg.notes_len); |
| 676 | for (notes_start.., other.getNotes(msg_index)) |note, other_note| { | 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 | return msg; | 679 | return msg; |
| 680 | } | 680 | } |
| ... | @@ -691,7 +691,7 @@ pub const Wip = struct { | ... | @@ -691,7 +691,7 @@ pub const Wip = struct { |
| 691 | defer ref_traces.deinit(wip.gpa); | 691 | defer ref_traces.deinit(wip.gpa); |
| 692 | 692 | ||
| 693 | if (other_sl.reference_trace_len > 0) { | 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 | for (0..other_sl.reference_trace_len) |_| { | 695 | for (0..other_sl.reference_trace_len) |_| { |
| 696 | const other_ref_trace_ed = other.extraData(ReferenceTrace, ref_index); | 696 | const other_ref_trace_ed = other.extraData(ReferenceTrace, ref_index); |
| 697 | const other_ref_trace = other_ref_trace_ed.data; | 697 | const other_ref_trace = other_ref_trace_ed.data; |
| ... | @@ -753,8 +753,8 @@ pub const Wip = struct { | ... | @@ -753,8 +753,8 @@ pub const Wip = struct { |
| 753 | inline for (field_names, field_types) |field_name, field_type| { | 753 | inline for (field_names, field_types) |field_name, field_type| { |
| 754 | wip.extra.items[i] = switch (field_type) { | 754 | wip.extra.items[i] = switch (field_type) { |
| 755 | u32 => @field(extra, field_name), | 755 | u32 => @field(extra, field_name), |
| 756 | MessageIndex => @intFromEnum(@field(extra, field_name)), | 756 | MessageIndex => @backingInt(@field(extra, field_name)), |
| 757 | SourceLocationIndex => @intFromEnum(@field(extra, field_name)), | 757 | SourceLocationIndex => @backingInt(@field(extra, field_name)), |
| 758 | else => @compileError("bad field type"), | 758 | else => @compileError("bad field type"), |
| 759 | }; | 759 | }; |
| 760 | i += 1; | 760 | i += 1; |
| ... | @@ -811,7 +811,7 @@ pub const Wip = struct { | ... | @@ -811,7 +811,7 @@ pub const Wip = struct { |
| 811 | .notes_len = 1, | 811 | .notes_len = 1, |
| 812 | }); | 812 | }); |
| 813 | const i = try wip.reserveNotes(1); | 813 | const i = try wip.reserveNotes(1); |
| 814 | const note_index = @intFromEnum(wip.addErrorMessageAssumeCapacity(.{ | 814 | const note_index = @backingInt(wip.addErrorMessageAssumeCapacity(.{ |
| 815 | .msg = try wip.addString("this is a note"), | 815 | .msg = try wip.addString("this is a note"), |
| 816 | .src_loc = try wip.addSourceLocation(.{ | 816 | .src_loc = try wip.addSourceLocation(.{ |
| 817 | .src_path = try wip.addString("bar"), | 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,15 +34,15 @@ fn tokenStart(p: *const Parse, token_index: TokenIndex) Ast.ByteOffset { |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | fn nodeTag(p: *const Parse, node: Node.Index) Node.Tag { | 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 | fn nodeMainToken(p: *const Parse, node: Node.Index) TokenIndex { | 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 | fn nodeData(p: *const Parse, node: Node.Index) Node.Data { | 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 | const SmallSpan = union(enum) { | 48 | const SmallSpan = union(enum) { |
| ... | @@ -69,20 +69,20 @@ const Members = struct { | ... | @@ -69,20 +69,20 @@ const Members = struct { |
| 69 | fn listToSpan(p: *Parse, list: []const Node.Index) Allocator.Error!Node.SubRange { | 69 | fn listToSpan(p: *Parse, list: []const Node.Index) Allocator.Error!Node.SubRange { |
| 70 | try p.extra_data.appendSlice(p.gpa, @ptrCast(list)); | 70 | try p.extra_data.appendSlice(p.gpa, @ptrCast(list)); |
| 71 | return .{ | 71 | return .{ |
| 72 | .start = @enumFromInt(p.extra_data.items.len - list.len), | 72 | .start = @fromBackingInt(@intCast(p.extra_data.items.len - list.len)), |
| 73 | .end = @enumFromInt(p.extra_data.items.len), | 73 | .end = @fromBackingInt(@intCast(p.extra_data.items.len)), |
| 74 | }; | 74 | }; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | fn addNode(p: *Parse, elem: Ast.Node) Allocator.Error!Node.Index { | 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 | try p.nodes.append(p.gpa, elem); | 79 | try p.nodes.append(p.gpa, elem); |
| 80 | return result; | 80 | return result; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | fn setNode(p: *Parse, i: usize, elem: Ast.Node) Node.Index { | 83 | fn setNode(p: *Parse, i: usize, elem: Ast.Node) Node.Index { |
| 84 | p.nodes.set(i, elem); | 84 | p.nodes.set(i, elem); |
| 85 | return @enumFromInt(i); | 85 | return @fromBackingInt(@intCast(i)); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | fn reserveNode(p: *Parse, tag: Ast.Node.Tag) !usize { | 88 | fn reserveNode(p: *Parse, tag: Ast.Node.Tag) !usize { |
| ... | @@ -105,14 +105,14 @@ fn unreserveNode(p: *Parse, node_index: usize) void { | ... | @@ -105,14 +105,14 @@ fn unreserveNode(p: *Parse, node_index: usize) void { |
| 105 | fn addExtra(p: *Parse, extra: anytype) Allocator.Error!ExtraIndex { | 105 | fn addExtra(p: *Parse, extra: anytype) Allocator.Error!ExtraIndex { |
| 106 | const info = @typeInfo(@TypeOf(extra)).@"struct"; | 106 | const info = @typeInfo(@TypeOf(extra)).@"struct"; |
| 107 | try p.extra_data.ensureUnusedCapacity(p.gpa, info.field_names.len); | 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 | inline for (info.field_names, info.field_types) |field_name, field_type| { | 109 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 110 | const data: u32 = switch (field_type) { | 110 | const data: u32 = switch (field_type) { |
| 111 | Node.Index, | 111 | Node.Index, |
| 112 | Node.OptionalIndex, | 112 | Node.OptionalIndex, |
| 113 | OptionalTokenIndex, | 113 | OptionalTokenIndex, |
| 114 | ExtraIndex, | 114 | ExtraIndex, |
| 115 | => @intFromEnum(@field(extra, field_name)), | 115 | => @backingInt(@field(extra, field_name)), |
| 116 | TokenIndex, | 116 | TokenIndex, |
| 117 | => @field(extra, field_name), | 117 | => @field(extra, field_name), |
| 118 | else => @compileError("unexpected field type"), | 118 | else => @compileError("unexpected field type"), |
| ... | @@ -796,9 +796,9 @@ fn parseFnProto(p: *Parse) !?Node.Index { | ... | @@ -796,9 +796,9 @@ fn parseFnProto(p: *Parse) !?Node.Index { |
| 796 | 796 | ||
| 797 | fn setVarDeclInitExpr(p: *Parse, var_decl: Node.Index, init_expr: Node.OptionalIndex) void { | 797 | fn setVarDeclInitExpr(p: *Parse, var_decl: Node.Index, init_expr: Node.OptionalIndex) void { |
| 798 | const init_expr_result = switch (p.nodeTag(var_decl)) { | 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], | 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)[@intFromEnum(var_decl)].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)[@intFromEnum(var_decl)].extra_and_opt_node[1], | 801 | .local_var_decl, .global_var_decl => &p.nodes.items(.data)[@backingInt(var_decl)].extra_and_opt_node[1], |
| 802 | else => unreachable, | 802 | else => unreachable, |
| 803 | }; | 803 | }; |
| 804 | init_expr_result.* = init_expr; | 804 | init_expr_result.* = init_expr; |
| ... | @@ -1114,7 +1114,7 @@ fn expectVarAssignStatement(p: *Parse, comptime_token: ?TokenIndex) !Node.Index | ... | @@ -1114,7 +1114,7 @@ fn expectVarAssignStatement(p: *Parse, comptime_token: ?TokenIndex) !Node.Index |
| 1114 | 1114 | ||
| 1115 | // An actual destructure! No need for any `comptime` wrapper here. | 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 | try p.extra_data.ensureUnusedCapacity(p.gpa, lhs_count + 1); | 1118 | try p.extra_data.ensureUnusedCapacity(p.gpa, lhs_count + 1); |
| 1119 | p.extra_data.appendAssumeCapacity(@intCast(lhs_count)); | 1119 | p.extra_data.appendAssumeCapacity(@intCast(lhs_count)); |
| 1120 | p.extra_data.appendSliceAssumeCapacity(@ptrCast(p.scratch.items[scratch_top..])); | 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,7 +1488,7 @@ fn finishAssignDestructureExpr(p: *Parse, first_lhs: Node.Index) !Node.Index { |
| 1488 | const lhs_count = p.scratch.items.len - scratch_top; | 1488 | const lhs_count = p.scratch.items.len - scratch_top; |
| 1489 | assert(lhs_count > 1); // we already had first_lhs, and must have at least one more lvalue | 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 | try p.extra_data.ensureUnusedCapacity(p.gpa, lhs_count + 1); | 1492 | try p.extra_data.ensureUnusedCapacity(p.gpa, lhs_count + 1); |
| 1493 | p.extra_data.appendAssumeCapacity(@intCast(lhs_count)); | 1493 | p.extra_data.appendAssumeCapacity(@intCast(lhs_count)); |
| 1494 | p.extra_data.appendSliceAssumeCapacity(@ptrCast(p.scratch.items[scratch_top..])); | 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,7 +1579,7 @@ fn parseExprPrecedence(p: *Parse, min_prec: i32) Error!?Node.Index { |
| 1579 | 1579 | ||
| 1580 | while (true) { | 1580 | while (true) { |
| 1581 | const tok_tag = p.tokenTag(p.tok_i); | 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 | if (info.prec < min_prec) { | 1583 | if (info.prec < min_prec) { |
| 1584 | break; | 1584 | break; |
| 1585 | } | 1585 | } |
lib/std/zig/TokenSmith.zig+2-2| ... | @@ -248,8 +248,8 @@ pub fn list(t: *TokenSmith) TokenList.Slice { | ... | @@ -248,8 +248,8 @@ pub fn list(t: *TokenSmith) TokenList.Slice { |
| 248 | .capacity = t.tags_len, | 248 | .capacity = t.tags_len, |
| 249 | }; | 249 | }; |
| 250 | comptime std.debug.assert(slice.ptrs.len == 2); | 250 | comptime std.debug.assert(slice.ptrs.len == 2); |
| 251 | slice.ptrs[@intFromEnum(TokenList.Field.tag)] = @ptrCast(&t.tag_buf); | 251 | slice.ptrs[@backingInt(TokenList.Field.tag)] = @ptrCast(&t.tag_buf); |
| 252 | slice.ptrs[@intFromEnum(TokenList.Field.start)] = @ptrCast(&t.start_buf); | 252 | slice.ptrs[@backingInt(TokenList.Field.start)] = @ptrCast(&t.start_buf); |
| 253 | return slice; | 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,13 +84,13 @@ pub fn extraData(code: Zir, comptime T: type, index: usize) ExtraData(T) { |
| 84 | Ast.OptionalTokenIndex, | 84 | Ast.OptionalTokenIndex, |
| 85 | Ast.Node.Index, | 85 | Ast.Node.Index, |
| 86 | Ast.Node.OptionalIndex, | 86 | Ast.Node.OptionalIndex, |
| 87 | => @enumFromInt(code.extra[i]), | 87 | => @fromBackingInt(@intCast(code.extra[i])), |
| 88 | 88 | ||
| 89 | Ast.TokenOffset, | 89 | Ast.TokenOffset, |
| 90 | Ast.OptionalTokenOffset, | 90 | Ast.OptionalTokenOffset, |
| 91 | Ast.Node.Offset, | 91 | Ast.Node.Offset, |
| 92 | Ast.Node.OptionalOffset, | 92 | Ast.Node.OptionalOffset, |
| 93 | => @enumFromInt(@as(i32, @bitCast(code.extra[i]))), | 93 | => @fromBackingInt(@intCast(@as(i32, @bitCast(code.extra[i])))), |
| 94 | 94 | ||
| 95 | Inst.Call.Flags, | 95 | Inst.Call.Flags, |
| 96 | Inst.BuiltinCall.Flags, | 96 | Inst.BuiltinCall.Flags, |
| ... | @@ -118,7 +118,7 @@ pub const NullTerminatedString = enum(u32) { | ... | @@ -118,7 +118,7 @@ pub const NullTerminatedString = enum(u32) { |
| 118 | 118 | ||
| 119 | /// Given an index into `string_bytes` returns the null-terminated string found there. | 119 | /// Given an index into `string_bytes` returns the null-terminated string found there. |
| 120 | pub fn nullTerminatedString(code: Zir, index: NullTerminatedString) [:0]const u8 { | 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 | return slice[0..std.mem.findScalar(u8, slice, 0).? :0]; | 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,7 +131,7 @@ pub fn bodySlice(zir: Zir, start: usize, len: usize) []Inst.Index { |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | pub fn hasCompileErrors(code: Zir) bool { | 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 | return true; | 135 | return true; |
| 136 | } else { | 136 | } else { |
| 137 | assert(code.instructions.len != 0); // i.e. lowering did not fail | 137 | assert(code.instructions.len != 0); // i.e. lowering did not fail |
| ... | @@ -2202,11 +2202,11 @@ pub const Inst = struct { | ... | @@ -2202,11 +2202,11 @@ pub const Inst = struct { |
| 2202 | _, | 2202 | _, |
| 2203 | 2203 | ||
| 2204 | pub fn toRef(i: Index) Inst.Ref { | 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 | pub fn toOptional(i: Index) OptionalIndex { | 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,7 +2218,7 @@ pub const Inst = struct { |
| 2218 | _, | 2218 | _, |
| 2219 | 2219 | ||
| 2220 | pub fn unwrap(oi: OptionalIndex) ?Index { | 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,9 +2370,9 @@ pub const Inst = struct { |
| 2370 | 2370 | ||
| 2371 | pub fn toIndex(inst: Ref) ?Index { | 2371 | pub fn toIndex(inst: Ref) ?Index { |
| 2372 | assert(inst != .none); | 2372 | assert(inst != .none); |
| 2373 | const ref_int = @intFromEnum(inst); | 2373 | const ref_int = @backingInt(inst); |
| 2374 | if (ref_int >= static_len) { | 2374 | if (ref_int >= static_len) { |
| 2375 | return @enumFromInt(ref_int - static_len); | 2375 | return @fromBackingInt(@intCast(ref_int - static_len)); |
| 2376 | } else { | 2376 | } else { |
| 2377 | return null; | 2377 | return null; |
| 2378 | } | 2378 | } |
| ... | @@ -2429,7 +2429,7 @@ pub const Inst = struct { | ... | @@ -2429,7 +2429,7 @@ pub const Inst = struct { |
| 2429 | len: u32, | 2429 | len: u32, |
| 2430 | 2430 | ||
| 2431 | pub fn get(self: @This(), code: Zir) []const u8 { | 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 | str_tok: struct { | 2435 | str_tok: struct { |
| ... | @@ -3009,7 +3009,7 @@ pub const Inst = struct { | ... | @@ -3009,7 +3009,7 @@ pub const Inst = struct { |
| 3009 | pub fn isNamedTest(name: Name, zir: Zir) bool { | 3009 | pub fn isNamedTest(name: Name, zir: Zir) bool { |
| 3010 | return switch (name) { | 3010 | return switch (name) { |
| 3011 | .@"comptime", .unnamed_test => false, | 3011 | .@"comptime", .unnamed_test => false, |
| 3012 | _ => zir.string_bytes[@intFromEnum(name)] == 0, | 3012 | _ => zir.string_bytes[@backingInt(name)] == 0, |
| 3013 | }; | 3013 | }; |
| 3014 | } | 3014 | } |
| 3015 | pub fn toString(name: Name, zir: Zir) ?NullTerminatedString { | 3015 | pub fn toString(name: Name, zir: Zir) ?NullTerminatedString { |
| ... | @@ -3017,12 +3017,12 @@ pub const Inst = struct { | ... | @@ -3017,12 +3017,12 @@ pub const Inst = struct { |
| 3017 | .@"comptime", .unnamed_test => return null, | 3017 | .@"comptime", .unnamed_test => return null, |
| 3018 | _ => {}, | 3018 | _ => {}, |
| 3019 | } | 3019 | } |
| 3020 | const idx: u32 = @intFromEnum(name); | 3020 | const idx: u32 = @backingInt(name); |
| 3021 | if (zir.string_bytes[idx] == 0) { | 3021 | if (zir.string_bytes[idx] == 0) { |
| 3022 | // Named test | 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,8 +3441,8 @@ pub const Inst = struct { |
| 3441 | 3441 | ||
| 3442 | pub fn wrap(unwrapped: ItemInfo.Unwrapped) ItemInfo { | 3442 | pub fn wrap(unwrapped: ItemInfo.Unwrapped) ItemInfo { |
| 3443 | const data_uncasted: u32 = switch (unwrapped) { | 3443 | const data_uncasted: u32 = switch (unwrapped) { |
| 3444 | .enum_literal => |str_index| @intFromEnum(str_index), | 3444 | .enum_literal => |str_index| @backingInt(str_index), |
| 3445 | .error_value => |str_index| @intFromEnum(str_index), | 3445 | .error_value => |str_index| @backingInt(str_index), |
| 3446 | .body_len => |body_len| body_len, | 3446 | .body_len => |body_len| body_len, |
| 3447 | .under => 0, | 3447 | .under => 0, |
| 3448 | }; | 3448 | }; |
| ... | @@ -3451,8 +3451,8 @@ pub const Inst = struct { | ... | @@ -3451,8 +3451,8 @@ pub const Inst = struct { |
| 3451 | 3451 | ||
| 3452 | pub fn unwrap(item_info: ItemInfo) ItemInfo.Unwrapped { | 3452 | pub fn unwrap(item_info: ItemInfo) ItemInfo.Unwrapped { |
| 3453 | return switch (item_info.kind) { | 3453 | return switch (item_info.kind) { |
| 3454 | .enum_literal => .{ .enum_literal = @enumFromInt(item_info.data) }, | 3454 | .enum_literal => .{ .enum_literal = @fromBackingInt(@intCast(item_info.data)) }, |
| 3455 | .error_value => .{ .error_value = @enumFromInt(item_info.data) }, | 3455 | .error_value => .{ .error_value = @fromBackingInt(@intCast(item_info.data)) }, |
| 3456 | .body_len => .{ .body_len = item_info.data }, | 3456 | .body_len => .{ .body_len = item_info.data }, |
| 3457 | .under => .under, | 3457 | .under => .under, |
| 3458 | }; | 3458 | }; |
| ... | @@ -3557,29 +3557,29 @@ pub const Inst = struct { | ... | @@ -3557,29 +3557,29 @@ pub const Inst = struct { |
| 3557 | }, | 3557 | }, |
| 3558 | .instruction => |inst| .{ | 3558 | .instruction => |inst| .{ |
| 3559 | .tag = .instruction, | 3559 | .tag = .instruction, |
| 3560 | .data = @intCast(@intFromEnum(inst)), | 3560 | .data = @intCast(@backingInt(inst)), |
| 3561 | }, | 3561 | }, |
| 3562 | .instruction_load => |inst| .{ | 3562 | .instruction_load => |inst| .{ |
| 3563 | .tag = .instruction_load, | 3563 | .tag = .instruction_load, |
| 3564 | .data = @intCast(@intFromEnum(inst)), | 3564 | .data = @intCast(@backingInt(inst)), |
| 3565 | }, | 3565 | }, |
| 3566 | .decl_val => |str| .{ | 3566 | .decl_val => |str| .{ |
| 3567 | .tag = .decl_val, | 3567 | .tag = .decl_val, |
| 3568 | .data = @intCast(@intFromEnum(str)), | 3568 | .data = @intCast(@backingInt(str)), |
| 3569 | }, | 3569 | }, |
| 3570 | .decl_ref => |str| .{ | 3570 | .decl_ref => |str| .{ |
| 3571 | .tag = .decl_ref, | 3571 | .tag = .decl_ref, |
| 3572 | .data = @intCast(@intFromEnum(str)), | 3572 | .data = @intCast(@backingInt(str)), |
| 3573 | }, | 3573 | }, |
| 3574 | }; | 3574 | }; |
| 3575 | } | 3575 | } |
| 3576 | pub fn unwrap(cap: Capture) Unwrapped { | 3576 | pub fn unwrap(cap: Capture) Unwrapped { |
| 3577 | return switch (cap.tag) { | 3577 | return switch (cap.tag) { |
| 3578 | .nested => .{ .nested = @intCast(cap.data) }, | 3578 | .nested => .{ .nested = @intCast(cap.data) }, |
| 3579 | .instruction => .{ .instruction = @enumFromInt(cap.data) }, | 3579 | .instruction => .{ .instruction = @fromBackingInt(@intCast(cap.data)) }, |
| 3580 | .instruction_load => .{ .instruction_load = @enumFromInt(cap.data) }, | 3580 | .instruction_load => .{ .instruction_load = @fromBackingInt(@intCast(cap.data)) }, |
| 3581 | .decl_val => .{ .decl_val = @enumFromInt(cap.data) }, | 3581 | .decl_val => .{ .decl_val = @fromBackingInt(@intCast(cap.data)) }, |
| 3582 | .decl_ref => .{ .decl_ref = @enumFromInt(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,8 +4084,8 @@ pub fn findTrackableFields( |
| 4084 | var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty; | 4084 | var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty; |
| 4085 | defer found_defers.deinit(gpa); | 4085 | defer found_defers.deinit(gpa); |
| 4086 | 4086 | ||
| 4087 | assert(zir.instructions.items(.tag)[@intFromEnum(type_decl_inst)] == .extended); | 4087 | assert(zir.instructions.items(.tag)[@backingInt(type_decl_inst)] == .extended); |
| 4088 | switch (zir.instructions.items(.data)[@intFromEnum(type_decl_inst)].extended.opcode) { | 4088 | switch (zir.instructions.items(.data)[@backingInt(type_decl_inst)].extended.opcode) { |
| 4089 | .struct_decl => { | 4089 | .struct_decl => { |
| 4090 | const struct_decl = zir.getStructDecl(type_decl_inst); | 4090 | const struct_decl = zir.getStructDecl(type_decl_inst); |
| 4091 | var it = struct_decl.iterateFields(); | 4091 | var it = struct_decl.iterateFields(); |
| ... | @@ -4128,7 +4128,7 @@ fn findTrackableInner( | ... | @@ -4128,7 +4128,7 @@ fn findTrackableInner( |
| 4128 | const tags = zir.instructions.items(.tag); | 4128 | const tags = zir.instructions.items(.tag); |
| 4129 | const datas = zir.instructions.items(.data); | 4129 | const datas = zir.instructions.items(.data); |
| 4130 | 4130 | ||
| 4131 | switch (tags[@intFromEnum(inst)]) { | 4131 | switch (tags[@backingInt(inst)]) { |
| 4132 | .declaration => unreachable, | 4132 | .declaration => unreachable, |
| 4133 | 4133 | ||
| 4134 | // Boring instruction tags first. These have no body and are not declarations or type declarations. | 4134 | // Boring instruction tags first. These have no body and are not declarations or type declarations. |
| ... | @@ -4369,7 +4369,7 @@ fn findTrackableInner( | ... | @@ -4369,7 +4369,7 @@ fn findTrackableInner( |
| 4369 | => return contents.other.append(gpa, inst), | 4369 | => return contents.other.append(gpa, inst), |
| 4370 | 4370 | ||
| 4371 | .extended => { | 4371 | .extended => { |
| 4372 | const extended = datas[@intFromEnum(inst)].extended; | 4372 | const extended = datas[@backingInt(inst)].extended; |
| 4373 | switch (extended.opcode) { | 4373 | switch (extended.opcode) { |
| 4374 | .value_placeholder => unreachable, | 4374 | .value_placeholder => unreachable, |
| 4375 | 4375 | ||
| ... | @@ -4460,7 +4460,7 @@ fn findTrackableInner( | ... | @@ -4460,7 +4460,7 @@ fn findTrackableInner( |
| 4460 | .func, | 4460 | .func, |
| 4461 | .func_inferred, | 4461 | .func_inferred, |
| 4462 | => { | 4462 | => { |
| 4463 | const inst_data = datas[@intFromEnum(inst)].pl_node; | 4463 | const inst_data = datas[@backingInt(inst)].pl_node; |
| 4464 | const extra = zir.extraData(Inst.Func, inst_data.payload_index); | 4464 | const extra = zir.extraData(Inst.Func, inst_data.payload_index); |
| 4465 | 4465 | ||
| 4466 | if (extra.data.body_len == 0) { | 4466 | if (extra.data.body_len == 0) { |
| ... | @@ -4486,7 +4486,7 @@ fn findTrackableInner( | ... | @@ -4486,7 +4486,7 @@ fn findTrackableInner( |
| 4486 | return zir.findTrackableBody(gpa, contents, defers, body); | 4486 | return zir.findTrackableBody(gpa, contents, defers, body); |
| 4487 | }, | 4487 | }, |
| 4488 | .func_fancy => { | 4488 | .func_fancy => { |
| 4489 | const inst_data = datas[@intFromEnum(inst)].pl_node; | 4489 | const inst_data = datas[@backingInt(inst)].pl_node; |
| 4490 | const extra = zir.extraData(Inst.FuncFancy, inst_data.payload_index); | 4490 | const extra = zir.extraData(Inst.FuncFancy, inst_data.payload_index); |
| 4491 | 4491 | ||
| 4492 | if (extra.data.body_len == 0) { | 4492 | if (extra.data.body_len == 0) { |
| ... | @@ -4534,19 +4534,19 @@ fn findTrackableInner( | ... | @@ -4534,19 +4534,19 @@ fn findTrackableInner( |
| 4534 | .typeof_builtin, | 4534 | .typeof_builtin, |
| 4535 | .loop, | 4535 | .loop, |
| 4536 | => { | 4536 | => { |
| 4537 | const inst_data = datas[@intFromEnum(inst)].pl_node; | 4537 | const inst_data = datas[@backingInt(inst)].pl_node; |
| 4538 | const extra = zir.extraData(Inst.Block, inst_data.payload_index); | 4538 | const extra = zir.extraData(Inst.Block, inst_data.payload_index); |
| 4539 | const body = zir.bodySlice(extra.end, extra.data.body_len); | 4539 | const body = zir.bodySlice(extra.end, extra.data.body_len); |
| 4540 | return zir.findTrackableBody(gpa, contents, defers, body); | 4540 | return zir.findTrackableBody(gpa, contents, defers, body); |
| 4541 | }, | 4541 | }, |
| 4542 | .block_comptime => { | 4542 | .block_comptime => { |
| 4543 | const inst_data = datas[@intFromEnum(inst)].pl_node; | 4543 | const inst_data = datas[@backingInt(inst)].pl_node; |
| 4544 | const extra = zir.extraData(Inst.BlockComptime, inst_data.payload_index); | 4544 | const extra = zir.extraData(Inst.BlockComptime, inst_data.payload_index); |
| 4545 | const body = zir.bodySlice(extra.end, extra.data.body_len); | 4545 | const body = zir.bodySlice(extra.end, extra.data.body_len); |
| 4546 | return zir.findTrackableBody(gpa, contents, defers, body); | 4546 | return zir.findTrackableBody(gpa, contents, defers, body); |
| 4547 | }, | 4547 | }, |
| 4548 | .condbr, .condbr_inline => { | 4548 | .condbr, .condbr_inline => { |
| 4549 | const inst_data = datas[@intFromEnum(inst)].pl_node; | 4549 | const inst_data = datas[@backingInt(inst)].pl_node; |
| 4550 | const extra = zir.extraData(Inst.CondBr, inst_data.payload_index); | 4550 | const extra = zir.extraData(Inst.CondBr, inst_data.payload_index); |
| 4551 | const then_body = zir.bodySlice(extra.end, extra.data.then_body_len); | 4551 | const then_body = zir.bodySlice(extra.end, extra.data.then_body_len); |
| 4552 | const else_body = zir.bodySlice(extra.end + then_body.len, extra.data.else_body_len); | 4552 | const else_body = zir.bodySlice(extra.end + then_body.len, extra.data.else_body_len); |
| ... | @@ -4554,7 +4554,7 @@ fn findTrackableInner( | ... | @@ -4554,7 +4554,7 @@ fn findTrackableInner( |
| 4554 | try zir.findTrackableBody(gpa, contents, defers, else_body); | 4554 | try zir.findTrackableBody(gpa, contents, defers, else_body); |
| 4555 | }, | 4555 | }, |
| 4556 | .@"try", .try_ptr => { | 4556 | .@"try", .try_ptr => { |
| 4557 | const inst_data = datas[@intFromEnum(inst)].pl_node; | 4557 | const inst_data = datas[@backingInt(inst)].pl_node; |
| 4558 | const extra = zir.extraData(Inst.Try, inst_data.payload_index); | 4558 | const extra = zir.extraData(Inst.Try, inst_data.payload_index); |
| 4559 | const body = zir.bodySlice(extra.end, extra.data.body_len); | 4559 | const body = zir.bodySlice(extra.end, extra.data.body_len); |
| 4560 | try zir.findTrackableBody(gpa, contents, defers, body); | 4560 | try zir.findTrackableBody(gpa, contents, defers, body); |
| ... | @@ -4602,14 +4602,14 @@ fn findTrackableInner( | ... | @@ -4602,14 +4602,14 @@ fn findTrackableInner( |
| 4602 | .suspend_block => @panic("TODO iterate suspend block"), | 4602 | .suspend_block => @panic("TODO iterate suspend block"), |
| 4603 | 4603 | ||
| 4604 | .param, .param_comptime => { | 4604 | .param, .param_comptime => { |
| 4605 | const inst_data = datas[@intFromEnum(inst)].pl_tok; | 4605 | const inst_data = datas[@backingInt(inst)].pl_tok; |
| 4606 | const extra = zir.extraData(Inst.Param, inst_data.payload_index); | 4606 | const extra = zir.extraData(Inst.Param, inst_data.payload_index); |
| 4607 | const body = zir.bodySlice(extra.end, extra.data.type.body_len); | 4607 | const body = zir.bodySlice(extra.end, extra.data.type.body_len); |
| 4608 | try zir.findTrackableBody(gpa, contents, defers, body); | 4608 | try zir.findTrackableBody(gpa, contents, defers, body); |
| 4609 | }, | 4609 | }, |
| 4610 | 4610 | ||
| 4611 | inline .call, .field_call => |tag| { | 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 | const extra = zir.extraData(switch (tag) { | 4613 | const extra = zir.extraData(switch (tag) { |
| 4614 | .call => Inst.Call, | 4614 | .call => Inst.Call, |
| 4615 | .field_call => Inst.FieldCall, | 4615 | .field_call => Inst.FieldCall, |
| ... | @@ -4625,7 +4625,7 @@ fn findTrackableInner( | ... | @@ -4625,7 +4625,7 @@ fn findTrackableInner( |
| 4625 | } | 4625 | } |
| 4626 | }, | 4626 | }, |
| 4627 | .@"defer" => { | 4627 | .@"defer" => { |
| 4628 | const inst_data = datas[@intFromEnum(inst)].@"defer"; | 4628 | const inst_data = datas[@backingInt(inst)].@"defer"; |
| 4629 | const gop = try defers.getOrPut(gpa, inst_data.index); | 4629 | const gop = try defers.getOrPut(gpa, inst_data.index); |
| 4630 | if (!gop.found_existing) { | 4630 | if (!gop.found_existing) { |
| 4631 | const body = zir.bodySlice(inst_data.index, inst_data.len); | 4631 | const body = zir.bodySlice(inst_data.index, inst_data.len); |
| ... | @@ -4661,9 +4661,9 @@ pub const FnInfo = struct { | ... | @@ -4661,9 +4661,9 @@ pub const FnInfo = struct { |
| 4661 | pub fn getParamBody(zir: Zir, fn_inst: Inst.Index) []const Zir.Inst.Index { | 4661 | pub fn getParamBody(zir: Zir, fn_inst: Inst.Index) []const Zir.Inst.Index { |
| 4662 | const tags = zir.instructions.items(.tag); | 4662 | const tags = zir.instructions.items(.tag); |
| 4663 | const datas = zir.instructions.items(.data); | 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 | .func, .func_inferred => blk: { | 4667 | .func, .func_inferred => blk: { |
| 4668 | const extra = zir.extraData(Inst.Func, inst_data.payload_index); | 4668 | const extra = zir.extraData(Inst.Func, inst_data.payload_index); |
| 4669 | break :blk extra.data.param_block; | 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,9 +4675,9 @@ pub fn getParamBody(zir: Zir, fn_inst: Inst.Index) []const Zir.Inst.Index { |
| 4675 | else => unreachable, | 4675 | else => unreachable, |
| 4676 | }; | 4676 | }; |
| 4677 | 4677 | ||
| 4678 | switch (tags[@intFromEnum(param_block_index)]) { | 4678 | switch (tags[@backingInt(param_block_index)]) { |
| 4679 | .block, .block_comptime, .block_inline => { | 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 | return zir.bodySlice(param_block.end, param_block.data.body_len); | 4681 | return zir.bodySlice(param_block.end, param_block.data.body_len); |
| 4682 | }, | 4682 | }, |
| 4683 | .declaration => { | 4683 | .declaration => { |
| ... | @@ -4688,7 +4688,7 @@ pub fn getParamBody(zir: Zir, fn_inst: Inst.Index) []const Zir.Inst.Index { | ... | @@ -4688,7 +4688,7 @@ pub fn getParamBody(zir: Zir, fn_inst: Inst.Index) []const Zir.Inst.Index { |
| 4688 | } | 4688 | } |
| 4689 | 4689 | ||
| 4690 | pub fn getParamName(zir: Zir, param_inst: Inst.Index) ?NullTerminatedString { | 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 | return switch (inst.tag) { | 4692 | return switch (inst.tag) { |
| 4693 | .param, .param_comptime => zir.extraData(Inst.Param, inst.data.pl_tok.payload_index).data.name, | 4693 | .param, .param_comptime => zir.extraData(Inst.Param, inst.data.pl_tok.payload_index).data.name, |
| 4694 | .param_anytype, .param_anytype_comptime => inst.data.str_tok.start, | 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,9 +4706,9 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4706 | ret_ty_body: []const Inst.Index, | 4706 | ret_ty_body: []const Inst.Index, |
| 4707 | ret_ty_is_generic: bool, | 4707 | ret_ty_is_generic: bool, |
| 4708 | ies: bool, | 4708 | ies: bool, |
| 4709 | } = switch (tags[@intFromEnum(fn_inst)]) { | 4709 | } = switch (tags[@backingInt(fn_inst)]) { |
| 4710 | .func, .func_inferred => |tag| blk: { | 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 | const extra = zir.extraData(Inst.Func, inst_data.payload_index); | 4712 | const extra = zir.extraData(Inst.Func, inst_data.payload_index); |
| 4713 | 4713 | ||
| 4714 | var extra_index: usize = extra.end; | 4714 | var extra_index: usize = extra.end; |
| ... | @@ -4720,7 +4720,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { | ... | @@ -4720,7 +4720,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4720 | ret_ty_ref = .void_type; | 4720 | ret_ty_ref = .void_type; |
| 4721 | }, | 4721 | }, |
| 4722 | 1 => { | 4722 | 1 => { |
| 4723 | ret_ty_ref = @enumFromInt(zir.extra[extra_index]); | 4723 | ret_ty_ref = @fromBackingInt(@intCast(zir.extra[extra_index])); |
| 4724 | extra_index += 1; | 4724 | extra_index += 1; |
| 4725 | }, | 4725 | }, |
| 4726 | else => { | 4726 | else => { |
| ... | @@ -4742,7 +4742,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { | ... | @@ -4742,7 +4742,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4742 | }; | 4742 | }; |
| 4743 | }, | 4743 | }, |
| 4744 | .func_fancy => blk: { | 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 | const extra = zir.extraData(Inst.FuncFancy, inst_data.payload_index); | 4746 | const extra = zir.extraData(Inst.FuncFancy, inst_data.payload_index); |
| 4747 | 4747 | ||
| 4748 | var extra_index: usize = extra.end; | 4748 | var extra_index: usize = extra.end; |
| ... | @@ -4760,7 +4760,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { | ... | @@ -4760,7 +4760,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4760 | ret_ty_body = zir.bodySlice(extra_index, body_len); | 4760 | ret_ty_body = zir.bodySlice(extra_index, body_len); |
| 4761 | extra_index += ret_ty_body.len; | 4761 | extra_index += ret_ty_body.len; |
| 4762 | } else if (extra.data.bits.has_ret_ty_ref) { | 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 | extra_index += 1; | 4764 | extra_index += 1; |
| 4765 | } else { | 4765 | } else { |
| 4766 | ret_ty_ref = .void_type; | 4766 | ret_ty_ref = .void_type; |
| ... | @@ -4784,7 +4784,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { | ... | @@ -4784,7 +4784,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4784 | const param_body = zir.getParamBody(fn_inst); | 4784 | const param_body = zir.getParamBody(fn_inst); |
| 4785 | var total_params_len: u32 = 0; | 4785 | var total_params_len: u32 = 0; |
| 4786 | for (param_body) |inst| { | 4786 | for (param_body) |inst| { |
| 4787 | switch (tags[@intFromEnum(inst)]) { | 4787 | switch (tags[@backingInt(inst)]) { |
| 4788 | .param, .param_comptime, .param_anytype, .param_anytype_comptime => { | 4788 | .param, .param_comptime, .param_anytype, .param_anytype_comptime => { |
| 4789 | total_params_len += 1; | 4789 | total_params_len += 1; |
| 4790 | }, | 4790 | }, |
| ... | @@ -4804,8 +4804,8 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { | ... | @@ -4804,8 +4804,8 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 4804 | } | 4804 | } |
| 4805 | 4805 | ||
| 4806 | pub fn getDeclaration(zir: Zir, inst: Zir.Inst.Index) Inst.Declaration.Unwrapped { | 4806 | pub fn getDeclaration(zir: Zir, inst: Zir.Inst.Index) Inst.Declaration.Unwrapped { |
| 4807 | assert(zir.instructions.items(.tag)[@intFromEnum(inst)] == .declaration); | 4807 | assert(zir.instructions.items(.tag)[@backingInt(inst)] == .declaration); |
| 4808 | const pl_node = zir.instructions.items(.data)[@intFromEnum(inst)].declaration; | 4808 | const pl_node = zir.instructions.items(.data)[@backingInt(inst)].declaration; |
| 4809 | const extra = zir.extraData(Inst.Declaration, pl_node.payload_index); | 4809 | const extra = zir.extraData(Inst.Declaration, pl_node.payload_index); |
| 4810 | 4810 | ||
| 4811 | const flags_vals: [2]u32 = .{ extra.data.flags_0, extra.data.flags_1 }; | 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,13 +4816,13 @@ pub fn getDeclaration(zir: Zir, inst: Zir.Inst.Index) Inst.Declaration.Unwrapped |
| 4816 | const name: NullTerminatedString = if (flags.id.hasName()) name: { | 4816 | const name: NullTerminatedString = if (flags.id.hasName()) name: { |
| 4817 | const name = zir.extra[extra_index]; | 4817 | const name = zir.extra[extra_index]; |
| 4818 | extra_index += 1; | 4818 | extra_index += 1; |
| 4819 | break :name @enumFromInt(name); | 4819 | break :name @fromBackingInt(@intCast(name)); |
| 4820 | } else .empty; | 4820 | } else .empty; |
| 4821 | 4821 | ||
| 4822 | const lib_name: NullTerminatedString = if (flags.id.hasLibName()) lib_name: { | 4822 | const lib_name: NullTerminatedString = if (flags.id.hasLibName()) lib_name: { |
| 4823 | const lib_name = zir.extra[extra_index]; | 4823 | const lib_name = zir.extra[extra_index]; |
| 4824 | extra_index += 1; | 4824 | extra_index += 1; |
| 4825 | break :lib_name @enumFromInt(lib_name); | 4825 | break :lib_name @fromBackingInt(@intCast(lib_name)); |
| 4826 | } else .empty; | 4826 | } else .empty; |
| 4827 | 4827 | ||
| 4828 | const type_body_len: u32 = if (flags.id.hasTypeBody()) len: { | 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,9 +4877,9 @@ pub fn getDeclaration(zir: Zir, inst: Zir.Inst.Index) Inst.Declaration.Unwrapped |
| 4877 | pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { | 4877 | pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { |
| 4878 | const tag = zir.instructions.items(.tag); | 4878 | const tag = zir.instructions.items(.tag); |
| 4879 | const data = zir.instructions.items(.data); | 4879 | const data = zir.instructions.items(.data); |
| 4880 | switch (tag[@intFromEnum(inst)]) { | 4880 | switch (tag[@backingInt(inst)]) { |
| 4881 | .declaration => { | 4881 | .declaration => { |
| 4882 | const declaration = data[@intFromEnum(inst)].declaration; | 4882 | const declaration = data[@backingInt(inst)].declaration; |
| 4883 | const extra = zir.extraData(Inst.Declaration, declaration.payload_index); | 4883 | const extra = zir.extraData(Inst.Declaration, declaration.payload_index); |
| 4884 | return @bitCast([4]u32{ | 4884 | return @bitCast([4]u32{ |
| 4885 | extra.data.src_hash_0, | 4885 | extra.data.src_hash_0, |
| ... | @@ -4889,7 +4889,7 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { | ... | @@ -4889,7 +4889,7 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { |
| 4889 | }); | 4889 | }); |
| 4890 | }, | 4890 | }, |
| 4891 | .func, .func_inferred => { | 4891 | .func, .func_inferred => { |
| 4892 | const pl_node = data[@intFromEnum(inst)].pl_node; | 4892 | const pl_node = data[@backingInt(inst)].pl_node; |
| 4893 | const extra = zir.extraData(Inst.Func, pl_node.payload_index); | 4893 | const extra = zir.extraData(Inst.Func, pl_node.payload_index); |
| 4894 | if (extra.data.body_len == 0) { | 4894 | if (extra.data.body_len == 0) { |
| 4895 | // Function type or extern fn - no associated hash | 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,7 +4907,7 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { |
| 4907 | }); | 4907 | }); |
| 4908 | }, | 4908 | }, |
| 4909 | .func_fancy => { | 4909 | .func_fancy => { |
| 4910 | const pl_node = data[@intFromEnum(inst)].pl_node; | 4910 | const pl_node = data[@backingInt(inst)].pl_node; |
| 4911 | const extra = zir.extraData(Inst.FuncFancy, pl_node.payload_index); | 4911 | const extra = zir.extraData(Inst.FuncFancy, pl_node.payload_index); |
| 4912 | if (extra.data.body_len == 0) { | 4912 | if (extra.data.body_len == 0) { |
| 4913 | // Function type or extern fn - no associated hash | 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,7 +4936,7 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { |
| 4936 | .extended => {}, | 4936 | .extended => {}, |
| 4937 | else => return null, | 4937 | else => return null, |
| 4938 | } | 4938 | } |
| 4939 | const extended = data[@intFromEnum(inst)].extended; | 4939 | const extended = data[@backingInt(inst)].extended; |
| 4940 | switch (extended.opcode) { | 4940 | switch (extended.opcode) { |
| 4941 | .struct_decl => { | 4941 | .struct_decl => { |
| 4942 | const extra = zir.extraData(Inst.StructDecl, extended.operand).data; | 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,12 +4970,12 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash { |
| 4970 | } | 4970 | } |
| 4971 | 4971 | ||
| 4972 | pub fn getSwitchBlock(zir: *const Zir, switch_inst: Inst.Index) UnwrappedSwitchBlock { | 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 | .switch_block, .switch_block_ref => false, | 4974 | .switch_block, .switch_block_ref => false, |
| 4975 | .switch_block_err_union => true, | 4975 | .switch_block_err_union => true, |
| 4976 | else => unreachable, | 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 | const extra = zir.extraData(Inst.SwitchBlock, inst_data.payload_index); | 4979 | const extra = zir.extraData(Inst.SwitchBlock, inst_data.payload_index); |
| 4980 | const bits = extra.data.bits; | 4980 | const bits = extra.data.bits; |
| 4981 | var extra_index = extra.end; | 4981 | var extra_index = extra.end; |
| ... | @@ -4985,17 +4985,17 @@ pub fn getSwitchBlock(zir: *const Zir, switch_inst: Inst.Index) UnwrappedSwitchB | ... | @@ -4985,17 +4985,17 @@ pub fn getSwitchBlock(zir: *const Zir, switch_inst: Inst.Index) UnwrappedSwitchB |
| 4985 | break :len multi_cases_len; | 4985 | break :len multi_cases_len; |
| 4986 | } else 0; | 4986 | } else 0; |
| 4987 | const payload_capture_placeholder: Inst.OptionalIndex = if (bits.payload_capture_inst_is_placeholder) inst: { | 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 | extra_index += 1; | 4989 | extra_index += 1; |
| 4990 | break :inst inst.toOptional(); | 4990 | break :inst inst.toOptional(); |
| 4991 | } else .none; | 4991 | } else .none; |
| 4992 | const tag_capture_placeholder: Inst.OptionalIndex = if (bits.tag_capture_inst_is_placeholder) inst: { | 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 | extra_index += 1; | 4994 | extra_index += 1; |
| 4995 | break :inst inst.toOptional(); | 4995 | break :inst inst.toOptional(); |
| 4996 | } else .none; | 4996 | } else .none; |
| 4997 | const catch_or_if_src_node_offset: Ast.Node.OptionalOffset = if (has_non_err) node_offset: { | 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 | extra_index += 1; | 4999 | extra_index += 1; |
| 5000 | break :node_offset node_offset.toOptional(); | 5000 | break :node_offset node_offset.toOptional(); |
| 5001 | } else .none; | 5001 | } else .none; |
| ... | @@ -5212,7 +5212,7 @@ pub const inst_tracking_version = 0; | ... | @@ -5212,7 +5212,7 @@ pub const inst_tracking_version = 0; |
| 5212 | /// thus may be given an `InternPool.TrackedInst`. | 5212 | /// thus may be given an `InternPool.TrackedInst`. |
| 5213 | pub fn assertTrackable(zir: Zir, inst_idx: Zir.Inst.Index) void { | 5213 | pub fn assertTrackable(zir: Zir, inst_idx: Zir.Inst.Index) void { |
| 5214 | comptime assert(Zir.inst_tracking_version == 0); | 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 | switch (inst.tag) { | 5216 | switch (inst.tag) { |
| 5217 | .struct_init, | 5217 | .struct_init, |
| 5218 | .struct_init_ref, | 5218 | .struct_init_ref, |
| ... | @@ -5246,7 +5246,7 @@ pub fn assertTrackable(zir: Zir, inst_idx: Zir.Inst.Index) void { | ... | @@ -5246,7 +5246,7 @@ pub fn assertTrackable(zir: Zir, inst_idx: Zir.Inst.Index) void { |
| 5246 | } | 5246 | } |
| 5247 | 5247 | ||
| 5248 | pub fn typeDecls(zir: Zir, type_decl: Inst.Index) []const Zir.Inst.Index { | 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 | assert(inst.tag == .extended); | 5250 | assert(inst.tag == .extended); |
| 5251 | return switch (inst.data.extended.opcode) { | 5251 | return switch (inst.data.extended.opcode) { |
| 5252 | .struct_decl => zir.getStructDecl(type_decl).decls, | 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,7 +5258,7 @@ pub fn typeDecls(zir: Zir, type_decl: Inst.Index) []const Zir.Inst.Index { |
| 5258 | } | 5258 | } |
| 5259 | 5259 | ||
| 5260 | pub fn getStructDecl(zir: *const Zir, struct_decl: Inst.Index) UnwrappedStructDecl { | 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 | assert(inst_data.tag == .extended); | 5262 | assert(inst_data.tag == .extended); |
| 5263 | assert(inst_data.data.extended.opcode == .struct_decl); | 5263 | assert(inst_data.data.extended.opcode == .struct_decl); |
| 5264 | const small: Inst.StructDecl.Small = @bitCast(inst_data.data.extended.small); | 5264 | const small: Inst.StructDecl.Small = @bitCast(inst_data.data.extended.small); |
| ... | @@ -5409,7 +5409,7 @@ pub const UnwrappedStructDecl = struct { | ... | @@ -5409,7 +5409,7 @@ pub const UnwrappedStructDecl = struct { |
| 5409 | }; | 5409 | }; |
| 5410 | 5410 | ||
| 5411 | pub fn getUnionDecl(zir: *const Zir, union_decl: Inst.Index) UnwrappedUnionDecl { | 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 | assert(inst_data.tag == .extended); | 5413 | assert(inst_data.tag == .extended); |
| 5414 | assert(inst_data.data.extended.opcode == .union_decl); | 5414 | assert(inst_data.data.extended.opcode == .union_decl); |
| 5415 | const small: Inst.UnionDecl.Small = @bitCast(inst_data.data.extended.small); | 5415 | const small: Inst.UnionDecl.Small = @bitCast(inst_data.data.extended.small); |
| ... | @@ -5543,7 +5543,7 @@ pub const UnwrappedUnionDecl = struct { | ... | @@ -5543,7 +5543,7 @@ pub const UnwrappedUnionDecl = struct { |
| 5543 | }; | 5543 | }; |
| 5544 | 5544 | ||
| 5545 | pub fn getEnumDecl(zir: *const Zir, enum_decl: Inst.Index) UnwrappedEnumDecl { | 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 | assert(inst_data.tag == .extended); | 5547 | assert(inst_data.tag == .extended); |
| 5548 | assert(inst_data.data.extended.opcode == .enum_decl); | 5548 | assert(inst_data.data.extended.opcode == .enum_decl); |
| 5549 | const small: Inst.EnumDecl.Small = @bitCast(inst_data.data.extended.small); | 5549 | const small: Inst.EnumDecl.Small = @bitCast(inst_data.data.extended.small); |
| ... | @@ -5658,7 +5658,7 @@ pub const UnwrappedEnumDecl = struct { | ... | @@ -5658,7 +5658,7 @@ pub const UnwrappedEnumDecl = struct { |
| 5658 | }; | 5658 | }; |
| 5659 | 5659 | ||
| 5660 | pub fn getOpaqueDecl(zir: *const Zir, opaque_decl: Inst.Index) UnwrappedOpaqueDecl { | 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 | assert(inst_data.tag == .extended); | 5662 | assert(inst_data.tag == .extended); |
| 5663 | assert(inst_data.data.extended.opcode == .opaque_decl); | 5663 | assert(inst_data.data.extended.opcode == .opaque_decl); |
| 5664 | const small: Inst.OpaqueDecl.Small = @bitCast(inst_data.data.extended.small); | 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,7 +106,7 @@ pub const Node = union(enum) { |
| 106 | _, | 106 | _, |
| 107 | 107 | ||
| 108 | pub fn get(idx: Index, zoir: Zoir) Node { | 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 | return switch (repr.tag) { | 110 | return switch (repr.tag) { |
| 111 | .true => .true, | 111 | .true => .true, |
| 112 | .false => .false, | 112 | .false => .false, |
| ... | @@ -129,30 +129,30 @@ pub const Node = union(enum) { | ... | @@ -129,30 +129,30 @@ pub const Node = union(enum) { |
| 129 | .float_literal_small => .{ .float_literal = @as(f32, @bitCast(repr.data)) }, | 129 | .float_literal_small => .{ .float_literal = @as(f32, @bitCast(repr.data)) }, |
| 130 | .float_literal => .{ .float_literal = @bitCast(zoir.extra[repr.data..][0..4].*) }, | 130 | .float_literal => .{ .float_literal = @bitCast(zoir.extra[repr.data..][0..4].*) }, |
| 131 | .char_literal => .{ .char_literal = @intCast(repr.data) }, | 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 | .string_literal => .{ .string_literal = s: { | 133 | .string_literal => .{ .string_literal = s: { |
| 134 | const start, const len = zoir.extra[repr.data..][0..2].*; | 134 | const start, const len = zoir.extra[repr.data..][0..2].*; |
| 135 | break :s zoir.string_bytes[start..][0..len]; | 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 | .empty_literal => .empty_literal, | 138 | .empty_literal => .empty_literal, |
| 139 | .array_literal => .{ .array_literal = a: { | 139 | .array_literal => .{ .array_literal = a: { |
| 140 | const elem_count, const first_elem = zoir.extra[repr.data..][0..2].*; | 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 | .struct_literal => .{ .struct_literal = s: { | 143 | .struct_literal => .{ .struct_literal = s: { |
| 144 | const elem_count, const first_elem = zoir.extra[repr.data..][0..2].*; | 144 | const elem_count, const first_elem = zoir.extra[repr.data..][0..2].*; |
| 145 | const field_names = zoir.extra[repr.data + 2 ..][0..elem_count]; | 145 | const field_names = zoir.extra[repr.data + 2 ..][0..elem_count]; |
| 146 | break :s .{ | 146 | break :s .{ |
| 147 | .names = @ptrCast(field_names), | 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 | pub fn getAstNode(idx: Index, zoir: Zoir) std.zig.Ast.Node.Index { | 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 | pub const Range = struct { | 158 | pub const Range = struct { |
| ... | @@ -161,7 +161,7 @@ pub const Node = union(enum) { | ... | @@ -161,7 +161,7 @@ pub const Node = union(enum) { |
| 161 | 161 | ||
| 162 | pub fn at(r: Range, i: u32) Index { | 162 | pub fn at(r: Range, i: u32) Index { |
| 163 | assert(i < r.len); | 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,8 +228,8 @@ pub const Node = union(enum) { |
| 228 | pub const NullTerminatedString = enum(u32) { | 228 | pub const NullTerminatedString = enum(u32) { |
| 229 | _, | 229 | _, |
| 230 | pub fn get(nts: NullTerminatedString, zoir: Zoir) [:0]const u8 { | 230 | pub fn get(nts: NullTerminatedString, zoir: Zoir) [:0]const u8 { |
| 231 | const idx = std.mem.findScalar(u8, zoir.string_bytes[@intFromEnum(nts)..], 0).?; | 231 | const idx = std.mem.findScalar(u8, zoir.string_bytes[@backingInt(nts)..], 0).?; |
| 232 | return zoir.string_bytes[@intFromEnum(nts)..][0..idx :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,14 +327,14 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator |
| 327 | }; | 327 | }; |
| 328 | zg.setNode(dest_node, .{ | 328 | zg.setNode(dest_node, .{ |
| 329 | .tag = .enum_literal, | 329 | .tag = .enum_literal, |
| 330 | .data = @intFromEnum(str_index), | 330 | .data = @backingInt(str_index), |
| 331 | .ast_node = node, | 331 | .ast_node = node, |
| 332 | }); | 332 | }); |
| 333 | }, | 333 | }, |
| 334 | .string_literal, .multiline_string_literal => if (zg.strLitAsString(node)) |result| switch (result) { | 334 | .string_literal, .multiline_string_literal => if (zg.strLitAsString(node)) |result| switch (result) { |
| 335 | .nts => |nts| zg.setNode(dest_node, .{ | 335 | .nts => |nts| zg.setNode(dest_node, .{ |
| 336 | .tag = .string_literal_null, | 336 | .tag = .string_literal_null, |
| 337 | .data = @intFromEnum(nts), | 337 | .data = @backingInt(nts), |
| 338 | .ast_node = node, | 338 | .ast_node = node, |
| 339 | }), | 339 | }), |
| 340 | .slice => |slice| { | 340 | .slice => |slice| { |
| ... | @@ -377,7 +377,7 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator | ... | @@ -377,7 +377,7 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator |
| 377 | }); | 377 | }); |
| 378 | 378 | ||
| 379 | for (full.ast.elements, first_elem..) |elem_node, elem_dest_node| { | 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,7 +429,7 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator |
| 429 | for (full.ast.fields, names_start.., first_elem..) |elem_node, extra_name_idx, elem_dest_node| { | 429 | for (full.ast.fields, names_start.., first_elem..) |elem_node, extra_name_idx, elem_dest_node| { |
| 430 | const name_token = tree.firstToken(elem_node) - 2; | 430 | const name_token = tree.firstToken(elem_node) - 2; |
| 431 | if (zg.identAsString(name_token)) |name_str| { | 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 | const gop = try field_names.getOrPut(bfa, name_str); | 433 | const gop = try field_names.getOrPut(bfa, name_str); |
| 434 | if (gop.found_existing and !reported_any_duplicate) { | 434 | if (gop.found_existing and !reported_any_duplicate) { |
| 435 | reported_any_duplicate = true; | 435 | reported_any_duplicate = true; |
| ... | @@ -443,7 +443,7 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator | ... | @@ -443,7 +443,7 @@ fn expr(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) Allocator |
| 443 | error.BadString => {}, // there's an error, so it's fine to not populate `zg.extra` | 443 | error.BadString => {}, // there's an error, so it's fine to not populate `zg.extra` |
| 444 | error.OutOfMemory => |e| return e, | 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,11 +590,11 @@ fn strLitAsString(zg: *ZonGen, str_node: Ast.Node.Index) error{ OutOfMemory, Bad |
| 590 | ); | 590 | ); |
| 591 | if (gop.found_existing) { | 591 | if (gop.found_existing) { |
| 592 | string_bytes.shrinkRetainingCapacity(str_index); | 592 | string_bytes.shrinkRetainingCapacity(str_index); |
| 593 | return .{ .nts = @enumFromInt(gop.key_ptr.*) }; | 593 | return .{ .nts = @fromBackingInt(@intCast(gop.key_ptr.*)) }; |
| 594 | } | 594 | } |
| 595 | gop.key_ptr.* = str_index; | 595 | gop.key_ptr.* = str_index; |
| 596 | try string_bytes.append(gpa, 0); | 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 | fn identAsString(zg: *ZonGen, ident_token: Ast.TokenIndex) !Zoir.NullTerminatedString { | 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,11 +610,11 @@ fn identAsString(zg: *ZonGen, ident_token: Ast.TokenIndex) !Zoir.NullTerminatedS |
| 610 | ); | 610 | ); |
| 611 | if (gop.found_existing) { | 611 | if (gop.found_existing) { |
| 612 | string_bytes.shrinkRetainingCapacity(str_index); | 612 | string_bytes.shrinkRetainingCapacity(str_index); |
| 613 | return @enumFromInt(gop.key_ptr.*); | 613 | return @fromBackingInt(@intCast(gop.key_ptr.*)); |
| 614 | } | 614 | } |
| 615 | gop.key_ptr.* = str_index; | 615 | gop.key_ptr.* = str_index; |
| 616 | try string_bytes.append(gpa, 0); | 616 | try string_bytes.append(gpa, 0); |
| 617 | return @enumFromInt(str_index); | 617 | return @fromBackingInt(@intCast(str_index)); |
| 618 | } | 618 | } |
| 619 | 619 | ||
| 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 { | 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,7 +656,7 @@ fn numberLiteral(zg: *ZonGen, num_node: Ast.Node.Index, src_node: Ast.Node.Index |
| 656 | }; | 656 | }; |
| 657 | var big_int: std.math.big.int.Managed = try .init(gpa); | 657 | var big_int: std.math.big.int.Managed = try .init(gpa); |
| 658 | defer big_int.deinit(); | 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 | error.InvalidCharacter => unreachable, // caught in `parseNumberLiteral` | 660 | error.InvalidCharacter => unreachable, // caught in `parseNumberLiteral` |
| 661 | error.InvalidBase => unreachable, // we only pass 16, 8, 2, see above | 661 | error.InvalidBase => unreachable, // we only pass 16, 8, 2, see above |
| 662 | error.OutOfMemory => |e| return e, | 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,7 +763,7 @@ fn identifier(zg: *ZonGen, node: Ast.Node.Index, dest_node: Zoir.Node.Index) !vo |
| 763 | } | 763 | } |
| 764 | 764 | ||
| 765 | fn setNode(zg: *ZonGen, dest: Zoir.Node.Index, repr: Zoir.Node.Repr) void { | 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 | fn lowerStrLitError( | 769 | fn lowerStrLitError( |
| ... | @@ -812,9 +812,9 @@ fn errNoteNode(zg: *ZonGen, node: Ast.Node.Index, comptime format: []const u8, a | ... | @@ -812,9 +812,9 @@ fn errNoteNode(zg: *ZonGen, node: Ast.Node.Index, comptime format: []const u8, a |
| 812 | const message_idx: u32 = @intCast(zg.string_bytes.items.len); | 812 | const message_idx: u32 = @intCast(zg.string_bytes.items.len); |
| 813 | try zg.string_bytes.print(zg.gpa, format ++ "\x00", args); | 813 | try zg.string_bytes.print(zg.gpa, format ++ "\x00", args); |
| 814 | return .{ | 814 | return .{ |
| 815 | .msg = @enumFromInt(message_idx), | 815 | .msg = @fromBackingInt(@intCast(message_idx)), |
| 816 | .token = .none, | 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,20 +822,20 @@ fn errNoteTok(zg: *ZonGen, tok: Ast.TokenIndex, comptime format: []const u8, arg |
| 822 | const message_idx: u32 = @intCast(zg.string_bytes.items.len); | 822 | const message_idx: u32 = @intCast(zg.string_bytes.items.len); |
| 823 | try zg.string_bytes.print(zg.gpa, format ++ "\x00", args); | 823 | try zg.string_bytes.print(zg.gpa, format ++ "\x00", args); |
| 824 | return .{ | 824 | return .{ |
| 825 | .msg = @enumFromInt(message_idx), | 825 | .msg = @fromBackingInt(@intCast(message_idx)), |
| 826 | .token = .fromToken(tok), | 826 | .token = .fromToken(tok), |
| 827 | .node_or_offset = 0, | 827 | .node_or_offset = 0, |
| 828 | }; | 828 | }; |
| 829 | } | 829 | } |
| 830 | 830 | ||
| 831 | fn addErrorNode(zg: *ZonGen, node: Ast.Node.Index, comptime format: []const u8, args: anytype) Allocator.Error!void { | 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 | fn addErrorTok(zg: *ZonGen, tok: Ast.TokenIndex, comptime format: []const u8, args: anytype) Allocator.Error!void { | 834 | fn addErrorTok(zg: *ZonGen, tok: Ast.TokenIndex, comptime format: []const u8, args: anytype) Allocator.Error!void { |
| 835 | return zg.addErrorInner(.fromToken(tok), 0, format, args, &.{}); | 835 | return zg.addErrorInner(.fromToken(tok), 0, format, args, &.{}); |
| 836 | } | 836 | } |
| 837 | fn addErrorNodeNotes(zg: *ZonGen, node: Ast.Node.Index, comptime format: []const u8, args: anytype, notes: []const Zoir.CompileError.Note) Allocator.Error!void { | 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 | fn addErrorTokNotes(zg: *ZonGen, tok: Ast.TokenIndex, comptime format: []const u8, args: anytype, notes: []const Zoir.CompileError.Note) Allocator.Error!void { | 840 | fn addErrorTokNotes(zg: *ZonGen, tok: Ast.TokenIndex, comptime format: []const u8, args: anytype, notes: []const Zoir.CompileError.Note) Allocator.Error!void { |
| 841 | return zg.addErrorInner(.fromToken(tok), 0, format, args, notes); | 841 | return zg.addErrorInner(.fromToken(tok), 0, format, args, notes); |
| ... | @@ -864,7 +864,7 @@ fn addErrorInner( | ... | @@ -864,7 +864,7 @@ fn addErrorInner( |
| 864 | try zg.string_bytes.print(gpa, format ++ "\x00", args); | 864 | try zg.string_bytes.print(gpa, format ++ "\x00", args); |
| 865 | 865 | ||
| 866 | try zg.compile_errors.append(gpa, .{ | 866 | try zg.compile_errors.append(gpa, .{ |
| 867 | .msg = @enumFromInt(message_idx), | 867 | .msg = @fromBackingInt(@intCast(message_idx)), |
| 868 | .token = token, | 868 | .token = token, |
| 869 | .node_or_offset = node_or_offset, | 869 | .node_or_offset = node_or_offset, |
| 870 | .first_note = first_note, | 870 | .first_note = first_note, |
lib/std/zig/llvm/BitcodeReader.zig+12-12| ... | @@ -70,23 +70,23 @@ pub const Record = struct { | ... | @@ -70,23 +70,23 @@ pub const Record = struct { |
| 70 | try operands.append(.{ .literal = record.operands[i + 1] }); | 70 | try operands.append(.{ .literal = record.operands[i + 1] }); |
| 71 | i += 2; | 71 | i += 2; |
| 72 | }, | 72 | }, |
| 73 | @intFromEnum(Abbrev.Operand.Encoding.fixed) => { | 73 | @backingInt(Abbrev.Operand.Encoding.fixed) => { |
| 74 | try operands.append(.{ .encoding = .{ .fixed = @intCast(record.operands[i + 1]) } }); | 74 | try operands.append(.{ .encoding = .{ .fixed = @intCast(record.operands[i + 1]) } }); |
| 75 | i += 2; | 75 | i += 2; |
| 76 | }, | 76 | }, |
| 77 | @intFromEnum(Abbrev.Operand.Encoding.vbr) => { | 77 | @backingInt(Abbrev.Operand.Encoding.vbr) => { |
| 78 | try operands.append(.{ .encoding = .{ .vbr = @intCast(record.operands[i + 1]) } }); | 78 | try operands.append(.{ .encoding = .{ .vbr = @intCast(record.operands[i + 1]) } }); |
| 79 | i += 2; | 79 | i += 2; |
| 80 | }, | 80 | }, |
| 81 | @intFromEnum(Abbrev.Operand.Encoding.array) => { | 81 | @backingInt(Abbrev.Operand.Encoding.array) => { |
| 82 | try operands.append(.{ .encoding = .{ .array = 6 } }); | 82 | try operands.append(.{ .encoding = .{ .array = 6 } }); |
| 83 | i += 1; | 83 | i += 1; |
| 84 | }, | 84 | }, |
| 85 | @intFromEnum(Abbrev.Operand.Encoding.char6) => { | 85 | @backingInt(Abbrev.Operand.Encoding.char6) => { |
| 86 | try operands.append(.{ .encoding = .char6 }); | 86 | try operands.append(.{ .encoding = .char6 }); |
| 87 | i += 1; | 87 | i += 1; |
| 88 | }, | 88 | }, |
| 89 | @intFromEnum(Abbrev.Operand.Encoding.blob) => { | 89 | @backingInt(Abbrev.Operand.Encoding.blob) => { |
| 90 | try operands.append(.{ .encoding = .{ .blob = 6 } }); | 90 | try operands.append(.{ .encoding = .{ .blob = 6 } }); |
| 91 | i += 1; | 91 | i += 1; |
| 92 | }, | 92 | }, |
| ... | @@ -225,8 +225,8 @@ fn nextRecord(bc: *BitcodeReader) !?Record { | ... | @@ -225,8 +225,8 @@ fn nextRecord(bc: *BitcodeReader) !?Record { |
| 225 | }), | 225 | }), |
| 226 | 0 => { | 226 | 0 => { |
| 227 | const encoding: Abbrev.Operand.Encoding = | 227 | const encoding: Abbrev.Operand.Encoding = |
| 228 | @enumFromInt(try bc.readFixed(u3, 3)); | 228 | @fromBackingInt(@intCast(try bc.readFixed(u3, 3))); |
| 229 | try operands.append(@intFromEnum(encoding)); | 229 | try operands.append(@backingInt(encoding)); |
| 230 | switch (encoding) { | 230 | switch (encoding) { |
| 231 | .fixed, .vbr => try operands.append(try bc.readVbr(u7, 5)), | 231 | .fixed, .vbr => try operands.append(try bc.readVbr(u7, 5)), |
| 232 | .array, .char6, .blob => {}, | 232 | .array, .char6, .blob => {}, |
| ... | @@ -285,14 +285,14 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void { | ... | @@ -285,14 +285,14 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void { |
| 285 | @typeInfo(Abbrev.Builtin).@"enum".field_names.len + abbrevs.len, | 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 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ | 289 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ |
| 290 | .operands = &.{ | 290 | .operands = &.{ |
| 291 | .{ .literal = Abbrev.Builtin.end_block.toRecordId() }, | 291 | .{ .literal = Abbrev.Builtin.end_block.toRecordId() }, |
| 292 | .align_32_bits, | 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 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ | 296 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ |
| 297 | .operands = &.{ | 297 | .operands = &.{ |
| 298 | .{ .literal = Abbrev.Builtin.enter_subblock.toRecordId() }, | 298 | .{ .literal = Abbrev.Builtin.enter_subblock.toRecordId() }, |
| ... | @@ -302,7 +302,7 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void { | ... | @@ -302,7 +302,7 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void { |
| 302 | .block_len, | 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 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ | 306 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ |
| 307 | .operands = &.{ | 307 | .operands = &.{ |
| 308 | .{ .literal = Abbrev.Builtin.define_abbrev.toRecordId() }, | 308 | .{ .literal = Abbrev.Builtin.define_abbrev.toRecordId() }, |
| ... | @@ -310,7 +310,7 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void { | ... | @@ -310,7 +310,7 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void { |
| 310 | .abbrev_op, | 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 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ | 314 | try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, .{ |
| 315 | .operands = &.{ | 315 | .operands = &.{ |
| 316 | .{ .encoding = .{ .vbr = 6 } }, // code | 316 | .{ .encoding = .{ .vbr = 6 } }, // code |
| ... | @@ -459,7 +459,7 @@ const Abbrev = struct { | ... | @@ -459,7 +459,7 @@ const Abbrev = struct { |
| 459 | 459 | ||
| 460 | const first_record_id: u32 = std.math.maxInt(u32) - @typeInfo(Builtin).@"enum".field_names.len + 1; | 460 | const first_record_id: u32 = std.math.maxInt(u32) - @typeInfo(Builtin).@"enum".field_names.len + 1; |
| 461 | fn toRecordId(builtin: Builtin) u32 { | 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,7 +112,7 @@ pub const String = enum(u32) { |
| 112 | fn format(data: FormatData, w: *Writer) Writer.Error!void { | 112 | fn format(data: FormatData, w: *Writer) Writer.Error!void { |
| 113 | assert(data.string != .none); | 113 | assert(data.string != .none); |
| 114 | const string_slice = data.string.slice(data.builder) orelse | 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 | const quote_behavior = data.quote_behavior orelse return w.writeAll(string_slice); | 116 | const quote_behavior = data.quote_behavior orelse return w.writeAll(string_slice); |
| 117 | return printEscapedString(string_slice, quote_behavior, w); | 117 | return printEscapedString(string_slice, quote_behavior, w); |
| 118 | } | 118 | } |
| ... | @@ -142,12 +142,12 @@ pub const String = enum(u32) { | ... | @@ -142,12 +142,12 @@ pub const String = enum(u32) { |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | fn fromIndex(index: ?usize) String { | 144 | fn fromIndex(index: ?usize) String { |
| 145 | return @enumFromInt(@as(u32, @intCast((index orelse return .none) + | 145 | return @fromBackingInt(@intCast(@as(u32, @intCast((index orelse return .none) + |
| 146 | @intFromEnum(String.empty)))); | 146 | @backingInt(String.empty))))); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | fn toIndex(self: String) ?usize { | 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 | const Adapter = struct { | 153 | const Adapter = struct { |
| ... | @@ -272,19 +272,19 @@ pub const Type = enum(u32) { | ... | @@ -272,19 +272,19 @@ pub const Type = enum(u32) { |
| 272 | 272 | ||
| 273 | pub const Simple = enum(u5) { | 273 | pub const Simple = enum(u5) { |
| 274 | const Code = ir.ModuleBlock.TypeBlock.Code; | 274 | const Code = ir.ModuleBlock.TypeBlock.Code; |
| 275 | void = @intFromEnum(Code.VOID), | 275 | void = @backingInt(Code.VOID), |
| 276 | half = @intFromEnum(Code.HALF), | 276 | half = @backingInt(Code.HALF), |
| 277 | bfloat = @intFromEnum(Code.BFLOAT), | 277 | bfloat = @backingInt(Code.BFLOAT), |
| 278 | float = @intFromEnum(Code.FLOAT), | 278 | float = @backingInt(Code.FLOAT), |
| 279 | double = @intFromEnum(Code.DOUBLE), | 279 | double = @backingInt(Code.DOUBLE), |
| 280 | fp128 = @intFromEnum(Code.FP128), | 280 | fp128 = @backingInt(Code.FP128), |
| 281 | x86_fp80 = @intFromEnum(Code.X86_FP80), | 281 | x86_fp80 = @backingInt(Code.X86_FP80), |
| 282 | ppc_fp128 = @intFromEnum(Code.PPC_FP128), | 282 | ppc_fp128 = @backingInt(Code.PPC_FP128), |
| 283 | x86_amx = @intFromEnum(Code.X86_AMX), | 283 | x86_amx = @backingInt(Code.X86_AMX), |
| 284 | x86_mmx = @intFromEnum(Code.X86_MMX), | 284 | x86_mmx = @backingInt(Code.X86_MMX), |
| 285 | label = @intFromEnum(Code.LABEL), | 285 | label = @backingInt(Code.LABEL), |
| 286 | token = @intFromEnum(Code.TOKEN), | 286 | token = @backingInt(Code.TOKEN), |
| 287 | metadata = @intFromEnum(Code.METADATA), | 287 | metadata = @backingInt(Code.METADATA), |
| 288 | }; | 288 | }; |
| 289 | 289 | ||
| 290 | pub const Function = struct { | 290 | pub const Function = struct { |
| ... | @@ -344,11 +344,11 @@ pub const Type = enum(u32) { | ... | @@ -344,11 +344,11 @@ pub const Type = enum(u32) { |
| 344 | }; | 344 | }; |
| 345 | 345 | ||
| 346 | pub fn tag(self: Type, builder: *const Builder) Tag { | 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 | pub fn unnamedTag(self: Type, builder: *const Builder) Tag { | 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 | return switch (item.tag) { | 352 | return switch (item.tag) { |
| 353 | .named_structure => builder.typeExtraData(Type.NamedStructure, item.data).body | 353 | .named_structure => builder.typeExtraData(Type.NamedStructure, item.data).body |
| 354 | .unnamedTag(builder), | 354 | .unnamedTag(builder), |
| ... | @@ -357,7 +357,7 @@ pub const Type = enum(u32) { | ... | @@ -357,7 +357,7 @@ pub const Type = enum(u32) { |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | pub fn scalarTag(self: Type, builder: *const Builder) Tag { | 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 | return switch (item.tag) { | 361 | return switch (item.tag) { |
| 362 | .vector, .scalable_vector => builder.typeExtraData(Type.Vector, item.data) | 362 | .vector, .scalable_vector => builder.typeExtraData(Type.Vector, item.data) |
| 363 | .child.tag(builder), | 363 | .child.tag(builder), |
| ... | @@ -396,9 +396,9 @@ pub const Type = enum(u32) { | ... | @@ -396,9 +396,9 @@ pub const Type = enum(u32) { |
| 396 | switch (self) { | 396 | switch (self) { |
| 397 | .ptr => return .default, | 397 | .ptr => return .default, |
| 398 | else => { | 398 | else => { |
| 399 | const item = builder.type_items.items[@intFromEnum(self)]; | 399 | const item = builder.type_items.items[@backingInt(self)]; |
| 400 | assert(item.tag == .pointer); | 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,7 +419,7 @@ pub const Type = enum(u32) { |
| 419 | } | 419 | } |
| 420 | 420 | ||
| 421 | pub fn functionParameters(self: Type, builder: *const Builder) []const Type { | 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 | switch (item.tag) { | 423 | switch (item.tag) { |
| 424 | .function, | 424 | .function, |
| 425 | .vararg_function, | 425 | .vararg_function, |
| ... | @@ -432,7 +432,7 @@ pub const Type = enum(u32) { | ... | @@ -432,7 +432,7 @@ pub const Type = enum(u32) { |
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | pub fn functionReturn(self: Type, builder: *const Builder) Type { | 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 | switch (item.tag) { | 436 | switch (item.tag) { |
| 437 | .function, | 437 | .function, |
| 438 | .vararg_function, | 438 | .vararg_function, |
| ... | @@ -491,7 +491,7 @@ pub const Type = enum(u32) { | ... | @@ -491,7 +491,7 @@ pub const Type = enum(u32) { |
| 491 | .fp128, .ppc_fp128, .i128 => 128, | 491 | .fp128, .ppc_fp128, .i128 => 128, |
| 492 | .ptr, .@"ptr addrspace(4)" => @panic("TODO: query data layout"), | 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 | return switch (item.tag) { | 495 | return switch (item.tag) { |
| 496 | .simple, | 496 | .simple, |
| 497 | .function, | 497 | .function, |
| ... | @@ -515,7 +515,7 @@ pub const Type = enum(u32) { | ... | @@ -515,7 +515,7 @@ pub const Type = enum(u32) { |
| 515 | } | 515 | } |
| 516 | 516 | ||
| 517 | pub fn childType(self: Type, builder: *const Builder) Type { | 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 | return switch (item.tag) { | 519 | return switch (item.tag) { |
| 520 | .vector, | 520 | .vector, |
| 521 | .scalable_vector, | 521 | .scalable_vector, |
| ... | @@ -529,7 +529,7 @@ pub const Type = enum(u32) { | ... | @@ -529,7 +529,7 @@ pub const Type = enum(u32) { |
| 529 | 529 | ||
| 530 | pub fn scalarType(self: Type, builder: *const Builder) Type { | 530 | pub fn scalarType(self: Type, builder: *const Builder) Type { |
| 531 | if (self.isFloatingPoint()) return self; | 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 | return switch (item.tag) { | 533 | return switch (item.tag) { |
| 534 | .integer, | 534 | .integer, |
| 535 | .pointer, | 535 | .pointer, |
| ... | @@ -548,7 +548,7 @@ pub const Type = enum(u32) { | ... | @@ -548,7 +548,7 @@ pub const Type = enum(u32) { |
| 548 | 548 | ||
| 549 | pub fn changeScalarAssumeCapacity(self: Type, scalar: Type, builder: *Builder) Type { | 549 | pub fn changeScalarAssumeCapacity(self: Type, scalar: Type, builder: *Builder) Type { |
| 550 | if (self.isFloatingPoint()) return scalar; | 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 | return switch (item.tag) { | 552 | return switch (item.tag) { |
| 553 | .integer, | 553 | .integer, |
| 554 | .pointer, | 554 | .pointer, |
| ... | @@ -569,7 +569,7 @@ pub const Type = enum(u32) { | ... | @@ -569,7 +569,7 @@ pub const Type = enum(u32) { |
| 569 | } | 569 | } |
| 570 | 570 | ||
| 571 | pub fn vectorLen(self: Type, builder: *const Builder) u32 { | 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 | return switch (item.tag) { | 573 | return switch (item.tag) { |
| 574 | .vector, | 574 | .vector, |
| 575 | .scalable_vector, | 575 | .scalable_vector, |
| ... | @@ -584,7 +584,7 @@ pub const Type = enum(u32) { | ... | @@ -584,7 +584,7 @@ pub const Type = enum(u32) { |
| 584 | } | 584 | } |
| 585 | 585 | ||
| 586 | pub fn changeLengthAssumeCapacity(self: Type, len: u32, builder: *Builder) Type { | 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 | return switch (item.tag) { | 588 | return switch (item.tag) { |
| 589 | inline .vector, | 589 | inline .vector, |
| 590 | .scalable_vector, | 590 | .scalable_vector, |
| ... | @@ -610,7 +610,7 @@ pub const Type = enum(u32) { | ... | @@ -610,7 +610,7 @@ pub const Type = enum(u32) { |
| 610 | } | 610 | } |
| 611 | 611 | ||
| 612 | pub fn aggregateLen(self: Type, builder: *const Builder) usize { | 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 | return switch (item.tag) { | 614 | return switch (item.tag) { |
| 615 | .vector, | 615 | .vector, |
| 616 | .scalable_vector, | 616 | .scalable_vector, |
| ... | @@ -627,7 +627,7 @@ pub const Type = enum(u32) { | ... | @@ -627,7 +627,7 @@ pub const Type = enum(u32) { |
| 627 | } | 627 | } |
| 628 | 628 | ||
| 629 | pub fn structFields(self: Type, builder: *const Builder) []const Type { | 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 | switch (item.tag) { | 631 | switch (item.tag) { |
| 632 | .structure, | 632 | .structure, |
| 633 | .packed_structure, | 633 | .packed_structure, |
| ... | @@ -643,7 +643,7 @@ pub const Type = enum(u32) { | ... | @@ -643,7 +643,7 @@ pub const Type = enum(u32) { |
| 643 | 643 | ||
| 644 | pub fn childTypeAt(self: Type, indices: []const u32, builder: *const Builder) Type { | 644 | pub fn childTypeAt(self: Type, indices: []const u32, builder: *const Builder) Type { |
| 645 | if (indices.len == 0) return self; | 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 | return switch (item.tag) { | 647 | return switch (item.tag) { |
| 648 | .small_array => builder.typeExtraData(Type.Vector, item.data).child | 648 | .small_array => builder.typeExtraData(Type.Vector, item.data).child |
| 649 | .childTypeAt(indices[1..], builder), | 649 | .childTypeAt(indices[1..], builder), |
| ... | @@ -685,9 +685,9 @@ pub const Type = enum(u32) { | ... | @@ -685,9 +685,9 @@ pub const Type = enum(u32) { |
| 685 | fn format(data: FormatData, w: *Writer) Writer.Error!void { | 685 | fn format(data: FormatData, w: *Writer) Writer.Error!void { |
| 686 | assert(data.type != .none); | 686 | assert(data.type != .none); |
| 687 | if (data.mode == .m) { | 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 | switch (item.tag) { | 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 | .void => "isVoid", | 691 | .void => "isVoid", |
| 692 | .half => "f16", | 692 | .half => "f16", |
| 693 | .bfloat => "bf16", | 693 | .bfloat => "bf16", |
| ... | @@ -760,7 +760,7 @@ pub const Type = enum(u32) { | ... | @@ -760,7 +760,7 @@ pub const Type = enum(u32) { |
| 760 | return; | 760 | return; |
| 761 | } | 761 | } |
| 762 | if (std.enums.tagName(Type, data.type)) |name| return w.writeAll(name); | 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 | switch (item.tag) { | 764 | switch (item.tag) { |
| 765 | .simple => unreachable, | 765 | .simple => unreachable, |
| 766 | .function, .vararg_function => |kind| { | 766 | .function, .vararg_function => |kind| { |
| ... | @@ -786,7 +786,7 @@ pub const Type = enum(u32) { | ... | @@ -786,7 +786,7 @@ pub const Type = enum(u32) { |
| 786 | } | 786 | } |
| 787 | }, | 787 | }, |
| 788 | .integer => try w.print("i{d}", .{item.data}), | 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 | .target => { | 790 | .target => { |
| 791 | var extra = data.builder.typeExtraDataTrail(Type.Target, item.data); | 791 | var extra = data.builder.typeExtraDataTrail(Type.Target, item.data); |
| 792 | const types = extra.trail.next(extra.data.types_len, Type, data.builder); | 792 | const types = extra.trail.next(extra.data.types_len, Type, data.builder); |
| ... | @@ -891,7 +891,7 @@ pub const Type = enum(u32) { | ... | @@ -891,7 +891,7 @@ pub const Type = enum(u32) { |
| 891 | => true, | 891 | => true, |
| 892 | .none => unreachable, | 892 | .none => unreachable, |
| 893 | _ => { | 893 | _ => { |
| 894 | const item = builder.type_items.items[@intFromEnum(self)]; | 894 | const item = builder.type_items.items[@backingInt(self)]; |
| 895 | return switch (item.tag) { | 895 | return switch (item.tag) { |
| 896 | .simple => unreachable, | 896 | .simple => unreachable, |
| 897 | .function, | 897 | .function, |
| ... | @@ -1045,7 +1045,7 @@ pub const Attribute = union(Kind) { | ... | @@ -1045,7 +1045,7 @@ pub const Attribute = union(Kind) { |
| 1045 | const storage = self.toStorage(builder); | 1045 | const storage = self.toStorage(builder); |
| 1046 | if (storage.kind.toString()) |kind| return .{ .string = .{ | 1046 | if (storage.kind.toString()) |kind| return .{ .string = .{ |
| 1047 | .kind = kind, | 1047 | .kind = kind, |
| 1048 | .value = @enumFromInt(storage.value), | 1048 | .value = @fromBackingInt(@intCast(storage.value)), |
| 1049 | } } else return switch (storage.kind) { | 1049 | } } else return switch (storage.kind) { |
| 1050 | inline .zeroext, | 1050 | inline .zeroext, |
| 1051 | .signext, | 1051 | .signext, |
| ... | @@ -1149,7 +1149,7 @@ pub const Attribute = union(Kind) { | ... | @@ -1149,7 +1149,7 @@ pub const Attribute = union(Kind) { |
| 1149 | return @unionInit(Attribute, field_name, switch (field_type) { | 1149 | return @unionInit(Attribute, field_name, switch (field_type) { |
| 1150 | void => {}, | 1150 | void => {}, |
| 1151 | u32 => storage.value, | 1151 | u32 => storage.value, |
| 1152 | Alignment.Lazy, String, Type, UwTable => @enumFromInt(storage.value), | 1152 | Alignment.Lazy, String, Type, UwTable => @fromBackingInt(@intCast(storage.value)), |
| 1153 | AllocKind, AllocSize, FpClass, Memory, VScaleRange => @bitCast(storage.value), | 1153 | AllocKind, AllocSize, FpClass, Memory, VScaleRange => @bitCast(storage.value), |
| 1154 | else => @compileError("bad payload type: " ++ field_name ++ ": " ++ | 1154 | else => @compileError("bad payload type: " ++ field_name ++ ": " ++ |
| 1155 | @typeName(field_type)), | 1155 | @typeName(field_type)), |
| ... | @@ -1338,7 +1338,7 @@ pub const Attribute = union(Kind) { | ... | @@ -1338,7 +1338,7 @@ pub const Attribute = union(Kind) { |
| 1338 | } | 1338 | } |
| 1339 | 1339 | ||
| 1340 | fn toStorage(self: Index, builder: *const Builder) Storage { | 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,14 +1447,14 @@ pub const Attribute = union(Kind) { |
| 1447 | 1447 | ||
| 1448 | pub fn fromString(str: String) Kind { | 1448 | pub fn fromString(str: String) Kind { |
| 1449 | assert(!str.isAnon()); | 1449 | assert(!str.isAnon()); |
| 1450 | const kind: Kind = @enumFromInt(@intFromEnum(str)); | 1450 | const kind: Kind = @fromBackingInt(@intCast(@backingInt(str))); |
| 1451 | assert(kind != .none); | 1451 | assert(kind != .none); |
| 1452 | return kind; | 1452 | return kind; |
| 1453 | } | 1453 | } |
| 1454 | 1454 | ||
| 1455 | fn toString(self: Kind) ?String { | 1455 | fn toString(self: Kind) ?String { |
| 1456 | assert(self != .none); | 1456 | assert(self != .none); |
| 1457 | const str: String = @enumFromInt(@intFromEnum(self)); | 1457 | const str: String = @fromBackingInt(@intCast(@backingInt(self))); |
| 1458 | return if (str.isAnon()) null else str; | 1458 | return if (str.isAnon()) null else str; |
| 1459 | } | 1459 | } |
| 1460 | }; | 1460 | }; |
| ... | @@ -1581,13 +1581,13 @@ pub const Attribute = union(Kind) { | ... | @@ -1581,13 +1581,13 @@ pub const Attribute = union(Kind) { |
| 1581 | inline else => |value, tag| .{ .kind = @as(Kind, self), .value = switch (@TypeOf(value)) { | 1581 | inline else => |value, tag| .{ .kind = @as(Kind, self), .value = switch (@TypeOf(value)) { |
| 1582 | void => 0, | 1582 | void => 0, |
| 1583 | u32 => value, | 1583 | u32 => value, |
| 1584 | Alignment.Lazy, String, Type, UwTable => @intFromEnum(value), | 1584 | Alignment.Lazy, String, Type, UwTable => @backingInt(value), |
| 1585 | AllocKind, AllocSize, FpClass, Memory, VScaleRange => @bitCast(value), | 1585 | AllocKind, AllocSize, FpClass, Memory, VScaleRange => @bitCast(value), |
| 1586 | else => @compileError("bad payload type: " ++ @tagName(tag) ++ @typeName(@TypeOf(value))), | 1586 | else => @compileError("bad payload type: " ++ @tagName(tag) ++ @typeName(@TypeOf(value))), |
| 1587 | } }, | 1587 | } }, |
| 1588 | .string => |string_attr| .{ | 1588 | .string => |string_attr| .{ |
| 1589 | .kind = Kind.fromString(string_attr.kind), | 1589 | .kind = Kind.fromString(string_attr.kind), |
| 1590 | .value = @intFromEnum(string_attr.value), | 1590 | .value = @backingInt(string_attr.value), |
| 1591 | }, | 1591 | }, |
| 1592 | .none => unreachable, | 1592 | .none => unreachable, |
| 1593 | }; | 1593 | }; |
| ... | @@ -1599,8 +1599,8 @@ pub const Attributes = enum(u32) { | ... | @@ -1599,8 +1599,8 @@ pub const Attributes = enum(u32) { |
| 1599 | _, | 1599 | _, |
| 1600 | 1600 | ||
| 1601 | pub fn slice(self: Attributes, builder: *const Builder) []const Attribute.Index { | 1601 | pub fn slice(self: Attributes, builder: *const Builder) []const Attribute.Index { |
| 1602 | const start = builder.attributes_indices.items[@intFromEnum(self)]; | 1602 | const start = builder.attributes_indices.items[@backingInt(self)]; |
| 1603 | const end = builder.attributes_indices.items[@intFromEnum(self) + 1]; | 1603 | const end = builder.attributes_indices.items[@backingInt(self) + 1]; |
| 1604 | return @ptrCast(builder.attributes_extra.items[start..end]); | 1604 | return @ptrCast(builder.attributes_extra.items[start..end]); |
| 1605 | } | 1605 | } |
| 1606 | 1606 | ||
| ... | @@ -1785,8 +1785,8 @@ pub const FunctionAttributes = enum(u32) { | ... | @@ -1785,8 +1785,8 @@ pub const FunctionAttributes = enum(u32) { |
| 1785 | } | 1785 | } |
| 1786 | 1786 | ||
| 1787 | fn slice(self: FunctionAttributes, builder: *const Builder) []const Attributes { | 1787 | fn slice(self: FunctionAttributes, builder: *const Builder) []const Attributes { |
| 1788 | const start = builder.attributes_indices.items[@intFromEnum(self)]; | 1788 | const start = builder.attributes_indices.items[@backingInt(self)]; |
| 1789 | const end = builder.attributes_indices.items[@intFromEnum(self) + 1]; | 1789 | const end = builder.attributes_indices.items[@backingInt(self) + 1]; |
| 1790 | return @ptrCast(builder.attributes_extra.items[start..end]); | 1790 | return @ptrCast(builder.attributes_extra.items[start..end]); |
| 1791 | } | 1791 | } |
| 1792 | }; | 1792 | }; |
| ... | @@ -1907,87 +1907,87 @@ pub const AddrSpace = enum(u24) { | ... | @@ -1907,87 +1907,87 @@ pub const AddrSpace = enum(u24) { |
| 1907 | 1907 | ||
| 1908 | // See llvm/lib/Target/X86/X86.h | 1908 | // See llvm/lib/Target/X86/X86.h |
| 1909 | pub const x86 = struct { | 1909 | pub const x86 = struct { |
| 1910 | pub const gs: AddrSpace = @enumFromInt(256); | 1910 | pub const gs: AddrSpace = @fromBackingInt(@intCast(256)); |
| 1911 | pub const fs: AddrSpace = @enumFromInt(257); | 1911 | pub const fs: AddrSpace = @fromBackingInt(@intCast(257)); |
| 1912 | pub const ss: AddrSpace = @enumFromInt(258); | 1912 | pub const ss: AddrSpace = @fromBackingInt(@intCast(258)); |
| 1913 | 1913 | ||
| 1914 | pub const ptr32_sptr: AddrSpace = @enumFromInt(270); | 1914 | pub const ptr32_sptr: AddrSpace = @fromBackingInt(@intCast(270)); |
| 1915 | pub const ptr32_uptr: AddrSpace = @enumFromInt(271); | 1915 | pub const ptr32_uptr: AddrSpace = @fromBackingInt(@intCast(271)); |
| 1916 | pub const ptr64: AddrSpace = @enumFromInt(272); | 1916 | pub const ptr64: AddrSpace = @fromBackingInt(@intCast(272)); |
| 1917 | }; | 1917 | }; |
| 1918 | pub const x86_64 = x86; | 1918 | pub const x86_64 = x86; |
| 1919 | 1919 | ||
| 1920 | // See llvm/lib/Target/AVR/AVR.h | 1920 | // See llvm/lib/Target/AVR/AVR.h |
| 1921 | pub const avr = struct { | 1921 | pub const avr = struct { |
| 1922 | pub const data: AddrSpace = @enumFromInt(0); | 1922 | pub const data: AddrSpace = @fromBackingInt(@intCast(0)); |
| 1923 | pub const program: AddrSpace = @enumFromInt(1); | 1923 | pub const program: AddrSpace = @fromBackingInt(@intCast(1)); |
| 1924 | pub const program1: AddrSpace = @enumFromInt(2); | 1924 | pub const program1: AddrSpace = @fromBackingInt(@intCast(2)); |
| 1925 | pub const program2: AddrSpace = @enumFromInt(3); | 1925 | pub const program2: AddrSpace = @fromBackingInt(@intCast(3)); |
| 1926 | pub const program3: AddrSpace = @enumFromInt(4); | 1926 | pub const program3: AddrSpace = @fromBackingInt(@intCast(4)); |
| 1927 | pub const program4: AddrSpace = @enumFromInt(5); | 1927 | pub const program4: AddrSpace = @fromBackingInt(@intCast(5)); |
| 1928 | pub const program5: AddrSpace = @enumFromInt(6); | 1928 | pub const program5: AddrSpace = @fromBackingInt(@intCast(6)); |
| 1929 | }; | 1929 | }; |
| 1930 | 1930 | ||
| 1931 | // See llvm/lib/Target/NVPTX/NVPTX.h | 1931 | // See llvm/lib/Target/NVPTX/NVPTX.h |
| 1932 | pub const nvptx = struct { | 1932 | pub const nvptx = struct { |
| 1933 | pub const generic: AddrSpace = @enumFromInt(0); | 1933 | pub const generic: AddrSpace = @fromBackingInt(@intCast(0)); |
| 1934 | pub const global: AddrSpace = @enumFromInt(1); | 1934 | pub const global: AddrSpace = @fromBackingInt(@intCast(1)); |
| 1935 | pub const constant: AddrSpace = @enumFromInt(2); | 1935 | pub const constant: AddrSpace = @fromBackingInt(@intCast(2)); |
| 1936 | pub const shared: AddrSpace = @enumFromInt(3); | 1936 | pub const shared: AddrSpace = @fromBackingInt(@intCast(3)); |
| 1937 | pub const param: AddrSpace = @enumFromInt(4); | 1937 | pub const param: AddrSpace = @fromBackingInt(@intCast(4)); |
| 1938 | pub const local: AddrSpace = @enumFromInt(5); | 1938 | pub const local: AddrSpace = @fromBackingInt(@intCast(5)); |
| 1939 | }; | 1939 | }; |
| 1940 | 1940 | ||
| 1941 | // See llvm/lib/Target/AMDGPU/AMDGPU.h | 1941 | // See llvm/lib/Target/AMDGPU/AMDGPU.h |
| 1942 | pub const amdgpu = struct { | 1942 | pub const amdgpu = struct { |
| 1943 | pub const flat: AddrSpace = @enumFromInt(0); | 1943 | pub const flat: AddrSpace = @fromBackingInt(@intCast(0)); |
| 1944 | pub const global: AddrSpace = @enumFromInt(1); | 1944 | pub const global: AddrSpace = @fromBackingInt(@intCast(1)); |
| 1945 | pub const region: AddrSpace = @enumFromInt(2); | 1945 | pub const region: AddrSpace = @fromBackingInt(@intCast(2)); |
| 1946 | pub const local: AddrSpace = @enumFromInt(3); | 1946 | pub const local: AddrSpace = @fromBackingInt(@intCast(3)); |
| 1947 | pub const constant: AddrSpace = @enumFromInt(4); | 1947 | pub const constant: AddrSpace = @fromBackingInt(@intCast(4)); |
| 1948 | pub const private: AddrSpace = @enumFromInt(5); | 1948 | pub const private: AddrSpace = @fromBackingInt(@intCast(5)); |
| 1949 | pub const constant_32bit: AddrSpace = @enumFromInt(6); | 1949 | pub const constant_32bit: AddrSpace = @fromBackingInt(@intCast(6)); |
| 1950 | pub const buffer_fat_pointer: AddrSpace = @enumFromInt(7); | 1950 | pub const buffer_fat_pointer: AddrSpace = @fromBackingInt(@intCast(7)); |
| 1951 | pub const buffer_resource: AddrSpace = @enumFromInt(8); | 1951 | pub const buffer_resource: AddrSpace = @fromBackingInt(@intCast(8)); |
| 1952 | pub const buffer_strided_pointer: AddrSpace = @enumFromInt(9); | 1952 | pub const buffer_strided_pointer: AddrSpace = @fromBackingInt(@intCast(9)); |
| 1953 | pub const param_d: AddrSpace = @enumFromInt(6); | 1953 | pub const param_d: AddrSpace = @fromBackingInt(@intCast(6)); |
| 1954 | pub const param_i: AddrSpace = @enumFromInt(7); | 1954 | pub const param_i: AddrSpace = @fromBackingInt(@intCast(7)); |
| 1955 | pub const constant_buffer_0: AddrSpace = @enumFromInt(8); | 1955 | pub const constant_buffer_0: AddrSpace = @fromBackingInt(@intCast(8)); |
| 1956 | pub const constant_buffer_1: AddrSpace = @enumFromInt(9); | 1956 | pub const constant_buffer_1: AddrSpace = @fromBackingInt(@intCast(9)); |
| 1957 | pub const constant_buffer_2: AddrSpace = @enumFromInt(10); | 1957 | pub const constant_buffer_2: AddrSpace = @fromBackingInt(@intCast(10)); |
| 1958 | pub const constant_buffer_3: AddrSpace = @enumFromInt(11); | 1958 | pub const constant_buffer_3: AddrSpace = @fromBackingInt(@intCast(11)); |
| 1959 | pub const constant_buffer_4: AddrSpace = @enumFromInt(12); | 1959 | pub const constant_buffer_4: AddrSpace = @fromBackingInt(@intCast(12)); |
| 1960 | pub const constant_buffer_5: AddrSpace = @enumFromInt(13); | 1960 | pub const constant_buffer_5: AddrSpace = @fromBackingInt(@intCast(13)); |
| 1961 | pub const constant_buffer_6: AddrSpace = @enumFromInt(14); | 1961 | pub const constant_buffer_6: AddrSpace = @fromBackingInt(@intCast(14)); |
| 1962 | pub const constant_buffer_7: AddrSpace = @enumFromInt(15); | 1962 | pub const constant_buffer_7: AddrSpace = @fromBackingInt(@intCast(15)); |
| 1963 | pub const constant_buffer_8: AddrSpace = @enumFromInt(16); | 1963 | pub const constant_buffer_8: AddrSpace = @fromBackingInt(@intCast(16)); |
| 1964 | pub const constant_buffer_9: AddrSpace = @enumFromInt(17); | 1964 | pub const constant_buffer_9: AddrSpace = @fromBackingInt(@intCast(17)); |
| 1965 | pub const constant_buffer_10: AddrSpace = @enumFromInt(18); | 1965 | pub const constant_buffer_10: AddrSpace = @fromBackingInt(@intCast(18)); |
| 1966 | pub const constant_buffer_11: AddrSpace = @enumFromInt(19); | 1966 | pub const constant_buffer_11: AddrSpace = @fromBackingInt(@intCast(19)); |
| 1967 | pub const constant_buffer_12: AddrSpace = @enumFromInt(20); | 1967 | pub const constant_buffer_12: AddrSpace = @fromBackingInt(@intCast(20)); |
| 1968 | pub const constant_buffer_13: AddrSpace = @enumFromInt(21); | 1968 | pub const constant_buffer_13: AddrSpace = @fromBackingInt(@intCast(21)); |
| 1969 | pub const constant_buffer_14: AddrSpace = @enumFromInt(22); | 1969 | pub const constant_buffer_14: AddrSpace = @fromBackingInt(@intCast(22)); |
| 1970 | pub const constant_buffer_15: AddrSpace = @enumFromInt(23); | 1970 | pub const constant_buffer_15: AddrSpace = @fromBackingInt(@intCast(23)); |
| 1971 | pub const streamout_register: AddrSpace = @enumFromInt(128); | 1971 | pub const streamout_register: AddrSpace = @fromBackingInt(@intCast(128)); |
| 1972 | }; | 1972 | }; |
| 1973 | 1973 | ||
| 1974 | pub const spirv = struct { | 1974 | pub const spirv = struct { |
| 1975 | pub const function: AddrSpace = @enumFromInt(0); | 1975 | pub const function: AddrSpace = @fromBackingInt(@intCast(0)); |
| 1976 | pub const cross_workgroup: AddrSpace = @enumFromInt(1); | 1976 | pub const cross_workgroup: AddrSpace = @fromBackingInt(@intCast(1)); |
| 1977 | pub const uniform_constant: AddrSpace = @enumFromInt(2); | 1977 | pub const uniform_constant: AddrSpace = @fromBackingInt(@intCast(2)); |
| 1978 | pub const workgroup: AddrSpace = @enumFromInt(3); | 1978 | pub const workgroup: AddrSpace = @fromBackingInt(@intCast(3)); |
| 1979 | pub const generic: AddrSpace = @enumFromInt(4); | 1979 | pub const generic: AddrSpace = @fromBackingInt(@intCast(4)); |
| 1980 | pub const device_only_intel: AddrSpace = @enumFromInt(5); | 1980 | pub const device_only_intel: AddrSpace = @fromBackingInt(@intCast(5)); |
| 1981 | pub const host_only_intel: AddrSpace = @enumFromInt(6); | 1981 | pub const host_only_intel: AddrSpace = @fromBackingInt(@intCast(6)); |
| 1982 | pub const input: AddrSpace = @enumFromInt(7); | 1982 | pub const input: AddrSpace = @fromBackingInt(@intCast(7)); |
| 1983 | }; | 1983 | }; |
| 1984 | 1984 | ||
| 1985 | // See llvm/include/llvm/CodeGen/WasmAddressSpaces.h | 1985 | // See llvm/include/llvm/CodeGen/WasmAddressSpaces.h |
| 1986 | pub const wasm = struct { | 1986 | pub const wasm = struct { |
| 1987 | pub const default: AddrSpace = @enumFromInt(0); | 1987 | pub const default: AddrSpace = @fromBackingInt(@intCast(0)); |
| 1988 | pub const variable: AddrSpace = @enumFromInt(1); | 1988 | pub const variable: AddrSpace = @fromBackingInt(@intCast(1)); |
| 1989 | pub const externref: AddrSpace = @enumFromInt(10); | 1989 | pub const externref: AddrSpace = @fromBackingInt(@intCast(10)); |
| 1990 | pub const funcref: AddrSpace = @enumFromInt(20); | 1990 | pub const funcref: AddrSpace = @fromBackingInt(@intCast(20)); |
| 1991 | }; | 1991 | }; |
| 1992 | 1992 | ||
| 1993 | pub fn format(addr_space: AddrSpace, w: *Writer) Writer.Error!void { | 1993 | pub fn format(addr_space: AddrSpace, w: *Writer) Writer.Error!void { |
| ... | @@ -2030,20 +2030,20 @@ pub const Alignment = enum(u6) { | ... | @@ -2030,20 +2030,20 @@ pub const Alignment = enum(u6) { |
| 2030 | _, | 2030 | _, |
| 2031 | 2031 | ||
| 2032 | pub fn wrap(a: Alignment) Lazy { | 2032 | pub fn wrap(a: Alignment) Lazy { |
| 2033 | return @enumFromInt(@intFromEnum(a)); | 2033 | return @fromBackingInt(@intCast(@backingInt(a))); |
| 2034 | } | 2034 | } |
| 2035 | pub fn resolve(l: Lazy, b: *const Builder) Alignment { | 2035 | pub fn resolve(l: Lazy, b: *const Builder) Alignment { |
| 2036 | return switch (@intFromEnum(l)) { | 2036 | return switch (@backingInt(l)) { |
| 2037 | 0...maxInt(u6) => |raw| @enumFromInt(raw), | 2037 | 0...maxInt(u6) => |raw| @fromBackingInt(@intCast(raw)), |
| 2038 | else => |offset_index| b.alignment_forward_references.items[offset_index - maxInt(u6)], | 2038 | else => |offset_index| b.alignment_forward_references.items[offset_index - maxInt(u6)], |
| 2039 | }; | 2039 | }; |
| 2040 | } | 2040 | } |
| 2041 | 2041 | ||
| 2042 | fn fromFwdRefIndex(index: usize) Lazy { | 2042 | fn fromFwdRefIndex(index: usize) Lazy { |
| 2043 | return @enumFromInt(index + maxInt(u6)); | 2043 | return @fromBackingInt(@intCast(index + maxInt(u6))); |
| 2044 | } | 2044 | } |
| 2045 | fn toFwdRefIndex(l: Lazy) usize { | 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,13 +2051,13 @@ pub const Alignment = enum(u6) { |
| 2051 | if (bytes == 0) return .default; | 2051 | if (bytes == 0) return .default; |
| 2052 | assert(std.math.isPowerOfTwo(bytes)); | 2052 | assert(std.math.isPowerOfTwo(bytes)); |
| 2053 | assert(bytes <= 1 << 32); | 2053 | assert(bytes <= 1 << 32); |
| 2054 | return @enumFromInt(@ctz(bytes)); | 2054 | return @fromBackingInt(@intCast(@ctz(bytes))); |
| 2055 | } | 2055 | } |
| 2056 | 2056 | ||
| 2057 | pub fn toByteUnits(self: Alignment) ?u64 { | 2057 | pub fn toByteUnits(self: Alignment) ?u64 { |
| 2058 | return switch (self) { | 2058 | return switch (self) { |
| 2059 | .default => null, | 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,13 +2065,13 @@ pub const Alignment = enum(u6) { |
| 2065 | pub fn max(a: Alignment, b: Alignment) Alignment { | 2065 | pub fn max(a: Alignment, b: Alignment) Alignment { |
| 2066 | assert(a != .default); | 2066 | assert(a != .default); |
| 2067 | assert(b != .default); | 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 | pub fn toLlvm(self: Alignment) u6 { | 2071 | pub fn toLlvm(self: Alignment) u6 { |
| 2072 | return switch (self) { | 2072 | return switch (self) { |
| 2073 | .default => 0, | 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,7 +2214,7 @@ pub const CallConv = enum(u10) { |
| 2214 | .m68k_rtdcc, | 2214 | .m68k_rtdcc, |
| 2215 | .riscv_vectorcallcc, | 2215 | .riscv_vectorcallcc, |
| 2216 | => try w.print(" {s}", .{@tagName(self)}), | 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,7 +2244,7 @@ pub const StrtabString = enum(u32) { |
| 2244 | fn format(data: FormatData, w: *Writer) Writer.Error!void { | 2244 | fn format(data: FormatData, w: *Writer) Writer.Error!void { |
| 2245 | assert(data.string != .none); | 2245 | assert(data.string != .none); |
| 2246 | const string_slice = data.string.slice(data.builder) orelse | 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 | const quote_behavior = data.quote_behavior orelse return w.writeAll(string_slice); | 2248 | const quote_behavior = data.quote_behavior orelse return w.writeAll(string_slice); |
| 2249 | return printEscapedString(string_slice, quote_behavior, w); | 2249 | return printEscapedString(string_slice, quote_behavior, w); |
| 2250 | } | 2250 | } |
| ... | @@ -2261,12 +2261,12 @@ pub const StrtabString = enum(u32) { | ... | @@ -2261,12 +2261,12 @@ pub const StrtabString = enum(u32) { |
| 2261 | } | 2261 | } |
| 2262 | 2262 | ||
| 2263 | fn fromIndex(index: ?usize) StrtabString { | 2263 | fn fromIndex(index: ?usize) StrtabString { |
| 2264 | return @enumFromInt(@as(u32, @intCast((index orelse return .none) + | 2264 | return @fromBackingInt(@intCast(@as(u32, @intCast((index orelse return .none) + |
| 2265 | @intFromEnum(StrtabString.empty)))); | 2265 | @backingInt(StrtabString.empty))))); |
| 2266 | } | 2266 | } |
| 2267 | 2267 | ||
| 2268 | fn toIndex(self: StrtabString) ?usize { | 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 | const Adapter = struct { | 2272 | const Adapter = struct { |
| ... | @@ -2354,7 +2354,7 @@ pub const Global = struct { | ... | @@ -2354,7 +2354,7 @@ pub const Global = struct { |
| 2354 | pub fn unwrap(orig_index: Index, builder: *const Builder) Index { | 2354 | pub fn unwrap(orig_index: Index, builder: *const Builder) Index { |
| 2355 | var cur = orig_index; | 2355 | var cur = orig_index; |
| 2356 | while (true) { | 2356 | while (true) { |
| 2357 | switch (builder.globals.values()[@intFromEnum(cur)].kind) { | 2357 | switch (builder.globals.values()[@backingInt(cur)].kind) { |
| 2358 | .replaced => |replacement| cur = replacement, | 2358 | .replaced => |replacement| cur = replacement, |
| 2359 | else => return cur, | 2359 | else => return cur, |
| 2360 | } | 2360 | } |
| ... | @@ -2366,15 +2366,15 @@ pub const Global = struct { | ... | @@ -2366,15 +2366,15 @@ pub const Global = struct { |
| 2366 | } | 2366 | } |
| 2367 | 2367 | ||
| 2368 | pub fn ptr(self: Index, builder: *Builder) *Global { | 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 | pub fn ptrConst(self: Index, builder: *const Builder) *const Global { | 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 | pub fn name(self: Index, builder: *const Builder) StrtabString { | 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 | pub fn strtab(self: Index, builder: *const Builder) struct { | 2380 | pub fn strtab(self: Index, builder: *const Builder) struct { |
| ... | @@ -2398,7 +2398,7 @@ pub const Global = struct { | ... | @@ -2398,7 +2398,7 @@ pub const Global = struct { |
| 2398 | } | 2398 | } |
| 2399 | 2399 | ||
| 2400 | pub fn toConst(global: Index) Constant { | 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 | pub fn toValue(global: Index) Value { | 2404 | pub fn toValue(global: Index) Value { |
| ... | @@ -2468,7 +2468,7 @@ pub const Global = struct { | ... | @@ -2468,7 +2468,7 @@ pub const Global = struct { |
| 2468 | pub fn toNewFunction(global: Index, builder: *Builder) Allocator.Error!Function.Index { | 2468 | pub fn toNewFunction(global: Index, builder: *Builder) Allocator.Error!Function.Index { |
| 2469 | try builder.functions.ensureUnusedCapacity(builder.gpa, 1); | 2469 | try builder.functions.ensureUnusedCapacity(builder.gpa, 1); |
| 2470 | errdefer comptime unreachable; | 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 | builder.functions.appendAssumeCapacity(.{ | 2472 | builder.functions.appendAssumeCapacity(.{ |
| 2473 | .global = global, | 2473 | .global = global, |
| 2474 | .strip = undefined, | 2474 | .strip = undefined, |
| ... | @@ -2482,7 +2482,7 @@ pub const Global = struct { | ... | @@ -2482,7 +2482,7 @@ pub const Global = struct { |
| 2482 | pub fn toNewVariable(global: Index, builder: *Builder) Allocator.Error!Variable.Index { | 2482 | pub fn toNewVariable(global: Index, builder: *Builder) Allocator.Error!Variable.Index { |
| 2483 | try builder.variables.ensureUnusedCapacity(builder.gpa, 1); | 2483 | try builder.variables.ensureUnusedCapacity(builder.gpa, 1); |
| 2484 | errdefer comptime unreachable; | 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 | builder.variables.appendAssumeCapacity(.{ .global = global }); | 2486 | builder.variables.appendAssumeCapacity(.{ .global = global }); |
| 2487 | global.ptr(builder).kind = .{ .variable = variable }; | 2487 | global.ptr(builder).kind = .{ .variable = variable }; |
| 2488 | return variable; | 2488 | return variable; |
| ... | @@ -2493,7 +2493,7 @@ pub const Global = struct { | ... | @@ -2493,7 +2493,7 @@ pub const Global = struct { |
| 2493 | pub fn toNewAlias(global: Index, builder: *Builder) Allocator.Error!Alias.Index { | 2493 | pub fn toNewAlias(global: Index, builder: *Builder) Allocator.Error!Alias.Index { |
| 2494 | try builder.aliases.ensureUnusedCapacity(builder.gpa, 1); | 2494 | try builder.aliases.ensureUnusedCapacity(builder.gpa, 1); |
| 2495 | errdefer comptime unreachable; | 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 | builder.aliass.appendAssumeCapacity(.{ .global = global, .aliasee = .none }); | 2497 | builder.aliass.appendAssumeCapacity(.{ .global = global, .aliasee = .none }); |
| 2498 | global.ptr(builder).kind = .{ .alias = alias }; | 2498 | global.ptr(builder).kind = .{ .alias = alias }; |
| 2499 | return alias; | 2499 | return alias; |
| ... | @@ -2522,11 +2522,11 @@ pub const Global = struct { | ... | @@ -2522,11 +2522,11 @@ pub const Global = struct { |
| 2522 | fn renameAssumeCapacity(self: Index, new_name: StrtabString, builder: *Builder) void { | 2522 | fn renameAssumeCapacity(self: Index, new_name: StrtabString, builder: *Builder) void { |
| 2523 | const old_name = self.name(builder); | 2523 | const old_name = self.name(builder); |
| 2524 | if (new_name == old_name) return; | 2524 | if (new_name == old_name) return; |
| 2525 | const index = @intFromEnum(self.unwrap(builder)); | 2525 | const index = @backingInt(self.unwrap(builder)); |
| 2526 | _ = builder.addGlobalAssumeCapacity(new_name, builder.globals.values()[index]); | 2526 | _ = builder.addGlobalAssumeCapacity(new_name, builder.globals.values()[index]); |
| 2527 | builder.globals.swapRemoveAt(index); | 2527 | builder.globals.swapRemoveAt(index); |
| 2528 | if (!old_name.isAnon()) return; | 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 | if (builder.next_unnamed_global == old_name) return; | 2530 | if (builder.next_unnamed_global == old_name) return; |
| 2531 | builder.getGlobal(builder.next_unnamed_global).?.renameAssumeCapacity(old_name, builder); | 2531 | builder.getGlobal(builder.next_unnamed_global).?.renameAssumeCapacity(old_name, builder); |
| 2532 | } | 2532 | } |
| ... | @@ -2539,7 +2539,7 @@ pub const Global = struct { | ... | @@ -2539,7 +2539,7 @@ pub const Global = struct { |
| 2539 | 2539 | ||
| 2540 | fn replaceAssumeCapacity(self: Index, other: Index, builder: *Builder) void { | 2540 | fn replaceAssumeCapacity(self: Index, other: Index, builder: *Builder) void { |
| 2541 | if (self.eql(other, builder)) return; | 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 | self.renameAssumeCapacity(builder.next_replaced_global, builder); | 2543 | self.renameAssumeCapacity(builder.next_replaced_global, builder); |
| 2544 | self.ptr(builder).kind = .{ .replaced = other.unwrap(builder) }; | 2544 | self.ptr(builder).kind = .{ .replaced = other.unwrap(builder) }; |
| 2545 | } | 2545 | } |
| ... | @@ -2556,11 +2556,11 @@ pub const Alias = struct { | ... | @@ -2556,11 +2556,11 @@ pub const Alias = struct { |
| 2556 | _, | 2556 | _, |
| 2557 | 2557 | ||
| 2558 | pub fn ptr(self: Index, builder: *Builder) *Alias { | 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 | pub fn ptrConst(self: Index, builder: *const Builder) *const Alias { | 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 | pub fn name(self: Index, builder: *const Builder) StrtabString { | 2566 | pub fn name(self: Index, builder: *const Builder) StrtabString { |
| ... | @@ -2608,11 +2608,11 @@ pub const Variable = struct { | ... | @@ -2608,11 +2608,11 @@ pub const Variable = struct { |
| 2608 | _, | 2608 | _, |
| 2609 | 2609 | ||
| 2610 | pub fn ptr(self: Index, builder: *Builder) *Variable { | 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 | pub fn ptrConst(self: Index, builder: *const Builder) *const Variable { | 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 | pub fn name(self: Index, builder: *const Builder) StrtabString { | 2618 | pub fn name(self: Index, builder: *const Builder) StrtabString { |
| ... | @@ -4119,11 +4119,11 @@ pub const Function = struct { | ... | @@ -4119,11 +4119,11 @@ pub const Function = struct { |
| 4119 | _, | 4119 | _, |
| 4120 | 4120 | ||
| 4121 | pub fn ptr(self: Index, builder: *Builder) *Function { | 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 | pub fn ptrConst(self: Index, builder: *const Builder) *const Function { | 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 | pub fn name(self: Index, builder: *const Builder) StrtabString { | 4129 | pub fn name(self: Index, builder: *const Builder) StrtabString { |
| ... | @@ -4479,19 +4479,19 @@ pub const Function = struct { | ... | @@ -4479,19 +4479,19 @@ pub const Function = struct { |
| 4479 | _, | 4479 | _, |
| 4480 | 4480 | ||
| 4481 | pub fn name(self: Instruction.Index, function: *const Function) String { | 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 | pub fn valueIndex(self: Instruction.Index, function: *const Function) u32 { | 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 | pub fn toValue(self: Instruction.Index) Value { | 4489 | pub fn toValue(self: Instruction.Index) Value { |
| 4490 | return @enumFromInt(@intFromEnum(self)); | 4490 | return @fromBackingInt(@intCast(@backingInt(self))); |
| 4491 | } | 4491 | } |
| 4492 | 4492 | ||
| 4493 | pub fn isTerminatorWip(self: Instruction.Index, wip: *const WipFunction) bool { | 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 | .br, | 4495 | .br, |
| 4496 | .br_cond, | 4496 | .br_cond, |
| 4497 | .indirectbr, | 4497 | .indirectbr, |
| ... | @@ -4505,7 +4505,7 @@ pub const Function = struct { | ... | @@ -4505,7 +4505,7 @@ pub const Function = struct { |
| 4505 | } | 4505 | } |
| 4506 | 4506 | ||
| 4507 | pub fn hasResultWip(self: Instruction.Index, wip: *const WipFunction) bool { | 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 | .br, | 4509 | .br, |
| 4510 | .br_cond, | 4510 | .br_cond, |
| 4511 | .fence, | 4511 | .fence, |
| ... | @@ -4532,7 +4532,7 @@ pub const Function = struct { | ... | @@ -4532,7 +4532,7 @@ pub const Function = struct { |
| 4532 | } | 4532 | } |
| 4533 | 4533 | ||
| 4534 | pub fn typeOfWip(self: Instruction.Index, wip: *const WipFunction) Type { | 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 | return switch (instruction.tag) { | 4536 | return switch (instruction.tag) { |
| 4537 | .add, | 4537 | .add, |
| 4538 | .@"add nsw", | 4538 | .@"add nsw", |
| ... | @@ -4679,7 +4679,7 @@ pub const Function = struct { | ... | @@ -4679,7 +4679,7 @@ pub const Function = struct { |
| 4679 | .changeScalarAssumeCapacity(.i1, wip.builder), | 4679 | .changeScalarAssumeCapacity(.i1, wip.builder), |
| 4680 | .fneg, | 4680 | .fneg, |
| 4681 | .@"fneg fast", | 4681 | .@"fneg fast", |
| 4682 | => @as(Value, @enumFromInt(instruction.data)).typeOfWip(wip), | 4682 | => @as(Value, @fromBackingInt(@intCast(instruction.data))).typeOfWip(wip), |
| 4683 | .getelementptr, | 4683 | .getelementptr, |
| 4684 | .@"getelementptr inbounds", | 4684 | .@"getelementptr inbounds", |
| 4685 | => { | 4685 | => { |
| ... | @@ -4721,7 +4721,7 @@ pub const Function = struct { | ... | @@ -4721,7 +4721,7 @@ pub const Function = struct { |
| 4721 | builder: *Builder, | 4721 | builder: *Builder, |
| 4722 | ) Type { | 4722 | ) Type { |
| 4723 | const function = function_index.ptrConst(builder); | 4723 | const function = function_index.ptrConst(builder); |
| 4724 | const instruction = function.instructions.get(@intFromEnum(self)); | 4724 | const instruction = function.instructions.get(@backingInt(self)); |
| 4725 | return switch (instruction.tag) { | 4725 | return switch (instruction.tag) { |
| 4726 | .add, | 4726 | .add, |
| 4727 | .@"add nsw", | 4727 | .@"add nsw", |
| ... | @@ -4871,7 +4871,7 @@ pub const Function = struct { | ... | @@ -4871,7 +4871,7 @@ pub const Function = struct { |
| 4871 | .changeScalarAssumeCapacity(.i1, builder), | 4871 | .changeScalarAssumeCapacity(.i1, builder), |
| 4872 | .fneg, | 4872 | .fneg, |
| 4873 | .@"fneg fast", | 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 | .getelementptr, | 4875 | .getelementptr, |
| 4876 | .@"getelementptr inbounds", | 4876 | .@"getelementptr inbounds", |
| 4877 | => { | 4877 | => { |
| ... | @@ -4963,11 +4963,11 @@ pub const Function = struct { | ... | @@ -4963,11 +4963,11 @@ pub const Function = struct { |
| 4963 | 4963 | ||
| 4964 | pub fn fromMetadata(metadata: Metadata) Weights { | 4964 | pub fn fromMetadata(metadata: Metadata) Weights { |
| 4965 | assert(metadata.kind == .node); | 4965 | assert(metadata.kind == .node); |
| 4966 | return @enumFromInt(metadata.index); | 4966 | return @fromBackingInt(@intCast(metadata.index)); |
| 4967 | } | 4967 | } |
| 4968 | 4968 | ||
| 4969 | pub fn toMetadata(weights: Weights) Metadata { | 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,7 +5156,7 @@ pub const Function = struct { |
| 5156 | assert(argument.tag == .arg); | 5156 | assert(argument.tag == .arg); |
| 5157 | assert(argument.data == index); | 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 | return argument_index.toValue(); | 5160 | return argument_index.toValue(); |
| 5161 | } | 5161 | } |
| 5162 | 5162 | ||
| ... | @@ -5202,7 +5202,7 @@ pub const Function = struct { | ... | @@ -5202,7 +5202,7 @@ pub const Function = struct { |
| 5202 | Type, | 5202 | Type, |
| 5203 | Value, | 5203 | Value, |
| 5204 | Instruction.BrCond.Weights, | 5204 | Instruction.BrCond.Weights, |
| 5205 | => @enumFromInt(value), | 5205 | => @fromBackingInt(@intCast(value)), |
| 5206 | MemoryAccessInfo, | 5206 | MemoryAccessInfo, |
| 5207 | Instruction.Alloca.Info, | 5207 | Instruction.Alloca.Info, |
| 5208 | Instruction.Call.Info, | 5208 | Instruction.Call.Info, |
| ... | @@ -5271,15 +5271,15 @@ pub const WipFunction = struct { | ... | @@ -5271,15 +5271,15 @@ pub const WipFunction = struct { |
| 5271 | _, | 5271 | _, |
| 5272 | 5272 | ||
| 5273 | pub fn ptr(self: Index, wip: *WipFunction) *Block { | 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 | pub fn ptrConst(self: Index, wip: *const WipFunction) *const Block { | 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 | pub fn toInst(self: Index, function: *const Function) Instruction.Index { | 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,14 +5327,14 @@ pub const WipFunction = struct { |
| 5327 | assert(argument.tag == .arg); | 5327 | assert(argument.tag == .arg); |
| 5328 | assert(argument.data == index); | 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 | return argument_index.toValue(); | 5331 | return argument_index.toValue(); |
| 5332 | } | 5332 | } |
| 5333 | 5333 | ||
| 5334 | pub fn block(self: *WipFunction, incoming: u32, name: []const u8) Allocator.Error!Block.Index { | 5334 | pub fn block(self: *WipFunction, incoming: u32, name: []const u8) Allocator.Error!Block.Index { |
| 5335 | try self.blocks.ensureUnusedCapacity(self.builder.gpa, 1); | 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 | const final_name = if (self.strip) .empty else try self.builder.string(name); | 5338 | const final_name = if (self.strip) .empty else try self.builder.string(name); |
| 5339 | self.blocks.appendAssumeCapacity(.{ | 5339 | self.blocks.appendAssumeCapacity(.{ |
| 5340 | .name = final_name, | 5340 | .name = final_name, |
| ... | @@ -5347,7 +5347,7 @@ pub const WipFunction = struct { | ... | @@ -5347,7 +5347,7 @@ pub const WipFunction = struct { |
| 5347 | pub fn ret(self: *WipFunction, val: Value) Allocator.Error!Instruction.Index { | 5347 | pub fn ret(self: *WipFunction, val: Value) Allocator.Error!Instruction.Index { |
| 5348 | assert(val.typeOfWip(self) == self.function.typeOf(self.builder).functionReturn(self.builder)); | 5348 | assert(val.typeOfWip(self) == self.function.typeOf(self.builder).functionReturn(self.builder)); |
| 5349 | try self.ensureUnusedExtraCapacity(1, NoExtra, 0); | 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 | pub fn retVoid(self: *WipFunction) Allocator.Error!Instruction.Index { | 5353 | pub fn retVoid(self: *WipFunction) Allocator.Error!Instruction.Index { |
| ... | @@ -5357,7 +5357,7 @@ pub const WipFunction = struct { | ... | @@ -5357,7 +5357,7 @@ pub const WipFunction = struct { |
| 5357 | 5357 | ||
| 5358 | pub fn br(self: *WipFunction, dest: Block.Index) Allocator.Error!Instruction.Index { | 5358 | pub fn br(self: *WipFunction, dest: Block.Index) Allocator.Error!Instruction.Index { |
| 5359 | try self.ensureUnusedExtraCapacity(1, NoExtra, 0); | 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 | dest.ptr(self).branches += 1; | 5361 | dest.ptr(self).branches += 1; |
| 5362 | return instruction; | 5362 | return instruction; |
| 5363 | } | 5363 | } |
| ... | @@ -5409,7 +5409,7 @@ pub const WipFunction = struct { | ... | @@ -5409,7 +5409,7 @@ pub const WipFunction = struct { |
| 5409 | dest: Block.Index, | 5409 | dest: Block.Index, |
| 5410 | wip: *WipFunction, | 5410 | wip: *WipFunction, |
| 5411 | ) Allocator.Error!void { | 5411 | ) Allocator.Error!void { |
| 5412 | const instruction = wip.instructions.get(@intFromEnum(self.instruction)); | 5412 | const instruction = wip.instructions.get(@backingInt(self.instruction)); |
| 5413 | var extra = wip.extraDataTrail(Instruction.Switch, instruction.data); | 5413 | var extra = wip.extraDataTrail(Instruction.Switch, instruction.data); |
| 5414 | assert(val.typeOf(wip.builder) == extra.data.val.typeOfWip(wip)); | 5414 | assert(val.typeOf(wip.builder) == extra.data.val.typeOfWip(wip)); |
| 5415 | extra.trail.nextMut(extra.data.cases_len, Constant, wip)[self.index] = val; | 5415 | extra.trail.nextMut(extra.data.cases_len, Constant, wip)[self.index] = val; |
| ... | @@ -5419,7 +5419,7 @@ pub const WipFunction = struct { | ... | @@ -5419,7 +5419,7 @@ pub const WipFunction = struct { |
| 5419 | } | 5419 | } |
| 5420 | 5420 | ||
| 5421 | pub fn finish(self: WipSwitch, wip: *WipFunction) void { | 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 | const extra = wip.extraData(Instruction.Switch, instruction.data); | 5423 | const extra = wip.extraData(Instruction.Switch, instruction.data); |
| 5424 | assert(self.index == extra.cases_len); | 5424 | assert(self.index == extra.cases_len); |
| 5425 | } | 5425 | } |
| ... | @@ -5483,7 +5483,7 @@ pub const WipFunction = struct { | ... | @@ -5483,7 +5483,7 @@ pub const WipFunction = struct { |
| 5483 | else => unreachable, | 5483 | else => unreachable, |
| 5484 | } | 5484 | } |
| 5485 | try self.ensureUnusedExtraCapacity(1, NoExtra, 0); | 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 | return instruction.toValue(); | 5487 | return instruction.toValue(); |
| 5488 | } | 5488 | } |
| 5489 | 5489 | ||
| ... | @@ -6060,7 +6060,7 @@ pub const WipFunction = struct { | ... | @@ -6060,7 +6060,7 @@ pub const WipFunction = struct { |
| 6060 | ) void { | 6060 | ) void { |
| 6061 | const incoming_len = self.block.ptrConst(wip).incoming; | 6061 | const incoming_len = self.block.ptrConst(wip).incoming; |
| 6062 | assert(vals.len == incoming_len and blocks.len == incoming_len); | 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 | var extra = wip.extraDataTrail(Instruction.Phi, instruction.data); | 6064 | var extra = wip.extraDataTrail(Instruction.Phi, instruction.data); |
| 6065 | for (vals) |val| assert(val.typeOfWip(wip) == extra.data.type); | 6065 | for (vals) |val| assert(val.typeOfWip(wip) == extra.data.type); |
| 6066 | @memcpy(extra.trail.nextMut(incoming_len, Value, wip), vals); | 6066 | @memcpy(extra.trail.nextMut(incoming_len, Value, wip), vals); |
| ... | @@ -6326,7 +6326,7 @@ pub const WipFunction = struct { | ... | @@ -6326,7 +6326,7 @@ pub const WipFunction = struct { |
| 6326 | if (val == .none) return .none; | 6326 | if (val == .none) return .none; |
| 6327 | return switch (val.unwrap()) { | 6327 | return switch (val.unwrap()) { |
| 6328 | .instruction => |instruction| instructions.items[ | 6328 | .instruction => |instruction| instructions.items[ |
| 6329 | @intFromEnum(instruction) | 6329 | @backingInt(instruction) |
| 6330 | ].toValue(), | 6330 | ].toValue(), |
| 6331 | .constant => |constant| constant.toValue(), | 6331 | .constant => |constant| constant.toValue(), |
| 6332 | .metadata => |metadata| metadata.toValue(), | 6332 | .metadata => |metadata| metadata.toValue(), |
| ... | @@ -6366,7 +6366,7 @@ pub const WipFunction = struct { | ... | @@ -6366,7 +6366,7 @@ pub const WipFunction = struct { |
| 6366 | Type, | 6366 | Type, |
| 6367 | Value, | 6367 | Value, |
| 6368 | Instruction.BrCond.Weights, | 6368 | Instruction.BrCond.Weights, |
| 6369 | => @intFromEnum(value), | 6369 | => @backingInt(value), |
| 6370 | MemoryAccessInfo, | 6370 | MemoryAccessInfo, |
| 6371 | Instruction.Alloca.Info, | 6371 | Instruction.Alloca.Info, |
| 6372 | Instruction.Call.Info, | 6372 | Instruction.Call.Info, |
| ... | @@ -6388,7 +6388,7 @@ pub const WipFunction = struct { | ... | @@ -6388,7 +6388,7 @@ pub const WipFunction = struct { |
| 6388 | 6388 | ||
| 6389 | fn appendMappedValues(wip_extra: *@This(), vals: []const Value, ctx: anytype) void { | 6389 | fn appendMappedValues(wip_extra: *@This(), vals: []const Value, ctx: anytype) void { |
| 6390 | for (wip_extra.items[wip_extra.index..][0..vals.len], vals) |*extra, val| | 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 | wip_extra.index += @intCast(vals.len); | 6392 | wip_extra.index += @intCast(vals.len); |
| 6393 | } | 6393 | } |
| 6394 | 6394 | ||
| ... | @@ -6414,24 +6414,24 @@ pub const WipFunction = struct { | ... | @@ -6414,24 +6414,24 @@ pub const WipFunction = struct { |
| 6414 | errdefer function.instructions.shrinkRetainingCapacity(0); | 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 | for (0..params_len) |param_index| { | 6418 | for (0..params_len) |param_index| { |
| 6419 | instructions.items[param_index] = final_instruction_index; | 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 | for (blocks, self.blocks.items) |*final_block, current_block| { | 6422 | for (blocks, self.blocks.items) |*final_block, current_block| { |
| 6423 | assert(current_block.incoming == current_block.branches); | 6423 | assert(current_block.incoming == current_block.branches); |
| 6424 | final_block.instruction = final_instruction_index; | 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 | for (current_block.instructions.items) |instruction| { | 6426 | for (current_block.instructions.items) |instruction| { |
| 6427 | instructions.items[@intFromEnum(instruction)] = final_instruction_index; | 6427 | instructions.items[@backingInt(instruction)] = final_instruction_index; |
| 6428 | final_instruction_index = @enumFromInt(@intFromEnum(final_instruction_index) + 1); | 6428 | final_instruction_index = @fromBackingInt(@intCast(@backingInt(final_instruction_index) + 1)); |
| 6429 | } | 6429 | } |
| 6430 | } | 6430 | } |
| 6431 | } | 6431 | } |
| 6432 | 6432 | ||
| 6433 | var wip_name: struct { | 6433 | var wip_name: struct { |
| 6434 | next_name: String = @enumFromInt(0), | 6434 | next_name: String = @fromBackingInt(@intCast(0)), |
| 6435 | next_unique_name: std.AutoHashMap(String, String), | 6435 | next_unique_name: std.AutoHashMap(String, String), |
| 6436 | builder: *Builder, | 6436 | builder: *Builder, |
| 6437 | 6437 | ||
| ... | @@ -6440,19 +6440,19 @@ pub const WipFunction = struct { | ... | @@ -6440,19 +6440,19 @@ pub const WipFunction = struct { |
| 6440 | .none => return .none, | 6440 | .none => return .none, |
| 6441 | .empty => { | 6441 | .empty => { |
| 6442 | assert(wip_name.next_name != .none); | 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 | return wip_name.next_name; | 6444 | return wip_name.next_name; |
| 6445 | }, | 6445 | }, |
| 6446 | _ => { | 6446 | _ => { |
| 6447 | assert(!name.isAnon()); | 6447 | assert(!name.isAnon()); |
| 6448 | const gop = try wip_name.next_unique_name.getOrPut(name); | 6448 | const gop = try wip_name.next_unique_name.getOrPut(name); |
| 6449 | if (!gop.found_existing) { | 6449 | if (!gop.found_existing) { |
| 6450 | gop.value_ptr.* = @enumFromInt(0); | 6450 | gop.value_ptr.* = @fromBackingInt(@intCast(0)); |
| 6451 | return name; | 6451 | return name; |
| 6452 | } | 6452 | } |
| 6453 | 6453 | ||
| 6454 | while (true) { | 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 | const unique_name = try wip_name.builder.fmt("{f}{s}{f}", .{ | 6456 | const unique_name = try wip_name.builder.fmt("{f}{s}{f}", .{ |
| 6457 | name.fmtRaw(wip_name.builder), | 6457 | name.fmtRaw(wip_name.builder), |
| 6458 | sep, | 6458 | sep, |
| ... | @@ -6460,7 +6460,7 @@ pub const WipFunction = struct { | ... | @@ -6460,7 +6460,7 @@ pub const WipFunction = struct { |
| 6460 | }); | 6460 | }); |
| 6461 | const unique_gop = try wip_name.next_unique_name.getOrPut(unique_name); | 6461 | const unique_gop = try wip_name.next_unique_name.getOrPut(unique_name); |
| 6462 | if (!unique_gop.found_existing) { | 6462 | if (!unique_gop.found_existing) { |
| 6463 | unique_gop.value_ptr.* = @enumFromInt(0); | 6463 | unique_gop.value_ptr.* = @fromBackingInt(@intCast(0)); |
| 6464 | return unique_name; | 6464 | return unique_name; |
| 6465 | } | 6465 | } |
| 6466 | } | 6466 | } |
| ... | @@ -6475,16 +6475,16 @@ pub const WipFunction = struct { | ... | @@ -6475,16 +6475,16 @@ pub const WipFunction = struct { |
| 6475 | 6475 | ||
| 6476 | var value_index: u32 = 0; | 6476 | var value_index: u32 = 0; |
| 6477 | for (0..params_len) |param_index| { | 6477 | for (0..params_len) |param_index| { |
| 6478 | const old_argument_index: Instruction.Index = @enumFromInt(param_index); | 6478 | const old_argument_index: Instruction.Index = @fromBackingInt(@intCast(param_index)); |
| 6479 | const new_argument_index: Instruction.Index = @enumFromInt(function.instructions.len); | 6479 | const new_argument_index: Instruction.Index = @fromBackingInt(@intCast(function.instructions.len)); |
| 6480 | const argument = self.instructions.get(@intFromEnum(old_argument_index)); | 6480 | const argument = self.instructions.get(@backingInt(old_argument_index)); |
| 6481 | assert(argument.tag == .arg); | 6481 | assert(argument.tag == .arg); |
| 6482 | assert(argument.data == param_index); | 6482 | assert(argument.data == param_index); |
| 6483 | value_indices[function.instructions.len] = value_index; | 6483 | value_indices[function.instructions.len] = value_index; |
| 6484 | value_index += 1; | 6484 | value_index += 1; |
| 6485 | function.instructions.appendAssumeCapacity(argument); | 6485 | function.instructions.appendAssumeCapacity(argument); |
| 6486 | names[@intFromEnum(new_argument_index)] = try wip_name.map( | 6486 | names[@backingInt(new_argument_index)] = try wip_name.map( |
| 6487 | if (self.strip) .empty else self.names.items[@intFromEnum(old_argument_index)], | 6487 | if (self.strip) .empty else self.names.items[@backingInt(old_argument_index)], |
| 6488 | ".", | 6488 | ".", |
| 6489 | ); | 6489 | ); |
| 6490 | if (self.debug_locations.get(old_argument_index)) |location| { | 6490 | if (self.debug_locations.get(old_argument_index)) |location| { |
| ... | @@ -6495,16 +6495,16 @@ pub const WipFunction = struct { | ... | @@ -6495,16 +6495,16 @@ pub const WipFunction = struct { |
| 6495 | } | 6495 | } |
| 6496 | } | 6496 | } |
| 6497 | for (self.blocks.items) |current_block| { | 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 | value_indices[function.instructions.len] = value_index; | 6499 | value_indices[function.instructions.len] = value_index; |
| 6500 | function.instructions.appendAssumeCapacity(.{ | 6500 | function.instructions.appendAssumeCapacity(.{ |
| 6501 | .tag = .block, | 6501 | .tag = .block, |
| 6502 | .data = current_block.incoming, | 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 | for (current_block.instructions.items) |old_instruction_index| { | 6505 | for (current_block.instructions.items) |old_instruction_index| { |
| 6506 | const new_instruction_index: Instruction.Index = @enumFromInt(function.instructions.len); | 6506 | const new_instruction_index: Instruction.Index = @fromBackingInt(@intCast(function.instructions.len)); |
| 6507 | var instruction = self.instructions.get(@intFromEnum(old_instruction_index)); | 6507 | var instruction = self.instructions.get(@backingInt(old_instruction_index)); |
| 6508 | switch (instruction.tag) { | 6508 | switch (instruction.tag) { |
| 6509 | .add, | 6509 | .add, |
| 6510 | .@"add nsw", | 6510 | .@"add nsw", |
| ... | @@ -6702,7 +6702,7 @@ pub const WipFunction = struct { | ... | @@ -6702,7 +6702,7 @@ pub const WipFunction = struct { |
| 6702 | .fneg, | 6702 | .fneg, |
| 6703 | .@"fneg fast", | 6703 | .@"fneg fast", |
| 6704 | .ret, | 6704 | .ret, |
| 6705 | => instruction.data = @intFromEnum(instructions.map(@enumFromInt(instruction.data))), | 6705 | => instruction.data = @backingInt(instructions.map(@fromBackingInt(@intCast(instruction.data)))), |
| 6706 | .getelementptr, | 6706 | .getelementptr, |
| 6707 | .@"getelementptr inbounds", | 6707 | .@"getelementptr inbounds", |
| 6708 | => { | 6708 | => { |
| ... | @@ -6815,10 +6815,10 @@ pub const WipFunction = struct { | ... | @@ -6815,10 +6815,10 @@ pub const WipFunction = struct { |
| 6815 | }, | 6815 | }, |
| 6816 | } | 6816 | } |
| 6817 | function.instructions.appendAssumeCapacity(instruction); | 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 | if (old_instruction_index.hasResultWip(self)) .empty else .none | 6819 | if (old_instruction_index.hasResultWip(self)) .empty else .none |
| 6820 | else | 6820 | else |
| 6821 | self.names.items[@intFromEnum(old_instruction_index)], "."); | 6821 | self.names.items[@backingInt(old_instruction_index)], "."); |
| 6822 | 6822 | ||
| 6823 | if (self.debug_locations.get(old_instruction_index)) |location| { | 6823 | if (self.debug_locations.get(old_instruction_index)) |location| { |
| 6824 | debug_locations.putAssumeCapacity(new_instruction_index, location); | 6824 | debug_locations.putAssumeCapacity(new_instruction_index, location); |
| ... | @@ -6828,7 +6828,7 @@ pub const WipFunction = struct { | ... | @@ -6828,7 +6828,7 @@ pub const WipFunction = struct { |
| 6828 | debug_values[index] = new_instruction_index; | 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 | if (old_instruction_index.hasResultWip(self)) value_index += 1; | 6832 | if (old_instruction_index.hasResultWip(self)) value_index += 1; |
| 6833 | } | 6833 | } |
| 6834 | } | 6834 | } |
| ... | @@ -6996,7 +6996,7 @@ pub const WipFunction = struct { | ... | @@ -6996,7 +6996,7 @@ pub const WipFunction = struct { |
| 6996 | else | 6996 | else |
| 6997 | .none; | 6997 | .none; |
| 6998 | 6998 | ||
| 6999 | const index: Instruction.Index = @enumFromInt(self.instructions.len); | 6999 | const index: Instruction.Index = @fromBackingInt(@intCast(self.instructions.len)); |
| 7000 | self.instructions.appendAssumeCapacity(instruction); | 7000 | self.instructions.appendAssumeCapacity(instruction); |
| 7001 | if (!self.strip) { | 7001 | if (!self.strip) { |
| 7002 | self.names.appendAssumeCapacity(final_name); | 7002 | self.names.appendAssumeCapacity(final_name); |
| ... | @@ -7026,7 +7026,7 @@ pub const WipFunction = struct { | ... | @@ -7026,7 +7026,7 @@ pub const WipFunction = struct { |
| 7026 | Type, | 7026 | Type, |
| 7027 | Value, | 7027 | Value, |
| 7028 | Instruction.BrCond.Weights, | 7028 | Instruction.BrCond.Weights, |
| 7029 | => @intFromEnum(value), | 7029 | => @backingInt(value), |
| 7030 | MemoryAccessInfo, | 7030 | MemoryAccessInfo, |
| 7031 | Instruction.Alloca.Info, | 7031 | Instruction.Alloca.Info, |
| 7032 | Instruction.Call.Info, | 7032 | Instruction.Call.Info, |
| ... | @@ -7079,7 +7079,7 @@ pub const WipFunction = struct { | ... | @@ -7079,7 +7079,7 @@ pub const WipFunction = struct { |
| 7079 | Type, | 7079 | Type, |
| 7080 | Value, | 7080 | Value, |
| 7081 | Instruction.BrCond.Weights, | 7081 | Instruction.BrCond.Weights, |
| 7082 | => @enumFromInt(value), | 7082 | => @fromBackingInt(@intCast(value)), |
| 7083 | MemoryAccessInfo, | 7083 | MemoryAccessInfo, |
| 7084 | Instruction.Alloca.Info, | 7084 | Instruction.Alloca.Info, |
| 7085 | Instruction.Call.Info, | 7085 | Instruction.Call.Info, |
| ... | @@ -7268,7 +7268,7 @@ pub const Constant = enum(u32) { | ... | @@ -7268,7 +7268,7 @@ pub const Constant = enum(u32) { |
| 7268 | no_init = (1 << 30) - 1, | 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 | pub const Tag = enum(u7) { | 7273 | pub const Tag = enum(u7) { |
| 7274 | positive_integer, | 7274 | positive_integer, |
| ... | @@ -7441,14 +7441,14 @@ pub const Constant = enum(u32) { | ... | @@ -7441,14 +7441,14 @@ pub const Constant = enum(u32) { |
| 7441 | constant: u30, | 7441 | constant: u30, |
| 7442 | global: Global.Index, | 7442 | global: Global.Index, |
| 7443 | } { | 7443 | } { |
| 7444 | return if (@intFromEnum(self) < @intFromEnum(first_global)) | 7444 | return if (@backingInt(self) < @backingInt(first_global)) |
| 7445 | .{ .constant = @intCast(@intFromEnum(self)) } | 7445 | .{ .constant = @intCast(@backingInt(self)) } |
| 7446 | else | 7446 | else |
| 7447 | .{ .global = @enumFromInt(@intFromEnum(self) - @intFromEnum(first_global)) }; | 7447 | .{ .global = @fromBackingInt(@intCast(@backingInt(self) - @backingInt(first_global))) }; |
| 7448 | } | 7448 | } |
| 7449 | 7449 | ||
| 7450 | pub fn toValue(self: Constant) Value { | 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 | pub fn typeOf(self: Constant, builder: *Builder) Type { | 7454 | pub fn typeOf(self: Constant, builder: *Builder) Type { |
| ... | @@ -7474,7 +7474,7 @@ pub const Constant = enum(u32) { | ... | @@ -7474,7 +7474,7 @@ pub const Constant = enum(u32) { |
| 7474 | .zeroinitializer, | 7474 | .zeroinitializer, |
| 7475 | .undef, | 7475 | .undef, |
| 7476 | .poison, | 7476 | .poison, |
| 7477 | => @enumFromInt(item.data), | 7477 | => @fromBackingInt(@intCast(item.data)), |
| 7478 | .structure, | 7478 | .structure, |
| 7479 | .packed_structure, | 7479 | .packed_structure, |
| 7480 | .array, | 7480 | .array, |
| ... | @@ -7482,7 +7482,7 @@ pub const Constant = enum(u32) { | ... | @@ -7482,7 +7482,7 @@ pub const Constant = enum(u32) { |
| 7482 | => builder.constantExtraData(Aggregate, item.data).type, | 7482 | => builder.constantExtraData(Aggregate, item.data).type, |
| 7483 | .splat => builder.constantExtraData(Splat, item.data).type, | 7483 | .splat => builder.constantExtraData(Splat, item.data).type, |
| 7484 | .string => builder.arrayTypeAssumeCapacity( | 7484 | .string => builder.arrayTypeAssumeCapacity( |
| 7485 | @as(String, @enumFromInt(item.data)).slice(builder).?.len, | 7485 | @as(String, @fromBackingInt(@intCast(item.data))).slice(builder).?.len, |
| 7486 | .i8, | 7486 | .i8, |
| 7487 | ), | 7487 | ), |
| 7488 | .blockaddress => builder.ptrTypeAssumeCapacity( | 7488 | .blockaddress => builder.ptrTypeAssumeCapacity( |
| ... | @@ -7491,7 +7491,7 @@ pub const Constant = enum(u32) { | ... | @@ -7491,7 +7491,7 @@ pub const Constant = enum(u32) { |
| 7491 | ), | 7491 | ), |
| 7492 | .dso_local_equivalent, | 7492 | .dso_local_equivalent, |
| 7493 | .no_cfi, | 7493 | .no_cfi, |
| 7494 | => builder.ptrTypeAssumeCapacity(@as(Function.Index, @enumFromInt(item.data)) | 7494 | => builder.ptrTypeAssumeCapacity(@as(Function.Index, @fromBackingInt(@intCast(item.data))) |
| 7495 | .ptrConst(builder).global.ptrConst(builder).addr_space), | 7495 | .ptrConst(builder).global.ptrConst(builder).addr_space), |
| 7496 | .trunc, | 7496 | .trunc, |
| 7497 | .ptrtoint, | 7497 | .ptrtoint, |
| ... | @@ -7802,7 +7802,7 @@ pub const Constant = enum(u32) { | ... | @@ -7802,7 +7802,7 @@ pub const Constant = enum(u32) { |
| 7802 | try w.writeByte('>'); | 7802 | try w.writeByte('>'); |
| 7803 | }, | 7803 | }, |
| 7804 | .string => try w.print("c{f}", .{ | 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 | .blockaddress => |tag| { | 7807 | .blockaddress => |tag| { |
| 7808 | const extra = data.builder.constantExtraData(BlockAddress, item.data); | 7808 | const extra = data.builder.constantExtraData(BlockAddress, item.data); |
| ... | @@ -7816,7 +7816,7 @@ pub const Constant = enum(u32) { | ... | @@ -7816,7 +7816,7 @@ pub const Constant = enum(u32) { |
| 7816 | .dso_local_equivalent, | 7816 | .dso_local_equivalent, |
| 7817 | .no_cfi, | 7817 | .no_cfi, |
| 7818 | => |tag| { | 7818 | => |tag| { |
| 7819 | const function: Function.Index = @enumFromInt(item.data); | 7819 | const function: Function.Index = @fromBackingInt(@intCast(item.data)); |
| 7820 | try w.print("{s} {f}", .{ | 7820 | try w.print("{s} {f}", .{ |
| 7821 | @tagName(tag), | 7821 | @tagName(tag), |
| 7822 | function.ptrConst(data.builder).global.fmt(data.builder), | 7822 | function.ptrConst(data.builder).global.fmt(data.builder), |
| ... | @@ -7905,10 +7905,10 @@ pub const Constant = enum(u32) { | ... | @@ -7905,10 +7905,10 @@ pub const Constant = enum(u32) { |
| 7905 | 7905 | ||
| 7906 | pub const Value = enum(u32) { | 7906 | pub const Value = enum(u32) { |
| 7907 | none = maxInt(u31), | 7907 | none = maxInt(u31), |
| 7908 | false = first_constant + @intFromEnum(Constant.false), | 7908 | false = first_constant + @backingInt(Constant.false), |
| 7909 | true = first_constant + @intFromEnum(Constant.true), | 7909 | true = first_constant + @backingInt(Constant.true), |
| 7910 | @"0" = first_constant + @intFromEnum(Constant.@"0"), | 7910 | @"0" = first_constant + @backingInt(Constant.@"0"), |
| 7911 | @"1" = first_constant + @intFromEnum(Constant.@"1"), | 7911 | @"1" = first_constant + @backingInt(Constant.@"1"), |
| 7912 | _, | 7912 | _, |
| 7913 | 7913 | ||
| 7914 | const first_constant = 1 << 30; | 7914 | const first_constant = 1 << 30; |
| ... | @@ -7919,12 +7919,12 @@ pub const Value = enum(u32) { | ... | @@ -7919,12 +7919,12 @@ pub const Value = enum(u32) { |
| 7919 | constant: Constant, | 7919 | constant: Constant, |
| 7920 | metadata: Metadata, | 7920 | metadata: Metadata, |
| 7921 | } { | 7921 | } { |
| 7922 | return if (@intFromEnum(self) < first_constant) | 7922 | return if (@backingInt(self) < first_constant) |
| 7923 | .{ .instruction = @enumFromInt(@intFromEnum(self)) } | 7923 | .{ .instruction = @fromBackingInt(@intCast(@backingInt(self))) } |
| 7924 | else if (@intFromEnum(self) < first_metadata) | 7924 | else if (@backingInt(self) < first_metadata) |
| 7925 | .{ .constant = @enumFromInt(@intFromEnum(self) - first_constant) } | 7925 | .{ .constant = @fromBackingInt(@intCast(@backingInt(self) - first_constant)) } |
| 7926 | else | 7926 | else |
| 7927 | .{ .metadata = @bitCast(@intFromEnum(self) - first_metadata) }; | 7927 | .{ .metadata = @bitCast(@backingInt(self) - first_metadata) }; |
| 7928 | } | 7928 | } |
| 7929 | 7929 | ||
| 7930 | pub fn typeOfWip(self: Value, wip: *const WipFunction) Type { | 7930 | pub fn typeOfWip(self: Value, wip: *const WipFunction) Type { |
| ... | @@ -8016,7 +8016,7 @@ pub const Metadata = packed struct(u32) { | ... | @@ -8016,7 +8016,7 @@ pub const Metadata = packed struct(u32) { |
| 8016 | return .{ .index = metadata.index, .kind = metadata.kind, .is_none = false }; | 8016 | return .{ .index = metadata.index, .kind = metadata.kind, .is_none = false }; |
| 8017 | } | 8017 | } |
| 8018 | pub fn toValue(metadata: Metadata) Value { | 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 | pub const String = enum(u32) { | 8022 | pub const String = enum(u32) { |
| ... | @@ -8032,7 +8032,7 @@ pub const Metadata = packed struct(u32) { | ... | @@ -8032,7 +8032,7 @@ pub const Metadata = packed struct(u32) { |
| 8032 | pub fn unwrap(metadata: Metadata.String.Optional) ?Metadata.String { | 8032 | pub fn unwrap(metadata: Metadata.String.Optional) ?Metadata.String { |
| 8033 | return switch (metadata) { | 8033 | return switch (metadata) { |
| 8034 | .none => null, | 8034 | .none => null, |
| 8035 | else => @enumFromInt(@intFromEnum(metadata)), | 8035 | else => @fromBackingInt(@intCast(@backingInt(metadata))), |
| 8036 | }; | 8036 | }; |
| 8037 | } | 8037 | } |
| 8038 | pub fn toMetadata(metadata: Metadata.String.Optional) Metadata.Optional { | 8038 | pub fn toMetadata(metadata: Metadata.String.Optional) Metadata.Optional { |
| ... | @@ -8040,14 +8040,14 @@ pub const Metadata = packed struct(u32) { | ... | @@ -8040,14 +8040,14 @@ pub const Metadata = packed struct(u32) { |
| 8040 | } | 8040 | } |
| 8041 | }; | 8041 | }; |
| 8042 | pub fn toOptional(metadata: Metadata.String) Metadata.String.Optional { | 8042 | pub fn toOptional(metadata: Metadata.String) Metadata.String.Optional { |
| 8043 | return @enumFromInt(@intFromEnum(metadata)); | 8043 | return @fromBackingInt(@intCast(@backingInt(metadata))); |
| 8044 | } | 8044 | } |
| 8045 | pub fn toMetadata(metadata: Metadata.String) Metadata { | 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 | pub fn slice(metadata: Metadata.String, builder: *const Builder) []const u8 { | 8049 | pub fn slice(metadata: Metadata.String, builder: *const Builder) []const u8 { |
| 8050 | const index = @intFromEnum(metadata); | 8050 | const index = @backingInt(metadata); |
| 8051 | const start = builder.metadata_string_indices.items[index]; | 8051 | const start = builder.metadata_string_indices.items[index]; |
| 8052 | const end = builder.metadata_string_indices.items[index + 1]; | 8052 | const end = builder.metadata_string_indices.items[index + 1]; |
| 8053 | return builder.metadata_string_bytes.items[start..end]; | 8053 | return builder.metadata_string_bytes.items[start..end]; |
| ... | @@ -8059,7 +8059,7 @@ pub const Metadata = packed struct(u32) { | ... | @@ -8059,7 +8059,7 @@ pub const Metadata = packed struct(u32) { |
| 8059 | return @truncate(std.hash.Wyhash.hash(0, key)); | 8059 | return @truncate(std.hash.Wyhash.hash(0, key)); |
| 8060 | } | 8060 | } |
| 8061 | pub fn eql(ctx: Adapter, lhs_key: []const u8, _: void, rhs_index: usize) bool { | 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 | return std.mem.eql(u8, lhs_key, rhs_metadata.slice(ctx.builder)); | 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,7 +8077,7 @@ pub const Metadata = packed struct(u32) { |
| 8077 | }; | 8077 | }; |
| 8078 | pub fn toString(metadata: Metadata) Metadata.String { | 8078 | pub fn toString(metadata: Metadata) Metadata.String { |
| 8079 | assert(metadata.kind == .string); | 8079 | assert(metadata.kind == .string); |
| 8080 | return @enumFromInt(metadata.index); | 8080 | return @fromBackingInt(@intCast(metadata.index)); |
| 8081 | } | 8081 | } |
| 8082 | 8082 | ||
| 8083 | pub const Tag = enum(u6) { | 8083 | pub const Tag = enum(u6) { |
| ... | @@ -8542,7 +8542,7 @@ pub const Metadata = packed struct(u32) { | ... | @@ -8542,7 +8542,7 @@ pub const Metadata = packed struct(u32) { |
| 8542 | try w.writeByte(')'); | 8542 | try w.writeByte(')'); |
| 8543 | }, | 8543 | }, |
| 8544 | .constant => try Constant.format(.{ | 8544 | .constant => try Constant.format(.{ |
| 8545 | .constant = @enumFromInt(node_item.data), | 8545 | .constant = @fromBackingInt(@intCast(node_item.data)), |
| 8546 | .builder = builder, | 8546 | .builder = builder, |
| 8547 | .flags = data.specialized orelse .{}, | 8547 | .flags = data.specialized orelse .{}, |
| 8548 | }, w), | 8548 | }, w), |
| ... | @@ -8744,7 +8744,7 @@ pub fn init(options: Options) Allocator.Error!Builder { | ... | @@ -8744,7 +8744,7 @@ pub fn init(options: Options) Allocator.Error!Builder { |
| 8744 | .string_bytes = .empty, | 8744 | .string_bytes = .empty, |
| 8745 | 8745 | ||
| 8746 | .types = .empty, | 8746 | .types = .empty, |
| 8747 | .next_unnamed_type = @enumFromInt(0), | 8747 | .next_unnamed_type = @fromBackingInt(@intCast(0)), |
| 8748 | .next_unique_type_id = .empty, | 8748 | .next_unique_type_id = .empty, |
| 8749 | .type_map = .empty, | 8749 | .type_map = .empty, |
| 8750 | .type_items = .empty, | 8750 | .type_items = .empty, |
| ... | @@ -8758,7 +8758,7 @@ pub fn init(options: Options) Allocator.Error!Builder { | ... | @@ -8758,7 +8758,7 @@ pub fn init(options: Options) Allocator.Error!Builder { |
| 8758 | .function_attributes_set = .empty, | 8758 | .function_attributes_set = .empty, |
| 8759 | 8759 | ||
| 8760 | .globals = .empty, | 8760 | .globals = .empty, |
| 8761 | .next_unnamed_global = @enumFromInt(0), | 8761 | .next_unnamed_global = @fromBackingInt(@intCast(0)), |
| 8762 | .next_replaced_global = .none, | 8762 | .next_replaced_global = .none, |
| 8763 | .next_unique_global_id = .empty, | 8763 | .next_unique_global_id = .empty, |
| 8764 | .aliases = .empty, | 8764 | .aliases = .empty, |
| ... | @@ -8815,7 +8815,7 @@ pub fn init(options: Options) Allocator.Error!Builder { | ... | @@ -8815,7 +8815,7 @@ pub fn init(options: Options) Allocator.Error!Builder { |
| 8815 | assert(self.intTypeAssumeCapacity(bits) == | 8815 | assert(self.intTypeAssumeCapacity(bits) == |
| 8816 | @field(Type, std.fmt.comptimePrint("i{d}", .{bits}))); | 8816 | @field(Type, std.fmt.comptimePrint("i{d}", .{bits}))); |
| 8817 | inline for (.{ 0, 4 }) |addr_space_index| { | 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 | assert(self.ptrTypeAssumeCapacity(addr_space) == | 8819 | assert(self.ptrTypeAssumeCapacity(addr_space) == |
| 8820 | @field(Type, std.fmt.comptimePrint("ptr{f}", .{addr_space.fmt(" ")}))); | 8820 | @field(Type, std.fmt.comptimePrint("ptr{f}", .{addr_space.fmt(" ")}))); |
| 8821 | } | 8821 | } |
| ... | @@ -9070,9 +9070,9 @@ pub fn namedTypeSetBody( | ... | @@ -9070,9 +9070,9 @@ pub fn namedTypeSetBody( |
| 9070 | named_type: Type, | 9070 | named_type: Type, |
| 9071 | body_type: Type, | 9071 | body_type: Type, |
| 9072 | ) void { | 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 | self.type_extra.items[named_item.data + std.meta.fieldIndex(Type.NamedStructure, "body").?] = | 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 | pub fn attr(self: *Builder, attribute: Attribute) Allocator.Error!Attribute.Index { | 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,7 +9080,7 @@ pub fn attr(self: *Builder, attribute: Attribute) Allocator.Error!Attribute.Inde |
| 9080 | 9080 | ||
| 9081 | const gop = self.attributes.getOrPutAssumeCapacity(attribute.toStorage()); | 9081 | const gop = self.attributes.getOrPutAssumeCapacity(attribute.toStorage()); |
| 9082 | if (!gop.found_existing) gop.value_ptr.* = {}; | 9082 | if (!gop.found_existing) gop.value_ptr.* = {}; |
| 9083 | return @enumFromInt(gop.index); | 9083 | return @fromBackingInt(@intCast(gop.index)); |
| 9084 | } | 9084 | } |
| 9085 | 9085 | ||
| 9086 | pub fn attrs(self: *Builder, attributes: []Attribute.Index) Allocator.Error!Attributes { | 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,20 +9089,20 @@ pub fn attrs(self: *Builder, attributes: []Attribute.Index) Allocator.Error!Attr |
| 9089 | const lhs_kind = lhs.getKind(builder); | 9089 | const lhs_kind = lhs.getKind(builder); |
| 9090 | const rhs_kind = rhs.getKind(builder); | 9090 | const rhs_kind = rhs.getKind(builder); |
| 9091 | assert(lhs_kind != rhs_kind); | 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 | }.lessThan); | 9094 | }.lessThan); |
| 9095 | return @enumFromInt(try self.attrGeneric(@ptrCast(attributes))); | 9095 | return @fromBackingInt(@intCast(try self.attrGeneric(@ptrCast(attributes)))); |
| 9096 | } | 9096 | } |
| 9097 | 9097 | ||
| 9098 | pub fn fnAttrs(self: *Builder, fn_attributes: []const Attributes) Allocator.Error!FunctionAttributes { | 9098 | pub fn fnAttrs(self: *Builder, fn_attributes: []const Attributes) Allocator.Error!FunctionAttributes { |
| 9099 | try self.function_attributes_set.ensureUnusedCapacity(self.gpa, 1); | 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 | fn_attributes[0..if (std.mem.lastIndexOfNone(Attributes, fn_attributes, &.{.none})) |last| | 9101 | fn_attributes[0..if (std.mem.lastIndexOfNone(Attributes, fn_attributes, &.{.none})) |last| |
| 9102 | last + 1 | 9102 | last + 1 |
| 9103 | else | 9103 | else |
| 9104 | 0], | 9104 | 0], |
| 9105 | ))); | 9105 | )))); |
| 9106 | 9106 | ||
| 9107 | _ = self.function_attributes_set.getOrPutAssumeCapacity(function_attributes); | 9107 | _ = self.function_attributes_set.getOrPutAssumeCapacity(function_attributes); |
| 9108 | return function_attributes; | 9108 | return function_attributes; |
| ... | @@ -9121,13 +9121,13 @@ pub fn addGlobalAssumeCapacity(self: *Builder, name: StrtabString, global: Globa | ... | @@ -9121,13 +9121,13 @@ pub fn addGlobalAssumeCapacity(self: *Builder, name: StrtabString, global: Globa |
| 9121 | if (name == .empty) { | 9121 | if (name == .empty) { |
| 9122 | id = self.next_unnamed_global; | 9122 | id = self.next_unnamed_global; |
| 9123 | assert(id != self.next_replaced_global); | 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 | while (true) { | 9126 | while (true) { |
| 9127 | const global_gop = self.globals.getOrPutAssumeCapacity(id); | 9127 | const global_gop = self.globals.getOrPutAssumeCapacity(id); |
| 9128 | if (!global_gop.found_existing) { | 9128 | if (!global_gop.found_existing) { |
| 9129 | global_gop.value_ptr.* = global; | 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 | global_index.updateDsoLocal(self); | 9131 | global_index.updateDsoLocal(self); |
| 9132 | return global_index; | 9132 | return global_index; |
| 9133 | } | 9133 | } |
| ... | @@ -9140,7 +9140,7 @@ pub fn addGlobalAssumeCapacity(self: *Builder, name: StrtabString, global: Globa | ... | @@ -9140,7 +9140,7 @@ pub fn addGlobalAssumeCapacity(self: *Builder, name: StrtabString, global: Globa |
| 9140 | } | 9140 | } |
| 9141 | 9141 | ||
| 9142 | pub fn getGlobal(self: *const Builder, name: StrtabString) ?Global.Index { | 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 | pub fn addAlias( | 9146 | pub fn addAlias( |
| ... | @@ -9164,7 +9164,7 @@ pub fn addAliasAssumeCapacity( | ... | @@ -9164,7 +9164,7 @@ pub fn addAliasAssumeCapacity( |
| 9164 | addr_space: AddrSpace, | 9164 | addr_space: AddrSpace, |
| 9165 | aliasee: Constant, | 9165 | aliasee: Constant, |
| 9166 | ) Alias.Index { | 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 | self.aliases.appendAssumeCapacity(.{ .global = self.addGlobalAssumeCapacity(name, .{ | 9168 | self.aliases.appendAssumeCapacity(.{ .global = self.addGlobalAssumeCapacity(name, .{ |
| 9169 | .addr_space = addr_space, | 9169 | .addr_space = addr_space, |
| 9170 | .type = ty, | 9170 | .type = ty, |
| ... | @@ -9192,7 +9192,7 @@ pub fn addVariableAssumeCapacity( | ... | @@ -9192,7 +9192,7 @@ pub fn addVariableAssumeCapacity( |
| 9192 | name: StrtabString, | 9192 | name: StrtabString, |
| 9193 | addr_space: AddrSpace, | 9193 | addr_space: AddrSpace, |
| 9194 | ) Variable.Index { | 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 | self.variables.appendAssumeCapacity(.{ .global = self.addGlobalAssumeCapacity(name, .{ | 9196 | self.variables.appendAssumeCapacity(.{ .global = self.addGlobalAssumeCapacity(name, .{ |
| 9197 | .addr_space = addr_space, | 9197 | .addr_space = addr_space, |
| 9198 | .type = ty, | 9198 | .type = ty, |
| ... | @@ -9221,7 +9221,7 @@ pub fn addFunctionAssumeCapacity( | ... | @@ -9221,7 +9221,7 @@ pub fn addFunctionAssumeCapacity( |
| 9221 | addr_space: AddrSpace, | 9221 | addr_space: AddrSpace, |
| 9222 | ) Function.Index { | 9222 | ) Function.Index { |
| 9223 | assert(ty.isFunction(self)); | 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 | self.functions.appendAssumeCapacity(.{ | 9225 | self.functions.appendAssumeCapacity(.{ |
| 9226 | .global = self.addGlobalAssumeCapacity(name, .{ | 9226 | .global = self.addGlobalAssumeCapacity(name, .{ |
| 9227 | .addr_space = addr_space, | 9227 | .addr_space = addr_space, |
| ... | @@ -9331,7 +9331,7 @@ pub fn getIntrinsic( | ... | @@ -9331,7 +9331,7 @@ pub fn getIntrinsic( |
| 9331 | pub fn intConst(self: *Builder, ty: Type, value: anytype) Allocator.Error!Constant { | 9331 | pub fn intConst(self: *Builder, ty: Type, value: anytype) Allocator.Error!Constant { |
| 9332 | const int_value = switch (@typeInfo(@TypeOf(value))) { | 9332 | const int_value = switch (@typeInfo(@TypeOf(value))) { |
| 9333 | .int, .comptime_int => value, | 9333 | .int, .comptime_int => value, |
| 9334 | .@"enum" => @intFromEnum(value), | 9334 | .@"enum" => @backingInt(value), |
| 9335 | else => @compileError("intConst expected an integral value, got " ++ @typeName(@TypeOf(value))), | 9335 | else => @compileError("intConst expected an integral value, got " ++ @typeName(@TypeOf(value))), |
| 9336 | }; | 9336 | }; |
| 9337 | var limbs: [ | 9337 | var limbs: [ |
| ... | @@ -9750,7 +9750,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -9750,7 +9750,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9750 | for (self.variables.items, 0..) |variable, variable_i| { | 9750 | for (self.variables.items, 0..) |variable, variable_i| { |
| 9751 | // Skip the variable if its global has been repurposed for something else. | 9751 | // Skip the variable if its global has been repurposed for something else. |
| 9752 | switch (variable.global.ptrConst(self).kind) { | 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 | else => continue, | 9754 | else => continue, |
| 9755 | } | 9755 | } |
| 9756 | const global = variable.global.ptrConst(self); | 9756 | const global = variable.global.ptrConst(self); |
| ... | @@ -9792,7 +9792,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -9792,7 +9792,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9792 | for (self.aliases.items, 0..) |alias, alias_i| { | 9792 | for (self.aliases.items, 0..) |alias, alias_i| { |
| 9793 | // Skip the alias if its global has been repurposed for something else. | 9793 | // Skip the alias if its global has been repurposed for something else. |
| 9794 | switch (alias.global.ptrConst(self).kind) { | 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 | else => continue, | 9796 | else => continue, |
| 9797 | } | 9797 | } |
| 9798 | const global = alias.global.ptrConst(self); | 9798 | const global = alias.global.ptrConst(self); |
| ... | @@ -9822,11 +9822,11 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -9822,11 +9822,11 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9822 | for (0.., self.functions.items) |function_i, function| { | 9822 | for (0.., self.functions.items) |function_i, function| { |
| 9823 | // Skip the function if its global has been repurposed for something else. | 9823 | // Skip the function if its global has been repurposed for something else. |
| 9824 | switch (function.global.ptrConst(self).kind) { | 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 | else => continue, | 9826 | else => continue, |
| 9827 | } | 9827 | } |
| 9828 | if (need_newline) try w.writeByte('\n') else need_newline = true; | 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 | const global = function.global.ptrConst(self); | 9830 | const global = function.global.ptrConst(self); |
| 9831 | const params_len = global.type.functionParameters(self).len; | 9831 | const params_len = global.type.functionParameters(self).len; |
| 9832 | const function_attributes = function.attributes.func(self); | 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,8 +9887,8 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 9887 | try w.writeAll(" {\n"); | 9887 | try w.writeAll(" {\n"); |
| 9888 | var maybe_dbg_index: ?u32 = null; | 9888 | var maybe_dbg_index: ?u32 = null; |
| 9889 | for (params_len..function.instructions.len) |instruction_i| { | 9889 | for (params_len..function.instructions.len) |instruction_i| { |
| 9890 | const instruction_index: Function.Instruction.Index = @enumFromInt(instruction_i); | 9890 | const instruction_index: Function.Instruction.Index = @fromBackingInt(@intCast(instruction_i)); |
| 9891 | const instruction = function.instructions.get(@intFromEnum(instruction_index)); | 9891 | const instruction = function.instructions.get(@backingInt(instruction_index)); |
| 9892 | if (function.debug_locations.get(instruction_index)) |debug_location| switch (debug_location) { | 9892 | if (function.debug_locations.get(instruction_index)) |debug_location| switch (debug_location) { |
| 9893 | .no_location => maybe_dbg_index = null, | 9893 | .no_location => maybe_dbg_index = null, |
| 9894 | .location => |location| { | 9894 | .location => |location| { |
| ... | @@ -10052,13 +10052,13 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -10052,13 +10052,13 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 10052 | .block => { | 10052 | .block => { |
| 10053 | block_incoming_len = instruction.data; | 10053 | block_incoming_len = instruction.data; |
| 10054 | const name = instruction_index.name(&function); | 10054 | const name = instruction_index.name(&function); |
| 10055 | if (@intFromEnum(instruction_index) > params_len) | 10055 | if (@backingInt(instruction_index) > params_len) |
| 10056 | try w.writeByte('\n'); | 10056 | try w.writeByte('\n'); |
| 10057 | try w.print("{f}:\n", .{name.fmt(self)}); | 10057 | try w.print("{f}:\n", .{name.fmt(self)}); |
| 10058 | continue; | 10058 | continue; |
| 10059 | }, | 10059 | }, |
| 10060 | .br => |tag| { | 10060 | .br => |tag| { |
| 10061 | const target: Function.Block.Index = @enumFromInt(instruction.data); | 10061 | const target: Function.Block.Index = @fromBackingInt(@intCast(instruction.data)); |
| 10062 | try w.print(" {s} {f}", .{ | 10062 | try w.print(" {s} {f}", .{ |
| 10063 | @tagName(tag), target.toInst(&function).fmt(function_index, self, .{ .percent = true }), | 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,7 +10187,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 10187 | .fneg, | 10187 | .fneg, |
| 10188 | .@"fneg fast", | 10188 | .@"fneg fast", |
| 10189 | => |tag| { | 10189 | => |tag| { |
| 10190 | const val: Value = @enumFromInt(instruction.data); | 10190 | const val: Value = @fromBackingInt(@intCast(instruction.data)); |
| 10191 | try w.print(" %{f} = {s} {f}", .{ | 10191 | try w.print(" %{f} = {s} {f}", .{ |
| 10192 | instruction_index.name(&function).fmt(self), | 10192 | instruction_index.name(&function).fmt(self), |
| 10193 | @tagName(tag), | 10193 | @tagName(tag), |
| ... | @@ -10288,7 +10288,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void | ... | @@ -10288,7 +10288,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 10288 | } | 10288 | } |
| 10289 | }, | 10289 | }, |
| 10290 | .ret => |tag| { | 10290 | .ret => |tag| { |
| 10291 | const val: Value = @enumFromInt(instruction.data); | 10291 | const val: Value = @fromBackingInt(@intCast(instruction.data)); |
| 10292 | try w.print(" {s} {f}", .{ | 10292 | try w.print(" {s} {f}", .{ |
| 10293 | @tagName(tag), | 10293 | @tagName(tag), |
| 10294 | val.fmt(function_index, self, .{ .percent = true }), | 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,7 +10498,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void |
| 10498 | .thisAdjustment = null, | 10498 | .thisAdjustment = null, |
| 10499 | .flags = extra.di_flags, | 10499 | .flags = extra.di_flags, |
| 10500 | .spFlags = @as(Metadata.Subprogram.DISPFlags, @bitCast(@as(u32, @as(u3, @intCast( | 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 | ))) << 2)), | 10502 | ))) << 2)), |
| 10503 | .unit = extra.compile_unit, | 10503 | .unit = extra.compile_unit, |
| 10504 | .templateParams = null, | 10504 | .templateParams = null, |
| ... | @@ -10818,7 +10818,7 @@ fn fnTypeAssumeCapacity( | ... | @@ -10818,7 +10818,7 @@ fn fnTypeAssumeCapacity( |
| 10818 | const Adapter = struct { | 10818 | const Adapter = struct { |
| 10819 | builder: *const Builder, | 10819 | builder: *const Builder, |
| 10820 | pub fn hash(_: @This(), key: Key) u32 { | 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 | hasher.update(std.mem.asBytes(&key.ret)); | 10822 | hasher.update(std.mem.asBytes(&key.ret)); |
| 10823 | hasher.update(std.mem.sliceAsBytes(key.params)); | 10823 | hasher.update(std.mem.sliceAsBytes(key.params)); |
| 10824 | return @truncate(hasher.final()); | 10824 | return @truncate(hasher.final()); |
| ... | @@ -10847,7 +10847,7 @@ fn fnTypeAssumeCapacity( | ... | @@ -10847,7 +10847,7 @@ fn fnTypeAssumeCapacity( |
| 10847 | }); | 10847 | }); |
| 10848 | self.type_extra.appendSliceAssumeCapacity(@ptrCast(params)); | 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 | fn intTypeAssumeCapacity(self: *Builder, bits: u24) Type { | 10853 | fn intTypeAssumeCapacity(self: *Builder, bits: u24) Type { |
| ... | @@ -10858,7 +10858,7 @@ fn intTypeAssumeCapacity(self: *Builder, bits: u24) Type { | ... | @@ -10858,7 +10858,7 @@ fn intTypeAssumeCapacity(self: *Builder, bits: u24) Type { |
| 10858 | 10858 | ||
| 10859 | fn ptrTypeAssumeCapacity(self: *Builder, addr_space: AddrSpace) Type { | 10859 | fn ptrTypeAssumeCapacity(self: *Builder, addr_space: AddrSpace) Type { |
| 10860 | const result = self.getOrPutTypeNoExtraAssumeCapacity( | 10860 | const result = self.getOrPutTypeNoExtraAssumeCapacity( |
| 10861 | .{ .tag = .pointer, .data = @intFromEnum(addr_space) }, | 10861 | .{ .tag = .pointer, .data = @backingInt(addr_space) }, |
| 10862 | ); | 10862 | ); |
| 10863 | return result.type; | 10863 | return result.type; |
| 10864 | } | 10864 | } |
| ... | @@ -10878,7 +10878,7 @@ fn vectorTypeAssumeCapacity( | ... | @@ -10878,7 +10878,7 @@ fn vectorTypeAssumeCapacity( |
| 10878 | builder: *const Builder, | 10878 | builder: *const Builder, |
| 10879 | pub fn hash(_: @This(), key: Type.Vector) u32 { | 10879 | pub fn hash(_: @This(), key: Type.Vector) u32 { |
| 10880 | return @truncate(std.hash.Wyhash.hash( | 10880 | return @truncate(std.hash.Wyhash.hash( |
| 10881 | comptime std.hash.int(@intFromEnum(tag)), | 10881 | comptime std.hash.int(@backingInt(tag)), |
| 10882 | std.mem.asBytes(&key), | 10882 | std.mem.asBytes(&key), |
| 10883 | )); | 10883 | )); |
| 10884 | } | 10884 | } |
| ... | @@ -10898,7 +10898,7 @@ fn vectorTypeAssumeCapacity( | ... | @@ -10898,7 +10898,7 @@ fn vectorTypeAssumeCapacity( |
| 10898 | .data = self.addTypeExtraAssumeCapacity(data), | 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 | fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { | 10904 | fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { |
| ... | @@ -10907,7 +10907,7 @@ fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { | ... | @@ -10907,7 +10907,7 @@ fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { |
| 10907 | builder: *const Builder, | 10907 | builder: *const Builder, |
| 10908 | pub fn hash(_: @This(), key: Type.Vector) u32 { | 10908 | pub fn hash(_: @This(), key: Type.Vector) u32 { |
| 10909 | return @truncate(std.hash.Wyhash.hash( | 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 | std.mem.asBytes(&key), | 10911 | std.mem.asBytes(&key), |
| 10912 | )); | 10912 | )); |
| 10913 | } | 10913 | } |
| ... | @@ -10927,13 +10927,13 @@ fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { | ... | @@ -10927,13 +10927,13 @@ fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { |
| 10927 | .data = self.addTypeExtraAssumeCapacity(data), | 10927 | .data = self.addTypeExtraAssumeCapacity(data), |
| 10928 | }); | 10928 | }); |
| 10929 | } | 10929 | } |
| 10930 | return @enumFromInt(gop.index); | 10930 | return @fromBackingInt(@intCast(gop.index)); |
| 10931 | } else { | 10931 | } else { |
| 10932 | const Adapter = struct { | 10932 | const Adapter = struct { |
| 10933 | builder: *const Builder, | 10933 | builder: *const Builder, |
| 10934 | pub fn hash(_: @This(), key: Type.Array) u32 { | 10934 | pub fn hash(_: @This(), key: Type.Array) u32 { |
| 10935 | return @truncate(std.hash.Wyhash.hash( | 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 | std.mem.asBytes(&key), | 10937 | std.mem.asBytes(&key), |
| 10938 | )); | 10938 | )); |
| 10939 | } | 10939 | } |
| ... | @@ -10957,7 +10957,7 @@ fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { | ... | @@ -10957,7 +10957,7 @@ fn arrayTypeAssumeCapacity(self: *Builder, len: u64, child: Type) Type { |
| 10957 | .data = self.addTypeExtraAssumeCapacity(data), | 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,7 +10974,7 @@ fn structTypeAssumeCapacity( |
| 10974 | builder: *const Builder, | 10974 | builder: *const Builder, |
| 10975 | pub fn hash(_: @This(), key: []const Type) u32 { | 10975 | pub fn hash(_: @This(), key: []const Type) u32 { |
| 10976 | return @truncate(std.hash.Wyhash.hash( | 10976 | return @truncate(std.hash.Wyhash.hash( |
| 10977 | comptime std.hash.int(@intFromEnum(tag)), | 10977 | comptime std.hash.int(@backingInt(tag)), |
| 10978 | std.mem.sliceAsBytes(key), | 10978 | std.mem.sliceAsBytes(key), |
| 10979 | )); | 10979 | )); |
| 10980 | } | 10980 | } |
| ... | @@ -10998,7 +10998,7 @@ fn structTypeAssumeCapacity( | ... | @@ -10998,7 +10998,7 @@ fn structTypeAssumeCapacity( |
| 10998 | }); | 10998 | }); |
| 10999 | self.type_extra.appendSliceAssumeCapacity(@ptrCast(fields)); | 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 | fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { | 11004 | fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { |
| ... | @@ -11006,7 +11006,7 @@ fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { | ... | @@ -11006,7 +11006,7 @@ fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { |
| 11006 | builder: *const Builder, | 11006 | builder: *const Builder, |
| 11007 | pub fn hash(_: @This(), key: String) u32 { | 11007 | pub fn hash(_: @This(), key: String) u32 { |
| 11008 | return @truncate(std.hash.Wyhash.hash( | 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 | std.mem.asBytes(&key), | 11010 | std.mem.asBytes(&key), |
| 11011 | )); | 11011 | )); |
| 11012 | } | 11012 | } |
| ... | @@ -11020,7 +11020,7 @@ fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { | ... | @@ -11020,7 +11020,7 @@ fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { |
| 11020 | if (name == .empty) { | 11020 | if (name == .empty) { |
| 11021 | id = self.next_unnamed_type; | 11021 | id = self.next_unnamed_type; |
| 11022 | assert(id != .none); | 11022 | assert(id != .none); |
| 11023 | self.next_unnamed_type = @enumFromInt(@intFromEnum(id) + 1); | 11023 | self.next_unnamed_type = @fromBackingInt(@intCast(@backingInt(id) + 1)); |
| 11024 | } else assert(!name.isAnon()); | 11024 | } else assert(!name.isAnon()); |
| 11025 | while (true) { | 11025 | while (true) { |
| 11026 | const type_gop = self.types.getOrPutAssumeCapacity(id); | 11026 | const type_gop = self.types.getOrPutAssumeCapacity(id); |
| ... | @@ -11036,7 +11036,7 @@ fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { | ... | @@ -11036,7 +11036,7 @@ fn opaqueTypeAssumeCapacity(self: *Builder, name: String) Type { |
| 11036 | .body = .none, | 11036 | .body = .none, |
| 11037 | }), | 11037 | }), |
| 11038 | }); | 11038 | }); |
| 11039 | const result: Type = @enumFromInt(gop.index); | 11039 | const result: Type = @fromBackingInt(@intCast(gop.index)); |
| 11040 | type_gop.value_ptr.* = result; | 11040 | type_gop.value_ptr.* = result; |
| 11041 | return result; | 11041 | return result; |
| 11042 | } | 11042 | } |
| ... | @@ -11067,7 +11067,7 @@ fn getOrPutTypeNoExtraAssumeCapacity(self: *Builder, item: Type.Item) struct { n | ... | @@ -11067,7 +11067,7 @@ fn getOrPutTypeNoExtraAssumeCapacity(self: *Builder, item: Type.Item) struct { n |
| 11067 | builder: *const Builder, | 11067 | builder: *const Builder, |
| 11068 | pub fn hash(_: @This(), key: Type.Item) u32 { | 11068 | pub fn hash(_: @This(), key: Type.Item) u32 { |
| 11069 | return @truncate(std.hash.Wyhash.hash( | 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 | std.mem.asBytes(&key), | 11071 | std.mem.asBytes(&key), |
| 11072 | )); | 11072 | )); |
| 11073 | } | 11073 | } |
| ... | @@ -11083,7 +11083,7 @@ fn getOrPutTypeNoExtraAssumeCapacity(self: *Builder, item: Type.Item) struct { n | ... | @@ -11083,7 +11083,7 @@ fn getOrPutTypeNoExtraAssumeCapacity(self: *Builder, item: Type.Item) struct { n |
| 11083 | gop.value_ptr.* = {}; | 11083 | gop.value_ptr.* = {}; |
| 11084 | self.type_items.appendAssumeCapacity(item); | 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 | fn addTypeExtraAssumeCapacity(self: *Builder, extra: anytype) Type.Item.ExtraIndex { | 11089 | fn addTypeExtraAssumeCapacity(self: *Builder, extra: anytype) Type.Item.ExtraIndex { |
| ... | @@ -11093,7 +11093,7 @@ fn addTypeExtraAssumeCapacity(self: *Builder, extra: anytype) Type.Item.ExtraInd | ... | @@ -11093,7 +11093,7 @@ fn addTypeExtraAssumeCapacity(self: *Builder, extra: anytype) Type.Item.ExtraInd |
| 11093 | const value = @field(extra, field_name); | 11093 | const value = @field(extra, field_name); |
| 11094 | self.type_extra.appendAssumeCapacity(switch (field_type) { | 11094 | self.type_extra.appendAssumeCapacity(switch (field_type) { |
| 11095 | u32 => value, | 11095 | u32 => value, |
| 11096 | String, Type => @intFromEnum(value), | 11096 | String, Type => @backingInt(value), |
| 11097 | else => @compileError("bad field type: " ++ field_name ++ ": " ++ @typeName(field_type)), | 11097 | else => @compileError("bad field type: " ++ field_name ++ ": " ++ @typeName(field_type)), |
| 11098 | }); | 11098 | }); |
| 11099 | } | 11099 | } |
| ... | @@ -11135,7 +11135,7 @@ fn typeExtraDataTrail( | ... | @@ -11135,7 +11135,7 @@ fn typeExtraDataTrail( |
| 11135 | ) |field_name, field_type, value| | 11135 | ) |field_name, field_type, value| |
| 11136 | @field(result, field_name) = switch (field_type) { | 11136 | @field(result, field_name) = switch (field_type) { |
| 11137 | u32 => value, | 11137 | u32 => value, |
| 11138 | String, Type => @enumFromInt(value), | 11138 | String, Type => @fromBackingInt(@intCast(value)), |
| 11139 | else => @compileError("bad field type: " ++ @typeName(field_type)), | 11139 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 11140 | }; | 11140 | }; |
| 11141 | return .{ | 11141 | return .{ |
| ... | @@ -11177,7 +11177,7 @@ fn bigIntConstAssumeCapacity( | ... | @@ -11177,7 +11177,7 @@ fn bigIntConstAssumeCapacity( |
| 11177 | ty: Type, | 11177 | ty: Type, |
| 11178 | value: std.math.big.int.Const, | 11178 | value: std.math.big.int.Const, |
| 11179 | ) Allocator.Error!Constant { | 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 | assert(type_item.tag == .integer); | 11181 | assert(type_item.tag == .integer); |
| 11182 | const bits = type_item.data; | 11182 | const bits = type_item.data; |
| 11183 | 11183 | ||
| ... | @@ -11206,7 +11206,7 @@ fn bigIntConstAssumeCapacity( | ... | @@ -11206,7 +11206,7 @@ fn bigIntConstAssumeCapacity( |
| 11206 | const Adapter = struct { | 11206 | const Adapter = struct { |
| 11207 | builder: *const Builder, | 11207 | builder: *const Builder, |
| 11208 | pub fn hash(_: @This(), key: Key) u32 { | 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 | hasher.update(std.mem.asBytes(&key.type)); | 11210 | hasher.update(std.mem.asBytes(&key.type)); |
| 11211 | hasher.update(std.mem.sliceAsBytes(key.limbs)); | 11211 | hasher.update(std.mem.sliceAsBytes(key.limbs)); |
| 11212 | return @truncate(hasher.final()); | 11212 | return @truncate(hasher.final()); |
| ... | @@ -11239,7 +11239,7 @@ fn bigIntConstAssumeCapacity( | ... | @@ -11239,7 +11239,7 @@ fn bigIntConstAssumeCapacity( |
| 11239 | extra.* = .{ .type = ty, .limbs_len = @intCast(canonical_value.limbs.len) }; | 11239 | extra.* = .{ .type = ty, .limbs_len = @intCast(canonical_value.limbs.len) }; |
| 11240 | self.constant_limbs.appendSliceAssumeCapacity(canonical_value.limbs); | 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 | fn halfConstAssumeCapacity(self: *Builder, val: f16) Constant { | 11245 | fn halfConstAssumeCapacity(self: *Builder, val: f16) Constant { |
| ... | @@ -11269,7 +11269,7 @@ fn doubleConstAssumeCapacity(self: *Builder, val: f64) Constant { | ... | @@ -11269,7 +11269,7 @@ fn doubleConstAssumeCapacity(self: *Builder, val: f64) Constant { |
| 11269 | builder: *const Builder, | 11269 | builder: *const Builder, |
| 11270 | pub fn hash(_: @This(), key: f64) u32 { | 11270 | pub fn hash(_: @This(), key: f64) u32 { |
| 11271 | return @truncate(std.hash.Wyhash.hash( | 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 | std.mem.asBytes(&key), | 11273 | std.mem.asBytes(&key), |
| 11274 | )); | 11274 | )); |
| 11275 | } | 11275 | } |
| ... | @@ -11292,7 +11292,7 @@ fn doubleConstAssumeCapacity(self: *Builder, val: f64) Constant { | ... | @@ -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 | fn fp128ConstAssumeCapacity(self: *Builder, val: f128) Constant { | 11298 | fn fp128ConstAssumeCapacity(self: *Builder, val: f128) Constant { |
| ... | @@ -11300,7 +11300,7 @@ fn fp128ConstAssumeCapacity(self: *Builder, val: f128) Constant { | ... | @@ -11300,7 +11300,7 @@ fn fp128ConstAssumeCapacity(self: *Builder, val: f128) Constant { |
| 11300 | builder: *const Builder, | 11300 | builder: *const Builder, |
| 11301 | pub fn hash(_: @This(), key: f128) u32 { | 11301 | pub fn hash(_: @This(), key: f128) u32 { |
| 11302 | return @truncate(std.hash.Wyhash.hash( | 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 | std.mem.asBytes(&key), | 11304 | std.mem.asBytes(&key), |
| 11305 | )); | 11305 | )); |
| 11306 | } | 11306 | } |
| ... | @@ -11326,7 +11326,7 @@ fn fp128ConstAssumeCapacity(self: *Builder, val: f128) Constant { | ... | @@ -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 | fn x86_fp80ConstAssumeCapacity(self: *Builder, val: f80) Constant { | 11332 | fn x86_fp80ConstAssumeCapacity(self: *Builder, val: f80) Constant { |
| ... | @@ -11334,7 +11334,7 @@ fn x86_fp80ConstAssumeCapacity(self: *Builder, val: f80) Constant { | ... | @@ -11334,7 +11334,7 @@ fn x86_fp80ConstAssumeCapacity(self: *Builder, val: f80) Constant { |
| 11334 | builder: *const Builder, | 11334 | builder: *const Builder, |
| 11335 | pub fn hash(_: @This(), key: f80) u32 { | 11335 | pub fn hash(_: @This(), key: f80) u32 { |
| 11336 | return @truncate(std.hash.Wyhash.hash( | 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 | std.mem.asBytes(&key)[0..10], | 11338 | std.mem.asBytes(&key)[0..10], |
| 11339 | )); | 11339 | )); |
| 11340 | } | 11340 | } |
| ... | @@ -11359,7 +11359,7 @@ fn x86_fp80ConstAssumeCapacity(self: *Builder, val: f80) Constant { | ... | @@ -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 | fn ppc_fp128ConstAssumeCapacity(self: *Builder, val: [2]f64) Constant { | 11365 | fn ppc_fp128ConstAssumeCapacity(self: *Builder, val: [2]f64) Constant { |
| ... | @@ -11367,7 +11367,7 @@ fn ppc_fp128ConstAssumeCapacity(self: *Builder, val: [2]f64) Constant { | ... | @@ -11367,7 +11367,7 @@ fn ppc_fp128ConstAssumeCapacity(self: *Builder, val: [2]f64) Constant { |
| 11367 | builder: *const Builder, | 11367 | builder: *const Builder, |
| 11368 | pub fn hash(_: @This(), key: [2]f64) u32 { | 11368 | pub fn hash(_: @This(), key: [2]f64) u32 { |
| 11369 | return @truncate(std.hash.Wyhash.hash( | 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 | std.mem.asBytes(&key), | 11371 | std.mem.asBytes(&key), |
| 11372 | )); | 11372 | )); |
| 11373 | } | 11373 | } |
| ... | @@ -11393,13 +11393,13 @@ fn ppc_fp128ConstAssumeCapacity(self: *Builder, val: [2]f64) Constant { | ... | @@ -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 | fn nullConstAssumeCapacity(self: *Builder, ty: Type) Constant { | 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 | const result = self.getOrPutConstantNoExtraAssumeCapacity( | 11401 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11402 | .{ .tag = .null, .data = @intFromEnum(ty) }, | 11402 | .{ .tag = .null, .data = @backingInt(ty) }, |
| 11403 | ); | 11403 | ); |
| 11404 | return result.constant; | 11404 | return result.constant; |
| 11405 | } | 11405 | } |
| ... | @@ -11407,18 +11407,18 @@ fn nullConstAssumeCapacity(self: *Builder, ty: Type) Constant { | ... | @@ -11407,18 +11407,18 @@ fn nullConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11407 | fn noneConstAssumeCapacity(self: *Builder, ty: Type) Constant { | 11407 | fn noneConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11408 | assert(ty == .token); | 11408 | assert(ty == .token); |
| 11409 | const result = self.getOrPutConstantNoExtraAssumeCapacity( | 11409 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11410 | .{ .tag = .none, .data = @intFromEnum(ty) }, | 11410 | .{ .tag = .none, .data = @backingInt(ty) }, |
| 11411 | ); | 11411 | ); |
| 11412 | return result.constant; | 11412 | return result.constant; |
| 11413 | } | 11413 | } |
| 11414 | 11414 | ||
| 11415 | fn structConstAssumeCapacity(self: *Builder, ty: Type, vals: []const Constant) Constant { | 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 | var extra = self.typeExtraDataTrail(Type.Structure, switch (type_item.tag) { | 11417 | var extra = self.typeExtraDataTrail(Type.Structure, switch (type_item.tag) { |
| 11418 | .structure, .packed_structure => type_item.data, | 11418 | .structure, .packed_structure => type_item.data, |
| 11419 | .named_structure => data: { | 11419 | .named_structure => data: { |
| 11420 | const body_ty = self.typeExtraData(Type.NamedStructure, type_item.data).body; | 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 | switch (body_item.tag) { | 11422 | switch (body_item.tag) { |
| 11423 | .structure, .packed_structure => break :data body_item.data, | 11423 | .structure, .packed_structure => break :data body_item.data, |
| 11424 | else => unreachable, | 11424 | else => unreachable, |
| ... | @@ -11443,7 +11443,7 @@ fn structConstAssumeCapacity(self: *Builder, ty: Type, vals: []const Constant) C | ... | @@ -11443,7 +11443,7 @@ fn structConstAssumeCapacity(self: *Builder, ty: Type, vals: []const Constant) C |
| 11443 | } | 11443 | } |
| 11444 | 11444 | ||
| 11445 | fn arrayConstAssumeCapacity(self: *Builder, ty: Type, vals: []const Constant) Constant { | 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 | const type_extra: struct { len: u64, child: Type } = switch (type_item.tag) { | 11447 | const type_extra: struct { len: u64, child: Type } = switch (type_item.tag) { |
| 11448 | inline .small_array, .array => |kind| extra: { | 11448 | inline .small_array, .array => |kind| extra: { |
| 11449 | const extra = self.typeExtraData(switch (kind) { | 11449 | const extra = self.typeExtraData(switch (kind) { |
| ... | @@ -11471,7 +11471,7 @@ fn stringConstAssumeCapacity(self: *Builder, val: String) Constant { | ... | @@ -11471,7 +11471,7 @@ fn stringConstAssumeCapacity(self: *Builder, val: String) Constant { |
| 11471 | const ty = self.arrayTypeAssumeCapacity(slice.len, .i8); | 11471 | const ty = self.arrayTypeAssumeCapacity(slice.len, .i8); |
| 11472 | if (std.mem.allEqual(u8, slice, 0)) return self.zeroInitConstAssumeCapacity(ty); | 11472 | if (std.mem.allEqual(u8, slice, 0)) return self.zeroInitConstAssumeCapacity(ty); |
| 11473 | const result = self.getOrPutConstantNoExtraAssumeCapacity( | 11473 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11474 | .{ .tag = .string, .data = @intFromEnum(val) }, | 11474 | .{ .tag = .string, .data = @backingInt(val) }, |
| 11475 | ); | 11475 | ); |
| 11476 | return result.constant; | 11476 | return result.constant; |
| 11477 | } | 11477 | } |
| ... | @@ -11502,7 +11502,7 @@ fn splatConstAssumeCapacity(self: *Builder, ty: Type, val: Constant) Constant { | ... | @@ -11502,7 +11502,7 @@ fn splatConstAssumeCapacity(self: *Builder, ty: Type, val: Constant) Constant { |
| 11502 | builder: *const Builder, | 11502 | builder: *const Builder, |
| 11503 | pub fn hash(_: @This(), key: Constant.Splat) u32 { | 11503 | pub fn hash(_: @This(), key: Constant.Splat) u32 { |
| 11504 | return @truncate(std.hash.Wyhash.hash( | 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 | std.mem.asBytes(&key), | 11506 | std.mem.asBytes(&key), |
| 11507 | )); | 11507 | )); |
| 11508 | } | 11508 | } |
| ... | @@ -11523,7 +11523,7 @@ fn splatConstAssumeCapacity(self: *Builder, ty: Type, val: Constant) Constant { | ... | @@ -11523,7 +11523,7 @@ fn splatConstAssumeCapacity(self: *Builder, ty: Type, val: Constant) Constant { |
| 11523 | .data = self.addConstantExtraAssumeCapacity(data), | 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 | fn zeroInitConstAssumeCapacity(self: *Builder, ty: Type) Constant { | 11529 | fn zeroInitConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| ... | @@ -11538,7 +11538,7 @@ fn zeroInitConstAssumeCapacity(self: *Builder, ty: Type) Constant { | ... | @@ -11538,7 +11538,7 @@ fn zeroInitConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11538 | .ppc_fp128 => return self.ppc_fp128ConstAssumeCapacity(.{ 0.0, 0.0 }), | 11538 | .ppc_fp128 => return self.ppc_fp128ConstAssumeCapacity(.{ 0.0, 0.0 }), |
| 11539 | .token => return .none, | 11539 | .token => return .none, |
| 11540 | .i1 => return .false, | 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 | .simple, | 11542 | .simple, |
| 11543 | .function, | 11543 | .function, |
| 11544 | .vararg_function, | 11544 | .vararg_function, |
| ... | @@ -11561,13 +11561,13 @@ fn zeroInitConstAssumeCapacity(self: *Builder, ty: Type) Constant { | ... | @@ -11561,13 +11561,13 @@ fn zeroInitConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11561 | }, | 11561 | }, |
| 11562 | } | 11562 | } |
| 11563 | const result = self.getOrPutConstantNoExtraAssumeCapacity( | 11563 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11564 | .{ .tag = .zeroinitializer, .data = @intFromEnum(ty) }, | 11564 | .{ .tag = .zeroinitializer, .data = @backingInt(ty) }, |
| 11565 | ); | 11565 | ); |
| 11566 | return result.constant; | 11566 | return result.constant; |
| 11567 | } | 11567 | } |
| 11568 | 11568 | ||
| 11569 | fn undefConstAssumeCapacity(self: *Builder, ty: Type) Constant { | 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 | .simple => switch (ty) { | 11571 | .simple => switch (ty) { |
| 11572 | .void, .label => unreachable, | 11572 | .void, .label => unreachable, |
| 11573 | else => {}, | 11573 | else => {}, |
| ... | @@ -11576,13 +11576,13 @@ fn undefConstAssumeCapacity(self: *Builder, ty: Type) Constant { | ... | @@ -11576,13 +11576,13 @@ fn undefConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11576 | else => {}, | 11576 | else => {}, |
| 11577 | } | 11577 | } |
| 11578 | const result = self.getOrPutConstantNoExtraAssumeCapacity( | 11578 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11579 | .{ .tag = .undef, .data = @intFromEnum(ty) }, | 11579 | .{ .tag = .undef, .data = @backingInt(ty) }, |
| 11580 | ); | 11580 | ); |
| 11581 | return result.constant; | 11581 | return result.constant; |
| 11582 | } | 11582 | } |
| 11583 | 11583 | ||
| 11584 | fn poisonConstAssumeCapacity(self: *Builder, ty: Type) Constant { | 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 | .simple => switch (ty) { | 11586 | .simple => switch (ty) { |
| 11587 | .void, .label => unreachable, | 11587 | .void, .label => unreachable, |
| 11588 | else => {}, | 11588 | else => {}, |
| ... | @@ -11591,7 +11591,7 @@ fn poisonConstAssumeCapacity(self: *Builder, ty: Type) Constant { | ... | @@ -11591,7 +11591,7 @@ fn poisonConstAssumeCapacity(self: *Builder, ty: Type) Constant { |
| 11591 | else => {}, | 11591 | else => {}, |
| 11592 | } | 11592 | } |
| 11593 | const result = self.getOrPutConstantNoExtraAssumeCapacity( | 11593 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11594 | .{ .tag = .poison, .data = @intFromEnum(ty) }, | 11594 | .{ .tag = .poison, .data = @backingInt(ty) }, |
| 11595 | ); | 11595 | ); |
| 11596 | return result.constant; | 11596 | return result.constant; |
| 11597 | } | 11597 | } |
| ... | @@ -11605,7 +11605,7 @@ fn blockAddrConstAssumeCapacity( | ... | @@ -11605,7 +11605,7 @@ fn blockAddrConstAssumeCapacity( |
| 11605 | builder: *const Builder, | 11605 | builder: *const Builder, |
| 11606 | pub fn hash(_: @This(), key: Constant.BlockAddress) u32 { | 11606 | pub fn hash(_: @This(), key: Constant.BlockAddress) u32 { |
| 11607 | return @truncate(std.hash.Wyhash.hash( | 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 | std.mem.asBytes(&key), | 11609 | std.mem.asBytes(&key), |
| 11610 | )); | 11610 | )); |
| 11611 | } | 11611 | } |
| ... | @@ -11626,19 +11626,19 @@ fn blockAddrConstAssumeCapacity( | ... | @@ -11626,19 +11626,19 @@ fn blockAddrConstAssumeCapacity( |
| 11626 | .data = self.addConstantExtraAssumeCapacity(data), | 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 | fn dsoLocalEquivalentConstAssumeCapacity(self: *Builder, function: Function.Index) Constant { | 11632 | fn dsoLocalEquivalentConstAssumeCapacity(self: *Builder, function: Function.Index) Constant { |
| 11633 | const result = self.getOrPutConstantNoExtraAssumeCapacity( | 11633 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11634 | .{ .tag = .dso_local_equivalent, .data = @intFromEnum(function) }, | 11634 | .{ .tag = .dso_local_equivalent, .data = @backingInt(function) }, |
| 11635 | ); | 11635 | ); |
| 11636 | return result.constant; | 11636 | return result.constant; |
| 11637 | } | 11637 | } |
| 11638 | 11638 | ||
| 11639 | fn noCfiConstAssumeCapacity(self: *Builder, function: Function.Index) Constant { | 11639 | fn noCfiConstAssumeCapacity(self: *Builder, function: Function.Index) Constant { |
| 11640 | const result = self.getOrPutConstantNoExtraAssumeCapacity( | 11640 | const result = self.getOrPutConstantNoExtraAssumeCapacity( |
| 11641 | .{ .tag = .no_cfi, .data = @intFromEnum(function) }, | 11641 | .{ .tag = .no_cfi, .data = @backingInt(function) }, |
| 11642 | ); | 11642 | ); |
| 11643 | return result.constant; | 11643 | return result.constant; |
| 11644 | } | 11644 | } |
| ... | @@ -11735,7 +11735,7 @@ fn castConstAssumeCapacity(self: *Builder, tag: Constant.Tag, val: Constant, ty: | ... | @@ -11735,7 +11735,7 @@ fn castConstAssumeCapacity(self: *Builder, tag: Constant.Tag, val: Constant, ty: |
| 11735 | builder: *const Builder, | 11735 | builder: *const Builder, |
| 11736 | pub fn hash(_: @This(), key: Key) u32 { | 11736 | pub fn hash(_: @This(), key: Key) u32 { |
| 11737 | return @truncate(std.hash.Wyhash.hash( | 11737 | return @truncate(std.hash.Wyhash.hash( |
| 11738 | std.hash.int(@intFromEnum(key.tag)), | 11738 | std.hash.int(@backingInt(key.tag)), |
| 11739 | std.mem.asBytes(&key.cast), | 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,7 +11756,7 @@ fn castConstAssumeCapacity(self: *Builder, tag: Constant.Tag, val: Constant, ty: |
| 11756 | .data = self.addConstantExtraAssumeCapacity(data.cast), | 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 | fn gepConstAssumeCapacity( | 11762 | fn gepConstAssumeCapacity( |
| ... | @@ -11810,7 +11810,7 @@ fn gepConstAssumeCapacity( | ... | @@ -11810,7 +11810,7 @@ fn gepConstAssumeCapacity( |
| 11810 | const Adapter = struct { | 11810 | const Adapter = struct { |
| 11811 | builder: *const Builder, | 11811 | builder: *const Builder, |
| 11812 | pub fn hash(_: @This(), key: Key) u32 { | 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 | hasher.update(std.mem.asBytes(&key.type)); | 11814 | hasher.update(std.mem.asBytes(&key.type)); |
| 11815 | hasher.update(std.mem.asBytes(&key.base)); | 11815 | hasher.update(std.mem.asBytes(&key.base)); |
| 11816 | hasher.update(std.mem.asBytes(&key.inrange)); | 11816 | hasher.update(std.mem.asBytes(&key.inrange)); |
| ... | @@ -11831,7 +11831,7 @@ fn gepConstAssumeCapacity( | ... | @@ -11831,7 +11831,7 @@ fn gepConstAssumeCapacity( |
| 11831 | const data = Key{ | 11831 | const data = Key{ |
| 11832 | .type = ty, | 11832 | .type = ty, |
| 11833 | .base = base, | 11833 | .base = base, |
| 11834 | .inrange = if (inrange) |index| @enumFromInt(index) else .none, | 11834 | .inrange = if (inrange) |index| @fromBackingInt(@intCast(index)) else .none, |
| 11835 | .indices = indices, | 11835 | .indices = indices, |
| 11836 | }; | 11836 | }; |
| 11837 | const gop = self.constant_map.getOrPutAssumeCapacityAdapted(data, Adapter{ .builder = self }); | 11837 | const gop = self.constant_map.getOrPutAssumeCapacityAdapted(data, Adapter{ .builder = self }); |
| ... | @@ -11848,7 +11848,7 @@ fn gepConstAssumeCapacity( | ... | @@ -11848,7 +11848,7 @@ fn gepConstAssumeCapacity( |
| 11848 | }); | 11848 | }); |
| 11849 | self.constant_extra.appendSliceAssumeCapacity(@ptrCast(indices)); | 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 | fn binConstAssumeCapacity( | 11854 | fn binConstAssumeCapacity( |
| ... | @@ -11874,7 +11874,7 @@ fn binConstAssumeCapacity( | ... | @@ -11874,7 +11874,7 @@ fn binConstAssumeCapacity( |
| 11874 | builder: *const Builder, | 11874 | builder: *const Builder, |
| 11875 | pub fn hash(_: @This(), key: Key) u32 { | 11875 | pub fn hash(_: @This(), key: Key) u32 { |
| 11876 | return @truncate(std.hash.Wyhash.hash( | 11876 | return @truncate(std.hash.Wyhash.hash( |
| 11877 | std.hash.int(@intFromEnum(key.tag)), | 11877 | std.hash.int(@backingInt(key.tag)), |
| 11878 | std.mem.asBytes(&key.extra), | 11878 | std.mem.asBytes(&key.extra), |
| 11879 | )); | 11879 | )); |
| 11880 | } | 11880 | } |
| ... | @@ -11895,7 +11895,7 @@ fn binConstAssumeCapacity( | ... | @@ -11895,7 +11895,7 @@ fn binConstAssumeCapacity( |
| 11895 | .data = self.addConstantExtraAssumeCapacity(data.extra), | 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 | fn asmConstAssumeCapacity( | 11901 | fn asmConstAssumeCapacity( |
| ... | @@ -11912,7 +11912,7 @@ fn asmConstAssumeCapacity( | ... | @@ -11912,7 +11912,7 @@ fn asmConstAssumeCapacity( |
| 11912 | builder: *const Builder, | 11912 | builder: *const Builder, |
| 11913 | pub fn hash(_: @This(), key: Key) u32 { | 11913 | pub fn hash(_: @This(), key: Key) u32 { |
| 11914 | return @truncate(std.hash.Wyhash.hash( | 11914 | return @truncate(std.hash.Wyhash.hash( |
| 11915 | std.hash.int(@intFromEnum(key.tag)), | 11915 | std.hash.int(@backingInt(key.tag)), |
| 11916 | std.mem.asBytes(&key.extra), | 11916 | std.mem.asBytes(&key.extra), |
| 11917 | )); | 11917 | )); |
| 11918 | } | 11918 | } |
| ... | @@ -11925,7 +11925,7 @@ fn asmConstAssumeCapacity( | ... | @@ -11925,7 +11925,7 @@ fn asmConstAssumeCapacity( |
| 11925 | }; | 11925 | }; |
| 11926 | 11926 | ||
| 11927 | const data = Key{ | 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 | .extra = .{ .type = ty, .assembly = assembly, .constraints = constraints }, | 11929 | .extra = .{ .type = ty, .assembly = assembly, .constraints = constraints }, |
| 11930 | }; | 11930 | }; |
| 11931 | const gop = self.constant_map.getOrPutAssumeCapacityAdapted(data, Adapter{ .builder = self }); | 11931 | const gop = self.constant_map.getOrPutAssumeCapacityAdapted(data, Adapter{ .builder = self }); |
| ... | @@ -11937,7 +11937,7 @@ fn asmConstAssumeCapacity( | ... | @@ -11937,7 +11937,7 @@ fn asmConstAssumeCapacity( |
| 11937 | .data = self.addConstantExtraAssumeCapacity(data.extra), | 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 | fn ensureUnusedConstantCapacity( | 11943 | fn ensureUnusedConstantCapacity( |
| ... | @@ -11962,7 +11962,7 @@ fn getOrPutConstantNoExtraAssumeCapacity( | ... | @@ -11962,7 +11962,7 @@ fn getOrPutConstantNoExtraAssumeCapacity( |
| 11962 | builder: *const Builder, | 11962 | builder: *const Builder, |
| 11963 | pub fn hash(_: @This(), key: Constant.Item) u32 { | 11963 | pub fn hash(_: @This(), key: Constant.Item) u32 { |
| 11964 | return @truncate(std.hash.Wyhash.hash( | 11964 | return @truncate(std.hash.Wyhash.hash( |
| 11965 | std.hash.int(@intFromEnum(key.tag)), | 11965 | std.hash.int(@backingInt(key.tag)), |
| 11966 | std.mem.asBytes(&key.data), | 11966 | std.mem.asBytes(&key.data), |
| 11967 | )); | 11967 | )); |
| 11968 | } | 11968 | } |
| ... | @@ -11976,7 +11976,7 @@ fn getOrPutConstantNoExtraAssumeCapacity( | ... | @@ -11976,7 +11976,7 @@ fn getOrPutConstantNoExtraAssumeCapacity( |
| 11976 | gop.value_ptr.* = {}; | 11976 | gop.value_ptr.* = {}; |
| 11977 | self.constant_items.appendAssumeCapacity(item); | 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 | fn getOrPutConstantAggregateAssumeCapacity( | 11982 | fn getOrPutConstantAggregateAssumeCapacity( |
| ... | @@ -11993,7 +11993,7 @@ fn getOrPutConstantAggregateAssumeCapacity( | ... | @@ -11993,7 +11993,7 @@ fn getOrPutConstantAggregateAssumeCapacity( |
| 11993 | const Adapter = struct { | 11993 | const Adapter = struct { |
| 11994 | builder: *const Builder, | 11994 | builder: *const Builder, |
| 11995 | pub fn hash(_: @This(), key: Key) u32 { | 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 | hasher.update(std.mem.asBytes(&key.type)); | 11997 | hasher.update(std.mem.asBytes(&key.type)); |
| 11998 | hasher.update(std.mem.sliceAsBytes(key.vals)); | 11998 | hasher.update(std.mem.sliceAsBytes(key.vals)); |
| 11999 | return @truncate(hasher.final()); | 11999 | return @truncate(hasher.final()); |
| ... | @@ -12020,7 +12020,7 @@ fn getOrPutConstantAggregateAssumeCapacity( | ... | @@ -12020,7 +12020,7 @@ fn getOrPutConstantAggregateAssumeCapacity( |
| 12020 | }); | 12020 | }); |
| 12021 | self.constant_extra.appendSliceAssumeCapacity(@ptrCast(vals)); | 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 | fn addConstantExtraAssumeCapacity(self: *Builder, extra: anytype) Constant.Item.ExtraIndex { | 12026 | fn addConstantExtraAssumeCapacity(self: *Builder, extra: anytype) Constant.Item.ExtraIndex { |
| ... | @@ -12030,7 +12030,7 @@ fn addConstantExtraAssumeCapacity(self: *Builder, extra: anytype) Constant.Item. | ... | @@ -12030,7 +12030,7 @@ fn addConstantExtraAssumeCapacity(self: *Builder, extra: anytype) Constant.Item. |
| 12030 | const value = @field(extra, field_name); | 12030 | const value = @field(extra, field_name); |
| 12031 | self.constant_extra.appendAssumeCapacity(switch (field_type) { | 12031 | self.constant_extra.appendAssumeCapacity(switch (field_type) { |
| 12032 | u32 => value, | 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 | Constant.GetElementPtr.Info => @bitCast(value), | 12034 | Constant.GetElementPtr.Info => @bitCast(value), |
| 12035 | else => @compileError("bad field type: " ++ @typeName(field_type)), | 12035 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 12036 | }); | 12036 | }); |
| ... | @@ -12073,7 +12073,7 @@ fn constantExtraDataTrail( | ... | @@ -12073,7 +12073,7 @@ fn constantExtraDataTrail( |
| 12073 | ) |field_name, field_type, value| | 12073 | ) |field_name, field_type, value| |
| 12074 | @field(result, field_name) = switch (field_type) { | 12074 | @field(result, field_name) = switch (field_type) { |
| 12075 | u32 => value, | 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 | Constant.GetElementPtr.Info => @bitCast(value), | 12077 | Constant.GetElementPtr.Info => @bitCast(value), |
| 12078 | else => @compileError("bad field type: " ++ @typeName(field_type)), | 12078 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 12079 | }; | 12079 | }; |
| ... | @@ -12108,7 +12108,7 @@ fn addMetadataExtraAssumeCapacity(self: *Builder, extra: anytype) Metadata.Item. | ... | @@ -12108,7 +12108,7 @@ fn addMetadataExtraAssumeCapacity(self: *Builder, extra: anytype) Metadata.Item. |
| 12108 | const value = @field(extra, field_name); | 12108 | const value = @field(extra, field_name); |
| 12109 | self.metadata_extra.appendAssumeCapacity(switch (field_type) { | 12109 | self.metadata_extra.appendAssumeCapacity(switch (field_type) { |
| 12110 | u32 => value, | 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 | Metadata, Metadata.Optional, Metadata.DIFlags => @bitCast(value), | 12112 | Metadata, Metadata.Optional, Metadata.DIFlags => @bitCast(value), |
| 12113 | else => @compileError("bad field type: " ++ @typeName(field_type)), | 12113 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 12114 | }); | 12114 | }); |
| ... | @@ -12151,7 +12151,7 @@ fn metadataExtraDataTrail( | ... | @@ -12151,7 +12151,7 @@ fn metadataExtraDataTrail( |
| 12151 | ) |field_name, field_type, value| | 12151 | ) |field_name, field_type, value| |
| 12152 | @field(result, field_name) = switch (field_type) { | 12152 | @field(result, field_name) = switch (field_type) { |
| 12153 | u32 => value, | 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 | Metadata, Metadata.Optional, Metadata.DIFlags => @bitCast(value), | 12155 | Metadata, Metadata.Optional, Metadata.DIFlags => @bitCast(value), |
| 12156 | else => @compileError("bad field type: " ++ @typeName(field_type)), | 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,7 +12181,7 @@ pub fn metadataString(self: *Builder, bytes: []const u8) Allocator.Error!Metadat |
| 12181 | @intCast(self.metadata_string_bytes.items.len), | 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 | pub fn metadataStringFromStrtabString( | 12187 | pub fn metadataStringFromStrtabString( |
| ... | @@ -12230,7 +12230,7 @@ pub fn trailingMetadataStringAssumeCapacity(self: *Builder) Metadata.String { | ... | @@ -12230,7 +12230,7 @@ pub fn trailingMetadataStringAssumeCapacity(self: *Builder) Metadata.String { |
| 12230 | } else { | 12230 | } else { |
| 12231 | self.metadata_string_indices.appendAssumeCapacity(@intCast(self.metadata_string_bytes.items.len)); | 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 | pub fn addNamedMetadata(self: *Builder, name: String, operands: []const Metadata) Allocator.Error!void { | 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,7 +12662,7 @@ fn metadataSimpleAssumeCapacity(self: *Builder, tag: Metadata.Tag, value: anytyp |
| 12662 | const Adapter = struct { | 12662 | const Adapter = struct { |
| 12663 | builder: *const Builder, | 12663 | builder: *const Builder, |
| 12664 | pub fn hash(_: @This(), key: Key) u32 { | 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 | inline for (comptime std.meta.fieldNames(@TypeOf(value))) |field_name| { | 12666 | inline for (comptime std.meta.fieldNames(@TypeOf(value))) |field_name| { |
| 12667 | hasher.update(std.mem.asBytes(&@field(key.value, field_name))); | 12667 | hasher.update(std.mem.asBytes(&@field(key.value, field_name))); |
| 12668 | } | 12668 | } |
| ... | @@ -12759,8 +12759,8 @@ fn debugSubprogramAssumeCapacity( | ... | @@ -12759,8 +12759,8 @@ fn debugSubprogramAssumeCapacity( |
| 12759 | compile_unit: ?Metadata, | 12759 | compile_unit: ?Metadata, |
| 12760 | ) Metadata { | 12760 | ) Metadata { |
| 12761 | assert(!self.strip); | 12761 | assert(!self.strip); |
| 12762 | const tag: Metadata.Tag = @enumFromInt(@intFromEnum(Metadata.Tag.subprogram) + | 12762 | const tag: Metadata.Tag = @fromBackingInt(@intCast(@backingInt(Metadata.Tag.subprogram) + |
| 12763 | @as(u3, @truncate(@as(u32, @bitCast(options.sp_flags)) >> 2))); | 12763 | @as(u3, @truncate(@as(u32, @bitCast(options.sp_flags)) >> 2)))); |
| 12764 | return self.metadataDistinctAssumeCapacity(tag, Metadata.Subprogram{ | 12764 | return self.metadataDistinctAssumeCapacity(tag, Metadata.Subprogram{ |
| 12765 | .file = .wrap(file), | 12765 | .file = .wrap(file), |
| 12766 | .name = .wrap(name), | 12766 | .name = .wrap(name), |
| ... | @@ -13105,7 +13105,7 @@ fn debugEnumeratorAssumeCapacity( | ... | @@ -13105,7 +13105,7 @@ fn debugEnumeratorAssumeCapacity( |
| 13105 | const Adapter = struct { | 13105 | const Adapter = struct { |
| 13106 | builder: *const Builder, | 13106 | builder: *const Builder, |
| 13107 | pub fn hash(_: @This(), key: Key) u32 { | 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 | hasher.update(std.mem.asBytes(&key.name)); | 13109 | hasher.update(std.mem.asBytes(&key.name)); |
| 13110 | hasher.update(std.mem.asBytes(&key.bit_width)); | 13110 | hasher.update(std.mem.asBytes(&key.bit_width)); |
| 13111 | hasher.update(std.mem.sliceAsBytes(key.value.limbs)); | 13111 | hasher.update(std.mem.sliceAsBytes(key.value.limbs)); |
| ... | @@ -13178,7 +13178,7 @@ fn debugExpressionAssumeCapacity(self: *Builder, elements: []const u32) Metadata | ... | @@ -13178,7 +13178,7 @@ fn debugExpressionAssumeCapacity(self: *Builder, elements: []const u32) Metadata |
| 13178 | builder: *const Builder, | 13178 | builder: *const Builder, |
| 13179 | pub fn hash(_: @This(), key: Key) u32 { | 13179 | pub fn hash(_: @This(), key: Key) u32 { |
| 13180 | var hasher = | 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 | hasher.update(std.mem.sliceAsBytes(key.elements)); | 13182 | hasher.update(std.mem.sliceAsBytes(key.elements)); |
| 13183 | return @truncate(hasher.final()); | 13183 | return @truncate(hasher.final()); |
| 13184 | } | 13184 | } |
| ... | @@ -13222,7 +13222,7 @@ fn metadataTupleOptionalsAssumeCapacity(self: *Builder, elements: []const Metada | ... | @@ -13222,7 +13222,7 @@ fn metadataTupleOptionalsAssumeCapacity(self: *Builder, elements: []const Metada |
| 13222 | const Adapter = struct { | 13222 | const Adapter = struct { |
| 13223 | builder: *const Builder, | 13223 | builder: *const Builder, |
| 13224 | pub fn hash(_: @This(), key: Key) u32 { | 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 | hasher.update(std.mem.sliceAsBytes(key.elements)); | 13226 | hasher.update(std.mem.sliceAsBytes(key.elements)); |
| 13227 | return @truncate(hasher.final()); | 13227 | return @truncate(hasher.final()); |
| 13228 | } | 13228 | } |
| ... | @@ -13338,14 +13338,14 @@ fn metadataConstantAssumeCapacity(self: *Builder, constant: Constant) Metadata { | ... | @@ -13338,14 +13338,14 @@ fn metadataConstantAssumeCapacity(self: *Builder, constant: Constant) Metadata { |
| 13338 | const Adapter = struct { | 13338 | const Adapter = struct { |
| 13339 | builder: *const Builder, | 13339 | builder: *const Builder, |
| 13340 | pub fn hash(_: @This(), key: Constant) u32 { | 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 | hasher.update(std.mem.asBytes(&key)); | 13342 | hasher.update(std.mem.asBytes(&key)); |
| 13343 | return @truncate(hasher.final()); | 13343 | return @truncate(hasher.final()); |
| 13344 | } | 13344 | } |
| 13345 | 13345 | ||
| 13346 | pub fn eql(ctx: @This(), lhs_key: Constant, _: void, rhs_index: usize) bool { | 13346 | pub fn eql(ctx: @This(), lhs_key: Constant, _: void, rhs_index: usize) bool { |
| 13347 | if (Metadata.Tag.constant != ctx.builder.metadata_items.items(.tag)[rhs_index]) return false; | 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 | return rhs_data == lhs_key; | 13349 | return rhs_data == lhs_key; |
| 13350 | } | 13350 | } |
| 13351 | }; | 13351 | }; |
| ... | @@ -13360,7 +13360,7 @@ fn metadataConstantAssumeCapacity(self: *Builder, constant: Constant) Metadata { | ... | @@ -13360,7 +13360,7 @@ fn metadataConstantAssumeCapacity(self: *Builder, constant: Constant) Metadata { |
| 13360 | gop.value_ptr.* = {}; | 13360 | gop.value_ptr.* = {}; |
| 13361 | self.metadata_items.appendAssumeCapacity(.{ | 13361 | self.metadata_items.appendAssumeCapacity(.{ |
| 13362 | .tag = .constant, | 13362 | .tag = .constant, |
| 13363 | .data = @intFromEnum(constant), | 13363 | .data = @backingInt(constant), |
| 13364 | }); | 13364 | }); |
| 13365 | } | 13365 | } |
| 13366 | return .{ .index = @intCast(gop.index), .kind = .node }; | 13366 | return .{ .index = @intCast(gop.index), .kind = .node }; |
| ... | @@ -13447,10 +13447,10 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13447,10 +13447,10 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13447 | try type_block.writeAbbrev(TypeBlock.NumEntry{ .num = @intCast(self.type_items.items.len) }); | 13447 | try type_block.writeAbbrev(TypeBlock.NumEntry{ .num = @intCast(self.type_items.items.len) }); |
| 13448 | 13448 | ||
| 13449 | for (self.type_items.items, 0..) |item, i| { | 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 | switch (item.tag) { | 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 | .integer => try type_block.writeAbbrev(TypeBlock.Integer{ .width = item.data }), | 13454 | .integer => try type_block.writeAbbrev(TypeBlock.Integer{ .width = item.data }), |
| 13455 | .structure, | 13455 | .structure, |
| 13456 | .packed_structure, | 13456 | .packed_structure, |
| ... | @@ -13475,7 +13475,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13475,7 +13475,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13475 | switch (extra.body) { | 13475 | switch (extra.body) { |
| 13476 | .none => try type_block.writeAbbrev(TypeBlock.Opaque{}), | 13476 | .none => try type_block.writeAbbrev(TypeBlock.Opaque{}), |
| 13477 | else => { | 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 | const is_packed: bool = switch (real_struct.tag) { | 13479 | const is_packed: bool = switch (real_struct.tag) { |
| 13480 | .structure => false, | 13480 | .structure => false, |
| 13481 | .packed_structure => true, | 13481 | .packed_structure => true, |
| ... | @@ -13648,7 +13648,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13648,7 +13648,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13648 | => { | 13648 | => { |
| 13649 | try record.ensureUnusedCapacity(self.gpa, 2); | 13649 | try record.ensureUnusedCapacity(self.gpa, 2); |
| 13650 | record.appendAssumeCapacity(0); | 13650 | record.appendAssumeCapacity(0); |
| 13651 | record.appendAssumeCapacity(@intFromEnum(kind)); | 13651 | record.appendAssumeCapacity(@backingInt(kind)); |
| 13652 | }, | 13652 | }, |
| 13653 | .byval, | 13653 | .byval, |
| 13654 | .byref, | 13654 | .byref, |
| ... | @@ -13659,15 +13659,15 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13659,15 +13659,15 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13659 | => |ty| { | 13659 | => |ty| { |
| 13660 | try record.ensureUnusedCapacity(self.gpa, 3); | 13660 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13661 | record.appendAssumeCapacity(6); | 13661 | record.appendAssumeCapacity(6); |
| 13662 | record.appendAssumeCapacity(@intFromEnum(kind)); | 13662 | record.appendAssumeCapacity(@backingInt(kind)); |
| 13663 | record.appendAssumeCapacity(@intFromEnum(ty)); | 13663 | record.appendAssumeCapacity(@backingInt(ty)); |
| 13664 | }, | 13664 | }, |
| 13665 | .@"align", | 13665 | .@"align", |
| 13666 | .alignstack, | 13666 | .alignstack, |
| 13667 | => |alignment| { | 13667 | => |alignment| { |
| 13668 | try record.ensureUnusedCapacity(self.gpa, 3); | 13668 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13669 | record.appendAssumeCapacity(1); | 13669 | record.appendAssumeCapacity(1); |
| 13670 | record.appendAssumeCapacity(@intFromEnum(kind)); | 13670 | record.appendAssumeCapacity(@backingInt(kind)); |
| 13671 | record.appendAssumeCapacity(alignment.resolve(self).toByteUnits() orelse 0); | 13671 | record.appendAssumeCapacity(alignment.resolve(self).toByteUnits() orelse 0); |
| 13672 | }, | 13672 | }, |
| 13673 | .dereferenceable, | 13673 | .dereferenceable, |
| ... | @@ -13675,44 +13675,44 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13675,44 +13675,44 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13675 | => |size| { | 13675 | => |size| { |
| 13676 | try record.ensureUnusedCapacity(self.gpa, 3); | 13676 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13677 | record.appendAssumeCapacity(1); | 13677 | record.appendAssumeCapacity(1); |
| 13678 | record.appendAssumeCapacity(@intFromEnum(kind)); | 13678 | record.appendAssumeCapacity(@backingInt(kind)); |
| 13679 | record.appendAssumeCapacity(size); | 13679 | record.appendAssumeCapacity(size); |
| 13680 | }, | 13680 | }, |
| 13681 | .nofpclass => |fpclass| { | 13681 | .nofpclass => |fpclass| { |
| 13682 | try record.ensureUnusedCapacity(self.gpa, 3); | 13682 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13683 | record.appendAssumeCapacity(1); | 13683 | record.appendAssumeCapacity(1); |
| 13684 | record.appendAssumeCapacity(@intFromEnum(kind)); | 13684 | record.appendAssumeCapacity(@backingInt(kind)); |
| 13685 | record.appendAssumeCapacity(@as(u32, @bitCast(fpclass))); | 13685 | record.appendAssumeCapacity(@as(u32, @bitCast(fpclass))); |
| 13686 | }, | 13686 | }, |
| 13687 | .allockind => |allockind| { | 13687 | .allockind => |allockind| { |
| 13688 | try record.ensureUnusedCapacity(self.gpa, 3); | 13688 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13689 | record.appendAssumeCapacity(1); | 13689 | record.appendAssumeCapacity(1); |
| 13690 | record.appendAssumeCapacity(@intFromEnum(kind)); | 13690 | record.appendAssumeCapacity(@backingInt(kind)); |
| 13691 | record.appendAssumeCapacity(@as(u32, @bitCast(allockind))); | 13691 | record.appendAssumeCapacity(@as(u32, @bitCast(allockind))); |
| 13692 | }, | 13692 | }, |
| 13693 | 13693 | ||
| 13694 | .allocsize => |allocsize| { | 13694 | .allocsize => |allocsize| { |
| 13695 | try record.ensureUnusedCapacity(self.gpa, 3); | 13695 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13696 | record.appendAssumeCapacity(1); | 13696 | record.appendAssumeCapacity(1); |
| 13697 | record.appendAssumeCapacity(@intFromEnum(kind)); | 13697 | record.appendAssumeCapacity(@backingInt(kind)); |
| 13698 | record.appendAssumeCapacity(@bitCast(allocsize.toLlvm())); | 13698 | record.appendAssumeCapacity(@bitCast(allocsize.toLlvm())); |
| 13699 | }, | 13699 | }, |
| 13700 | .memory => |memory| { | 13700 | .memory => |memory| { |
| 13701 | try record.ensureUnusedCapacity(self.gpa, 3); | 13701 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13702 | record.appendAssumeCapacity(1); | 13702 | record.appendAssumeCapacity(1); |
| 13703 | record.appendAssumeCapacity(@intFromEnum(kind)); | 13703 | record.appendAssumeCapacity(@backingInt(kind)); |
| 13704 | record.appendAssumeCapacity(@as(u32, @bitCast(memory))); | 13704 | record.appendAssumeCapacity(@as(u32, @bitCast(memory))); |
| 13705 | }, | 13705 | }, |
| 13706 | .uwtable => |uwtable| if (uwtable != .none) { | 13706 | .uwtable => |uwtable| if (uwtable != .none) { |
| 13707 | try record.ensureUnusedCapacity(self.gpa, 3); | 13707 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13708 | record.appendAssumeCapacity(1); | 13708 | record.appendAssumeCapacity(1); |
| 13709 | record.appendAssumeCapacity(@intFromEnum(kind)); | 13709 | record.appendAssumeCapacity(@backingInt(kind)); |
| 13710 | record.appendAssumeCapacity(@intFromEnum(uwtable)); | 13710 | record.appendAssumeCapacity(@backingInt(uwtable)); |
| 13711 | }, | 13711 | }, |
| 13712 | .vscale_range => |vscale_range| { | 13712 | .vscale_range => |vscale_range| { |
| 13713 | try record.ensureUnusedCapacity(self.gpa, 3); | 13713 | try record.ensureUnusedCapacity(self.gpa, 3); |
| 13714 | record.appendAssumeCapacity(1); | 13714 | record.appendAssumeCapacity(1); |
| 13715 | record.appendAssumeCapacity(@intFromEnum(kind)); | 13715 | record.appendAssumeCapacity(@backingInt(kind)); |
| 13716 | record.appendAssumeCapacity(@bitCast(vscale_range.toLlvm())); | 13716 | record.appendAssumeCapacity(@bitCast(vscale_range.toLlvm())); |
| 13717 | }, | 13717 | }, |
| 13718 | .string => |string_attr| { | 13718 | .string => |string_attr| { |
| ... | @@ -13787,7 +13787,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13787,7 +13787,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13787 | for (self.variables.items, 0..) |variable, variable_i| { | 13787 | for (self.variables.items, 0..) |variable, variable_i| { |
| 13788 | // Skip the variable if its global has been repurposed for something else. | 13788 | // Skip the variable if its global has been repurposed for something else. |
| 13789 | switch (variable.global.ptrConst(self).kind) { | 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 | else => continue, | 13791 | else => continue, |
| 13792 | } | 13792 | } |
| 13793 | 13793 | ||
| ... | @@ -13797,7 +13797,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13797,7 +13797,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13797 | for (self.functions.items, 0..) |function, function_i| { | 13797 | for (self.functions.items, 0..) |function, function_i| { |
| 13798 | // Skip the function if its global has been repurposed for something else. | 13798 | // Skip the function if its global has been repurposed for something else. |
| 13799 | switch (function.global.ptrConst(self).kind) { | 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 | else => continue, | 13801 | else => continue, |
| 13802 | } | 13802 | } |
| 13803 | 13803 | ||
| ... | @@ -13807,7 +13807,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13807,7 +13807,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13807 | for (self.aliases.items, 0..) |alias, alias_i| { | 13807 | for (self.aliases.items, 0..) |alias, alias_i| { |
| 13808 | // Skip the alias if its global has been repurposed for something else. | 13808 | // Skip the alias if its global has been repurposed for something else. |
| 13809 | switch (alias.global.ptrConst(self).kind) { | 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 | else => continue, | 13811 | else => continue, |
| 13812 | } | 13812 | } |
| 13813 | 13813 | ||
| ... | @@ -13854,7 +13854,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13854,7 +13854,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13854 | for (self.variables.items, 0..) |variable, variable_i| { | 13854 | for (self.variables.items, 0..) |variable, variable_i| { |
| 13855 | // Skip the variable if its global has been repurposed for something else. | 13855 | // Skip the variable if its global has been repurposed for something else. |
| 13856 | switch (variable.global.ptrConst(self).kind) { | 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 | else => continue, | 13858 | else => continue, |
| 13859 | } | 13859 | } |
| 13860 | 13860 | ||
| ... | @@ -13905,7 +13905,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13905,7 +13905,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13905 | for (self.functions.items, 0..) |func, func_i| { | 13905 | for (self.functions.items, 0..) |func, func_i| { |
| 13906 | // Skip the function if its global has been repurposed for something else. | 13906 | // Skip the function if its global has been repurposed for something else. |
| 13907 | switch (func.global.ptrConst(self).kind) { | 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 | else => continue, | 13909 | else => continue, |
| 13910 | } | 13910 | } |
| 13911 | 13911 | ||
| ... | @@ -13950,7 +13950,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13950,7 +13950,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13950 | for (self.aliases.items, 0..) |alias, alias_i| { | 13950 | for (self.aliases.items, 0..) |alias, alias_i| { |
| 13951 | // Skip the alias if its global has been repurposed for something else. | 13951 | // Skip the alias if its global has been repurposed for something else. |
| 13952 | switch (alias.global.ptrConst(self).kind) { | 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 | else => continue, | 13954 | else => continue, |
| 13955 | } | 13955 | } |
| 13956 | 13956 | ||
| ... | @@ -13983,7 +13983,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -13983,7 +13983,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 13983 | const datas = self.constant_items.items(.data); | 13983 | const datas = self.constant_items.items(.data); |
| 13984 | for (0..self.constant_items.len) |index| { | 13984 | for (0..self.constant_items.len) |index| { |
| 13985 | record.clearRetainingCapacity(); | 13985 | record.clearRetainingCapacity(); |
| 13986 | const constant: Constant = @enumFromInt(index); | 13986 | const constant: Constant = @fromBackingInt(@intCast(index)); |
| 13987 | const constant_type = constant.typeOf(self); | 13987 | const constant_type = constant.typeOf(self); |
| 13988 | if (constant_type != current_type) { | 13988 | if (constant_type != current_type) { |
| 13989 | try constants_block.writeAbbrev(ConstantsBlock.SetType{ .type_id = constant_type }); | 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,7 +14096,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14096 | } | 14096 | } |
| 14097 | }, | 14097 | }, |
| 14098 | .string => { | 14098 | .string => { |
| 14099 | const str: String = @enumFromInt(data); | 14099 | const str: String = @fromBackingInt(@intCast(data)); |
| 14100 | if (str == .none) { | 14100 | if (str == .none) { |
| 14101 | try constants_block.writeAbbrev(ConstantsBlock.Null{}); | 14101 | try constants_block.writeAbbrev(ConstantsBlock.Null{}); |
| 14102 | } else { | 14102 | } else { |
| ... | @@ -14143,13 +14143,13 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -14143,13 +14143,13 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14143 | const indices = extra.trail.next(extra.data.info.indices_len, Constant, self); | 14143 | const indices = extra.trail.next(extra.data.info.indices_len, Constant, self); |
| 14144 | try record.ensureUnusedCapacity(self.gpa, 1 + 2 + 2 * indices.len); | 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 | record.appendAssumeCapacity(constant_adapter.getConstantIndex(extra.data.base)); | 14149 | record.appendAssumeCapacity(constant_adapter.getConstantIndex(extra.data.base)); |
| 14150 | 14150 | ||
| 14151 | for (indices) |i| { | 14151 | for (indices) |i| { |
| 14152 | record.appendAssumeCapacity(@intFromEnum(i.typeOf(self))); | 14152 | record.appendAssumeCapacity(@backingInt(i.typeOf(self))); |
| 14153 | record.appendAssumeCapacity(constant_adapter.getConstantIndex(i)); | 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,7 +14183,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14183 | 14183 | ||
| 14184 | try record.ensureUnusedCapacity(self.gpa, 4 + assembly_slice.len + constraints_slice.len); | 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 | record.appendAssumeCapacity(switch (tag) { | 14187 | record.appendAssumeCapacity(switch (tag) { |
| 14188 | .@"asm" => 0, | 14188 | .@"asm" => 0, |
| 14189 | .@"asm sideeffect" => 0b0001, | 14189 | .@"asm sideeffect" => 0b0001, |
| ... | @@ -14217,13 +14217,13 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -14217,13 +14217,13 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14217 | try constants_block.writeAbbrev(ConstantsBlock.BlockAddress{ | 14217 | try constants_block.writeAbbrev(ConstantsBlock.BlockAddress{ |
| 14218 | .type_id = extra.function.typeOf(self), | 14218 | .type_id = extra.function.typeOf(self), |
| 14219 | .function = constant_adapter.getConstantIndex(extra.function.toConst(self)), | 14219 | .function = constant_adapter.getConstantIndex(extra.function.toConst(self)), |
| 14220 | .block = @intFromEnum(extra.block), | 14220 | .block = @backingInt(extra.block), |
| 14221 | }); | 14221 | }); |
| 14222 | }, | 14222 | }, |
| 14223 | .dso_local_equivalent, | 14223 | .dso_local_equivalent, |
| 14224 | .no_cfi, | 14224 | .no_cfi, |
| 14225 | => |tag| { | 14225 | => |tag| { |
| 14226 | const function: Function.Index = @enumFromInt(data); | 14226 | const function: Function.Index = @fromBackingInt(@intCast(data)); |
| 14227 | try constants_block.writeAbbrev(ConstantsBlock.DsoLocalEquivalentOrNoCfi{ | 14227 | try constants_block.writeAbbrev(ConstantsBlock.DsoLocalEquivalentOrNoCfi{ |
| 14228 | .code = switch (tag) { | 14228 | .code = switch (tag) { |
| 14229 | .dso_local_equivalent => .DSO_LOCAL_EQUIVALENT, | 14229 | .dso_local_equivalent => .DSO_LOCAL_EQUIVALENT, |
| ... | @@ -14384,7 +14384,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -14384,7 +14384,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14384 | .ty = extra.ty, | 14384 | .ty = extra.ty, |
| 14385 | .scope_line = extra.scope_line, | 14385 | .scope_line = extra.scope_line, |
| 14386 | .sp_flags = @bitCast(@as(u32, @as(u3, @intCast( | 14386 | .sp_flags = @bitCast(@as(u32, @as(u3, @intCast( |
| 14387 | @intFromEnum(kind) - @intFromEnum(Metadata.Tag.subprogram), | 14387 | @backingInt(kind) - @backingInt(Metadata.Tag.subprogram), |
| 14388 | ))) << 2), | 14388 | ))) << 2), |
| 14389 | .flags = extra.di_flags, | 14389 | .flags = extra.di_flags, |
| 14390 | .compile_unit = extra.compile_unit, | 14390 | .compile_unit = extra.compile_unit, |
| ... | @@ -14528,7 +14528,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -14528,7 +14528,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14528 | else | 14528 | else |
| 14529 | -%val << 1 | 1); | 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 | continue; | 14532 | continue; |
| 14533 | }; | 14533 | }; |
| 14534 | try metadata_block.writeAbbrevAdapted(MetadataBlock.Enumerator{ | 14534 | try metadata_block.writeAbbrevAdapted(MetadataBlock.Enumerator{ |
| ... | @@ -14606,7 +14606,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -14606,7 +14606,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14606 | }, metadata_adapter); | 14606 | }, metadata_adapter); |
| 14607 | }, | 14607 | }, |
| 14608 | .constant => { | 14608 | .constant => { |
| 14609 | const constant: Constant = @enumFromInt(data); | 14609 | const constant: Constant = @fromBackingInt(@intCast(data)); |
| 14610 | try metadata_block.writeAbbrevAdapted(MetadataBlock.Constant{ | 14610 | try metadata_block.writeAbbrevAdapted(MetadataBlock.Constant{ |
| 14611 | .ty = constant.typeOf(self), | 14611 | .ty = constant.typeOf(self), |
| 14612 | .constant = constant, | 14612 | .constant = constant, |
| ... | @@ -14663,28 +14663,28 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -14663,28 +14663,28 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14663 | var block_info_block = try module_block.enterSubBlock(BlockInfoBlock, true); | 14663 | var block_info_block = try module_block.enterSubBlock(BlockInfoBlock, true); |
| 14664 | 14664 | ||
| 14665 | try block_info_block.writeUnabbrev(BlockInfoBlock.set_block_id, &.{ | 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 | inline for (ir.ModuleBlock.FunctionBlock.abbrevs) |abbrev| { | 14668 | inline for (ir.ModuleBlock.FunctionBlock.abbrevs) |abbrev| { |
| 14669 | try block_info_block.defineAbbrev(&abbrev.ops); | 14669 | try block_info_block.defineAbbrev(&abbrev.ops); |
| 14670 | } | 14670 | } |
| 14671 | 14671 | ||
| 14672 | try block_info_block.writeUnabbrev(BlockInfoBlock.set_block_id, &.{ | 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 | inline for (ir.ModuleBlock.FunctionBlock.ValueSymtabBlock.abbrevs) |abbrev| { | 14675 | inline for (ir.ModuleBlock.FunctionBlock.ValueSymtabBlock.abbrevs) |abbrev| { |
| 14676 | try block_info_block.defineAbbrev(&abbrev.ops); | 14676 | try block_info_block.defineAbbrev(&abbrev.ops); |
| 14677 | } | 14677 | } |
| 14678 | 14678 | ||
| 14679 | try block_info_block.writeUnabbrev(BlockInfoBlock.set_block_id, &.{ | 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 | inline for (ir.ModuleBlock.FunctionBlock.MetadataBlock.abbrevs) |abbrev| { | 14682 | inline for (ir.ModuleBlock.FunctionBlock.MetadataBlock.abbrevs) |abbrev| { |
| 14683 | try block_info_block.defineAbbrev(&abbrev.ops); | 14683 | try block_info_block.defineAbbrev(&abbrev.ops); |
| 14684 | } | 14684 | } |
| 14685 | 14685 | ||
| 14686 | try block_info_block.writeUnabbrev(BlockInfoBlock.set_block_id, &.{ | 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 | inline for (ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock.abbrevs) |abbrev| { | 14689 | inline for (ir.ModuleBlock.FunctionBlock.MetadataAttachmentBlock.abbrevs) |abbrev| { |
| 14690 | try block_info_block.defineAbbrev(&abbrev.ops); | 14690 | try block_info_block.defineAbbrev(&abbrev.ops); |
| ... | @@ -14760,7 +14760,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -14760,7 +14760,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14760 | for (self.functions.items, 0..) |func, func_index| { | 14760 | for (self.functions.items, 0..) |func, func_index| { |
| 14761 | // Skip the function if its global has been repurposed for something else. | 14761 | // Skip the function if its global has been repurposed for something else. |
| 14762 | switch (func.global.ptrConst(self).kind) { | 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 | else => continue, | 14764 | else => continue, |
| 14765 | } | 14765 | } |
| 14766 | 14766 | ||
| ... | @@ -14775,7 +14775,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -14775,7 +14775,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14775 | var adapter: FunctionAdapter = .{ | 14775 | var adapter: FunctionAdapter = .{ |
| 14776 | .metadata_adapter = metadata_adapter, | 14776 | .metadata_adapter = metadata_adapter, |
| 14777 | .func = &func, | 14777 | .func = &func, |
| 14778 | .instruction_index = @enumFromInt(0), | 14778 | .instruction_index = @fromBackingInt(@intCast(0)), |
| 14779 | }; | 14779 | }; |
| 14780 | 14780 | ||
| 14781 | // Emit function level metadata block | 14781 | // Emit function level metadata block |
| ... | @@ -14785,8 +14785,8 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -14785,8 +14785,8 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14785 | 14785 | ||
| 14786 | for (func.debug_values) |value| { | 14786 | for (func.debug_values) |value| { |
| 14787 | try metadata_block.writeAbbrev(MetadataBlock.Value{ | 14787 | try metadata_block.writeAbbrev(MetadataBlock.Value{ |
| 14788 | .ty = value.typeOf(@enumFromInt(func_index), self), | 14788 | .ty = value.typeOf(@fromBackingInt(@intCast(func_index)), self), |
| 14789 | .value = @enumFromInt(adapter.getValueIndex(value.toValue())), | 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,7 +14800,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14800 | 14800 | ||
| 14801 | var block_incoming_len: u32 = undefined; | 14801 | var block_incoming_len: u32 = undefined; |
| 14802 | for (tags, datas, 0..) |tag, data, instr_index| { | 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 | record.clearRetainingCapacity(); | 14804 | record.clearRetainingCapacity(); |
| 14805 | 14805 | ||
| 14806 | switch (tag) { | 14806 | switch (tag) { |
| ... | @@ -14962,7 +14962,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -14962,7 +14962,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 14962 | const alignment = extra.info.alignment.toLlvm(); | 14962 | const alignment = extra.info.alignment.toLlvm(); |
| 14963 | try function_block.writeAbbrev(FunctionBlock.Alloca{ | 14963 | try function_block.writeAbbrev(FunctionBlock.Alloca{ |
| 14964 | .inst_type = extra.type, | 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 | .len_value = adapter.getValueIndex(extra.len), | 14966 | .len_value = adapter.getValueIndex(extra.len), |
| 14967 | .flags = .{ | 14967 | .flags = .{ |
| 14968 | .align_lower = @truncate(alignment), | 14968 | .align_lower = @truncate(alignment), |
| ... | @@ -15068,10 +15068,10 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -15068,10 +15068,10 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15068 | }); | 15068 | }); |
| 15069 | }, | 15069 | }, |
| 15070 | .fneg => try function_block.writeAbbrev(FunctionBlock.FNeg{ | 15070 | .fneg => try function_block.writeAbbrev(FunctionBlock.FNeg{ |
| 15071 | .val = adapter.getOffsetValueIndex(@enumFromInt(data)), | 15071 | .val = adapter.getOffsetValueIndex(@fromBackingInt(@intCast(data))), |
| 15072 | }), | 15072 | }), |
| 15073 | .@"fneg fast" => try function_block.writeAbbrev(FunctionBlock.FNegFast{ | 15073 | .@"fneg fast" => try function_block.writeAbbrev(FunctionBlock.FNegFast{ |
| 15074 | .val = adapter.getOffsetValueIndex(@enumFromInt(data)), | 15074 | .val = adapter.getOffsetValueIndex(@fromBackingInt(@intCast(data))), |
| 15075 | .fast_math = FastMath.fast, | 15075 | .fast_math = FastMath.fast, |
| 15076 | }), | 15076 | }), |
| 15077 | .extractvalue => { | 15077 | .extractvalue => { |
| ... | @@ -15096,7 +15096,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -15096,7 +15096,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15096 | extra.trail.next(extra.data.targets_len, Function.Block.Index, &func); | 15096 | extra.trail.next(extra.data.targets_len, Function.Block.Index, &func); |
| 15097 | try function_block.writeAbbrevAdapted( | 15097 | try function_block.writeAbbrevAdapted( |
| 15098 | FunctionBlock.IndirectBr{ | 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 | .addr = extra.data.addr, | 15100 | .addr = extra.data.addr, |
| 15101 | .targets = targets, | 15101 | .targets = targets, |
| 15102 | }, | 15102 | }, |
| ... | @@ -15208,8 +15208,8 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -15208,8 +15208,8 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15208 | .br_cond => { | 15208 | .br_cond => { |
| 15209 | const extra = func.extraData(Function.Instruction.BrCond, data); | 15209 | const extra = func.extraData(Function.Instruction.BrCond, data); |
| 15210 | try function_block.writeAbbrev(FunctionBlock.BrConditional{ | 15210 | try function_block.writeAbbrev(FunctionBlock.BrConditional{ |
| 15211 | .then_block = @intFromEnum(extra.then), | 15211 | .then_block = @backingInt(extra.then), |
| 15212 | .else_block = @intFromEnum(extra.@"else"), | 15212 | .else_block = @backingInt(extra.@"else"), |
| 15213 | .condition = adapter.getOffsetValueIndex(extra.cond), | 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,19 +15219,19 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15219 | try record.ensureUnusedCapacity(self.gpa, 3 + extra.data.cases_len * 2); | 15219 | try record.ensureUnusedCapacity(self.gpa, 3 + extra.data.cases_len * 2); |
| 15220 | 15220 | ||
| 15221 | // Conditional type | 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 | // Conditional | 15224 | // Conditional |
| 15225 | record.appendAssumeCapacity(adapter.getOffsetValueIndex(extra.data.val)); | 15225 | record.appendAssumeCapacity(adapter.getOffsetValueIndex(extra.data.val)); |
| 15226 | 15226 | ||
| 15227 | // Default block | 15227 | // Default block |
| 15228 | record.appendAssumeCapacity(@intFromEnum(extra.data.default)); | 15228 | record.appendAssumeCapacity(@backingInt(extra.data.default)); |
| 15229 | 15229 | ||
| 15230 | const vals = extra.trail.next(extra.data.cases_len, Constant, &func); | 15230 | const vals = extra.trail.next(extra.data.cases_len, Constant, &func); |
| 15231 | const blocks = extra.trail.next(extra.data.cases_len, Function.Block.Index, &func); | 15231 | const blocks = extra.trail.next(extra.data.cases_len, Function.Block.Index, &func); |
| 15232 | for (vals, blocks) |val, block| { | 15232 | for (vals, blocks) |val, block| { |
| 15233 | record.appendAssumeCapacity(adapter.metadata_adapter.constant_adapter.getConstantIndex(val)); | 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 | try function_block.writeUnabbrev(12, record.items); | 15237 | try function_block.writeUnabbrev(12, record.items); |
| ... | @@ -15239,7 +15239,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -15239,7 +15239,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15239 | .va_arg => { | 15239 | .va_arg => { |
| 15240 | const extra = func.extraData(Function.Instruction.VaArg, data); | 15240 | const extra = func.extraData(Function.Instruction.VaArg, data); |
| 15241 | try function_block.writeAbbrev(FunctionBlock.VaArg{ | 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 | .list = adapter.getOffsetValueIndex(extra.list), | 15243 | .list = adapter.getOffsetValueIndex(extra.list), |
| 15244 | .type = extra.type, | 15244 | .type = extra.type, |
| 15245 | }); | 15245 | }); |
| ... | @@ -15256,14 +15256,14 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco | ... | @@ -15256,14 +15256,14 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15256 | 1 + block_incoming_len * 2 + @intFromBool(kind == .@"phi fast"), | 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 | for (vals, blocks) |val, block| { | 15261 | for (vals, blocks) |val, block| { |
| 15262 | const offset_value = adapter.getOffsetValueSignedIndex(val); | 15262 | const offset_value = adapter.getOffsetValueSignedIndex(val); |
| 15263 | const abs_value: u32 = @intCast(@abs(offset_value)); | 15263 | const abs_value: u32 = @intCast(@abs(offset_value)); |
| 15264 | const signed_vbr = if (offset_value > 0) abs_value << 1 else ((abs_value << 1) | 1); | 15264 | const signed_vbr = if (offset_value > 0) abs_value << 1 else ((abs_value << 1) | 1); |
| 15265 | record.appendAssumeCapacity(signed_vbr); | 15265 | record.appendAssumeCapacity(signed_vbr); |
| 15266 | record.appendAssumeCapacity(@intFromEnum(block)); | 15266 | record.appendAssumeCapacity(@backingInt(block)); |
| 15267 | } | 15267 | } |
| 15268 | 15268 | ||
| 15269 | if (kind == .@"phi fast") record.appendAssumeCapacity(@as(u8, @bitCast(FastMath{}))); | 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,7 +15271,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco |
| 15271 | try function_block.writeUnabbrev(16, record.items); | 15271 | try function_block.writeUnabbrev(16, record.items); |
| 15272 | }, | 15272 | }, |
| 15273 | .ret => try function_block.writeAbbrev(FunctionBlock.Ret{ | 15273 | .ret => try function_block.writeAbbrev(FunctionBlock.Ret{ |
| 15274 | .val = adapter.getOffsetValueIndex(@enumFromInt(data)), | 15274 | .val = adapter.getOffsetValueIndex(@fromBackingInt(@intCast(data))), |
| 15275 | }), | 15275 | }), |
| 15276 | .@"ret void" => try function_block.writeAbbrev(FunctionBlock.RetVoid{}), | 15276 | .@"ret void" => try function_block.writeAbbrev(FunctionBlock.RetVoid{}), |
| 15277 | .atomicrmw => { | 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,7 +423,7 @@ fn BufType(comptime T: type, comptime min_len: usize) type { |
| 423 | fn bufValue(value: anytype, comptime min_len: usize) BufType(@TypeOf(value), min_len) { | 423 | fn bufValue(value: anytype, comptime min_len: usize) BufType(@TypeOf(value), min_len) { |
| 424 | return switch (@typeInfo(@TypeOf(value))) { | 424 | return switch (@typeInfo(@TypeOf(value))) { |
| 425 | .comptime_int, .int => @intCast(value), | 425 | .comptime_int, .int => @intCast(value), |
| 426 | .@"enum" => @intFromEnum(value), | 426 | .@"enum" => @backingInt(value), |
| 427 | .bool => @intFromBool(value), | 427 | .bool => @intFromBool(value), |
| 428 | .@"struct" => @intCast(@as(@Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))), | 428 | .@"struct" => @intCast(@as(@Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))), |
| 429 | else => unreachable, | 429 | else => unreachable, |
lib/std/zig/llvm/ir.zig+108-108| ... | @@ -189,7 +189,7 @@ pub const ModuleBlock = struct { | ... | @@ -189,7 +189,7 @@ pub const ModuleBlock = struct { |
| 189 | 189 | ||
| 190 | pub const Version = struct { | 190 | pub const Version = struct { |
| 191 | pub const ops = [_]AbbrevOp{ | 191 | pub const ops = [_]AbbrevOp{ |
| 192 | .{ .literal = @intFromEnum(ModuleBlock.Code.VERSION) }, | 192 | .{ .literal = @backingInt(ModuleBlock.Code.VERSION) }, |
| 193 | .{ .literal = 2 }, | 193 | .{ .literal = 2 }, |
| 194 | }; | 194 | }; |
| 195 | }; | 195 | }; |
| ... | @@ -211,7 +211,7 @@ pub const ModuleBlock = struct { | ... | @@ -211,7 +211,7 @@ pub const ModuleBlock = struct { |
| 211 | }; | 211 | }; |
| 212 | 212 | ||
| 213 | pub const ops = [_]AbbrevOp{ | 213 | pub const ops = [_]AbbrevOp{ |
| 214 | .{ .literal = @intFromEnum(ModuleBlock.Code.GLOBALVAR) }, // Code | 214 | .{ .literal = @backingInt(ModuleBlock.Code.GLOBALVAR) }, // Code |
| 215 | .{ .vbr = 16 }, // strtab_offset | 215 | .{ .vbr = 16 }, // strtab_offset |
| 216 | .{ .vbr = 16 }, // strtab_size | 216 | .{ .vbr = 16 }, // strtab_size |
| 217 | .{ .fixed_runtime = Builder.Type }, | 217 | .{ .fixed_runtime = Builder.Type }, |
| ... | @@ -247,7 +247,7 @@ pub const ModuleBlock = struct { | ... | @@ -247,7 +247,7 @@ pub const ModuleBlock = struct { |
| 247 | 247 | ||
| 248 | pub const Function = struct { | 248 | pub const Function = struct { |
| 249 | pub const ops = [_]AbbrevOp{ | 249 | pub const ops = [_]AbbrevOp{ |
| 250 | .{ .literal = @intFromEnum(ModuleBlock.Code.FUNCTION) }, // Code | 250 | .{ .literal = @backingInt(ModuleBlock.Code.FUNCTION) }, // Code |
| 251 | .{ .vbr = 16 }, // strtab_offset | 251 | .{ .vbr = 16 }, // strtab_offset |
| 252 | .{ .vbr = 16 }, // strtab_size | 252 | .{ .vbr = 16 }, // strtab_size |
| 253 | .{ .fixed_runtime = Builder.Type }, | 253 | .{ .fixed_runtime = Builder.Type }, |
| ... | @@ -286,7 +286,7 @@ pub const ModuleBlock = struct { | ... | @@ -286,7 +286,7 @@ pub const ModuleBlock = struct { |
| 286 | 286 | ||
| 287 | pub const Alias = struct { | 287 | pub const Alias = struct { |
| 288 | pub const ops = [_]AbbrevOp{ | 288 | pub const ops = [_]AbbrevOp{ |
| 289 | .{ .literal = @intFromEnum(ModuleBlock.Code.ALIAS) }, // Code | 289 | .{ .literal = @backingInt(ModuleBlock.Code.ALIAS) }, // Code |
| 290 | .{ .vbr = 16 }, // strtab_offset | 290 | .{ .vbr = 16 }, // strtab_offset |
| 291 | .{ .vbr = 16 }, // strtab_size | 291 | .{ .vbr = 16 }, // strtab_size |
| 292 | .{ .fixed_runtime = Builder.Type }, | 292 | .{ .fixed_runtime = Builder.Type }, |
| ... | @@ -330,7 +330,7 @@ pub const ModuleBlock = struct { | ... | @@ -330,7 +330,7 @@ pub const ModuleBlock = struct { |
| 330 | 330 | ||
| 331 | pub const Entry = struct { | 331 | pub const Entry = struct { |
| 332 | pub const ops = [_]AbbrevOp{ | 332 | pub const ops = [_]AbbrevOp{ |
| 333 | .{ .literal = @intFromEnum(ModuleBlock.ParamattrBlock.Code.ENTRY) }, | 333 | .{ .literal = @backingInt(ModuleBlock.ParamattrBlock.Code.ENTRY) }, |
| 334 | .{ .array_vbr = 8 }, | 334 | .{ .array_vbr = 8 }, |
| 335 | }; | 335 | }; |
| 336 | group_indices: []const u64, | 336 | group_indices: []const u64, |
| ... | @@ -451,7 +451,7 @@ pub const ModuleBlock = struct { | ... | @@ -451,7 +451,7 @@ pub const ModuleBlock = struct { |
| 451 | 451 | ||
| 452 | pub const SetType = struct { | 452 | pub const SetType = struct { |
| 453 | pub const ops = [_]AbbrevOp{ | 453 | pub const ops = [_]AbbrevOp{ |
| 454 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.SETTYPE) }, | 454 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.SETTYPE) }, |
| 455 | .{ .fixed_runtime = Builder.Type }, | 455 | .{ .fixed_runtime = Builder.Type }, |
| 456 | }; | 456 | }; |
| 457 | type_id: Builder.Type, | 457 | type_id: Builder.Type, |
| ... | @@ -459,25 +459,25 @@ pub const ModuleBlock = struct { | ... | @@ -459,25 +459,25 @@ pub const ModuleBlock = struct { |
| 459 | 459 | ||
| 460 | pub const Null = struct { | 460 | pub const Null = struct { |
| 461 | pub const ops = [_]AbbrevOp{ | 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 | pub const Undef = struct { | 466 | pub const Undef = struct { |
| 467 | pub const ops = [_]AbbrevOp{ | 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 | pub const Poison = struct { | 472 | pub const Poison = struct { |
| 473 | pub const ops = [_]AbbrevOp{ | 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 | pub const Integer = struct { | 478 | pub const Integer = struct { |
| 479 | pub const ops = [_]AbbrevOp{ | 479 | pub const ops = [_]AbbrevOp{ |
| 480 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.INTEGER) }, | 480 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.INTEGER) }, |
| 481 | .{ .vbr = 16 }, | 481 | .{ .vbr = 16 }, |
| 482 | }; | 482 | }; |
| 483 | value: u64, | 483 | value: u64, |
| ... | @@ -485,7 +485,7 @@ pub const ModuleBlock = struct { | ... | @@ -485,7 +485,7 @@ pub const ModuleBlock = struct { |
| 485 | 485 | ||
| 486 | pub const Half = struct { | 486 | pub const Half = struct { |
| 487 | pub const ops = [_]AbbrevOp{ | 487 | pub const ops = [_]AbbrevOp{ |
| 488 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | 488 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) }, |
| 489 | .{ .fixed = 16 }, | 489 | .{ .fixed = 16 }, |
| 490 | }; | 490 | }; |
| 491 | value: u16, | 491 | value: u16, |
| ... | @@ -493,7 +493,7 @@ pub const ModuleBlock = struct { | ... | @@ -493,7 +493,7 @@ pub const ModuleBlock = struct { |
| 493 | 493 | ||
| 494 | pub const Float = struct { | 494 | pub const Float = struct { |
| 495 | pub const ops = [_]AbbrevOp{ | 495 | pub const ops = [_]AbbrevOp{ |
| 496 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | 496 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) }, |
| 497 | .{ .fixed = 32 }, | 497 | .{ .fixed = 32 }, |
| 498 | }; | 498 | }; |
| 499 | value: u32, | 499 | value: u32, |
| ... | @@ -501,7 +501,7 @@ pub const ModuleBlock = struct { | ... | @@ -501,7 +501,7 @@ pub const ModuleBlock = struct { |
| 501 | 501 | ||
| 502 | pub const Double = struct { | 502 | pub const Double = struct { |
| 503 | pub const ops = [_]AbbrevOp{ | 503 | pub const ops = [_]AbbrevOp{ |
| 504 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | 504 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) }, |
| 505 | .{ .vbr = 6 }, | 505 | .{ .vbr = 6 }, |
| 506 | }; | 506 | }; |
| 507 | value: u64, | 507 | value: u64, |
| ... | @@ -509,7 +509,7 @@ pub const ModuleBlock = struct { | ... | @@ -509,7 +509,7 @@ pub const ModuleBlock = struct { |
| 509 | 509 | ||
| 510 | pub const Fp80 = struct { | 510 | pub const Fp80 = struct { |
| 511 | pub const ops = [_]AbbrevOp{ | 511 | pub const ops = [_]AbbrevOp{ |
| 512 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | 512 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) }, |
| 513 | .{ .vbr = 6 }, | 513 | .{ .vbr = 6 }, |
| 514 | .{ .vbr = 6 }, | 514 | .{ .vbr = 6 }, |
| 515 | }; | 515 | }; |
| ... | @@ -519,7 +519,7 @@ pub const ModuleBlock = struct { | ... | @@ -519,7 +519,7 @@ pub const ModuleBlock = struct { |
| 519 | 519 | ||
| 520 | pub const Fp128 = struct { | 520 | pub const Fp128 = struct { |
| 521 | pub const ops = [_]AbbrevOp{ | 521 | pub const ops = [_]AbbrevOp{ |
| 522 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.FLOAT) }, | 522 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.FLOAT) }, |
| 523 | .{ .vbr = 6 }, | 523 | .{ .vbr = 6 }, |
| 524 | .{ .vbr = 6 }, | 524 | .{ .vbr = 6 }, |
| 525 | }; | 525 | }; |
| ... | @@ -529,7 +529,7 @@ pub const ModuleBlock = struct { | ... | @@ -529,7 +529,7 @@ pub const ModuleBlock = struct { |
| 529 | 529 | ||
| 530 | pub const Aggregate = struct { | 530 | pub const Aggregate = struct { |
| 531 | pub const ops = [_]AbbrevOp{ | 531 | pub const ops = [_]AbbrevOp{ |
| 532 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.AGGREGATE) }, | 532 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.AGGREGATE) }, |
| 533 | .{ .array_fixed = 32 }, | 533 | .{ .array_fixed = 32 }, |
| 534 | }; | 534 | }; |
| 535 | values: []const Builder.Constant, | 535 | values: []const Builder.Constant, |
| ... | @@ -537,7 +537,7 @@ pub const ModuleBlock = struct { | ... | @@ -537,7 +537,7 @@ pub const ModuleBlock = struct { |
| 537 | 537 | ||
| 538 | pub const String = struct { | 538 | pub const String = struct { |
| 539 | pub const ops = [_]AbbrevOp{ | 539 | pub const ops = [_]AbbrevOp{ |
| 540 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.STRING) }, | 540 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.STRING) }, |
| 541 | .{ .array_fixed = 8 }, | 541 | .{ .array_fixed = 8 }, |
| 542 | }; | 542 | }; |
| 543 | string: []const u8, | 543 | string: []const u8, |
| ... | @@ -545,7 +545,7 @@ pub const ModuleBlock = struct { | ... | @@ -545,7 +545,7 @@ pub const ModuleBlock = struct { |
| 545 | 545 | ||
| 546 | pub const CString = struct { | 546 | pub const CString = struct { |
| 547 | pub const ops = [_]AbbrevOp{ | 547 | pub const ops = [_]AbbrevOp{ |
| 548 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CSTRING) }, | 548 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CSTRING) }, |
| 549 | .{ .array_fixed = 8 }, | 549 | .{ .array_fixed = 8 }, |
| 550 | }; | 550 | }; |
| 551 | string: []const u8, | 551 | string: []const u8, |
| ... | @@ -554,7 +554,7 @@ pub const ModuleBlock = struct { | ... | @@ -554,7 +554,7 @@ pub const ModuleBlock = struct { |
| 554 | pub const Cast = struct { | 554 | pub const Cast = struct { |
| 555 | const CastOpcode = Builder.CastOpcode; | 555 | const CastOpcode = Builder.CastOpcode; |
| 556 | pub const ops = [_]AbbrevOp{ | 556 | pub const ops = [_]AbbrevOp{ |
| 557 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_CAST) }, | 557 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_CAST) }, |
| 558 | .{ .fixed = @bitSizeOf(CastOpcode) }, | 558 | .{ .fixed = @bitSizeOf(CastOpcode) }, |
| 559 | .{ .fixed_runtime = Builder.Type }, | 559 | .{ .fixed_runtime = Builder.Type }, |
| 560 | ConstantAbbrev, | 560 | ConstantAbbrev, |
| ... | @@ -568,7 +568,7 @@ pub const ModuleBlock = struct { | ... | @@ -568,7 +568,7 @@ pub const ModuleBlock = struct { |
| 568 | pub const Binary = struct { | 568 | pub const Binary = struct { |
| 569 | const BinaryOpcode = Builder.BinaryOpcode; | 569 | const BinaryOpcode = Builder.BinaryOpcode; |
| 570 | pub const ops = [_]AbbrevOp{ | 570 | pub const ops = [_]AbbrevOp{ |
| 571 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_BINOP) }, | 571 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_BINOP) }, |
| 572 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, | 572 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, |
| 573 | ConstantAbbrev, | 573 | ConstantAbbrev, |
| 574 | ConstantAbbrev, | 574 | ConstantAbbrev, |
| ... | @@ -581,7 +581,7 @@ pub const ModuleBlock = struct { | ... | @@ -581,7 +581,7 @@ pub const ModuleBlock = struct { |
| 581 | 581 | ||
| 582 | pub const Cmp = struct { | 582 | pub const Cmp = struct { |
| 583 | pub const ops = [_]AbbrevOp{ | 583 | pub const ops = [_]AbbrevOp{ |
| 584 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_CMP) }, | 584 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_CMP) }, |
| 585 | .{ .fixed_runtime = Builder.Type }, | 585 | .{ .fixed_runtime = Builder.Type }, |
| 586 | ConstantAbbrev, | 586 | ConstantAbbrev, |
| 587 | ConstantAbbrev, | 587 | ConstantAbbrev, |
| ... | @@ -596,7 +596,7 @@ pub const ModuleBlock = struct { | ... | @@ -596,7 +596,7 @@ pub const ModuleBlock = struct { |
| 596 | 596 | ||
| 597 | pub const ExtractElement = struct { | 597 | pub const ExtractElement = struct { |
| 598 | pub const ops = [_]AbbrevOp{ | 598 | pub const ops = [_]AbbrevOp{ |
| 599 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_EXTRACTELT) }, | 599 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_EXTRACTELT) }, |
| 600 | .{ .fixed_runtime = Builder.Type }, | 600 | .{ .fixed_runtime = Builder.Type }, |
| 601 | ConstantAbbrev, | 601 | ConstantAbbrev, |
| 602 | .{ .fixed_runtime = Builder.Type }, | 602 | .{ .fixed_runtime = Builder.Type }, |
| ... | @@ -611,7 +611,7 @@ pub const ModuleBlock = struct { | ... | @@ -611,7 +611,7 @@ pub const ModuleBlock = struct { |
| 611 | 611 | ||
| 612 | pub const InsertElement = struct { | 612 | pub const InsertElement = struct { |
| 613 | pub const ops = [_]AbbrevOp{ | 613 | pub const ops = [_]AbbrevOp{ |
| 614 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_INSERTELT) }, | 614 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_INSERTELT) }, |
| 615 | ConstantAbbrev, | 615 | ConstantAbbrev, |
| 616 | ConstantAbbrev, | 616 | ConstantAbbrev, |
| 617 | .{ .fixed_runtime = Builder.Type }, | 617 | .{ .fixed_runtime = Builder.Type }, |
| ... | @@ -626,7 +626,7 @@ pub const ModuleBlock = struct { | ... | @@ -626,7 +626,7 @@ pub const ModuleBlock = struct { |
| 626 | 626 | ||
| 627 | pub const ShuffleVector = struct { | 627 | pub const ShuffleVector = struct { |
| 628 | pub const ops = [_]AbbrevOp{ | 628 | pub const ops = [_]AbbrevOp{ |
| 629 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_SHUFFLEVEC) }, | 629 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_SHUFFLEVEC) }, |
| 630 | ValueAbbrev, | 630 | ValueAbbrev, |
| 631 | ValueAbbrev, | 631 | ValueAbbrev, |
| 632 | ValueAbbrev, | 632 | ValueAbbrev, |
| ... | @@ -639,7 +639,7 @@ pub const ModuleBlock = struct { | ... | @@ -639,7 +639,7 @@ pub const ModuleBlock = struct { |
| 639 | 639 | ||
| 640 | pub const ShuffleVectorEx = struct { | 640 | pub const ShuffleVectorEx = struct { |
| 641 | pub const ops = [_]AbbrevOp{ | 641 | pub const ops = [_]AbbrevOp{ |
| 642 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.CE_SHUFVEC_EX) }, | 642 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.CE_SHUFVEC_EX) }, |
| 643 | .{ .fixed_runtime = Builder.Type }, | 643 | .{ .fixed_runtime = Builder.Type }, |
| 644 | ValueAbbrev, | 644 | ValueAbbrev, |
| 645 | ValueAbbrev, | 645 | ValueAbbrev, |
| ... | @@ -654,7 +654,7 @@ pub const ModuleBlock = struct { | ... | @@ -654,7 +654,7 @@ pub const ModuleBlock = struct { |
| 654 | 654 | ||
| 655 | pub const BlockAddress = struct { | 655 | pub const BlockAddress = struct { |
| 656 | pub const ops = [_]AbbrevOp{ | 656 | pub const ops = [_]AbbrevOp{ |
| 657 | .{ .literal = @intFromEnum(ModuleBlock.ConstantsBlock.Code.BLOCKADDRESS) }, | 657 | .{ .literal = @backingInt(ModuleBlock.ConstantsBlock.Code.BLOCKADDRESS) }, |
| 658 | .{ .fixed_runtime = Builder.Type }, | 658 | .{ .fixed_runtime = Builder.Type }, |
| 659 | ConstantAbbrev, | 659 | ConstantAbbrev, |
| 660 | BlockAbbrev, | 660 | BlockAbbrev, |
| ... | @@ -867,7 +867,7 @@ pub const ModuleBlock = struct { | ... | @@ -867,7 +867,7 @@ pub const ModuleBlock = struct { |
| 867 | 867 | ||
| 868 | pub const DeclareBlocks = struct { | 868 | pub const DeclareBlocks = struct { |
| 869 | pub const ops = [_]AbbrevOp{ | 869 | pub const ops = [_]AbbrevOp{ |
| 870 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.DECLAREBLOCKS) }, | 870 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.DECLAREBLOCKS) }, |
| 871 | .{ .vbr = 8 }, | 871 | .{ .vbr = 8 }, |
| 872 | }; | 872 | }; |
| 873 | num_blocks: usize, | 873 | num_blocks: usize, |
| ... | @@ -884,7 +884,7 @@ pub const ModuleBlock = struct { | ... | @@ -884,7 +884,7 @@ pub const ModuleBlock = struct { |
| 884 | no_tail: bool = false, | 884 | no_tail: bool = false, |
| 885 | }; | 885 | }; |
| 886 | pub const ops = [_]AbbrevOp{ | 886 | pub const ops = [_]AbbrevOp{ |
| 887 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CALL) }, | 887 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CALL) }, |
| 888 | .{ .fixed_runtime = Builder.FunctionAttributes }, | 888 | .{ .fixed_runtime = Builder.FunctionAttributes }, |
| 889 | .{ .fixed = @bitSizeOf(CallType) }, | 889 | .{ .fixed = @bitSizeOf(CallType) }, |
| 890 | .{ .fixed_runtime = Builder.Type }, | 890 | .{ .fixed_runtime = Builder.Type }, |
| ... | @@ -912,7 +912,7 @@ pub const ModuleBlock = struct { | ... | @@ -912,7 +912,7 @@ pub const ModuleBlock = struct { |
| 912 | }; | 912 | }; |
| 913 | 913 | ||
| 914 | pub const ops = [_]AbbrevOp{ | 914 | pub const ops = [_]AbbrevOp{ |
| 915 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CALL) }, | 915 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CALL) }, |
| 916 | .{ .fixed_runtime = Builder.FunctionAttributes }, | 916 | .{ .fixed_runtime = Builder.FunctionAttributes }, |
| 917 | .{ .fixed = @bitSizeOf(CallType) }, | 917 | .{ .fixed = @bitSizeOf(CallType) }, |
| 918 | .{ .fixed = @bitSizeOf(Builder.FastMath) }, | 918 | .{ .fixed = @bitSizeOf(Builder.FastMath) }, |
| ... | @@ -931,7 +931,7 @@ pub const ModuleBlock = struct { | ... | @@ -931,7 +931,7 @@ pub const ModuleBlock = struct { |
| 931 | 931 | ||
| 932 | pub const FNeg = struct { | 932 | pub const FNeg = struct { |
| 933 | pub const ops = [_]AbbrevOp{ | 933 | pub const ops = [_]AbbrevOp{ |
| 934 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_UNOP) }, | 934 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_UNOP) }, |
| 935 | ValueAbbrev, | 935 | ValueAbbrev, |
| 936 | .{ .literal = 0 }, | 936 | .{ .literal = 0 }, |
| 937 | }; | 937 | }; |
| ... | @@ -941,7 +941,7 @@ pub const ModuleBlock = struct { | ... | @@ -941,7 +941,7 @@ pub const ModuleBlock = struct { |
| 941 | 941 | ||
| 942 | pub const FNegFast = struct { | 942 | pub const FNegFast = struct { |
| 943 | pub const ops = [_]AbbrevOp{ | 943 | pub const ops = [_]AbbrevOp{ |
| 944 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_UNOP) }, | 944 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_UNOP) }, |
| 945 | ValueAbbrev, | 945 | ValueAbbrev, |
| 946 | .{ .literal = 0 }, | 946 | .{ .literal = 0 }, |
| 947 | .{ .fixed = @bitSizeOf(Builder.FastMath) }, | 947 | .{ .fixed = @bitSizeOf(Builder.FastMath) }, |
| ... | @@ -954,7 +954,7 @@ pub const ModuleBlock = struct { | ... | @@ -954,7 +954,7 @@ pub const ModuleBlock = struct { |
| 954 | pub const Binary = struct { | 954 | pub const Binary = struct { |
| 955 | const BinaryOpcode = Builder.BinaryOpcode; | 955 | const BinaryOpcode = Builder.BinaryOpcode; |
| 956 | pub const ops = [_]AbbrevOp{ | 956 | pub const ops = [_]AbbrevOp{ |
| 957 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | 957 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, |
| 958 | ValueAbbrev, | 958 | ValueAbbrev, |
| 959 | ValueAbbrev, | 959 | ValueAbbrev, |
| 960 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, | 960 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, |
| ... | @@ -968,7 +968,7 @@ pub const ModuleBlock = struct { | ... | @@ -968,7 +968,7 @@ pub const ModuleBlock = struct { |
| 968 | pub const BinaryNoWrap = struct { | 968 | pub const BinaryNoWrap = struct { |
| 969 | const BinaryOpcode = Builder.BinaryOpcode; | 969 | const BinaryOpcode = Builder.BinaryOpcode; |
| 970 | pub const ops = [_]AbbrevOp{ | 970 | pub const ops = [_]AbbrevOp{ |
| 971 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | 971 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, |
| 972 | ValueAbbrev, | 972 | ValueAbbrev, |
| 973 | ValueAbbrev, | 973 | ValueAbbrev, |
| 974 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, | 974 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, |
| ... | @@ -987,7 +987,7 @@ pub const ModuleBlock = struct { | ... | @@ -987,7 +987,7 @@ pub const ModuleBlock = struct { |
| 987 | pub const BinaryExact = struct { | 987 | pub const BinaryExact = struct { |
| 988 | const BinaryOpcode = Builder.BinaryOpcode; | 988 | const BinaryOpcode = Builder.BinaryOpcode; |
| 989 | pub const ops = [_]AbbrevOp{ | 989 | pub const ops = [_]AbbrevOp{ |
| 990 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | 990 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, |
| 991 | ValueAbbrev, | 991 | ValueAbbrev, |
| 992 | ValueAbbrev, | 992 | ValueAbbrev, |
| 993 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, | 993 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, |
| ... | @@ -1002,7 +1002,7 @@ pub const ModuleBlock = struct { | ... | @@ -1002,7 +1002,7 @@ pub const ModuleBlock = struct { |
| 1002 | pub const BinaryFast = struct { | 1002 | pub const BinaryFast = struct { |
| 1003 | const BinaryOpcode = Builder.BinaryOpcode; | 1003 | const BinaryOpcode = Builder.BinaryOpcode; |
| 1004 | pub const ops = [_]AbbrevOp{ | 1004 | pub const ops = [_]AbbrevOp{ |
| 1005 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, | 1005 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BINOP) }, |
| 1006 | ValueAbbrev, | 1006 | ValueAbbrev, |
| 1007 | ValueAbbrev, | 1007 | ValueAbbrev, |
| 1008 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, | 1008 | .{ .fixed = @bitSizeOf(BinaryOpcode) }, |
| ... | @@ -1018,7 +1018,7 @@ pub const ModuleBlock = struct { | ... | @@ -1018,7 +1018,7 @@ pub const ModuleBlock = struct { |
| 1018 | pub const Cmp = struct { | 1018 | pub const Cmp = struct { |
| 1019 | const CmpPredicate = Builder.CmpPredicate; | 1019 | const CmpPredicate = Builder.CmpPredicate; |
| 1020 | pub const ops = [_]AbbrevOp{ | 1020 | pub const ops = [_]AbbrevOp{ |
| 1021 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CMP2) }, | 1021 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CMP2) }, |
| 1022 | ValueAbbrev, | 1022 | ValueAbbrev, |
| 1023 | ValueAbbrev, | 1023 | ValueAbbrev, |
| 1024 | .{ .fixed = @bitSizeOf(CmpPredicate) }, | 1024 | .{ .fixed = @bitSizeOf(CmpPredicate) }, |
| ... | @@ -1032,7 +1032,7 @@ pub const ModuleBlock = struct { | ... | @@ -1032,7 +1032,7 @@ pub const ModuleBlock = struct { |
| 1032 | pub const CmpFast = struct { | 1032 | pub const CmpFast = struct { |
| 1033 | const CmpPredicate = Builder.CmpPredicate; | 1033 | const CmpPredicate = Builder.CmpPredicate; |
| 1034 | pub const ops = [_]AbbrevOp{ | 1034 | pub const ops = [_]AbbrevOp{ |
| 1035 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CMP2) }, | 1035 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CMP2) }, |
| 1036 | ValueAbbrev, | 1036 | ValueAbbrev, |
| 1037 | ValueAbbrev, | 1037 | ValueAbbrev, |
| 1038 | .{ .fixed = @bitSizeOf(CmpPredicate) }, | 1038 | .{ .fixed = @bitSizeOf(CmpPredicate) }, |
| ... | @@ -1047,7 +1047,7 @@ pub const ModuleBlock = struct { | ... | @@ -1047,7 +1047,7 @@ pub const ModuleBlock = struct { |
| 1047 | 1047 | ||
| 1048 | pub const Select = struct { | 1048 | pub const Select = struct { |
| 1049 | pub const ops = [_]AbbrevOp{ | 1049 | pub const ops = [_]AbbrevOp{ |
| 1050 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_VSELECT) }, | 1050 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_VSELECT) }, |
| 1051 | ValueAbbrev, | 1051 | ValueAbbrev, |
| 1052 | ValueAbbrev, | 1052 | ValueAbbrev, |
| 1053 | ValueAbbrev, | 1053 | ValueAbbrev, |
| ... | @@ -1060,7 +1060,7 @@ pub const ModuleBlock = struct { | ... | @@ -1060,7 +1060,7 @@ pub const ModuleBlock = struct { |
| 1060 | 1060 | ||
| 1061 | pub const SelectFast = struct { | 1061 | pub const SelectFast = struct { |
| 1062 | pub const ops = [_]AbbrevOp{ | 1062 | pub const ops = [_]AbbrevOp{ |
| 1063 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_VSELECT) }, | 1063 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_VSELECT) }, |
| 1064 | ValueAbbrev, | 1064 | ValueAbbrev, |
| 1065 | ValueAbbrev, | 1065 | ValueAbbrev, |
| 1066 | ValueAbbrev, | 1066 | ValueAbbrev, |
| ... | @@ -1076,7 +1076,7 @@ pub const ModuleBlock = struct { | ... | @@ -1076,7 +1076,7 @@ pub const ModuleBlock = struct { |
| 1076 | pub const Cast = struct { | 1076 | pub const Cast = struct { |
| 1077 | const CastOpcode = Builder.CastOpcode; | 1077 | const CastOpcode = Builder.CastOpcode; |
| 1078 | pub const ops = [_]AbbrevOp{ | 1078 | pub const ops = [_]AbbrevOp{ |
| 1079 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CAST) }, | 1079 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CAST) }, |
| 1080 | ValueAbbrev, | 1080 | ValueAbbrev, |
| 1081 | .{ .fixed_runtime = Builder.Type }, | 1081 | .{ .fixed_runtime = Builder.Type }, |
| 1082 | .{ .fixed = @bitSizeOf(CastOpcode) }, | 1082 | .{ .fixed = @bitSizeOf(CastOpcode) }, |
| ... | @@ -1093,10 +1093,10 @@ pub const ModuleBlock = struct { | ... | @@ -1093,10 +1093,10 @@ pub const ModuleBlock = struct { |
| 1093 | no_signed_wrap: bool, | 1093 | no_signed_wrap: bool, |
| 1094 | }; | 1094 | }; |
| 1095 | pub const ops = [_]AbbrevOp{ | 1095 | pub const ops = [_]AbbrevOp{ |
| 1096 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CAST) }, | 1096 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CAST) }, |
| 1097 | ValueAbbrev, | 1097 | ValueAbbrev, |
| 1098 | .{ .fixed_runtime = Builder.Type }, | 1098 | .{ .fixed_runtime = Builder.Type }, |
| 1099 | .{ .literal = @intFromEnum(Builder.CastOpcode.trunc) }, | 1099 | .{ .literal = @backingInt(Builder.CastOpcode.trunc) }, |
| 1100 | .{ .fixed = @bitSizeOf(Flags) }, | 1100 | .{ .fixed = @bitSizeOf(Flags) }, |
| 1101 | }; | 1101 | }; |
| 1102 | 1102 | ||
| ... | @@ -1114,7 +1114,7 @@ pub const ModuleBlock = struct { | ... | @@ -1114,7 +1114,7 @@ pub const ModuleBlock = struct { |
| 1114 | align_upper: u3, | 1114 | align_upper: u3, |
| 1115 | }; | 1115 | }; |
| 1116 | pub const ops = [_]AbbrevOp{ | 1116 | pub const ops = [_]AbbrevOp{ |
| 1117 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_ALLOCA) }, | 1117 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_ALLOCA) }, |
| 1118 | .{ .fixed_runtime = Builder.Type }, | 1118 | .{ .fixed_runtime = Builder.Type }, |
| 1119 | .{ .fixed_runtime = Builder.Type }, | 1119 | .{ .fixed_runtime = Builder.Type }, |
| 1120 | ValueAbbrev, | 1120 | ValueAbbrev, |
| ... | @@ -1129,13 +1129,13 @@ pub const ModuleBlock = struct { | ... | @@ -1129,13 +1129,13 @@ pub const ModuleBlock = struct { |
| 1129 | 1129 | ||
| 1130 | pub const RetVoid = struct { | 1130 | pub const RetVoid = struct { |
| 1131 | pub const ops = [_]AbbrevOp{ | 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 | pub const Ret = struct { | 1136 | pub const Ret = struct { |
| 1137 | pub const ops = [_]AbbrevOp{ | 1137 | pub const ops = [_]AbbrevOp{ |
| 1138 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_RET) }, | 1138 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_RET) }, |
| 1139 | ValueAbbrev, | 1139 | ValueAbbrev, |
| 1140 | }; | 1140 | }; |
| 1141 | val: u32, | 1141 | val: u32, |
| ... | @@ -1143,7 +1143,7 @@ pub const ModuleBlock = struct { | ... | @@ -1143,7 +1143,7 @@ pub const ModuleBlock = struct { |
| 1143 | 1143 | ||
| 1144 | pub const GetElementPtr = struct { | 1144 | pub const GetElementPtr = struct { |
| 1145 | pub const ops = [_]AbbrevOp{ | 1145 | pub const ops = [_]AbbrevOp{ |
| 1146 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_GEP) }, | 1146 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_GEP) }, |
| 1147 | .{ .fixed = 1 }, | 1147 | .{ .fixed = 1 }, |
| 1148 | .{ .fixed_runtime = Builder.Type }, | 1148 | .{ .fixed_runtime = Builder.Type }, |
| 1149 | ValueAbbrev, | 1149 | ValueAbbrev, |
| ... | @@ -1158,7 +1158,7 @@ pub const ModuleBlock = struct { | ... | @@ -1158,7 +1158,7 @@ pub const ModuleBlock = struct { |
| 1158 | 1158 | ||
| 1159 | pub const ExtractValue = struct { | 1159 | pub const ExtractValue = struct { |
| 1160 | pub const ops = [_]AbbrevOp{ | 1160 | pub const ops = [_]AbbrevOp{ |
| 1161 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_EXTRACTVAL) }, | 1161 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_EXTRACTVAL) }, |
| 1162 | ValueAbbrev, | 1162 | ValueAbbrev, |
| 1163 | ValueArrayAbbrev, | 1163 | ValueArrayAbbrev, |
| 1164 | }; | 1164 | }; |
| ... | @@ -1169,7 +1169,7 @@ pub const ModuleBlock = struct { | ... | @@ -1169,7 +1169,7 @@ pub const ModuleBlock = struct { |
| 1169 | 1169 | ||
| 1170 | pub const InsertValue = struct { | 1170 | pub const InsertValue = struct { |
| 1171 | pub const ops = [_]AbbrevOp{ | 1171 | pub const ops = [_]AbbrevOp{ |
| 1172 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_INSERTVAL) }, | 1172 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_INSERTVAL) }, |
| 1173 | ValueAbbrev, | 1173 | ValueAbbrev, |
| 1174 | ValueAbbrev, | 1174 | ValueAbbrev, |
| 1175 | ValueArrayAbbrev, | 1175 | ValueArrayAbbrev, |
| ... | @@ -1182,7 +1182,7 @@ pub const ModuleBlock = struct { | ... | @@ -1182,7 +1182,7 @@ pub const ModuleBlock = struct { |
| 1182 | 1182 | ||
| 1183 | pub const ExtractElement = struct { | 1183 | pub const ExtractElement = struct { |
| 1184 | pub const ops = [_]AbbrevOp{ | 1184 | pub const ops = [_]AbbrevOp{ |
| 1185 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_EXTRACTELT) }, | 1185 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_EXTRACTELT) }, |
| 1186 | ValueAbbrev, | 1186 | ValueAbbrev, |
| 1187 | ValueAbbrev, | 1187 | ValueAbbrev, |
| 1188 | }; | 1188 | }; |
| ... | @@ -1193,7 +1193,7 @@ pub const ModuleBlock = struct { | ... | @@ -1193,7 +1193,7 @@ pub const ModuleBlock = struct { |
| 1193 | 1193 | ||
| 1194 | pub const InsertElement = struct { | 1194 | pub const InsertElement = struct { |
| 1195 | pub const ops = [_]AbbrevOp{ | 1195 | pub const ops = [_]AbbrevOp{ |
| 1196 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_INSERTELT) }, | 1196 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_INSERTELT) }, |
| 1197 | ValueAbbrev, | 1197 | ValueAbbrev, |
| 1198 | ValueAbbrev, | 1198 | ValueAbbrev, |
| 1199 | ValueAbbrev, | 1199 | ValueAbbrev, |
| ... | @@ -1206,7 +1206,7 @@ pub const ModuleBlock = struct { | ... | @@ -1206,7 +1206,7 @@ pub const ModuleBlock = struct { |
| 1206 | 1206 | ||
| 1207 | pub const ShuffleVector = struct { | 1207 | pub const ShuffleVector = struct { |
| 1208 | pub const ops = [_]AbbrevOp{ | 1208 | pub const ops = [_]AbbrevOp{ |
| 1209 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_SHUFFLEVEC) }, | 1209 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_SHUFFLEVEC) }, |
| 1210 | ValueAbbrev, | 1210 | ValueAbbrev, |
| 1211 | ValueAbbrev, | 1211 | ValueAbbrev, |
| 1212 | ValueAbbrev, | 1212 | ValueAbbrev, |
| ... | @@ -1219,13 +1219,13 @@ pub const ModuleBlock = struct { | ... | @@ -1219,13 +1219,13 @@ pub const ModuleBlock = struct { |
| 1219 | 1219 | ||
| 1220 | pub const Unreachable = struct { | 1220 | pub const Unreachable = struct { |
| 1221 | pub const ops = [_]AbbrevOp{ | 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 | pub const Load = struct { | 1226 | pub const Load = struct { |
| 1227 | pub const ops = [_]AbbrevOp{ | 1227 | pub const ops = [_]AbbrevOp{ |
| 1228 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_LOAD) }, | 1228 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_LOAD) }, |
| 1229 | ValueAbbrev, | 1229 | ValueAbbrev, |
| 1230 | .{ .fixed_runtime = Builder.Type }, | 1230 | .{ .fixed_runtime = Builder.Type }, |
| 1231 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, | 1231 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, |
| ... | @@ -1239,7 +1239,7 @@ pub const ModuleBlock = struct { | ... | @@ -1239,7 +1239,7 @@ pub const ModuleBlock = struct { |
| 1239 | 1239 | ||
| 1240 | pub const LoadAtomic = struct { | 1240 | pub const LoadAtomic = struct { |
| 1241 | pub const ops = [_]AbbrevOp{ | 1241 | pub const ops = [_]AbbrevOp{ |
| 1242 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_LOADATOMIC) }, | 1242 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_LOADATOMIC) }, |
| 1243 | ValueAbbrev, | 1243 | ValueAbbrev, |
| 1244 | .{ .fixed_runtime = Builder.Type }, | 1244 | .{ .fixed_runtime = Builder.Type }, |
| 1245 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, | 1245 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, |
| ... | @@ -1257,7 +1257,7 @@ pub const ModuleBlock = struct { | ... | @@ -1257,7 +1257,7 @@ pub const ModuleBlock = struct { |
| 1257 | 1257 | ||
| 1258 | pub const Store = struct { | 1258 | pub const Store = struct { |
| 1259 | pub const ops = [_]AbbrevOp{ | 1259 | pub const ops = [_]AbbrevOp{ |
| 1260 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_STORE) }, | 1260 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_STORE) }, |
| 1261 | ValueAbbrev, | 1261 | ValueAbbrev, |
| 1262 | ValueAbbrev, | 1262 | ValueAbbrev, |
| 1263 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, | 1263 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, |
| ... | @@ -1271,7 +1271,7 @@ pub const ModuleBlock = struct { | ... | @@ -1271,7 +1271,7 @@ pub const ModuleBlock = struct { |
| 1271 | 1271 | ||
| 1272 | pub const StoreAtomic = struct { | 1272 | pub const StoreAtomic = struct { |
| 1273 | pub const ops = [_]AbbrevOp{ | 1273 | pub const ops = [_]AbbrevOp{ |
| 1274 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_STOREATOMIC) }, | 1274 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_STOREATOMIC) }, |
| 1275 | ValueAbbrev, | 1275 | ValueAbbrev, |
| 1276 | ValueAbbrev, | 1276 | ValueAbbrev, |
| 1277 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, | 1277 | .{ .fixed = @bitSizeOf(Builder.Alignment) }, |
| ... | @@ -1289,7 +1289,7 @@ pub const ModuleBlock = struct { | ... | @@ -1289,7 +1289,7 @@ pub const ModuleBlock = struct { |
| 1289 | 1289 | ||
| 1290 | pub const BrUnconditional = struct { | 1290 | pub const BrUnconditional = struct { |
| 1291 | pub const ops = [_]AbbrevOp{ | 1291 | pub const ops = [_]AbbrevOp{ |
| 1292 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BR) }, | 1292 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BR) }, |
| 1293 | BlockAbbrev, | 1293 | BlockAbbrev, |
| 1294 | }; | 1294 | }; |
| 1295 | block: u32, | 1295 | block: u32, |
| ... | @@ -1297,7 +1297,7 @@ pub const ModuleBlock = struct { | ... | @@ -1297,7 +1297,7 @@ pub const ModuleBlock = struct { |
| 1297 | 1297 | ||
| 1298 | pub const BrConditional = struct { | 1298 | pub const BrConditional = struct { |
| 1299 | pub const ops = [_]AbbrevOp{ | 1299 | pub const ops = [_]AbbrevOp{ |
| 1300 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_BR) }, | 1300 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_BR) }, |
| 1301 | BlockAbbrev, | 1301 | BlockAbbrev, |
| 1302 | BlockAbbrev, | 1302 | BlockAbbrev, |
| 1303 | BlockAbbrev, | 1303 | BlockAbbrev, |
| ... | @@ -1309,7 +1309,7 @@ pub const ModuleBlock = struct { | ... | @@ -1309,7 +1309,7 @@ pub const ModuleBlock = struct { |
| 1309 | 1309 | ||
| 1310 | pub const VaArg = struct { | 1310 | pub const VaArg = struct { |
| 1311 | pub const ops = [_]AbbrevOp{ | 1311 | pub const ops = [_]AbbrevOp{ |
| 1312 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_VAARG) }, | 1312 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_VAARG) }, |
| 1313 | .{ .fixed_runtime = Builder.Type }, | 1313 | .{ .fixed_runtime = Builder.Type }, |
| 1314 | ValueAbbrev, | 1314 | ValueAbbrev, |
| 1315 | .{ .fixed_runtime = Builder.Type }, | 1315 | .{ .fixed_runtime = Builder.Type }, |
| ... | @@ -1321,7 +1321,7 @@ pub const ModuleBlock = struct { | ... | @@ -1321,7 +1321,7 @@ pub const ModuleBlock = struct { |
| 1321 | 1321 | ||
| 1322 | pub const AtomicRmw = struct { | 1322 | pub const AtomicRmw = struct { |
| 1323 | pub const ops = [_]AbbrevOp{ | 1323 | pub const ops = [_]AbbrevOp{ |
| 1324 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_ATOMICRMW) }, | 1324 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_ATOMICRMW) }, |
| 1325 | ValueAbbrev, | 1325 | ValueAbbrev, |
| 1326 | ValueAbbrev, | 1326 | ValueAbbrev, |
| 1327 | .{ .fixed = @bitSizeOf(Builder.Function.Instruction.AtomicRmw.Operation) }, | 1327 | .{ .fixed = @bitSizeOf(Builder.Function.Instruction.AtomicRmw.Operation) }, |
| ... | @@ -1341,7 +1341,7 @@ pub const ModuleBlock = struct { | ... | @@ -1341,7 +1341,7 @@ pub const ModuleBlock = struct { |
| 1341 | 1341 | ||
| 1342 | pub const CmpXchg = struct { | 1342 | pub const CmpXchg = struct { |
| 1343 | pub const ops = [_]AbbrevOp{ | 1343 | pub const ops = [_]AbbrevOp{ |
| 1344 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_CMPXCHG) }, | 1344 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_CMPXCHG) }, |
| 1345 | ValueAbbrev, | 1345 | ValueAbbrev, |
| 1346 | ValueAbbrev, | 1346 | ValueAbbrev, |
| 1347 | ValueAbbrev, | 1347 | ValueAbbrev, |
| ... | @@ -1365,7 +1365,7 @@ pub const ModuleBlock = struct { | ... | @@ -1365,7 +1365,7 @@ pub const ModuleBlock = struct { |
| 1365 | 1365 | ||
| 1366 | pub const Fence = struct { | 1366 | pub const Fence = struct { |
| 1367 | pub const ops = [_]AbbrevOp{ | 1367 | pub const ops = [_]AbbrevOp{ |
| 1368 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_FENCE) }, | 1368 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_FENCE) }, |
| 1369 | .{ .fixed = @bitSizeOf(Builder.AtomicOrdering) }, | 1369 | .{ .fixed = @bitSizeOf(Builder.AtomicOrdering) }, |
| 1370 | .{ .fixed = @bitSizeOf(Builder.SyncScope) }, | 1370 | .{ .fixed = @bitSizeOf(Builder.SyncScope) }, |
| 1371 | }; | 1371 | }; |
| ... | @@ -1375,7 +1375,7 @@ pub const ModuleBlock = struct { | ... | @@ -1375,7 +1375,7 @@ pub const ModuleBlock = struct { |
| 1375 | 1375 | ||
| 1376 | pub const DebugLoc = struct { | 1376 | pub const DebugLoc = struct { |
| 1377 | pub const ops = [_]AbbrevOp{ | 1377 | pub const ops = [_]AbbrevOp{ |
| 1378 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.DEBUG_LOC) }, | 1378 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.DEBUG_LOC) }, |
| 1379 | LineAbbrev, | 1379 | LineAbbrev, |
| 1380 | ColumnAbbrev, | 1380 | ColumnAbbrev, |
| 1381 | MetadataAbbrev, | 1381 | MetadataAbbrev, |
| ... | @@ -1390,20 +1390,20 @@ pub const ModuleBlock = struct { | ... | @@ -1390,20 +1390,20 @@ pub const ModuleBlock = struct { |
| 1390 | 1390 | ||
| 1391 | pub const DebugLocAgain = struct { | 1391 | pub const DebugLocAgain = struct { |
| 1392 | pub const ops = [_]AbbrevOp{ | 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 | pub const ColdOperandBundle = struct { | 1397 | pub const ColdOperandBundle = struct { |
| 1398 | pub const ops = [_]AbbrevOp{ | 1398 | pub const ops = [_]AbbrevOp{ |
| 1399 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.OPERAND_BUNDLE) }, | 1399 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.OPERAND_BUNDLE) }, |
| 1400 | .{ .literal = 0 }, | 1400 | .{ .literal = 0 }, |
| 1401 | }; | 1401 | }; |
| 1402 | }; | 1402 | }; |
| 1403 | 1403 | ||
| 1404 | pub const IndirectBr = struct { | 1404 | pub const IndirectBr = struct { |
| 1405 | pub const ops = [_]AbbrevOp{ | 1405 | pub const ops = [_]AbbrevOp{ |
| 1406 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.Code.INST_INDIRECTBR) }, | 1406 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.Code.INST_INDIRECTBR) }, |
| 1407 | .{ .fixed_runtime = Builder.Type }, | 1407 | .{ .fixed_runtime = Builder.Type }, |
| 1408 | ValueAbbrev, | 1408 | ValueAbbrev, |
| 1409 | BlockArrayAbbrev, | 1409 | BlockArrayAbbrev, |
| ... | @@ -1434,7 +1434,7 @@ pub const ModuleBlock = struct { | ... | @@ -1434,7 +1434,7 @@ pub const ModuleBlock = struct { |
| 1434 | 1434 | ||
| 1435 | pub const BlockEntry = struct { | 1435 | pub const BlockEntry = struct { |
| 1436 | pub const ops = [_]AbbrevOp{ | 1436 | pub const ops = [_]AbbrevOp{ |
| 1437 | .{ .literal = @intFromEnum(ModuleBlock.FunctionBlock.ValueSymtabBlock.Code.BBENTRY) }, | 1437 | .{ .literal = @backingInt(ModuleBlock.FunctionBlock.ValueSymtabBlock.Code.BBENTRY) }, |
| 1438 | ValueAbbrev, | 1438 | ValueAbbrev, |
| 1439 | .{ .array_fixed = 8 }, | 1439 | .{ .array_fixed = 8 }, |
| 1440 | }; | 1440 | }; |
| ... | @@ -1452,7 +1452,7 @@ pub const ModuleBlock = struct { | ... | @@ -1452,7 +1452,7 @@ pub const ModuleBlock = struct { |
| 1452 | 1452 | ||
| 1453 | pub const Value = struct { | 1453 | pub const Value = struct { |
| 1454 | pub const ops = [_]AbbrevOp{ | 1454 | pub const ops = [_]AbbrevOp{ |
| 1455 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.VALUE) }, | 1455 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.VALUE) }, |
| 1456 | .{ .fixed = 32 }, // variable | 1456 | .{ .fixed = 32 }, // variable |
| 1457 | .{ .fixed = 32 }, // expression | 1457 | .{ .fixed = 32 }, // expression |
| 1458 | }; | 1458 | }; |
| ... | @@ -1472,7 +1472,7 @@ pub const ModuleBlock = struct { | ... | @@ -1472,7 +1472,7 @@ pub const ModuleBlock = struct { |
| 1472 | 1472 | ||
| 1473 | pub const AttachmentGlobalSingle = struct { | 1473 | pub const AttachmentGlobalSingle = struct { |
| 1474 | pub const ops = [_]AbbrevOp{ | 1474 | pub const ops = [_]AbbrevOp{ |
| 1475 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.ATTACHMENT) }, | 1475 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.ATTACHMENT) }, |
| 1476 | .{ .fixed = 1 }, | 1476 | .{ .fixed = 1 }, |
| 1477 | MetadataAbbrev, | 1477 | MetadataAbbrev, |
| 1478 | }; | 1478 | }; |
| ... | @@ -1482,7 +1482,7 @@ pub const ModuleBlock = struct { | ... | @@ -1482,7 +1482,7 @@ pub const ModuleBlock = struct { |
| 1482 | 1482 | ||
| 1483 | pub const AttachmentInstructionSingle = struct { | 1483 | pub const AttachmentInstructionSingle = struct { |
| 1484 | pub const ops = [_]AbbrevOp{ | 1484 | pub const ops = [_]AbbrevOp{ |
| 1485 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.ATTACHMENT) }, | 1485 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.ATTACHMENT) }, |
| 1486 | ValueAbbrev, | 1486 | ValueAbbrev, |
| 1487 | .{ .fixed = 5 }, | 1487 | .{ .fixed = 5 }, |
| 1488 | MetadataAbbrev, | 1488 | MetadataAbbrev, |
| ... | @@ -1617,7 +1617,7 @@ pub const ModuleBlock = struct { | ... | @@ -1617,7 +1617,7 @@ pub const ModuleBlock = struct { |
| 1617 | 1617 | ||
| 1618 | pub const Strings = struct { | 1618 | pub const Strings = struct { |
| 1619 | pub const ops = [_]AbbrevOp{ | 1619 | pub const ops = [_]AbbrevOp{ |
| 1620 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.STRINGS) }, | 1620 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.STRINGS) }, |
| 1621 | .{ .vbr = 6 }, | 1621 | .{ .vbr = 6 }, |
| 1622 | .{ .vbr = 6 }, | 1622 | .{ .vbr = 6 }, |
| 1623 | .blob, | 1623 | .blob, |
| ... | @@ -1629,7 +1629,7 @@ pub const ModuleBlock = struct { | ... | @@ -1629,7 +1629,7 @@ pub const ModuleBlock = struct { |
| 1629 | 1629 | ||
| 1630 | pub const File = struct { | 1630 | pub const File = struct { |
| 1631 | pub const ops = [_]AbbrevOp{ | 1631 | pub const ops = [_]AbbrevOp{ |
| 1632 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.FILE) }, | 1632 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.FILE) }, |
| 1633 | .{ .literal = 0 }, // is distinct | 1633 | .{ .literal = 0 }, // is distinct |
| 1634 | MetadataAbbrev, // filename | 1634 | MetadataAbbrev, // filename |
| 1635 | MetadataAbbrev, // directory | 1635 | MetadataAbbrev, // directory |
| ... | @@ -1643,7 +1643,7 @@ pub const ModuleBlock = struct { | ... | @@ -1643,7 +1643,7 @@ pub const ModuleBlock = struct { |
| 1643 | 1643 | ||
| 1644 | pub const CompileUnit = struct { | 1644 | pub const CompileUnit = struct { |
| 1645 | pub const ops = [_]AbbrevOp{ | 1645 | pub const ops = [_]AbbrevOp{ |
| 1646 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.COMPILE_UNIT) }, | 1646 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.COMPILE_UNIT) }, |
| 1647 | .{ .literal = 1 }, // is distinct | 1647 | .{ .literal = 1 }, // is distinct |
| 1648 | .{ .literal = std.dwarf.LANG.C99 }, // source language | 1648 | .{ .literal = std.dwarf.LANG.C99 }, // source language |
| 1649 | MetadataAbbrev, // file | 1649 | MetadataAbbrev, // file |
| ... | @@ -1677,7 +1677,7 @@ pub const ModuleBlock = struct { | ... | @@ -1677,7 +1677,7 @@ pub const ModuleBlock = struct { |
| 1677 | 1677 | ||
| 1678 | pub const Subprogram = struct { | 1678 | pub const Subprogram = struct { |
| 1679 | pub const ops = [_]AbbrevOp{ | 1679 | pub const ops = [_]AbbrevOp{ |
| 1680 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.SUBPROGRAM) }, | 1680 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.SUBPROGRAM) }, |
| 1681 | .{ .literal = 0b111 }, // is distinct | has sp flags | has flags | 1681 | .{ .literal = 0b111 }, // is distinct | has sp flags | has flags |
| 1682 | MetadataAbbrev, // scope | 1682 | MetadataAbbrev, // scope |
| 1683 | MetadataAbbrev, // name | 1683 | MetadataAbbrev, // name |
| ... | @@ -1714,7 +1714,7 @@ pub const ModuleBlock = struct { | ... | @@ -1714,7 +1714,7 @@ pub const ModuleBlock = struct { |
| 1714 | 1714 | ||
| 1715 | pub const LexicalBlock = struct { | 1715 | pub const LexicalBlock = struct { |
| 1716 | pub const ops = [_]AbbrevOp{ | 1716 | pub const ops = [_]AbbrevOp{ |
| 1717 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.LEXICAL_BLOCK) }, | 1717 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LEXICAL_BLOCK) }, |
| 1718 | .{ .literal = 0 }, // is distinct | 1718 | .{ .literal = 0 }, // is distinct |
| 1719 | MetadataAbbrev, // scope | 1719 | MetadataAbbrev, // scope |
| 1720 | MetadataAbbrev, // file | 1720 | MetadataAbbrev, // file |
| ... | @@ -1730,7 +1730,7 @@ pub const ModuleBlock = struct { | ... | @@ -1730,7 +1730,7 @@ pub const ModuleBlock = struct { |
| 1730 | 1730 | ||
| 1731 | pub const Location = struct { | 1731 | pub const Location = struct { |
| 1732 | pub const ops = [_]AbbrevOp{ | 1732 | pub const ops = [_]AbbrevOp{ |
| 1733 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.LOCATION) }, | 1733 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LOCATION) }, |
| 1734 | .{ .literal = 0 }, // is distinct | 1734 | .{ .literal = 0 }, // is distinct |
| 1735 | LineAbbrev, // line | 1735 | LineAbbrev, // line |
| 1736 | ColumnAbbrev, // column | 1736 | ColumnAbbrev, // column |
| ... | @@ -1747,7 +1747,7 @@ pub const ModuleBlock = struct { | ... | @@ -1747,7 +1747,7 @@ pub const ModuleBlock = struct { |
| 1747 | 1747 | ||
| 1748 | pub const BasicType = struct { | 1748 | pub const BasicType = struct { |
| 1749 | pub const ops = [_]AbbrevOp{ | 1749 | pub const ops = [_]AbbrevOp{ |
| 1750 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.BASIC_TYPE) }, | 1750 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.BASIC_TYPE) }, |
| 1751 | .{ .literal = 0 }, // is distinct | 1751 | .{ .literal = 0 }, // is distinct |
| 1752 | .{ .literal = std.dwarf.TAG.base_type }, // tag | 1752 | .{ .literal = std.dwarf.TAG.base_type }, // tag |
| 1753 | MetadataAbbrev, // name | 1753 | MetadataAbbrev, // name |
| ... | @@ -1764,7 +1764,7 @@ pub const ModuleBlock = struct { | ... | @@ -1764,7 +1764,7 @@ pub const ModuleBlock = struct { |
| 1764 | 1764 | ||
| 1765 | pub const CompositeType = struct { | 1765 | pub const CompositeType = struct { |
| 1766 | pub const ops = [_]AbbrevOp{ | 1766 | pub const ops = [_]AbbrevOp{ |
| 1767 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.COMPOSITE_TYPE) }, | 1767 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.COMPOSITE_TYPE) }, |
| 1768 | .{ .literal = 0 | 0x2 }, // is distinct | is not used in old type ref | 1768 | .{ .literal = 0 | 0x2 }, // is distinct | is not used in old type ref |
| 1769 | .{ .fixed = 32 }, // tag | 1769 | .{ .fixed = 32 }, // tag |
| 1770 | MetadataAbbrev, // name | 1770 | MetadataAbbrev, // name |
| ... | @@ -1803,7 +1803,7 @@ pub const ModuleBlock = struct { | ... | @@ -1803,7 +1803,7 @@ pub const ModuleBlock = struct { |
| 1803 | 1803 | ||
| 1804 | pub const DerivedType = struct { | 1804 | pub const DerivedType = struct { |
| 1805 | pub const ops = [_]AbbrevOp{ | 1805 | pub const ops = [_]AbbrevOp{ |
| 1806 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.DERIVED_TYPE) }, | 1806 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.DERIVED_TYPE) }, |
| 1807 | .{ .literal = 0 }, // is distinct | 1807 | .{ .literal = 0 }, // is distinct |
| 1808 | .{ .fixed = 32 }, // tag | 1808 | .{ .fixed = 32 }, // tag |
| 1809 | MetadataAbbrev, // name | 1809 | MetadataAbbrev, // name |
| ... | @@ -1831,7 +1831,7 @@ pub const ModuleBlock = struct { | ... | @@ -1831,7 +1831,7 @@ pub const ModuleBlock = struct { |
| 1831 | 1831 | ||
| 1832 | pub const SubroutineType = struct { | 1832 | pub const SubroutineType = struct { |
| 1833 | pub const ops = [_]AbbrevOp{ | 1833 | pub const ops = [_]AbbrevOp{ |
| 1834 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.SUBROUTINE_TYPE) }, | 1834 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.SUBROUTINE_TYPE) }, |
| 1835 | .{ .literal = 0 | 0x2 }, // is distinct | has no old type refs | 1835 | .{ .literal = 0 | 0x2 }, // is distinct | has no old type refs |
| 1836 | .{ .literal = 0 }, // flags | 1836 | .{ .literal = 0 }, // flags |
| 1837 | MetadataAbbrev, // types | 1837 | MetadataAbbrev, // types |
| ... | @@ -1849,7 +1849,7 @@ pub const ModuleBlock = struct { | ... | @@ -1849,7 +1849,7 @@ pub const ModuleBlock = struct { |
| 1849 | }; | 1849 | }; |
| 1850 | 1850 | ||
| 1851 | pub const ops = [_]AbbrevOp{ | 1851 | pub const ops = [_]AbbrevOp{ |
| 1852 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.ENUMERATOR) }, | 1852 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.ENUMERATOR) }, |
| 1853 | .{ .fixed = @bitSizeOf(Flags) }, // flags | 1853 | .{ .fixed = @bitSizeOf(Flags) }, // flags |
| 1854 | .{ .vbr = 6 }, // bit width | 1854 | .{ .vbr = 6 }, // bit width |
| 1855 | MetadataAbbrev, // name | 1855 | MetadataAbbrev, // name |
| ... | @@ -1864,7 +1864,7 @@ pub const ModuleBlock = struct { | ... | @@ -1864,7 +1864,7 @@ pub const ModuleBlock = struct { |
| 1864 | 1864 | ||
| 1865 | pub const Subrange = struct { | 1865 | pub const Subrange = struct { |
| 1866 | pub const ops = [_]AbbrevOp{ | 1866 | pub const ops = [_]AbbrevOp{ |
| 1867 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.SUBRANGE) }, | 1867 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.SUBRANGE) }, |
| 1868 | .{ .literal = 0 | (2 << 1) }, // is distinct | version | 1868 | .{ .literal = 0 | (2 << 1) }, // is distinct | version |
| 1869 | MetadataAbbrev, // count | 1869 | MetadataAbbrev, // count |
| 1870 | MetadataAbbrev, // lower bound | 1870 | MetadataAbbrev, // lower bound |
| ... | @@ -1878,7 +1878,7 @@ pub const ModuleBlock = struct { | ... | @@ -1878,7 +1878,7 @@ pub const ModuleBlock = struct { |
| 1878 | 1878 | ||
| 1879 | pub const Expression = struct { | 1879 | pub const Expression = struct { |
| 1880 | pub const ops = [_]AbbrevOp{ | 1880 | pub const ops = [_]AbbrevOp{ |
| 1881 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.EXPRESSION) }, | 1881 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.EXPRESSION) }, |
| 1882 | .{ .literal = 0 | (3 << 1) }, // is distinct | version | 1882 | .{ .literal = 0 | (3 << 1) }, // is distinct | version |
| 1883 | MetadataArrayAbbrev, // elements | 1883 | MetadataArrayAbbrev, // elements |
| 1884 | }; | 1884 | }; |
| ... | @@ -1888,7 +1888,7 @@ pub const ModuleBlock = struct { | ... | @@ -1888,7 +1888,7 @@ pub const ModuleBlock = struct { |
| 1888 | 1888 | ||
| 1889 | pub const Node = struct { | 1889 | pub const Node = struct { |
| 1890 | pub const ops = [_]AbbrevOp{ | 1890 | pub const ops = [_]AbbrevOp{ |
| 1891 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.NODE) }, | 1891 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.NODE) }, |
| 1892 | MetadataArrayAbbrev, // elements | 1892 | MetadataArrayAbbrev, // elements |
| 1893 | }; | 1893 | }; |
| 1894 | 1894 | ||
| ... | @@ -1897,7 +1897,7 @@ pub const ModuleBlock = struct { | ... | @@ -1897,7 +1897,7 @@ pub const ModuleBlock = struct { |
| 1897 | 1897 | ||
| 1898 | pub const LocalVar = struct { | 1898 | pub const LocalVar = struct { |
| 1899 | pub const ops = [_]AbbrevOp{ | 1899 | pub const ops = [_]AbbrevOp{ |
| 1900 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.LOCAL_VAR) }, | 1900 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LOCAL_VAR) }, |
| 1901 | .{ .literal = 0b10 }, // is distinct | has alignment | 1901 | .{ .literal = 0b10 }, // is distinct | has alignment |
| 1902 | MetadataAbbrev, // scope | 1902 | MetadataAbbrev, // scope |
| 1903 | MetadataAbbrev, // name | 1903 | MetadataAbbrev, // name |
| ... | @@ -1919,7 +1919,7 @@ pub const ModuleBlock = struct { | ... | @@ -1919,7 +1919,7 @@ pub const ModuleBlock = struct { |
| 1919 | 1919 | ||
| 1920 | pub const Parameter = struct { | 1920 | pub const Parameter = struct { |
| 1921 | pub const ops = [_]AbbrevOp{ | 1921 | pub const ops = [_]AbbrevOp{ |
| 1922 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.LOCAL_VAR) }, | 1922 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.LOCAL_VAR) }, |
| 1923 | .{ .literal = 0b10 }, // is distinct | has alignment | 1923 | .{ .literal = 0b10 }, // is distinct | has alignment |
| 1924 | MetadataAbbrev, // scope | 1924 | MetadataAbbrev, // scope |
| 1925 | MetadataAbbrev, // name | 1925 | MetadataAbbrev, // name |
| ... | @@ -1942,7 +1942,7 @@ pub const ModuleBlock = struct { | ... | @@ -1942,7 +1942,7 @@ pub const ModuleBlock = struct { |
| 1942 | 1942 | ||
| 1943 | pub const GlobalVar = struct { | 1943 | pub const GlobalVar = struct { |
| 1944 | pub const ops = [_]AbbrevOp{ | 1944 | pub const ops = [_]AbbrevOp{ |
| 1945 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.GLOBAL_VAR) }, | 1945 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.GLOBAL_VAR) }, |
| 1946 | .{ .literal = 0b101 }, // is distinct | version | 1946 | .{ .literal = 0b101 }, // is distinct | version |
| 1947 | MetadataAbbrev, // scope | 1947 | MetadataAbbrev, // scope |
| 1948 | MetadataAbbrev, // name | 1948 | MetadataAbbrev, // name |
| ... | @@ -1969,7 +1969,7 @@ pub const ModuleBlock = struct { | ... | @@ -1969,7 +1969,7 @@ pub const ModuleBlock = struct { |
| 1969 | 1969 | ||
| 1970 | pub const GlobalVarExpression = struct { | 1970 | pub const GlobalVarExpression = struct { |
| 1971 | pub const ops = [_]AbbrevOp{ | 1971 | pub const ops = [_]AbbrevOp{ |
| 1972 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.GLOBAL_VAR_EXPR) }, | 1972 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.GLOBAL_VAR_EXPR) }, |
| 1973 | .{ .literal = 0 }, // is distinct | 1973 | .{ .literal = 0 }, // is distinct |
| 1974 | MetadataAbbrev, // variable | 1974 | MetadataAbbrev, // variable |
| 1975 | MetadataAbbrev, // expression | 1975 | MetadataAbbrev, // expression |
| ... | @@ -1981,7 +1981,7 @@ pub const ModuleBlock = struct { | ... | @@ -1981,7 +1981,7 @@ pub const ModuleBlock = struct { |
| 1981 | 1981 | ||
| 1982 | pub const Constant = struct { | 1982 | pub const Constant = struct { |
| 1983 | pub const ops = [_]AbbrevOp{ | 1983 | pub const ops = [_]AbbrevOp{ |
| 1984 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.VALUE) }, | 1984 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.VALUE) }, |
| 1985 | MetadataAbbrev, // type | 1985 | MetadataAbbrev, // type |
| 1986 | MetadataAbbrev, // value | 1986 | MetadataAbbrev, // value |
| 1987 | }; | 1987 | }; |
| ... | @@ -1992,7 +1992,7 @@ pub const ModuleBlock = struct { | ... | @@ -1992,7 +1992,7 @@ pub const ModuleBlock = struct { |
| 1992 | 1992 | ||
| 1993 | pub const Name = struct { | 1993 | pub const Name = struct { |
| 1994 | pub const ops = [_]AbbrevOp{ | 1994 | pub const ops = [_]AbbrevOp{ |
| 1995 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.NAME) }, | 1995 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.NAME) }, |
| 1996 | .{ .array_fixed = 8 }, // name | 1996 | .{ .array_fixed = 8 }, // name |
| 1997 | }; | 1997 | }; |
| 1998 | 1998 | ||
| ... | @@ -2001,7 +2001,7 @@ pub const ModuleBlock = struct { | ... | @@ -2001,7 +2001,7 @@ pub const ModuleBlock = struct { |
| 2001 | 2001 | ||
| 2002 | pub const NamedNode = struct { | 2002 | pub const NamedNode = struct { |
| 2003 | pub const ops = [_]AbbrevOp{ | 2003 | pub const ops = [_]AbbrevOp{ |
| 2004 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.NAMED_NODE) }, | 2004 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.NAMED_NODE) }, |
| 2005 | MetadataArrayAbbrev, // elements | 2005 | MetadataArrayAbbrev, // elements |
| 2006 | }; | 2006 | }; |
| 2007 | 2007 | ||
| ... | @@ -2010,7 +2010,7 @@ pub const ModuleBlock = struct { | ... | @@ -2010,7 +2010,7 @@ pub const ModuleBlock = struct { |
| 2010 | 2010 | ||
| 2011 | pub const GlobalDeclAttachment = struct { | 2011 | pub const GlobalDeclAttachment = struct { |
| 2012 | pub const ops = [_]AbbrevOp{ | 2012 | pub const ops = [_]AbbrevOp{ |
| 2013 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.GLOBAL_DECL_ATTACHMENT) }, | 2013 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.GLOBAL_DECL_ATTACHMENT) }, |
| 2014 | ValueAbbrev, // value id | 2014 | ValueAbbrev, // value id |
| 2015 | .{ .fixed = 1 }, // kind | 2015 | .{ .fixed = 1 }, // kind |
| 2016 | MetadataAbbrev, // elements | 2016 | MetadataAbbrev, // elements |
| ... | @@ -2115,7 +2115,7 @@ pub const ModuleBlock = struct { | ... | @@ -2115,7 +2115,7 @@ pub const ModuleBlock = struct { |
| 2115 | 2115 | ||
| 2116 | pub const NumEntry = struct { | 2116 | pub const NumEntry = struct { |
| 2117 | pub const ops = [_]AbbrevOp{ | 2117 | pub const ops = [_]AbbrevOp{ |
| 2118 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.NUMENTRY) }, | 2118 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.NUMENTRY) }, |
| 2119 | .{ .fixed = 32 }, | 2119 | .{ .fixed = 32 }, |
| 2120 | }; | 2120 | }; |
| 2121 | num: u32, | 2121 | num: u32, |
| ... | @@ -2130,14 +2130,14 @@ pub const ModuleBlock = struct { | ... | @@ -2130,14 +2130,14 @@ pub const ModuleBlock = struct { |
| 2130 | 2130 | ||
| 2131 | pub const Opaque = struct { | 2131 | pub const Opaque = struct { |
| 2132 | pub const ops = [_]AbbrevOp{ | 2132 | pub const ops = [_]AbbrevOp{ |
| 2133 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.OPAQUE) }, | 2133 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.OPAQUE) }, |
| 2134 | .{ .literal = 0 }, | 2134 | .{ .literal = 0 }, |
| 2135 | }; | 2135 | }; |
| 2136 | }; | 2136 | }; |
| 2137 | 2137 | ||
| 2138 | pub const Integer = struct { | 2138 | pub const Integer = struct { |
| 2139 | pub const ops = [_]AbbrevOp{ | 2139 | pub const ops = [_]AbbrevOp{ |
| 2140 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.INTEGER) }, | 2140 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.INTEGER) }, |
| 2141 | .{ .fixed = 28 }, | 2141 | .{ .fixed = 28 }, |
| 2142 | }; | 2142 | }; |
| 2143 | width: u28, | 2143 | width: u28, |
| ... | @@ -2145,7 +2145,7 @@ pub const ModuleBlock = struct { | ... | @@ -2145,7 +2145,7 @@ pub const ModuleBlock = struct { |
| 2145 | 2145 | ||
| 2146 | pub const StructAnon = struct { | 2146 | pub const StructAnon = struct { |
| 2147 | pub const ops = [_]AbbrevOp{ | 2147 | pub const ops = [_]AbbrevOp{ |
| 2148 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.STRUCT_ANON) }, | 2148 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.STRUCT_ANON) }, |
| 2149 | .{ .fixed = 1 }, | 2149 | .{ .fixed = 1 }, |
| 2150 | .{ .array_fixed_runtime = Builder.Type }, | 2150 | .{ .array_fixed_runtime = Builder.Type }, |
| 2151 | }; | 2151 | }; |
| ... | @@ -2155,7 +2155,7 @@ pub const ModuleBlock = struct { | ... | @@ -2155,7 +2155,7 @@ pub const ModuleBlock = struct { |
| 2155 | 2155 | ||
| 2156 | pub const StructNamed = struct { | 2156 | pub const StructNamed = struct { |
| 2157 | pub const ops = [_]AbbrevOp{ | 2157 | pub const ops = [_]AbbrevOp{ |
| 2158 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.STRUCT_NAMED) }, | 2158 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.STRUCT_NAMED) }, |
| 2159 | .{ .fixed = 1 }, | 2159 | .{ .fixed = 1 }, |
| 2160 | .{ .array_fixed_runtime = Builder.Type }, | 2160 | .{ .array_fixed_runtime = Builder.Type }, |
| 2161 | }; | 2161 | }; |
| ... | @@ -2165,7 +2165,7 @@ pub const ModuleBlock = struct { | ... | @@ -2165,7 +2165,7 @@ pub const ModuleBlock = struct { |
| 2165 | 2165 | ||
| 2166 | pub const StructName = struct { | 2166 | pub const StructName = struct { |
| 2167 | pub const ops = [_]AbbrevOp{ | 2167 | pub const ops = [_]AbbrevOp{ |
| 2168 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.STRUCT_NAME) }, | 2168 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.STRUCT_NAME) }, |
| 2169 | .{ .array_fixed = 8 }, | 2169 | .{ .array_fixed = 8 }, |
| 2170 | }; | 2170 | }; |
| 2171 | string: []const u8, | 2171 | string: []const u8, |
| ... | @@ -2173,7 +2173,7 @@ pub const ModuleBlock = struct { | ... | @@ -2173,7 +2173,7 @@ pub const ModuleBlock = struct { |
| 2173 | 2173 | ||
| 2174 | pub const Array = struct { | 2174 | pub const Array = struct { |
| 2175 | pub const ops = [_]AbbrevOp{ | 2175 | pub const ops = [_]AbbrevOp{ |
| 2176 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.ARRAY) }, | 2176 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.ARRAY) }, |
| 2177 | .{ .vbr = 16 }, | 2177 | .{ .vbr = 16 }, |
| 2178 | .{ .fixed_runtime = Builder.Type }, | 2178 | .{ .fixed_runtime = Builder.Type }, |
| 2179 | }; | 2179 | }; |
| ... | @@ -2183,7 +2183,7 @@ pub const ModuleBlock = struct { | ... | @@ -2183,7 +2183,7 @@ pub const ModuleBlock = struct { |
| 2183 | 2183 | ||
| 2184 | pub const Vector = struct { | 2184 | pub const Vector = struct { |
| 2185 | pub const ops = [_]AbbrevOp{ | 2185 | pub const ops = [_]AbbrevOp{ |
| 2186 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.VECTOR) }, | 2186 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.VECTOR) }, |
| 2187 | .{ .vbr = 16 }, | 2187 | .{ .vbr = 16 }, |
| 2188 | .{ .fixed_runtime = Builder.Type }, | 2188 | .{ .fixed_runtime = Builder.Type }, |
| 2189 | }; | 2189 | }; |
| ... | @@ -2193,7 +2193,7 @@ pub const ModuleBlock = struct { | ... | @@ -2193,7 +2193,7 @@ pub const ModuleBlock = struct { |
| 2193 | 2193 | ||
| 2194 | pub const Pointer = struct { | 2194 | pub const Pointer = struct { |
| 2195 | pub const ops = [_]AbbrevOp{ | 2195 | pub const ops = [_]AbbrevOp{ |
| 2196 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.OPAQUE_POINTER) }, | 2196 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.OPAQUE_POINTER) }, |
| 2197 | .{ .vbr = 4 }, | 2197 | .{ .vbr = 4 }, |
| 2198 | }; | 2198 | }; |
| 2199 | addr_space: Builder.AddrSpace, | 2199 | addr_space: Builder.AddrSpace, |
| ... | @@ -2201,7 +2201,7 @@ pub const ModuleBlock = struct { | ... | @@ -2201,7 +2201,7 @@ pub const ModuleBlock = struct { |
| 2201 | 2201 | ||
| 2202 | pub const Target = struct { | 2202 | pub const Target = struct { |
| 2203 | pub const ops = [_]AbbrevOp{ | 2203 | pub const ops = [_]AbbrevOp{ |
| 2204 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.TARGET_TYPE) }, | 2204 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.TARGET_TYPE) }, |
| 2205 | .{ .vbr = 4 }, | 2205 | .{ .vbr = 4 }, |
| 2206 | .{ .array_fixed_runtime = Builder.Type }, | 2206 | .{ .array_fixed_runtime = Builder.Type }, |
| 2207 | .{ .array_fixed = 32 }, | 2207 | .{ .array_fixed = 32 }, |
| ... | @@ -2213,7 +2213,7 @@ pub const ModuleBlock = struct { | ... | @@ -2213,7 +2213,7 @@ pub const ModuleBlock = struct { |
| 2213 | 2213 | ||
| 2214 | pub const Function = struct { | 2214 | pub const Function = struct { |
| 2215 | pub const ops = [_]AbbrevOp{ | 2215 | pub const ops = [_]AbbrevOp{ |
| 2216 | .{ .literal = @intFromEnum(ModuleBlock.TypeBlock.Code.FUNCTION) }, | 2216 | .{ .literal = @backingInt(ModuleBlock.TypeBlock.Code.FUNCTION) }, |
| 2217 | .{ .fixed = 1 }, | 2217 | .{ .fixed = 1 }, |
| 2218 | .{ .fixed_runtime = Builder.Type }, | 2218 | .{ .fixed_runtime = Builder.Type }, |
| 2219 | .{ .array_fixed_runtime = Builder.Type }, | 2219 | .{ .array_fixed_runtime = Builder.Type }, |
| ... | @@ -2238,7 +2238,7 @@ pub const ModuleBlock = struct { | ... | @@ -2238,7 +2238,7 @@ pub const ModuleBlock = struct { |
| 2238 | 2238 | ||
| 2239 | pub const OperandBundleTag = struct { | 2239 | pub const OperandBundleTag = struct { |
| 2240 | pub const ops = [_]AbbrevOp{ | 2240 | pub const ops = [_]AbbrevOp{ |
| 2241 | .{ .literal = @intFromEnum(ModuleBlock.OperandBundleTagsBlock.Code.OPERAND_BUNDLE_TAG) }, | 2241 | .{ .literal = @backingInt(ModuleBlock.OperandBundleTagsBlock.Code.OPERAND_BUNDLE_TAG) }, |
| 2242 | .array_char6, | 2242 | .array_char6, |
| 2243 | }; | 2243 | }; |
| 2244 | tag: []const u8, | 2244 | tag: []const u8, |
| ... | @@ -2254,7 +2254,7 @@ pub const ModuleBlock = struct { | ... | @@ -2254,7 +2254,7 @@ pub const ModuleBlock = struct { |
| 2254 | 2254 | ||
| 2255 | pub const Kind = struct { | 2255 | pub const Kind = struct { |
| 2256 | pub const ops = [_]AbbrevOp{ | 2256 | pub const ops = [_]AbbrevOp{ |
| 2257 | .{ .literal = @intFromEnum(ModuleBlock.MetadataBlock.Code.KIND) }, | 2257 | .{ .literal = @backingInt(ModuleBlock.MetadataBlock.Code.KIND) }, |
| 2258 | .{ .vbr = 4 }, | 2258 | .{ .vbr = 4 }, |
| 2259 | .{ .array_fixed = 8 }, | 2259 | .{ .array_fixed = 8 }, |
| 2260 | }; | 2260 | }; |
| ... | @@ -2283,7 +2283,7 @@ pub const IdentificationBlock = struct { | ... | @@ -2283,7 +2283,7 @@ pub const IdentificationBlock = struct { |
| 2283 | 2283 | ||
| 2284 | pub const Version = struct { | 2284 | pub const Version = struct { |
| 2285 | pub const ops = [_]AbbrevOp{ | 2285 | pub const ops = [_]AbbrevOp{ |
| 2286 | .{ .literal = @intFromEnum(IdentificationBlock.Code.STRING) }, | 2286 | .{ .literal = @backingInt(IdentificationBlock.Code.STRING) }, |
| 2287 | .{ .array_fixed = 8 }, | 2287 | .{ .array_fixed = 8 }, |
| 2288 | }; | 2288 | }; |
| 2289 | string: []const u8, | 2289 | string: []const u8, |
| ... | @@ -2291,7 +2291,7 @@ pub const IdentificationBlock = struct { | ... | @@ -2291,7 +2291,7 @@ pub const IdentificationBlock = struct { |
| 2291 | 2291 | ||
| 2292 | pub const Epoch = struct { | 2292 | pub const Epoch = struct { |
| 2293 | pub const ops = [_]AbbrevOp{ | 2293 | pub const ops = [_]AbbrevOp{ |
| 2294 | .{ .literal = @intFromEnum(IdentificationBlock.Code.EPOCH) }, | 2294 | .{ .literal = @backingInt(IdentificationBlock.Code.EPOCH) }, |
| 2295 | .{ .vbr = 6 }, | 2295 | .{ .vbr = 6 }, |
| 2296 | }; | 2296 | }; |
| 2297 | epoch: u32, | 2297 | epoch: u32, |
| ... | @@ -2309,7 +2309,7 @@ pub const StrtabBlock = struct { | ... | @@ -2309,7 +2309,7 @@ pub const StrtabBlock = struct { |
| 2309 | 2309 | ||
| 2310 | pub const Blob = struct { | 2310 | pub const Blob = struct { |
| 2311 | pub const ops = [_]AbbrevOp{ | 2311 | pub const ops = [_]AbbrevOp{ |
| 2312 | .{ .literal = @intFromEnum(StrtabBlock.Code.BLOB) }, | 2312 | .{ .literal = @backingInt(StrtabBlock.Code.BLOB) }, |
| 2313 | .blob, | 2313 | .blob, |
| 2314 | }; | 2314 | }; |
| 2315 | blob: []const u8, | 2315 | blob: []const u8, |
lib/std/zig/number_literal.zig+3-3| ... | @@ -147,7 +147,7 @@ pub fn parseNumberLiteral(bytes: []const u8) Result { | ... | @@ -147,7 +147,7 @@ pub fn parseNumberLiteral(bytes: []const u8) Result { |
| 147 | 'a'...'z' => c - 'a' + 10, | 147 | 'a'...'z' => c - 'a' + 10, |
| 148 | else => return .{ .failure = .{ .invalid_character = i } }, | 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 | if (exponent and digit >= 10) return .{ .failure = .{ .invalid_digit_exponent = i } }; | 151 | if (exponent and digit >= 10) return .{ .failure = .{ .invalid_digit_exponent = i } }; |
| 152 | underscore = false; | 152 | underscore = false; |
| 153 | special = 0; | 153 | special = 0; |
| ... | @@ -165,8 +165,8 @@ pub fn parseNumberLiteral(bytes: []const u8) Result { | ... | @@ -165,8 +165,8 @@ pub fn parseNumberLiteral(bytes: []const u8) Result { |
| 165 | if (underscore) return .{ .failure = .{ .trailing_underscore = bytes.len - 1 } }; | 165 | if (underscore) return .{ .failure = .{ .trailing_underscore = bytes.len - 1 } }; |
| 166 | if (special != 0) return .{ .failure = .{ .trailing_special = bytes.len - 1 } }; | 166 | if (special != 0) return .{ .failure = .{ .trailing_special = bytes.len - 1 } }; |
| 167 | 167 | ||
| 168 | if (float) return .{ .float = @as(FloatBase, @enumFromInt(base)) }; | 168 | if (float) return .{ .float = @as(FloatBase, @fromBackingInt(@intCast(base))) }; |
| 169 | if (overflow) return .{ .big_int = @as(Base, @enumFromInt(base)) }; | 169 | if (overflow) return .{ .big_int = @as(Base, @fromBackingInt(@intCast(base))) }; |
| 170 | return .{ .int = x }; | 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,7 +292,7 @@ const Parser = struct { |
| 292 | i: usize, | 292 | i: usize, |
| 293 | depths: [272]u8, | 293 | depths: [272]u8, |
| 294 | pub fn parseRoot(p: *Parser) Error!bool { | 294 | pub fn parseRoot(p: *Parser) Error!bool { |
| 295 | const def_index = @intFromEnum(Def.defRoot); | 295 | const def_index = @backingInt(Def.defRoot); |
| 296 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 296 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 297 | p.depths[def_index] += 1; | 297 | p.depths[def_index] += 1; |
| 298 | defer p.depths[def_index] -= 1; | 298 | defer p.depths[def_index] -= 1; |
| ... | @@ -304,7 +304,7 @@ const Parser = struct { | ... | @@ -304,7 +304,7 @@ const Parser = struct { |
| 304 | }; | 304 | }; |
| 305 | } | 305 | } |
| 306 | pub fn parseContainerMembers(p: *Parser) Error!bool { | 306 | pub fn parseContainerMembers(p: *Parser) Error!bool { |
| 307 | const def_index = @intFromEnum(Def.defContainerMembers); | 307 | const def_index = @backingInt(Def.defContainerMembers); |
| 308 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 308 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 309 | p.depths[def_index] += 1; | 309 | p.depths[def_index] += 1; |
| 310 | defer p.depths[def_index] -= 1; | 310 | defer p.depths[def_index] -= 1; |
| ... | @@ -323,7 +323,7 @@ const Parser = struct { | ... | @@ -323,7 +323,7 @@ const Parser = struct { |
| 323 | }; | 323 | }; |
| 324 | } | 324 | } |
| 325 | pub fn parseContainerMembersRest(p: *Parser) Error!bool { | 325 | pub fn parseContainerMembersRest(p: *Parser) Error!bool { |
| 326 | const def_index = @intFromEnum(Def.defContainerMembersRest); | 326 | const def_index = @backingInt(Def.defContainerMembersRest); |
| 327 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 327 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 328 | p.depths[def_index] += 1; | 328 | p.depths[def_index] += 1; |
| 329 | defer p.depths[def_index] -= 1; | 329 | defer p.depths[def_index] -= 1; |
| ... | @@ -354,7 +354,7 @@ const Parser = struct { | ... | @@ -354,7 +354,7 @@ const Parser = struct { |
| 354 | }; | 354 | }; |
| 355 | } | 355 | } |
| 356 | pub fn parseContainerDecl(p: *Parser) Error!bool { | 356 | pub fn parseContainerDecl(p: *Parser) Error!bool { |
| 357 | const def_index = @intFromEnum(Def.defContainerDecl); | 357 | const def_index = @backingInt(Def.defContainerDecl); |
| 358 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 358 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 359 | p.depths[def_index] += 1; | 359 | p.depths[def_index] += 1; |
| 360 | defer p.depths[def_index] -= 1; | 360 | defer p.depths[def_index] -= 1; |
| ... | @@ -370,7 +370,7 @@ const Parser = struct { | ... | @@ -370,7 +370,7 @@ const Parser = struct { |
| 370 | }; | 370 | }; |
| 371 | } | 371 | } |
| 372 | pub fn parseContainerDeclPrefix(p: *Parser) Error!bool { | 372 | pub fn parseContainerDeclPrefix(p: *Parser) Error!bool { |
| 373 | const def_index = @intFromEnum(Def.defContainerDeclPrefix); | 373 | const def_index = @backingInt(Def.defContainerDeclPrefix); |
| 374 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 374 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 375 | p.depths[def_index] += 1; | 375 | p.depths[def_index] += 1; |
| 376 | defer p.depths[def_index] -= 1; | 376 | defer p.depths[def_index] -= 1; |
| ... | @@ -386,7 +386,7 @@ const Parser = struct { | ... | @@ -386,7 +386,7 @@ const Parser = struct { |
| 386 | }; | 386 | }; |
| 387 | } | 387 | } |
| 388 | pub fn parseTestDecl(p: *Parser) Error!bool { | 388 | pub fn parseTestDecl(p: *Parser) Error!bool { |
| 389 | const def_index = @intFromEnum(Def.defTestDecl); | 389 | const def_index = @backingInt(Def.defTestDecl); |
| 390 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 390 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 391 | p.depths[def_index] += 1; | 391 | p.depths[def_index] += 1; |
| 392 | defer p.depths[def_index] -= 1; | 392 | defer p.depths[def_index] -= 1; |
| ... | @@ -405,7 +405,7 @@ const Parser = struct { | ... | @@ -405,7 +405,7 @@ const Parser = struct { |
| 405 | }; | 405 | }; |
| 406 | } | 406 | } |
| 407 | pub fn parseComptimeDecl(p: *Parser) Error!bool { | 407 | pub fn parseComptimeDecl(p: *Parser) Error!bool { |
| 408 | const def_index = @intFromEnum(Def.defComptimeDecl); | 408 | const def_index = @backingInt(Def.defComptimeDecl); |
| 409 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 409 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 410 | p.depths[def_index] += 1; | 410 | p.depths[def_index] += 1; |
| 411 | defer p.depths[def_index] -= 1; | 411 | defer p.depths[def_index] -= 1; |
| ... | @@ -417,7 +417,7 @@ const Parser = struct { | ... | @@ -417,7 +417,7 @@ const Parser = struct { |
| 417 | }; | 417 | }; |
| 418 | } | 418 | } |
| 419 | pub fn parseDecl(p: *Parser) Error!bool { | 419 | pub fn parseDecl(p: *Parser) Error!bool { |
| 420 | const def_index = @intFromEnum(Def.defDecl); | 420 | const def_index = @backingInt(Def.defDecl); |
| 421 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 421 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 422 | p.depths[def_index] += 1; | 422 | p.depths[def_index] += 1; |
| 423 | defer p.depths[def_index] -= 1; | 423 | defer p.depths[def_index] -= 1; |
| ... | @@ -456,7 +456,7 @@ const Parser = struct { | ... | @@ -456,7 +456,7 @@ const Parser = struct { |
| 456 | }; | 456 | }; |
| 457 | } | 457 | } |
| 458 | pub fn parseDeclPrefix(p: *Parser) Error!bool { | 458 | pub fn parseDeclPrefix(p: *Parser) Error!bool { |
| 459 | const def_index = @intFromEnum(Def.defDeclPrefix); | 459 | const def_index = @backingInt(Def.defDeclPrefix); |
| 460 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 460 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 461 | p.depths[def_index] += 1; | 461 | p.depths[def_index] += 1; |
| 462 | defer p.depths[def_index] -= 1; | 462 | defer p.depths[def_index] -= 1; |
| ... | @@ -495,7 +495,7 @@ const Parser = struct { | ... | @@ -495,7 +495,7 @@ const Parser = struct { |
| 495 | }; | 495 | }; |
| 496 | } | 496 | } |
| 497 | pub fn parseFnProto(p: *Parser) Error!bool { | 497 | pub fn parseFnProto(p: *Parser) Error!bool { |
| 498 | const def_index = @intFromEnum(Def.defFnProto); | 498 | const def_index = @backingInt(Def.defFnProto); |
| 499 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 499 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 500 | p.depths[def_index] += 1; | 500 | p.depths[def_index] += 1; |
| 501 | defer p.depths[def_index] -= 1; | 501 | defer p.depths[def_index] -= 1; |
| ... | @@ -507,7 +507,7 @@ const Parser = struct { | ... | @@ -507,7 +507,7 @@ const Parser = struct { |
| 507 | }; | 507 | }; |
| 508 | } | 508 | } |
| 509 | pub fn parseVarDeclProto(p: *Parser) Error!bool { | 509 | pub fn parseVarDeclProto(p: *Parser) Error!bool { |
| 510 | const def_index = @intFromEnum(Def.defVarDeclProto); | 510 | const def_index = @backingInt(Def.defVarDeclProto); |
| 511 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 511 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 512 | p.depths[def_index] += 1; | 512 | p.depths[def_index] += 1; |
| 513 | defer p.depths[def_index] -= 1; | 513 | defer p.depths[def_index] -= 1; |
| ... | @@ -531,7 +531,7 @@ const Parser = struct { | ... | @@ -531,7 +531,7 @@ const Parser = struct { |
| 531 | }; | 531 | }; |
| 532 | } | 532 | } |
| 533 | pub fn parseGlobalVarDecl(p: *Parser) Error!bool { | 533 | pub fn parseGlobalVarDecl(p: *Parser) Error!bool { |
| 534 | const def_index = @intFromEnum(Def.defGlobalVarDecl); | 534 | const def_index = @backingInt(Def.defGlobalVarDecl); |
| 535 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 535 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 536 | p.depths[def_index] += 1; | 536 | p.depths[def_index] += 1; |
| 537 | defer p.depths[def_index] -= 1; | 537 | defer p.depths[def_index] -= 1; |
| ... | @@ -548,7 +548,7 @@ const Parser = struct { | ... | @@ -548,7 +548,7 @@ const Parser = struct { |
| 548 | }; | 548 | }; |
| 549 | } | 549 | } |
| 550 | pub fn parseContainerField(p: *Parser) Error!bool { | 550 | pub fn parseContainerField(p: *Parser) Error!bool { |
| 551 | const def_index = @intFromEnum(Def.defContainerField); | 551 | const def_index = @backingInt(Def.defContainerField); |
| 552 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 552 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 553 | p.depths[def_index] += 1; | 553 | p.depths[def_index] += 1; |
| 554 | defer p.depths[def_index] -= 1; | 554 | defer p.depths[def_index] -= 1; |
| ... | @@ -570,7 +570,7 @@ const Parser = struct { | ... | @@ -570,7 +570,7 @@ const Parser = struct { |
| 570 | }; | 570 | }; |
| 571 | } | 571 | } |
| 572 | pub fn parseBlockStatement(p: *Parser) Error!bool { | 572 | pub fn parseBlockStatement(p: *Parser) Error!bool { |
| 573 | const def_index = @intFromEnum(Def.defBlockStatement); | 573 | const def_index = @backingInt(Def.defBlockStatement); |
| 574 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 574 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 575 | p.depths[def_index] += 1; | 575 | p.depths[def_index] += 1; |
| 576 | defer p.depths[def_index] -= 1; | 576 | defer p.depths[def_index] -= 1; |
| ... | @@ -593,7 +593,7 @@ const Parser = struct { | ... | @@ -593,7 +593,7 @@ const Parser = struct { |
| 593 | }; | 593 | }; |
| 594 | } | 594 | } |
| 595 | pub fn parseStatement(p: *Parser) Error!bool { | 595 | pub fn parseStatement(p: *Parser) Error!bool { |
| 596 | const def_index = @intFromEnum(Def.defStatement); | 596 | const def_index = @backingInt(Def.defStatement); |
| 597 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 597 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 598 | p.depths[def_index] += 1; | 598 | p.depths[def_index] += 1; |
| 599 | defer p.depths[def_index] -= 1; | 599 | defer p.depths[def_index] -= 1; |
| ... | @@ -620,7 +620,7 @@ const Parser = struct { | ... | @@ -620,7 +620,7 @@ const Parser = struct { |
| 620 | }; | 620 | }; |
| 621 | } | 621 | } |
| 622 | pub fn parseStatementPrefix(p: *Parser) Error!bool { | 622 | pub fn parseStatementPrefix(p: *Parser) Error!bool { |
| 623 | const def_index = @intFromEnum(Def.defStatementPrefix); | 623 | const def_index = @backingInt(Def.defStatementPrefix); |
| 624 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 624 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 625 | p.depths[def_index] += 1; | 625 | p.depths[def_index] += 1; |
| 626 | defer p.depths[def_index] -= 1; | 626 | defer p.depths[def_index] -= 1; |
| ... | @@ -654,7 +654,7 @@ const Parser = struct { | ... | @@ -654,7 +654,7 @@ const Parser = struct { |
| 654 | }; | 654 | }; |
| 655 | } | 655 | } |
| 656 | pub fn parseIfStatement(p: *Parser) Error!bool { | 656 | pub fn parseIfStatement(p: *Parser) Error!bool { |
| 657 | const def_index = @intFromEnum(Def.defIfStatement); | 657 | const def_index = @backingInt(Def.defIfStatement); |
| 658 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 658 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 659 | p.depths[def_index] += 1; | 659 | p.depths[def_index] += 1; |
| 660 | defer p.depths[def_index] -= 1; | 660 | defer p.depths[def_index] -= 1; |
| ... | @@ -692,7 +692,7 @@ const Parser = struct { | ... | @@ -692,7 +692,7 @@ const Parser = struct { |
| 692 | }; | 692 | }; |
| 693 | } | 693 | } |
| 694 | pub fn parseLabeledStatement(p: *Parser) Error!bool { | 694 | pub fn parseLabeledStatement(p: *Parser) Error!bool { |
| 695 | const def_index = @intFromEnum(Def.defLabeledStatement); | 695 | const def_index = @backingInt(Def.defLabeledStatement); |
| 696 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 696 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 697 | p.depths[def_index] += 1; | 697 | p.depths[def_index] += 1; |
| 698 | defer p.depths[def_index] -= 1; | 698 | defer p.depths[def_index] -= 1; |
| ... | @@ -713,7 +713,7 @@ const Parser = struct { | ... | @@ -713,7 +713,7 @@ const Parser = struct { |
| 713 | }; | 713 | }; |
| 714 | } | 714 | } |
| 715 | pub fn parseLoopStatement(p: *Parser) Error!bool { | 715 | pub fn parseLoopStatement(p: *Parser) Error!bool { |
| 716 | const def_index = @intFromEnum(Def.defLoopStatement); | 716 | const def_index = @backingInt(Def.defLoopStatement); |
| 717 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 717 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 718 | p.depths[def_index] += 1; | 718 | p.depths[def_index] += 1; |
| 719 | defer p.depths[def_index] -= 1; | 719 | defer p.depths[def_index] -= 1; |
| ... | @@ -732,7 +732,7 @@ const Parser = struct { | ... | @@ -732,7 +732,7 @@ const Parser = struct { |
| 732 | }; | 732 | }; |
| 733 | } | 733 | } |
| 734 | pub fn parseForStatement(p: *Parser) Error!bool { | 734 | pub fn parseForStatement(p: *Parser) Error!bool { |
| 735 | const def_index = @intFromEnum(Def.defForStatement); | 735 | const def_index = @backingInt(Def.defForStatement); |
| 736 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 736 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 737 | p.depths[def_index] += 1; | 737 | p.depths[def_index] += 1; |
| 738 | defer p.depths[def_index] -= 1; | 738 | defer p.depths[def_index] -= 1; |
| ... | @@ -770,7 +770,7 @@ const Parser = struct { | ... | @@ -770,7 +770,7 @@ const Parser = struct { |
| 770 | }; | 770 | }; |
| 771 | } | 771 | } |
| 772 | pub fn parseWhileStatement(p: *Parser) Error!bool { | 772 | pub fn parseWhileStatement(p: *Parser) Error!bool { |
| 773 | const def_index = @intFromEnum(Def.defWhileStatement); | 773 | const def_index = @backingInt(Def.defWhileStatement); |
| 774 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 774 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 775 | p.depths[def_index] += 1; | 775 | p.depths[def_index] += 1; |
| 776 | defer p.depths[def_index] -= 1; | 776 | defer p.depths[def_index] -= 1; |
| ... | @@ -808,7 +808,7 @@ const Parser = struct { | ... | @@ -808,7 +808,7 @@ const Parser = struct { |
| 808 | }; | 808 | }; |
| 809 | } | 809 | } |
| 810 | pub fn parseBlockExprStatement(p: *Parser) Error!bool { | 810 | pub fn parseBlockExprStatement(p: *Parser) Error!bool { |
| 811 | const def_index = @intFromEnum(Def.defBlockExprStatement); | 811 | const def_index = @backingInt(Def.defBlockExprStatement); |
| 812 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 812 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 813 | p.depths[def_index] += 1; | 813 | p.depths[def_index] += 1; |
| 814 | defer p.depths[def_index] -= 1; | 814 | defer p.depths[def_index] -= 1; |
| ... | @@ -827,7 +827,7 @@ const Parser = struct { | ... | @@ -827,7 +827,7 @@ const Parser = struct { |
| 827 | }; | 827 | }; |
| 828 | } | 828 | } |
| 829 | pub fn parseBlockExprPrefix(p: *Parser) Error!bool { | 829 | pub fn parseBlockExprPrefix(p: *Parser) Error!bool { |
| 830 | const def_index = @intFromEnum(Def.defBlockExprPrefix); | 830 | const def_index = @backingInt(Def.defBlockExprPrefix); |
| 831 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 831 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 832 | p.depths[def_index] += 1; | 832 | p.depths[def_index] += 1; |
| 833 | defer p.depths[def_index] -= 1; | 833 | defer p.depths[def_index] -= 1; |
| ... | @@ -839,7 +839,7 @@ const Parser = struct { | ... | @@ -839,7 +839,7 @@ const Parser = struct { |
| 839 | }; | 839 | }; |
| 840 | } | 840 | } |
| 841 | pub fn parseBlockExpr(p: *Parser) Error!bool { | 841 | pub fn parseBlockExpr(p: *Parser) Error!bool { |
| 842 | const def_index = @intFromEnum(Def.defBlockExpr); | 842 | const def_index = @backingInt(Def.defBlockExpr); |
| 843 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 843 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 844 | p.depths[def_index] += 1; | 844 | p.depths[def_index] += 1; |
| 845 | defer p.depths[def_index] -= 1; | 845 | defer p.depths[def_index] -= 1; |
| ... | @@ -851,7 +851,7 @@ const Parser = struct { | ... | @@ -851,7 +851,7 @@ const Parser = struct { |
| 851 | }; | 851 | }; |
| 852 | } | 852 | } |
| 853 | pub fn parseVarAssignStatement(p: *Parser) Error!bool { | 853 | pub fn parseVarAssignStatement(p: *Parser) Error!bool { |
| 854 | const def_index = @intFromEnum(Def.defVarAssignStatement); | 854 | const def_index = @backingInt(Def.defVarAssignStatement); |
| 855 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 855 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 856 | p.depths[def_index] += 1; | 856 | p.depths[def_index] += 1; |
| 857 | defer p.depths[def_index] -= 1; | 857 | defer p.depths[def_index] -= 1; |
| ... | @@ -889,7 +889,7 @@ const Parser = struct { | ... | @@ -889,7 +889,7 @@ const Parser = struct { |
| 889 | }; | 889 | }; |
| 890 | } | 890 | } |
| 891 | pub fn parseAssignExpr(p: *Parser) Error!bool { | 891 | pub fn parseAssignExpr(p: *Parser) Error!bool { |
| 892 | const def_index = @intFromEnum(Def.defAssignExpr); | 892 | const def_index = @backingInt(Def.defAssignExpr); |
| 893 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 893 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 894 | p.depths[def_index] += 1; | 894 | p.depths[def_index] += 1; |
| 895 | defer p.depths[def_index] -= 1; | 895 | defer p.depths[def_index] -= 1; |
| ... | @@ -934,7 +934,7 @@ const Parser = struct { | ... | @@ -934,7 +934,7 @@ const Parser = struct { |
| 934 | }; | 934 | }; |
| 935 | } | 935 | } |
| 936 | pub fn parseSingleAssignExpr(p: *Parser) Error!bool { | 936 | pub fn parseSingleAssignExpr(p: *Parser) Error!bool { |
| 937 | const def_index = @intFromEnum(Def.defSingleAssignExpr); | 937 | const def_index = @backingInt(Def.defSingleAssignExpr); |
| 938 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 938 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 939 | p.depths[def_index] += 1; | 939 | p.depths[def_index] += 1; |
| 940 | defer p.depths[def_index] -= 1; | 940 | defer p.depths[def_index] -= 1; |
| ... | @@ -958,7 +958,7 @@ const Parser = struct { | ... | @@ -958,7 +958,7 @@ const Parser = struct { |
| 958 | }; | 958 | }; |
| 959 | } | 959 | } |
| 960 | pub fn parseExpr(p: *Parser) Error!bool { | 960 | pub fn parseExpr(p: *Parser) Error!bool { |
| 961 | const def_index = @intFromEnum(Def.defExpr); | 961 | const def_index = @backingInt(Def.defExpr); |
| 962 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 962 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 963 | p.depths[def_index] += 1; | 963 | p.depths[def_index] += 1; |
| 964 | defer p.depths[def_index] -= 1; | 964 | defer p.depths[def_index] -= 1; |
| ... | @@ -970,7 +970,7 @@ const Parser = struct { | ... | @@ -970,7 +970,7 @@ const Parser = struct { |
| 970 | }; | 970 | }; |
| 971 | } | 971 | } |
| 972 | pub fn parseBoolOrExpr(p: *Parser) Error!bool { | 972 | pub fn parseBoolOrExpr(p: *Parser) Error!bool { |
| 973 | const def_index = @intFromEnum(Def.defBoolOrExpr); | 973 | const def_index = @backingInt(Def.defBoolOrExpr); |
| 974 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 974 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 975 | p.depths[def_index] += 1; | 975 | p.depths[def_index] += 1; |
| 976 | defer p.depths[def_index] -= 1; | 976 | defer p.depths[def_index] -= 1; |
| ... | @@ -999,7 +999,7 @@ const Parser = struct { | ... | @@ -999,7 +999,7 @@ const Parser = struct { |
| 999 | }; | 999 | }; |
| 1000 | } | 1000 | } |
| 1001 | pub fn parseBoolAndExpr(p: *Parser) Error!bool { | 1001 | pub fn parseBoolAndExpr(p: *Parser) Error!bool { |
| 1002 | const def_index = @intFromEnum(Def.defBoolAndExpr); | 1002 | const def_index = @backingInt(Def.defBoolAndExpr); |
| 1003 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1003 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1004 | p.depths[def_index] += 1; | 1004 | p.depths[def_index] += 1; |
| 1005 | defer p.depths[def_index] -= 1; | 1005 | defer p.depths[def_index] -= 1; |
| ... | @@ -1028,7 +1028,7 @@ const Parser = struct { | ... | @@ -1028,7 +1028,7 @@ const Parser = struct { |
| 1028 | }; | 1028 | }; |
| 1029 | } | 1029 | } |
| 1030 | pub fn parseCompareExpr(p: *Parser) Error!bool { | 1030 | pub fn parseCompareExpr(p: *Parser) Error!bool { |
| 1031 | const def_index = @intFromEnum(Def.defCompareExpr); | 1031 | const def_index = @backingInt(Def.defCompareExpr); |
| 1032 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1032 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1033 | p.depths[def_index] += 1; | 1033 | p.depths[def_index] += 1; |
| 1034 | defer p.depths[def_index] -= 1; | 1034 | defer p.depths[def_index] -= 1; |
| ... | @@ -1050,7 +1050,7 @@ const Parser = struct { | ... | @@ -1050,7 +1050,7 @@ const Parser = struct { |
| 1050 | }; | 1050 | }; |
| 1051 | } | 1051 | } |
| 1052 | pub fn parseBitwiseExpr(p: *Parser) Error!bool { | 1052 | pub fn parseBitwiseExpr(p: *Parser) Error!bool { |
| 1053 | const def_index = @intFromEnum(Def.defBitwiseExpr); | 1053 | const def_index = @backingInt(Def.defBitwiseExpr); |
| 1054 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1054 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1055 | p.depths[def_index] += 1; | 1055 | p.depths[def_index] += 1; |
| 1056 | defer p.depths[def_index] -= 1; | 1056 | defer p.depths[def_index] -= 1; |
| ... | @@ -1079,7 +1079,7 @@ const Parser = struct { | ... | @@ -1079,7 +1079,7 @@ const Parser = struct { |
| 1079 | }; | 1079 | }; |
| 1080 | } | 1080 | } |
| 1081 | pub fn parseBitShiftExpr(p: *Parser) Error!bool { | 1081 | pub fn parseBitShiftExpr(p: *Parser) Error!bool { |
| 1082 | const def_index = @intFromEnum(Def.defBitShiftExpr); | 1082 | const def_index = @backingInt(Def.defBitShiftExpr); |
| 1083 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1083 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1084 | p.depths[def_index] += 1; | 1084 | p.depths[def_index] += 1; |
| 1085 | defer p.depths[def_index] -= 1; | 1085 | defer p.depths[def_index] -= 1; |
| ... | @@ -1108,7 +1108,7 @@ const Parser = struct { | ... | @@ -1108,7 +1108,7 @@ const Parser = struct { |
| 1108 | }; | 1108 | }; |
| 1109 | } | 1109 | } |
| 1110 | pub fn parseAdditionExpr(p: *Parser) Error!bool { | 1110 | pub fn parseAdditionExpr(p: *Parser) Error!bool { |
| 1111 | const def_index = @intFromEnum(Def.defAdditionExpr); | 1111 | const def_index = @backingInt(Def.defAdditionExpr); |
| 1112 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1112 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1113 | p.depths[def_index] += 1; | 1113 | p.depths[def_index] += 1; |
| 1114 | defer p.depths[def_index] -= 1; | 1114 | defer p.depths[def_index] -= 1; |
| ... | @@ -1137,7 +1137,7 @@ const Parser = struct { | ... | @@ -1137,7 +1137,7 @@ const Parser = struct { |
| 1137 | }; | 1137 | }; |
| 1138 | } | 1138 | } |
| 1139 | pub fn parseMultiplyExpr(p: *Parser) Error!bool { | 1139 | pub fn parseMultiplyExpr(p: *Parser) Error!bool { |
| 1140 | const def_index = @intFromEnum(Def.defMultiplyExpr); | 1140 | const def_index = @backingInt(Def.defMultiplyExpr); |
| 1141 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1141 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1142 | p.depths[def_index] += 1; | 1142 | p.depths[def_index] += 1; |
| 1143 | defer p.depths[def_index] -= 1; | 1143 | defer p.depths[def_index] -= 1; |
| ... | @@ -1166,7 +1166,7 @@ const Parser = struct { | ... | @@ -1166,7 +1166,7 @@ const Parser = struct { |
| 1166 | }; | 1166 | }; |
| 1167 | } | 1167 | } |
| 1168 | pub fn parsePrefixExpr(p: *Parser) Error!bool { | 1168 | pub fn parsePrefixExpr(p: *Parser) Error!bool { |
| 1169 | const def_index = @intFromEnum(Def.defPrefixExpr); | 1169 | const def_index = @backingInt(Def.defPrefixExpr); |
| 1170 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1170 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1171 | p.depths[def_index] += 1; | 1171 | p.depths[def_index] += 1; |
| 1172 | defer p.depths[def_index] -= 1; | 1172 | defer p.depths[def_index] -= 1; |
| ... | @@ -1190,7 +1190,7 @@ const Parser = struct { | ... | @@ -1190,7 +1190,7 @@ const Parser = struct { |
| 1190 | }; | 1190 | }; |
| 1191 | } | 1191 | } |
| 1192 | pub fn parsePrimaryExpr(p: *Parser) Error!bool { | 1192 | pub fn parsePrimaryExpr(p: *Parser) Error!bool { |
| 1193 | const def_index = @intFromEnum(Def.defPrimaryExpr); | 1193 | const def_index = @backingInt(Def.defPrimaryExpr); |
| 1194 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1194 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1195 | p.depths[def_index] += 1; | 1195 | p.depths[def_index] += 1; |
| 1196 | defer p.depths[def_index] -= 1; | 1196 | defer p.depths[def_index] -= 1; |
| ... | @@ -1258,7 +1258,7 @@ const Parser = struct { | ... | @@ -1258,7 +1258,7 @@ const Parser = struct { |
| 1258 | }; | 1258 | }; |
| 1259 | } | 1259 | } |
| 1260 | pub fn parseIfExpr(p: *Parser) Error!bool { | 1260 | pub fn parseIfExpr(p: *Parser) Error!bool { |
| 1261 | const def_index = @intFromEnum(Def.defIfExpr); | 1261 | const def_index = @backingInt(Def.defIfExpr); |
| 1262 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1262 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1263 | p.depths[def_index] += 1; | 1263 | p.depths[def_index] += 1; |
| 1264 | defer p.depths[def_index] -= 1; | 1264 | defer p.depths[def_index] -= 1; |
| ... | @@ -1282,7 +1282,7 @@ const Parser = struct { | ... | @@ -1282,7 +1282,7 @@ const Parser = struct { |
| 1282 | }; | 1282 | }; |
| 1283 | } | 1283 | } |
| 1284 | pub fn parseBlock(p: *Parser) Error!bool { | 1284 | pub fn parseBlock(p: *Parser) Error!bool { |
| 1285 | const def_index = @intFromEnum(Def.defBlock); | 1285 | const def_index = @backingInt(Def.defBlock); |
| 1286 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1286 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1287 | p.depths[def_index] += 1; | 1287 | p.depths[def_index] += 1; |
| 1288 | defer p.depths[def_index] -= 1; | 1288 | defer p.depths[def_index] -= 1; |
| ... | @@ -1301,7 +1301,7 @@ const Parser = struct { | ... | @@ -1301,7 +1301,7 @@ const Parser = struct { |
| 1301 | }; | 1301 | }; |
| 1302 | } | 1302 | } |
| 1303 | pub fn parseLoopExpr(p: *Parser) Error!bool { | 1303 | pub fn parseLoopExpr(p: *Parser) Error!bool { |
| 1304 | const def_index = @intFromEnum(Def.defLoopExpr); | 1304 | const def_index = @backingInt(Def.defLoopExpr); |
| 1305 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1305 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1306 | p.depths[def_index] += 1; | 1306 | p.depths[def_index] += 1; |
| 1307 | defer p.depths[def_index] -= 1; | 1307 | defer p.depths[def_index] -= 1; |
| ... | @@ -1320,7 +1320,7 @@ const Parser = struct { | ... | @@ -1320,7 +1320,7 @@ const Parser = struct { |
| 1320 | }; | 1320 | }; |
| 1321 | } | 1321 | } |
| 1322 | pub fn parseForExpr(p: *Parser) Error!bool { | 1322 | pub fn parseForExpr(p: *Parser) Error!bool { |
| 1323 | const def_index = @intFromEnum(Def.defForExpr); | 1323 | const def_index = @backingInt(Def.defForExpr); |
| 1324 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1324 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1325 | p.depths[def_index] += 1; | 1325 | p.depths[def_index] += 1; |
| 1326 | defer p.depths[def_index] -= 1; | 1326 | defer p.depths[def_index] -= 1; |
| ... | @@ -1344,7 +1344,7 @@ const Parser = struct { | ... | @@ -1344,7 +1344,7 @@ const Parser = struct { |
| 1344 | }; | 1344 | }; |
| 1345 | } | 1345 | } |
| 1346 | pub fn parseWhileExpr(p: *Parser) Error!bool { | 1346 | pub fn parseWhileExpr(p: *Parser) Error!bool { |
| 1347 | const def_index = @intFromEnum(Def.defWhileExpr); | 1347 | const def_index = @backingInt(Def.defWhileExpr); |
| 1348 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1348 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1349 | p.depths[def_index] += 1; | 1349 | p.depths[def_index] += 1; |
| 1350 | defer p.depths[def_index] -= 1; | 1350 | defer p.depths[def_index] -= 1; |
| ... | @@ -1361,7 +1361,7 @@ const Parser = struct { | ... | @@ -1361,7 +1361,7 @@ const Parser = struct { |
| 1361 | }; | 1361 | }; |
| 1362 | } | 1362 | } |
| 1363 | pub fn parseCurlySuffixExpr(p: *Parser) Error!bool { | 1363 | pub fn parseCurlySuffixExpr(p: *Parser) Error!bool { |
| 1364 | const def_index = @intFromEnum(Def.defCurlySuffixExpr); | 1364 | const def_index = @backingInt(Def.defCurlySuffixExpr); |
| 1365 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1365 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1366 | p.depths[def_index] += 1; | 1366 | p.depths[def_index] += 1; |
| 1367 | defer p.depths[def_index] -= 1; | 1367 | defer p.depths[def_index] -= 1; |
| ... | @@ -1385,7 +1385,7 @@ const Parser = struct { | ... | @@ -1385,7 +1385,7 @@ const Parser = struct { |
| 1385 | }; | 1385 | }; |
| 1386 | } | 1386 | } |
| 1387 | pub fn parseInitList(p: *Parser) Error!bool { | 1387 | pub fn parseInitList(p: *Parser) Error!bool { |
| 1388 | const def_index = @intFromEnum(Def.defInitList); | 1388 | const def_index = @backingInt(Def.defInitList); |
| 1389 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1389 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1390 | p.depths[def_index] += 1; | 1390 | p.depths[def_index] += 1; |
| 1391 | defer p.depths[def_index] -= 1; | 1391 | defer p.depths[def_index] -= 1; |
| ... | @@ -1425,7 +1425,7 @@ const Parser = struct { | ... | @@ -1425,7 +1425,7 @@ const Parser = struct { |
| 1425 | }; | 1425 | }; |
| 1426 | } | 1426 | } |
| 1427 | pub fn parseTypeExpr(p: *Parser) Error!bool { | 1427 | pub fn parseTypeExpr(p: *Parser) Error!bool { |
| 1428 | const def_index = @intFromEnum(Def.defTypeExpr); | 1428 | const def_index = @backingInt(Def.defTypeExpr); |
| 1429 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1429 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1430 | p.depths[def_index] += 1; | 1430 | p.depths[def_index] += 1; |
| 1431 | defer p.depths[def_index] -= 1; | 1431 | defer p.depths[def_index] -= 1; |
| ... | @@ -1449,7 +1449,7 @@ const Parser = struct { | ... | @@ -1449,7 +1449,7 @@ const Parser = struct { |
| 1449 | }; | 1449 | }; |
| 1450 | } | 1450 | } |
| 1451 | pub fn parseErrorUnionExpr(p: *Parser) Error!bool { | 1451 | pub fn parseErrorUnionExpr(p: *Parser) Error!bool { |
| 1452 | const def_index = @intFromEnum(Def.defErrorUnionExpr); | 1452 | const def_index = @backingInt(Def.defErrorUnionExpr); |
| 1453 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1453 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1454 | p.depths[def_index] += 1; | 1454 | p.depths[def_index] += 1; |
| 1455 | defer p.depths[def_index] -= 1; | 1455 | defer p.depths[def_index] -= 1; |
| ... | @@ -1473,7 +1473,7 @@ const Parser = struct { | ... | @@ -1473,7 +1473,7 @@ const Parser = struct { |
| 1473 | }; | 1473 | }; |
| 1474 | } | 1474 | } |
| 1475 | pub fn parseSuffixExpr(p: *Parser) Error!bool { | 1475 | pub fn parseSuffixExpr(p: *Parser) Error!bool { |
| 1476 | const def_index = @intFromEnum(Def.defSuffixExpr); | 1476 | const def_index = @backingInt(Def.defSuffixExpr); |
| 1477 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1477 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1478 | p.depths[def_index] += 1; | 1478 | p.depths[def_index] += 1; |
| 1479 | defer p.depths[def_index] -= 1; | 1479 | defer p.depths[def_index] -= 1; |
| ... | @@ -1497,7 +1497,7 @@ const Parser = struct { | ... | @@ -1497,7 +1497,7 @@ const Parser = struct { |
| 1497 | }; | 1497 | }; |
| 1498 | } | 1498 | } |
| 1499 | pub fn parsePrimaryTypeExpr(p: *Parser) Error!bool { | 1499 | pub fn parsePrimaryTypeExpr(p: *Parser) Error!bool { |
| 1500 | const def_index = @intFromEnum(Def.defPrimaryTypeExpr); | 1500 | const def_index = @backingInt(Def.defPrimaryTypeExpr); |
| 1501 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1501 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1502 | p.depths[def_index] += 1; | 1502 | p.depths[def_index] += 1; |
| 1503 | defer p.depths[def_index] -= 1; | 1503 | defer p.depths[def_index] -= 1; |
| ... | @@ -1541,7 +1541,7 @@ const Parser = struct { | ... | @@ -1541,7 +1541,7 @@ const Parser = struct { |
| 1541 | }; | 1541 | }; |
| 1542 | } | 1542 | } |
| 1543 | pub fn parseContainerType(p: *Parser) Error!bool { | 1543 | pub fn parseContainerType(p: *Parser) Error!bool { |
| 1544 | const def_index = @intFromEnum(Def.defContainerType); | 1544 | const def_index = @backingInt(Def.defContainerType); |
| 1545 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1545 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1546 | p.depths[def_index] += 1; | 1546 | p.depths[def_index] += 1; |
| 1547 | defer p.depths[def_index] -= 1; | 1547 | defer p.depths[def_index] -= 1; |
| ... | @@ -1560,7 +1560,7 @@ const Parser = struct { | ... | @@ -1560,7 +1560,7 @@ const Parser = struct { |
| 1560 | }; | 1560 | }; |
| 1561 | } | 1561 | } |
| 1562 | pub fn parseErrorSetDecl(p: *Parser) Error!bool { | 1562 | pub fn parseErrorSetDecl(p: *Parser) Error!bool { |
| 1563 | const def_index = @intFromEnum(Def.defErrorSetDecl); | 1563 | const def_index = @backingInt(Def.defErrorSetDecl); |
| 1564 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1564 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1565 | p.depths[def_index] += 1; | 1565 | p.depths[def_index] += 1; |
| 1566 | defer p.depths[def_index] -= 1; | 1566 | defer p.depths[def_index] -= 1; |
| ... | @@ -1572,7 +1572,7 @@ const Parser = struct { | ... | @@ -1572,7 +1572,7 @@ const Parser = struct { |
| 1572 | }; | 1572 | }; |
| 1573 | } | 1573 | } |
| 1574 | pub fn parseGroupedExpr(p: *Parser) Error!bool { | 1574 | pub fn parseGroupedExpr(p: *Parser) Error!bool { |
| 1575 | const def_index = @intFromEnum(Def.defGroupedExpr); | 1575 | const def_index = @backingInt(Def.defGroupedExpr); |
| 1576 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1576 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1577 | p.depths[def_index] += 1; | 1577 | p.depths[def_index] += 1; |
| 1578 | defer p.depths[def_index] -= 1; | 1578 | defer p.depths[def_index] -= 1; |
| ... | @@ -1584,7 +1584,7 @@ const Parser = struct { | ... | @@ -1584,7 +1584,7 @@ const Parser = struct { |
| 1584 | }; | 1584 | }; |
| 1585 | } | 1585 | } |
| 1586 | pub fn parseIfTypeExpr(p: *Parser) Error!bool { | 1586 | pub fn parseIfTypeExpr(p: *Parser) Error!bool { |
| 1587 | const def_index = @intFromEnum(Def.defIfTypeExpr); | 1587 | const def_index = @backingInt(Def.defIfTypeExpr); |
| 1588 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1588 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1589 | p.depths[def_index] += 1; | 1589 | p.depths[def_index] += 1; |
| 1590 | defer p.depths[def_index] -= 1; | 1590 | defer p.depths[def_index] -= 1; |
| ... | @@ -1608,7 +1608,7 @@ const Parser = struct { | ... | @@ -1608,7 +1608,7 @@ const Parser = struct { |
| 1608 | }; | 1608 | }; |
| 1609 | } | 1609 | } |
| 1610 | pub fn parseLabeledTypeExpr(p: *Parser) Error!bool { | 1610 | pub fn parseLabeledTypeExpr(p: *Parser) Error!bool { |
| 1611 | const def_index = @intFromEnum(Def.defLabeledTypeExpr); | 1611 | const def_index = @backingInt(Def.defLabeledTypeExpr); |
| 1612 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1612 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1613 | p.depths[def_index] += 1; | 1613 | p.depths[def_index] += 1; |
| 1614 | defer p.depths[def_index] -= 1; | 1614 | defer p.depths[def_index] -= 1; |
| ... | @@ -1624,7 +1624,7 @@ const Parser = struct { | ... | @@ -1624,7 +1624,7 @@ const Parser = struct { |
| 1624 | }; | 1624 | }; |
| 1625 | } | 1625 | } |
| 1626 | pub fn parseLoopTypeExpr(p: *Parser) Error!bool { | 1626 | pub fn parseLoopTypeExpr(p: *Parser) Error!bool { |
| 1627 | const def_index = @intFromEnum(Def.defLoopTypeExpr); | 1627 | const def_index = @backingInt(Def.defLoopTypeExpr); |
| 1628 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1628 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1629 | p.depths[def_index] += 1; | 1629 | p.depths[def_index] += 1; |
| 1630 | defer p.depths[def_index] -= 1; | 1630 | defer p.depths[def_index] -= 1; |
| ... | @@ -1643,7 +1643,7 @@ const Parser = struct { | ... | @@ -1643,7 +1643,7 @@ const Parser = struct { |
| 1643 | }; | 1643 | }; |
| 1644 | } | 1644 | } |
| 1645 | pub fn parseForTypeExpr(p: *Parser) Error!bool { | 1645 | pub fn parseForTypeExpr(p: *Parser) Error!bool { |
| 1646 | const def_index = @intFromEnum(Def.defForTypeExpr); | 1646 | const def_index = @backingInt(Def.defForTypeExpr); |
| 1647 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1647 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1648 | p.depths[def_index] += 1; | 1648 | p.depths[def_index] += 1; |
| 1649 | defer p.depths[def_index] -= 1; | 1649 | defer p.depths[def_index] -= 1; |
| ... | @@ -1667,7 +1667,7 @@ const Parser = struct { | ... | @@ -1667,7 +1667,7 @@ const Parser = struct { |
| 1667 | }; | 1667 | }; |
| 1668 | } | 1668 | } |
| 1669 | pub fn parseWhileTypeExpr(p: *Parser) Error!bool { | 1669 | pub fn parseWhileTypeExpr(p: *Parser) Error!bool { |
| 1670 | const def_index = @intFromEnum(Def.defWhileTypeExpr); | 1670 | const def_index = @backingInt(Def.defWhileTypeExpr); |
| 1671 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1671 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1672 | p.depths[def_index] += 1; | 1672 | p.depths[def_index] += 1; |
| 1673 | defer p.depths[def_index] -= 1; | 1673 | defer p.depths[def_index] -= 1; |
| ... | @@ -1691,7 +1691,7 @@ const Parser = struct { | ... | @@ -1691,7 +1691,7 @@ const Parser = struct { |
| 1691 | }; | 1691 | }; |
| 1692 | } | 1692 | } |
| 1693 | pub fn parseSwitchExpr(p: *Parser) Error!bool { | 1693 | pub fn parseSwitchExpr(p: *Parser) Error!bool { |
| 1694 | const def_index = @intFromEnum(Def.defSwitchExpr); | 1694 | const def_index = @backingInt(Def.defSwitchExpr); |
| 1695 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1695 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1696 | p.depths[def_index] += 1; | 1696 | p.depths[def_index] += 1; |
| 1697 | defer p.depths[def_index] -= 1; | 1697 | defer p.depths[def_index] -= 1; |
| ... | @@ -1703,7 +1703,7 @@ const Parser = struct { | ... | @@ -1703,7 +1703,7 @@ const Parser = struct { |
| 1703 | }; | 1703 | }; |
| 1704 | } | 1704 | } |
| 1705 | pub fn parseAsmExpr(p: *Parser) Error!bool { | 1705 | pub fn parseAsmExpr(p: *Parser) Error!bool { |
| 1706 | const def_index = @intFromEnum(Def.defAsmExpr); | 1706 | const def_index = @backingInt(Def.defAsmExpr); |
| 1707 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1707 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1708 | p.depths[def_index] += 1; | 1708 | p.depths[def_index] += 1; |
| 1709 | defer p.depths[def_index] -= 1; | 1709 | defer p.depths[def_index] -= 1; |
| ... | @@ -1715,7 +1715,7 @@ const Parser = struct { | ... | @@ -1715,7 +1715,7 @@ const Parser = struct { |
| 1715 | }; | 1715 | }; |
| 1716 | } | 1716 | } |
| 1717 | pub fn parseAsmOutput(p: *Parser) Error!bool { | 1717 | pub fn parseAsmOutput(p: *Parser) Error!bool { |
| 1718 | const def_index = @intFromEnum(Def.defAsmOutput); | 1718 | const def_index = @backingInt(Def.defAsmOutput); |
| 1719 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1719 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1720 | p.depths[def_index] += 1; | 1720 | p.depths[def_index] += 1; |
| 1721 | defer p.depths[def_index] -= 1; | 1721 | defer p.depths[def_index] -= 1; |
| ... | @@ -1727,7 +1727,7 @@ const Parser = struct { | ... | @@ -1727,7 +1727,7 @@ const Parser = struct { |
| 1727 | }; | 1727 | }; |
| 1728 | } | 1728 | } |
| 1729 | pub fn parseAsmOutputItem(p: *Parser) Error!bool { | 1729 | pub fn parseAsmOutputItem(p: *Parser) Error!bool { |
| 1730 | const def_index = @intFromEnum(Def.defAsmOutputItem); | 1730 | const def_index = @backingInt(Def.defAsmOutputItem); |
| 1731 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1731 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1732 | p.depths[def_index] += 1; | 1732 | p.depths[def_index] += 1; |
| 1733 | defer p.depths[def_index] -= 1; | 1733 | defer p.depths[def_index] -= 1; |
| ... | @@ -1746,7 +1746,7 @@ const Parser = struct { | ... | @@ -1746,7 +1746,7 @@ const Parser = struct { |
| 1746 | }; | 1746 | }; |
| 1747 | } | 1747 | } |
| 1748 | pub fn parseAsmInput(p: *Parser) Error!bool { | 1748 | pub fn parseAsmInput(p: *Parser) Error!bool { |
| 1749 | const def_index = @intFromEnum(Def.defAsmInput); | 1749 | const def_index = @backingInt(Def.defAsmInput); |
| 1750 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1750 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1751 | p.depths[def_index] += 1; | 1751 | p.depths[def_index] += 1; |
| 1752 | defer p.depths[def_index] -= 1; | 1752 | defer p.depths[def_index] -= 1; |
| ... | @@ -1758,7 +1758,7 @@ const Parser = struct { | ... | @@ -1758,7 +1758,7 @@ const Parser = struct { |
| 1758 | }; | 1758 | }; |
| 1759 | } | 1759 | } |
| 1760 | pub fn parseAsmInputItem(p: *Parser) Error!bool { | 1760 | pub fn parseAsmInputItem(p: *Parser) Error!bool { |
| 1761 | const def_index = @intFromEnum(Def.defAsmInputItem); | 1761 | const def_index = @backingInt(Def.defAsmInputItem); |
| 1762 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1762 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1763 | p.depths[def_index] += 1; | 1763 | p.depths[def_index] += 1; |
| 1764 | defer p.depths[def_index] -= 1; | 1764 | defer p.depths[def_index] -= 1; |
| ... | @@ -1770,7 +1770,7 @@ const Parser = struct { | ... | @@ -1770,7 +1770,7 @@ const Parser = struct { |
| 1770 | }; | 1770 | }; |
| 1771 | } | 1771 | } |
| 1772 | pub fn parseAsmClobbers(p: *Parser) Error!bool { | 1772 | pub fn parseAsmClobbers(p: *Parser) Error!bool { |
| 1773 | const def_index = @intFromEnum(Def.defAsmClobbers); | 1773 | const def_index = @backingInt(Def.defAsmClobbers); |
| 1774 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1774 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1775 | p.depths[def_index] += 1; | 1775 | p.depths[def_index] += 1; |
| 1776 | defer p.depths[def_index] -= 1; | 1776 | defer p.depths[def_index] -= 1; |
| ... | @@ -1782,7 +1782,7 @@ const Parser = struct { | ... | @@ -1782,7 +1782,7 @@ const Parser = struct { |
| 1782 | }; | 1782 | }; |
| 1783 | } | 1783 | } |
| 1784 | pub fn parseBreakLabel(p: *Parser) Error!bool { | 1784 | pub fn parseBreakLabel(p: *Parser) Error!bool { |
| 1785 | const def_index = @intFromEnum(Def.defBreakLabel); | 1785 | const def_index = @backingInt(Def.defBreakLabel); |
| 1786 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1786 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1787 | p.depths[def_index] += 1; | 1787 | p.depths[def_index] += 1; |
| 1788 | defer p.depths[def_index] -= 1; | 1788 | defer p.depths[def_index] -= 1; |
| ... | @@ -1794,7 +1794,7 @@ const Parser = struct { | ... | @@ -1794,7 +1794,7 @@ const Parser = struct { |
| 1794 | }; | 1794 | }; |
| 1795 | } | 1795 | } |
| 1796 | pub fn parseBlockLabel(p: *Parser) Error!bool { | 1796 | pub fn parseBlockLabel(p: *Parser) Error!bool { |
| 1797 | const def_index = @intFromEnum(Def.defBlockLabel); | 1797 | const def_index = @backingInt(Def.defBlockLabel); |
| 1798 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1798 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1799 | p.depths[def_index] += 1; | 1799 | p.depths[def_index] += 1; |
| 1800 | defer p.depths[def_index] -= 1; | 1800 | defer p.depths[def_index] -= 1; |
| ... | @@ -1806,7 +1806,7 @@ const Parser = struct { | ... | @@ -1806,7 +1806,7 @@ const Parser = struct { |
| 1806 | }; | 1806 | }; |
| 1807 | } | 1807 | } |
| 1808 | pub fn parseFieldInit(p: *Parser) Error!bool { | 1808 | pub fn parseFieldInit(p: *Parser) Error!bool { |
| 1809 | const def_index = @intFromEnum(Def.defFieldInit); | 1809 | const def_index = @backingInt(Def.defFieldInit); |
| 1810 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1810 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1811 | p.depths[def_index] += 1; | 1811 | p.depths[def_index] += 1; |
| 1812 | defer p.depths[def_index] -= 1; | 1812 | defer p.depths[def_index] -= 1; |
| ... | @@ -1818,7 +1818,7 @@ const Parser = struct { | ... | @@ -1818,7 +1818,7 @@ const Parser = struct { |
| 1818 | }; | 1818 | }; |
| 1819 | } | 1819 | } |
| 1820 | pub fn parseWhileContinueExpr(p: *Parser) Error!bool { | 1820 | pub fn parseWhileContinueExpr(p: *Parser) Error!bool { |
| 1821 | const def_index = @intFromEnum(Def.defWhileContinueExpr); | 1821 | const def_index = @backingInt(Def.defWhileContinueExpr); |
| 1822 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1822 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1823 | p.depths[def_index] += 1; | 1823 | p.depths[def_index] += 1; |
| 1824 | defer p.depths[def_index] -= 1; | 1824 | defer p.depths[def_index] -= 1; |
| ... | @@ -1830,7 +1830,7 @@ const Parser = struct { | ... | @@ -1830,7 +1830,7 @@ const Parser = struct { |
| 1830 | }; | 1830 | }; |
| 1831 | } | 1831 | } |
| 1832 | pub fn parseLinkSection(p: *Parser) Error!bool { | 1832 | pub fn parseLinkSection(p: *Parser) Error!bool { |
| 1833 | const def_index = @intFromEnum(Def.defLinkSection); | 1833 | const def_index = @backingInt(Def.defLinkSection); |
| 1834 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1834 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1835 | p.depths[def_index] += 1; | 1835 | p.depths[def_index] += 1; |
| 1836 | defer p.depths[def_index] -= 1; | 1836 | defer p.depths[def_index] -= 1; |
| ... | @@ -1842,7 +1842,7 @@ const Parser = struct { | ... | @@ -1842,7 +1842,7 @@ const Parser = struct { |
| 1842 | }; | 1842 | }; |
| 1843 | } | 1843 | } |
| 1844 | pub fn parseAddrSpace(p: *Parser) Error!bool { | 1844 | pub fn parseAddrSpace(p: *Parser) Error!bool { |
| 1845 | const def_index = @intFromEnum(Def.defAddrSpace); | 1845 | const def_index = @backingInt(Def.defAddrSpace); |
| 1846 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1846 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1847 | p.depths[def_index] += 1; | 1847 | p.depths[def_index] += 1; |
| 1848 | defer p.depths[def_index] -= 1; | 1848 | defer p.depths[def_index] -= 1; |
| ... | @@ -1854,7 +1854,7 @@ const Parser = struct { | ... | @@ -1854,7 +1854,7 @@ const Parser = struct { |
| 1854 | }; | 1854 | }; |
| 1855 | } | 1855 | } |
| 1856 | pub fn parseCallConv(p: *Parser) Error!bool { | 1856 | pub fn parseCallConv(p: *Parser) Error!bool { |
| 1857 | const def_index = @intFromEnum(Def.defCallConv); | 1857 | const def_index = @backingInt(Def.defCallConv); |
| 1858 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1858 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1859 | p.depths[def_index] += 1; | 1859 | p.depths[def_index] += 1; |
| 1860 | defer p.depths[def_index] -= 1; | 1860 | defer p.depths[def_index] -= 1; |
| ... | @@ -1866,7 +1866,7 @@ const Parser = struct { | ... | @@ -1866,7 +1866,7 @@ const Parser = struct { |
| 1866 | }; | 1866 | }; |
| 1867 | } | 1867 | } |
| 1868 | pub fn parseParamDecl(p: *Parser) Error!bool { | 1868 | pub fn parseParamDecl(p: *Parser) Error!bool { |
| 1869 | const def_index = @intFromEnum(Def.defParamDecl); | 1869 | const def_index = @backingInt(Def.defParamDecl); |
| 1870 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1870 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1871 | p.depths[def_index] += 1; | 1871 | p.depths[def_index] += 1; |
| 1872 | defer p.depths[def_index] -= 1; | 1872 | defer p.depths[def_index] -= 1; |
| ... | @@ -1890,7 +1890,7 @@ const Parser = struct { | ... | @@ -1890,7 +1890,7 @@ const Parser = struct { |
| 1890 | }; | 1890 | }; |
| 1891 | } | 1891 | } |
| 1892 | pub fn parseParamType(p: *Parser) Error!bool { | 1892 | pub fn parseParamType(p: *Parser) Error!bool { |
| 1893 | const def_index = @intFromEnum(Def.defParamType); | 1893 | const def_index = @backingInt(Def.defParamType); |
| 1894 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1894 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1895 | p.depths[def_index] += 1; | 1895 | p.depths[def_index] += 1; |
| 1896 | defer p.depths[def_index] -= 1; | 1896 | defer p.depths[def_index] -= 1; |
| ... | @@ -1904,7 +1904,7 @@ const Parser = struct { | ... | @@ -1904,7 +1904,7 @@ const Parser = struct { |
| 1904 | }; | 1904 | }; |
| 1905 | } | 1905 | } |
| 1906 | pub fn parseIfPrefix(p: *Parser) Error!bool { | 1906 | pub fn parseIfPrefix(p: *Parser) Error!bool { |
| 1907 | const def_index = @intFromEnum(Def.defIfPrefix); | 1907 | const def_index = @backingInt(Def.defIfPrefix); |
| 1908 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1908 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1909 | p.depths[def_index] += 1; | 1909 | p.depths[def_index] += 1; |
| 1910 | defer p.depths[def_index] -= 1; | 1910 | defer p.depths[def_index] -= 1; |
| ... | @@ -1916,7 +1916,7 @@ const Parser = struct { | ... | @@ -1916,7 +1916,7 @@ const Parser = struct { |
| 1916 | }; | 1916 | }; |
| 1917 | } | 1917 | } |
| 1918 | pub fn parseWhilePrefix(p: *Parser) Error!bool { | 1918 | pub fn parseWhilePrefix(p: *Parser) Error!bool { |
| 1919 | const def_index = @intFromEnum(Def.defWhilePrefix); | 1919 | const def_index = @backingInt(Def.defWhilePrefix); |
| 1920 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1920 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1921 | p.depths[def_index] += 1; | 1921 | p.depths[def_index] += 1; |
| 1922 | defer p.depths[def_index] -= 1; | 1922 | defer p.depths[def_index] -= 1; |
| ... | @@ -1928,7 +1928,7 @@ const Parser = struct { | ... | @@ -1928,7 +1928,7 @@ const Parser = struct { |
| 1928 | }; | 1928 | }; |
| 1929 | } | 1929 | } |
| 1930 | pub fn parseForPrefix(p: *Parser) Error!bool { | 1930 | pub fn parseForPrefix(p: *Parser) Error!bool { |
| 1931 | const def_index = @intFromEnum(Def.defForPrefix); | 1931 | const def_index = @backingInt(Def.defForPrefix); |
| 1932 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1932 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1933 | p.depths[def_index] += 1; | 1933 | p.depths[def_index] += 1; |
| 1934 | defer p.depths[def_index] -= 1; | 1934 | defer p.depths[def_index] -= 1; |
| ... | @@ -1940,7 +1940,7 @@ const Parser = struct { | ... | @@ -1940,7 +1940,7 @@ const Parser = struct { |
| 1940 | }; | 1940 | }; |
| 1941 | } | 1941 | } |
| 1942 | pub fn parsePayload(p: *Parser) Error!bool { | 1942 | pub fn parsePayload(p: *Parser) Error!bool { |
| 1943 | const def_index = @intFromEnum(Def.defPayload); | 1943 | const def_index = @backingInt(Def.defPayload); |
| 1944 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1944 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1945 | p.depths[def_index] += 1; | 1945 | p.depths[def_index] += 1; |
| 1946 | defer p.depths[def_index] -= 1; | 1946 | defer p.depths[def_index] -= 1; |
| ... | @@ -1952,7 +1952,7 @@ const Parser = struct { | ... | @@ -1952,7 +1952,7 @@ const Parser = struct { |
| 1952 | }; | 1952 | }; |
| 1953 | } | 1953 | } |
| 1954 | pub fn parsePtrPayload(p: *Parser) Error!bool { | 1954 | pub fn parsePtrPayload(p: *Parser) Error!bool { |
| 1955 | const def_index = @intFromEnum(Def.defPtrPayload); | 1955 | const def_index = @backingInt(Def.defPtrPayload); |
| 1956 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1956 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1957 | p.depths[def_index] += 1; | 1957 | p.depths[def_index] += 1; |
| 1958 | defer p.depths[def_index] -= 1; | 1958 | defer p.depths[def_index] -= 1; |
| ... | @@ -1964,7 +1964,7 @@ const Parser = struct { | ... | @@ -1964,7 +1964,7 @@ const Parser = struct { |
| 1964 | }; | 1964 | }; |
| 1965 | } | 1965 | } |
| 1966 | pub fn parsePtrIndexPayload(p: *Parser) Error!bool { | 1966 | pub fn parsePtrIndexPayload(p: *Parser) Error!bool { |
| 1967 | const def_index = @intFromEnum(Def.defPtrIndexPayload); | 1967 | const def_index = @backingInt(Def.defPtrIndexPayload); |
| 1968 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1968 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1969 | p.depths[def_index] += 1; | 1969 | p.depths[def_index] += 1; |
| 1970 | defer p.depths[def_index] -= 1; | 1970 | defer p.depths[def_index] -= 1; |
| ... | @@ -1981,7 +1981,7 @@ const Parser = struct { | ... | @@ -1981,7 +1981,7 @@ const Parser = struct { |
| 1981 | }; | 1981 | }; |
| 1982 | } | 1982 | } |
| 1983 | pub fn parsePtrListPayload(p: *Parser) Error!bool { | 1983 | pub fn parsePtrListPayload(p: *Parser) Error!bool { |
| 1984 | const def_index = @intFromEnum(Def.defPtrListPayload); | 1984 | const def_index = @backingInt(Def.defPtrListPayload); |
| 1985 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 1985 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 1986 | p.depths[def_index] += 1; | 1986 | p.depths[def_index] += 1; |
| 1987 | defer p.depths[def_index] -= 1; | 1987 | defer p.depths[def_index] -= 1; |
| ... | @@ -2005,7 +2005,7 @@ const Parser = struct { | ... | @@ -2005,7 +2005,7 @@ const Parser = struct { |
| 2005 | }; | 2005 | }; |
| 2006 | } | 2006 | } |
| 2007 | pub fn parseSwitchProng(p: *Parser) Error!bool { | 2007 | pub fn parseSwitchProng(p: *Parser) Error!bool { |
| 2008 | const def_index = @intFromEnum(Def.defSwitchProng); | 2008 | const def_index = @backingInt(Def.defSwitchProng); |
| 2009 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2009 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2010 | p.depths[def_index] += 1; | 2010 | p.depths[def_index] += 1; |
| 2011 | defer p.depths[def_index] -= 1; | 2011 | defer p.depths[def_index] -= 1; |
| ... | @@ -2017,7 +2017,7 @@ const Parser = struct { | ... | @@ -2017,7 +2017,7 @@ const Parser = struct { |
| 2017 | }; | 2017 | }; |
| 2018 | } | 2018 | } |
| 2019 | pub fn parseSwitchCase(p: *Parser) Error!bool { | 2019 | pub fn parseSwitchCase(p: *Parser) Error!bool { |
| 2020 | const def_index = @intFromEnum(Def.defSwitchCase); | 2020 | const def_index = @backingInt(Def.defSwitchCase); |
| 2021 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2021 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2022 | p.depths[def_index] += 1; | 2022 | p.depths[def_index] += 1; |
| 2023 | defer p.depths[def_index] -= 1; | 2023 | defer p.depths[def_index] -= 1; |
| ... | @@ -2043,7 +2043,7 @@ const Parser = struct { | ... | @@ -2043,7 +2043,7 @@ const Parser = struct { |
| 2043 | }; | 2043 | }; |
| 2044 | } | 2044 | } |
| 2045 | pub fn parseSwitchItem(p: *Parser) Error!bool { | 2045 | pub fn parseSwitchItem(p: *Parser) Error!bool { |
| 2046 | const def_index = @intFromEnum(Def.defSwitchItem); | 2046 | const def_index = @backingInt(Def.defSwitchItem); |
| 2047 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2047 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2048 | p.depths[def_index] += 1; | 2048 | p.depths[def_index] += 1; |
| 2049 | defer p.depths[def_index] -= 1; | 2049 | defer p.depths[def_index] -= 1; |
| ... | @@ -2060,7 +2060,7 @@ const Parser = struct { | ... | @@ -2060,7 +2060,7 @@ const Parser = struct { |
| 2060 | }; | 2060 | }; |
| 2061 | } | 2061 | } |
| 2062 | pub fn parseForArgumentsList(p: *Parser) Error!bool { | 2062 | pub fn parseForArgumentsList(p: *Parser) Error!bool { |
| 2063 | const def_index = @intFromEnum(Def.defForArgumentsList); | 2063 | const def_index = @backingInt(Def.defForArgumentsList); |
| 2064 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2064 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2065 | p.depths[def_index] += 1; | 2065 | p.depths[def_index] += 1; |
| 2066 | defer p.depths[def_index] -= 1; | 2066 | defer p.depths[def_index] -= 1; |
| ... | @@ -2084,7 +2084,7 @@ const Parser = struct { | ... | @@ -2084,7 +2084,7 @@ const Parser = struct { |
| 2084 | }; | 2084 | }; |
| 2085 | } | 2085 | } |
| 2086 | pub fn parseForItem(p: *Parser) Error!bool { | 2086 | pub fn parseForItem(p: *Parser) Error!bool { |
| 2087 | const def_index = @intFromEnum(Def.defForItem); | 2087 | const def_index = @backingInt(Def.defForItem); |
| 2088 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2088 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2089 | p.depths[def_index] += 1; | 2089 | p.depths[def_index] += 1; |
| 2090 | defer p.depths[def_index] -= 1; | 2090 | defer p.depths[def_index] -= 1; |
| ... | @@ -2120,7 +2120,7 @@ const Parser = struct { | ... | @@ -2120,7 +2120,7 @@ const Parser = struct { |
| 2120 | }; | 2120 | }; |
| 2121 | } | 2121 | } |
| 2122 | pub fn parseAssignOp(p: *Parser) Error!bool { | 2122 | pub fn parseAssignOp(p: *Parser) Error!bool { |
| 2123 | const def_index = @intFromEnum(Def.defAssignOp); | 2123 | const def_index = @backingInt(Def.defAssignOp); |
| 2124 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2124 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2125 | p.depths[def_index] += 1; | 2125 | p.depths[def_index] += 1; |
| 2126 | defer p.depths[def_index] -= 1; | 2126 | defer p.depths[def_index] -= 1; |
| ... | @@ -2166,7 +2166,7 @@ const Parser = struct { | ... | @@ -2166,7 +2166,7 @@ const Parser = struct { |
| 2166 | }; | 2166 | }; |
| 2167 | } | 2167 | } |
| 2168 | pub fn parseOrOp(p: *Parser) Error!bool { | 2168 | pub fn parseOrOp(p: *Parser) Error!bool { |
| 2169 | const def_index = @intFromEnum(Def.defOrOp); | 2169 | const def_index = @backingInt(Def.defOrOp); |
| 2170 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2170 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2171 | p.depths[def_index] += 1; | 2171 | p.depths[def_index] += 1; |
| 2172 | defer p.depths[def_index] -= 1; | 2172 | defer p.depths[def_index] -= 1; |
| ... | @@ -2190,7 +2190,7 @@ const Parser = struct { | ... | @@ -2190,7 +2190,7 @@ const Parser = struct { |
| 2190 | }; | 2190 | }; |
| 2191 | } | 2191 | } |
| 2192 | pub fn parseAndOp(p: *Parser) Error!bool { | 2192 | pub fn parseAndOp(p: *Parser) Error!bool { |
| 2193 | const def_index = @intFromEnum(Def.defAndOp); | 2193 | const def_index = @backingInt(Def.defAndOp); |
| 2194 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2194 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2195 | p.depths[def_index] += 1; | 2195 | p.depths[def_index] += 1; |
| 2196 | defer p.depths[def_index] -= 1; | 2196 | defer p.depths[def_index] -= 1; |
| ... | @@ -2214,7 +2214,7 @@ const Parser = struct { | ... | @@ -2214,7 +2214,7 @@ const Parser = struct { |
| 2214 | }; | 2214 | }; |
| 2215 | } | 2215 | } |
| 2216 | pub fn parseCompareOp(p: *Parser) Error!bool { | 2216 | pub fn parseCompareOp(p: *Parser) Error!bool { |
| 2217 | const def_index = @intFromEnum(Def.defCompareOp); | 2217 | const def_index = @backingInt(Def.defCompareOp); |
| 2218 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2218 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2219 | p.depths[def_index] += 1; | 2219 | p.depths[def_index] += 1; |
| 2220 | defer p.depths[def_index] -= 1; | 2220 | defer p.depths[def_index] -= 1; |
| ... | @@ -2238,7 +2238,7 @@ const Parser = struct { | ... | @@ -2238,7 +2238,7 @@ const Parser = struct { |
| 2238 | }; | 2238 | }; |
| 2239 | } | 2239 | } |
| 2240 | pub fn parseCompareOpTok(p: *Parser) Error!bool { | 2240 | pub fn parseCompareOpTok(p: *Parser) Error!bool { |
| 2241 | const def_index = @intFromEnum(Def.defCompareOpTok); | 2241 | const def_index = @backingInt(Def.defCompareOpTok); |
| 2242 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2242 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2243 | p.depths[def_index] += 1; | 2243 | p.depths[def_index] += 1; |
| 2244 | defer p.depths[def_index] -= 1; | 2244 | defer p.depths[def_index] -= 1; |
| ... | @@ -2260,7 +2260,7 @@ const Parser = struct { | ... | @@ -2260,7 +2260,7 @@ const Parser = struct { |
| 2260 | }; | 2260 | }; |
| 2261 | } | 2261 | } |
| 2262 | pub fn parseBitwiseOp(p: *Parser) Error!bool { | 2262 | pub fn parseBitwiseOp(p: *Parser) Error!bool { |
| 2263 | const def_index = @intFromEnum(Def.defBitwiseOp); | 2263 | const def_index = @backingInt(Def.defBitwiseOp); |
| 2264 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2264 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2265 | p.depths[def_index] += 1; | 2265 | p.depths[def_index] += 1; |
| 2266 | defer p.depths[def_index] -= 1; | 2266 | defer p.depths[def_index] -= 1; |
| ... | @@ -2298,7 +2298,7 @@ const Parser = struct { | ... | @@ -2298,7 +2298,7 @@ const Parser = struct { |
| 2298 | }; | 2298 | }; |
| 2299 | } | 2299 | } |
| 2300 | pub fn parseBitwiseOpTok(p: *Parser) Error!bool { | 2300 | pub fn parseBitwiseOpTok(p: *Parser) Error!bool { |
| 2301 | const def_index = @intFromEnum(Def.defBitwiseOpTok); | 2301 | const def_index = @backingInt(Def.defBitwiseOpTok); |
| 2302 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2302 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2303 | p.depths[def_index] += 1; | 2303 | p.depths[def_index] += 1; |
| 2304 | defer p.depths[def_index] -= 1; | 2304 | defer p.depths[def_index] -= 1; |
| ... | @@ -2328,7 +2328,7 @@ const Parser = struct { | ... | @@ -2328,7 +2328,7 @@ const Parser = struct { |
| 2328 | }; | 2328 | }; |
| 2329 | } | 2329 | } |
| 2330 | pub fn parseBitShiftOp(p: *Parser) Error!bool { | 2330 | pub fn parseBitShiftOp(p: *Parser) Error!bool { |
| 2331 | const def_index = @intFromEnum(Def.defBitShiftOp); | 2331 | const def_index = @backingInt(Def.defBitShiftOp); |
| 2332 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2332 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2333 | p.depths[def_index] += 1; | 2333 | p.depths[def_index] += 1; |
| 2334 | defer p.depths[def_index] -= 1; | 2334 | defer p.depths[def_index] -= 1; |
| ... | @@ -2352,7 +2352,7 @@ const Parser = struct { | ... | @@ -2352,7 +2352,7 @@ const Parser = struct { |
| 2352 | }; | 2352 | }; |
| 2353 | } | 2353 | } |
| 2354 | pub fn parseBitShiftOpTok(p: *Parser) Error!bool { | 2354 | pub fn parseBitShiftOpTok(p: *Parser) Error!bool { |
| 2355 | const def_index = @intFromEnum(Def.defBitShiftOpTok); | 2355 | const def_index = @backingInt(Def.defBitShiftOpTok); |
| 2356 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2356 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2357 | p.depths[def_index] += 1; | 2357 | p.depths[def_index] += 1; |
| 2358 | defer p.depths[def_index] -= 1; | 2358 | defer p.depths[def_index] -= 1; |
| ... | @@ -2368,7 +2368,7 @@ const Parser = struct { | ... | @@ -2368,7 +2368,7 @@ const Parser = struct { |
| 2368 | }; | 2368 | }; |
| 2369 | } | 2369 | } |
| 2370 | pub fn parseAdditionOp(p: *Parser) Error!bool { | 2370 | pub fn parseAdditionOp(p: *Parser) Error!bool { |
| 2371 | const def_index = @intFromEnum(Def.defAdditionOp); | 2371 | const def_index = @backingInt(Def.defAdditionOp); |
| 2372 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2372 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2373 | p.depths[def_index] += 1; | 2373 | p.depths[def_index] += 1; |
| 2374 | defer p.depths[def_index] -= 1; | 2374 | defer p.depths[def_index] -= 1; |
| ... | @@ -2392,7 +2392,7 @@ const Parser = struct { | ... | @@ -2392,7 +2392,7 @@ const Parser = struct { |
| 2392 | }; | 2392 | }; |
| 2393 | } | 2393 | } |
| 2394 | pub fn parseAdditionOpTok(p: *Parser) Error!bool { | 2394 | pub fn parseAdditionOpTok(p: *Parser) Error!bool { |
| 2395 | const def_index = @intFromEnum(Def.defAdditionOpTok); | 2395 | const def_index = @backingInt(Def.defAdditionOpTok); |
| 2396 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2396 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2397 | p.depths[def_index] += 1; | 2397 | p.depths[def_index] += 1; |
| 2398 | defer p.depths[def_index] -= 1; | 2398 | defer p.depths[def_index] -= 1; |
| ... | @@ -2416,7 +2416,7 @@ const Parser = struct { | ... | @@ -2416,7 +2416,7 @@ const Parser = struct { |
| 2416 | }; | 2416 | }; |
| 2417 | } | 2417 | } |
| 2418 | pub fn parseMultiplyOp(p: *Parser) Error!bool { | 2418 | pub fn parseMultiplyOp(p: *Parser) Error!bool { |
| 2419 | const def_index = @intFromEnum(Def.defMultiplyOp); | 2419 | const def_index = @backingInt(Def.defMultiplyOp); |
| 2420 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2420 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2421 | p.depths[def_index] += 1; | 2421 | p.depths[def_index] += 1; |
| 2422 | defer p.depths[def_index] -= 1; | 2422 | defer p.depths[def_index] -= 1; |
| ... | @@ -2440,7 +2440,7 @@ const Parser = struct { | ... | @@ -2440,7 +2440,7 @@ const Parser = struct { |
| 2440 | }; | 2440 | }; |
| 2441 | } | 2441 | } |
| 2442 | pub fn parseMultiplyOpTok(p: *Parser) Error!bool { | 2442 | pub fn parseMultiplyOpTok(p: *Parser) Error!bool { |
| 2443 | const def_index = @intFromEnum(Def.defMultiplyOpTok); | 2443 | const def_index = @backingInt(Def.defMultiplyOpTok); |
| 2444 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2444 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2445 | p.depths[def_index] += 1; | 2445 | p.depths[def_index] += 1; |
| 2446 | defer p.depths[def_index] -= 1; | 2446 | defer p.depths[def_index] -= 1; |
| ... | @@ -2462,7 +2462,7 @@ const Parser = struct { | ... | @@ -2462,7 +2462,7 @@ const Parser = struct { |
| 2462 | }; | 2462 | }; |
| 2463 | } | 2463 | } |
| 2464 | pub fn parsePrefixOp(p: *Parser) Error!bool { | 2464 | pub fn parsePrefixOp(p: *Parser) Error!bool { |
| 2465 | const def_index = @intFromEnum(Def.defPrefixOp); | 2465 | const def_index = @backingInt(Def.defPrefixOp); |
| 2466 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2466 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2467 | p.depths[def_index] += 1; | 2467 | p.depths[def_index] += 1; |
| 2468 | defer p.depths[def_index] -= 1; | 2468 | defer p.depths[def_index] -= 1; |
| ... | @@ -2484,7 +2484,7 @@ const Parser = struct { | ... | @@ -2484,7 +2484,7 @@ const Parser = struct { |
| 2484 | }; | 2484 | }; |
| 2485 | } | 2485 | } |
| 2486 | pub fn parsePrefixTypeOp(p: *Parser) Error!bool { | 2486 | pub fn parsePrefixTypeOp(p: *Parser) Error!bool { |
| 2487 | const def_index = @intFromEnum(Def.defPrefixTypeOp); | 2487 | const def_index = @backingInt(Def.defPrefixTypeOp); |
| 2488 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2488 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2489 | p.depths[def_index] += 1; | 2489 | p.depths[def_index] += 1; |
| 2490 | defer p.depths[def_index] -= 1; | 2490 | defer p.depths[def_index] -= 1; |
| ... | @@ -2511,7 +2511,7 @@ const Parser = struct { | ... | @@ -2511,7 +2511,7 @@ const Parser = struct { |
| 2511 | }; | 2511 | }; |
| 2512 | } | 2512 | } |
| 2513 | pub fn parsePtrMods(p: *Parser) Error!bool { | 2513 | pub fn parsePtrMods(p: *Parser) Error!bool { |
| 2514 | const def_index = @intFromEnum(Def.defPtrMods); | 2514 | const def_index = @backingInt(Def.defPtrMods); |
| 2515 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2515 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2516 | p.depths[def_index] += 1; | 2516 | p.depths[def_index] += 1; |
| 2517 | defer p.depths[def_index] -= 1; | 2517 | defer p.depths[def_index] -= 1; |
| ... | @@ -2577,7 +2577,7 @@ const Parser = struct { | ... | @@ -2577,7 +2577,7 @@ const Parser = struct { |
| 2577 | }; | 2577 | }; |
| 2578 | } | 2578 | } |
| 2579 | pub fn parseSinglePtrMods(p: *Parser) Error!bool { | 2579 | pub fn parseSinglePtrMods(p: *Parser) Error!bool { |
| 2580 | const def_index = @intFromEnum(Def.defSinglePtrMods); | 2580 | const def_index = @backingInt(Def.defSinglePtrMods); |
| 2581 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2581 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2582 | p.depths[def_index] += 1; | 2582 | p.depths[def_index] += 1; |
| 2583 | defer p.depths[def_index] -= 1; | 2583 | defer p.depths[def_index] -= 1; |
| ... | @@ -2643,7 +2643,7 @@ const Parser = struct { | ... | @@ -2643,7 +2643,7 @@ const Parser = struct { |
| 2643 | }; | 2643 | }; |
| 2644 | } | 2644 | } |
| 2645 | pub fn parsePtrMod(p: *Parser) Error!bool { | 2645 | pub fn parsePtrMod(p: *Parser) Error!bool { |
| 2646 | const def_index = @intFromEnum(Def.defPtrMod); | 2646 | const def_index = @backingInt(Def.defPtrMod); |
| 2647 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2647 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2648 | p.depths[def_index] += 1; | 2648 | p.depths[def_index] += 1; |
| 2649 | defer p.depths[def_index] -= 1; | 2649 | defer p.depths[def_index] -= 1; |
| ... | @@ -2659,7 +2659,7 @@ const Parser = struct { | ... | @@ -2659,7 +2659,7 @@ const Parser = struct { |
| 2659 | }; | 2659 | }; |
| 2660 | } | 2660 | } |
| 2661 | pub fn parsePrefixTypeOpPrefix(p: *Parser) Error!bool { | 2661 | pub fn parsePrefixTypeOpPrefix(p: *Parser) Error!bool { |
| 2662 | const def_index = @intFromEnum(Def.defPrefixTypeOpPrefix); | 2662 | const def_index = @backingInt(Def.defPrefixTypeOpPrefix); |
| 2663 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2663 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2664 | p.depths[def_index] += 1; | 2664 | p.depths[def_index] += 1; |
| 2665 | defer p.depths[def_index] -= 1; | 2665 | defer p.depths[def_index] -= 1; |
| ... | @@ -2677,7 +2677,7 @@ const Parser = struct { | ... | @@ -2677,7 +2677,7 @@ const Parser = struct { |
| 2677 | }; | 2677 | }; |
| 2678 | } | 2678 | } |
| 2679 | pub fn parseSuffixOp(p: *Parser) Error!bool { | 2679 | pub fn parseSuffixOp(p: *Parser) Error!bool { |
| 2680 | const def_index = @intFromEnum(Def.defSuffixOp); | 2680 | const def_index = @backingInt(Def.defSuffixOp); |
| 2681 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2681 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2682 | p.depths[def_index] += 1; | 2682 | p.depths[def_index] += 1; |
| 2683 | defer p.depths[def_index] -= 1; | 2683 | defer p.depths[def_index] -= 1; |
| ... | @@ -2719,7 +2719,7 @@ const Parser = struct { | ... | @@ -2719,7 +2719,7 @@ const Parser = struct { |
| 2719 | }; | 2719 | }; |
| 2720 | } | 2720 | } |
| 2721 | pub fn parseSuffixOpPrefix(p: *Parser) Error!bool { | 2721 | pub fn parseSuffixOpPrefix(p: *Parser) Error!bool { |
| 2722 | const def_index = @intFromEnum(Def.defSuffixOpPrefix); | 2722 | const def_index = @backingInt(Def.defSuffixOpPrefix); |
| 2723 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2723 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2724 | p.depths[def_index] += 1; | 2724 | p.depths[def_index] += 1; |
| 2725 | defer p.depths[def_index] -= 1; | 2725 | defer p.depths[def_index] -= 1; |
| ... | @@ -2739,7 +2739,7 @@ const Parser = struct { | ... | @@ -2739,7 +2739,7 @@ const Parser = struct { |
| 2739 | }; | 2739 | }; |
| 2740 | } | 2740 | } |
| 2741 | pub fn parseFnCallArguments(p: *Parser) Error!bool { | 2741 | pub fn parseFnCallArguments(p: *Parser) Error!bool { |
| 2742 | const def_index = @intFromEnum(Def.defFnCallArguments); | 2742 | const def_index = @backingInt(Def.defFnCallArguments); |
| 2743 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2743 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2744 | p.depths[def_index] += 1; | 2744 | p.depths[def_index] += 1; |
| 2745 | defer p.depths[def_index] -= 1; | 2745 | defer p.depths[def_index] -= 1; |
| ... | @@ -2751,7 +2751,7 @@ const Parser = struct { | ... | @@ -2751,7 +2751,7 @@ const Parser = struct { |
| 2751 | }; | 2751 | }; |
| 2752 | } | 2752 | } |
| 2753 | pub fn parseSliceTypeStart(p: *Parser) Error!bool { | 2753 | pub fn parseSliceTypeStart(p: *Parser) Error!bool { |
| 2754 | const def_index = @intFromEnum(Def.defSliceTypeStart); | 2754 | const def_index = @backingInt(Def.defSliceTypeStart); |
| 2755 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2755 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2756 | p.depths[def_index] += 1; | 2756 | p.depths[def_index] += 1; |
| 2757 | defer p.depths[def_index] -= 1; | 2757 | defer p.depths[def_index] -= 1; |
| ... | @@ -2768,7 +2768,7 @@ const Parser = struct { | ... | @@ -2768,7 +2768,7 @@ const Parser = struct { |
| 2768 | }; | 2768 | }; |
| 2769 | } | 2769 | } |
| 2770 | pub fn parseSinglePtrTypeStart(p: *Parser) Error!bool { | 2770 | pub fn parseSinglePtrTypeStart(p: *Parser) Error!bool { |
| 2771 | const def_index = @intFromEnum(Def.defSinglePtrTypeStart); | 2771 | const def_index = @backingInt(Def.defSinglePtrTypeStart); |
| 2772 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2772 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2773 | p.depths[def_index] += 1; | 2773 | p.depths[def_index] += 1; |
| 2774 | defer p.depths[def_index] -= 1; | 2774 | defer p.depths[def_index] -= 1; |
| ... | @@ -2780,7 +2780,7 @@ const Parser = struct { | ... | @@ -2780,7 +2780,7 @@ const Parser = struct { |
| 2780 | }; | 2780 | }; |
| 2781 | } | 2781 | } |
| 2782 | pub fn parseManyPtrTypeStart(p: *Parser) Error!bool { | 2782 | pub fn parseManyPtrTypeStart(p: *Parser) Error!bool { |
| 2783 | const def_index = @intFromEnum(Def.defManyPtrTypeStart); | 2783 | const def_index = @backingInt(Def.defManyPtrTypeStart); |
| 2784 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2784 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2785 | p.depths[def_index] += 1; | 2785 | p.depths[def_index] += 1; |
| 2786 | defer p.depths[def_index] -= 1; | 2786 | defer p.depths[def_index] -= 1; |
| ... | @@ -2799,7 +2799,7 @@ const Parser = struct { | ... | @@ -2799,7 +2799,7 @@ const Parser = struct { |
| 2799 | }; | 2799 | }; |
| 2800 | } | 2800 | } |
| 2801 | pub fn parseArrayTypeStart(p: *Parser) Error!bool { | 2801 | pub fn parseArrayTypeStart(p: *Parser) Error!bool { |
| 2802 | const def_index = @intFromEnum(Def.defArrayTypeStart); | 2802 | const def_index = @backingInt(Def.defArrayTypeStart); |
| 2803 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2803 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2804 | p.depths[def_index] += 1; | 2804 | p.depths[def_index] += 1; |
| 2805 | defer p.depths[def_index] -= 1; | 2805 | defer p.depths[def_index] -= 1; |
| ... | @@ -2821,7 +2821,7 @@ const Parser = struct { | ... | @@ -2821,7 +2821,7 @@ const Parser = struct { |
| 2821 | }; | 2821 | }; |
| 2822 | } | 2822 | } |
| 2823 | pub fn parseContainerTypeAuto(p: *Parser) Error!bool { | 2823 | pub fn parseContainerTypeAuto(p: *Parser) Error!bool { |
| 2824 | const def_index = @intFromEnum(Def.defContainerTypeAuto); | 2824 | const def_index = @backingInt(Def.defContainerTypeAuto); |
| 2825 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2825 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2826 | p.depths[def_index] += 1; | 2826 | p.depths[def_index] += 1; |
| 2827 | defer p.depths[def_index] -= 1; | 2827 | defer p.depths[def_index] -= 1; |
| ... | @@ -2833,7 +2833,7 @@ const Parser = struct { | ... | @@ -2833,7 +2833,7 @@ const Parser = struct { |
| 2833 | }; | 2833 | }; |
| 2834 | } | 2834 | } |
| 2835 | pub fn parseContainerTypeKind(p: *Parser) Error!bool { | 2835 | pub fn parseContainerTypeKind(p: *Parser) Error!bool { |
| 2836 | const def_index = @intFromEnum(Def.defContainerTypeKind); | 2836 | const def_index = @backingInt(Def.defContainerTypeKind); |
| 2837 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2837 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2838 | p.depths[def_index] += 1; | 2838 | p.depths[def_index] += 1; |
| 2839 | defer p.depths[def_index] -= 1; | 2839 | defer p.depths[def_index] -= 1; |
| ... | @@ -2878,7 +2878,7 @@ const Parser = struct { | ... | @@ -2878,7 +2878,7 @@ const Parser = struct { |
| 2878 | }; | 2878 | }; |
| 2879 | } | 2879 | } |
| 2880 | pub fn parseByteAlign(p: *Parser) Error!bool { | 2880 | pub fn parseByteAlign(p: *Parser) Error!bool { |
| 2881 | const def_index = @intFromEnum(Def.defByteAlign); | 2881 | const def_index = @backingInt(Def.defByteAlign); |
| 2882 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2882 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2883 | p.depths[def_index] += 1; | 2883 | p.depths[def_index] += 1; |
| 2884 | defer p.depths[def_index] -= 1; | 2884 | defer p.depths[def_index] -= 1; |
| ... | @@ -2890,7 +2890,7 @@ const Parser = struct { | ... | @@ -2890,7 +2890,7 @@ const Parser = struct { |
| 2890 | }; | 2890 | }; |
| 2891 | } | 2891 | } |
| 2892 | pub fn parseBitAlign(p: *Parser) Error!bool { | 2892 | pub fn parseBitAlign(p: *Parser) Error!bool { |
| 2893 | const def_index = @intFromEnum(Def.defBitAlign); | 2893 | const def_index = @backingInt(Def.defBitAlign); |
| 2894 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2894 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2895 | p.depths[def_index] += 1; | 2895 | p.depths[def_index] += 1; |
| 2896 | defer p.depths[def_index] -= 1; | 2896 | defer p.depths[def_index] -= 1; |
| ... | @@ -2907,7 +2907,7 @@ const Parser = struct { | ... | @@ -2907,7 +2907,7 @@ const Parser = struct { |
| 2907 | }; | 2907 | }; |
| 2908 | } | 2908 | } |
| 2909 | pub fn parseIdentifierList(p: *Parser) Error!bool { | 2909 | pub fn parseIdentifierList(p: *Parser) Error!bool { |
| 2910 | const def_index = @intFromEnum(Def.defIdentifierList); | 2910 | const def_index = @backingInt(Def.defIdentifierList); |
| 2911 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2911 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2912 | p.depths[def_index] += 1; | 2912 | p.depths[def_index] += 1; |
| 2913 | defer p.depths[def_index] -= 1; | 2913 | defer p.depths[def_index] -= 1; |
| ... | @@ -2929,7 +2929,7 @@ const Parser = struct { | ... | @@ -2929,7 +2929,7 @@ const Parser = struct { |
| 2929 | }; | 2929 | }; |
| 2930 | } | 2930 | } |
| 2931 | pub fn parseSwitchProngList(p: *Parser) Error!bool { | 2931 | pub fn parseSwitchProngList(p: *Parser) Error!bool { |
| 2932 | const def_index = @intFromEnum(Def.defSwitchProngList); | 2932 | const def_index = @backingInt(Def.defSwitchProngList); |
| 2933 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2933 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2934 | p.depths[def_index] += 1; | 2934 | p.depths[def_index] += 1; |
| 2935 | defer p.depths[def_index] -= 1; | 2935 | defer p.depths[def_index] -= 1; |
| ... | @@ -2951,7 +2951,7 @@ const Parser = struct { | ... | @@ -2951,7 +2951,7 @@ const Parser = struct { |
| 2951 | }; | 2951 | }; |
| 2952 | } | 2952 | } |
| 2953 | pub fn parseAsmOutputList(p: *Parser) Error!bool { | 2953 | pub fn parseAsmOutputList(p: *Parser) Error!bool { |
| 2954 | const def_index = @intFromEnum(Def.defAsmOutputList); | 2954 | const def_index = @backingInt(Def.defAsmOutputList); |
| 2955 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2955 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2956 | p.depths[def_index] += 1; | 2956 | p.depths[def_index] += 1; |
| 2957 | defer p.depths[def_index] -= 1; | 2957 | defer p.depths[def_index] -= 1; |
| ... | @@ -2973,7 +2973,7 @@ const Parser = struct { | ... | @@ -2973,7 +2973,7 @@ const Parser = struct { |
| 2973 | }; | 2973 | }; |
| 2974 | } | 2974 | } |
| 2975 | pub fn parseAsmInputList(p: *Parser) Error!bool { | 2975 | pub fn parseAsmInputList(p: *Parser) Error!bool { |
| 2976 | const def_index = @intFromEnum(Def.defAsmInputList); | 2976 | const def_index = @backingInt(Def.defAsmInputList); |
| 2977 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2977 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 2978 | p.depths[def_index] += 1; | 2978 | p.depths[def_index] += 1; |
| 2979 | defer p.depths[def_index] -= 1; | 2979 | defer p.depths[def_index] -= 1; |
| ... | @@ -2995,7 +2995,7 @@ const Parser = struct { | ... | @@ -2995,7 +2995,7 @@ const Parser = struct { |
| 2995 | }; | 2995 | }; |
| 2996 | } | 2996 | } |
| 2997 | pub fn parseParamDeclList(p: *Parser) Error!bool { | 2997 | pub fn parseParamDeclList(p: *Parser) Error!bool { |
| 2998 | const def_index = @intFromEnum(Def.defParamDeclList); | 2998 | const def_index = @backingInt(Def.defParamDeclList); |
| 2999 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 2999 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3000 | p.depths[def_index] += 1; | 3000 | p.depths[def_index] += 1; |
| 3001 | defer p.depths[def_index] -= 1; | 3001 | defer p.depths[def_index] -= 1; |
| ... | @@ -3007,7 +3007,7 @@ const Parser = struct { | ... | @@ -3007,7 +3007,7 @@ const Parser = struct { |
| 3007 | }; | 3007 | }; |
| 3008 | } | 3008 | } |
| 3009 | pub fn parseParamDeclListRest(p: *Parser) Error!bool { | 3009 | pub fn parseParamDeclListRest(p: *Parser) Error!bool { |
| 3010 | const def_index = @intFromEnum(Def.defParamDeclListRest); | 3010 | const def_index = @backingInt(Def.defParamDeclListRest); |
| 3011 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3011 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3012 | p.depths[def_index] += 1; | 3012 | p.depths[def_index] += 1; |
| 3013 | defer p.depths[def_index] -= 1; | 3013 | defer p.depths[def_index] -= 1; |
| ... | @@ -3030,7 +3030,7 @@ const Parser = struct { | ... | @@ -3030,7 +3030,7 @@ const Parser = struct { |
| 3030 | }; | 3030 | }; |
| 3031 | } | 3031 | } |
| 3032 | pub fn parseExprList(p: *Parser) Error!bool { | 3032 | pub fn parseExprList(p: *Parser) Error!bool { |
| 3033 | const def_index = @intFromEnum(Def.defExprList); | 3033 | const def_index = @backingInt(Def.defExprList); |
| 3034 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3034 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3035 | p.depths[def_index] += 1; | 3035 | p.depths[def_index] += 1; |
| 3036 | defer p.depths[def_index] -= 1; | 3036 | defer p.depths[def_index] -= 1; |
| ... | @@ -3054,7 +3054,7 @@ const Parser = struct { | ... | @@ -3054,7 +3054,7 @@ const Parser = struct { |
| 3054 | }; | 3054 | }; |
| 3055 | } | 3055 | } |
| 3056 | pub fn parseExprPrefix(p: *Parser) Error!bool { | 3056 | pub fn parseExprPrefix(p: *Parser) Error!bool { |
| 3057 | const def_index = @intFromEnum(Def.defExprPrefix); | 3057 | const def_index = @backingInt(Def.defExprPrefix); |
| 3058 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3058 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3059 | p.depths[def_index] += 1; | 3059 | p.depths[def_index] += 1; |
| 3060 | defer p.depths[def_index] -= 1; | 3060 | defer p.depths[def_index] -= 1; |
| ... | @@ -3066,7 +3066,7 @@ const Parser = struct { | ... | @@ -3066,7 +3066,7 @@ const Parser = struct { |
| 3066 | }; | 3066 | }; |
| 3067 | } | 3067 | } |
| 3068 | pub fn parsebyte_order_mark(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3070 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3071 | p.depths[def_index] += 1; | 3071 | p.depths[def_index] += 1; |
| 3072 | defer p.depths[def_index] -= 1; | 3072 | defer p.depths[def_index] -= 1; |
| ... | @@ -3084,7 +3084,7 @@ const Parser = struct { | ... | @@ -3084,7 +3084,7 @@ const Parser = struct { |
| 3084 | }; | 3084 | }; |
| 3085 | } | 3085 | } |
| 3086 | pub fn parsesof(p: *Parser) Error!bool { | 3086 | pub fn parsesof(p: *Parser) Error!bool { |
| 3087 | const def_index = @intFromEnum(Def.defsof); | 3087 | const def_index = @backingInt(Def.defsof); |
| 3088 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3088 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3089 | p.depths[def_index] += 1; | 3089 | p.depths[def_index] += 1; |
| 3090 | defer p.depths[def_index] -= 1; | 3090 | defer p.depths[def_index] -= 1; |
| ... | @@ -3096,7 +3096,7 @@ const Parser = struct { | ... | @@ -3096,7 +3096,7 @@ const Parser = struct { |
| 3096 | }; | 3096 | }; |
| 3097 | } | 3097 | } |
| 3098 | pub fn parseeof(p: *Parser) Error!bool { | 3098 | pub fn parseeof(p: *Parser) Error!bool { |
| 3099 | const def_index = @intFromEnum(Def.defeof); | 3099 | const def_index = @backingInt(Def.defeof); |
| 3100 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3100 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3101 | p.depths[def_index] += 1; | 3101 | p.depths[def_index] += 1; |
| 3102 | defer p.depths[def_index] -= 1; | 3102 | defer p.depths[def_index] -= 1; |
| ... | @@ -3119,7 +3119,7 @@ const Parser = struct { | ... | @@ -3119,7 +3119,7 @@ const Parser = struct { |
| 3119 | }; | 3119 | }; |
| 3120 | } | 3120 | } |
| 3121 | pub fn parseox80_oxBF(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3123 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3124 | p.depths[def_index] += 1; | 3124 | p.depths[def_index] += 1; |
| 3125 | defer p.depths[def_index] -= 1; | 3125 | defer p.depths[def_index] -= 1; |
| ... | @@ -3138,7 +3138,7 @@ const Parser = struct { | ... | @@ -3138,7 +3138,7 @@ const Parser = struct { |
| 3138 | }; | 3138 | }; |
| 3139 | } | 3139 | } |
| 3140 | pub fn parseoxF4(p: *Parser) Error!bool { | 3140 | pub fn parseoxF4(p: *Parser) Error!bool { |
| 3141 | const def_index = @intFromEnum(Def.defoxF4); | 3141 | const def_index = @backingInt(Def.defoxF4); |
| 3142 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3142 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3143 | p.depths[def_index] += 1; | 3143 | p.depths[def_index] += 1; |
| 3144 | defer p.depths[def_index] -= 1; | 3144 | defer p.depths[def_index] -= 1; |
| ... | @@ -3156,7 +3156,7 @@ const Parser = struct { | ... | @@ -3156,7 +3156,7 @@ const Parser = struct { |
| 3156 | }; | 3156 | }; |
| 3157 | } | 3157 | } |
| 3158 | pub fn parseox80_ox8F(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3160 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3161 | p.depths[def_index] += 1; | 3161 | p.depths[def_index] += 1; |
| 3162 | defer p.depths[def_index] -= 1; | 3162 | defer p.depths[def_index] -= 1; |
| ... | @@ -3175,7 +3175,7 @@ const Parser = struct { | ... | @@ -3175,7 +3175,7 @@ const Parser = struct { |
| 3175 | }; | 3175 | }; |
| 3176 | } | 3176 | } |
| 3177 | pub fn parseoxF1_oxF3(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3179 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3180 | p.depths[def_index] += 1; | 3180 | p.depths[def_index] += 1; |
| 3181 | defer p.depths[def_index] -= 1; | 3181 | defer p.depths[def_index] -= 1; |
| ... | @@ -3194,7 +3194,7 @@ const Parser = struct { | ... | @@ -3194,7 +3194,7 @@ const Parser = struct { |
| 3194 | }; | 3194 | }; |
| 3195 | } | 3195 | } |
| 3196 | pub fn parseoxF0(p: *Parser) Error!bool { | 3196 | pub fn parseoxF0(p: *Parser) Error!bool { |
| 3197 | const def_index = @intFromEnum(Def.defoxF0); | 3197 | const def_index = @backingInt(Def.defoxF0); |
| 3198 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3198 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3199 | p.depths[def_index] += 1; | 3199 | p.depths[def_index] += 1; |
| 3200 | defer p.depths[def_index] -= 1; | 3200 | defer p.depths[def_index] -= 1; |
| ... | @@ -3212,7 +3212,7 @@ const Parser = struct { | ... | @@ -3212,7 +3212,7 @@ const Parser = struct { |
| 3212 | }; | 3212 | }; |
| 3213 | } | 3213 | } |
| 3214 | pub fn parseox90_0xBF(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3216 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3217 | p.depths[def_index] += 1; | 3217 | p.depths[def_index] += 1; |
| 3218 | defer p.depths[def_index] -= 1; | 3218 | defer p.depths[def_index] -= 1; |
| ... | @@ -3231,7 +3231,7 @@ const Parser = struct { | ... | @@ -3231,7 +3231,7 @@ const Parser = struct { |
| 3231 | }; | 3231 | }; |
| 3232 | } | 3232 | } |
| 3233 | pub fn parseoxEE_oxEF(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3235 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3236 | p.depths[def_index] += 1; | 3236 | p.depths[def_index] += 1; |
| 3237 | defer p.depths[def_index] -= 1; | 3237 | defer p.depths[def_index] -= 1; |
| ... | @@ -3250,7 +3250,7 @@ const Parser = struct { | ... | @@ -3250,7 +3250,7 @@ const Parser = struct { |
| 3250 | }; | 3250 | }; |
| 3251 | } | 3251 | } |
| 3252 | pub fn parseoxED(p: *Parser) Error!bool { | 3252 | pub fn parseoxED(p: *Parser) Error!bool { |
| 3253 | const def_index = @intFromEnum(Def.defoxED); | 3253 | const def_index = @backingInt(Def.defoxED); |
| 3254 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3254 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3255 | p.depths[def_index] += 1; | 3255 | p.depths[def_index] += 1; |
| 3256 | defer p.depths[def_index] -= 1; | 3256 | defer p.depths[def_index] -= 1; |
| ... | @@ -3268,7 +3268,7 @@ const Parser = struct { | ... | @@ -3268,7 +3268,7 @@ const Parser = struct { |
| 3268 | }; | 3268 | }; |
| 3269 | } | 3269 | } |
| 3270 | pub fn parseox80_ox9F(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3272 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3273 | p.depths[def_index] += 1; | 3273 | p.depths[def_index] += 1; |
| 3274 | defer p.depths[def_index] -= 1; | 3274 | defer p.depths[def_index] -= 1; |
| ... | @@ -3287,7 +3287,7 @@ const Parser = struct { | ... | @@ -3287,7 +3287,7 @@ const Parser = struct { |
| 3287 | }; | 3287 | }; |
| 3288 | } | 3288 | } |
| 3289 | pub fn parseoxE1_oxEC(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3291 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3292 | p.depths[def_index] += 1; | 3292 | p.depths[def_index] += 1; |
| 3293 | defer p.depths[def_index] -= 1; | 3293 | defer p.depths[def_index] -= 1; |
| ... | @@ -3306,7 +3306,7 @@ const Parser = struct { | ... | @@ -3306,7 +3306,7 @@ const Parser = struct { |
| 3306 | }; | 3306 | }; |
| 3307 | } | 3307 | } |
| 3308 | pub fn parseoxE0(p: *Parser) Error!bool { | 3308 | pub fn parseoxE0(p: *Parser) Error!bool { |
| 3309 | const def_index = @intFromEnum(Def.defoxE0); | 3309 | const def_index = @backingInt(Def.defoxE0); |
| 3310 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3310 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3311 | p.depths[def_index] += 1; | 3311 | p.depths[def_index] += 1; |
| 3312 | defer p.depths[def_index] -= 1; | 3312 | defer p.depths[def_index] -= 1; |
| ... | @@ -3324,7 +3324,7 @@ const Parser = struct { | ... | @@ -3324,7 +3324,7 @@ const Parser = struct { |
| 3324 | }; | 3324 | }; |
| 3325 | } | 3325 | } |
| 3326 | pub fn parseoxA0_oxBF(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3328 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3329 | p.depths[def_index] += 1; | 3329 | p.depths[def_index] += 1; |
| 3330 | defer p.depths[def_index] -= 1; | 3330 | defer p.depths[def_index] -= 1; |
| ... | @@ -3343,7 +3343,7 @@ const Parser = struct { | ... | @@ -3343,7 +3343,7 @@ const Parser = struct { |
| 3343 | }; | 3343 | }; |
| 3344 | } | 3344 | } |
| 3345 | pub fn parseoxC2_oxDF(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3347 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3348 | p.depths[def_index] += 1; | 3348 | p.depths[def_index] += 1; |
| 3349 | defer p.depths[def_index] -= 1; | 3349 | defer p.depths[def_index] -= 1; |
| ... | @@ -3362,7 +3362,7 @@ const Parser = struct { | ... | @@ -3362,7 +3362,7 @@ const Parser = struct { |
| 3362 | }; | 3362 | }; |
| 3363 | } | 3363 | } |
| 3364 | pub fn parsemultibyte_utf8(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3366 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3367 | p.depths[def_index] += 1; | 3367 | p.depths[def_index] += 1; |
| 3368 | defer p.depths[def_index] -= 1; | 3368 | defer p.depths[def_index] -= 1; |
| ... | @@ -3388,7 +3388,7 @@ const Parser = struct { | ... | @@ -3388,7 +3388,7 @@ const Parser = struct { |
| 3388 | }; | 3388 | }; |
| 3389 | } | 3389 | } |
| 3390 | pub fn parsenon_control_ascii(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3392 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3393 | p.depths[def_index] += 1; | 3393 | p.depths[def_index] += 1; |
| 3394 | defer p.depths[def_index] -= 1; | 3394 | defer p.depths[def_index] -= 1; |
| ... | @@ -3407,7 +3407,7 @@ const Parser = struct { | ... | @@ -3407,7 +3407,7 @@ const Parser = struct { |
| 3407 | }; | 3407 | }; |
| 3408 | } | 3408 | } |
| 3409 | pub fn parsenon_control_utf8(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3411 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3412 | p.depths[def_index] += 1; | 3412 | p.depths[def_index] += 1; |
| 3413 | defer p.depths[def_index] -= 1; | 3413 | defer p.depths[def_index] -= 1; |
| ... | @@ -3427,7 +3427,7 @@ const Parser = struct { | ... | @@ -3427,7 +3427,7 @@ const Parser = struct { |
| 3427 | }; | 3427 | }; |
| 3428 | } | 3428 | } |
| 3429 | pub fn parsechar_char(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3431 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3432 | p.depths[def_index] += 1; | 3432 | p.depths[def_index] += 1; |
| 3433 | defer p.depths[def_index] -= 1; | 3433 | defer p.depths[def_index] -= 1; |
| ... | @@ -3467,7 +3467,7 @@ const Parser = struct { | ... | @@ -3467,7 +3467,7 @@ const Parser = struct { |
| 3467 | }; | 3467 | }; |
| 3468 | } | 3468 | } |
| 3469 | pub fn parsestring_char(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3471 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3472 | p.depths[def_index] += 1; | 3472 | p.depths[def_index] += 1; |
| 3473 | defer p.depths[def_index] -= 1; | 3473 | defer p.depths[def_index] -= 1; |
| ... | @@ -3507,7 +3507,7 @@ const Parser = struct { | ... | @@ -3507,7 +3507,7 @@ const Parser = struct { |
| 3507 | }; | 3507 | }; |
| 3508 | } | 3508 | } |
| 3509 | pub fn parsecontainer_doc_comment(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3511 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3512 | p.depths[def_index] += 1; | 3512 | p.depths[def_index] += 1; |
| 3513 | defer p.depths[def_index] -= 1; | 3513 | defer p.depths[def_index] -= 1; |
| ... | @@ -3546,7 +3546,7 @@ const Parser = struct { | ... | @@ -3546,7 +3546,7 @@ const Parser = struct { |
| 3546 | }; | 3546 | }; |
| 3547 | } | 3547 | } |
| 3548 | pub fn parsedoc_comment(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3550 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3551 | p.depths[def_index] += 1; | 3551 | p.depths[def_index] += 1; |
| 3552 | defer p.depths[def_index] -= 1; | 3552 | defer p.depths[def_index] -= 1; |
| ... | @@ -3592,7 +3592,7 @@ const Parser = struct { | ... | @@ -3592,7 +3592,7 @@ const Parser = struct { |
| 3592 | }; | 3592 | }; |
| 3593 | } | 3593 | } |
| 3594 | pub fn parseline_comment(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3596 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3597 | p.depths[def_index] += 1; | 3597 | p.depths[def_index] += 1; |
| 3598 | defer p.depths[def_index] -= 1; | 3598 | defer p.depths[def_index] -= 1; |
| ... | @@ -3645,7 +3645,7 @@ const Parser = struct { | ... | @@ -3645,7 +3645,7 @@ const Parser = struct { |
| 3645 | }; | 3645 | }; |
| 3646 | } | 3646 | } |
| 3647 | pub fn parseline_string(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3649 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3650 | p.depths[def_index] += 1; | 3650 | p.depths[def_index] += 1; |
| 3651 | defer p.depths[def_index] -= 1; | 3651 | defer p.depths[def_index] -= 1; |
| ... | @@ -3670,7 +3670,7 @@ const Parser = struct { | ... | @@ -3670,7 +3670,7 @@ const Parser = struct { |
| 3670 | }; | 3670 | }; |
| 3671 | } | 3671 | } |
| 3672 | pub fn parsenewline(p: *Parser) Error!bool { | 3672 | pub fn parsenewline(p: *Parser) Error!bool { |
| 3673 | const def_index = @intFromEnum(Def.defnewline); | 3673 | const def_index = @backingInt(Def.defnewline); |
| 3674 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3674 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3675 | p.depths[def_index] += 1; | 3675 | p.depths[def_index] += 1; |
| 3676 | defer p.depths[def_index] -= 1; | 3676 | defer p.depths[def_index] -= 1; |
| ... | @@ -3708,7 +3708,7 @@ const Parser = struct { | ... | @@ -3708,7 +3708,7 @@ const Parser = struct { |
| 3708 | }; | 3708 | }; |
| 3709 | } | 3709 | } |
| 3710 | pub fn parseskip(p: *Parser) Error!bool { | 3710 | pub fn parseskip(p: *Parser) Error!bool { |
| 3711 | const def_index = @intFromEnum(Def.defskip); | 3711 | const def_index = @backingInt(Def.defskip); |
| 3712 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3712 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3713 | p.depths[def_index] += 1; | 3713 | p.depths[def_index] += 1; |
| 3714 | defer p.depths[def_index] -= 1; | 3714 | defer p.depths[def_index] -= 1; |
| ... | @@ -3744,7 +3744,7 @@ const Parser = struct { | ... | @@ -3744,7 +3744,7 @@ const Parser = struct { |
| 3744 | }; | 3744 | }; |
| 3745 | } | 3745 | } |
| 3746 | pub fn parseskip_require_newline(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3748 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3749 | p.depths[def_index] += 1; | 3749 | p.depths[def_index] += 1; |
| 3750 | defer p.depths[def_index] -= 1; | 3750 | defer p.depths[def_index] -= 1; |
| ... | @@ -3786,7 +3786,7 @@ const Parser = struct { | ... | @@ -3786,7 +3786,7 @@ const Parser = struct { |
| 3786 | }; | 3786 | }; |
| 3787 | } | 3787 | } |
| 3788 | pub fn parsepre_op_white(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3790 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3791 | p.depths[def_index] += 1; | 3791 | p.depths[def_index] += 1; |
| 3792 | defer p.depths[def_index] -= 1; | 3792 | defer p.depths[def_index] -= 1; |
| ... | @@ -3824,7 +3824,7 @@ const Parser = struct { | ... | @@ -3824,7 +3824,7 @@ const Parser = struct { |
| 3824 | }; | 3824 | }; |
| 3825 | } | 3825 | } |
| 3826 | pub fn parsepost_op_white(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3828 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3829 | p.depths[def_index] += 1; | 3829 | p.depths[def_index] += 1; |
| 3830 | defer p.depths[def_index] -= 1; | 3830 | defer p.depths[def_index] -= 1; |
| ... | @@ -3846,7 +3846,7 @@ const Parser = struct { | ... | @@ -3846,7 +3846,7 @@ const Parser = struct { |
| 3846 | }; | 3846 | }; |
| 3847 | } | 3847 | } |
| 3848 | pub fn parseCHAR_LITERAL(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3850 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3851 | p.depths[def_index] += 1; | 3851 | p.depths[def_index] += 1; |
| 3852 | defer p.depths[def_index] -= 1; | 3852 | defer p.depths[def_index] -= 1; |
| ... | @@ -3879,7 +3879,7 @@ const Parser = struct { | ... | @@ -3879,7 +3879,7 @@ const Parser = struct { |
| 3879 | }; | 3879 | }; |
| 3880 | } | 3880 | } |
| 3881 | pub fn parsedigit(p: *Parser) Error!bool { | 3881 | pub fn parsedigit(p: *Parser) Error!bool { |
| 3882 | const def_index = @intFromEnum(Def.defdigit); | 3882 | const def_index = @backingInt(Def.defdigit); |
| 3883 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3883 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3884 | p.depths[def_index] += 1; | 3884 | p.depths[def_index] += 1; |
| 3885 | defer p.depths[def_index] -= 1; | 3885 | defer p.depths[def_index] -= 1; |
| ... | @@ -3905,7 +3905,7 @@ const Parser = struct { | ... | @@ -3905,7 +3905,7 @@ const Parser = struct { |
| 3905 | }; | 3905 | }; |
| 3906 | } | 3906 | } |
| 3907 | pub fn parsedigit_int(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3909 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3910 | p.depths[def_index] += 1; | 3910 | p.depths[def_index] += 1; |
| 3911 | defer p.depths[def_index] -= 1; | 3911 | defer p.depths[def_index] -= 1; |
| ... | @@ -3929,7 +3929,7 @@ const Parser = struct { | ... | @@ -3929,7 +3929,7 @@ const Parser = struct { |
| 3929 | }; | 3929 | }; |
| 3930 | } | 3930 | } |
| 3931 | pub fn parsedigit_float(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3933 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3934 | p.depths[def_index] += 1; | 3934 | p.depths[def_index] += 1; |
| 3935 | defer p.depths[def_index] -= 1; | 3935 | defer p.depths[def_index] -= 1; |
| ... | @@ -3961,7 +3961,7 @@ const Parser = struct { | ... | @@ -3961,7 +3961,7 @@ const Parser = struct { |
| 3961 | }; | 3961 | }; |
| 3962 | } | 3962 | } |
| 3963 | pub fn parseNUMBERLITERAL(p: *Parser) Error!bool { | 3963 | pub fn parseNUMBERLITERAL(p: *Parser) Error!bool { |
| 3964 | const def_index = @intFromEnum(Def.defNUMBERLITERAL); | 3964 | const def_index = @backingInt(Def.defNUMBERLITERAL); |
| 3965 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 3965 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 3966 | p.depths[def_index] += 1; | 3966 | p.depths[def_index] += 1; |
| 3967 | defer p.depths[def_index] -= 1; | 3967 | defer p.depths[def_index] -= 1; |
| ... | @@ -4018,7 +4018,7 @@ const Parser = struct { | ... | @@ -4018,7 +4018,7 @@ const Parser = struct { |
| 4018 | }; | 4018 | }; |
| 4019 | } | 4019 | } |
| 4020 | pub fn parsestring(p: *Parser) Error!bool { | 4020 | pub fn parsestring(p: *Parser) Error!bool { |
| 4021 | const def_index = @intFromEnum(Def.defstring); | 4021 | const def_index = @backingInt(Def.defstring); |
| 4022 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4022 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4023 | p.depths[def_index] += 1; | 4023 | p.depths[def_index] += 1; |
| 4024 | defer p.depths[def_index] -= 1; | 4024 | defer p.depths[def_index] -= 1; |
| ... | @@ -4051,7 +4051,7 @@ const Parser = struct { | ... | @@ -4051,7 +4051,7 @@ const Parser = struct { |
| 4051 | }; | 4051 | }; |
| 4052 | } | 4052 | } |
| 4053 | pub fn parseSTRINGLITERALSINGLE(p: *Parser) Error!bool { | 4053 | pub fn parseSTRINGLITERALSINGLE(p: *Parser) Error!bool { |
| 4054 | const def_index = @intFromEnum(Def.defSTRINGLITERALSINGLE); | 4054 | const def_index = @backingInt(Def.defSTRINGLITERALSINGLE); |
| 4055 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4055 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4056 | p.depths[def_index] += 1; | 4056 | p.depths[def_index] += 1; |
| 4057 | defer p.depths[def_index] -= 1; | 4057 | defer p.depths[def_index] -= 1; |
| ... | @@ -4063,7 +4063,7 @@ const Parser = struct { | ... | @@ -4063,7 +4063,7 @@ const Parser = struct { |
| 4063 | }; | 4063 | }; |
| 4064 | } | 4064 | } |
| 4065 | pub fn parseSTRINGLITERAL(p: *Parser) Error!bool { | 4065 | pub fn parseSTRINGLITERAL(p: *Parser) Error!bool { |
| 4066 | const def_index = @intFromEnum(Def.defSTRINGLITERAL); | 4066 | const def_index = @backingInt(Def.defSTRINGLITERAL); |
| 4067 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4067 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4068 | p.depths[def_index] += 1; | 4068 | p.depths[def_index] += 1; |
| 4069 | defer p.depths[def_index] -= 1; | 4069 | defer p.depths[def_index] -= 1; |
| ... | @@ -4091,7 +4091,7 @@ const Parser = struct { | ... | @@ -4091,7 +4091,7 @@ const Parser = struct { |
| 4091 | }; | 4091 | }; |
| 4092 | } | 4092 | } |
| 4093 | pub fn parseIDENTIFIER(p: *Parser) Error!bool { | 4093 | pub fn parseIDENTIFIER(p: *Parser) Error!bool { |
| 4094 | const def_index = @intFromEnum(Def.defIDENTIFIER); | 4094 | const def_index = @backingInt(Def.defIDENTIFIER); |
| 4095 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4095 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4096 | p.depths[def_index] += 1; | 4096 | p.depths[def_index] += 1; |
| 4097 | defer p.depths[def_index] -= 1; | 4097 | defer p.depths[def_index] -= 1; |
| ... | @@ -4142,7 +4142,7 @@ const Parser = struct { | ... | @@ -4142,7 +4142,7 @@ const Parser = struct { |
| 4142 | }; | 4142 | }; |
| 4143 | } | 4143 | } |
| 4144 | pub fn parseBUILTINIDENTIFIER(p: *Parser) Error!bool { | 4144 | pub fn parseBUILTINIDENTIFIER(p: *Parser) Error!bool { |
| 4145 | const def_index = @intFromEnum(Def.defBUILTINIDENTIFIER); | 4145 | const def_index = @backingInt(Def.defBUILTINIDENTIFIER); |
| 4146 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4146 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4147 | p.depths[def_index] += 1; | 4147 | p.depths[def_index] += 1; |
| 4148 | defer p.depths[def_index] -= 1; | 4148 | defer p.depths[def_index] -= 1; |
| ... | @@ -4186,7 +4186,7 @@ const Parser = struct { | ... | @@ -4186,7 +4186,7 @@ const Parser = struct { |
| 4186 | }; | 4186 | }; |
| 4187 | } | 4187 | } |
| 4188 | pub fn parseAMPERSAND(p: *Parser) Error!bool { | 4188 | pub fn parseAMPERSAND(p: *Parser) Error!bool { |
| 4189 | const def_index = @intFromEnum(Def.defAMPERSAND); | 4189 | const def_index = @backingInt(Def.defAMPERSAND); |
| 4190 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4190 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4191 | p.depths[def_index] += 1; | 4191 | p.depths[def_index] += 1; |
| 4192 | defer p.depths[def_index] -= 1; | 4192 | defer p.depths[def_index] -= 1; |
| ... | @@ -4216,7 +4216,7 @@ const Parser = struct { | ... | @@ -4216,7 +4216,7 @@ const Parser = struct { |
| 4216 | }; | 4216 | }; |
| 4217 | } | 4217 | } |
| 4218 | pub fn parseAMPERSANDEQUAL(p: *Parser) Error!bool { | 4218 | pub fn parseAMPERSANDEQUAL(p: *Parser) Error!bool { |
| 4219 | const def_index = @intFromEnum(Def.defAMPERSANDEQUAL); | 4219 | const def_index = @backingInt(Def.defAMPERSANDEQUAL); |
| 4220 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4220 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4221 | p.depths[def_index] += 1; | 4221 | p.depths[def_index] += 1; |
| 4222 | defer p.depths[def_index] -= 1; | 4222 | defer p.depths[def_index] -= 1; |
| ... | @@ -4234,7 +4234,7 @@ const Parser = struct { | ... | @@ -4234,7 +4234,7 @@ const Parser = struct { |
| 4234 | }; | 4234 | }; |
| 4235 | } | 4235 | } |
| 4236 | pub fn parseASTERISK(p: *Parser) Error!bool { | 4236 | pub fn parseASTERISK(p: *Parser) Error!bool { |
| 4237 | const def_index = @intFromEnum(Def.defASTERISK); | 4237 | const def_index = @backingInt(Def.defASTERISK); |
| 4238 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4238 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4239 | p.depths[def_index] += 1; | 4239 | p.depths[def_index] += 1; |
| 4240 | defer p.depths[def_index] -= 1; | 4240 | defer p.depths[def_index] -= 1; |
| ... | @@ -4266,7 +4266,7 @@ const Parser = struct { | ... | @@ -4266,7 +4266,7 @@ const Parser = struct { |
| 4266 | }; | 4266 | }; |
| 4267 | } | 4267 | } |
| 4268 | pub fn parseASTERISKEQUAL(p: *Parser) Error!bool { | 4268 | pub fn parseASTERISKEQUAL(p: *Parser) Error!bool { |
| 4269 | const def_index = @intFromEnum(Def.defASTERISKEQUAL); | 4269 | const def_index = @backingInt(Def.defASTERISKEQUAL); |
| 4270 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4270 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4271 | p.depths[def_index] += 1; | 4271 | p.depths[def_index] += 1; |
| 4272 | defer p.depths[def_index] -= 1; | 4272 | defer p.depths[def_index] -= 1; |
| ... | @@ -4284,7 +4284,7 @@ const Parser = struct { | ... | @@ -4284,7 +4284,7 @@ const Parser = struct { |
| 4284 | }; | 4284 | }; |
| 4285 | } | 4285 | } |
| 4286 | pub fn parseASTERISKPERCENT(p: *Parser) Error!bool { | 4286 | pub fn parseASTERISKPERCENT(p: *Parser) Error!bool { |
| 4287 | const def_index = @intFromEnum(Def.defASTERISKPERCENT); | 4287 | const def_index = @backingInt(Def.defASTERISKPERCENT); |
| 4288 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4288 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4289 | p.depths[def_index] += 1; | 4289 | p.depths[def_index] += 1; |
| 4290 | defer p.depths[def_index] -= 1; | 4290 | defer p.depths[def_index] -= 1; |
| ... | @@ -4314,7 +4314,7 @@ const Parser = struct { | ... | @@ -4314,7 +4314,7 @@ const Parser = struct { |
| 4314 | }; | 4314 | }; |
| 4315 | } | 4315 | } |
| 4316 | pub fn parseASTERISKPERCENTEQUAL(p: *Parser) Error!bool { | 4316 | pub fn parseASTERISKPERCENTEQUAL(p: *Parser) Error!bool { |
| 4317 | const def_index = @intFromEnum(Def.defASTERISKPERCENTEQUAL); | 4317 | const def_index = @backingInt(Def.defASTERISKPERCENTEQUAL); |
| 4318 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4318 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4319 | p.depths[def_index] += 1; | 4319 | p.depths[def_index] += 1; |
| 4320 | defer p.depths[def_index] -= 1; | 4320 | defer p.depths[def_index] -= 1; |
| ... | @@ -4332,7 +4332,7 @@ const Parser = struct { | ... | @@ -4332,7 +4332,7 @@ const Parser = struct { |
| 4332 | }; | 4332 | }; |
| 4333 | } | 4333 | } |
| 4334 | pub fn parseASTERISKPIPE(p: *Parser) Error!bool { | 4334 | pub fn parseASTERISKPIPE(p: *Parser) Error!bool { |
| 4335 | const def_index = @intFromEnum(Def.defASTERISKPIPE); | 4335 | const def_index = @backingInt(Def.defASTERISKPIPE); |
| 4336 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4336 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4337 | p.depths[def_index] += 1; | 4337 | p.depths[def_index] += 1; |
| 4338 | defer p.depths[def_index] -= 1; | 4338 | defer p.depths[def_index] -= 1; |
| ... | @@ -4362,7 +4362,7 @@ const Parser = struct { | ... | @@ -4362,7 +4362,7 @@ const Parser = struct { |
| 4362 | }; | 4362 | }; |
| 4363 | } | 4363 | } |
| 4364 | pub fn parseASTERISKPIPEEQUAL(p: *Parser) Error!bool { | 4364 | pub fn parseASTERISKPIPEEQUAL(p: *Parser) Error!bool { |
| 4365 | const def_index = @intFromEnum(Def.defASTERISKPIPEEQUAL); | 4365 | const def_index = @backingInt(Def.defASTERISKPIPEEQUAL); |
| 4366 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4366 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4367 | p.depths[def_index] += 1; | 4367 | p.depths[def_index] += 1; |
| 4368 | defer p.depths[def_index] -= 1; | 4368 | defer p.depths[def_index] -= 1; |
| ... | @@ -4380,7 +4380,7 @@ const Parser = struct { | ... | @@ -4380,7 +4380,7 @@ const Parser = struct { |
| 4380 | }; | 4380 | }; |
| 4381 | } | 4381 | } |
| 4382 | pub fn parseCARET(p: *Parser) Error!bool { | 4382 | pub fn parseCARET(p: *Parser) Error!bool { |
| 4383 | const def_index = @intFromEnum(Def.defCARET); | 4383 | const def_index = @backingInt(Def.defCARET); |
| 4384 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4384 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4385 | p.depths[def_index] += 1; | 4385 | p.depths[def_index] += 1; |
| 4386 | defer p.depths[def_index] -= 1; | 4386 | defer p.depths[def_index] -= 1; |
| ... | @@ -4410,7 +4410,7 @@ const Parser = struct { | ... | @@ -4410,7 +4410,7 @@ const Parser = struct { |
| 4410 | }; | 4410 | }; |
| 4411 | } | 4411 | } |
| 4412 | pub fn parseCARETEQUAL(p: *Parser) Error!bool { | 4412 | pub fn parseCARETEQUAL(p: *Parser) Error!bool { |
| 4413 | const def_index = @intFromEnum(Def.defCARETEQUAL); | 4413 | const def_index = @backingInt(Def.defCARETEQUAL); |
| 4414 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4414 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4415 | p.depths[def_index] += 1; | 4415 | p.depths[def_index] += 1; |
| 4416 | defer p.depths[def_index] -= 1; | 4416 | defer p.depths[def_index] -= 1; |
| ... | @@ -4428,7 +4428,7 @@ const Parser = struct { | ... | @@ -4428,7 +4428,7 @@ const Parser = struct { |
| 4428 | }; | 4428 | }; |
| 4429 | } | 4429 | } |
| 4430 | pub fn parseCOLON(p: *Parser) Error!bool { | 4430 | pub fn parseCOLON(p: *Parser) Error!bool { |
| 4431 | const def_index = @intFromEnum(Def.defCOLON); | 4431 | const def_index = @backingInt(Def.defCOLON); |
| 4432 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4432 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4433 | p.depths[def_index] += 1; | 4433 | p.depths[def_index] += 1; |
| 4434 | defer p.depths[def_index] -= 1; | 4434 | defer p.depths[def_index] -= 1; |
| ... | @@ -4446,7 +4446,7 @@ const Parser = struct { | ... | @@ -4446,7 +4446,7 @@ const Parser = struct { |
| 4446 | }; | 4446 | }; |
| 4447 | } | 4447 | } |
| 4448 | pub fn parseCOMMA(p: *Parser) Error!bool { | 4448 | pub fn parseCOMMA(p: *Parser) Error!bool { |
| 4449 | const def_index = @intFromEnum(Def.defCOMMA); | 4449 | const def_index = @backingInt(Def.defCOMMA); |
| 4450 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4450 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4451 | p.depths[def_index] += 1; | 4451 | p.depths[def_index] += 1; |
| 4452 | defer p.depths[def_index] -= 1; | 4452 | defer p.depths[def_index] -= 1; |
| ... | @@ -4464,7 +4464,7 @@ const Parser = struct { | ... | @@ -4464,7 +4464,7 @@ const Parser = struct { |
| 4464 | }; | 4464 | }; |
| 4465 | } | 4465 | } |
| 4466 | pub fn parseDOT(p: *Parser) Error!bool { | 4466 | pub fn parseDOT(p: *Parser) Error!bool { |
| 4467 | const def_index = @intFromEnum(Def.defDOT); | 4467 | const def_index = @backingInt(Def.defDOT); |
| 4468 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4468 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4469 | p.depths[def_index] += 1; | 4469 | p.depths[def_index] += 1; |
| 4470 | defer p.depths[def_index] -= 1; | 4470 | defer p.depths[def_index] -= 1; |
| ... | @@ -4495,7 +4495,7 @@ const Parser = struct { | ... | @@ -4495,7 +4495,7 @@ const Parser = struct { |
| 4495 | }; | 4495 | }; |
| 4496 | } | 4496 | } |
| 4497 | pub fn parseDOT2(p: *Parser) Error!bool { | 4497 | pub fn parseDOT2(p: *Parser) Error!bool { |
| 4498 | const def_index = @intFromEnum(Def.defDOT2); | 4498 | const def_index = @backingInt(Def.defDOT2); |
| 4499 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4499 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4500 | p.depths[def_index] += 1; | 4500 | p.depths[def_index] += 1; |
| 4501 | defer p.depths[def_index] -= 1; | 4501 | defer p.depths[def_index] -= 1; |
| ... | @@ -4525,7 +4525,7 @@ const Parser = struct { | ... | @@ -4525,7 +4525,7 @@ const Parser = struct { |
| 4525 | }; | 4525 | }; |
| 4526 | } | 4526 | } |
| 4527 | pub fn parseDOT3(p: *Parser) Error!bool { | 4527 | pub fn parseDOT3(p: *Parser) Error!bool { |
| 4528 | const def_index = @intFromEnum(Def.defDOT3); | 4528 | const def_index = @backingInt(Def.defDOT3); |
| 4529 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4529 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4530 | p.depths[def_index] += 1; | 4530 | p.depths[def_index] += 1; |
| 4531 | defer p.depths[def_index] -= 1; | 4531 | defer p.depths[def_index] -= 1; |
| ... | @@ -4543,7 +4543,7 @@ const Parser = struct { | ... | @@ -4543,7 +4543,7 @@ const Parser = struct { |
| 4543 | }; | 4543 | }; |
| 4544 | } | 4544 | } |
| 4545 | pub fn parseDOTASTERISK(p: *Parser) Error!bool { | 4545 | pub fn parseDOTASTERISK(p: *Parser) Error!bool { |
| 4546 | const def_index = @intFromEnum(Def.defDOTASTERISK); | 4546 | const def_index = @backingInt(Def.defDOTASTERISK); |
| 4547 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4547 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4548 | p.depths[def_index] += 1; | 4548 | p.depths[def_index] += 1; |
| 4549 | defer p.depths[def_index] -= 1; | 4549 | defer p.depths[def_index] -= 1; |
| ... | @@ -4561,7 +4561,7 @@ const Parser = struct { | ... | @@ -4561,7 +4561,7 @@ const Parser = struct { |
| 4561 | }; | 4561 | }; |
| 4562 | } | 4562 | } |
| 4563 | pub fn parseEQUAL(p: *Parser) Error!bool { | 4563 | pub fn parseEQUAL(p: *Parser) Error!bool { |
| 4564 | const def_index = @intFromEnum(Def.defEQUAL); | 4564 | const def_index = @backingInt(Def.defEQUAL); |
| 4565 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4565 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4566 | p.depths[def_index] += 1; | 4566 | p.depths[def_index] += 1; |
| 4567 | defer p.depths[def_index] -= 1; | 4567 | defer p.depths[def_index] -= 1; |
| ... | @@ -4592,7 +4592,7 @@ const Parser = struct { | ... | @@ -4592,7 +4592,7 @@ const Parser = struct { |
| 4592 | }; | 4592 | }; |
| 4593 | } | 4593 | } |
| 4594 | pub fn parseEQUALEQUAL(p: *Parser) Error!bool { | 4594 | pub fn parseEQUALEQUAL(p: *Parser) Error!bool { |
| 4595 | const def_index = @intFromEnum(Def.defEQUALEQUAL); | 4595 | const def_index = @backingInt(Def.defEQUALEQUAL); |
| 4596 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4596 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4597 | p.depths[def_index] += 1; | 4597 | p.depths[def_index] += 1; |
| 4598 | defer p.depths[def_index] -= 1; | 4598 | defer p.depths[def_index] -= 1; |
| ... | @@ -4610,7 +4610,7 @@ const Parser = struct { | ... | @@ -4610,7 +4610,7 @@ const Parser = struct { |
| 4610 | }; | 4610 | }; |
| 4611 | } | 4611 | } |
| 4612 | pub fn parseEQUALRARROW(p: *Parser) Error!bool { | 4612 | pub fn parseEQUALRARROW(p: *Parser) Error!bool { |
| 4613 | const def_index = @intFromEnum(Def.defEQUALRARROW); | 4613 | const def_index = @backingInt(Def.defEQUALRARROW); |
| 4614 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4614 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4615 | p.depths[def_index] += 1; | 4615 | p.depths[def_index] += 1; |
| 4616 | defer p.depths[def_index] -= 1; | 4616 | defer p.depths[def_index] -= 1; |
| ... | @@ -4628,7 +4628,7 @@ const Parser = struct { | ... | @@ -4628,7 +4628,7 @@ const Parser = struct { |
| 4628 | }; | 4628 | }; |
| 4629 | } | 4629 | } |
| 4630 | pub fn parseEXCLAMATIONMARK(p: *Parser) Error!bool { | 4630 | pub fn parseEXCLAMATIONMARK(p: *Parser) Error!bool { |
| 4631 | const def_index = @intFromEnum(Def.defEXCLAMATIONMARK); | 4631 | const def_index = @backingInt(Def.defEXCLAMATIONMARK); |
| 4632 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4632 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4633 | p.depths[def_index] += 1; | 4633 | p.depths[def_index] += 1; |
| 4634 | defer p.depths[def_index] -= 1; | 4634 | defer p.depths[def_index] -= 1; |
| ... | @@ -4658,7 +4658,7 @@ const Parser = struct { | ... | @@ -4658,7 +4658,7 @@ const Parser = struct { |
| 4658 | }; | 4658 | }; |
| 4659 | } | 4659 | } |
| 4660 | pub fn parseEXCLAMATIONMARKEQUAL(p: *Parser) Error!bool { | 4660 | pub fn parseEXCLAMATIONMARKEQUAL(p: *Parser) Error!bool { |
| 4661 | const def_index = @intFromEnum(Def.defEXCLAMATIONMARKEQUAL); | 4661 | const def_index = @backingInt(Def.defEXCLAMATIONMARKEQUAL); |
| 4662 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4662 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4663 | p.depths[def_index] += 1; | 4663 | p.depths[def_index] += 1; |
| 4664 | defer p.depths[def_index] -= 1; | 4664 | defer p.depths[def_index] -= 1; |
| ... | @@ -4676,7 +4676,7 @@ const Parser = struct { | ... | @@ -4676,7 +4676,7 @@ const Parser = struct { |
| 4676 | }; | 4676 | }; |
| 4677 | } | 4677 | } |
| 4678 | pub fn parseLARROW(p: *Parser) Error!bool { | 4678 | pub fn parseLARROW(p: *Parser) Error!bool { |
| 4679 | const def_index = @intFromEnum(Def.defLARROW); | 4679 | const def_index = @backingInt(Def.defLARROW); |
| 4680 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4680 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4681 | p.depths[def_index] += 1; | 4681 | p.depths[def_index] += 1; |
| 4682 | defer p.depths[def_index] -= 1; | 4682 | defer p.depths[def_index] -= 1; |
| ... | @@ -4707,7 +4707,7 @@ const Parser = struct { | ... | @@ -4707,7 +4707,7 @@ const Parser = struct { |
| 4707 | }; | 4707 | }; |
| 4708 | } | 4708 | } |
| 4709 | pub fn parseLARROW2(p: *Parser) Error!bool { | 4709 | pub fn parseLARROW2(p: *Parser) Error!bool { |
| 4710 | const def_index = @intFromEnum(Def.defLARROW2); | 4710 | const def_index = @backingInt(Def.defLARROW2); |
| 4711 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4711 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4712 | p.depths[def_index] += 1; | 4712 | p.depths[def_index] += 1; |
| 4713 | defer p.depths[def_index] -= 1; | 4713 | defer p.depths[def_index] -= 1; |
| ... | @@ -4738,7 +4738,7 @@ const Parser = struct { | ... | @@ -4738,7 +4738,7 @@ const Parser = struct { |
| 4738 | }; | 4738 | }; |
| 4739 | } | 4739 | } |
| 4740 | pub fn parseLARROW2EQUAL(p: *Parser) Error!bool { | 4740 | pub fn parseLARROW2EQUAL(p: *Parser) Error!bool { |
| 4741 | const def_index = @intFromEnum(Def.defLARROW2EQUAL); | 4741 | const def_index = @backingInt(Def.defLARROW2EQUAL); |
| 4742 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4742 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4743 | p.depths[def_index] += 1; | 4743 | p.depths[def_index] += 1; |
| 4744 | defer p.depths[def_index] -= 1; | 4744 | defer p.depths[def_index] -= 1; |
| ... | @@ -4756,7 +4756,7 @@ const Parser = struct { | ... | @@ -4756,7 +4756,7 @@ const Parser = struct { |
| 4756 | }; | 4756 | }; |
| 4757 | } | 4757 | } |
| 4758 | pub fn parseLARROW2PIPE(p: *Parser) Error!bool { | 4758 | pub fn parseLARROW2PIPE(p: *Parser) Error!bool { |
| 4759 | const def_index = @intFromEnum(Def.defLARROW2PIPE); | 4759 | const def_index = @backingInt(Def.defLARROW2PIPE); |
| 4760 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4760 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4761 | p.depths[def_index] += 1; | 4761 | p.depths[def_index] += 1; |
| 4762 | defer p.depths[def_index] -= 1; | 4762 | defer p.depths[def_index] -= 1; |
| ... | @@ -4786,7 +4786,7 @@ const Parser = struct { | ... | @@ -4786,7 +4786,7 @@ const Parser = struct { |
| 4786 | }; | 4786 | }; |
| 4787 | } | 4787 | } |
| 4788 | pub fn parseLARROW2PIPEEQUAL(p: *Parser) Error!bool { | 4788 | pub fn parseLARROW2PIPEEQUAL(p: *Parser) Error!bool { |
| 4789 | const def_index = @intFromEnum(Def.defLARROW2PIPEEQUAL); | 4789 | const def_index = @backingInt(Def.defLARROW2PIPEEQUAL); |
| 4790 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4790 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4791 | p.depths[def_index] += 1; | 4791 | p.depths[def_index] += 1; |
| 4792 | defer p.depths[def_index] -= 1; | 4792 | defer p.depths[def_index] -= 1; |
| ... | @@ -4804,7 +4804,7 @@ const Parser = struct { | ... | @@ -4804,7 +4804,7 @@ const Parser = struct { |
| 4804 | }; | 4804 | }; |
| 4805 | } | 4805 | } |
| 4806 | pub fn parseLARROWEQUAL(p: *Parser) Error!bool { | 4806 | pub fn parseLARROWEQUAL(p: *Parser) Error!bool { |
| 4807 | const def_index = @intFromEnum(Def.defLARROWEQUAL); | 4807 | const def_index = @backingInt(Def.defLARROWEQUAL); |
| 4808 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4808 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4809 | p.depths[def_index] += 1; | 4809 | p.depths[def_index] += 1; |
| 4810 | defer p.depths[def_index] -= 1; | 4810 | defer p.depths[def_index] -= 1; |
| ... | @@ -4822,7 +4822,7 @@ const Parser = struct { | ... | @@ -4822,7 +4822,7 @@ const Parser = struct { |
| 4822 | }; | 4822 | }; |
| 4823 | } | 4823 | } |
| 4824 | pub fn parseLBRACE(p: *Parser) Error!bool { | 4824 | pub fn parseLBRACE(p: *Parser) Error!bool { |
| 4825 | const def_index = @intFromEnum(Def.defLBRACE); | 4825 | const def_index = @backingInt(Def.defLBRACE); |
| 4826 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4826 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4827 | p.depths[def_index] += 1; | 4827 | p.depths[def_index] += 1; |
| 4828 | defer p.depths[def_index] -= 1; | 4828 | defer p.depths[def_index] -= 1; |
| ... | @@ -4840,7 +4840,7 @@ const Parser = struct { | ... | @@ -4840,7 +4840,7 @@ const Parser = struct { |
| 4840 | }; | 4840 | }; |
| 4841 | } | 4841 | } |
| 4842 | pub fn parseLBRACKET(p: *Parser) Error!bool { | 4842 | pub fn parseLBRACKET(p: *Parser) Error!bool { |
| 4843 | const def_index = @intFromEnum(Def.defLBRACKET); | 4843 | const def_index = @backingInt(Def.defLBRACKET); |
| 4844 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4844 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4845 | p.depths[def_index] += 1; | 4845 | p.depths[def_index] += 1; |
| 4846 | defer p.depths[def_index] -= 1; | 4846 | defer p.depths[def_index] -= 1; |
| ... | @@ -4858,7 +4858,7 @@ const Parser = struct { | ... | @@ -4858,7 +4858,7 @@ const Parser = struct { |
| 4858 | }; | 4858 | }; |
| 4859 | } | 4859 | } |
| 4860 | pub fn parseLPAREN(p: *Parser) Error!bool { | 4860 | pub fn parseLPAREN(p: *Parser) Error!bool { |
| 4861 | const def_index = @intFromEnum(Def.defLPAREN); | 4861 | const def_index = @backingInt(Def.defLPAREN); |
| 4862 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4862 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4863 | p.depths[def_index] += 1; | 4863 | p.depths[def_index] += 1; |
| 4864 | defer p.depths[def_index] -= 1; | 4864 | defer p.depths[def_index] -= 1; |
| ... | @@ -4876,7 +4876,7 @@ const Parser = struct { | ... | @@ -4876,7 +4876,7 @@ const Parser = struct { |
| 4876 | }; | 4876 | }; |
| 4877 | } | 4877 | } |
| 4878 | pub fn parseMINUS(p: *Parser) Error!bool { | 4878 | pub fn parseMINUS(p: *Parser) Error!bool { |
| 4879 | const def_index = @intFromEnum(Def.defMINUS); | 4879 | const def_index = @backingInt(Def.defMINUS); |
| 4880 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4880 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4881 | p.depths[def_index] += 1; | 4881 | p.depths[def_index] += 1; |
| 4882 | defer p.depths[def_index] -= 1; | 4882 | defer p.depths[def_index] -= 1; |
| ... | @@ -4909,7 +4909,7 @@ const Parser = struct { | ... | @@ -4909,7 +4909,7 @@ const Parser = struct { |
| 4909 | }; | 4909 | }; |
| 4910 | } | 4910 | } |
| 4911 | pub fn parseMINUSEQUAL(p: *Parser) Error!bool { | 4911 | pub fn parseMINUSEQUAL(p: *Parser) Error!bool { |
| 4912 | const def_index = @intFromEnum(Def.defMINUSEQUAL); | 4912 | const def_index = @backingInt(Def.defMINUSEQUAL); |
| 4913 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4913 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4914 | p.depths[def_index] += 1; | 4914 | p.depths[def_index] += 1; |
| 4915 | defer p.depths[def_index] -= 1; | 4915 | defer p.depths[def_index] -= 1; |
| ... | @@ -4927,7 +4927,7 @@ const Parser = struct { | ... | @@ -4927,7 +4927,7 @@ const Parser = struct { |
| 4927 | }; | 4927 | }; |
| 4928 | } | 4928 | } |
| 4929 | pub fn parseMINUSPERCENT(p: *Parser) Error!bool { | 4929 | pub fn parseMINUSPERCENT(p: *Parser) Error!bool { |
| 4930 | const def_index = @intFromEnum(Def.defMINUSPERCENT); | 4930 | const def_index = @backingInt(Def.defMINUSPERCENT); |
| 4931 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4931 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4932 | p.depths[def_index] += 1; | 4932 | p.depths[def_index] += 1; |
| 4933 | defer p.depths[def_index] -= 1; | 4933 | defer p.depths[def_index] -= 1; |
| ... | @@ -4957,7 +4957,7 @@ const Parser = struct { | ... | @@ -4957,7 +4957,7 @@ const Parser = struct { |
| 4957 | }; | 4957 | }; |
| 4958 | } | 4958 | } |
| 4959 | pub fn parseMINUSPERCENTEQUAL(p: *Parser) Error!bool { | 4959 | pub fn parseMINUSPERCENTEQUAL(p: *Parser) Error!bool { |
| 4960 | const def_index = @intFromEnum(Def.defMINUSPERCENTEQUAL); | 4960 | const def_index = @backingInt(Def.defMINUSPERCENTEQUAL); |
| 4961 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4961 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4962 | p.depths[def_index] += 1; | 4962 | p.depths[def_index] += 1; |
| 4963 | defer p.depths[def_index] -= 1; | 4963 | defer p.depths[def_index] -= 1; |
| ... | @@ -4975,7 +4975,7 @@ const Parser = struct { | ... | @@ -4975,7 +4975,7 @@ const Parser = struct { |
| 4975 | }; | 4975 | }; |
| 4976 | } | 4976 | } |
| 4977 | pub fn parseMINUSPIPE(p: *Parser) Error!bool { | 4977 | pub fn parseMINUSPIPE(p: *Parser) Error!bool { |
| 4978 | const def_index = @intFromEnum(Def.defMINUSPIPE); | 4978 | const def_index = @backingInt(Def.defMINUSPIPE); |
| 4979 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 4979 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 4980 | p.depths[def_index] += 1; | 4980 | p.depths[def_index] += 1; |
| 4981 | defer p.depths[def_index] -= 1; | 4981 | defer p.depths[def_index] -= 1; |
| ... | @@ -5005,7 +5005,7 @@ const Parser = struct { | ... | @@ -5005,7 +5005,7 @@ const Parser = struct { |
| 5005 | }; | 5005 | }; |
| 5006 | } | 5006 | } |
| 5007 | pub fn parseMINUSPIPEEQUAL(p: *Parser) Error!bool { | 5007 | pub fn parseMINUSPIPEEQUAL(p: *Parser) Error!bool { |
| 5008 | const def_index = @intFromEnum(Def.defMINUSPIPEEQUAL); | 5008 | const def_index = @backingInt(Def.defMINUSPIPEEQUAL); |
| 5009 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5009 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5010 | p.depths[def_index] += 1; | 5010 | p.depths[def_index] += 1; |
| 5011 | defer p.depths[def_index] -= 1; | 5011 | defer p.depths[def_index] -= 1; |
| ... | @@ -5023,7 +5023,7 @@ const Parser = struct { | ... | @@ -5023,7 +5023,7 @@ const Parser = struct { |
| 5023 | }; | 5023 | }; |
| 5024 | } | 5024 | } |
| 5025 | pub fn parseMINUSRARROW(p: *Parser) Error!bool { | 5025 | pub fn parseMINUSRARROW(p: *Parser) Error!bool { |
| 5026 | const def_index = @intFromEnum(Def.defMINUSRARROW); | 5026 | const def_index = @backingInt(Def.defMINUSRARROW); |
| 5027 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5027 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5028 | p.depths[def_index] += 1; | 5028 | p.depths[def_index] += 1; |
| 5029 | defer p.depths[def_index] -= 1; | 5029 | defer p.depths[def_index] -= 1; |
| ... | @@ -5041,7 +5041,7 @@ const Parser = struct { | ... | @@ -5041,7 +5041,7 @@ const Parser = struct { |
| 5041 | }; | 5041 | }; |
| 5042 | } | 5042 | } |
| 5043 | pub fn parsePERCENT(p: *Parser) Error!bool { | 5043 | pub fn parsePERCENT(p: *Parser) Error!bool { |
| 5044 | const def_index = @intFromEnum(Def.defPERCENT); | 5044 | const def_index = @backingInt(Def.defPERCENT); |
| 5045 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5045 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5046 | p.depths[def_index] += 1; | 5046 | p.depths[def_index] += 1; |
| 5047 | defer p.depths[def_index] -= 1; | 5047 | defer p.depths[def_index] -= 1; |
| ... | @@ -5071,7 +5071,7 @@ const Parser = struct { | ... | @@ -5071,7 +5071,7 @@ const Parser = struct { |
| 5071 | }; | 5071 | }; |
| 5072 | } | 5072 | } |
| 5073 | pub fn parsePERCENTEQUAL(p: *Parser) Error!bool { | 5073 | pub fn parsePERCENTEQUAL(p: *Parser) Error!bool { |
| 5074 | const def_index = @intFromEnum(Def.defPERCENTEQUAL); | 5074 | const def_index = @backingInt(Def.defPERCENTEQUAL); |
| 5075 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5075 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5076 | p.depths[def_index] += 1; | 5076 | p.depths[def_index] += 1; |
| 5077 | defer p.depths[def_index] -= 1; | 5077 | defer p.depths[def_index] -= 1; |
| ... | @@ -5089,7 +5089,7 @@ const Parser = struct { | ... | @@ -5089,7 +5089,7 @@ const Parser = struct { |
| 5089 | }; | 5089 | }; |
| 5090 | } | 5090 | } |
| 5091 | pub fn parsePIPE(p: *Parser) Error!bool { | 5091 | pub fn parsePIPE(p: *Parser) Error!bool { |
| 5092 | const def_index = @intFromEnum(Def.defPIPE); | 5092 | const def_index = @backingInt(Def.defPIPE); |
| 5093 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5093 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5094 | p.depths[def_index] += 1; | 5094 | p.depths[def_index] += 1; |
| 5095 | defer p.depths[def_index] -= 1; | 5095 | defer p.depths[def_index] -= 1; |
| ... | @@ -5120,7 +5120,7 @@ const Parser = struct { | ... | @@ -5120,7 +5120,7 @@ const Parser = struct { |
| 5120 | }; | 5120 | }; |
| 5121 | } | 5121 | } |
| 5122 | pub fn parsePIPE2(p: *Parser) Error!bool { | 5122 | pub fn parsePIPE2(p: *Parser) Error!bool { |
| 5123 | const def_index = @intFromEnum(Def.defPIPE2); | 5123 | const def_index = @backingInt(Def.defPIPE2); |
| 5124 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5124 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5125 | p.depths[def_index] += 1; | 5125 | p.depths[def_index] += 1; |
| 5126 | defer p.depths[def_index] -= 1; | 5126 | defer p.depths[def_index] -= 1; |
| ... | @@ -5138,7 +5138,7 @@ const Parser = struct { | ... | @@ -5138,7 +5138,7 @@ const Parser = struct { |
| 5138 | }; | 5138 | }; |
| 5139 | } | 5139 | } |
| 5140 | pub fn parsePIPEEQUAL(p: *Parser) Error!bool { | 5140 | pub fn parsePIPEEQUAL(p: *Parser) Error!bool { |
| 5141 | const def_index = @intFromEnum(Def.defPIPEEQUAL); | 5141 | const def_index = @backingInt(Def.defPIPEEQUAL); |
| 5142 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5142 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5143 | p.depths[def_index] += 1; | 5143 | p.depths[def_index] += 1; |
| 5144 | defer p.depths[def_index] -= 1; | 5144 | defer p.depths[def_index] -= 1; |
| ... | @@ -5156,7 +5156,7 @@ const Parser = struct { | ... | @@ -5156,7 +5156,7 @@ const Parser = struct { |
| 5156 | }; | 5156 | }; |
| 5157 | } | 5157 | } |
| 5158 | pub fn parsePLUS(p: *Parser) Error!bool { | 5158 | pub fn parsePLUS(p: *Parser) Error!bool { |
| 5159 | const def_index = @intFromEnum(Def.defPLUS); | 5159 | const def_index = @backingInt(Def.defPLUS); |
| 5160 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5160 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5161 | p.depths[def_index] += 1; | 5161 | p.depths[def_index] += 1; |
| 5162 | defer p.depths[def_index] -= 1; | 5162 | defer p.depths[def_index] -= 1; |
| ... | @@ -5189,7 +5189,7 @@ const Parser = struct { | ... | @@ -5189,7 +5189,7 @@ const Parser = struct { |
| 5189 | }; | 5189 | }; |
| 5190 | } | 5190 | } |
| 5191 | pub fn parsePLUS2(p: *Parser) Error!bool { | 5191 | pub fn parsePLUS2(p: *Parser) Error!bool { |
| 5192 | const def_index = @intFromEnum(Def.defPLUS2); | 5192 | const def_index = @backingInt(Def.defPLUS2); |
| 5193 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5193 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5194 | p.depths[def_index] += 1; | 5194 | p.depths[def_index] += 1; |
| 5195 | defer p.depths[def_index] -= 1; | 5195 | defer p.depths[def_index] -= 1; |
| ... | @@ -5207,7 +5207,7 @@ const Parser = struct { | ... | @@ -5207,7 +5207,7 @@ const Parser = struct { |
| 5207 | }; | 5207 | }; |
| 5208 | } | 5208 | } |
| 5209 | pub fn parsePLUSEQUAL(p: *Parser) Error!bool { | 5209 | pub fn parsePLUSEQUAL(p: *Parser) Error!bool { |
| 5210 | const def_index = @intFromEnum(Def.defPLUSEQUAL); | 5210 | const def_index = @backingInt(Def.defPLUSEQUAL); |
| 5211 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5211 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5212 | p.depths[def_index] += 1; | 5212 | p.depths[def_index] += 1; |
| 5213 | defer p.depths[def_index] -= 1; | 5213 | defer p.depths[def_index] -= 1; |
| ... | @@ -5225,7 +5225,7 @@ const Parser = struct { | ... | @@ -5225,7 +5225,7 @@ const Parser = struct { |
| 5225 | }; | 5225 | }; |
| 5226 | } | 5226 | } |
| 5227 | pub fn parsePLUSPERCENT(p: *Parser) Error!bool { | 5227 | pub fn parsePLUSPERCENT(p: *Parser) Error!bool { |
| 5228 | const def_index = @intFromEnum(Def.defPLUSPERCENT); | 5228 | const def_index = @backingInt(Def.defPLUSPERCENT); |
| 5229 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5229 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5230 | p.depths[def_index] += 1; | 5230 | p.depths[def_index] += 1; |
| 5231 | defer p.depths[def_index] -= 1; | 5231 | defer p.depths[def_index] -= 1; |
| ... | @@ -5255,7 +5255,7 @@ const Parser = struct { | ... | @@ -5255,7 +5255,7 @@ const Parser = struct { |
| 5255 | }; | 5255 | }; |
| 5256 | } | 5256 | } |
| 5257 | pub fn parsePLUSPERCENTEQUAL(p: *Parser) Error!bool { | 5257 | pub fn parsePLUSPERCENTEQUAL(p: *Parser) Error!bool { |
| 5258 | const def_index = @intFromEnum(Def.defPLUSPERCENTEQUAL); | 5258 | const def_index = @backingInt(Def.defPLUSPERCENTEQUAL); |
| 5259 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5259 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5260 | p.depths[def_index] += 1; | 5260 | p.depths[def_index] += 1; |
| 5261 | defer p.depths[def_index] -= 1; | 5261 | defer p.depths[def_index] -= 1; |
| ... | @@ -5273,7 +5273,7 @@ const Parser = struct { | ... | @@ -5273,7 +5273,7 @@ const Parser = struct { |
| 5273 | }; | 5273 | }; |
| 5274 | } | 5274 | } |
| 5275 | pub fn parsePLUSPIPE(p: *Parser) Error!bool { | 5275 | pub fn parsePLUSPIPE(p: *Parser) Error!bool { |
| 5276 | const def_index = @intFromEnum(Def.defPLUSPIPE); | 5276 | const def_index = @backingInt(Def.defPLUSPIPE); |
| 5277 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5277 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5278 | p.depths[def_index] += 1; | 5278 | p.depths[def_index] += 1; |
| 5279 | defer p.depths[def_index] -= 1; | 5279 | defer p.depths[def_index] -= 1; |
| ... | @@ -5303,7 +5303,7 @@ const Parser = struct { | ... | @@ -5303,7 +5303,7 @@ const Parser = struct { |
| 5303 | }; | 5303 | }; |
| 5304 | } | 5304 | } |
| 5305 | pub fn parsePLUSPIPEEQUAL(p: *Parser) Error!bool { | 5305 | pub fn parsePLUSPIPEEQUAL(p: *Parser) Error!bool { |
| 5306 | const def_index = @intFromEnum(Def.defPLUSPIPEEQUAL); | 5306 | const def_index = @backingInt(Def.defPLUSPIPEEQUAL); |
| 5307 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5307 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5308 | p.depths[def_index] += 1; | 5308 | p.depths[def_index] += 1; |
| 5309 | defer p.depths[def_index] -= 1; | 5309 | defer p.depths[def_index] -= 1; |
| ... | @@ -5321,7 +5321,7 @@ const Parser = struct { | ... | @@ -5321,7 +5321,7 @@ const Parser = struct { |
| 5321 | }; | 5321 | }; |
| 5322 | } | 5322 | } |
| 5323 | pub fn parseLETTERC(p: *Parser) Error!bool { | 5323 | pub fn parseLETTERC(p: *Parser) Error!bool { |
| 5324 | const def_index = @intFromEnum(Def.defLETTERC); | 5324 | const def_index = @backingInt(Def.defLETTERC); |
| 5325 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5325 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5326 | p.depths[def_index] += 1; | 5326 | p.depths[def_index] += 1; |
| 5327 | defer p.depths[def_index] -= 1; | 5327 | defer p.depths[def_index] -= 1; |
| ... | @@ -5339,7 +5339,7 @@ const Parser = struct { | ... | @@ -5339,7 +5339,7 @@ const Parser = struct { |
| 5339 | }; | 5339 | }; |
| 5340 | } | 5340 | } |
| 5341 | pub fn parseQUESTIONMARK(p: *Parser) Error!bool { | 5341 | pub fn parseQUESTIONMARK(p: *Parser) Error!bool { |
| 5342 | const def_index = @intFromEnum(Def.defQUESTIONMARK); | 5342 | const def_index = @backingInt(Def.defQUESTIONMARK); |
| 5343 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5343 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5344 | p.depths[def_index] += 1; | 5344 | p.depths[def_index] += 1; |
| 5345 | defer p.depths[def_index] -= 1; | 5345 | defer p.depths[def_index] -= 1; |
| ... | @@ -5357,7 +5357,7 @@ const Parser = struct { | ... | @@ -5357,7 +5357,7 @@ const Parser = struct { |
| 5357 | }; | 5357 | }; |
| 5358 | } | 5358 | } |
| 5359 | pub fn parseRARROW(p: *Parser) Error!bool { | 5359 | pub fn parseRARROW(p: *Parser) Error!bool { |
| 5360 | const def_index = @intFromEnum(Def.defRARROW); | 5360 | const def_index = @backingInt(Def.defRARROW); |
| 5361 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5361 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5362 | p.depths[def_index] += 1; | 5362 | p.depths[def_index] += 1; |
| 5363 | defer p.depths[def_index] -= 1; | 5363 | defer p.depths[def_index] -= 1; |
| ... | @@ -5388,7 +5388,7 @@ const Parser = struct { | ... | @@ -5388,7 +5388,7 @@ const Parser = struct { |
| 5388 | }; | 5388 | }; |
| 5389 | } | 5389 | } |
| 5390 | pub fn parseRARROW2(p: *Parser) Error!bool { | 5390 | pub fn parseRARROW2(p: *Parser) Error!bool { |
| 5391 | const def_index = @intFromEnum(Def.defRARROW2); | 5391 | const def_index = @backingInt(Def.defRARROW2); |
| 5392 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5392 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5393 | p.depths[def_index] += 1; | 5393 | p.depths[def_index] += 1; |
| 5394 | defer p.depths[def_index] -= 1; | 5394 | defer p.depths[def_index] -= 1; |
| ... | @@ -5418,7 +5418,7 @@ const Parser = struct { | ... | @@ -5418,7 +5418,7 @@ const Parser = struct { |
| 5418 | }; | 5418 | }; |
| 5419 | } | 5419 | } |
| 5420 | pub fn parseRARROW2EQUAL(p: *Parser) Error!bool { | 5420 | pub fn parseRARROW2EQUAL(p: *Parser) Error!bool { |
| 5421 | const def_index = @intFromEnum(Def.defRARROW2EQUAL); | 5421 | const def_index = @backingInt(Def.defRARROW2EQUAL); |
| 5422 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5422 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5423 | p.depths[def_index] += 1; | 5423 | p.depths[def_index] += 1; |
| 5424 | defer p.depths[def_index] -= 1; | 5424 | defer p.depths[def_index] -= 1; |
| ... | @@ -5436,7 +5436,7 @@ const Parser = struct { | ... | @@ -5436,7 +5436,7 @@ const Parser = struct { |
| 5436 | }; | 5436 | }; |
| 5437 | } | 5437 | } |
| 5438 | pub fn parseRARROWEQUAL(p: *Parser) Error!bool { | 5438 | pub fn parseRARROWEQUAL(p: *Parser) Error!bool { |
| 5439 | const def_index = @intFromEnum(Def.defRARROWEQUAL); | 5439 | const def_index = @backingInt(Def.defRARROWEQUAL); |
| 5440 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5440 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5441 | p.depths[def_index] += 1; | 5441 | p.depths[def_index] += 1; |
| 5442 | defer p.depths[def_index] -= 1; | 5442 | defer p.depths[def_index] -= 1; |
| ... | @@ -5454,7 +5454,7 @@ const Parser = struct { | ... | @@ -5454,7 +5454,7 @@ const Parser = struct { |
| 5454 | }; | 5454 | }; |
| 5455 | } | 5455 | } |
| 5456 | pub fn parseRBRACE(p: *Parser) Error!bool { | 5456 | pub fn parseRBRACE(p: *Parser) Error!bool { |
| 5457 | const def_index = @intFromEnum(Def.defRBRACE); | 5457 | const def_index = @backingInt(Def.defRBRACE); |
| 5458 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5458 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5459 | p.depths[def_index] += 1; | 5459 | p.depths[def_index] += 1; |
| 5460 | defer p.depths[def_index] -= 1; | 5460 | defer p.depths[def_index] -= 1; |
| ... | @@ -5472,7 +5472,7 @@ const Parser = struct { | ... | @@ -5472,7 +5472,7 @@ const Parser = struct { |
| 5472 | }; | 5472 | }; |
| 5473 | } | 5473 | } |
| 5474 | pub fn parseRBRACKET(p: *Parser) Error!bool { | 5474 | pub fn parseRBRACKET(p: *Parser) Error!bool { |
| 5475 | const def_index = @intFromEnum(Def.defRBRACKET); | 5475 | const def_index = @backingInt(Def.defRBRACKET); |
| 5476 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5476 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5477 | p.depths[def_index] += 1; | 5477 | p.depths[def_index] += 1; |
| 5478 | defer p.depths[def_index] -= 1; | 5478 | defer p.depths[def_index] -= 1; |
| ... | @@ -5490,7 +5490,7 @@ const Parser = struct { | ... | @@ -5490,7 +5490,7 @@ const Parser = struct { |
| 5490 | }; | 5490 | }; |
| 5491 | } | 5491 | } |
| 5492 | pub fn parseRPAREN(p: *Parser) Error!bool { | 5492 | pub fn parseRPAREN(p: *Parser) Error!bool { |
| 5493 | const def_index = @intFromEnum(Def.defRPAREN); | 5493 | const def_index = @backingInt(Def.defRPAREN); |
| 5494 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5494 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5495 | p.depths[def_index] += 1; | 5495 | p.depths[def_index] += 1; |
| 5496 | defer p.depths[def_index] -= 1; | 5496 | defer p.depths[def_index] -= 1; |
| ... | @@ -5508,7 +5508,7 @@ const Parser = struct { | ... | @@ -5508,7 +5508,7 @@ const Parser = struct { |
| 5508 | }; | 5508 | }; |
| 5509 | } | 5509 | } |
| 5510 | pub fn parseSEMICOLON(p: *Parser) Error!bool { | 5510 | pub fn parseSEMICOLON(p: *Parser) Error!bool { |
| 5511 | const def_index = @intFromEnum(Def.defSEMICOLON); | 5511 | const def_index = @backingInt(Def.defSEMICOLON); |
| 5512 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5512 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5513 | p.depths[def_index] += 1; | 5513 | p.depths[def_index] += 1; |
| 5514 | defer p.depths[def_index] -= 1; | 5514 | defer p.depths[def_index] -= 1; |
| ... | @@ -5526,7 +5526,7 @@ const Parser = struct { | ... | @@ -5526,7 +5526,7 @@ const Parser = struct { |
| 5526 | }; | 5526 | }; |
| 5527 | } | 5527 | } |
| 5528 | pub fn parseSLASH(p: *Parser) Error!bool { | 5528 | pub fn parseSLASH(p: *Parser) Error!bool { |
| 5529 | const def_index = @intFromEnum(Def.defSLASH); | 5529 | const def_index = @backingInt(Def.defSLASH); |
| 5530 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5530 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5531 | p.depths[def_index] += 1; | 5531 | p.depths[def_index] += 1; |
| 5532 | defer p.depths[def_index] -= 1; | 5532 | defer p.depths[def_index] -= 1; |
| ... | @@ -5557,7 +5557,7 @@ const Parser = struct { | ... | @@ -5557,7 +5557,7 @@ const Parser = struct { |
| 5557 | }; | 5557 | }; |
| 5558 | } | 5558 | } |
| 5559 | pub fn parseSLASHEQUAL(p: *Parser) Error!bool { | 5559 | pub fn parseSLASHEQUAL(p: *Parser) Error!bool { |
| 5560 | const def_index = @intFromEnum(Def.defSLASHEQUAL); | 5560 | const def_index = @backingInt(Def.defSLASHEQUAL); |
| 5561 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5561 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5562 | p.depths[def_index] += 1; | 5562 | p.depths[def_index] += 1; |
| 5563 | defer p.depths[def_index] -= 1; | 5563 | defer p.depths[def_index] -= 1; |
| ... | @@ -5575,7 +5575,7 @@ const Parser = struct { | ... | @@ -5575,7 +5575,7 @@ const Parser = struct { |
| 5575 | }; | 5575 | }; |
| 5576 | } | 5576 | } |
| 5577 | pub fn parseTILDE(p: *Parser) Error!bool { | 5577 | pub fn parseTILDE(p: *Parser) Error!bool { |
| 5578 | const def_index = @intFromEnum(Def.defTILDE); | 5578 | const def_index = @backingInt(Def.defTILDE); |
| 5579 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5579 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5580 | p.depths[def_index] += 1; | 5580 | p.depths[def_index] += 1; |
| 5581 | defer p.depths[def_index] -= 1; | 5581 | defer p.depths[def_index] -= 1; |
| ... | @@ -5593,7 +5593,7 @@ const Parser = struct { | ... | @@ -5593,7 +5593,7 @@ const Parser = struct { |
| 5593 | }; | 5593 | }; |
| 5594 | } | 5594 | } |
| 5595 | pub fn parseend_of_word(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5597 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5598 | p.depths[def_index] += 1; | 5598 | p.depths[def_index] += 1; |
| 5599 | defer p.depths[def_index] -= 1; | 5599 | defer p.depths[def_index] -= 1; |
| ... | @@ -5620,7 +5620,7 @@ const Parser = struct { | ... | @@ -5620,7 +5620,7 @@ const Parser = struct { |
| 5620 | }; | 5620 | }; |
| 5621 | } | 5621 | } |
| 5622 | pub fn parseKEYWORD_addrspace(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5624 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5625 | p.depths[def_index] += 1; | 5625 | p.depths[def_index] += 1; |
| 5626 | defer p.depths[def_index] -= 1; | 5626 | defer p.depths[def_index] -= 1; |
| ... | @@ -5638,7 +5638,7 @@ const Parser = struct { | ... | @@ -5638,7 +5638,7 @@ const Parser = struct { |
| 5638 | }; | 5638 | }; |
| 5639 | } | 5639 | } |
| 5640 | pub fn parseKEYWORD_align(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5642 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5643 | p.depths[def_index] += 1; | 5643 | p.depths[def_index] += 1; |
| 5644 | defer p.depths[def_index] -= 1; | 5644 | defer p.depths[def_index] -= 1; |
| ... | @@ -5656,7 +5656,7 @@ const Parser = struct { | ... | @@ -5656,7 +5656,7 @@ const Parser = struct { |
| 5656 | }; | 5656 | }; |
| 5657 | } | 5657 | } |
| 5658 | pub fn parseKEYWORD_allowzero(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5660 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5661 | p.depths[def_index] += 1; | 5661 | p.depths[def_index] += 1; |
| 5662 | defer p.depths[def_index] -= 1; | 5662 | defer p.depths[def_index] -= 1; |
| ... | @@ -5674,7 +5674,7 @@ const Parser = struct { | ... | @@ -5674,7 +5674,7 @@ const Parser = struct { |
| 5674 | }; | 5674 | }; |
| 5675 | } | 5675 | } |
| 5676 | pub fn parseKEYWORD_and(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5678 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5679 | p.depths[def_index] += 1; | 5679 | p.depths[def_index] += 1; |
| 5680 | defer p.depths[def_index] -= 1; | 5680 | defer p.depths[def_index] -= 1; |
| ... | @@ -5692,7 +5692,7 @@ const Parser = struct { | ... | @@ -5692,7 +5692,7 @@ const Parser = struct { |
| 5692 | }; | 5692 | }; |
| 5693 | } | 5693 | } |
| 5694 | pub fn parseKEYWORD_anyframe(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5696 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5697 | p.depths[def_index] += 1; | 5697 | p.depths[def_index] += 1; |
| 5698 | defer p.depths[def_index] -= 1; | 5698 | defer p.depths[def_index] -= 1; |
| ... | @@ -5710,7 +5710,7 @@ const Parser = struct { | ... | @@ -5710,7 +5710,7 @@ const Parser = struct { |
| 5710 | }; | 5710 | }; |
| 5711 | } | 5711 | } |
| 5712 | pub fn parseKEYWORD_anytype(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5714 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5715 | p.depths[def_index] += 1; | 5715 | p.depths[def_index] += 1; |
| 5716 | defer p.depths[def_index] -= 1; | 5716 | defer p.depths[def_index] -= 1; |
| ... | @@ -5728,7 +5728,7 @@ const Parser = struct { | ... | @@ -5728,7 +5728,7 @@ const Parser = struct { |
| 5728 | }; | 5728 | }; |
| 5729 | } | 5729 | } |
| 5730 | pub fn parseKEYWORD_asm(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5732 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5733 | p.depths[def_index] += 1; | 5733 | p.depths[def_index] += 1; |
| 5734 | defer p.depths[def_index] -= 1; | 5734 | defer p.depths[def_index] -= 1; |
| ... | @@ -5746,7 +5746,7 @@ const Parser = struct { | ... | @@ -5746,7 +5746,7 @@ const Parser = struct { |
| 5746 | }; | 5746 | }; |
| 5747 | } | 5747 | } |
| 5748 | pub fn parseKEYWORD_break(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5750 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5751 | p.depths[def_index] += 1; | 5751 | p.depths[def_index] += 1; |
| 5752 | defer p.depths[def_index] -= 1; | 5752 | defer p.depths[def_index] -= 1; |
| ... | @@ -5764,7 +5764,7 @@ const Parser = struct { | ... | @@ -5764,7 +5764,7 @@ const Parser = struct { |
| 5764 | }; | 5764 | }; |
| 5765 | } | 5765 | } |
| 5766 | pub fn parseKEYWORD_callconv(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5768 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5769 | p.depths[def_index] += 1; | 5769 | p.depths[def_index] += 1; |
| 5770 | defer p.depths[def_index] -= 1; | 5770 | defer p.depths[def_index] -= 1; |
| ... | @@ -5782,7 +5782,7 @@ const Parser = struct { | ... | @@ -5782,7 +5782,7 @@ const Parser = struct { |
| 5782 | }; | 5782 | }; |
| 5783 | } | 5783 | } |
| 5784 | pub fn parseKEYWORD_catch(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5786 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5787 | p.depths[def_index] += 1; | 5787 | p.depths[def_index] += 1; |
| 5788 | defer p.depths[def_index] -= 1; | 5788 | defer p.depths[def_index] -= 1; |
| ... | @@ -5800,7 +5800,7 @@ const Parser = struct { | ... | @@ -5800,7 +5800,7 @@ const Parser = struct { |
| 5800 | }; | 5800 | }; |
| 5801 | } | 5801 | } |
| 5802 | pub fn parseKEYWORD_comptime(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5804 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5805 | p.depths[def_index] += 1; | 5805 | p.depths[def_index] += 1; |
| 5806 | defer p.depths[def_index] -= 1; | 5806 | defer p.depths[def_index] -= 1; |
| ... | @@ -5818,7 +5818,7 @@ const Parser = struct { | ... | @@ -5818,7 +5818,7 @@ const Parser = struct { |
| 5818 | }; | 5818 | }; |
| 5819 | } | 5819 | } |
| 5820 | pub fn parseKEYWORD_const(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5822 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5823 | p.depths[def_index] += 1; | 5823 | p.depths[def_index] += 1; |
| 5824 | defer p.depths[def_index] -= 1; | 5824 | defer p.depths[def_index] -= 1; |
| ... | @@ -5836,7 +5836,7 @@ const Parser = struct { | ... | @@ -5836,7 +5836,7 @@ const Parser = struct { |
| 5836 | }; | 5836 | }; |
| 5837 | } | 5837 | } |
| 5838 | pub fn parseKEYWORD_continue(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5840 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5841 | p.depths[def_index] += 1; | 5841 | p.depths[def_index] += 1; |
| 5842 | defer p.depths[def_index] -= 1; | 5842 | defer p.depths[def_index] -= 1; |
| ... | @@ -5854,7 +5854,7 @@ const Parser = struct { | ... | @@ -5854,7 +5854,7 @@ const Parser = struct { |
| 5854 | }; | 5854 | }; |
| 5855 | } | 5855 | } |
| 5856 | pub fn parseKEYWORD_defer(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5858 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5859 | p.depths[def_index] += 1; | 5859 | p.depths[def_index] += 1; |
| 5860 | defer p.depths[def_index] -= 1; | 5860 | defer p.depths[def_index] -= 1; |
| ... | @@ -5872,7 +5872,7 @@ const Parser = struct { | ... | @@ -5872,7 +5872,7 @@ const Parser = struct { |
| 5872 | }; | 5872 | }; |
| 5873 | } | 5873 | } |
| 5874 | pub fn parseKEYWORD_else(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5876 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5877 | p.depths[def_index] += 1; | 5877 | p.depths[def_index] += 1; |
| 5878 | defer p.depths[def_index] -= 1; | 5878 | defer p.depths[def_index] -= 1; |
| ... | @@ -5890,7 +5890,7 @@ const Parser = struct { | ... | @@ -5890,7 +5890,7 @@ const Parser = struct { |
| 5890 | }; | 5890 | }; |
| 5891 | } | 5891 | } |
| 5892 | pub fn parseKEYWORD_enum(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5894 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5895 | p.depths[def_index] += 1; | 5895 | p.depths[def_index] += 1; |
| 5896 | defer p.depths[def_index] -= 1; | 5896 | defer p.depths[def_index] -= 1; |
| ... | @@ -5908,7 +5908,7 @@ const Parser = struct { | ... | @@ -5908,7 +5908,7 @@ const Parser = struct { |
| 5908 | }; | 5908 | }; |
| 5909 | } | 5909 | } |
| 5910 | pub fn parseKEYWORD_errdefer(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5912 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5913 | p.depths[def_index] += 1; | 5913 | p.depths[def_index] += 1; |
| 5914 | defer p.depths[def_index] -= 1; | 5914 | defer p.depths[def_index] -= 1; |
| ... | @@ -5926,7 +5926,7 @@ const Parser = struct { | ... | @@ -5926,7 +5926,7 @@ const Parser = struct { |
| 5926 | }; | 5926 | }; |
| 5927 | } | 5927 | } |
| 5928 | pub fn parseKEYWORD_error(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5930 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5931 | p.depths[def_index] += 1; | 5931 | p.depths[def_index] += 1; |
| 5932 | defer p.depths[def_index] -= 1; | 5932 | defer p.depths[def_index] -= 1; |
| ... | @@ -5944,7 +5944,7 @@ const Parser = struct { | ... | @@ -5944,7 +5944,7 @@ const Parser = struct { |
| 5944 | }; | 5944 | }; |
| 5945 | } | 5945 | } |
| 5946 | pub fn parseKEYWORD_export(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5948 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5949 | p.depths[def_index] += 1; | 5949 | p.depths[def_index] += 1; |
| 5950 | defer p.depths[def_index] -= 1; | 5950 | defer p.depths[def_index] -= 1; |
| ... | @@ -5962,7 +5962,7 @@ const Parser = struct { | ... | @@ -5962,7 +5962,7 @@ const Parser = struct { |
| 5962 | }; | 5962 | }; |
| 5963 | } | 5963 | } |
| 5964 | pub fn parseKEYWORD_extern(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5966 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5967 | p.depths[def_index] += 1; | 5967 | p.depths[def_index] += 1; |
| 5968 | defer p.depths[def_index] -= 1; | 5968 | defer p.depths[def_index] -= 1; |
| ... | @@ -5980,7 +5980,7 @@ const Parser = struct { | ... | @@ -5980,7 +5980,7 @@ const Parser = struct { |
| 5980 | }; | 5980 | }; |
| 5981 | } | 5981 | } |
| 5982 | pub fn parseKEYWORD_fn(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 5984 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 5985 | p.depths[def_index] += 1; | 5985 | p.depths[def_index] += 1; |
| 5986 | defer p.depths[def_index] -= 1; | 5986 | defer p.depths[def_index] -= 1; |
| ... | @@ -5998,7 +5998,7 @@ const Parser = struct { | ... | @@ -5998,7 +5998,7 @@ const Parser = struct { |
| 5998 | }; | 5998 | }; |
| 5999 | } | 5999 | } |
| 6000 | pub fn parseKEYWORD_for(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6002 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6003 | p.depths[def_index] += 1; | 6003 | p.depths[def_index] += 1; |
| 6004 | defer p.depths[def_index] -= 1; | 6004 | defer p.depths[def_index] -= 1; |
| ... | @@ -6016,7 +6016,7 @@ const Parser = struct { | ... | @@ -6016,7 +6016,7 @@ const Parser = struct { |
| 6016 | }; | 6016 | }; |
| 6017 | } | 6017 | } |
| 6018 | pub fn parseKEYWORD_if(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6020 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6021 | p.depths[def_index] += 1; | 6021 | p.depths[def_index] += 1; |
| 6022 | defer p.depths[def_index] -= 1; | 6022 | defer p.depths[def_index] -= 1; |
| ... | @@ -6034,7 +6034,7 @@ const Parser = struct { | ... | @@ -6034,7 +6034,7 @@ const Parser = struct { |
| 6034 | }; | 6034 | }; |
| 6035 | } | 6035 | } |
| 6036 | pub fn parseKEYWORD_inline(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6038 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6039 | p.depths[def_index] += 1; | 6039 | p.depths[def_index] += 1; |
| 6040 | defer p.depths[def_index] -= 1; | 6040 | defer p.depths[def_index] -= 1; |
| ... | @@ -6052,7 +6052,7 @@ const Parser = struct { | ... | @@ -6052,7 +6052,7 @@ const Parser = struct { |
| 6052 | }; | 6052 | }; |
| 6053 | } | 6053 | } |
| 6054 | pub fn parseKEYWORD_noalias(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6056 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6057 | p.depths[def_index] += 1; | 6057 | p.depths[def_index] += 1; |
| 6058 | defer p.depths[def_index] -= 1; | 6058 | defer p.depths[def_index] -= 1; |
| ... | @@ -6070,7 +6070,7 @@ const Parser = struct { | ... | @@ -6070,7 +6070,7 @@ const Parser = struct { |
| 6070 | }; | 6070 | }; |
| 6071 | } | 6071 | } |
| 6072 | pub fn parseKEYWORD_nosuspend(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6074 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6075 | p.depths[def_index] += 1; | 6075 | p.depths[def_index] += 1; |
| 6076 | defer p.depths[def_index] -= 1; | 6076 | defer p.depths[def_index] -= 1; |
| ... | @@ -6088,7 +6088,7 @@ const Parser = struct { | ... | @@ -6088,7 +6088,7 @@ const Parser = struct { |
| 6088 | }; | 6088 | }; |
| 6089 | } | 6089 | } |
| 6090 | pub fn parseKEYWORD_noinline(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6092 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6093 | p.depths[def_index] += 1; | 6093 | p.depths[def_index] += 1; |
| 6094 | defer p.depths[def_index] -= 1; | 6094 | defer p.depths[def_index] -= 1; |
| ... | @@ -6106,7 +6106,7 @@ const Parser = struct { | ... | @@ -6106,7 +6106,7 @@ const Parser = struct { |
| 6106 | }; | 6106 | }; |
| 6107 | } | 6107 | } |
| 6108 | pub fn parseKEYWORD_opaque(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6110 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6111 | p.depths[def_index] += 1; | 6111 | p.depths[def_index] += 1; |
| 6112 | defer p.depths[def_index] -= 1; | 6112 | defer p.depths[def_index] -= 1; |
| ... | @@ -6124,7 +6124,7 @@ const Parser = struct { | ... | @@ -6124,7 +6124,7 @@ const Parser = struct { |
| 6124 | }; | 6124 | }; |
| 6125 | } | 6125 | } |
| 6126 | pub fn parseKEYWORD_or(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6128 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6129 | p.depths[def_index] += 1; | 6129 | p.depths[def_index] += 1; |
| 6130 | defer p.depths[def_index] -= 1; | 6130 | defer p.depths[def_index] -= 1; |
| ... | @@ -6142,7 +6142,7 @@ const Parser = struct { | ... | @@ -6142,7 +6142,7 @@ const Parser = struct { |
| 6142 | }; | 6142 | }; |
| 6143 | } | 6143 | } |
| 6144 | pub fn parseKEYWORD_orelse(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6146 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6147 | p.depths[def_index] += 1; | 6147 | p.depths[def_index] += 1; |
| 6148 | defer p.depths[def_index] -= 1; | 6148 | defer p.depths[def_index] -= 1; |
| ... | @@ -6160,7 +6160,7 @@ const Parser = struct { | ... | @@ -6160,7 +6160,7 @@ const Parser = struct { |
| 6160 | }; | 6160 | }; |
| 6161 | } | 6161 | } |
| 6162 | pub fn parseKEYWORD_packed(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6164 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6165 | p.depths[def_index] += 1; | 6165 | p.depths[def_index] += 1; |
| 6166 | defer p.depths[def_index] -= 1; | 6166 | defer p.depths[def_index] -= 1; |
| ... | @@ -6178,7 +6178,7 @@ const Parser = struct { | ... | @@ -6178,7 +6178,7 @@ const Parser = struct { |
| 6178 | }; | 6178 | }; |
| 6179 | } | 6179 | } |
| 6180 | pub fn parseKEYWORD_pub(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6182 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6183 | p.depths[def_index] += 1; | 6183 | p.depths[def_index] += 1; |
| 6184 | defer p.depths[def_index] -= 1; | 6184 | defer p.depths[def_index] -= 1; |
| ... | @@ -6196,7 +6196,7 @@ const Parser = struct { | ... | @@ -6196,7 +6196,7 @@ const Parser = struct { |
| 6196 | }; | 6196 | }; |
| 6197 | } | 6197 | } |
| 6198 | pub fn parseKEYWORD_resume(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6200 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6201 | p.depths[def_index] += 1; | 6201 | p.depths[def_index] += 1; |
| 6202 | defer p.depths[def_index] -= 1; | 6202 | defer p.depths[def_index] -= 1; |
| ... | @@ -6214,7 +6214,7 @@ const Parser = struct { | ... | @@ -6214,7 +6214,7 @@ const Parser = struct { |
| 6214 | }; | 6214 | }; |
| 6215 | } | 6215 | } |
| 6216 | pub fn parseKEYWORD_return(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6218 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6219 | p.depths[def_index] += 1; | 6219 | p.depths[def_index] += 1; |
| 6220 | defer p.depths[def_index] -= 1; | 6220 | defer p.depths[def_index] -= 1; |
| ... | @@ -6232,7 +6232,7 @@ const Parser = struct { | ... | @@ -6232,7 +6232,7 @@ const Parser = struct { |
| 6232 | }; | 6232 | }; |
| 6233 | } | 6233 | } |
| 6234 | pub fn parseKEYWORD_linksection(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6236 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6237 | p.depths[def_index] += 1; | 6237 | p.depths[def_index] += 1; |
| 6238 | defer p.depths[def_index] -= 1; | 6238 | defer p.depths[def_index] -= 1; |
| ... | @@ -6250,7 +6250,7 @@ const Parser = struct { | ... | @@ -6250,7 +6250,7 @@ const Parser = struct { |
| 6250 | }; | 6250 | }; |
| 6251 | } | 6251 | } |
| 6252 | pub fn parseKEYWORD_struct(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6254 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6255 | p.depths[def_index] += 1; | 6255 | p.depths[def_index] += 1; |
| 6256 | defer p.depths[def_index] -= 1; | 6256 | defer p.depths[def_index] -= 1; |
| ... | @@ -6268,7 +6268,7 @@ const Parser = struct { | ... | @@ -6268,7 +6268,7 @@ const Parser = struct { |
| 6268 | }; | 6268 | }; |
| 6269 | } | 6269 | } |
| 6270 | pub fn parseKEYWORD_suspend(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6272 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6273 | p.depths[def_index] += 1; | 6273 | p.depths[def_index] += 1; |
| 6274 | defer p.depths[def_index] -= 1; | 6274 | defer p.depths[def_index] -= 1; |
| ... | @@ -6286,7 +6286,7 @@ const Parser = struct { | ... | @@ -6286,7 +6286,7 @@ const Parser = struct { |
| 6286 | }; | 6286 | }; |
| 6287 | } | 6287 | } |
| 6288 | pub fn parseKEYWORD_switch(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6290 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6291 | p.depths[def_index] += 1; | 6291 | p.depths[def_index] += 1; |
| 6292 | defer p.depths[def_index] -= 1; | 6292 | defer p.depths[def_index] -= 1; |
| ... | @@ -6304,7 +6304,7 @@ const Parser = struct { | ... | @@ -6304,7 +6304,7 @@ const Parser = struct { |
| 6304 | }; | 6304 | }; |
| 6305 | } | 6305 | } |
| 6306 | pub fn parseKEYWORD_test(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6308 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6309 | p.depths[def_index] += 1; | 6309 | p.depths[def_index] += 1; |
| 6310 | defer p.depths[def_index] -= 1; | 6310 | defer p.depths[def_index] -= 1; |
| ... | @@ -6322,7 +6322,7 @@ const Parser = struct { | ... | @@ -6322,7 +6322,7 @@ const Parser = struct { |
| 6322 | }; | 6322 | }; |
| 6323 | } | 6323 | } |
| 6324 | pub fn parseKEYWORD_threadlocal(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6326 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6327 | p.depths[def_index] += 1; | 6327 | p.depths[def_index] += 1; |
| 6328 | defer p.depths[def_index] -= 1; | 6328 | defer p.depths[def_index] -= 1; |
| ... | @@ -6340,7 +6340,7 @@ const Parser = struct { | ... | @@ -6340,7 +6340,7 @@ const Parser = struct { |
| 6340 | }; | 6340 | }; |
| 6341 | } | 6341 | } |
| 6342 | pub fn parseKEYWORD_try(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6344 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6345 | p.depths[def_index] += 1; | 6345 | p.depths[def_index] += 1; |
| 6346 | defer p.depths[def_index] -= 1; | 6346 | defer p.depths[def_index] -= 1; |
| ... | @@ -6358,7 +6358,7 @@ const Parser = struct { | ... | @@ -6358,7 +6358,7 @@ const Parser = struct { |
| 6358 | }; | 6358 | }; |
| 6359 | } | 6359 | } |
| 6360 | pub fn parseKEYWORD_union(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6362 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6363 | p.depths[def_index] += 1; | 6363 | p.depths[def_index] += 1; |
| 6364 | defer p.depths[def_index] -= 1; | 6364 | defer p.depths[def_index] -= 1; |
| ... | @@ -6376,7 +6376,7 @@ const Parser = struct { | ... | @@ -6376,7 +6376,7 @@ const Parser = struct { |
| 6376 | }; | 6376 | }; |
| 6377 | } | 6377 | } |
| 6378 | pub fn parseKEYWORD_unreachable(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6380 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6381 | p.depths[def_index] += 1; | 6381 | p.depths[def_index] += 1; |
| 6382 | defer p.depths[def_index] -= 1; | 6382 | defer p.depths[def_index] -= 1; |
| ... | @@ -6394,7 +6394,7 @@ const Parser = struct { | ... | @@ -6394,7 +6394,7 @@ const Parser = struct { |
| 6394 | }; | 6394 | }; |
| 6395 | } | 6395 | } |
| 6396 | pub fn parseKEYWORD_var(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6398 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6399 | p.depths[def_index] += 1; | 6399 | p.depths[def_index] += 1; |
| 6400 | defer p.depths[def_index] -= 1; | 6400 | defer p.depths[def_index] -= 1; |
| ... | @@ -6412,7 +6412,7 @@ const Parser = struct { | ... | @@ -6412,7 +6412,7 @@ const Parser = struct { |
| 6412 | }; | 6412 | }; |
| 6413 | } | 6413 | } |
| 6414 | pub fn parseKEYWORD_volatile(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6416 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6417 | p.depths[def_index] += 1; | 6417 | p.depths[def_index] += 1; |
| 6418 | defer p.depths[def_index] -= 1; | 6418 | defer p.depths[def_index] -= 1; |
| ... | @@ -6430,7 +6430,7 @@ const Parser = struct { | ... | @@ -6430,7 +6430,7 @@ const Parser = struct { |
| 6430 | }; | 6430 | }; |
| 6431 | } | 6431 | } |
| 6432 | pub fn parseKEYWORD_while(p: *Parser) Error!bool { | 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 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6434 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6435 | p.depths[def_index] += 1; | 6435 | p.depths[def_index] += 1; |
| 6436 | defer p.depths[def_index] -= 1; | 6436 | defer p.depths[def_index] -= 1; |
| ... | @@ -6448,7 +6448,7 @@ const Parser = struct { | ... | @@ -6448,7 +6448,7 @@ const Parser = struct { |
| 6448 | }; | 6448 | }; |
| 6449 | } | 6449 | } |
| 6450 | pub fn parsekeyword(p: *Parser) Error!bool { | 6450 | pub fn parsekeyword(p: *Parser) Error!bool { |
| 6451 | const def_index = @intFromEnum(Def.defkeyword); | 6451 | const def_index = @backingInt(Def.defkeyword); |
| 6452 | if (p.depths[def_index] > max_depth) return error.MaxDepth; | 6452 | if (p.depths[def_index] > max_depth) return error.MaxDepth; |
| 6453 | p.depths[def_index] += 1; | 6453 | p.depths[def_index] += 1; |
| 6454 | defer p.depths[def_index] -= 1; | 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,13 +390,13 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target { |
| 390 | // sets one of them, that takes precedence. | 390 | // sets one of them, that takes precedence. |
| 391 | switch (query_cpu_arch) { | 391 | switch (query_cpu_arch) { |
| 392 | .x86_16 => { | 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 | .x86 => { | 395 | .x86 => { |
| 396 | if (!Target.x86.featureSetHasAny(query.cpu_features_add, .{ | 396 | if (!Target.x86.featureSetHasAny(query.cpu_features_add, .{ |
| 397 | .@"16bit_mode", .@"32bit_mode", | 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 | .arm, .armeb => { | 402 | .arm, .armeb => { |
| ... | @@ -404,7 +404,7 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target { | ... | @@ -404,7 +404,7 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target { |
| 404 | // What do we do if the user specifies +thumb_mode? | 404 | // What do we do if the user specifies +thumb_mode? |
| 405 | }, | 405 | }, |
| 406 | .thumb, .thumbeb => { | 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 | else => {}, | 409 | else => {}, |
| 410 | } | 410 | } |
| ... | @@ -452,16 +452,16 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target { | ... | @@ -452,16 +452,16 @@ pub fn resolveTargetQuery(io: Io, query: Target.Query) DetectError!Target { |
| 452 | // `-G <n>` to Clang...) We can't do the `-gpsize` hack because we can have multiple | 452 | // `-G <n>` to Clang...) We can't do the `-gpsize` hack because we can have multiple |
| 453 | // concurrent LLVM emit jobs, and command line options in LLVM are shared globally. So | 453 | // concurrent LLVM emit jobs, and command line options in LLVM are shared globally. So |
| 454 | // just force this feature off. Lovely stuff. | 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 | // https://github.com/llvm/llvm-project/issues/105978 | 458 | // https://github.com/llvm/llvm-project/issues/105978 |
| 459 | if (result.cpu.arch.isArm() and result.abi.float() == .soft) { | 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 | if (result.cpu.arch.isXtensa() and result.abi == .call0) { | 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,7 +972,7 @@ fn detectAbiAndDynamicLinker(io: Io, cpu: Target.Cpu, os: Target.Os, query: Targ |
| 972 | // and supported by Zig. But that means that we must detect the system ABI here rather than | 972 | // and supported by Zig. But that means that we must detect the system ABI here rather than |
| 973 | // relying on `builtin.target`. | 973 | // relying on `builtin.target`. |
| 974 | const all_abis = comptime blk: { | 974 | const all_abis = comptime blk: { |
| 975 | assert(@intFromEnum(Target.Abi.none) == 0); | 975 | assert(@backingInt(Target.Abi.none) == 0); |
| 976 | const field_names = std.meta.fieldNames(Target.Abi)[1..]; | 976 | const field_names = std.meta.fieldNames(Target.Abi)[1..]; |
| 977 | var array: [field_names.len]Target.Abi = undefined; | 977 | var array: [field_names.len]Target.Abi = undefined; |
| 978 | for (field_names, 0..) |field_name, i| { | 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,7 +233,7 @@ pub const cpu_models = struct { |
| 233 | 233 | ||
| 234 | pub const aarch64 = struct { | 234 | pub const aarch64 = struct { |
| 235 | fn setFeature(cpu: *Target.Cpu, feature: Target.aarch64.Feature, enabled: bool) void { | 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 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); | 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,7 +13,7 @@ inline fn bit(input: u32, offset: u5) bool { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | fn setFeature(cpu: *std.Target.Cpu, feature: std.Target.loongarch.Feature, enabled: bool) void { | 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 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); | 18 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); |
| 19 | } | 19 | } |
| ... | @@ -26,7 +26,7 @@ pub fn detectNativeCpuAndFeatures( | ... | @@ -26,7 +26,7 @@ pub fn detectNativeCpuAndFeatures( |
| 26 | _ = os; | 26 | _ = os; |
| 27 | _ = query; | 27 | _ = query; |
| 28 | 28 | ||
| 29 | const variant: Variant = @enumFromInt(cpucfg(1) & 0b11); | 29 | const variant: Variant = @fromBackingInt(@intCast(cpucfg(1) & 0b11)); |
| 30 | 30 | ||
| 31 | var cpu: std.Target.Cpu = .{ | 31 | var cpu: std.Target.Cpu = .{ |
| 32 | .arch = arch, | 32 | .arch = arch, |
lib/std/zig/system/windows.zig+2-2| ... | @@ -43,7 +43,7 @@ pub fn detectRuntimeVersion() WindowsVersion { | ... | @@ -43,7 +43,7 @@ pub fn detectRuntimeVersion() WindowsVersion { |
| 43 | 43 | ||
| 44 | const version: u32 = @as(u32, os_ver) << 16 | @as(u16, sp_ver) << 8 | sub_ver; | 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 | // Technically, a registry value can be as long as 1MB. However, MS recommends storing | 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,7 +188,7 @@ fn getCpuInfoFromRegistry(core: usize, args: anytype) !void { |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | fn setFeature(comptime Feature: type, cpu: *Target.Cpu, feature: Feature, enabled: bool) void { | 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 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); | 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,7 +28,7 @@ const Xcr0 = packed struct(u32) { |
| 28 | }; | 28 | }; |
| 29 | 29 | ||
| 30 | fn setFeature(cpu: *Target.Cpu, feature: Target.x86.Feature, enabled: bool) void { | 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 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); | 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,7 +377,7 @@ pub const Iterator = struct { |
| 377 | if (end > extra.len) | 377 | if (end > extra.len) |
| 378 | return error.ZipBadExtraFieldSize; | 378 | return error.ZipBadExtraFieldSize; |
| 379 | const data = extra[extra_offset + 4 .. end]; | 379 | const data = extra[extra_offset + 4 .. end]; |
| 380 | switch (@as(ExtraHeader, @enumFromInt(header_id))) { | 380 | switch (@as(ExtraHeader, @fromBackingInt(@intCast(header_id)))) { |
| 381 | .zip64_info => try readZip64FileExtents(CentralDirectoryFileHeader, header, &extents, data), | 381 | .zip64_info => try readZip64FileExtents(CentralDirectoryFileHeader, header, &extents, data), |
| 382 | else => {}, // ignore | 382 | else => {}, // ignore |
| 383 | } | 383 | } |
| ... | @@ -485,7 +485,7 @@ pub const Iterator = struct { | ... | @@ -485,7 +485,7 @@ pub const Iterator = struct { |
| 485 | if (end > local_header.extra_len) | 485 | if (end > local_header.extra_len) |
| 486 | return error.ZipBadExtraFieldSize; | 486 | return error.ZipBadExtraFieldSize; |
| 487 | const data = extra[extra_offset + 4 .. end]; | 487 | const data = extra[extra_offset + 4 .. end]; |
| 488 | switch (@as(ExtraHeader, @enumFromInt(header_id))) { | 488 | switch (@as(ExtraHeader, @fromBackingInt(@intCast(header_id)))) { |
| 489 | .zip64_info => try readZip64FileExtents(LocalFileHeader, local_header, &extents, data), | 489 | .zip64_info => try readZip64FileExtents(LocalFileHeader, local_header, &extents, data), |
| 490 | else => {}, // ignore | 490 | else => {}, // ignore |
| 491 | } | 491 | } |
lib/std/zon/parse.zig+2-2| ... | @@ -183,7 +183,7 @@ pub const Error = union(enum) { | ... | @@ -183,7 +183,7 @@ pub const Error = union(enum) { |
| 183 | location.column += node_or_offset; | 183 | location.column += node_or_offset; |
| 184 | return location; | 184 | return location; |
| 185 | } else { | 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 | const token = ast.nodeMainToken(ast_node); | 187 | const token = ast.nodeMainToken(ast_node); |
| 188 | return ast.tokenLocation(0, token); | 188 | return ast.tokenLocation(0, token); |
| 189 | } | 189 | } |
| ... | @@ -672,7 +672,7 @@ const Parser = struct { | ... | @@ -672,7 +672,7 @@ const Parser = struct { |
| 672 | const enum_info = @typeInfo(T).@"enum"; | 672 | const enum_info = @typeInfo(T).@"enum"; |
| 673 | comptime var kvs_list: [enum_info.field_names.len]struct { []const u8, T } = undefined; | 673 | comptime var kvs_list: [enum_info.field_names.len]struct { []const u8, T } = undefined; |
| 674 | inline for (enum_info.field_names, enum_info.field_values, 0..) |enum_field_name, enum_field_value, i| { | 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 | const enum_tags = std.StaticStringMap(T).initComptime(kvs_list); | 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,9 +1052,9 @@ pub const Inst = struct { |
| 1052 | _, | 1052 | _, |
| 1053 | 1053 | ||
| 1054 | pub fn unwrap(index: Index) union(enum) { ref: Inst.Ref, target: u31 } { | 1054 | pub fn unwrap(index: Index) union(enum) { ref: Inst.Ref, target: u31 } { |
| 1055 | const low_index: u31 = @truncate(@intFromEnum(index)); | 1055 | const low_index: u31 = @truncate(@backingInt(index)); |
| 1056 | return switch (@as(u1, @intCast(@intFromEnum(index) >> 31))) { | 1056 | return switch (@as(u1, @intCast(@backingInt(index) >> 31))) { |
| 1057 | 0 => .{ .ref = @enumFromInt(@as(u32, 1 << 31) | low_index) }, | 1057 | 0 => .{ .ref = @fromBackingInt(@intCast(@as(u32, 1 << 31) | low_index)) }, |
| 1058 | 1 => .{ .target = low_index }, | 1058 | 1 => .{ .target = low_index }, |
| 1059 | }; | 1059 | }; |
| 1060 | } | 1060 | } |
| ... | @@ -1064,7 +1064,7 @@ pub const Inst = struct { | ... | @@ -1064,7 +1064,7 @@ pub const Inst = struct { |
| 1064 | } | 1064 | } |
| 1065 | 1065 | ||
| 1066 | pub fn fromTargetIndex(index: u31) Index { | 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 | pub fn toTargetIndex(index: Index) u31 { | 1070 | pub fn toTargetIndex(index: Index) u31 { |
| ... | @@ -1077,7 +1077,7 @@ pub const Inst = struct { | ... | @@ -1077,7 +1077,7 @@ pub const Inst = struct { |
| 1077 | .ref => {}, | 1077 | .ref => {}, |
| 1078 | .target => try w.writeByte('t'), | 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,138 +1087,138 @@ pub const Inst = struct { |
| 1087 | /// | 1087 | /// |
| 1088 | /// The ref `none` is an exception: it has the tag bit set but refers to the InternPool. | 1088 | /// The ref `none` is an exception: it has the tag bit set but refers to the InternPool. |
| 1089 | pub const Ref = enum(u32) { | 1089 | pub const Ref = enum(u32) { |
| 1090 | u0_type = @intFromEnum(InternPool.Index.u0_type), | 1090 | u0_type = @backingInt(InternPool.Index.u0_type), |
| 1091 | u1_type = @intFromEnum(InternPool.Index.u1_type), | 1091 | u1_type = @backingInt(InternPool.Index.u1_type), |
| 1092 | u8_type = @intFromEnum(InternPool.Index.u8_type), | 1092 | u8_type = @backingInt(InternPool.Index.u8_type), |
| 1093 | i8_type = @intFromEnum(InternPool.Index.i8_type), | 1093 | i8_type = @backingInt(InternPool.Index.i8_type), |
| 1094 | u16_type = @intFromEnum(InternPool.Index.u16_type), | 1094 | u16_type = @backingInt(InternPool.Index.u16_type), |
| 1095 | i16_type = @intFromEnum(InternPool.Index.i16_type), | 1095 | i16_type = @backingInt(InternPool.Index.i16_type), |
| 1096 | u29_type = @intFromEnum(InternPool.Index.u29_type), | 1096 | u29_type = @backingInt(InternPool.Index.u29_type), |
| 1097 | u32_type = @intFromEnum(InternPool.Index.u32_type), | 1097 | u32_type = @backingInt(InternPool.Index.u32_type), |
| 1098 | i32_type = @intFromEnum(InternPool.Index.i32_type), | 1098 | i32_type = @backingInt(InternPool.Index.i32_type), |
| 1099 | u64_type = @intFromEnum(InternPool.Index.u64_type), | 1099 | u64_type = @backingInt(InternPool.Index.u64_type), |
| 1100 | i64_type = @intFromEnum(InternPool.Index.i64_type), | 1100 | i64_type = @backingInt(InternPool.Index.i64_type), |
| 1101 | u80_type = @intFromEnum(InternPool.Index.u80_type), | 1101 | u80_type = @backingInt(InternPool.Index.u80_type), |
| 1102 | u128_type = @intFromEnum(InternPool.Index.u128_type), | 1102 | u128_type = @backingInt(InternPool.Index.u128_type), |
| 1103 | i128_type = @intFromEnum(InternPool.Index.i128_type), | 1103 | i128_type = @backingInt(InternPool.Index.i128_type), |
| 1104 | u256_type = @intFromEnum(InternPool.Index.u256_type), | 1104 | u256_type = @backingInt(InternPool.Index.u256_type), |
| 1105 | usize_type = @intFromEnum(InternPool.Index.usize_type), | 1105 | usize_type = @backingInt(InternPool.Index.usize_type), |
| 1106 | isize_type = @intFromEnum(InternPool.Index.isize_type), | 1106 | isize_type = @backingInt(InternPool.Index.isize_type), |
| 1107 | c_char_type = @intFromEnum(InternPool.Index.c_char_type), | 1107 | c_char_type = @backingInt(InternPool.Index.c_char_type), |
| 1108 | c_short_type = @intFromEnum(InternPool.Index.c_short_type), | 1108 | c_short_type = @backingInt(InternPool.Index.c_short_type), |
| 1109 | c_ushort_type = @intFromEnum(InternPool.Index.c_ushort_type), | 1109 | c_ushort_type = @backingInt(InternPool.Index.c_ushort_type), |
| 1110 | c_int_type = @intFromEnum(InternPool.Index.c_int_type), | 1110 | c_int_type = @backingInt(InternPool.Index.c_int_type), |
| 1111 | c_uint_type = @intFromEnum(InternPool.Index.c_uint_type), | 1111 | c_uint_type = @backingInt(InternPool.Index.c_uint_type), |
| 1112 | c_long_type = @intFromEnum(InternPool.Index.c_long_type), | 1112 | c_long_type = @backingInt(InternPool.Index.c_long_type), |
| 1113 | c_ulong_type = @intFromEnum(InternPool.Index.c_ulong_type), | 1113 | c_ulong_type = @backingInt(InternPool.Index.c_ulong_type), |
| 1114 | c_longlong_type = @intFromEnum(InternPool.Index.c_longlong_type), | 1114 | c_longlong_type = @backingInt(InternPool.Index.c_longlong_type), |
| 1115 | c_ulonglong_type = @intFromEnum(InternPool.Index.c_ulonglong_type), | 1115 | c_ulonglong_type = @backingInt(InternPool.Index.c_ulonglong_type), |
| 1116 | c_longdouble_type = @intFromEnum(InternPool.Index.c_longdouble_type), | 1116 | c_longdouble_type = @backingInt(InternPool.Index.c_longdouble_type), |
| 1117 | f16_type = @intFromEnum(InternPool.Index.f16_type), | 1117 | f16_type = @backingInt(InternPool.Index.f16_type), |
| 1118 | f32_type = @intFromEnum(InternPool.Index.f32_type), | 1118 | f32_type = @backingInt(InternPool.Index.f32_type), |
| 1119 | f64_type = @intFromEnum(InternPool.Index.f64_type), | 1119 | f64_type = @backingInt(InternPool.Index.f64_type), |
| 1120 | f80_type = @intFromEnum(InternPool.Index.f80_type), | 1120 | f80_type = @backingInt(InternPool.Index.f80_type), |
| 1121 | f128_type = @intFromEnum(InternPool.Index.f128_type), | 1121 | f128_type = @backingInt(InternPool.Index.f128_type), |
| 1122 | anyopaque_type = @intFromEnum(InternPool.Index.anyopaque_type), | 1122 | anyopaque_type = @backingInt(InternPool.Index.anyopaque_type), |
| 1123 | bool_type = @intFromEnum(InternPool.Index.bool_type), | 1123 | bool_type = @backingInt(InternPool.Index.bool_type), |
| 1124 | void_type = @intFromEnum(InternPool.Index.void_type), | 1124 | void_type = @backingInt(InternPool.Index.void_type), |
| 1125 | type_type = @intFromEnum(InternPool.Index.type_type), | 1125 | type_type = @backingInt(InternPool.Index.type_type), |
| 1126 | anyerror_type = @intFromEnum(InternPool.Index.anyerror_type), | 1126 | anyerror_type = @backingInt(InternPool.Index.anyerror_type), |
| 1127 | comptime_int_type = @intFromEnum(InternPool.Index.comptime_int_type), | 1127 | comptime_int_type = @backingInt(InternPool.Index.comptime_int_type), |
| 1128 | comptime_float_type = @intFromEnum(InternPool.Index.comptime_float_type), | 1128 | comptime_float_type = @backingInt(InternPool.Index.comptime_float_type), |
| 1129 | noreturn_type = @intFromEnum(InternPool.Index.noreturn_type), | 1129 | noreturn_type = @backingInt(InternPool.Index.noreturn_type), |
| 1130 | anyframe_type = @intFromEnum(InternPool.Index.anyframe_type), | 1130 | anyframe_type = @backingInt(InternPool.Index.anyframe_type), |
| 1131 | null_type = @intFromEnum(InternPool.Index.null_type), | 1131 | null_type = @backingInt(InternPool.Index.null_type), |
| 1132 | undefined_type = @intFromEnum(InternPool.Index.undefined_type), | 1132 | undefined_type = @backingInt(InternPool.Index.undefined_type), |
| 1133 | enum_literal_type = @intFromEnum(InternPool.Index.enum_literal_type), | 1133 | enum_literal_type = @backingInt(InternPool.Index.enum_literal_type), |
| 1134 | ptr_usize_type = @intFromEnum(InternPool.Index.ptr_usize_type), | 1134 | ptr_usize_type = @backingInt(InternPool.Index.ptr_usize_type), |
| 1135 | ptr_const_comptime_int_type = @intFromEnum(InternPool.Index.ptr_const_comptime_int_type), | 1135 | ptr_const_comptime_int_type = @backingInt(InternPool.Index.ptr_const_comptime_int_type), |
| 1136 | manyptr_u8_type = @intFromEnum(InternPool.Index.manyptr_u8_type), | 1136 | manyptr_u8_type = @backingInt(InternPool.Index.manyptr_u8_type), |
| 1137 | manyptr_const_u8_type = @intFromEnum(InternPool.Index.manyptr_const_u8_type), | 1137 | manyptr_const_u8_type = @backingInt(InternPool.Index.manyptr_const_u8_type), |
| 1138 | manyptr_const_u8_sentinel_0_type = @intFromEnum(InternPool.Index.manyptr_const_u8_sentinel_0_type), | 1138 | manyptr_const_u8_sentinel_0_type = @backingInt(InternPool.Index.manyptr_const_u8_sentinel_0_type), |
| 1139 | slice_const_u8_type = @intFromEnum(InternPool.Index.slice_const_u8_type), | 1139 | slice_const_u8_type = @backingInt(InternPool.Index.slice_const_u8_type), |
| 1140 | slice_const_u8_sentinel_0_type = @intFromEnum(InternPool.Index.slice_const_u8_sentinel_0_type), | 1140 | slice_const_u8_sentinel_0_type = @backingInt(InternPool.Index.slice_const_u8_sentinel_0_type), |
| 1141 | manyptr_const_slice_const_u8_type = @intFromEnum(InternPool.Index.manyptr_const_slice_const_u8_type), | 1141 | manyptr_const_slice_const_u8_type = @backingInt(InternPool.Index.manyptr_const_slice_const_u8_type), |
| 1142 | slice_const_slice_const_u8_type = @intFromEnum(InternPool.Index.slice_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 = @intFromEnum(InternPool.Index.optional_type_type), | 1143 | optional_type_type = @backingInt(InternPool.Index.optional_type_type), |
| 1144 | manyptr_const_type_type = @intFromEnum(InternPool.Index.manyptr_const_type_type), | 1144 | manyptr_const_type_type = @backingInt(InternPool.Index.manyptr_const_type_type), |
| 1145 | slice_const_type_type = @intFromEnum(InternPool.Index.slice_const_type_type), | 1145 | slice_const_type_type = @backingInt(InternPool.Index.slice_const_type_type), |
| 1146 | vector_8_i8_type = @intFromEnum(InternPool.Index.vector_8_i8_type), | 1146 | vector_8_i8_type = @backingInt(InternPool.Index.vector_8_i8_type), |
| 1147 | vector_16_i8_type = @intFromEnum(InternPool.Index.vector_16_i8_type), | 1147 | vector_16_i8_type = @backingInt(InternPool.Index.vector_16_i8_type), |
| 1148 | vector_32_i8_type = @intFromEnum(InternPool.Index.vector_32_i8_type), | 1148 | vector_32_i8_type = @backingInt(InternPool.Index.vector_32_i8_type), |
| 1149 | vector_64_i8_type = @intFromEnum(InternPool.Index.vector_64_i8_type), | 1149 | vector_64_i8_type = @backingInt(InternPool.Index.vector_64_i8_type), |
| 1150 | vector_1_u8_type = @intFromEnum(InternPool.Index.vector_1_u8_type), | 1150 | vector_1_u8_type = @backingInt(InternPool.Index.vector_1_u8_type), |
| 1151 | vector_2_u8_type = @intFromEnum(InternPool.Index.vector_2_u8_type), | 1151 | vector_2_u8_type = @backingInt(InternPool.Index.vector_2_u8_type), |
| 1152 | vector_4_u8_type = @intFromEnum(InternPool.Index.vector_4_u8_type), | 1152 | vector_4_u8_type = @backingInt(InternPool.Index.vector_4_u8_type), |
| 1153 | vector_8_u8_type = @intFromEnum(InternPool.Index.vector_8_u8_type), | 1153 | vector_8_u8_type = @backingInt(InternPool.Index.vector_8_u8_type), |
| 1154 | vector_16_u8_type = @intFromEnum(InternPool.Index.vector_16_u8_type), | 1154 | vector_16_u8_type = @backingInt(InternPool.Index.vector_16_u8_type), |
| 1155 | vector_32_u8_type = @intFromEnum(InternPool.Index.vector_32_u8_type), | 1155 | vector_32_u8_type = @backingInt(InternPool.Index.vector_32_u8_type), |
| 1156 | vector_64_u8_type = @intFromEnum(InternPool.Index.vector_64_u8_type), | 1156 | vector_64_u8_type = @backingInt(InternPool.Index.vector_64_u8_type), |
| 1157 | vector_2_i16_type = @intFromEnum(InternPool.Index.vector_2_i16_type), | 1157 | vector_2_i16_type = @backingInt(InternPool.Index.vector_2_i16_type), |
| 1158 | vector_4_i16_type = @intFromEnum(InternPool.Index.vector_4_i16_type), | 1158 | vector_4_i16_type = @backingInt(InternPool.Index.vector_4_i16_type), |
| 1159 | vector_8_i16_type = @intFromEnum(InternPool.Index.vector_8_i16_type), | 1159 | vector_8_i16_type = @backingInt(InternPool.Index.vector_8_i16_type), |
| 1160 | vector_16_i16_type = @intFromEnum(InternPool.Index.vector_16_i16_type), | 1160 | vector_16_i16_type = @backingInt(InternPool.Index.vector_16_i16_type), |
| 1161 | vector_32_i16_type = @intFromEnum(InternPool.Index.vector_32_i16_type), | 1161 | vector_32_i16_type = @backingInt(InternPool.Index.vector_32_i16_type), |
| 1162 | vector_4_u16_type = @intFromEnum(InternPool.Index.vector_4_u16_type), | 1162 | vector_4_u16_type = @backingInt(InternPool.Index.vector_4_u16_type), |
| 1163 | vector_8_u16_type = @intFromEnum(InternPool.Index.vector_8_u16_type), | 1163 | vector_8_u16_type = @backingInt(InternPool.Index.vector_8_u16_type), |
| 1164 | vector_16_u16_type = @intFromEnum(InternPool.Index.vector_16_u16_type), | 1164 | vector_16_u16_type = @backingInt(InternPool.Index.vector_16_u16_type), |
| 1165 | vector_32_u16_type = @intFromEnum(InternPool.Index.vector_32_u16_type), | 1165 | vector_32_u16_type = @backingInt(InternPool.Index.vector_32_u16_type), |
| 1166 | vector_2_i32_type = @intFromEnum(InternPool.Index.vector_2_i32_type), | 1166 | vector_2_i32_type = @backingInt(InternPool.Index.vector_2_i32_type), |
| 1167 | vector_4_i32_type = @intFromEnum(InternPool.Index.vector_4_i32_type), | 1167 | vector_4_i32_type = @backingInt(InternPool.Index.vector_4_i32_type), |
| 1168 | vector_8_i32_type = @intFromEnum(InternPool.Index.vector_8_i32_type), | 1168 | vector_8_i32_type = @backingInt(InternPool.Index.vector_8_i32_type), |
| 1169 | vector_16_i32_type = @intFromEnum(InternPool.Index.vector_16_i32_type), | 1169 | vector_16_i32_type = @backingInt(InternPool.Index.vector_16_i32_type), |
| 1170 | vector_4_u32_type = @intFromEnum(InternPool.Index.vector_4_u32_type), | 1170 | vector_4_u32_type = @backingInt(InternPool.Index.vector_4_u32_type), |
| 1171 | vector_8_u32_type = @intFromEnum(InternPool.Index.vector_8_u32_type), | 1171 | vector_8_u32_type = @backingInt(InternPool.Index.vector_8_u32_type), |
| 1172 | vector_16_u32_type = @intFromEnum(InternPool.Index.vector_16_u32_type), | 1172 | vector_16_u32_type = @backingInt(InternPool.Index.vector_16_u32_type), |
| 1173 | vector_2_i64_type = @intFromEnum(InternPool.Index.vector_2_i64_type), | 1173 | vector_2_i64_type = @backingInt(InternPool.Index.vector_2_i64_type), |
| 1174 | vector_4_i64_type = @intFromEnum(InternPool.Index.vector_4_i64_type), | 1174 | vector_4_i64_type = @backingInt(InternPool.Index.vector_4_i64_type), |
| 1175 | vector_8_i64_type = @intFromEnum(InternPool.Index.vector_8_i64_type), | 1175 | vector_8_i64_type = @backingInt(InternPool.Index.vector_8_i64_type), |
| 1176 | vector_2_u64_type = @intFromEnum(InternPool.Index.vector_2_u64_type), | 1176 | vector_2_u64_type = @backingInt(InternPool.Index.vector_2_u64_type), |
| 1177 | vector_4_u64_type = @intFromEnum(InternPool.Index.vector_4_u64_type), | 1177 | vector_4_u64_type = @backingInt(InternPool.Index.vector_4_u64_type), |
| 1178 | vector_8_u64_type = @intFromEnum(InternPool.Index.vector_8_u64_type), | 1178 | vector_8_u64_type = @backingInt(InternPool.Index.vector_8_u64_type), |
| 1179 | vector_1_u128_type = @intFromEnum(InternPool.Index.vector_1_u128_type), | 1179 | vector_1_u128_type = @backingInt(InternPool.Index.vector_1_u128_type), |
| 1180 | vector_2_u128_type = @intFromEnum(InternPool.Index.vector_2_u128_type), | 1180 | vector_2_u128_type = @backingInt(InternPool.Index.vector_2_u128_type), |
| 1181 | vector_1_u256_type = @intFromEnum(InternPool.Index.vector_1_u256_type), | 1181 | vector_1_u256_type = @backingInt(InternPool.Index.vector_1_u256_type), |
| 1182 | vector_4_f16_type = @intFromEnum(InternPool.Index.vector_4_f16_type), | 1182 | vector_4_f16_type = @backingInt(InternPool.Index.vector_4_f16_type), |
| 1183 | vector_8_f16_type = @intFromEnum(InternPool.Index.vector_8_f16_type), | 1183 | vector_8_f16_type = @backingInt(InternPool.Index.vector_8_f16_type), |
| 1184 | vector_16_f16_type = @intFromEnum(InternPool.Index.vector_16_f16_type), | 1184 | vector_16_f16_type = @backingInt(InternPool.Index.vector_16_f16_type), |
| 1185 | vector_32_f16_type = @intFromEnum(InternPool.Index.vector_32_f16_type), | 1185 | vector_32_f16_type = @backingInt(InternPool.Index.vector_32_f16_type), |
| 1186 | vector_2_f32_type = @intFromEnum(InternPool.Index.vector_2_f32_type), | 1186 | vector_2_f32_type = @backingInt(InternPool.Index.vector_2_f32_type), |
| 1187 | vector_4_f32_type = @intFromEnum(InternPool.Index.vector_4_f32_type), | 1187 | vector_4_f32_type = @backingInt(InternPool.Index.vector_4_f32_type), |
| 1188 | vector_8_f32_type = @intFromEnum(InternPool.Index.vector_8_f32_type), | 1188 | vector_8_f32_type = @backingInt(InternPool.Index.vector_8_f32_type), |
| 1189 | vector_16_f32_type = @intFromEnum(InternPool.Index.vector_16_f32_type), | 1189 | vector_16_f32_type = @backingInt(InternPool.Index.vector_16_f32_type), |
| 1190 | vector_2_f64_type = @intFromEnum(InternPool.Index.vector_2_f64_type), | 1190 | vector_2_f64_type = @backingInt(InternPool.Index.vector_2_f64_type), |
| 1191 | vector_4_f64_type = @intFromEnum(InternPool.Index.vector_4_f64_type), | 1191 | vector_4_f64_type = @backingInt(InternPool.Index.vector_4_f64_type), |
| 1192 | vector_8_f64_type = @intFromEnum(InternPool.Index.vector_8_f64_type), | 1192 | vector_8_f64_type = @backingInt(InternPool.Index.vector_8_f64_type), |
| 1193 | optional_noreturn_type = @intFromEnum(InternPool.Index.optional_noreturn_type), | 1193 | optional_noreturn_type = @backingInt(InternPool.Index.optional_noreturn_type), |
| 1194 | anyerror_void_error_union_type = @intFromEnum(InternPool.Index.anyerror_void_error_union_type), | 1194 | anyerror_void_error_union_type = @backingInt(InternPool.Index.anyerror_void_error_union_type), |
| 1195 | adhoc_inferred_error_set_type = @intFromEnum(InternPool.Index.adhoc_inferred_error_set_type), | 1195 | adhoc_inferred_error_set_type = @backingInt(InternPool.Index.adhoc_inferred_error_set_type), |
| 1196 | generic_poison_type = @intFromEnum(InternPool.Index.generic_poison_type), | 1196 | generic_poison_type = @backingInt(InternPool.Index.generic_poison_type), |
| 1197 | empty_tuple_type = @intFromEnum(InternPool.Index.empty_tuple_type), | 1197 | empty_tuple_type = @backingInt(InternPool.Index.empty_tuple_type), |
| 1198 | undef = @intFromEnum(InternPool.Index.undef), | 1198 | undef = @backingInt(InternPool.Index.undef), |
| 1199 | undef_bool = @intFromEnum(InternPool.Index.undef_bool), | 1199 | undef_bool = @backingInt(InternPool.Index.undef_bool), |
| 1200 | undef_usize = @intFromEnum(InternPool.Index.undef_usize), | 1200 | undef_usize = @backingInt(InternPool.Index.undef_usize), |
| 1201 | undef_u1 = @intFromEnum(InternPool.Index.undef_u1), | 1201 | undef_u1 = @backingInt(InternPool.Index.undef_u1), |
| 1202 | zero = @intFromEnum(InternPool.Index.zero), | 1202 | zero = @backingInt(InternPool.Index.zero), |
| 1203 | zero_usize = @intFromEnum(InternPool.Index.zero_usize), | 1203 | zero_usize = @backingInt(InternPool.Index.zero_usize), |
| 1204 | zero_u1 = @intFromEnum(InternPool.Index.zero_u1), | 1204 | zero_u1 = @backingInt(InternPool.Index.zero_u1), |
| 1205 | zero_u8 = @intFromEnum(InternPool.Index.zero_u8), | 1205 | zero_u8 = @backingInt(InternPool.Index.zero_u8), |
| 1206 | one = @intFromEnum(InternPool.Index.one), | 1206 | one = @backingInt(InternPool.Index.one), |
| 1207 | one_usize = @intFromEnum(InternPool.Index.one_usize), | 1207 | one_usize = @backingInt(InternPool.Index.one_usize), |
| 1208 | one_u1 = @intFromEnum(InternPool.Index.one_u1), | 1208 | one_u1 = @backingInt(InternPool.Index.one_u1), |
| 1209 | one_u8 = @intFromEnum(InternPool.Index.one_u8), | 1209 | one_u8 = @backingInt(InternPool.Index.one_u8), |
| 1210 | four_u8 = @intFromEnum(InternPool.Index.four_u8), | 1210 | four_u8 = @backingInt(InternPool.Index.four_u8), |
| 1211 | negative_one = @intFromEnum(InternPool.Index.negative_one), | 1211 | negative_one = @backingInt(InternPool.Index.negative_one), |
| 1212 | void_value = @intFromEnum(InternPool.Index.void_value), | 1212 | void_value = @backingInt(InternPool.Index.void_value), |
| 1213 | unreachable_value = @intFromEnum(InternPool.Index.unreachable_value), | 1213 | unreachable_value = @backingInt(InternPool.Index.unreachable_value), |
| 1214 | null_value = @intFromEnum(InternPool.Index.null_value), | 1214 | null_value = @backingInt(InternPool.Index.null_value), |
| 1215 | bool_true = @intFromEnum(InternPool.Index.bool_true), | 1215 | bool_true = @backingInt(InternPool.Index.bool_true), |
| 1216 | bool_false = @intFromEnum(InternPool.Index.bool_false), | 1216 | bool_false = @backingInt(InternPool.Index.bool_false), |
| 1217 | empty_tuple = @intFromEnum(InternPool.Index.empty_tuple), | 1217 | empty_tuple = @backingInt(InternPool.Index.empty_tuple), |
| 1218 | 1218 | ||
| 1219 | /// This Ref does not correspond to any AIR instruction or constant | 1219 | /// This Ref does not correspond to any AIR instruction or constant |
| 1220 | /// value and may instead be used as a sentinel to indicate null. | 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 | pub fn toInterned(ref: Ref) ?InternPool.Index { | 1224 | pub fn toInterned(ref: Ref) ?InternPool.Index { |
| ... | @@ -1229,8 +1229,8 @@ pub const Inst = struct { | ... | @@ -1229,8 +1229,8 @@ pub const Inst = struct { |
| 1229 | pub fn toInternedAllowNone(ref: Ref) ?InternPool.Index { | 1229 | pub fn toInternedAllowNone(ref: Ref) ?InternPool.Index { |
| 1230 | return switch (ref) { | 1230 | return switch (ref) { |
| 1231 | .none => .none, | 1231 | .none => .none, |
| 1232 | else => if (@intFromEnum(ref) >> 31 == 0) | 1232 | else => if (@backingInt(ref) >> 31 == 0) |
| 1233 | @enumFromInt(@as(u31, @truncate(@intFromEnum(ref)))) | 1233 | @fromBackingInt(@intCast(@as(u31, @truncate(@backingInt(ref))))) |
| 1234 | else | 1234 | else |
| 1235 | null, | 1235 | null, |
| 1236 | }; | 1236 | }; |
| ... | @@ -1244,8 +1244,8 @@ pub const Inst = struct { | ... | @@ -1244,8 +1244,8 @@ pub const Inst = struct { |
| 1244 | pub fn toIndexAllowNone(ref: Ref) ?Index { | 1244 | pub fn toIndexAllowNone(ref: Ref) ?Index { |
| 1245 | return switch (ref) { | 1245 | return switch (ref) { |
| 1246 | .none => null, | 1246 | .none => null, |
| 1247 | else => if (@intFromEnum(ref) >> 31 != 0) | 1247 | else => if (@backingInt(ref) >> 31 != 0) |
| 1248 | @enumFromInt(@as(u31, @truncate(@intFromEnum(ref)))) | 1248 | @fromBackingInt(@intCast(@as(u31, @truncate(@backingInt(ref))))) |
| 1249 | else | 1249 | else |
| 1250 | null, | 1250 | null, |
| 1251 | }; | 1251 | }; |
| ... | @@ -1259,8 +1259,8 @@ pub const Inst = struct { | ... | @@ -1259,8 +1259,8 @@ pub const Inst = struct { |
| 1259 | return switch (ip_index) { | 1259 | return switch (ip_index) { |
| 1260 | .none => .none, | 1260 | .none => .none, |
| 1261 | else => { | 1261 | else => { |
| 1262 | assert(@intFromEnum(ip_index) >> 31 == 0); | 1262 | assert(@backingInt(ip_index) >> 31 == 0); |
| 1263 | return @enumFromInt(@as(u31, @intCast(@intFromEnum(ip_index)))); | 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,11 +1452,11 @@ pub const VectorCmp = struct { |
| 1452 | op: u32, | 1452 | op: u32, |
| 1453 | 1453 | ||
| 1454 | pub fn compareOperator(self: VectorCmp) std.math.CompareOperator { | 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 | pub fn encodeOp(compare_operator: std.math.CompareOperator) u32 { | 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,7 +1469,7 @@ pub const ShuffleOneMask = packed struct(u32) { |
| 1469 | return .{ .index = @intCast(idx), .kind = .elem }; | 1469 | return .{ .index = @intCast(idx), .kind = .elem }; |
| 1470 | } | 1470 | } |
| 1471 | pub fn value(val: Value) ShuffleOneMask { | 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 | pub const Unwrapped = union(enum) { | 1474 | pub const Unwrapped = union(enum) { |
| 1475 | /// The resulting element is this index into the runtime vector. | 1475 | /// The resulting element is this index into the runtime vector. |
| ... | @@ -1481,7 +1481,7 @@ pub const ShuffleOneMask = packed struct(u32) { | ... | @@ -1481,7 +1481,7 @@ pub const ShuffleOneMask = packed struct(u32) { |
| 1481 | pub fn unwrap(raw: ShuffleOneMask) Unwrapped { | 1481 | pub fn unwrap(raw: ShuffleOneMask) Unwrapped { |
| 1482 | return switch (raw.kind) { | 1482 | return switch (raw.kind) { |
| 1483 | .elem => .{ .elem = raw.index }, | 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,10 +1492,10 @@ pub const ShuffleTwoMask = enum(u32) { |
| 1492 | undef = std.math.maxInt(u32), | 1492 | undef = std.math.maxInt(u32), |
| 1493 | _, | 1493 | _, |
| 1494 | pub fn aElem(idx: u32) ShuffleTwoMask { | 1494 | pub fn aElem(idx: u32) ShuffleTwoMask { |
| 1495 | return @enumFromInt(idx << 1); | 1495 | return @fromBackingInt(@intCast(idx << 1)); |
| 1496 | } | 1496 | } |
| 1497 | pub fn bElem(idx: u32) ShuffleTwoMask { | 1497 | pub fn bElem(idx: u32) ShuffleTwoMask { |
| 1498 | return @enumFromInt(idx << 1 | 1); | 1498 | return @fromBackingInt(@intCast(idx << 1 | 1)); |
| 1499 | } | 1499 | } |
| 1500 | pub const Unwrapped = union(enum) { | 1500 | pub const Unwrapped = union(enum) { |
| 1501 | /// The resulting element is this index into the first runtime vector. | 1501 | /// The resulting element is this index into the first runtime vector. |
| ... | @@ -1510,7 +1510,7 @@ pub const ShuffleTwoMask = enum(u32) { | ... | @@ -1510,7 +1510,7 @@ pub const ShuffleTwoMask = enum(u32) { |
| 1510 | .undef => return .undef, | 1510 | .undef => return .undef, |
| 1511 | _ => {}, | 1511 | _ => {}, |
| 1512 | } | 1512 | } |
| 1513 | const x = @intFromEnum(raw); | 1513 | const x = @backingInt(raw); |
| 1514 | return switch (@as(u1, @truncate(x))) { | 1514 | return switch (@as(u1, @truncate(x))) { |
| 1515 | 0 => .{ .a_elem = x >> 1 }, | 1515 | 0 => .{ .a_elem = x >> 1 }, |
| 1516 | 1 => .{ .b_elem = x >> 1 }, | 1516 | 1 => .{ .b_elem = x >> 1 }, |
| ... | @@ -1556,11 +1556,11 @@ pub const Cmpxchg = struct { | ... | @@ -1556,11 +1556,11 @@ pub const Cmpxchg = struct { |
| 1556 | flags: u32, | 1556 | flags: u32, |
| 1557 | 1557 | ||
| 1558 | pub fn successOrder(self: Cmpxchg) std.lang.AtomicOrder { | 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 | pub fn failureOrder(self: Cmpxchg) std.lang.AtomicOrder { | 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,11 +1571,11 @@ pub const AtomicRmw = struct { |
| 1571 | flags: u32, | 1571 | flags: u32, |
| 1572 | 1572 | ||
| 1573 | pub fn ordering(self: AtomicRmw) std.lang.AtomicOrder { | 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 | pub fn op(self: AtomicRmw) std.lang.AtomicRmwOp { | 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,7 +1585,7 @@ pub const UnionInit = struct { |
| 1585 | }; | 1585 | }; |
| 1586 | 1586 | ||
| 1587 | pub fn getMainBody(air: Air) []const Air.Inst.Index { | 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 | const extra = air.extraData(Block, body_index); | 1589 | const extra = air.extraData(Block, body_index); |
| 1590 | return @ptrCast(air.extra.items[extra.end..][0..extra.data.body_len]); | 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,7 +1600,7 @@ pub fn typeOf(air: *const Air, inst: Air.Inst.Ref, ip: *const InternPool) Type { |
| 1600 | 1600 | ||
| 1601 | pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) Type { | 1601 | pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) Type { |
| 1602 | const datas = air.instructions.items(.data); | 1602 | const datas = air.instructions.items(.data); |
| 1603 | switch (air.instructions.items(.tag)[@intFromEnum(inst)]) { | 1603 | switch (air.instructions.items(.tag)[@backingInt(inst)]) { |
| 1604 | .add, | 1604 | .add, |
| 1605 | .add_safe, | 1605 | .add_safe, |
| 1606 | .add_wrap, | 1606 | .add_wrap, |
| ... | @@ -1640,7 +1640,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) | ... | @@ -1640,7 +1640,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1640 | .div_exact_optimized, | 1640 | .div_exact_optimized, |
| 1641 | .rem_optimized, | 1641 | .rem_optimized, |
| 1642 | .mod_optimized, | 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 | .sqrt, | 1645 | .sqrt, |
| 1646 | .sin, | 1646 | .sin, |
| ... | @@ -1657,7 +1657,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) | ... | @@ -1657,7 +1657,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1657 | .trunc_float, | 1657 | .trunc_float, |
| 1658 | .neg, | 1658 | .neg, |
| 1659 | .neg_optimized, | 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 | .cmp_lt, | 1662 | .cmp_lt, |
| 1663 | .cmp_lte, | 1663 | .cmp_lte, |
| ... | @@ -1688,9 +1688,9 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) | ... | @@ -1688,9 +1688,9 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1688 | .ret_ptr, | 1688 | .ret_ptr, |
| 1689 | .err_return_trace, | 1689 | .err_return_trace, |
| 1690 | .c_va_start, | 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 | .assembly, | 1695 | .assembly, |
| 1696 | .block, | 1696 | .block, |
| ... | @@ -1717,7 +1717,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) | ... | @@ -1717,7 +1717,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1717 | .try_ptr_cold, | 1717 | .try_ptr_cold, |
| 1718 | .shuffle_one, | 1718 | .shuffle_one, |
| 1719 | .shuffle_two, | 1719 | .shuffle_two, |
| 1720 | => return datas[@intFromEnum(inst)].ty_pl.ty.toType(), | 1720 | => return datas[@backingInt(inst)].ty_pl.ty.toType(), |
| 1721 | 1721 | ||
| 1722 | .not, | 1722 | .not, |
| 1723 | .bit_cast, | 1723 | .bit_cast, |
| ... | @@ -1770,7 +1770,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) | ... | @@ -1770,7 +1770,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1770 | .c_va_arg, | 1770 | .c_va_arg, |
| 1771 | .c_va_copy, | 1771 | .c_va_copy, |
| 1772 | .abs, | 1772 | .abs, |
| 1773 | => return datas[@intFromEnum(inst)].ty_op.ty.toType(), | 1773 | => return datas[@backingInt(inst)].ty_op.ty.toType(), |
| 1774 | 1774 | ||
| 1775 | .loop, | 1775 | .loop, |
| 1776 | .repeat, | 1776 | .repeat, |
| ... | @@ -1821,40 +1821,40 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) | ... | @@ -1821,40 +1821,40 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1821 | .tag_name, .error_name => return .slice_const_u8_sentinel_0, | 1821 | .tag_name, .error_name => return .slice_const_u8_sentinel_0, |
| 1822 | 1822 | ||
| 1823 | .call, .call_always_tail, .call_never_tail, .call_never_inline => { | 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 | return .fromInterned(ip.funcTypeReturnType(callee_ty.toIntern())); | 1825 | return .fromInterned(ip.funcTypeReturnType(callee_ty.toIntern())); |
| 1826 | }, | 1826 | }, |
| 1827 | 1827 | ||
| 1828 | .slice_elem_val, .ptr_elem_val, .array_elem_val, .legalize_vec_elem_val => { | 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 | return ptr_ty.childTypeIp(ip); | 1830 | return ptr_ty.childTypeIp(ip); |
| 1831 | }, | 1831 | }, |
| 1832 | .atomic_load => { | 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 | return ptr_ty.childTypeIp(ip); | 1834 | return ptr_ty.childTypeIp(ip); |
| 1835 | }, | 1835 | }, |
| 1836 | .atomic_rmw => { | 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 | return ptr_ty.childTypeIp(ip); | 1838 | return ptr_ty.childTypeIp(ip); |
| 1839 | }, | 1839 | }, |
| 1840 | 1840 | ||
| 1841 | .reduce, .reduce_optimized => { | 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 | return .fromInterned(ip.indexToKey(operand_ty.ip_index).vector_type.child); | 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 | .select => { | 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 | return air.typeOf(extra.lhs, ip); | 1849 | return air.typeOf(extra.lhs, ip); |
| 1850 | }, | 1850 | }, |
| 1851 | 1851 | ||
| 1852 | .@"try", .try_cold => { | 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 | return .fromInterned(ip.indexToKey(err_union_ty.ip_index).error_union_type.payload_type); | 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 | .work_item_id, | 1859 | .work_item_id, |
| 1860 | .work_group_size, | 1860 | .work_group_size, |
| ... | @@ -1862,7 +1862,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) | ... | @@ -1862,7 +1862,7 @@ pub fn typeOfIndex(air: *const Air, inst: Air.Inst.Index, ip: *const InternPool) |
| 1862 | .spirv_runtime_array_len, | 1862 | .spirv_runtime_array_len, |
| 1863 | => return .u32, | 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 | .inferred_alloc => unreachable, | 1867 | .inferred_alloc => unreachable, |
| 1868 | .inferred_alloc_comptime => unreachable, | 1868 | .inferred_alloc_comptime => unreachable, |
| ... | @@ -1878,7 +1878,7 @@ pub fn extraData(air: Air, comptime T: type, index: usize) struct { data: T, end | ... | @@ -1878,7 +1878,7 @@ pub fn extraData(air: Air, comptime T: type, index: usize) struct { data: T, end |
| 1878 | inline for (info.field_names, info.field_types) |field_name, field_type| { | 1878 | inline for (info.field_names, info.field_types) |field_name, field_type| { |
| 1879 | @field(result, field_name) = switch (field_type) { | 1879 | @field(result, field_name) = switch (field_type) { |
| 1880 | u32 => air.extra.items[i], | 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 | i32, CondBr.BranchHints, Asm.Flags => @bitCast(air.extra.items[i]), | 1882 | i32, CondBr.BranchHints, Asm.Flags => @bitCast(air.extra.items[i]), |
| 1883 | else => @compileError("bad field type: " ++ @typeName(field_type)), | 1883 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 1884 | }; | 1884 | }; |
| ... | @@ -1906,7 +1906,7 @@ pub const NullTerminatedString = enum(u32) { | ... | @@ -1906,7 +1906,7 @@ pub const NullTerminatedString = enum(u32) { |
| 1906 | 1906 | ||
| 1907 | pub fn toSlice(nts: NullTerminatedString, air: Air) [:0]const u8 { | 1907 | pub fn toSlice(nts: NullTerminatedString, air: Air) [:0]const u8 { |
| 1908 | if (nts == .none) return ""; | 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 | return bytes[0..std.mem.indexOfScalar(u8, bytes, 0).? :0]; | 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,8 +1916,8 @@ pub const NullTerminatedString = enum(u32) { |
| 1916 | /// lowered, and Liveness determines its result is unused, backends should | 1916 | /// lowered, and Liveness determines its result is unused, backends should |
| 1917 | /// avoid lowering it. | 1917 | /// avoid lowering it. |
| 1918 | pub fn mustLower(air: Air, inst: Air.Inst.Index, ip: *const InternPool) bool { | 1918 | pub fn mustLower(air: Air, inst: Air.Inst.Index, ip: *const InternPool) bool { |
| 1919 | const data = air.instructions.items(.data)[@intFromEnum(inst)]; | 1919 | const data = air.instructions.items(.data)[@backingInt(inst)]; |
| 1920 | return switch (air.instructions.items(.tag)[@intFromEnum(inst)]) { | 1920 | return switch (air.instructions.items(.tag)[@backingInt(inst)]) { |
| 1921 | .arg, | 1921 | .arg, |
| 1922 | .assembly, | 1922 | .assembly, |
| 1923 | .block, | 1923 | .block, |
| ... | @@ -2165,7 +2165,7 @@ pub const UnwrappedSwitch = struct { | ... | @@ -2165,7 +2165,7 @@ pub const UnwrappedSwitch = struct { |
| 2165 | fn getHintInner(us: UnwrappedSwitch, idx: u32) std.lang.BranchHint { | 2165 | fn getHintInner(us: UnwrappedSwitch, idx: u32) std.lang.BranchHint { |
| 2166 | const bag = us.air.extra.items[us.branch_hints_start..][idx / 10]; | 2166 | const bag = us.air.extra.items[us.branch_hints_start..][idx / 10]; |
| 2167 | const bits: u3 = @truncate(bag >> @intCast(3 * (idx % 10))); | 2167 | const bits: u3 = @truncate(bag >> @intCast(3 * (idx % 10))); |
| 2168 | return @enumFromInt(bits); | 2168 | return @fromBackingInt(@intCast(bits)); |
| 2169 | } | 2169 | } |
| 2170 | 2170 | ||
| 2171 | pub fn iterateCases(us: UnwrappedSwitch) CaseIterator { | 2171 | pub fn iterateCases(us: UnwrappedSwitch) CaseIterator { |
| ... | @@ -2224,7 +2224,7 @@ pub const UnwrappedSwitch = struct { | ... | @@ -2224,7 +2224,7 @@ pub const UnwrappedSwitch = struct { |
| 2224 | }; | 2224 | }; |
| 2225 | 2225 | ||
| 2226 | pub fn unwrapSwitch(air: *const Air, switch_inst: Inst.Index) UnwrappedSwitch { | 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 | switch (inst.tag) { | 2228 | switch (inst.tag) { |
| 2229 | .switch_br, .loop_switch_br => {}, | 2229 | .switch_br, .loop_switch_br => {}, |
| 2230 | else => unreachable, // assertion failure | 2230 | else => unreachable, // assertion failure |
| ... | @@ -2249,8 +2249,8 @@ pub const UnwrappedDbgInlineBlock = struct { | ... | @@ -2249,8 +2249,8 @@ pub const UnwrappedDbgInlineBlock = struct { |
| 2249 | }; | 2249 | }; |
| 2250 | 2250 | ||
| 2251 | pub fn unwrapDbgBlock(air: *const Air, inst_index: Inst.Index) UnwrappedDbgInlineBlock { | 2251 | pub fn unwrapDbgBlock(air: *const Air, inst_index: Inst.Index) UnwrappedDbgInlineBlock { |
| 2252 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | 2252 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; |
| 2253 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | 2253 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; |
| 2254 | assert(tag == .dbg_inline_block); | 2254 | assert(tag == .dbg_inline_block); |
| 2255 | const payload = data.ty_pl.payload; | 2255 | const payload = data.ty_pl.payload; |
| 2256 | const extra = air.extraData(Air.DbgInlineBlock, payload); | 2256 | const extra = air.extraData(Air.DbgInlineBlock, payload); |
| ... | @@ -2267,8 +2267,8 @@ pub const UnwrappedBlock = struct { | ... | @@ -2267,8 +2267,8 @@ pub const UnwrappedBlock = struct { |
| 2267 | }; | 2267 | }; |
| 2268 | 2268 | ||
| 2269 | pub fn unwrapBlock(air: *const Air, inst_index: Inst.Index) UnwrappedBlock { | 2269 | pub fn unwrapBlock(air: *const Air, inst_index: Inst.Index) UnwrappedBlock { |
| 2270 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | 2270 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; |
| 2271 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | 2271 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; |
| 2272 | const payload = switch (tag) { | 2272 | const payload = switch (tag) { |
| 2273 | .block, .loop => data.ty_pl.payload, | 2273 | .block, .loop => data.ty_pl.payload, |
| 2274 | else => unreachable, | 2274 | else => unreachable, |
| ... | @@ -2286,8 +2286,8 @@ pub const UnwrappedCall = struct { | ... | @@ -2286,8 +2286,8 @@ pub const UnwrappedCall = struct { |
| 2286 | }; | 2286 | }; |
| 2287 | 2287 | ||
| 2288 | pub fn unwrapCall(air: *const Air, inst_index: Inst.Index) UnwrappedCall { | 2288 | pub fn unwrapCall(air: *const Air, inst_index: Inst.Index) UnwrappedCall { |
| 2289 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | 2289 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; |
| 2290 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | 2290 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; |
| 2291 | const payload = switch (tag) { | 2291 | const payload = switch (tag) { |
| 2292 | .call, .call_always_tail, .call_never_tail, .call_never_inline => data.pl_op.payload, | 2292 | .call, .call_always_tail, .call_never_tail, .call_never_inline => data.pl_op.payload, |
| 2293 | else => unreachable, | 2293 | else => unreachable, |
| ... | @@ -2305,8 +2305,8 @@ pub const UnwrappedCompilerRtCall = struct { | ... | @@ -2305,8 +2305,8 @@ pub const UnwrappedCompilerRtCall = struct { |
| 2305 | }; | 2305 | }; |
| 2306 | 2306 | ||
| 2307 | pub fn unwrapCompilerRtCall(air: *const Air, inst_index: Inst.Index) UnwrappedCompilerRtCall { | 2307 | pub fn unwrapCompilerRtCall(air: *const Air, inst_index: Inst.Index) UnwrappedCompilerRtCall { |
| 2308 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | 2308 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; |
| 2309 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | 2309 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; |
| 2310 | assert(tag == .legalize_compiler_rt_call); | 2310 | assert(tag == .legalize_compiler_rt_call); |
| 2311 | const payload = data.legalize_compiler_rt_call.payload; | 2311 | const payload = data.legalize_compiler_rt_call.payload; |
| 2312 | const extra = air.extraData(Air.Call, payload); | 2312 | const extra = air.extraData(Air.Call, payload); |
| ... | @@ -2324,8 +2324,8 @@ pub const UnwrappedCondBr = struct { | ... | @@ -2324,8 +2324,8 @@ pub const UnwrappedCondBr = struct { |
| 2324 | }; | 2324 | }; |
| 2325 | 2325 | ||
| 2326 | pub fn unwrapCondBr(air: *const Air, inst_index: Inst.Index) UnwrappedCondBr { | 2326 | pub fn unwrapCondBr(air: *const Air, inst_index: Inst.Index) UnwrappedCondBr { |
| 2327 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | 2327 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; |
| 2328 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | 2328 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; |
| 2329 | assert(tag == .cond_br); | 2329 | assert(tag == .cond_br); |
| 2330 | const payload = data.pl_op.payload; | 2330 | const payload = data.pl_op.payload; |
| 2331 | const extra = air.extraData(Air.CondBr, payload); | 2331 | const extra = air.extraData(Air.CondBr, payload); |
| ... | @@ -2343,8 +2343,8 @@ pub const UnwrappedTry = struct { | ... | @@ -2343,8 +2343,8 @@ pub const UnwrappedTry = struct { |
| 2343 | }; | 2343 | }; |
| 2344 | 2344 | ||
| 2345 | pub fn unwrapTry(air: *const Air, inst_index: Inst.Index) UnwrappedTry { | 2345 | pub fn unwrapTry(air: *const Air, inst_index: Inst.Index) UnwrappedTry { |
| 2346 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | 2346 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; |
| 2347 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | 2347 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; |
| 2348 | assert(tag == .@"try" or tag == .try_cold); | 2348 | assert(tag == .@"try" or tag == .try_cold); |
| 2349 | const payload = data.pl_op.payload; | 2349 | const payload = data.pl_op.payload; |
| 2350 | const extra = air.extraData(Air.Try, payload); | 2350 | const extra = air.extraData(Air.Try, payload); |
| ... | @@ -2361,8 +2361,8 @@ pub const UnwrappedTryPtr = struct { | ... | @@ -2361,8 +2361,8 @@ pub const UnwrappedTryPtr = struct { |
| 2361 | }; | 2361 | }; |
| 2362 | 2362 | ||
| 2363 | pub fn unwrapTryPtr(air: *const Air, inst_index: Inst.Index) UnwrappedTryPtr { | 2363 | pub fn unwrapTryPtr(air: *const Air, inst_index: Inst.Index) UnwrappedTryPtr { |
| 2364 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | 2364 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; |
| 2365 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | 2365 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; |
| 2366 | assert(tag == .try_ptr or tag == .try_ptr_cold); | 2366 | assert(tag == .try_ptr or tag == .try_ptr_cold); |
| 2367 | const payload = data.ty_pl.payload; | 2367 | const payload = data.ty_pl.payload; |
| 2368 | const extra = air.extraData(Air.TryPtr, payload); | 2368 | const extra = air.extraData(Air.TryPtr, payload); |
| ... | @@ -2430,8 +2430,8 @@ pub const UnwrappedAsm = struct { | ... | @@ -2430,8 +2430,8 @@ pub const UnwrappedAsm = struct { |
| 2430 | }; | 2430 | }; |
| 2431 | 2431 | ||
| 2432 | pub fn unwrapAsm(air: *const Air, inst_index: Inst.Index) UnwrappedAsm { | 2432 | pub fn unwrapAsm(air: *const Air, inst_index: Inst.Index) UnwrappedAsm { |
| 2433 | const data = air.instructions.items(.data)[@intFromEnum(inst_index)]; | 2433 | const data = air.instructions.items(.data)[@backingInt(inst_index)]; |
| 2434 | const tag = air.instructions.items(.tag)[@intFromEnum(inst_index)]; | 2434 | const tag = air.instructions.items(.tag)[@backingInt(inst_index)]; |
| 2435 | assert(tag == .assembly); | 2435 | assert(tag == .assembly); |
| 2436 | const payload = data.ty_pl.payload; | 2436 | const payload = data.ty_pl.payload; |
| 2437 | const extra = air.extraData(Air.Asm, payload); | 2437 | const extra = air.extraData(Air.Asm, payload); |
| ... | @@ -2465,7 +2465,7 @@ pub const UnwrappedShuffleOne = struct { | ... | @@ -2465,7 +2465,7 @@ pub const UnwrappedShuffleOne = struct { |
| 2465 | }; | 2465 | }; |
| 2466 | 2466 | ||
| 2467 | pub fn unwrapShuffleOne(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index) UnwrappedShuffleOne { | 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 | switch (inst.tag) { | 2469 | switch (inst.tag) { |
| 2470 | .shuffle_one => {}, | 2470 | .shuffle_one => {}, |
| 2471 | else => unreachable, // assertion failure | 2471 | else => unreachable, // assertion failure |
| ... | @@ -2475,7 +2475,7 @@ pub fn unwrapShuffleOne(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index | ... | @@ -2475,7 +2475,7 @@ pub fn unwrapShuffleOne(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index |
| 2475 | const extra_idx = inst.data.ty_pl.payload; | 2475 | const extra_idx = inst.data.ty_pl.payload; |
| 2476 | return .{ | 2476 | return .{ |
| 2477 | .result_ty = result_ty, | 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 | .mask = @ptrCast(air.extra.items[extra_idx..][0..mask_len]), | 2479 | .mask = @ptrCast(air.extra.items[extra_idx..][0..mask_len]), |
| 2480 | }; | 2480 | }; |
| 2481 | } | 2481 | } |
| ... | @@ -2488,7 +2488,7 @@ pub const UnwrappedShuffleTwo = struct { | ... | @@ -2488,7 +2488,7 @@ pub const UnwrappedShuffleTwo = struct { |
| 2488 | }; | 2488 | }; |
| 2489 | 2489 | ||
| 2490 | pub fn unwrapShuffleTwo(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index) UnwrappedShuffleTwo { | 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 | switch (inst.tag) { | 2492 | switch (inst.tag) { |
| 2493 | .shuffle_two => {}, | 2493 | .shuffle_two => {}, |
| 2494 | else => unreachable, // assertion failure | 2494 | else => unreachable, // assertion failure |
| ... | @@ -2498,8 +2498,8 @@ pub fn unwrapShuffleTwo(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index | ... | @@ -2498,8 +2498,8 @@ pub fn unwrapShuffleTwo(air: *const Air, zcu: *const Zcu, inst_index: Inst.Index |
| 2498 | const extra_idx = inst.data.ty_pl.payload; | 2498 | const extra_idx = inst.data.ty_pl.payload; |
| 2499 | return .{ | 2499 | return .{ |
| 2500 | .result_ty = result_ty, | 2500 | .result_ty = result_ty, |
| 2501 | .operand_a = @enumFromInt(air.extra.items[extra_idx + mask_len + 0]), | 2501 | .operand_a = @fromBackingInt(@intCast(air.extra.items[extra_idx + mask_len + 0])), |
| 2502 | .operand_b = @enumFromInt(air.extra.items[extra_idx + mask_len + 1]), | 2502 | .operand_b = @fromBackingInt(@intCast(air.extra.items[extra_idx + mask_len + 1])), |
| 2503 | .mask = @ptrCast(air.extra.items[extra_idx..][0..mask_len]), | 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,7 +328,7 @@ pub fn legalize(air: *Air, pt: Zcu.PerThread, features: *const Features) Error!v |
| 328 | .features = .init(features), | 328 | .features = .init(features), |
| 329 | }; | 329 | }; |
| 330 | defer air.* = l.getTmpAir(); | 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 | try l.legalizeBody(main_extra.end, main_extra.data.body_len); | 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,8 +359,8 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 359 | const zcu = l.pt.zcu; | 359 | const zcu = l.pt.zcu; |
| 360 | const ip = &zcu.intern_pool; | 360 | const ip = &zcu.intern_pool; |
| 361 | for (0..body_len) |body_index| { | 361 | for (0..body_len) |body_index| { |
| 362 | const inst: Air.Inst.Index = @enumFromInt(l.air_extra.items[body_start + body_index]); | 362 | const inst: Air.Inst.Index = @fromBackingInt(@intCast(l.air_extra.items[body_start + body_index])); |
| 363 | inst: switch (l.air_instructions.items(.tag)[@intFromEnum(inst)]) { | 363 | inst: switch (l.air_instructions.items(.tag)[@backingInt(inst)]) { |
| 364 | .arg => {}, | 364 | .arg => {}, |
| 365 | inline .add, | 365 | inline .add, |
| 366 | .add_optimized, | 366 | .add_optimized, |
| ... | @@ -377,7 +377,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -377,7 +377,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 377 | .min, | 377 | .min, |
| 378 | .max, | 378 | .max, |
| 379 | => |air_tag| { | 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 | const ty = l.typeOf(bin_op.lhs); | 381 | const ty = l.typeOf(bin_op.lhs); |
| 382 | switch (l.wantScalarizeOrSoftFloat(air_tag, ty)) { | 382 | switch (l.wantScalarizeOrSoftFloat(air_tag, ty)) { |
| 383 | .none => {}, | 383 | .none => {}, |
| ... | @@ -395,7 +395,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -395,7 +395,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 395 | .div_floor, | 395 | .div_floor, |
| 396 | .div_floor_optimized, | 396 | .div_floor_optimized, |
| 397 | => |air_tag| { | 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 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(bin_op.lhs))) { | 399 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(bin_op.lhs))) { |
| 400 | .none => {}, | 400 | .none => {}, |
| 401 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)), | 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,7 +408,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 408 | } | 408 | } |
| 409 | }, | 409 | }, |
| 410 | inline .mod, .mod_optimized => |air_tag| { | 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 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(bin_op.lhs))) { | 412 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(bin_op.lhs))) { |
| 413 | .none => {}, | 413 | .none => {}, |
| 414 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)), | 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,7 +429,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 429 | .bit_or, | 429 | .bit_or, |
| 430 | .xor, | 430 | .xor, |
| 431 | => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) { | 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 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { | 433 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { |
| 434 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)); | 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,7 +438,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 438 | assert(!l.features.has(.scalarize_add_safe)); // it doesn't make sense to do both | 438 | assert(!l.features.has(.scalarize_add_safe)); // it doesn't make sense to do both |
| 439 | continue :inst l.replaceInst(inst, .block, try l.safeArithmeticBlockPayload(inst, .add_with_overflow)); | 439 | continue :inst l.replaceInst(inst, .block, try l.safeArithmeticBlockPayload(inst, .add_with_overflow)); |
| 440 | } else if (l.features.has(.scalarize_add_safe)) { | 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 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { | 442 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { |
| 443 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)); | 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,7 +447,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 447 | assert(!l.features.has(.scalarize_sub_safe)); // it doesn't make sense to do both | 447 | assert(!l.features.has(.scalarize_sub_safe)); // it doesn't make sense to do both |
| 448 | continue :inst l.replaceInst(inst, .block, try l.safeArithmeticBlockPayload(inst, .sub_with_overflow)); | 448 | continue :inst l.replaceInst(inst, .block, try l.safeArithmeticBlockPayload(inst, .sub_with_overflow)); |
| 449 | } else if (l.features.has(.scalarize_sub_safe)) { | 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 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { | 451 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { |
| 452 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)); | 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,7 +456,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 456 | assert(!l.features.has(.scalarize_mul_safe)); // it doesn't make sense to do both | 456 | assert(!l.features.has(.scalarize_mul_safe)); // it doesn't make sense to do both |
| 457 | continue :inst l.replaceInst(inst, .block, try l.safeArithmeticBlockPayload(inst, .mul_with_overflow)); | 457 | continue :inst l.replaceInst(inst, .block, try l.safeArithmeticBlockPayload(inst, .mul_with_overflow)); |
| 458 | } else if (l.features.has(.scalarize_mul_safe)) { | 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 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { | 460 | if (l.typeOf(bin_op.lhs).isVector(zcu)) { |
| 461 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)); | 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,7 +467,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 467 | .mul_with_overflow, | 467 | .mul_with_overflow, |
| 468 | .shl_with_overflow, | 468 | .shl_with_overflow, |
| 469 | => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) { | 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 | if (ty_pl.ty.toType().fieldType(0, zcu).isVector(zcu)) { | 471 | if (ty_pl.ty.toType().fieldType(0, zcu).isVector(zcu)) { |
| 472 | continue :inst l.replaceInst(inst, .block, try l.scalarizeOverflowBlockPayload(inst)); | 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,7 +484,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 484 | .unsplat_shift_rhs, | 484 | .unsplat_shift_rhs, |
| 485 | .scalarize(air_tag), | 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 | if (l.typeOf(bin_op.rhs).isVector(zcu)) { | 488 | if (l.typeOf(bin_op.rhs).isVector(zcu)) { |
| 489 | if (l.features.has(.unsplat_shift_rhs)) { | 489 | if (l.features.has(.unsplat_shift_rhs)) { |
| 490 | if (bin_op.rhs.toInterned()) |rhs_ip_index| switch (ip.indexToKey(rhs_ip_index)) { | 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,11 +498,11 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 498 | }, | 498 | }, |
| 499 | } else { | 499 | } else { |
| 500 | const rhs_inst = bin_op.rhs.toIndex().?; | 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 | else => {}, | 502 | else => {}, |
| 503 | .splat => continue :inst l.replaceInst(inst, air_tag, .{ .bin_op = .{ | 503 | .splat => continue :inst l.replaceInst(inst, air_tag, .{ .bin_op = .{ |
| 504 | .lhs = bin_op.lhs, | 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,13 +524,13 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 524 | .int_from_ptr, | 524 | .int_from_ptr, |
| 525 | .trunc, | 525 | .trunc, |
| 526 | => |air_tag| if (l.features.has(comptime .scalarize(air_tag))) { | 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 | if (ty_op.ty.toType().isVector(zcu)) { | 528 | if (ty_op.ty.toType().isVector(zcu)) { |
| 529 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)); | 529 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)); |
| 530 | } | 530 | } |
| 531 | }, | 531 | }, |
| 532 | .abs => { | 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 | switch (l.wantScalarizeOrSoftFloat(.abs, ty_op.ty.toType())) { | 534 | switch (l.wantScalarizeOrSoftFloat(.abs, ty_op.ty.toType())) { |
| 535 | .none => {}, | 535 | .none => {}, |
| 536 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)), | 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,7 +543,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 543 | } | 543 | } |
| 544 | }, | 544 | }, |
| 545 | .fptrunc => { | 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 | const src_ty = l.typeOf(ty_op.operand); | 547 | const src_ty = l.typeOf(ty_op.operand); |
| 548 | const dest_ty = ty_op.ty.toType(); | 548 | const dest_ty = ty_op.ty.toType(); |
| 549 | if (src_ty.zigTypeTag(zcu) == .vector) { | 549 | if (src_ty.zigTypeTag(zcu) == .vector) { |
| ... | @@ -558,7 +558,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -558,7 +558,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 558 | } | 558 | } |
| 559 | }, | 559 | }, |
| 560 | .fpext => { | 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 | const src_ty = l.typeOf(ty_op.operand); | 562 | const src_ty = l.typeOf(ty_op.operand); |
| 563 | const dest_ty = ty_op.ty.toType(); | 563 | const dest_ty = ty_op.ty.toType(); |
| 564 | if (src_ty.zigTypeTag(zcu) == .vector) { | 564 | if (src_ty.zigTypeTag(zcu) == .vector) { |
| ... | @@ -573,7 +573,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -573,7 +573,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 573 | } | 573 | } |
| 574 | }, | 574 | }, |
| 575 | inline .int_from_float, .int_from_float_optimized => |air_tag| { | 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 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(ty_op.operand))) { | 577 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(ty_op.operand))) { |
| 578 | .none => {}, | 578 | .none => {}, |
| 579 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)), | 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,7 +584,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 584 | } | 584 | } |
| 585 | }, | 585 | }, |
| 586 | .float_from_int => { | 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 | const dest_ty = ty_op.ty.toType(); | 588 | const dest_ty = ty_op.ty.toType(); |
| 589 | switch (l.wantScalarizeOrSoftFloat(.float_from_int, dest_ty)) { | 589 | switch (l.wantScalarizeOrSoftFloat(.float_from_int, dest_ty)) { |
| 590 | .none => {}, | 590 | .none => {}, |
| ... | @@ -608,7 +608,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -608,7 +608,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 608 | if (try l.safeBitcastBlockPayload(inst)) |payload| { | 608 | if (try l.safeBitcastBlockPayload(inst)) |payload| { |
| 609 | continue :inst l.replaceInst(inst, .block, payload); | 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 | continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = ty_op }); | 612 | continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = ty_op }); |
| 613 | } else if (l.features.hasAny(&.{ | 613 | } else if (l.features.hasAny(&.{ |
| 614 | .scalarize_bit_cast_array, | 614 | .scalarize_bit_cast_array, |
| ... | @@ -624,10 +624,10 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -624,10 +624,10 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 624 | if (try l.safeIntcastBlockPayload(inst)) |payload| { | 624 | if (try l.safeIntcastBlockPayload(inst)) |payload| { |
| 625 | continue :inst l.replaceInst(inst, .block, payload); | 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 | continue :inst l.replaceInst(inst, .int_cast, .{ .ty_op = ty_op }); | 628 | continue :inst l.replaceInst(inst, .int_cast, .{ .ty_op = ty_op }); |
| 629 | } else if (l.features.has(.scalarize_int_cast_safe)) { | 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 | if (ty_op.ty.toType().isVector(zcu)) { | 631 | if (ty_op.ty.toType().isVector(zcu)) { |
| 632 | continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)); | 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,7 +643,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 643 | assert(!l.features.has(.scalarize(air_tag))); // it doesn't make sense to do both | 643 | assert(!l.features.has(.scalarize(air_tag))); // it doesn't make sense to do both |
| 644 | continue :inst l.replaceInst(inst, .block, try l.divCeilBlockPayload(inst, air_tag)); | 644 | continue :inst l.replaceInst(inst, .block, try l.divCeilBlockPayload(inst, air_tag)); |
| 645 | } else { | 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 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(bin_op.lhs))) { | 647 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(bin_op.lhs))) { |
| 648 | .none => {}, | 648 | .none => {}, |
| 649 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .bin_op)), | 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,7 +669,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 669 | assert(!l.features.has(.scalarize(air_tag))); | 669 | assert(!l.features.has(.scalarize(air_tag))); |
| 670 | continue :inst l.replaceInst(inst, .block, try l.safeIntFromFloatBlockPayload(inst, optimized)); | 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 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(ty_op.operand))) { | 673 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(ty_op.operand))) { |
| 674 | .none => {}, | 674 | .none => {}, |
| 675 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .ty_op)), | 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,7 +678,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 678 | } | 678 | } |
| 679 | }, | 679 | }, |
| 680 | .block, .loop => { | 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 | const extra = l.extraData(Air.Block, ty_pl.payload); | 682 | const extra = l.extraData(Air.Block, ty_pl.payload); |
| 683 | try l.legalizeBody(extra.end, extra.data.body_len); | 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,7 +707,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 707 | .round, | 707 | .round, |
| 708 | .trunc_float, | 708 | .trunc_float, |
| 709 | => |air_tag| { | 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 | const ty = l.typeOf(operand); | 711 | const ty = l.typeOf(operand); |
| 712 | switch (l.wantScalarizeOrSoftFloat(air_tag, ty)) { | 712 | switch (l.wantScalarizeOrSoftFloat(air_tag, ty)) { |
| 713 | .none => {}, | 713 | .none => {}, |
| ... | @@ -721,7 +721,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -721,7 +721,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 721 | } | 721 | } |
| 722 | }, | 722 | }, |
| 723 | inline .neg, .neg_optimized => |air_tag| { | 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 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(operand))) { | 725 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(operand))) { |
| 726 | .none => {}, | 726 | .none => {}, |
| 727 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeBlockPayload(inst, .un_op)), | 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,7 +741,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 741 | .cmp_neq, | 741 | .cmp_neq, |
| 742 | .cmp_neq_optimized, | 742 | .cmp_neq_optimized, |
| 743 | => |air_tag| { | 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 | const ty = l.typeOf(bin_op.lhs); | 745 | const ty = l.typeOf(bin_op.lhs); |
| 746 | if (l.wantSoftFloatScalar(ty)) { | 746 | if (l.wantSoftFloatScalar(ty)) { |
| 747 | continue :inst l.replaceInst( | 747 | continue :inst l.replaceInst( |
| ... | @@ -752,7 +752,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -752,7 +752,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 752 | } | 752 | } |
| 753 | }, | 753 | }, |
| 754 | inline .cmp_vector, .cmp_vector_optimized => |air_tag| { | 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 | const payload = l.extraData(Air.VectorCmp, ty_pl.payload).data; | 756 | const payload = l.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 757 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(payload.lhs))) { | 757 | switch (l.wantScalarizeOrSoftFloat(air_tag, l.typeOf(payload.lhs))) { |
| 758 | .none => {}, | 758 | .none => {}, |
| ... | @@ -761,13 +761,13 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -761,13 +761,13 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 761 | } | 761 | } |
| 762 | }, | 762 | }, |
| 763 | .cond_br => { | 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 | const extra = l.extraData(Air.CondBr, pl_op.payload); | 765 | const extra = l.extraData(Air.CondBr, pl_op.payload); |
| 766 | try l.legalizeBody(extra.end, extra.data.then_body_len); | 766 | try l.legalizeBody(extra.end, extra.data.then_body_len); |
| 767 | try l.legalizeBody(extra.end + extra.data.then_body_len, extra.data.else_body_len); | 767 | try l.legalizeBody(extra.end + extra.data.then_body_len, extra.data.else_body_len); |
| 768 | }, | 768 | }, |
| 769 | .switch_br, .loop_switch_br => { | 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 | const extra = l.extraData(Air.SwitchBr, pl_op.payload); | 771 | const extra = l.extraData(Air.SwitchBr, pl_op.payload); |
| 772 | const hint_bag_count = @divCeil(extra.data.cases_len + 1, 10); | 772 | const hint_bag_count = @divCeil(extra.data.cases_len + 1, 10); |
| 773 | var extra_index = extra.end + hint_bag_count; | 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,18 +781,18 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 781 | }, | 781 | }, |
| 782 | .switch_dispatch => {}, | 782 | .switch_dispatch => {}, |
| 783 | .@"try", .try_cold => { | 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 | const extra = l.extraData(Air.Try, pl_op.payload); | 785 | const extra = l.extraData(Air.Try, pl_op.payload); |
| 786 | try l.legalizeBody(extra.end, extra.data.body_len); | 786 | try l.legalizeBody(extra.end, extra.data.body_len); |
| 787 | }, | 787 | }, |
| 788 | .try_ptr, .try_ptr_cold => { | 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 | const extra = l.extraData(Air.TryPtr, ty_pl.payload); | 790 | const extra = l.extraData(Air.TryPtr, ty_pl.payload); |
| 791 | try l.legalizeBody(extra.end, extra.data.body_len); | 791 | try l.legalizeBody(extra.end, extra.data.body_len); |
| 792 | }, | 792 | }, |
| 793 | .dbg_stmt, .dbg_empty_stmt => {}, | 793 | .dbg_stmt, .dbg_empty_stmt => {}, |
| 794 | .dbg_inline_block => { | 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 | const extra = l.extraData(Air.DbgInlineBlock, ty_pl.payload); | 796 | const extra = l.extraData(Air.DbgInlineBlock, ty_pl.payload); |
| 797 | try l.legalizeBody(extra.end, extra.data.body_len); | 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,7 +809,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 809 | .is_non_err_ptr, | 809 | .is_non_err_ptr, |
| 810 | => {}, | 810 | => {}, |
| 811 | .load => if (l.features.has(.expand_packed_load)) { | 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 | const ptr_info = l.typeOf(ty_op.operand).ptrInfo(zcu); | 813 | const ptr_info = l.typeOf(ty_op.operand).ptrInfo(zcu); |
| 814 | if (ptr_info.packed_offset.host_size > 0 and ptr_info.flags.vector_index == .none) { | 814 | if (ptr_info.packed_offset.host_size > 0 and ptr_info.flags.vector_index == .none) { |
| 815 | continue :inst l.replaceInst(inst, .block, try l.packedLoadBlockPayload(inst)); | 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,7 +817,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 817 | }, | 817 | }, |
| 818 | .ret, .ret_safe, .ret_load => {}, | 818 | .ret, .ret_safe, .ret_load => {}, |
| 819 | .store, .store_safe => if (l.features.has(.expand_packed_store)) { | 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 | const ptr_info = l.typeOf(bin_op.lhs).ptrInfo(zcu); | 821 | const ptr_info = l.typeOf(bin_op.lhs).ptrInfo(zcu); |
| 822 | if (ptr_info.packed_offset.host_size > 0 and ptr_info.flags.vector_index == .none) { | 822 | if (ptr_info.packed_offset.host_size > 0 and ptr_info.flags.vector_index == .none) { |
| 823 | continue :inst l.replaceInst(inst, .block, try l.packedStoreBlockPayload(inst)); | 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,7 +842,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 842 | .struct_field_ptr_index_3, | 842 | .struct_field_ptr_index_3, |
| 843 | => {}, | 843 | => {}, |
| 844 | .agg_field_val => if (l.features.has(.expand_packed_agg_field_val)) { | 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 | const extra = l.extraData(Air.StructField, ty_pl.payload).data; | 846 | const extra = l.extraData(Air.StructField, ty_pl.payload).data; |
| 847 | switch (l.typeOf(extra.struct_operand).containerLayout(zcu)) { | 847 | switch (l.typeOf(extra.struct_operand).containerLayout(zcu)) { |
| 848 | .auto, .@"extern" => {}, | 848 | .auto, .@"extern" => {}, |
| ... | @@ -864,7 +864,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -864,7 +864,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 864 | .array_to_slice, | 864 | .array_to_slice, |
| 865 | => {}, | 865 | => {}, |
| 866 | inline .reduce, .reduce_optimized => |air_tag| { | 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 | const vector_ty = l.typeOf(reduce.operand); | 868 | const vector_ty = l.typeOf(reduce.operand); |
| 869 | if (l.features.has(.reduce_one_elem_to_bit_cast)) { | 869 | if (l.features.has(.reduce_one_elem_to_bit_cast)) { |
| 870 | switch (vector_ty.vectorLen(zcu)) { | 870 | switch (vector_ty.vectorLen(zcu)) { |
| ... | @@ -887,7 +887,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -887,7 +887,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 887 | } | 887 | } |
| 888 | }, | 888 | }, |
| 889 | .splat => if (l.features.has(.splat_one_elem_to_bit_cast)) { | 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 | switch (ty_op.ty.toType().vectorLen(zcu)) { | 891 | switch (ty_op.ty.toType().vectorLen(zcu)) { |
| 892 | 0 => unreachable, | 892 | 0 => unreachable, |
| 893 | 1 => continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{ | 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,7 +898,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 898 | } | 898 | } |
| 899 | }, | 899 | }, |
| 900 | .shuffle_one => { | 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 | switch (l.wantScalarizeOrSoftFloat(.shuffle_one, ty_pl.ty.toType())) { | 902 | switch (l.wantScalarizeOrSoftFloat(.shuffle_one, ty_pl.ty.toType())) { |
| 903 | .none => {}, | 903 | .none => {}, |
| 904 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeShuffleOneBlockPayload(inst)), | 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,7 +906,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 906 | } | 906 | } |
| 907 | }, | 907 | }, |
| 908 | .shuffle_two => { | 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 | switch (l.wantScalarizeOrSoftFloat(.shuffle_two, ty_pl.ty.toType())) { | 910 | switch (l.wantScalarizeOrSoftFloat(.shuffle_two, ty_pl.ty.toType())) { |
| 911 | .none => {}, | 911 | .none => {}, |
| 912 | .scalarize => continue :inst l.replaceInst(inst, .block, try l.scalarizeShuffleTwoBlockPayload(inst)), | 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,7 +914,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 914 | } | 914 | } |
| 915 | }, | 915 | }, |
| 916 | .select => { | 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 | const bin = l.extraData(Air.Bin, pl_op.payload).data; | 918 | const bin = l.extraData(Air.Bin, pl_op.payload).data; |
| 919 | switch (l.wantScalarizeOrSoftFloat(.select, l.typeOf(bin.lhs))) { | 919 | switch (l.wantScalarizeOrSoftFloat(.select, l.typeOf(bin.lhs))) { |
| 920 | .none => {}, | 920 | .none => {}, |
| ... | @@ -940,7 +940,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -940,7 +940,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 940 | .error_set_has_value, | 940 | .error_set_has_value, |
| 941 | => {}, | 941 | => {}, |
| 942 | .aggregate_init => if (l.features.has(.expand_packed_aggregate_init)) { | 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 | const agg_ty = ty_pl.ty.toType(); | 944 | const agg_ty = ty_pl.ty.toType(); |
| 945 | switch (agg_ty.zigTypeTag(zcu)) { | 945 | switch (agg_ty.zigTypeTag(zcu)) { |
| 946 | else => {}, | 946 | else => {}, |
| ... | @@ -958,7 +958,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { | ... | @@ -958,7 +958,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 958 | // Just bitcast this field. | 958 | // Just bitcast this field. |
| 959 | continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{ | 959 | continue :inst l.replaceInst(inst, .bit_cast, .{ .ty_op = .{ |
| 960 | .ty = .fromType(agg_ty), | 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,7 +971,7 @@ fn legalizeBody(l: *Legalize, body_start: usize, body_len: usize) Error!void { |
| 971 | }, | 971 | }, |
| 972 | .union_init, .prefetch => {}, | 972 | .union_init, .prefetch => {}, |
| 973 | .mul_add => { | 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 | const ty = l.typeOf(pl_op.operand); | 975 | const ty = l.typeOf(pl_op.operand); |
| 976 | switch (l.wantScalarizeOrSoftFloat(.mul_add, ty)) { | 976 | switch (l.wantScalarizeOrSoftFloat(.mul_add, ty)) { |
| 977 | .none => {}, | 977 | .none => {}, |
| ... | @@ -1017,7 +1017,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz | ... | @@ -1017,7 +1017,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz |
| 1017 | const pt = l.pt; | 1017 | const pt = l.pt; |
| 1018 | const zcu = pt.zcu; | 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 | const res_ty = l.typeOfIndex(orig_inst); | 1021 | const res_ty = l.typeOfIndex(orig_inst); |
| 1022 | const result_is_array = switch (res_ty.zigTypeTag(zcu)) { | 1022 | const result_is_array = switch (res_ty.zigTypeTag(zcu)) { |
| 1023 | .vector => false, | 1023 | .vector => false, |
| ... | @@ -1167,7 +1167,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz | ... | @@ -1167,7 +1167,7 @@ fn scalarizeBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, form: Scalariz |
| 1167 | try condbr.finish(l); | 1167 | try condbr.finish(l); |
| 1168 | 1168 | ||
| 1169 | const inst_data = l.air_instructions.items(.data); | 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 | break :elem elem_block_inst.toRef(); | 1172 | break :elem elem_block_inst.toRef(); |
| 1173 | }, | 1173 | }, |
| ... | @@ -1519,13 +1519,13 @@ fn addScalarizedShuffle( | ... | @@ -1519,13 +1519,13 @@ fn addScalarizedShuffle( |
| 1519 | try loop.finish(l); | 1519 | try loop.finish(l); |
| 1520 | 1520 | ||
| 1521 | const inst_data = l.air_instructions.items(.data); | 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 | fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.Inst.Data { | 1524 | fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.Inst.Data { |
| 1525 | const pt = l.pt; | 1525 | const pt = l.pt; |
| 1526 | const zcu = pt.zcu; | 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 | const dest_ty = ty_op.ty.toType(); | 1530 | const dest_ty = ty_op.ty.toType(); |
| 1531 | const operand_ty = l.typeOf(ty_op.operand); | 1531 | const operand_ty = l.typeOf(ty_op.operand); |
| ... | @@ -1723,7 +1723,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!? | ... | @@ -1723,7 +1723,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!? |
| 1723 | try loop.finish(l); | 1723 | try loop.finish(l); |
| 1724 | 1724 | ||
| 1725 | const inst_data = l.air_instructions.items(.data); | 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 | break :uint_val uint_block_inst.toRef(); | 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,7 +1736,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!? |
| 1736 | 1736 | ||
| 1737 | if (int_to_dest_ok) { | 1737 | if (int_to_dest_ok) { |
| 1738 | _ = main_block.stealCapacity(17); | 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 | .bit_cast => main_block.addBitCast(l, dest_ty, uint_val), | 1740 | .bit_cast => main_block.addBitCast(l, dest_ty, uint_val), |
| 1741 | .bit_cast_safe => main_block.add(l, .{ | 1741 | .bit_cast_safe => main_block.add(l, .{ |
| 1742 | .tag = .bit_cast_safe, | 1742 | .tag = .bit_cast_safe, |
| ... | @@ -1752,7 +1752,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!? | ... | @@ -1752,7 +1752,7 @@ fn scalarizeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!? |
| 1752 | _ = main_block.stealCapacity(16); | 1752 | _ = main_block.stealCapacity(16); |
| 1753 | const elem = main_block.addBitCast(l, dest_ty.childType(zcu), uint_val); | 1753 | const elem = main_block.addBitCast(l, dest_ty.childType(zcu), uint_val); |
| 1754 | const aggregate_init_payload_start = l.air_extra.items.len; | 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 | const result = main_block.add(l, .{ | 1756 | const result = main_block.add(l, .{ |
| 1757 | .tag = .aggregate_init, | 1757 | .tag = .aggregate_init, |
| 1758 | .data = .{ .ty_pl = .{ | 1758 | .data = .{ .ty_pl = .{ |
| ... | @@ -1863,7 +1863,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error! | ... | @@ -1863,7 +1863,7 @@ fn scalarizeOverflowBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error! |
| 1863 | const pt = l.pt; | 1863 | const pt = l.pt; |
| 1864 | const zcu = pt.zcu; | 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 | const orig_operands = l.extraData(Air.Bin, orig.data.ty_pl.payload).data; | 1867 | const orig_operands = l.extraData(Air.Bin, orig.data.ty_pl.payload).data; |
| 1868 | 1868 | ||
| 1869 | const vec_tuple_ty = l.typeOfIndex(orig_inst); | 1869 | const vec_tuple_ty = l.typeOfIndex(orig_inst); |
| ... | @@ -2009,7 +2009,7 @@ fn scalarizeReduceBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimize | ... | @@ -2009,7 +2009,7 @@ fn scalarizeReduceBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimize |
| 2009 | const pt = l.pt; | 2009 | const pt = l.pt; |
| 2010 | const zcu = pt.zcu; | 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 | const vector_ty = l.typeOf(reduce.operand); | 2014 | const vector_ty = l.typeOf(reduce.operand); |
| 2015 | const scalar_ty = vector_ty.childType(zcu); | 2015 | const scalar_ty = vector_ty.childType(zcu); |
| ... | @@ -2136,7 +2136,7 @@ fn scalarizeReduceBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimize | ... | @@ -2136,7 +2136,7 @@ fn scalarizeReduceBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimize |
| 2136 | fn safeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.Inst.Data { | 2136 | fn safeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.Inst.Data { |
| 2137 | const pt = l.pt; | 2137 | const pt = l.pt; |
| 2138 | const zcu = pt.zcu; | 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 | const operand_ref = ty_op.operand; | 2141 | const operand_ref = ty_op.operand; |
| 2142 | const dest_ty = ty_op.ty.toType(); | 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,7 +2191,7 @@ fn safeBitcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.I |
| 2191 | fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.Inst.Data { | 2191 | fn safeIntcastBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!?Air.Inst.Data { |
| 2192 | const pt = l.pt; | 2192 | const pt = l.pt; |
| 2193 | const zcu = pt.zcu; | 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 | const operand_ref = ty_op.operand; | 2196 | const operand_ref = ty_op.operand; |
| 2197 | const operand_ty = l.typeOf(operand_ref); | 2197 | const operand_ty = l.typeOf(operand_ref); |
| ... | @@ -2362,7 +2362,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz | ... | @@ -2362,7 +2362,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz |
| 2362 | const pt = l.pt; | 2362 | const pt = l.pt; |
| 2363 | const zcu = pt.zcu; | 2363 | const zcu = pt.zcu; |
| 2364 | const gpa = zcu.gpa; | 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 | const operand_ref = ty_op.operand; | 2367 | const operand_ref = ty_op.operand; |
| 2368 | const operand_ty = l.typeOf(operand_ref); | 2368 | const operand_ty = l.typeOf(operand_ref); |
| ... | @@ -2470,7 +2470,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz | ... | @@ -2470,7 +2470,7 @@ fn safeIntFromFloatBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, optimiz |
| 2470 | fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_op_tag: Air.Inst.Tag) Error!Air.Inst.Data { | 2470 | fn safeArithmeticBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index, overflow_op_tag: Air.Inst.Tag) Error!Air.Inst.Data { |
| 2471 | const pt = l.pt; | 2471 | const pt = l.pt; |
| 2472 | const zcu = pt.zcu; | 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 | const operand_ty = l.typeOf(bin_op.lhs); | 2475 | const operand_ty = l.typeOf(bin_op.lhs); |
| 2476 | assert(l.typeOf(bin_op.rhs).toIntern() == operand_ty.toIntern()); | 2476 | assert(l.typeOf(bin_op.rhs).toIntern() == operand_ty.toIntern()); |
| ... | @@ -2567,7 +2567,7 @@ fn divCeilBlockPayload( | ... | @@ -2567,7 +2567,7 @@ fn divCeilBlockPayload( |
| 2567 | const zcu = pt.zcu; | 2567 | const zcu = pt.zcu; |
| 2568 | const gpa = zcu.gpa; | 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 | const operand_ty = l.typeOf(bin_op.lhs); | 2571 | const operand_ty = l.typeOf(bin_op.lhs); |
| 2572 | assert(l.typeOf(bin_op.rhs).toIntern() == operand_ty.toIntern()); | 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,7 +2715,7 @@ fn packedLoadBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.Ins |
| 2715 | const pt = l.pt; | 2715 | const pt = l.pt; |
| 2716 | const zcu = pt.zcu; | 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 | const res_ty = orig_ty_op.ty.toType(); | 2719 | const res_ty = orig_ty_op.ty.toType(); |
| 2720 | const res_int_ty = try pt.intType(.unsigned, @intCast(res_ty.bitSize(zcu))); | 2720 | const res_int_ty = try pt.intType(.unsigned, @intCast(res_ty.bitSize(zcu))); |
| 2721 | const ptr_ty = l.typeOf(orig_ty_op.operand); | 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,7 +2771,7 @@ fn packedStoreBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Error!Air.In |
| 2771 | const pt = l.pt; | 2771 | const pt = l.pt; |
| 2772 | const zcu = pt.zcu; | 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 | const ptr_ty = l.typeOf(orig_bin_op.lhs); | 2775 | const ptr_ty = l.typeOf(orig_bin_op.lhs); |
| 2776 | const ptr_info = ptr_ty.ptrInfo(zcu); | 2776 | const ptr_info = ptr_ty.ptrInfo(zcu); |
| 2777 | const operand_ty = l.typeOf(orig_bin_op.rhs); | 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,7 +2869,7 @@ fn packedStructFieldValBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Err |
| 2869 | const pt = l.pt; | 2869 | const pt = l.pt; |
| 2870 | const zcu = pt.zcu; | 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 | const orig_extra = l.extraData(Air.StructField, orig_ty_pl.payload).data; | 2873 | const orig_extra = l.extraData(Air.StructField, orig_ty_pl.payload).data; |
| 2874 | const field_ty = orig_ty_pl.ty.toType(); | 2874 | const field_ty = orig_ty_pl.ty.toType(); |
| 2875 | const agg_ty = l.typeOf(orig_extra.struct_operand); | 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,7 +2903,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro |
| 2903 | const zcu = pt.zcu; | 2903 | const zcu = pt.zcu; |
| 2904 | const gpa = zcu.gpa; | 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 | const agg_ty = orig_ty_pl.ty.toType(); | 2907 | const agg_ty = orig_ty_pl.ty.toType(); |
| 2908 | const agg_field_count = agg_ty.structFieldCount(zcu); | 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,7 +2930,7 @@ fn packedAggregateInitBlockPayload(l: *Legalize, orig_inst: Air.Inst.Index) Erro |
| 2930 | assert(field_bits < num_bits); | 2930 | assert(field_bits < num_bits); |
| 2931 | const field_uint_ty = try pt.intType(.unsigned, field_bits); | 2931 | const field_uint_ty = try pt.intType(.unsigned, field_bits); |
| 2932 | const field_bit_size_ref: Air.Inst.Ref = .fromValue(try pt.intValue(shift_ty, field_bits)); | 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 | const shifted = main_block.addBinOp(l, .shl_exact, cur_uint, field_bit_size_ref).toRef(); | 2935 | const shifted = main_block.addBinOp(l, .shl_exact, cur_uint, field_bit_size_ref).toRef(); |
| 2936 | const field_as_uint = main_block.addBitCast(l, field_uint_ty, field_val); | 2936 | const field_as_uint = main_block.addBitCast(l, field_uint_ty, field_val); |
| ... | @@ -3298,7 +3298,7 @@ const Loop = struct { | ... | @@ -3298,7 +3298,7 @@ const Loop = struct { |
| 3298 | } | 3298 | } |
| 3299 | 3299 | ||
| 3300 | fn finish(loop: Loop, l: *Legalize) Error!void { | 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 | data.ty_pl.payload = try l.addBlockBody(loop.block.body()); | 3302 | data.ty_pl.payload = try l.addBlockBody(loop.block.body()); |
| 3303 | } | 3303 | } |
| 3304 | }; | 3304 | }; |
| ... | @@ -3331,7 +3331,7 @@ const CondBr = struct { | ... | @@ -3331,7 +3331,7 @@ const CondBr = struct { |
| 3331 | const else_body = cond_br.else_block.body(); | 3331 | const else_body = cond_br.else_block.body(); |
| 3332 | try l.air_extra.ensureUnusedCapacity(l.pt.zcu.gpa, 3 + then_body.len + else_body.len); | 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 | data.pl_op.payload = @intCast(l.air_extra.items.len); | 3335 | data.pl_op.payload = @intCast(l.air_extra.items.len); |
| 3336 | l.air_extra.appendSliceAssumeCapacity(&.{ | 3336 | l.air_extra.appendSliceAssumeCapacity(&.{ |
| 3337 | @intCast(then_body.len), | 3337 | @intCast(then_body.len), |
| ... | @@ -3345,7 +3345,7 @@ const CondBr = struct { | ... | @@ -3345,7 +3345,7 @@ const CondBr = struct { |
| 3345 | 3345 | ||
| 3346 | fn addInstAssumeCapacity(l: *Legalize, inst: Air.Inst) Air.Inst.Index { | 3346 | fn addInstAssumeCapacity(l: *Legalize, inst: Air.Inst) Air.Inst.Index { |
| 3347 | defer l.air_instructions.appendAssumeCapacity(inst); | 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 | fn addExtra(l: *Legalize, comptime Extra: type, extra: Extra) Error!u32 { | 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,7 +3353,7 @@ fn addExtra(l: *Legalize, comptime Extra: type, extra: Extra) Error!u32 { |
| 3353 | try l.air_extra.ensureUnusedCapacity(l.pt.zcu.gpa, extra_info.field_names.len); | 3353 | try l.air_extra.ensureUnusedCapacity(l.pt.zcu.gpa, extra_info.field_names.len); |
| 3354 | defer inline for (extra_info.field_names, extra_info.field_types) |field_name, field_type| l.air_extra.appendAssumeCapacity(switch (field_type) { | 3354 | defer inline for (extra_info.field_names, extra_info.field_types) |field_name, field_type| l.air_extra.appendAssumeCapacity(switch (field_type) { |
| 3355 | u32 => @field(extra, field_name), | 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 | else => @compileError(@typeName(field_type)), | 3357 | else => @compileError(@typeName(field_type)), |
| 3358 | }); | 3358 | }); |
| 3359 | return @intCast(l.air_extra.items.len); | 3359 | return @intCast(l.air_extra.items.len); |
| ... | @@ -3372,7 +3372,7 @@ fn addBlockBody(l: *Legalize, body: []const Air.Inst.Index) Error!u32 { | ... | @@ -3372,7 +3372,7 @@ fn addBlockBody(l: *Legalize, body: []const Air.Inst.Index) Error!u32 { |
| 3372 | /// `inline` to propagate the comptime-known `tag` result. | 3372 | /// `inline` to propagate the comptime-known `tag` result. |
| 3373 | inline fn replaceInst(l: *Legalize, inst: Air.Inst.Index, comptime tag: Air.Inst.Tag, data: Air.Inst.Data) Air.Inst.Tag { | 3373 | inline fn replaceInst(l: *Legalize, inst: Air.Inst.Index, comptime tag: Air.Inst.Tag, data: Air.Inst.Data) Air.Inst.Tag { |
| 3374 | const orig_ty = if (std.debug.runtime_safety) l.typeOfIndex(inst) else {}; | 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 | if (std.debug.runtime_safety) assert(l.typeOfIndex(inst).toIntern() == orig_ty.toIntern()); | 3376 | if (std.debug.runtime_safety) assert(l.typeOfIndex(inst).toIntern() == orig_ty.toIntern()); |
| 3377 | return tag; | 3377 | return tag; |
| 3378 | } | 3378 | } |
| ... | @@ -3436,7 +3436,7 @@ fn softFptruncFunc(l: *const Legalize, src_ty: Type, dst_ty: Type) Air.CompilerR | ... | @@ -3436,7 +3436,7 @@ fn softFptruncFunc(l: *const Legalize, src_ty: Type, dst_ty: Type) Air.CompilerR |
| 3436 | 80 => 3, | 3436 | 80 => 3, |
| 3437 | else => unreachable, | 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 | fn softFpextFunc(l: *const Legalize, src_ty: Type, dst_ty: Type) Air.CompilerRtFunc { | 3441 | fn softFpextFunc(l: *const Legalize, src_ty: Type, dst_ty: Type) Air.CompilerRtFunc { |
| 3442 | const target = l.pt.zcu.getTarget(); | 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,7 +3457,7 @@ fn softFpextFunc(l: *const Legalize, src_ty: Type, dst_ty: Type) Air.CompilerRtF |
| 3457 | 32 => 3, | 3457 | 32 => 3, |
| 3458 | else => unreachable, | 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 | fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { | 3462 | fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3463 | call: Air.CompilerRtFunc, | 3463 | call: Air.CompilerRtFunc, |
| ... | @@ -3467,7 +3467,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { | ... | @@ -3467,7 +3467,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3467 | const zcu = pt.zcu; | 3467 | const zcu = pt.zcu; |
| 3468 | const target = zcu.getTarget(); | 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 | const dest_ty = ty_op.ty.toType(); | 3471 | const dest_ty = ty_op.ty.toType(); |
| 3472 | const src_ty = l.typeOf(ty_op.operand); | 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,7 +3497,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3497 | break :fixed; | 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 | if (extended_int_bits == src_info.bits) return .{ .call = func }; | 3501 | if (extended_int_bits == src_info.bits) return .{ .call = func }; |
| 3502 | 3502 | ||
| 3503 | // We need to emit a block which first sign/zero-extends to the right type and *then* calls | 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,7 +3522,7 @@ fn softFloatFromInt(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3522 | // We need to emit a block which puts the integer into an `alloc` (possibly sign/zero-extended) | 3522 | // We need to emit a block which puts the integer into an `alloc` (possibly sign/zero-extended) |
| 3523 | // and calls an arbitrary-width conversion routine. | 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 | // The extended integer routines expect the integer representation where the integer is | 3527 | // The extended integer routines expect the integer representation where the integer is |
| 3528 | // effectively zero- or sign-extended to its ABI size. We represent that by intcasting to | 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,7 +3560,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3560 | const zcu = pt.zcu; | 3560 | const zcu = pt.zcu; |
| 3561 | const target = zcu.getTarget(); | 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 | const src_ty = l.typeOf(ty_op.operand); | 3564 | const src_ty = l.typeOf(ty_op.operand); |
| 3565 | const dest_ty = ty_op.ty.toType(); | 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,7 +3590,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3590 | break :fixed; | 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 | if (extended_int_bits == dest_info.bits) return .{ .call = func }; | 3594 | if (extended_int_bits == dest_info.bits) return .{ .call = func }; |
| 3595 | 3595 | ||
| 3596 | // We need to emit a block which calls the routine and then casts to the required type. | 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,7 +3611,7 @@ fn softIntFromFloat(l: *Legalize, orig_inst: Air.Inst.Index) Error!union(enum) { |
| 3611 | 3611 | ||
| 3612 | // We need to emit a block which calls an arbitrary-width conversion routine, then loads the | 3612 | // We need to emit a block which calls an arbitrary-width conversion routine, then loads the |
| 3613 | // integer from an `alloc` and possibly truncates it. | 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 | const extended_ty = try pt.intType(dest_info.signedness, @intCast(dest_ty.abiSize(zcu) * 8)); | 3616 | const extended_ty = try pt.intType(dest_info.signedness, @intCast(dest_ty.abiSize(zcu) * 8)); |
| 3617 | assert(extended_ty.abiSize(zcu) == dest_ty.abiSize(zcu)); | 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,7 +3678,7 @@ fn softFloatFunc(op: Air.Inst.Tag, float_ty: Type, zcu: *const Zcu) Air.Compiler |
| 3678 | 128 => 4, | 3678 | 128 => 4, |
| 3679 | else => unreachable, | 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 | fn softFloatNegBlockPayload( | 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,23 +188,23 @@ pub fn analyze(zcu: *Zcu, air: Air, intern_pool: *InternPool) Allocator.Error!Li |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | pub fn getTombBits(l: Liveness, inst: Air.Inst.Index) Bpi { | 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 | return @as(Bpi, @truncate(l.tomb_bits[usize_index] >> | 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 | pub fn isUnused(l: Liveness, inst: Air.Inst.Index) bool { | 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 | const mask = @as(usize, 1) << | 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 | return (l.tomb_bits[usize_index] & mask) != 0; | 200 | return (l.tomb_bits[usize_index] & mask) != 0; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | pub fn operandDies(l: Liveness, inst: Air.Inst.Index, operand: OperandInt) bool { | 203 | pub fn operandDies(l: Liveness, inst: Air.Inst.Index, operand: OperandInt) bool { |
| 204 | assert(operand < bpi - 1); | 204 | assert(operand < bpi - 1); |
| 205 | const usize_index = (@intFromEnum(inst) * bpi) / @bitSizeOf(usize); | 205 | const usize_index = (@backingInt(inst) * bpi) / @bitSizeOf(usize); |
| 206 | const mask = @as(usize, 1) << | 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 | return (l.tomb_bits[usize_index] & mask) != 0; | 208 | return (l.tomb_bits[usize_index] & mask) != 0; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| ... | @@ -393,7 +393,7 @@ fn analyzeInst( | ... | @@ -393,7 +393,7 @@ fn analyzeInst( |
| 393 | const inst_tags = a.air.instructions.items(.tag); | 393 | const inst_tags = a.air.instructions.items(.tag); |
| 394 | const inst_datas = a.air.instructions.items(.data); | 394 | const inst_datas = a.air.instructions.items(.data); |
| 395 | 395 | ||
| 396 | switch (inst_tags[@intFromEnum(inst)]) { | 396 | switch (inst_tags[@backingInt(inst)]) { |
| 397 | .add, | 397 | .add, |
| 398 | .add_safe, | 398 | .add_safe, |
| 399 | .add_optimized, | 399 | .add_optimized, |
| ... | @@ -461,7 +461,7 @@ fn analyzeInst( | ... | @@ -461,7 +461,7 @@ fn analyzeInst( |
| 461 | .memmove, | 461 | .memmove, |
| 462 | .legalize_vec_elem_val, | 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 | return analyzeOperands(a, pass, data, inst, .{ o.lhs, o.rhs, .none }); | 465 | return analyzeOperands(a, pass, data, inst, .{ o.lhs, o.rhs, .none }); |
| 466 | }, | 466 | }, |
| 467 | 467 | ||
| ... | @@ -543,7 +543,7 @@ fn analyzeInst( | ... | @@ -543,7 +543,7 @@ fn analyzeInst( |
| 543 | .c_va_copy, | 543 | .c_va_copy, |
| 544 | .abs, | 544 | .abs, |
| 545 | => { | 545 | => { |
| 546 | const o = inst_datas[@intFromEnum(inst)].ty_op; | 546 | const o = inst_datas[@backingInt(inst)].ty_op; |
| 547 | return analyzeOperands(a, pass, data, inst, .{ o.operand, .none, .none }); | 547 | return analyzeOperands(a, pass, data, inst, .{ o.operand, .none, .none }); |
| 548 | }, | 548 | }, |
| 549 | 549 | ||
| ... | @@ -577,7 +577,7 @@ fn analyzeInst( | ... | @@ -577,7 +577,7 @@ fn analyzeInst( |
| 577 | .set_err_return_trace, | 577 | .set_err_return_trace, |
| 578 | .c_va_end, | 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 | return analyzeOperands(a, pass, data, inst, .{ operand, .none, .none }); | 581 | return analyzeOperands(a, pass, data, inst, .{ operand, .none, .none }); |
| 582 | }, | 582 | }, |
| 583 | 583 | ||
| ... | @@ -585,7 +585,7 @@ fn analyzeInst( | ... | @@ -585,7 +585,7 @@ fn analyzeInst( |
| 585 | .ret_safe, | 585 | .ret_safe, |
| 586 | .ret_load, | 586 | .ret_load, |
| 587 | => { | 587 | => { |
| 588 | const operand = inst_datas[@intFromEnum(inst)].un_op; | 588 | const operand = inst_datas[@backingInt(inst)].un_op; |
| 589 | return analyzeFuncEnd(a, pass, data, inst, .{ operand, .none, .none }); | 589 | return analyzeFuncEnd(a, pass, data, inst, .{ operand, .none, .none }); |
| 590 | }, | 590 | }, |
| 591 | 591 | ||
| ... | @@ -599,7 +599,7 @@ fn analyzeInst( | ... | @@ -599,7 +599,7 @@ fn analyzeInst( |
| 599 | .slice_elem_ptr, | 599 | .slice_elem_ptr, |
| 600 | .slice, | 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 | const extra = a.air.extraData(Air.Bin, ty_pl.payload).data; | 603 | const extra = a.air.extraData(Air.Bin, ty_pl.payload).data; |
| 604 | return analyzeOperands(a, pass, data, inst, .{ extra.lhs, extra.rhs, .none }); | 604 | return analyzeOperands(a, pass, data, inst, .{ extra.lhs, extra.rhs, .none }); |
| 605 | }, | 605 | }, |
| ... | @@ -608,12 +608,12 @@ fn analyzeInst( | ... | @@ -608,12 +608,12 @@ fn analyzeInst( |
| 608 | .dbg_var_val, | 608 | .dbg_var_val, |
| 609 | .dbg_arg_inline, | 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 | return analyzeOperands(a, pass, data, inst, .{ operand, .none, .none }); | 612 | return analyzeOperands(a, pass, data, inst, .{ operand, .none, .none }); |
| 613 | }, | 613 | }, |
| 614 | 614 | ||
| 615 | .prefetch => { | 615 | .prefetch => { |
| 616 | const prefetch = inst_datas[@intFromEnum(inst)].prefetch; | 616 | const prefetch = inst_datas[@backingInt(inst)].prefetch; |
| 617 | return analyzeOperands(a, pass, data, inst, .{ prefetch.ptr, .none, .none }); | 617 | return analyzeOperands(a, pass, data, inst, .{ prefetch.ptr, .none, .none }); |
| 618 | }, | 618 | }, |
| 619 | 619 | ||
| ... | @@ -638,7 +638,7 @@ fn analyzeInst( | ... | @@ -638,7 +638,7 @@ fn analyzeInst( |
| 638 | return big.finish(); | 638 | return big.finish(); |
| 639 | }, | 639 | }, |
| 640 | .select => { | 640 | .select => { |
| 641 | const pl_op = inst_datas[@intFromEnum(inst)].pl_op; | 641 | const pl_op = inst_datas[@backingInt(inst)].pl_op; |
| 642 | const extra = a.air.extraData(Air.Bin, pl_op.payload).data; | 642 | const extra = a.air.extraData(Air.Bin, pl_op.payload).data; |
| 643 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, extra.lhs, extra.rhs }); | 643 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, extra.lhs, extra.rhs }); |
| 644 | }, | 644 | }, |
| ... | @@ -651,15 +651,15 @@ fn analyzeInst( | ... | @@ -651,15 +651,15 @@ fn analyzeInst( |
| 651 | return analyzeOperands(a, pass, data, inst, .{ unwrapped.operand_a, unwrapped.operand_b, .none }); | 651 | return analyzeOperands(a, pass, data, inst, .{ unwrapped.operand_a, unwrapped.operand_b, .none }); |
| 652 | }, | 652 | }, |
| 653 | .reduce, .reduce_optimized => { | 653 | .reduce, .reduce_optimized => { |
| 654 | const reduce = inst_datas[@intFromEnum(inst)].reduce; | 654 | const reduce = inst_datas[@backingInt(inst)].reduce; |
| 655 | return analyzeOperands(a, pass, data, inst, .{ reduce.operand, .none, .none }); | 655 | return analyzeOperands(a, pass, data, inst, .{ reduce.operand, .none, .none }); |
| 656 | }, | 656 | }, |
| 657 | .cmp_vector, .cmp_vector_optimized => { | 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 | return analyzeOperands(a, pass, data, inst, .{ extra.lhs, extra.rhs, .none }); | 659 | return analyzeOperands(a, pass, data, inst, .{ extra.lhs, extra.rhs, .none }); |
| 660 | }, | 660 | }, |
| 661 | .aggregate_init => { | 661 | .aggregate_init => { |
| 662 | const ty_pl = inst_datas[@intFromEnum(inst)].ty_pl; | 662 | const ty_pl = inst_datas[@backingInt(inst)].ty_pl; |
| 663 | const aggregate_ty = ty_pl.ty.toType(); | 663 | const aggregate_ty = ty_pl.ty.toType(); |
| 664 | const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip))); | 664 | const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip))); |
| 665 | const elements = @as([]const Air.Inst.Ref, @ptrCast(a.air.extra.items[ty_pl.payload..][0..len])); | 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,32 +680,32 @@ fn analyzeInst( |
| 680 | return big.finish(); | 680 | return big.finish(); |
| 681 | }, | 681 | }, |
| 682 | .union_init => { | 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 | return analyzeOperands(a, pass, data, inst, .{ extra.init, .none, .none }); | 684 | return analyzeOperands(a, pass, data, inst, .{ extra.init, .none, .none }); |
| 685 | }, | 685 | }, |
| 686 | .struct_field_ptr, .agg_field_val, .spirv_runtime_array_len => { | 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 | return analyzeOperands(a, pass, data, inst, .{ extra.struct_operand, .none, .none }); | 688 | return analyzeOperands(a, pass, data, inst, .{ extra.struct_operand, .none, .none }); |
| 689 | }, | 689 | }, |
| 690 | .field_parent_ptr => { | 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 | return analyzeOperands(a, pass, data, inst, .{ extra.field_ptr, .none, .none }); | 692 | return analyzeOperands(a, pass, data, inst, .{ extra.field_ptr, .none, .none }); |
| 693 | }, | 693 | }, |
| 694 | .cmpxchg_strong, .cmpxchg_weak => { | 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 | return analyzeOperands(a, pass, data, inst, .{ extra.ptr, extra.expected_value, extra.new_value }); | 696 | return analyzeOperands(a, pass, data, inst, .{ extra.ptr, extra.expected_value, extra.new_value }); |
| 697 | }, | 697 | }, |
| 698 | .mul_add => { | 698 | .mul_add => { |
| 699 | const pl_op = inst_datas[@intFromEnum(inst)].pl_op; | 699 | const pl_op = inst_datas[@backingInt(inst)].pl_op; |
| 700 | const extra = a.air.extraData(Air.Bin, pl_op.payload).data; | 700 | const extra = a.air.extraData(Air.Bin, pl_op.payload).data; |
| 701 | return analyzeOperands(a, pass, data, inst, .{ extra.lhs, extra.rhs, pl_op.operand }); | 701 | return analyzeOperands(a, pass, data, inst, .{ extra.lhs, extra.rhs, pl_op.operand }); |
| 702 | }, | 702 | }, |
| 703 | .atomic_load => { | 703 | .atomic_load => { |
| 704 | const ptr = inst_datas[@intFromEnum(inst)].atomic_load.ptr; | 704 | const ptr = inst_datas[@backingInt(inst)].atomic_load.ptr; |
| 705 | return analyzeOperands(a, pass, data, inst, .{ ptr, .none, .none }); | 705 | return analyzeOperands(a, pass, data, inst, .{ ptr, .none, .none }); |
| 706 | }, | 706 | }, |
| 707 | .atomic_rmw => { | 707 | .atomic_rmw => { |
| 708 | const pl_op = inst_datas[@intFromEnum(inst)].pl_op; | 708 | const pl_op = inst_datas[@backingInt(inst)].pl_op; |
| 709 | const extra = a.air.extraData(Air.AtomicRmw, pl_op.payload).data; | 709 | const extra = a.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 710 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, extra.operand, .none }); | 710 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, extra.operand, .none }); |
| 711 | }, | 711 | }, |
| ... | @@ -769,12 +769,12 @@ fn analyzeInst( | ... | @@ -769,12 +769,12 @@ fn analyzeInst( |
| 769 | .loop_switch_br => return analyzeInstSwitchBr(a, pass, data, inst, true), | 769 | .loop_switch_br => return analyzeInstSwitchBr(a, pass, data, inst, true), |
| 770 | 770 | ||
| 771 | .wasm_memory_grow => { | 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 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, .none, .none }); | 773 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, .none, .none }); |
| 774 | }, | 774 | }, |
| 775 | 775 | ||
| 776 | .legalize_vec_store_elem => { | 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 | const bin = a.air.extraData(Air.Bin, pl_op.payload).data; | 778 | const bin = a.air.extraData(Air.Bin, pl_op.payload).data; |
| 779 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, bin.lhs, bin.rhs }); | 779 | return analyzeOperands(a, pass, data, inst, .{ pl_op.operand, bin.lhs, bin.rhs }); |
| 780 | }, | 780 | }, |
| ... | @@ -823,7 +823,7 @@ fn analyzeOperands( | ... | @@ -823,7 +823,7 @@ fn analyzeOperands( |
| 823 | }, | 823 | }, |
| 824 | 824 | ||
| 825 | .main_analysis => { | 825 | .main_analysis => { |
| 826 | const usize_index = (@intFromEnum(inst) * bpi) / @bitSizeOf(usize); | 826 | const usize_index = (@backingInt(inst) * bpi) / @bitSizeOf(usize); |
| 827 | 827 | ||
| 828 | // This logic must synchronize with `will_die_immediately` in `AnalyzeBigOperands.init`. | 828 | // This logic must synchronize with `will_die_immediately` in `AnalyzeBigOperands.init`. |
| 829 | const immediate_death = if (data.live_set.remove(inst)) blk: { | 829 | const immediate_death = if (data.live_set.remove(inst)) blk: { |
| ... | @@ -858,7 +858,7 @@ fn analyzeOperands( | ... | @@ -858,7 +858,7 @@ fn analyzeOperands( |
| 858 | } | 858 | } |
| 859 | 859 | ||
| 860 | a.tomb_bits[usize_index] |= @as(usize, tomb_bits) << | 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,7 +893,7 @@ fn analyzeInstBr( |
| 893 | inst: Air.Inst.Index, | 893 | inst: Air.Inst.Index, |
| 894 | ) !void { | 894 | ) !void { |
| 895 | const inst_datas = a.air.instructions.items(.data); | 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 | const gpa = a.gpa; | 897 | const gpa = a.gpa; |
| 898 | 898 | ||
| 899 | switch (pass) { | 899 | switch (pass) { |
| ... | @@ -920,7 +920,7 @@ fn analyzeInstRepeat( | ... | @@ -920,7 +920,7 @@ fn analyzeInstRepeat( |
| 920 | inst: Air.Inst.Index, | 920 | inst: Air.Inst.Index, |
| 921 | ) !void { | 921 | ) !void { |
| 922 | const inst_datas = a.air.instructions.items(.data); | 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 | const gpa = a.gpa; | 924 | const gpa = a.gpa; |
| 925 | 925 | ||
| 926 | switch (pass) { | 926 | switch (pass) { |
| ... | @@ -949,7 +949,7 @@ fn analyzeInstSwitchDispatch( | ... | @@ -949,7 +949,7 @@ fn analyzeInstSwitchDispatch( |
| 949 | // This happens to be identical to `analyzeInstBr`, but is separated anyway for clarity. | 949 | // This happens to be identical to `analyzeInstBr`, but is separated anyway for clarity. |
| 950 | 950 | ||
| 951 | const inst_datas = a.air.instructions.items(.data); | 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 | const gpa = a.gpa; | 953 | const gpa = a.gpa; |
| 954 | 954 | ||
| 955 | switch (pass) { | 955 | switch (pass) { |
| ... | @@ -1023,7 +1023,7 @@ fn analyzeInstBlock( | ... | @@ -1023,7 +1023,7 @@ fn analyzeInstBlock( |
| 1023 | const alive = key.*; | 1023 | const alive = key.*; |
| 1024 | if (!block_scope.live_set.contains(alive)) { | 1024 | if (!block_scope.live_set.contains(alive)) { |
| 1025 | // Dies in block | 1025 | // Dies in block |
| 1026 | a.extra.appendAssumeCapacity(@intFromEnum(alive)); | 1026 | a.extra.appendAssumeCapacity(@backingInt(alive)); |
| 1027 | measured_num += 1; | 1027 | measured_num += 1; |
| 1028 | } | 1028 | } |
| 1029 | } | 1029 | } |
| ... | @@ -1064,7 +1064,7 @@ fn writeLoopInfo( | ... | @@ -1064,7 +1064,7 @@ fn writeLoopInfo( |
| 1064 | var it = data.breaks.keyIterator(); | 1064 | var it = data.breaks.keyIterator(); |
| 1065 | while (it.next()) |key| { | 1065 | while (it.next()) |key| { |
| 1066 | const block_inst = key.*; | 1066 | const block_inst = key.*; |
| 1067 | a.extra.appendAssumeCapacity(@intFromEnum(block_inst)); | 1067 | a.extra.appendAssumeCapacity(@backingInt(block_inst)); |
| 1068 | } | 1068 | } |
| 1069 | log.debug("[{t}] {f}: includes breaks to {f}", .{ LivenessPass.loop_analysis, inst, fmtInstSet(&data.breaks) }); | 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,7 +1076,7 @@ fn writeLoopInfo( |
| 1076 | it = data.live_set.keyIterator(); | 1076 | it = data.live_set.keyIterator(); |
| 1077 | while (it.next()) |key| { | 1077 | while (it.next()) |key| { |
| 1078 | const alive = key.*; | 1078 | const alive = key.*; |
| 1079 | a.extra.appendAssumeCapacity(@intFromEnum(alive)); | 1079 | a.extra.appendAssumeCapacity(@backingInt(alive)); |
| 1080 | } | 1080 | } |
| 1081 | log.debug("[{t}] {f}: maintain liveness of {f}", .{ LivenessPass.loop_analysis, inst, fmtInstSet(&data.live_set) }); | 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,7 +1297,7 @@ fn analyzeInstSwitchBr( |
| 1297 | is_dispatch_loop: bool, | 1297 | is_dispatch_loop: bool, |
| 1298 | ) !void { | 1298 | ) !void { |
| 1299 | const inst_datas = a.air.instructions.items(.data); | 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 | const condition = pl_op.operand; | 1301 | const condition = pl_op.operand; |
| 1302 | const switch_br = a.air.unwrapSwitch(inst); | 1302 | const switch_br = a.air.unwrapSwitch(inst); |
| 1303 | const gpa = a.gpa; | 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,7 +48,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 48 | continue; | 48 | continue; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | switch (tags[@intFromEnum(inst)]) { | 51 | switch (tags[@backingInt(inst)]) { |
| 52 | // no operands | 52 | // no operands |
| 53 | .arg, | 53 | .arg, |
| 54 | .alloc, | 54 | .alloc, |
| ... | @@ -131,7 +131,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { | ... | @@ -131,7 +131,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 131 | .c_va_copy, | 131 | .c_va_copy, |
| 132 | .abs, | 132 | .abs, |
| 133 | => { | 133 | => { |
| 134 | const ty_op = data[@intFromEnum(inst)].ty_op; | 134 | const ty_op = data[@backingInt(inst)].ty_op; |
| 135 | try self.verifyInstOperands(inst, .{ ty_op.operand, .none, .none }); | 135 | try self.verifyInstOperands(inst, .{ ty_op.operand, .none, .none }); |
| 136 | }, | 136 | }, |
| 137 | .is_null, | 137 | .is_null, |
| ... | @@ -164,14 +164,14 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { | ... | @@ -164,14 +164,14 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 164 | .set_err_return_trace, | 164 | .set_err_return_trace, |
| 165 | .c_va_end, | 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 | try self.verifyInstOperands(inst, .{ un_op, .none, .none }); | 168 | try self.verifyInstOperands(inst, .{ un_op, .none, .none }); |
| 169 | }, | 169 | }, |
| 170 | .ret, | 170 | .ret, |
| 171 | .ret_safe, | 171 | .ret_safe, |
| 172 | .ret_load, | 172 | .ret_load, |
| 173 | => { | 173 | => { |
| 174 | const un_op = data[@intFromEnum(inst)].un_op; | 174 | const un_op = data[@backingInt(inst)].un_op; |
| 175 | try self.verifyInstOperands(inst, .{ un_op, .none, .none }); | 175 | try self.verifyInstOperands(inst, .{ un_op, .none, .none }); |
| 176 | // This instruction terminates the function, so everything should be dead | 176 | // This instruction terminates the function, so everything should be dead |
| 177 | if (self.live.count() > 0) return invalid("{f}: instructions still alive", .{inst}); | 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,36 +181,36 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 181 | .dbg_arg_inline, | 181 | .dbg_arg_inline, |
| 182 | .wasm_memory_grow, | 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 | try self.verifyInstOperands(inst, .{ pl_op.operand, .none, .none }); | 185 | try self.verifyInstOperands(inst, .{ pl_op.operand, .none, .none }); |
| 186 | }, | 186 | }, |
| 187 | .prefetch => { | 187 | .prefetch => { |
| 188 | const prefetch = data[@intFromEnum(inst)].prefetch; | 188 | const prefetch = data[@backingInt(inst)].prefetch; |
| 189 | try self.verifyInstOperands(inst, .{ prefetch.ptr, .none, .none }); | 189 | try self.verifyInstOperands(inst, .{ prefetch.ptr, .none, .none }); |
| 190 | }, | 190 | }, |
| 191 | .reduce, | 191 | .reduce, |
| 192 | .reduce_optimized, | 192 | .reduce_optimized, |
| 193 | => { | 193 | => { |
| 194 | const reduce = data[@intFromEnum(inst)].reduce; | 194 | const reduce = data[@backingInt(inst)].reduce; |
| 195 | try self.verifyInstOperands(inst, .{ reduce.operand, .none, .none }); | 195 | try self.verifyInstOperands(inst, .{ reduce.operand, .none, .none }); |
| 196 | }, | 196 | }, |
| 197 | .union_init => { | 197 | .union_init => { |
| 198 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | 198 | const ty_pl = data[@backingInt(inst)].ty_pl; |
| 199 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; | 199 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 200 | try self.verifyInstOperands(inst, .{ extra.init, .none, .none }); | 200 | try self.verifyInstOperands(inst, .{ extra.init, .none, .none }); |
| 201 | }, | 201 | }, |
| 202 | .struct_field_ptr, .agg_field_val, .spirv_runtime_array_len => { | 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 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; | 204 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 205 | try self.verifyInstOperands(inst, .{ extra.struct_operand, .none, .none }); | 205 | try self.verifyInstOperands(inst, .{ extra.struct_operand, .none, .none }); |
| 206 | }, | 206 | }, |
| 207 | .field_parent_ptr => { | 207 | .field_parent_ptr => { |
| 208 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | 208 | const ty_pl = data[@backingInt(inst)].ty_pl; |
| 209 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 209 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 210 | try self.verifyInstOperands(inst, .{ extra.field_ptr, .none, .none }); | 210 | try self.verifyInstOperands(inst, .{ extra.field_ptr, .none, .none }); |
| 211 | }, | 211 | }, |
| 212 | .atomic_load => { | 212 | .atomic_load => { |
| 213 | const atomic_load = data[@intFromEnum(inst)].atomic_load; | 213 | const atomic_load = data[@backingInt(inst)].atomic_load; |
| 214 | try self.verifyInstOperands(inst, .{ atomic_load.ptr, .none, .none }); | 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,7 +282,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 282 | .memmove, | 282 | .memmove, |
| 283 | .legalize_vec_elem_val, | 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 | try self.verifyInstOperands(inst, .{ bin_op.lhs, bin_op.rhs, .none }); | 286 | try self.verifyInstOperands(inst, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 287 | }, | 287 | }, |
| 288 | .add_with_overflow, | 288 | .add_with_overflow, |
| ... | @@ -295,7 +295,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { | ... | @@ -295,7 +295,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 295 | .slice_elem_ptr, | 295 | .slice_elem_ptr, |
| 296 | .slice, | 296 | .slice, |
| 297 | => { | 297 | => { |
| 298 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | 298 | const ty_pl = data[@backingInt(inst)].ty_pl; |
| 299 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 299 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 300 | try self.verifyInstOperands(inst, .{ extra.lhs, extra.rhs, .none }); | 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,38 +310,38 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 310 | .cmp_vector, | 310 | .cmp_vector, |
| 311 | .cmp_vector_optimized, | 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 | const extra = self.air.extraData(Air.VectorCmp, ty_pl.payload).data; | 314 | const extra = self.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 315 | try self.verifyInstOperands(inst, .{ extra.lhs, extra.rhs, .none }); | 315 | try self.verifyInstOperands(inst, .{ extra.lhs, extra.rhs, .none }); |
| 316 | }, | 316 | }, |
| 317 | .atomic_rmw => { | 317 | .atomic_rmw => { |
| 318 | const pl_op = data[@intFromEnum(inst)].pl_op; | 318 | const pl_op = data[@backingInt(inst)].pl_op; |
| 319 | const extra = self.air.extraData(Air.AtomicRmw, pl_op.payload).data; | 319 | const extra = self.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 320 | try self.verifyInstOperands(inst, .{ pl_op.operand, extra.operand, .none }); | 320 | try self.verifyInstOperands(inst, .{ pl_op.operand, extra.operand, .none }); |
| 321 | }, | 321 | }, |
| 322 | 322 | ||
| 323 | // ternary | 323 | // ternary |
| 324 | .select => { | 324 | .select => { |
| 325 | const pl_op = data[@intFromEnum(inst)].pl_op; | 325 | const pl_op = data[@backingInt(inst)].pl_op; |
| 326 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; | 326 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 327 | try self.verifyInstOperands(inst, .{ pl_op.operand, extra.lhs, extra.rhs }); | 327 | try self.verifyInstOperands(inst, .{ pl_op.operand, extra.lhs, extra.rhs }); |
| 328 | }, | 328 | }, |
| 329 | .mul_add => { | 329 | .mul_add => { |
| 330 | const pl_op = data[@intFromEnum(inst)].pl_op; | 330 | const pl_op = data[@backingInt(inst)].pl_op; |
| 331 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; | 331 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 332 | try self.verifyInstOperands(inst, .{ extra.lhs, extra.rhs, pl_op.operand }); | 332 | try self.verifyInstOperands(inst, .{ extra.lhs, extra.rhs, pl_op.operand }); |
| 333 | }, | 333 | }, |
| 334 | .cmpxchg_strong, | 334 | .cmpxchg_strong, |
| 335 | .cmpxchg_weak, | 335 | .cmpxchg_weak, |
| 336 | => { | 336 | => { |
| 337 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | 337 | const ty_pl = data[@backingInt(inst)].ty_pl; |
| 338 | const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data; | 338 | const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 339 | try self.verifyInstOperands(inst, .{ extra.ptr, extra.expected_value, extra.new_value }); | 339 | try self.verifyInstOperands(inst, .{ extra.ptr, extra.expected_value, extra.new_value }); |
| 340 | }, | 340 | }, |
| 341 | 341 | ||
| 342 | // big tombs | 342 | // big tombs |
| 343 | .aggregate_init => { | 343 | .aggregate_init => { |
| 344 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | 344 | const ty_pl = data[@backingInt(inst)].ty_pl; |
| 345 | const aggregate_ty = ty_pl.ty.toType(); | 345 | const aggregate_ty = ty_pl.ty.toType(); |
| 346 | const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip))); | 346 | const len = @as(usize, @intCast(aggregate_ty.arrayLenIp(ip))); |
| 347 | const elements = @as([]const Air.Inst.Ref, @ptrCast(self.air.extra.items[ty_pl.payload..][0..len])); | 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,7 +422,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 422 | try self.verifyInst(inst); | 422 | try self.verifyInst(inst); |
| 423 | }, | 423 | }, |
| 424 | .br => { | 424 | .br => { |
| 425 | const br = data[@intFromEnum(inst)].br; | 425 | const br = data[@backingInt(inst)].br; |
| 426 | const gop = try self.blocks.getOrPut(self.gpa, br.block_inst); | 426 | const gop = try self.blocks.getOrPut(self.gpa, br.block_inst); |
| 427 | 427 | ||
| 428 | try self.verifyOperand(inst, br.operand, self.liveness.operandDies(inst, 0)); | 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,14 +434,14 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 434 | try self.verifyInst(inst); | 434 | try self.verifyInst(inst); |
| 435 | }, | 435 | }, |
| 436 | .repeat => { | 436 | .repeat => { |
| 437 | const repeat = data[@intFromEnum(inst)].repeat; | 437 | const repeat = data[@backingInt(inst)].repeat; |
| 438 | const expected_live = self.loops.get(repeat.loop_inst) orelse | 438 | const expected_live = self.loops.get(repeat.loop_inst) orelse |
| 439 | return invalid("{f}: loop {f} not in scope", .{ inst, repeat.loop_inst }); | 439 | return invalid("{f}: loop {f} not in scope", .{ inst, repeat.loop_inst }); |
| 440 | 440 | ||
| 441 | try self.verifyMatchingLiveness(repeat.loop_inst, expected_live); | 441 | try self.verifyMatchingLiveness(repeat.loop_inst, expected_live); |
| 442 | }, | 442 | }, |
| 443 | .switch_dispatch => { | 443 | .switch_dispatch => { |
| 444 | const br = data[@intFromEnum(inst)].br; | 444 | const br = data[@backingInt(inst)].br; |
| 445 | 445 | ||
| 446 | try self.verifyOperand(inst, br.operand, self.liveness.operandDies(inst, 0)); | 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,7 +451,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 451 | try self.verifyMatchingLiveness(br.block_inst, expected_live); | 451 | try self.verifyMatchingLiveness(br.block_inst, expected_live); |
| 452 | }, | 452 | }, |
| 453 | .block, .dbg_inline_block => |tag| { | 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 | const block_ty = ty_pl.ty.toType(); | 455 | const block_ty = ty_pl.ty.toType(); |
| 456 | const block_body = switch (tag) { | 456 | const block_body = switch (tag) { |
| 457 | .block => self.air.unwrapBlock(inst).body, | 457 | .block => self.air.unwrapBlock(inst).body, |
| ... | @@ -570,7 +570,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { | ... | @@ -570,7 +570,7 @@ fn verifyBody(self: *Verify, body: []const Air.Inst.Index) Error!void { |
| 570 | try self.verifyInst(inst); | 570 | try self.verifyInst(inst); |
| 571 | }, | 571 | }, |
| 572 | .legalize_vec_store_elem => { | 572 | .legalize_vec_store_elem => { |
| 573 | const pl_op = data[@intFromEnum(inst)].pl_op; | 573 | const pl_op = data[@backingInt(inst)].pl_op; |
| 574 | const bin = self.air.extraData(Air.Bin, pl_op.payload).data; | 574 | const bin = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 575 | try self.verifyInstOperands(inst, .{ pl_op.operand, bin.lhs, bin.rhs }); | 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,7 +69,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 69 | const data = air.instructions.items(.data); | 69 | const data = air.instructions.items(.data); |
| 70 | for (body_insts, 0..) |inst, body_index| { | 70 | for (body_insts, 0..) |inst, body_index| { |
| 71 | verify.cur_inst = inst; | 71 | verify.cur_inst = inst; |
| 72 | switch (tags[@intFromEnum(inst)]) { | 72 | switch (tags[@backingInt(inst)]) { |
| 73 | .block => { | 73 | .block => { |
| 74 | const block = air.unwrapBlock(inst); | 74 | const block = air.unwrapBlock(inst); |
| 75 | try verify.body(block.body); | 75 | try verify.body(block.body); |
| ... | @@ -107,11 +107,11 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { | ... | @@ -107,11 +107,11 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 107 | } | 107 | } |
| 108 | }, | 108 | }, |
| 109 | .ret, .ret_safe => { | 109 | .ret, .ret_safe => { |
| 110 | const operand = data[@intFromEnum(inst)].un_op; | 110 | const operand = data[@backingInt(inst)].un_op; |
| 111 | if (air.typeOf(operand, ip).toIntern() != verify.ret_ty.toIntern()) return verify.fail("bad return type"); | 111 | if (air.typeOf(operand, ip).toIntern() != verify.ret_ty.toIntern()) return verify.fail("bad return type"); |
| 112 | }, | 112 | }, |
| 113 | .ret_load => { | 113 | .ret_load => { |
| 114 | const operand = data[@intFromEnum(inst)].un_op; | 114 | const operand = data[@backingInt(inst)].un_op; |
| 115 | const ptr_ty = air.typeOf(operand, ip); | 115 | const ptr_ty = air.typeOf(operand, ip); |
| 116 | if (ptr_ty.zigTypeTag(zcu) != .pointer) return verify.fail("operand is not a pointer"); | 116 | if (ptr_ty.zigTypeTag(zcu) != .pointer) return verify.fail("operand is not a pointer"); |
| 117 | if (ptr_ty.ptrSize(zcu) != .one) return verify.fail("pointer size is not '.one'"); | 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,7 +119,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 119 | }, | 119 | }, |
| 120 | 120 | ||
| 121 | .bit_cast, .bit_cast_safe => { | 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 | const operand_ty = air.typeOf(ty_op.operand, ip); | 123 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 124 | const result_ty = ty_op.ty.toType(); | 124 | const result_ty = ty_op.ty.toType(); |
| 125 | // Enums are allowed here even if their backing type is implicit. | 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,7 +134,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 134 | if (operand_ty.bitSize(zcu) != result_ty.bitSize(zcu)) return verify.fail("bit size mismatch"); | 134 | if (operand_ty.bitSize(zcu) != result_ty.bitSize(zcu)) return verify.fail("bit size mismatch"); |
| 135 | }, | 135 | }, |
| 136 | .ptr_cast => { | 136 | .ptr_cast => { |
| 137 | const ty_op = data[@intFromEnum(inst)].ty_op; | 137 | const ty_op = data[@backingInt(inst)].ty_op; |
| 138 | const operand_ty = air.typeOf(ty_op.operand, ip); | 138 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 139 | const result_ty = ty_op.ty.toType(); | 139 | const result_ty = ty_op.ty.toType(); |
| 140 | const operand_scalar_ty = operand_ty.scalarType(zcu); | 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,7 +152,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 152 | } | 152 | } |
| 153 | }, | 153 | }, |
| 154 | .ptr_from_int => { | 154 | .ptr_from_int => { |
| 155 | const ty_op = data[@intFromEnum(inst)].ty_op; | 155 | const ty_op = data[@backingInt(inst)].ty_op; |
| 156 | const operand_ty = air.typeOf(ty_op.operand, ip); | 156 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 157 | const result_ty = ty_op.ty.toType(); | 157 | const result_ty = ty_op.ty.toType(); |
| 158 | const operand_scalar_ty = operand_ty.scalarType(zcu); | 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,7 +163,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 163 | if (!operand_ty.isVector(zcu) and result_ty.isVector(zcu)) return verify.fail("result is vector, but operand is not"); | 163 | if (!operand_ty.isVector(zcu) and result_ty.isVector(zcu)) return verify.fail("result is vector, but operand is not"); |
| 164 | }, | 164 | }, |
| 165 | .int_from_ptr => { | 165 | .int_from_ptr => { |
| 166 | const ty_op = data[@intFromEnum(inst)].ty_op; | 166 | const ty_op = data[@backingInt(inst)].ty_op; |
| 167 | const operand_ty = air.typeOf(ty_op.operand, ip); | 167 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 168 | const result_ty = ty_op.ty.toType(); | 168 | const result_ty = ty_op.ty.toType(); |
| 169 | const operand_scalar_ty = operand_ty.scalarType(zcu); | 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,7 +174,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 174 | if (!operand_ty.isVector(zcu) and result_ty.isVector(zcu)) return verify.fail("result is vector, but operand is not"); | 174 | if (!operand_ty.isVector(zcu) and result_ty.isVector(zcu)) return verify.fail("result is vector, but operand is not"); |
| 175 | }, | 175 | }, |
| 176 | .error_cast => { | 176 | .error_cast => { |
| 177 | const ty_op = data[@intFromEnum(inst)].ty_op; | 177 | const ty_op = data[@backingInt(inst)].ty_op; |
| 178 | const operand_ty = air.typeOf(ty_op.operand, ip); | 178 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 179 | const result_ty = ty_op.ty.toType(); | 179 | const result_ty = ty_op.ty.toType(); |
| 180 | switch (operand_ty.zigTypeTag(zcu)) { | 180 | switch (operand_ty.zigTypeTag(zcu)) { |
| ... | @@ -193,7 +193,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { | ... | @@ -193,7 +193,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 193 | } | 193 | } |
| 194 | }, | 194 | }, |
| 195 | .error_from_int => { | 195 | .error_from_int => { |
| 196 | const ty_op = data[@intFromEnum(inst)].ty_op; | 196 | const ty_op = data[@backingInt(inst)].ty_op; |
| 197 | const operand_ty = air.typeOf(ty_op.operand, ip); | 197 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 198 | const result_ty = ty_op.ty.toType(); | 198 | const result_ty = ty_op.ty.toType(); |
| 199 | if (!operand_ty.isUnsignedInt(zcu)) return verify.fail("bad operand type"); | 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,7 +201,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 201 | if (result_ty.zigTypeTag(zcu) != .error_set) return verify.fail("bad result type"); | 201 | if (result_ty.zigTypeTag(zcu) != .error_set) return verify.fail("bad result type"); |
| 202 | }, | 202 | }, |
| 203 | .int_from_error => { | 203 | .int_from_error => { |
| 204 | const ty_op = data[@intFromEnum(inst)].ty_op; | 204 | const ty_op = data[@backingInt(inst)].ty_op; |
| 205 | const operand_ty = air.typeOf(ty_op.operand, ip); | 205 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 206 | const result_ty = ty_op.ty.toType(); | 206 | const result_ty = ty_op.ty.toType(); |
| 207 | if (operand_ty.zigTypeTag(zcu) != .error_set) return verify.fail("bad operand type"); | 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,7 +209,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 209 | if (result_ty.bitSize(zcu) != zcu.errorSetBits()) return verify.fail("bad result bit size"); | 209 | if (result_ty.bitSize(zcu) != zcu.errorSetBits()) return verify.fail("bad result bit size"); |
| 210 | }, | 210 | }, |
| 211 | .union_from_enum => { | 211 | .union_from_enum => { |
| 212 | const ty_op = data[@intFromEnum(inst)].ty_op; | 212 | const ty_op = data[@backingInt(inst)].ty_op; |
| 213 | const operand_ty = air.typeOf(ty_op.operand, ip); | 213 | const operand_ty = air.typeOf(ty_op.operand, ip); |
| 214 | const result_ty = ty_op.ty.toType(); | 214 | const result_ty = ty_op.ty.toType(); |
| 215 | if (operand_ty.zigTypeTag(zcu) != .@"enum") return verify.fail("bad operand type"); | 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,7 +219,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 219 | }, | 219 | }, |
| 220 | 220 | ||
| 221 | .ptr_elem_ptr => { | 221 | .ptr_elem_ptr => { |
| 222 | const ty_pl = data[@intFromEnum(inst)].ty_pl; | 222 | const ty_pl = data[@backingInt(inst)].ty_pl; |
| 223 | const bin_op = air.extraData(Air.Bin, ty_pl.payload).data; | 223 | const bin_op = air.extraData(Air.Bin, ty_pl.payload).data; |
| 224 | const ptr_ty = air.typeOf(bin_op.lhs, ip); | 224 | const ptr_ty = air.typeOf(bin_op.lhs, ip); |
| 225 | const result_ty = ty_pl.ty.toType(); | 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,7 +442,7 @@ fn body(verify: *Verify, body_insts: []const Air.Inst.Index) Error!void { |
| 442 | // probably just needs to live exclusively in backends; putting AIR instructions after a | 442 | // probably just needs to live exclusively in backends; putting AIR instructions after a |
| 443 | // call implies that we have e.g. a valid stack at that point, which we can't actually | 443 | // call implies that we have e.g. a valid stack at that point, which we can't actually |
| 444 | // assume when the user has gotten a function's ABI wrong. | 444 | // assume when the user has gotten a function's ABI wrong. |
| 445 | switch (tags[@intFromEnum(inst)]) { | 445 | switch (tags[@backingInt(inst)]) { |
| 446 | .call, | 446 | .call, |
| 447 | .call_always_tail, | 447 | .call_always_tail, |
| 448 | .call_never_tail, | 448 | .call_never_tail, |
src/Air/print.zig+33-33| ... | @@ -106,7 +106,7 @@ const Writer = struct { | ... | @@ -106,7 +106,7 @@ const Writer = struct { |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | fn writeInst(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try s.splatByteAll(' ', w.indent); | 110 | try s.splatByteAll(' ', w.indent); |
| 111 | try s.print("{f}{c}= {s}(", .{ | 111 | try s.print("{f}{c}= {s}(", .{ |
| 112 | inst, | 112 | inst, |
| ... | @@ -357,14 +357,14 @@ const Writer = struct { | ... | @@ -357,14 +357,14 @@ const Writer = struct { |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | fn writeBinOp(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try w.writeOperand(s, inst, 0, bin_op.lhs); | 361 | try w.writeOperand(s, inst, 0, bin_op.lhs); |
| 362 | try s.writeAll(", "); | 362 | try s.writeAll(", "); |
| 363 | try w.writeOperand(s, inst, 1, bin_op.rhs); | 363 | try w.writeOperand(s, inst, 1, bin_op.rhs); |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | fn writeUnOp(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try w.writeOperand(s, inst, 0, un_op); | 368 | try w.writeOperand(s, inst, 0, un_op); |
| 369 | } | 369 | } |
| 370 | 370 | ||
| ... | @@ -380,25 +380,25 @@ const Writer = struct { | ... | @@ -380,25 +380,25 @@ const Writer = struct { |
| 380 | } | 380 | } |
| 381 | 381 | ||
| 382 | fn writeTy(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try w.writeType(s, ty); | 384 | try w.writeType(s, ty); |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | fn writeArg(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try w.writeType(s, arg.ty.toType()); | 389 | try w.writeType(s, arg.ty.toType()); |
| 390 | try s.print(", {d}", .{arg.zir_param_index}); | 390 | try s.print(", {d}", .{arg.zir_param_index}); |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | fn writeTyOp(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try w.writeType(s, ty_op.ty.toType()); | 395 | try w.writeType(s, ty_op.ty.toType()); |
| 396 | try s.writeAll(", "); | 396 | try s.writeAll(", "); |
| 397 | try w.writeOperand(s, inst, 0, ty_op.operand); | 397 | try w.writeOperand(s, inst, 0, ty_op.operand); |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | fn writeBlock(w: *Writer, s: *std.Io.Writer, tag: Air.Inst.Tag, inst: Air.Inst.Index) Error!void { | 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 | try w.writeType(s, ty_pl.ty.toType()); | 402 | try w.writeType(s, ty_pl.ty.toType()); |
| 403 | 403 | ||
| 404 | const body = switch (tag) { | 404 | const body = switch (tag) { |
| ... | @@ -446,7 +446,7 @@ const Writer = struct { | ... | @@ -446,7 +446,7 @@ const Writer = struct { |
| 446 | 446 | ||
| 447 | fn writeAggregateInit(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 447 | fn writeAggregateInit(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 448 | const zcu = w.pt.zcu; | 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 | const vector_ty = ty_pl.ty.toType(); | 450 | const vector_ty = ty_pl.ty.toType(); |
| 451 | const len = @as(usize, @intCast(vector_ty.arrayLen(zcu))); | 451 | const len = @as(usize, @intCast(vector_ty.arrayLen(zcu))); |
| 452 | const elements = @as([]const Air.Inst.Ref, @ptrCast(w.air.extra.items[ty_pl.payload..][0..len])); | 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,7 +461,7 @@ const Writer = struct { |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | fn writeUnionInit(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | const extra = w.air.extraData(Air.UnionInit, ty_pl.payload).data; | 465 | const extra = w.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 466 | 466 | ||
| 467 | try s.print("{d}, ", .{extra.field_index}); | 467 | try s.print("{d}, ", .{extra.field_index}); |
| ... | @@ -469,7 +469,7 @@ const Writer = struct { | ... | @@ -469,7 +469,7 @@ const Writer = struct { |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | fn writeStructField(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | const extra = w.air.extraData(Air.StructField, ty_pl.payload).data; | 473 | const extra = w.air.extraData(Air.StructField, ty_pl.payload).data; |
| 474 | 474 | ||
| 475 | try w.writeOperand(s, inst, 0, extra.struct_operand); | 475 | try w.writeOperand(s, inst, 0, extra.struct_operand); |
| ... | @@ -478,10 +478,10 @@ const Writer = struct { | ... | @@ -478,10 +478,10 @@ const Writer = struct { |
| 478 | 478 | ||
| 479 | fn writeTyPlBin(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 479 | fn writeTyPlBin(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 480 | const data = w.air.instructions.items(.data); | 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 | const extra = w.air.extraData(Air.Bin, ty_pl.payload).data; | 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 | try w.writeType(s, inst_ty); | 485 | try w.writeType(s, inst_ty); |
| 486 | try s.writeAll(", "); | 486 | try s.writeAll(", "); |
| 487 | try w.writeOperand(s, inst, 0, extra.lhs); | 487 | try w.writeOperand(s, inst, 0, extra.lhs); |
| ... | @@ -490,7 +490,7 @@ const Writer = struct { | ... | @@ -490,7 +490,7 @@ const Writer = struct { |
| 490 | } | 490 | } |
| 491 | 491 | ||
| 492 | fn writeCmpxchg(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | const extra = w.air.extraData(Air.Cmpxchg, ty_pl.payload).data; | 494 | const extra = w.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 495 | 495 | ||
| 496 | try w.writeOperand(s, inst, 0, extra.ptr); | 496 | try w.writeOperand(s, inst, 0, extra.ptr); |
| ... | @@ -504,7 +504,7 @@ const Writer = struct { | ... | @@ -504,7 +504,7 @@ const Writer = struct { |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | fn writeMulAdd(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | const extra = w.air.extraData(Air.Bin, pl_op.payload).data; | 508 | const extra = w.air.extraData(Air.Bin, pl_op.payload).data; |
| 509 | 509 | ||
| 510 | try w.writeOperand(s, inst, 0, extra.lhs); | 510 | try w.writeOperand(s, inst, 0, extra.lhs); |
| ... | @@ -515,7 +515,7 @@ const Writer = struct { | ... | @@ -515,7 +515,7 @@ const Writer = struct { |
| 515 | } | 515 | } |
| 516 | 516 | ||
| 517 | fn writeLegalizeVecStoreElem(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | const bin = w.air.extraData(Air.Bin, pl_op.payload).data; | 519 | const bin = w.air.extraData(Air.Bin, pl_op.payload).data; |
| 520 | 520 | ||
| 521 | try w.writeOperand(s, inst, 0, pl_op.operand); | 521 | try w.writeOperand(s, inst, 0, pl_op.operand); |
| ... | @@ -574,7 +574,7 @@ const Writer = struct { | ... | @@ -574,7 +574,7 @@ const Writer = struct { |
| 574 | 574 | ||
| 575 | fn writeSelect(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 575 | fn writeSelect(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 576 | const zcu = w.pt.zcu; | 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 | const extra = w.air.extraData(Air.Bin, pl_op.payload).data; | 578 | const extra = w.air.extraData(Air.Bin, pl_op.payload).data; |
| 579 | 579 | ||
| 580 | const elem_ty = w.typeOfIndex(inst).childType(zcu); | 580 | const elem_ty = w.typeOfIndex(inst).childType(zcu); |
| ... | @@ -588,14 +588,14 @@ const Writer = struct { | ... | @@ -588,14 +588,14 @@ const Writer = struct { |
| 588 | } | 588 | } |
| 589 | 589 | ||
| 590 | fn writeReduce(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try w.writeOperand(s, inst, 0, reduce.operand); | 593 | try w.writeOperand(s, inst, 0, reduce.operand); |
| 594 | try s.print(", {s}", .{@tagName(reduce.operation)}); | 594 | try s.print(", {s}", .{@tagName(reduce.operation)}); |
| 595 | } | 595 | } |
| 596 | 596 | ||
| 597 | fn writeCmpVector(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | const extra = w.air.extraData(Air.VectorCmp, ty_pl.payload).data; | 599 | const extra = w.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 600 | 600 | ||
| 601 | try s.print("{s}, ", .{@tagName(extra.compareOperator())}); | 601 | try s.print("{s}, ", .{@tagName(extra.compareOperator())}); |
| ... | @@ -606,20 +606,20 @@ const Writer = struct { | ... | @@ -606,20 +606,20 @@ const Writer = struct { |
| 606 | 606 | ||
| 607 | fn writeRuntimeNavPtr(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 607 | fn writeRuntimeNavPtr(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { |
| 608 | const ip = &w.pt.zcu.intern_pool; | 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 | try w.writeType(s, .fromInterned(ty_nav.ty)); | 610 | try w.writeType(s, .fromInterned(ty_nav.ty)); |
| 611 | try s.print(", '{f}'", .{ip.getNav(ty_nav.nav).fqn.fmt(ip)}); | 611 | try s.print(", '{f}'", .{ip.getNav(ty_nav.nav).fqn.fmt(ip)}); |
| 612 | } | 612 | } |
| 613 | 613 | ||
| 614 | fn writeAtomicLoad(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try w.writeOperand(s, inst, 0, atomic_load.ptr); | 617 | try w.writeOperand(s, inst, 0, atomic_load.ptr); |
| 618 | try s.print(", {s}", .{@tagName(atomic_load.order)}); | 618 | try s.print(", {s}", .{@tagName(atomic_load.order)}); |
| 619 | } | 619 | } |
| 620 | 620 | ||
| 621 | fn writePrefetch(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try w.writeOperand(s, inst, 0, prefetch.ptr); | 624 | try w.writeOperand(s, inst, 0, prefetch.ptr); |
| 625 | try s.print(", {s}, {d}, {s}", .{ | 625 | try s.print(", {s}, {d}, {s}", .{ |
| ... | @@ -633,7 +633,7 @@ const Writer = struct { | ... | @@ -633,7 +633,7 @@ const Writer = struct { |
| 633 | inst: Air.Inst.Index, | 633 | inst: Air.Inst.Index, |
| 634 | order: std.lang.AtomicOrder, | 634 | order: std.lang.AtomicOrder, |
| 635 | ) Error!void { | 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 | try w.writeOperand(s, inst, 0, bin_op.lhs); | 637 | try w.writeOperand(s, inst, 0, bin_op.lhs); |
| 638 | try s.writeAll(", "); | 638 | try s.writeAll(", "); |
| 639 | try w.writeOperand(s, inst, 1, bin_op.rhs); | 639 | try w.writeOperand(s, inst, 1, bin_op.rhs); |
| ... | @@ -641,7 +641,7 @@ const Writer = struct { | ... | @@ -641,7 +641,7 @@ const Writer = struct { |
| 641 | } | 641 | } |
| 642 | 642 | ||
| 643 | fn writeAtomicRmw(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | const extra = w.air.extraData(Air.AtomicRmw, pl_op.payload).data; | 645 | const extra = w.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 646 | 646 | ||
| 647 | try w.writeOperand(s, inst, 0, pl_op.operand); | 647 | try w.writeOperand(s, inst, 0, pl_op.operand); |
| ... | @@ -651,7 +651,7 @@ const Writer = struct { | ... | @@ -651,7 +651,7 @@ const Writer = struct { |
| 651 | } | 651 | } |
| 652 | 652 | ||
| 653 | fn writeFieldParentPtr(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | const extra = w.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 655 | const extra = w.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 656 | 656 | ||
| 657 | try w.writeOperand(s, inst, 0, extra.field_ptr); | 657 | try w.writeOperand(s, inst, 0, extra.field_ptr); |
| ... | @@ -719,14 +719,14 @@ const Writer = struct { | ... | @@ -719,14 +719,14 @@ const Writer = struct { |
| 719 | } | 719 | } |
| 720 | 720 | ||
| 721 | fn writeDbgStmt(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try s.print("{d}:{d}", .{ dbg_stmt.line + 1, dbg_stmt.column + 1 }); | 723 | try s.print("{d}:{d}", .{ dbg_stmt.line + 1, dbg_stmt.column + 1 }); |
| 724 | } | 724 | } |
| 725 | 725 | ||
| 726 | fn writeDbgVar(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try w.writeOperand(s, inst, 0, pl_op.operand); | 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 | try s.print(", \"{f}\"", .{std.zig.fmtString(name.toSlice(w.air))}); | 730 | try s.print(", \"{f}\"", .{std.zig.fmtString(name.toSlice(w.air))}); |
| 731 | } | 731 | } |
| 732 | 732 | ||
| ... | @@ -743,14 +743,14 @@ const Writer = struct { | ... | @@ -743,14 +743,14 @@ const Writer = struct { |
| 743 | } | 743 | } |
| 744 | 744 | ||
| 745 | fn writeBr(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try w.writeInstIndex(s, br.block_inst, false); | 747 | try w.writeInstIndex(s, br.block_inst, false); |
| 748 | try s.writeAll(", "); | 748 | try s.writeAll(", "); |
| 749 | try w.writeOperand(s, inst, 0, br.operand); | 749 | try w.writeOperand(s, inst, 0, br.operand); |
| 750 | } | 750 | } |
| 751 | 751 | ||
| 752 | fn writeRepeat(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try w.writeInstIndex(s, repeat.loop_inst, false); | 754 | try w.writeInstIndex(s, repeat.loop_inst, false); |
| 755 | } | 755 | } |
| 756 | 756 | ||
| ... | @@ -968,18 +968,18 @@ const Writer = struct { | ... | @@ -968,18 +968,18 @@ const Writer = struct { |
| 968 | } | 968 | } |
| 969 | 969 | ||
| 970 | fn writeWasmMemorySize(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try s.print("{d}", .{pl_op.payload}); | 972 | try s.print("{d}", .{pl_op.payload}); |
| 973 | } | 973 | } |
| 974 | 974 | ||
| 975 | fn writeWasmMemoryGrow(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try s.print("{d}, ", .{pl_op.payload}); | 977 | try s.print("{d}, ", .{pl_op.payload}); |
| 978 | try w.writeOperand(s, inst, 0, pl_op.operand); | 978 | try w.writeOperand(s, inst, 0, pl_op.operand); |
| 979 | } | 979 | } |
| 980 | 980 | ||
| 981 | fn writeWorkDimension(w: *Writer, s: *std.Io.Writer, inst: Air.Inst.Index) Error!void { | 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 | try s.print("{d}", .{pl_op.payload}); | 983 | try s.print("{d}", .{pl_op.payload}); |
| 984 | } | 984 | } |
| 985 | 985 | ||
| ... | @@ -1015,7 +1015,7 @@ const Writer = struct { | ... | @@ -1015,7 +1015,7 @@ const Writer = struct { |
| 1015 | operand: Air.Inst.Ref, | 1015 | operand: Air.Inst.Ref, |
| 1016 | dies: bool, | 1016 | dies: bool, |
| 1017 | ) Error!void { | 1017 | ) Error!void { |
| 1018 | if (@intFromEnum(operand) < InternPool.static_len) { | 1018 | if (@backingInt(operand) < InternPool.static_len) { |
| 1019 | return s.print("@{}", .{operand}); | 1019 | return s.print("@{}", .{operand}); |
| 1020 | } else if (operand.toInterned()) |ip_index| { | 1020 | } else if (operand.toInterned()) |ip_index| { |
| 1021 | const pt = w.pt; | 1021 | const pt = w.pt; |
src/Compilation.zig+39-39| ... | @@ -418,7 +418,7 @@ pub const Path = struct { | ... | @@ -418,7 +418,7 @@ pub const Path = struct { |
| 418 | /// The added data is relocatable across any compiler process using the same lib and cache | 418 | /// The added data is relocatable across any compiler process using the same lib and cache |
| 419 | /// directories; it does not depend on cwd. | 419 | /// directories; it does not depend on cwd. |
| 420 | pub fn addToHasher(p: Path, h: *Cache.Hasher) void { | 420 | pub fn addToHasher(p: Path, h: *Cache.Hasher) void { |
| 421 | h.update(&.{@intFromEnum(p.root)}); | 421 | h.update(&.{@backingInt(p.root)}); |
| 422 | h.update(p.sub_path); | 422 | h.update(p.sub_path); |
| 423 | } | 423 | } |
| 424 | 424 | ||
| ... | @@ -843,7 +843,7 @@ pub const CObject = struct { | ... | @@ -843,7 +843,7 @@ pub const CObject = struct { |
| 843 | 843 | ||
| 844 | pub fn addToErrorBundle(diag: *const Diag, io: Io, eb: *ErrorBundle.Wip, bundle: Bundle, note: *u32) !void { | 844 | pub fn addToErrorBundle(diag: *const Diag, io: Io, eb: *ErrorBundle.Wip, bundle: Bundle, note: *u32) !void { |
| 845 | const err_msg = try eb.addErrorMessage(try diag.toErrorMessage(io, eb, bundle, 0)); | 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 | note.* += 1; | 847 | note.* += 1; |
| 848 | for (diag.sub_diags) |sub_diag| try sub_diag.addToErrorBundle(io, eb, bundle, note); | 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,12 +976,12 @@ pub const CObject = struct { |
| 976 | 976 | ||
| 977 | try bc.checkMagic("DIAG"); | 977 | try bc.checkMagic("DIAG"); |
| 978 | while (try bc.next()) |item| switch (item) { | 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 | .Meta => if (stack.items.len > 0) try bc.skipBlock(block), | 980 | .Meta => if (stack.items.len > 0) try bc.skipBlock(block), |
| 981 | .Diag => try stack.append(gpa, .{}), | 981 | .Diag => try stack.append(gpa, .{}), |
| 982 | _ => try bc.skipBlock(block), | 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 | .Version => if (record.operands[0] != 2) return error.InvalidVersion, | 985 | .Version => if (record.operands[0] != 2) return error.InvalidVersion, |
| 986 | .DiagInfo => { | 986 | .DiagInfo => { |
| 987 | const top = &stack.items[stack.items.len - 1]; | 987 | const top = &stack.items[stack.items.len - 1]; |
| ... | @@ -1027,7 +1027,7 @@ pub const CObject = struct { | ... | @@ -1027,7 +1027,7 @@ pub const CObject = struct { |
| 1027 | .FixIt => {}, | 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 | .Meta => {}, | 1031 | .Meta => {}, |
| 1032 | .Diag => { | 1032 | .Diag => { |
| 1033 | try stack.items[stack.items.len - 2].sub_diags.ensureUnusedCapacity(gpa, 1); | 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,26 +2401,26 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2401 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); | 2401 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2402 | 2402 | ||
| 2403 | if (musl.needsCrt0(comp.config.output_mode, comp.config.link_mode, comp.config.pie)) |f| { | 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 | switch (comp.config.link_mode) { | 2406 | switch (comp.config.link_mode) { |
| 2407 | .static => comp.queued_jobs.musl_crt_file[@intFromEnum(musl.CrtFile.libc_a)] = true, | 2407 | .static => comp.queued_jobs.musl_crt_file[@backingInt(musl.CrtFile.libc_a)] = true, |
| 2408 | .dynamic => comp.queued_jobs.musl_crt_file[@intFromEnum(musl.CrtFile.libc_so)] = true, | 2408 | .dynamic => comp.queued_jobs.musl_crt_file[@backingInt(musl.CrtFile.libc_so)] = true, |
| 2409 | } | 2409 | } |
| 2410 | } else if (target.isGnuLibC()) { | 2410 | } else if (target.isGnuLibC()) { |
| 2411 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); | 2411 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2412 | 2412 | ||
| 2413 | if (glibc.needsCrt0(comp.config.output_mode)) |f| { | 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 | comp.queued_jobs.glibc_shared_objects = true; | 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 | } else if (target.isFreeBSDLibC()) { | 2419 | } else if (target.isFreeBSDLibC()) { |
| 2420 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); | 2420 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2421 | 2421 | ||
| 2422 | if (freebsd.needsCrt0(comp.config.output_mode)) |f| { | 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 | comp.queued_jobs.freebsd_shared_objects = true; | 2426 | comp.queued_jobs.freebsd_shared_objects = true; |
| ... | @@ -2428,7 +2428,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, | ... | @@ -2428,7 +2428,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2428 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); | 2428 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2429 | 2429 | ||
| 2430 | if (netbsd.needsCrt0(comp.config.output_mode)) |f| { | 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 | comp.queued_jobs.netbsd_shared_objects = true; | 2434 | comp.queued_jobs.netbsd_shared_objects = true; |
| ... | @@ -2436,21 +2436,21 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, | ... | @@ -2436,21 +2436,21 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2436 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); | 2436 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2437 | 2437 | ||
| 2438 | if (openbsd.needsCrt0(comp.config.output_mode)) |f| { | 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 | comp.queued_jobs.openbsd_shared_objects = true; | 2442 | comp.queued_jobs.openbsd_shared_objects = true; |
| 2443 | } else if (target.isWasiLibC()) { | 2443 | } else if (target.isWasiLibC()) { |
| 2444 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); | 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; | 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[@intFromEnum(wasi_libc.CrtFile.libc_a)] = true; | 2447 | comp.queued_jobs.wasi_libc_crt_file[@backingInt(wasi_libc.CrtFile.libc_a)] = true; |
| 2448 | } else if (target.isMinGW()) { | 2448 | } else if (target.isMinGW()) { |
| 2449 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); | 2449 | if (!std.zig.target.canBuildLibC(target)) return diag.fail(.cross_libc_unavailable); |
| 2450 | 2450 | ||
| 2451 | const main_crt_file: mingw.CrtFile = if (is_dyn_lib) .dllcrt2_o else .crt2_o; | 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; | 2452 | comp.queued_jobs.mingw_crt_file[@backingInt(main_crt_file)] = true; |
| 2453 | comp.queued_jobs.mingw_crt_file[@intFromEnum(mingw.CrtFile.libmingw32_lib)] = true; | 2453 | comp.queued_jobs.mingw_crt_file[@backingInt(mingw.CrtFile.libmingw32_lib)] = true; |
| 2454 | 2454 | ||
| 2455 | // When linking mingw-w64 there are some import libs we always need. | 2455 | // When linking mingw-w64 there are some import libs we always need. |
| 2456 | try comp.windows_libs.ensureUnusedCapacity(gpa, mingw.always_link_libs.len); | 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,7 +3783,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) error{OutOfMemory}!ErrorBundle { |
| 3783 | }); | 3783 | }); |
| 3784 | const notes_start = try bundle.reserveNotes(notes_len); | 3784 | const notes_start = try bundle.reserveNotes(notes_len); |
| 3785 | for (notes_start.., lld_error.context_lines) |note, context_line| { | 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 | .msg = try bundle.addString(context_line), | 3787 | .msg = try bundle.addString(context_line), |
| 3788 | })); | 3788 | })); |
| 3789 | } | 3789 | } |
| ... | @@ -3845,7 +3845,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) error{OutOfMemory}!ErrorBundle { | ... | @@ -3845,7 +3845,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) error{OutOfMemory}!ErrorBundle { |
| 3845 | pub fn lessThan(ctx: @This(), lhs_index: usize, rhs_index: usize) bool { | 3845 | pub fn lessThan(ctx: @This(), lhs_index: usize, rhs_index: usize) bool { |
| 3846 | const lhs_path = ctx.zcu.fileByIndex(ctx.failed_files_keys[lhs_index]).path; | 3846 | const lhs_path = ctx.zcu.fileByIndex(ctx.failed_files_keys[lhs_index]).path; |
| 3847 | const rhs_path = ctx.zcu.fileByIndex(ctx.failed_files_keys[rhs_index]).path; | 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 | return std.mem.order(u8, lhs_path.sub_path, rhs_path.sub_path).compare(.lt); | 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,7 +3946,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) error{OutOfMemory}!ErrorBundle { |
| 3946 | .notes_len = 1, | 3946 | .notes_len = 1, |
| 3947 | }); | 3947 | }); |
| 3948 | const notes_start = try bundle.reserveNotes(1); | 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 | .msg = try bundle.printString("use '--error-limit {d}' to increase limit", .{ | 3950 | .msg = try bundle.printString("use '--error-limit {d}' to increase limit", .{ |
| 3951 | actual_error_count, | 3951 | actual_error_count, |
| 3952 | }), | 3952 | }), |
| ... | @@ -3968,10 +3968,10 @@ pub fn getAllErrorsAlloc(comp: *Compilation) error{OutOfMemory}!ErrorBundle { | ... | @@ -3968,10 +3968,10 @@ pub fn getAllErrorsAlloc(comp: *Compilation) error{OutOfMemory}!ErrorBundle { |
| 3968 | .notes_len = 2, | 3968 | .notes_len = 2, |
| 3969 | }); | 3969 | }); |
| 3970 | const notes_start = try bundle.reserveNotes(2); | 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 | .msg = try bundle.addString("run 'zig libc -h' to learn about libc installations"), | 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 | .msg = try bundle.addString("run 'zig targets' to see the targets for which zig can always provide libc"), | 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,7 +4227,7 @@ pub fn addModuleErrorMsg( |
| 4227 | const notes_start = try eb.reserveNotes(notes_len); | 4227 | const notes_start = try eb.reserveNotes(notes_len); |
| 4228 | 4228 | ||
| 4229 | for (notes_start.., notes.keys()) |i, note| { | 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,7 +4260,7 @@ fn addWholeFileError( |
| 4260 | }); | 4260 | }); |
| 4261 | if (imported_note) |n| { | 4261 | if (imported_note) |n| { |
| 4262 | const note_idx = try eb.reserveNotes(1); | 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,49 +4483,49 @@ fn dispatchPrelinkWork(comp: *Compilation, main_progress_node: std.Progress.Node |
| 4483 | 4483 | ||
| 4484 | for (0..@typeInfo(musl.CrtFile).@"enum".field_names.len) |i| { | 4484 | for (0..@typeInfo(musl.CrtFile).@"enum".field_names.len) |i| { |
| 4485 | if (comp.queued_jobs.musl_crt_file[i]) { | 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 | prelink_group.async(io, buildMuslCrtFile, .{ comp, tag, main_progress_node }); | 4487 | prelink_group.async(io, buildMuslCrtFile, .{ comp, tag, main_progress_node }); |
| 4488 | } | 4488 | } |
| 4489 | } | 4489 | } |
| 4490 | 4490 | ||
| 4491 | for (0..@typeInfo(glibc.CrtFile).@"enum".field_names.len) |i| { | 4491 | for (0..@typeInfo(glibc.CrtFile).@"enum".field_names.len) |i| { |
| 4492 | if (comp.queued_jobs.glibc_crt_file[i]) { | 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 | prelink_group.async(io, buildGlibcCrtFile, .{ comp, tag, main_progress_node }); | 4494 | prelink_group.async(io, buildGlibcCrtFile, .{ comp, tag, main_progress_node }); |
| 4495 | } | 4495 | } |
| 4496 | } | 4496 | } |
| 4497 | 4497 | ||
| 4498 | for (0..@typeInfo(freebsd.CrtFile).@"enum".field_names.len) |i| { | 4498 | for (0..@typeInfo(freebsd.CrtFile).@"enum".field_names.len) |i| { |
| 4499 | if (comp.queued_jobs.freebsd_crt_file[i]) { | 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 | prelink_group.async(io, buildFreeBSDCrtFile, .{ comp, tag, main_progress_node }); | 4501 | prelink_group.async(io, buildFreeBSDCrtFile, .{ comp, tag, main_progress_node }); |
| 4502 | } | 4502 | } |
| 4503 | } | 4503 | } |
| 4504 | 4504 | ||
| 4505 | for (0..@typeInfo(netbsd.CrtFile).@"enum".field_names.len) |i| { | 4505 | for (0..@typeInfo(netbsd.CrtFile).@"enum".field_names.len) |i| { |
| 4506 | if (comp.queued_jobs.netbsd_crt_file[i]) { | 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 | prelink_group.async(io, buildNetBSDCrtFile, .{ comp, tag, main_progress_node }); | 4508 | prelink_group.async(io, buildNetBSDCrtFile, .{ comp, tag, main_progress_node }); |
| 4509 | } | 4509 | } |
| 4510 | } | 4510 | } |
| 4511 | 4511 | ||
| 4512 | for (0..@typeInfo(openbsd.CrtFile).@"enum".field_names.len) |i| { | 4512 | for (0..@typeInfo(openbsd.CrtFile).@"enum".field_names.len) |i| { |
| 4513 | if (comp.queued_jobs.openbsd_crt_file[i]) { | 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 | prelink_group.async(io, buildOpenBSDCrtFile, .{ comp, tag, main_progress_node }); | 4515 | prelink_group.async(io, buildOpenBSDCrtFile, .{ comp, tag, main_progress_node }); |
| 4516 | } | 4516 | } |
| 4517 | } | 4517 | } |
| 4518 | 4518 | ||
| 4519 | for (0..@typeInfo(wasi_libc.CrtFile).@"enum".field_names.len) |i| { | 4519 | for (0..@typeInfo(wasi_libc.CrtFile).@"enum".field_names.len) |i| { |
| 4520 | if (comp.queued_jobs.wasi_libc_crt_file[i]) { | 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 | prelink_group.async(io, buildWasiLibcCrtFile, .{ comp, tag, main_progress_node }); | 4522 | prelink_group.async(io, buildWasiLibcCrtFile, .{ comp, tag, main_progress_node }); |
| 4523 | } | 4523 | } |
| 4524 | } | 4524 | } |
| 4525 | 4525 | ||
| 4526 | for (0..@typeInfo(mingw.CrtFile).@"enum".field_names.len) |i| { | 4526 | for (0..@typeInfo(mingw.CrtFile).@"enum".field_names.len) |i| { |
| 4527 | if (comp.queued_jobs.mingw_crt_file[i]) { | 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 | prelink_group.async(io, buildMingwCrtFile, .{ comp, tag, main_progress_node }); | 4529 | prelink_group.async(io, buildMingwCrtFile, .{ comp, tag, main_progress_node }); |
| 4530 | } | 4530 | } |
| 4531 | } | 4531 | } |
| ... | @@ -5127,7 +5127,7 @@ fn buildRt( | ... | @@ -5127,7 +5127,7 @@ fn buildRt( |
| 5127 | 5127 | ||
| 5128 | fn buildMuslCrtFile(comp: *Compilation, crt_file: musl.CrtFile, prog_node: std.Progress.Node) void { | 5128 | fn buildMuslCrtFile(comp: *Compilation, crt_file: musl.CrtFile, prog_node: std.Progress.Node) void { |
| 5129 | if (musl.buildCrtFile(comp, crt_file, prog_node)) |_| { | 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 | } else |err| switch (err) { | 5131 | } else |err| switch (err) { |
| 5132 | error.AlreadyReported => return, | 5132 | error.AlreadyReported => return, |
| 5133 | else => comp.lockAndSetMiscFailure(.musl_crt_file, "unable to build musl {s}: {s}", .{ | 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,7 +5138,7 @@ fn buildMuslCrtFile(comp: *Compilation, crt_file: musl.CrtFile, prog_node: std.P |
| 5138 | 5138 | ||
| 5139 | fn buildGlibcCrtFile(comp: *Compilation, crt_file: glibc.CrtFile, prog_node: std.Progress.Node) void { | 5139 | fn buildGlibcCrtFile(comp: *Compilation, crt_file: glibc.CrtFile, prog_node: std.Progress.Node) void { |
| 5140 | if (glibc.buildCrtFile(comp, crt_file, prog_node)) |_| { | 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 | } else |err| switch (err) { | 5142 | } else |err| switch (err) { |
| 5143 | error.AlreadyReported => return, | 5143 | error.AlreadyReported => return, |
| 5144 | else => comp.lockAndSetMiscFailure(.glibc_crt_file, "unable to build glibc {s}: {s}", .{ | 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,7 +5159,7 @@ fn buildGlibcSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) voi |
| 5159 | 5159 | ||
| 5160 | fn buildFreeBSDCrtFile(comp: *Compilation, crt_file: freebsd.CrtFile, prog_node: std.Progress.Node) void { | 5160 | fn buildFreeBSDCrtFile(comp: *Compilation, crt_file: freebsd.CrtFile, prog_node: std.Progress.Node) void { |
| 5161 | if (freebsd.buildCrtFile(comp, crt_file, prog_node)) |_| { | 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 | } else |err| switch (err) { | 5163 | } else |err| switch (err) { |
| 5164 | error.AlreadyReported => return, | 5164 | error.AlreadyReported => return, |
| 5165 | else => comp.lockAndSetMiscFailure(.freebsd_crt_file, "unable to build FreeBSD {s}: {s}", .{ | 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,7 +5182,7 @@ fn buildFreeBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) v |
| 5182 | 5182 | ||
| 5183 | fn buildNetBSDCrtFile(comp: *Compilation, crt_file: netbsd.CrtFile, prog_node: std.Progress.Node) void { | 5183 | fn buildNetBSDCrtFile(comp: *Compilation, crt_file: netbsd.CrtFile, prog_node: std.Progress.Node) void { |
| 5184 | if (netbsd.buildCrtFile(comp, crt_file, prog_node)) |_| { | 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 | } else |err| switch (err) { | 5186 | } else |err| switch (err) { |
| 5187 | error.AlreadyReported => return, | 5187 | error.AlreadyReported => return, |
| 5188 | else => comp.lockAndSetMiscFailure(.netbsd_crt_file, "unable to build NetBSD {s}: {s}", .{ | 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,7 +5205,7 @@ fn buildNetBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) vo |
| 5205 | 5205 | ||
| 5206 | fn buildOpenBSDCrtFile(comp: *Compilation, crt_file: openbsd.CrtFile, prog_node: std.Progress.Node) void { | 5206 | fn buildOpenBSDCrtFile(comp: *Compilation, crt_file: openbsd.CrtFile, prog_node: std.Progress.Node) void { |
| 5207 | if (openbsd.buildCrtFile(comp, crt_file, prog_node)) |_| { | 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 | } else |err| switch (err) { | 5209 | } else |err| switch (err) { |
| 5210 | error.AlreadyReported => return, | 5210 | error.AlreadyReported => return, |
| 5211 | else => comp.lockAndSetMiscFailure(.openbsd_crt_file, "unable to build OpenBSD {s}: {s}", .{ | 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,7 +5228,7 @@ fn buildOpenBSDSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) v |
| 5228 | 5228 | ||
| 5229 | fn buildMingwCrtFile(comp: *Compilation, crt_file: mingw.CrtFile, prog_node: std.Progress.Node) void { | 5229 | fn buildMingwCrtFile(comp: *Compilation, crt_file: mingw.CrtFile, prog_node: std.Progress.Node) void { |
| 5230 | if (mingw.buildCrtFile(comp, crt_file, prog_node)) |_| { | 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 | } else |err| switch (err) { | 5232 | } else |err| switch (err) { |
| 5233 | error.AlreadyReported => return, | 5233 | error.AlreadyReported => return, |
| 5234 | else => comp.lockAndSetMiscFailure(.mingw_crt_file, "unable to build mingw-w64 {s}: {s}", .{ | 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,7 +5272,7 @@ fn buildMingwImportLib(comp: *Compilation, lib_name: []const u8, is_prelink: boo |
| 5272 | 5272 | ||
| 5273 | fn buildWasiLibcCrtFile(comp: *Compilation, crt_file: wasi_libc.CrtFile, prog_node: std.Progress.Node) void { | 5273 | fn buildWasiLibcCrtFile(comp: *Compilation, crt_file: wasi_libc.CrtFile, prog_node: std.Progress.Node) void { |
| 5274 | if (wasi_libc.buildCrtFile(comp, crt_file, prog_node)) |_| { | 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 | } else |err| switch (err) { | 5276 | } else |err| switch (err) { |
| 5277 | error.AlreadyReported => return, | 5277 | error.AlreadyReported => return, |
| 5278 | else => comp.lockAndSetMiscFailure(.wasi_libc_crt_file, "unable to build WASI libc {s}: {s}", .{ | 5278 | else => comp.lockAndSetMiscFailure(.wasi_libc_crt_file, "unable to build WASI libc {s}: {s}", .{ |
| ... | @@ -6213,7 +6213,7 @@ fn addCommonCCArgs( | ... | @@ -6213,7 +6213,7 @@ fn addCommonCCArgs( |
| 6213 | } else if (target.isMinGW()) { | 6213 | } else if (target.isMinGW()) { |
| 6214 | try argv.append("-D__MSVCRT_VERSION__=0xE00"); // use ucrt | 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 | try argv.append( | 6217 | try argv.append( |
| 6218 | try std.fmt.allocPrint(arena, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}), | 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,7 +208,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 208 | zcu.incremental_debug_state.units.count(), | 208 | zcu.incremental_debug_state.units.count(), |
| 209 | }); | 209 | }); |
| 210 | } else if (std.mem.eql(u8, cmd_str, "nav_info")) { | 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 | const create_gen = zcu.incremental_debug_state.navs.get(nav_index) orelse return w.writeAll("unknown nav index"); | 212 | const create_gen = zcu.incremental_debug_state.navs.get(nav_index) orelse return w.writeAll("unknown nav index"); |
| 213 | const nav = ip.getNav(nav_index); | 213 | const nav = ip.getNav(nav_index); |
| 214 | try w.print( | 214 | try w.print( |
| ... | @@ -251,7 +251,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const | ... | @@ -251,7 +251,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 251 | }; | 251 | }; |
| 252 | if (success) { | 252 | if (success) { |
| 253 | num_results += 1; | 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 | try w.print("Found {d} results\n", .{num_results}); | 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,7 +272,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 272 | }; | 272 | }; |
| 273 | if (success) { | 273 | if (success) { |
| 274 | num_results += 1; | 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 | try w.print("Found {d} results\n", .{num_results}); | 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,8 +308,8 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 308 | try w.print("[{d}] ", .{i}); | 308 | try w.print("[{d}] ", .{i}); |
| 309 | switch (dependee) { | 309 | switch (dependee) { |
| 310 | .src_hash, .namespace, .namespace_name, .source_file, .embed_file => try w.print("{f}", .{zcu.fmtDependee(dependee)}), | 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) }), | 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, @intFromEnum(ip_index) }), | 312 | .type_layout, .struct_defaults, .func_ies => |ip_index| try w.print("{t} {d}", .{ dependee, @backingInt(ip_index) }), |
| 313 | .memoized_state => |stage| try w.print("memoized_state {s}", .{@tagName(stage)}), | 313 | .memoized_state => |stage| try w.print("memoized_state {s}", .{@tagName(stage)}), |
| 314 | } | 314 | } |
| 315 | try w.writeByte('\n'); | 315 | try w.writeByte('\n'); |
| ... | @@ -326,7 +326,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const | ... | @@ -326,7 +326,7 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 326 | opt_cur = if (refs.get(cur).?) |ref| ref.referencer else null; | 326 | opt_cur = if (refs.get(cur).?) |ref| ref.referencer else null; |
| 327 | } | 327 | } |
| 328 | } else if (std.mem.eql(u8, cmd_str, "type_info")) { | 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 | const create_gen = zcu.incremental_debug_state.types.get(ip_index) orelse return w.writeAll("unknown type"); | 330 | const create_gen = zcu.incremental_debug_state.types.get(ip_index) orelse return w.writeAll("unknown type"); |
| 331 | try w.print( | 331 | try w.print( |
| 332 | \\name: '{f}' | 332 | \\name: '{f}' |
| ... | @@ -337,24 +337,24 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const | ... | @@ -337,24 +337,24 @@ fn handleCommand(zcu: *Zcu, w: *Io.Writer, cmd_str: []const u8, arg_str: []const |
| 337 | create_gen, | 337 | create_gen, |
| 338 | }); | 338 | }); |
| 339 | } else if (std.mem.eql(u8, cmd_str, "type_namespace")) { | 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 | if (!zcu.incremental_debug_state.types.contains(ip_index)) return w.writeAll("unknown type"); | 341 | if (!zcu.incremental_debug_state.types.contains(ip_index)) return w.writeAll("unknown type"); |
| 342 | const ns = zcu.namespacePtr(Type.fromInterned(ip_index).getNamespaceIndex(zcu)); | 342 | const ns = zcu.namespacePtr(Type.fromInterned(ip_index).getNamespaceIndex(zcu)); |
| 343 | try w.print("{d} pub decls:\n", .{ns.pub_decls.count()}); | 343 | try w.print("{d} pub decls:\n", .{ns.pub_decls.count()}); |
| 344 | for (ns.pub_decls.keys()) |nav| { | 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 | try w.print("{d} non-pub decls:\n", .{ns.priv_decls.count()}); | 347 | try w.print("{d} non-pub decls:\n", .{ns.priv_decls.count()}); |
| 348 | for (ns.priv_decls.keys()) |nav| { | 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 | try w.print("{d} comptime decls:\n", .{ns.comptime_decls.items.len}); | 351 | try w.print("{d} comptime decls:\n", .{ns.comptime_decls.items.len}); |
| 352 | for (ns.comptime_decls.items) |id| { | 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 | try w.print("{d} tests:\n", .{ns.test_decls.items.len}); | 355 | try w.print("{d} tests:\n", .{ns.test_decls.items.len}); |
| 356 | for (ns.test_decls.items) |nav| { | 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 | } else { | 359 | } else { |
| 360 | try w.writeAll("command not found; run 'help' for a command list"); | 360 | try w.writeAll("command not found; run 'help' for a command list"); |
| ... | @@ -369,17 +369,17 @@ fn parseAnalUnit(str: []const u8) ?AnalUnit { | ... | @@ -369,17 +369,17 @@ fn parseAnalUnit(str: []const u8) ?AnalUnit { |
| 369 | const kind = str[0..split_idx]; | 369 | const kind = str[0..split_idx]; |
| 370 | const idx_str = str[split_idx + 1 ..]; | 370 | const idx_str = str[split_idx + 1 ..]; |
| 371 | if (std.mem.eql(u8, kind, "comptime")) { | 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 | } else if (std.mem.eql(u8, kind, "nav_val")) { | 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 | } else if (std.mem.eql(u8, kind, "nav_ty")) { | 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 | } else if (std.mem.eql(u8, kind, "type_layout")) { | 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 | } else if (std.mem.eql(u8, kind, "struct_defaults")) { | 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 | } else if (std.mem.eql(u8, kind, "func")) { | 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 | } else if (std.mem.eql(u8, kind, "memoized_state")) { | 383 | } else if (std.mem.eql(u8, kind, "memoized_state")) { |
| 384 | return .wrap(.{ .memoized_state = std.meta.stringToEnum( | 384 | return .wrap(.{ .memoized_state = std.meta.stringToEnum( |
| 385 | InternPool.MemoizedStateStage, | 385 | InternPool.MemoizedStateStage, |
| ... | @@ -392,7 +392,7 @@ fn parseAnalUnit(str: []const u8) ?AnalUnit { | ... | @@ -392,7 +392,7 @@ fn parseAnalUnit(str: []const u8) ?AnalUnit { |
| 392 | fn printAnalUnit(unit: AnalUnit, buf: *[32]u8) []const u8 { | 392 | fn printAnalUnit(unit: AnalUnit, buf: *[32]u8) []const u8 { |
| 393 | const idx: u32 = switch (unit.unwrap()) { | 393 | const idx: u32 = switch (unit.unwrap()) { |
| 394 | .memoized_state => |stage| return std.fmt.bufPrint(buf, "memoized_state {s}", .{@tagName(stage)}) catch unreachable, | 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 | return std.fmt.bufPrint(buf, "{s} {d}", .{ @tagName(unit.unwrap()), idx }) catch unreachable; | 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,7 +437,7 @@ fn printType(ty: Type, zcu: *const Zcu, w: *Io.Writer) Io.Writer.Error!void { |
| 437 | .union_type, | 437 | .union_type, |
| 438 | .enum_type, | 438 | .enum_type, |
| 439 | .opaque_type, | 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 | else => unreachable, | 442 | else => unreachable, |
| 443 | } | 443 | } |
src/InternPool.zig+319-319| ... | @@ -152,11 +152,11 @@ pub const TrackedInst = extern struct { | ... | @@ -152,11 +152,11 @@ pub const TrackedInst = extern struct { |
| 152 | pub fn unwrap(inst: ZirIndex) ?Zir.Inst.Index { | 152 | pub fn unwrap(inst: ZirIndex) ?Zir.Inst.Index { |
| 153 | return switch (inst) { | 153 | return switch (inst) { |
| 154 | .lost => null, | 154 | .lost => null, |
| 155 | _ => @enumFromInt(@intFromEnum(inst)), | 155 | _ => @fromBackingInt(@intCast(@backingInt(inst))), |
| 156 | }; | 156 | }; |
| 157 | } | 157 | } |
| 158 | pub fn wrap(inst: Zir.Inst.Index) ZirIndex { | 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 | comptime { | 162 | comptime { |
| ... | @@ -187,7 +187,7 @@ pub const TrackedInst = extern struct { | ... | @@ -187,7 +187,7 @@ pub const TrackedInst = extern struct { |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | pub fn toOptional(i: TrackedInst.Index) Optional { | 189 | pub fn toOptional(i: TrackedInst.Index) Optional { |
| 190 | return @enumFromInt(@intFromEnum(i)); | 190 | return @fromBackingInt(@intCast(@backingInt(i))); |
| 191 | } | 191 | } |
| 192 | pub const Optional = enum(u32) { | 192 | pub const Optional = enum(u32) { |
| 193 | none = std.math.maxInt(u32), | 193 | none = std.math.maxInt(u32), |
| ... | @@ -195,7 +195,7 @@ pub const TrackedInst = extern struct { | ... | @@ -195,7 +195,7 @@ pub const TrackedInst = extern struct { |
| 195 | pub fn unwrap(opt: Optional) ?TrackedInst.Index { | 195 | pub fn unwrap(opt: Optional) ?TrackedInst.Index { |
| 196 | return switch (opt) { | 196 | return switch (opt) { |
| 197 | .none => null, | 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,16 +207,16 @@ pub const TrackedInst = extern struct { |
| 207 | index: u32, | 207 | index: u32, |
| 208 | 208 | ||
| 209 | pub fn wrap(unwrapped: Unwrapped, ip: *const InternPool) TrackedInst.Index { | 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 | assert(unwrapped.index <= ip.getIndexMask(u32)); | 211 | assert(unwrapped.index <= ip.getIndexMask(u32)); |
| 212 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_32) | | 212 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_32) | |
| 213 | unwrapped.index); | 213 | unwrapped.index)); |
| 214 | } | 214 | } |
| 215 | }; | 215 | }; |
| 216 | pub fn unwrap(tracked_inst_index: TrackedInst.Index, ip: *const InternPool) Unwrapped { | 216 | pub fn unwrap(tracked_inst_index: TrackedInst.Index, ip: *const InternPool) Unwrapped { |
| 217 | return .{ | 217 | return .{ |
| 218 | .tid = @enumFromInt(@intFromEnum(tracked_inst_index) >> ip.tid_shift_32 & ip.getTidMask()), | 218 | .tid = @fromBackingInt(@intCast(@backingInt(tracked_inst_index) >> ip.tid_shift_32 & ip.getTidMask())), |
| 219 | .index = @intFromEnum(tracked_inst_index) & ip.getIndexMask(u32), | 219 | .index = @backingInt(tracked_inst_index) & ip.getIndexMask(u32), |
| 220 | }; | 220 | }; |
| 221 | } | 221 | } |
| 222 | 222 | ||
| ... | @@ -408,7 +408,7 @@ pub fn rehashTrackedInsts( | ... | @@ -408,7 +408,7 @@ pub fn rehashTrackedInsts( |
| 408 | if (entry.acquire() == .none) break entry; | 408 | if (entry.acquire() == .none) break entry; |
| 409 | }; | 409 | }; |
| 410 | const index = TrackedInst.Index.Unwrapped.wrap(.{ | 410 | const index = TrackedInst.Index.Unwrapped.wrap(.{ |
| 411 | .tid = @enumFromInt(local_tid), | 411 | .tid = @fromBackingInt(@intCast(local_tid)), |
| 412 | .index = @intCast(local_inst_index), | 412 | .index = @intCast(local_inst_index), |
| 413 | }, ip); | 413 | }, ip); |
| 414 | entry.hash = hash; | 414 | entry.hash = hash; |
| ... | @@ -455,7 +455,7 @@ pub const AnalUnit = packed struct(u64) { | ... | @@ -455,7 +455,7 @@ pub const AnalUnit = packed struct(u64) { |
| 455 | inline else => |tag| @unionInit( | 455 | inline else => |tag| @unionInit( |
| 456 | Unwrapped, | 456 | Unwrapped, |
| 457 | @tagName(tag), | 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,13 +463,13 @@ pub const AnalUnit = packed struct(u64) { |
| 463 | return switch (raw) { | 463 | return switch (raw) { |
| 464 | inline else => |id, tag| .{ | 464 | inline else => |id, tag| .{ |
| 465 | .kind = tag, | 465 | .kind = tag, |
| 466 | .id = @intFromEnum(id), | 466 | .id = @backingInt(id), |
| 467 | }, | 467 | }, |
| 468 | }; | 468 | }; |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | pub fn toOptional(as: AnalUnit) Optional { | 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 | pub const Optional = enum(u64) { | 474 | pub const Optional = enum(u64) { |
| 475 | none = std.math.maxInt(u64), | 475 | none = std.math.maxInt(u64), |
| ... | @@ -477,7 +477,7 @@ pub const AnalUnit = packed struct(u64) { | ... | @@ -477,7 +477,7 @@ pub const AnalUnit = packed struct(u64) { |
| 477 | pub fn unwrap(opt: Optional) ?AnalUnit { | 477 | pub fn unwrap(opt: Optional) ?AnalUnit { |
| 478 | return switch (opt) { | 478 | return switch (opt) { |
| 479 | .none => null, | 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,16 +509,16 @@ pub const ComptimeUnit = extern struct { |
| 509 | tid: Zcu.PerThread.Id, | 509 | tid: Zcu.PerThread.Id, |
| 510 | index: u32, | 510 | index: u32, |
| 511 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) ComptimeUnit.Id { | 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 | assert(unwrapped.index <= ip.getIndexMask(u32)); | 513 | assert(unwrapped.index <= ip.getIndexMask(u32)); |
| 514 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_32) | | 514 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_32) | |
| 515 | unwrapped.index); | 515 | unwrapped.index)); |
| 516 | } | 516 | } |
| 517 | }; | 517 | }; |
| 518 | fn unwrap(id: Id, ip: *const InternPool) Unwrapped { | 518 | fn unwrap(id: Id, ip: *const InternPool) Unwrapped { |
| 519 | return .{ | 519 | return .{ |
| 520 | .tid = @enumFromInt(@intFromEnum(id) >> ip.tid_shift_32 & ip.getTidMask()), | 520 | .tid = @fromBackingInt(@intCast(@backingInt(id) >> ip.tid_shift_32 & ip.getTidMask())), |
| 521 | .index = @intFromEnum(id) & ip.getIndexMask(u31), | 521 | .index = @backingInt(id) & ip.getIndexMask(u31), |
| 522 | }; | 522 | }; |
| 523 | } | 523 | } |
| 524 | 524 | ||
| ... | @@ -633,30 +633,30 @@ pub const Nav = struct { | ... | @@ -633,30 +633,30 @@ pub const Nav = struct { |
| 633 | pub fn unwrap(opt: Optional) ?Nav.Index { | 633 | pub fn unwrap(opt: Optional) ?Nav.Index { |
| 634 | return switch (opt) { | 634 | return switch (opt) { |
| 635 | .none => null, | 635 | .none => null, |
| 636 | _ => @enumFromInt(@intFromEnum(opt)), | 636 | _ => @fromBackingInt(@intCast(@backingInt(opt))), |
| 637 | }; | 637 | }; |
| 638 | } | 638 | } |
| 639 | 639 | ||
| 640 | const debug_state = InternPool.debug_state; | 640 | const debug_state = InternPool.debug_state; |
| 641 | }; | 641 | }; |
| 642 | pub fn toOptional(i: Nav.Index) Optional { | 642 | pub fn toOptional(i: Nav.Index) Optional { |
| 643 | return @enumFromInt(@intFromEnum(i)); | 643 | return @fromBackingInt(@intCast(@backingInt(i))); |
| 644 | } | 644 | } |
| 645 | const Unwrapped = struct { | 645 | const Unwrapped = struct { |
| 646 | tid: Zcu.PerThread.Id, | 646 | tid: Zcu.PerThread.Id, |
| 647 | index: u32, | 647 | index: u32, |
| 648 | 648 | ||
| 649 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) Nav.Index { | 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 | assert(unwrapped.index <= ip.getIndexMask(u30)); | 651 | assert(unwrapped.index <= ip.getIndexMask(u30)); |
| 652 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_30) | | 652 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_30) | |
| 653 | unwrapped.index); | 653 | unwrapped.index)); |
| 654 | } | 654 | } |
| 655 | }; | 655 | }; |
| 656 | fn unwrap(nav_index: Nav.Index, ip: *const InternPool) Unwrapped { | 656 | fn unwrap(nav_index: Nav.Index, ip: *const InternPool) Unwrapped { |
| 657 | return .{ | 657 | return .{ |
| 658 | .tid = @enumFromInt(@intFromEnum(nav_index) >> ip.tid_shift_30 & ip.getTidMask()), | 658 | .tid = @fromBackingInt(@intCast(@backingInt(nav_index) >> ip.tid_shift_30 & ip.getTidMask())), |
| 659 | .index = @intFromEnum(nav_index) & ip.getIndexMask(u30), | 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,19 +762,19 @@ pub fn removeDependenciesForDepender(ip: *InternPool, gpa: Allocator, depender: |
| 762 | var opt_idx = (ip.first_dependency.fetchSwapRemove(depender) orelse return).value.toOptional(); | 762 | var opt_idx = (ip.first_dependency.fetchSwapRemove(depender) orelse return).value.toOptional(); |
| 763 | 763 | ||
| 764 | while (opt_idx.unwrap()) |idx| { | 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 | opt_idx = dep.next_dependee; | 766 | opt_idx = dep.next_dependee; |
| 767 | 767 | ||
| 768 | const prev_idx = dep.prev.unwrap() orelse { | 768 | const prev_idx = dep.prev.unwrap() orelse { |
| 769 | // This entry is the start of a list in some `*_deps`. | 769 | // This entry is the start of a list in some `*_deps`. |
| 770 | // We cannot easily remove this mapping, so this must remain as a dummy entry. | 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 | continue; | 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 | if (dep.next.unwrap()) |next_idx| { | 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 | ip.free_dep_entries.append(gpa, idx) catch { | 780 | ip.free_dep_entries.append(gpa, idx) catch { |
| ... | @@ -790,7 +790,7 @@ pub const DependencyIterator = struct { | ... | @@ -790,7 +790,7 @@ pub const DependencyIterator = struct { |
| 790 | pub fn next(it: *DependencyIterator) ?AnalUnit { | 790 | pub fn next(it: *DependencyIterator) ?AnalUnit { |
| 791 | while (true) { | 791 | while (true) { |
| 792 | const idx = it.next_entry.unwrap() orelse return null; | 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 | it.next_entry = entry.next; | 794 | it.next_entry = entry.next; |
| 795 | if (entry.depender.unwrap()) |depender| return depender; | 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,7 +853,7 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend |
| 853 | }; | 853 | }; |
| 854 | 854 | ||
| 855 | if (deps.unwrap()) |first| { | 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 | // Dummy entry, so we can reuse it rather than allocating a new one! | 857 | // Dummy entry, so we can reuse it rather than allocating a new one! |
| 858 | break :new_index first; | 858 | break :new_index first; |
| 859 | } | 859 | } |
| ... | @@ -861,11 +861,11 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend | ... | @@ -861,11 +861,11 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend |
| 861 | 861 | ||
| 862 | // Prepend a new dependency. | 862 | // Prepend a new dependency. |
| 863 | const new_index: DepEntry.Index, const ptr = if (ip.free_dep_entries.pop()) |new_index| new: { | 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)] }; | 864 | break :new .{ new_index, &ip.dep_entries.items[@backingInt(new_index)] }; |
| 865 | } else .{ @enumFromInt(ip.dep_entries.items.len), ip.dep_entries.addOneAssumeCapacity() }; | 865 | } else .{ @fromBackingInt(@intCast(ip.dep_entries.items.len)), ip.dep_entries.addOneAssumeCapacity() }; |
| 866 | if (deps.unwrap()) |old_first| { | 866 | if (deps.unwrap()) |old_first| { |
| 867 | ptr.next = old_first.toOptional(); | 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 | } else { | 869 | } else { |
| 870 | ptr.next = .none; | 870 | ptr.next = .none; |
| 871 | } | 871 | } |
| ... | @@ -887,18 +887,18 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend | ... | @@ -887,18 +887,18 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend |
| 887 | .memoized_state => comptime unreachable, | 887 | .memoized_state => comptime unreachable, |
| 888 | }.getOrPut(gpa, dependee_payload); | 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 | // Dummy entry, so we can reuse it rather than allocating a new one! | 891 | // Dummy entry, so we can reuse it rather than allocating a new one! |
| 892 | break :new_index gop.value_ptr.*; | 892 | break :new_index gop.value_ptr.*; |
| 893 | } | 893 | } |
| 894 | 894 | ||
| 895 | // Prepend a new dependency. | 895 | // Prepend a new dependency. |
| 896 | const new_index: DepEntry.Index, const ptr = if (ip.free_dep_entries.pop()) |new_index| new: { | 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)] }; | 897 | break :new .{ new_index, &ip.dep_entries.items[@backingInt(new_index)] }; |
| 898 | } else .{ @enumFromInt(ip.dep_entries.items.len), ip.dep_entries.addOneAssumeCapacity() }; | 898 | } else .{ @fromBackingInt(@intCast(ip.dep_entries.items.len)), ip.dep_entries.addOneAssumeCapacity() }; |
| 899 | if (gop.found_existing) { | 899 | if (gop.found_existing) { |
| 900 | ptr.next = gop.value_ptr.*.toOptional(); | 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 | } else { | 902 | } else { |
| 903 | ptr.next = .none; | 903 | ptr.next = .none; |
| 904 | } | 904 | } |
| ... | @@ -907,9 +907,9 @@ pub fn addDependency(ip: *InternPool, gpa: Allocator, depender: AnalUnit, depend | ... | @@ -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(); | 910 | ip.dep_entries.items[@backingInt(new_index)].depender = depender.toOptional(); |
| 911 | ip.dep_entries.items[@intFromEnum(new_index)].prev = .none; | 911 | ip.dep_entries.items[@backingInt(new_index)].prev = .none; |
| 912 | ip.dep_entries.items[@intFromEnum(new_index)].next_dependee = first_depender_dep; | 912 | ip.dep_entries.items[@backingInt(new_index)].next_dependee = first_depender_dep; |
| 913 | ip.first_dependency.putAssumeCapacity(depender, new_index); | 913 | ip.first_dependency.putAssumeCapacity(depender, new_index); |
| 914 | } | 914 | } |
| 915 | 915 | ||
| ... | @@ -942,7 +942,7 @@ pub const DepEntry = extern struct { | ... | @@ -942,7 +942,7 @@ pub const DepEntry = extern struct { |
| 942 | pub const Index = enum(u32) { | 942 | pub const Index = enum(u32) { |
| 943 | _, | 943 | _, |
| 944 | pub fn toOptional(dep: DepEntry.Index) Optional { | 944 | pub fn toOptional(dep: DepEntry.Index) Optional { |
| 945 | return @enumFromInt(@intFromEnum(dep)); | 945 | return @fromBackingInt(@intCast(@backingInt(dep))); |
| 946 | } | 946 | } |
| 947 | pub const Optional = enum(u32) { | 947 | pub const Optional = enum(u32) { |
| 948 | none = std.math.maxInt(u32), | 948 | none = std.math.maxInt(u32), |
| ... | @@ -950,7 +950,7 @@ pub const DepEntry = extern struct { | ... | @@ -950,7 +950,7 @@ pub const DepEntry = extern struct { |
| 950 | pub fn unwrap(opt: Optional) ?DepEntry.Index { | 950 | pub fn unwrap(opt: Optional) ?DepEntry.Index { |
| 951 | return switch (opt) { | 951 | return switch (opt) { |
| 952 | .none => null, | 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,11 +1439,11 @@ const Local = struct { |
| 1439 | }; | 1439 | }; |
| 1440 | 1440 | ||
| 1441 | pub fn getLocal(ip: *InternPool, tid: Zcu.PerThread.Id) *Local { | 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 | pub fn getLocalShared(ip: *const InternPool, tid: Zcu.PerThread.Id) *const Local.Shared { | 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 | const Shard = struct { | 1449 | const Shard = struct { |
| ... | @@ -1596,7 +1596,7 @@ pub const OptionalMapIndex = enum(u32) { | ... | @@ -1596,7 +1596,7 @@ pub const OptionalMapIndex = enum(u32) { |
| 1596 | 1596 | ||
| 1597 | pub fn unwrap(oi: OptionalMapIndex) ?MapIndex { | 1597 | pub fn unwrap(oi: OptionalMapIndex) ?MapIndex { |
| 1598 | if (oi == .none) return null; | 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,7 +1611,7 @@ pub const MapIndex = enum(u32) { |
| 1611 | } | 1611 | } |
| 1612 | 1612 | ||
| 1613 | pub fn toOptional(i: MapIndex) OptionalMapIndex { | 1613 | pub fn toOptional(i: MapIndex) OptionalMapIndex { |
| 1614 | return @enumFromInt(@intFromEnum(i)); | 1614 | return @fromBackingInt(@intCast(@backingInt(i))); |
| 1615 | } | 1615 | } |
| 1616 | 1616 | ||
| 1617 | const Unwrapped = struct { | 1617 | const Unwrapped = struct { |
| ... | @@ -1619,16 +1619,16 @@ pub const MapIndex = enum(u32) { | ... | @@ -1619,16 +1619,16 @@ pub const MapIndex = enum(u32) { |
| 1619 | index: u32, | 1619 | index: u32, |
| 1620 | 1620 | ||
| 1621 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) MapIndex { | 1621 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) MapIndex { |
| 1622 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | 1622 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); |
| 1623 | assert(unwrapped.index <= ip.getIndexMask(u32)); | 1623 | assert(unwrapped.index <= ip.getIndexMask(u32)); |
| 1624 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_32) | | 1624 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_32) | |
| 1625 | unwrapped.index); | 1625 | unwrapped.index)); |
| 1626 | } | 1626 | } |
| 1627 | }; | 1627 | }; |
| 1628 | fn unwrap(map_index: MapIndex, ip: *const InternPool) Unwrapped { | 1628 | fn unwrap(map_index: MapIndex, ip: *const InternPool) Unwrapped { |
| 1629 | return .{ | 1629 | return .{ |
| 1630 | .tid = @enumFromInt(@intFromEnum(map_index) >> ip.tid_shift_32 & ip.getTidMask()), | 1630 | .tid = @fromBackingInt(@intCast(@backingInt(map_index) >> ip.tid_shift_32 & ip.getTidMask())), |
| 1631 | .index = @intFromEnum(map_index) & ip.getIndexMask(u32), | 1631 | .index = @backingInt(map_index) & ip.getIndexMask(u32), |
| 1632 | }; | 1632 | }; |
| 1633 | } | 1633 | } |
| 1634 | }; | 1634 | }; |
| ... | @@ -1644,25 +1644,25 @@ pub const NamespaceIndex = enum(u32) { | ... | @@ -1644,25 +1644,25 @@ pub const NamespaceIndex = enum(u32) { |
| 1644 | index: u32, | 1644 | index: u32, |
| 1645 | 1645 | ||
| 1646 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) NamespaceIndex { | 1646 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) NamespaceIndex { |
| 1647 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | 1647 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); |
| 1648 | assert(unwrapped.bucket_index <= ip.getIndexMask(u32) >> Local.namespaces_bucket_width); | 1648 | assert(unwrapped.bucket_index <= ip.getIndexMask(u32) >> Local.namespaces_bucket_width); |
| 1649 | assert(unwrapped.index <= Local.namespaces_bucket_mask); | 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 | unwrapped.bucket_index << Local.namespaces_bucket_width | | 1651 | unwrapped.bucket_index << Local.namespaces_bucket_width | |
| 1652 | unwrapped.index); | 1652 | unwrapped.index)); |
| 1653 | } | 1653 | } |
| 1654 | }; | 1654 | }; |
| 1655 | fn unwrap(namespace_index: NamespaceIndex, ip: *const InternPool) Unwrapped { | 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 | return .{ | 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 | .bucket_index = index >> Local.namespaces_bucket_width, | 1659 | .bucket_index = index >> Local.namespaces_bucket_width, |
| 1660 | .index = index & Local.namespaces_bucket_mask, | 1660 | .index = index & Local.namespaces_bucket_mask, |
| 1661 | }; | 1661 | }; |
| 1662 | } | 1662 | } |
| 1663 | 1663 | ||
| 1664 | pub fn toOptional(i: NamespaceIndex) OptionalNamespaceIndex { | 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,12 +1671,12 @@ pub const OptionalNamespaceIndex = enum(u32) { |
| 1671 | _, | 1671 | _, |
| 1672 | 1672 | ||
| 1673 | pub fn init(oi: ?NamespaceIndex) OptionalNamespaceIndex { | 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 | pub fn unwrap(oi: OptionalNamespaceIndex) ?NamespaceIndex { | 1677 | pub fn unwrap(oi: OptionalNamespaceIndex) ?NamespaceIndex { |
| 1678 | if (oi == .none) return null; | 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,20 +1688,20 @@ pub const FileIndex = enum(u32) { |
| 1688 | index: u32, | 1688 | index: u32, |
| 1689 | 1689 | ||
| 1690 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) FileIndex { | 1690 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) FileIndex { |
| 1691 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | 1691 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); |
| 1692 | assert(unwrapped.index <= ip.getIndexMask(u32)); | 1692 | assert(unwrapped.index <= ip.getIndexMask(u32)); |
| 1693 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_32) | | 1693 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_32) | |
| 1694 | unwrapped.index); | 1694 | unwrapped.index)); |
| 1695 | } | 1695 | } |
| 1696 | }; | 1696 | }; |
| 1697 | pub fn unwrap(file_index: FileIndex, ip: *const InternPool) Unwrapped { | 1697 | pub fn unwrap(file_index: FileIndex, ip: *const InternPool) Unwrapped { |
| 1698 | return .{ | 1698 | return .{ |
| 1699 | .tid = @enumFromInt(@intFromEnum(file_index) >> ip.tid_shift_32 & ip.getTidMask()), | 1699 | .tid = @fromBackingInt(@intCast(@backingInt(file_index) >> ip.tid_shift_32 & ip.getTidMask())), |
| 1700 | .index = @intFromEnum(file_index) & ip.getIndexMask(u32), | 1700 | .index = @backingInt(file_index) & ip.getIndexMask(u32), |
| 1701 | }; | 1701 | }; |
| 1702 | } | 1702 | } |
| 1703 | pub fn toOptional(i: FileIndex) Optional { | 1703 | pub fn toOptional(i: FileIndex) Optional { |
| 1704 | return @enumFromInt(@intFromEnum(i)); | 1704 | return @fromBackingInt(@intCast(@backingInt(i))); |
| 1705 | } | 1705 | } |
| 1706 | pub const Optional = enum(u32) { | 1706 | pub const Optional = enum(u32) { |
| 1707 | none = std.math.maxInt(u32), | 1707 | none = std.math.maxInt(u32), |
| ... | @@ -1709,7 +1709,7 @@ pub const FileIndex = enum(u32) { | ... | @@ -1709,7 +1709,7 @@ pub const FileIndex = enum(u32) { |
| 1709 | pub fn unwrap(opt: Optional) ?FileIndex { | 1709 | pub fn unwrap(opt: Optional) ?FileIndex { |
| 1710 | return switch (opt) { | 1710 | return switch (opt) { |
| 1711 | .none => null, | 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,7 +1739,7 @@ pub const String = enum(u32) { |
| 1739 | pub fn toNullTerminatedString(string: String, len: u64, ip: *const InternPool) NullTerminatedString { | 1739 | pub fn toNullTerminatedString(string: String, len: u64, ip: *const InternPool) NullTerminatedString { |
| 1740 | assert(std.mem.indexOfScalar(u8, string.toSlice(len, ip), 0) == null); | 1740 | assert(std.mem.indexOfScalar(u8, string.toSlice(len, ip), 0) == null); |
| 1741 | assert(string.at(len, ip) == 0); | 1741 | assert(string.at(len, ip) == 0); |
| 1742 | return @enumFromInt(@intFromEnum(string)); | 1742 | return @fromBackingInt(@intCast(@backingInt(string))); |
| 1743 | } | 1743 | } |
| 1744 | 1744 | ||
| 1745 | const Unwrapped = struct { | 1745 | const Unwrapped = struct { |
| ... | @@ -1747,16 +1747,16 @@ pub const String = enum(u32) { | ... | @@ -1747,16 +1747,16 @@ pub const String = enum(u32) { |
| 1747 | index: u32, | 1747 | index: u32, |
| 1748 | 1748 | ||
| 1749 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) String { | 1749 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) String { |
| 1750 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | 1750 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); |
| 1751 | assert(unwrapped.index <= ip.getIndexMask(u32)); | 1751 | assert(unwrapped.index <= ip.getIndexMask(u32)); |
| 1752 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_32) | | 1752 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_32) | |
| 1753 | unwrapped.index); | 1753 | unwrapped.index)); |
| 1754 | } | 1754 | } |
| 1755 | }; | 1755 | }; |
| 1756 | fn unwrap(string: String, ip: *const InternPool) Unwrapped { | 1756 | fn unwrap(string: String, ip: *const InternPool) Unwrapped { |
| 1757 | return .{ | 1757 | return .{ |
| 1758 | .tid = @enumFromInt(@intFromEnum(string) >> ip.tid_shift_32 & ip.getTidMask()), | 1758 | .tid = @fromBackingInt(@intCast(@backingInt(string) >> ip.tid_shift_32 & ip.getTidMask())), |
| 1759 | .index = @intFromEnum(string) & ip.getIndexMask(u32), | 1759 | .index = @backingInt(string) & ip.getIndexMask(u32), |
| 1760 | }; | 1760 | }; |
| 1761 | } | 1761 | } |
| 1762 | 1762 | ||
| ... | @@ -1779,7 +1779,7 @@ pub const OptionalString = enum(u32) { | ... | @@ -1779,7 +1779,7 @@ pub const OptionalString = enum(u32) { |
| 1779 | _, | 1779 | _, |
| 1780 | 1780 | ||
| 1781 | pub fn unwrap(string: OptionalString) ?String { | 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 | pub fn toSlice(string: OptionalString, len: u64, ip: *const InternPool) ?[]const u8 { | 1785 | pub fn toSlice(string: OptionalString, len: u64, ip: *const InternPool) ?[]const u8 { |
| ... | @@ -1812,11 +1812,11 @@ pub const NullTerminatedString = enum(u32) { | ... | @@ -1812,11 +1812,11 @@ pub const NullTerminatedString = enum(u32) { |
| 1812 | }; | 1812 | }; |
| 1813 | 1813 | ||
| 1814 | pub fn toString(self: NullTerminatedString) String { | 1814 | pub fn toString(self: NullTerminatedString) String { |
| 1815 | return @enumFromInt(@intFromEnum(self)); | 1815 | return @fromBackingInt(@intCast(@backingInt(self))); |
| 1816 | } | 1816 | } |
| 1817 | 1817 | ||
| 1818 | pub fn toOptional(self: NullTerminatedString) OptionalNullTerminatedString { | 1818 | pub fn toOptional(self: NullTerminatedString) OptionalNullTerminatedString { |
| 1819 | return @enumFromInt(@intFromEnum(self)); | 1819 | return @fromBackingInt(@intCast(@backingInt(self))); |
| 1820 | } | 1820 | } |
| 1821 | 1821 | ||
| 1822 | pub fn toSlice(string: NullTerminatedString, ip: *const InternPool) [:0]const u8 { | 1822 | pub fn toSlice(string: NullTerminatedString, ip: *const InternPool) [:0]const u8 { |
| ... | @@ -1851,14 +1851,14 @@ pub const NullTerminatedString = enum(u32) { | ... | @@ -1851,14 +1851,14 @@ pub const NullTerminatedString = enum(u32) { |
| 1851 | 1851 | ||
| 1852 | pub fn hash(ctx: @This(), a: NullTerminatedString) u32 { | 1852 | pub fn hash(ctx: @This(), a: NullTerminatedString) u32 { |
| 1853 | _ = ctx; | 1853 | _ = ctx; |
| 1854 | return std.hash.int(@intFromEnum(a)); | 1854 | return std.hash.int(@backingInt(a)); |
| 1855 | } | 1855 | } |
| 1856 | }; | 1856 | }; |
| 1857 | 1857 | ||
| 1858 | /// Compare based on integer value alone, ignoring the string contents. | 1858 | /// Compare based on integer value alone, ignoring the string contents. |
| 1859 | pub fn indexLessThan(ctx: void, a: NullTerminatedString, b: NullTerminatedString) bool { | 1859 | pub fn indexLessThan(ctx: void, a: NullTerminatedString, b: NullTerminatedString) bool { |
| 1860 | _ = ctx; | 1860 | _ = ctx; |
| 1861 | return @intFromEnum(a) < @intFromEnum(b); | 1861 | return @backingInt(a) < @backingInt(b); |
| 1862 | } | 1862 | } |
| 1863 | 1863 | ||
| 1864 | pub fn toUnsigned(string: NullTerminatedString, ip: *const InternPool) ?u32 { | 1864 | pub fn toUnsigned(string: NullTerminatedString, ip: *const InternPool) ?u32 { |
| ... | @@ -1901,7 +1901,7 @@ pub const OptionalNullTerminatedString = enum(u32) { | ... | @@ -1901,7 +1901,7 @@ pub const OptionalNullTerminatedString = enum(u32) { |
| 1901 | _, | 1901 | _, |
| 1902 | 1902 | ||
| 1903 | pub fn unwrap(string: OptionalNullTerminatedString) ?NullTerminatedString { | 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 | pub fn toSlice(string: OptionalNullTerminatedString, ip: *const InternPool) ?[:0]const u8 { | 1907 | pub fn toSlice(string: OptionalNullTerminatedString, ip: *const InternPool) ?[:0]const u8 { |
| ... | @@ -1923,18 +1923,18 @@ pub const CaptureValue = packed struct(u32) { | ... | @@ -1923,18 +1923,18 @@ pub const CaptureValue = packed struct(u32) { |
| 1923 | 1923 | ||
| 1924 | pub fn wrap(val: Unwrapped) CaptureValue { | 1924 | pub fn wrap(val: Unwrapped) CaptureValue { |
| 1925 | return switch (val) { | 1925 | return switch (val) { |
| 1926 | .@"comptime" => |i| .{ .tag = .@"comptime", .idx = @intCast(@intFromEnum(i)) }, | 1926 | .@"comptime" => |i| .{ .tag = .@"comptime", .idx = @intCast(@backingInt(i)) }, |
| 1927 | .runtime => |i| .{ .tag = .runtime, .idx = @intCast(@intFromEnum(i)) }, | 1927 | .runtime => |i| .{ .tag = .runtime, .idx = @intCast(@backingInt(i)) }, |
| 1928 | .nav_val => |i| .{ .tag = .nav_val, .idx = @intCast(@intFromEnum(i)) }, | 1928 | .nav_val => |i| .{ .tag = .nav_val, .idx = @intCast(@backingInt(i)) }, |
| 1929 | .nav_ref => |i| .{ .tag = .nav_ref, .idx = @intCast(@intFromEnum(i)) }, | 1929 | .nav_ref => |i| .{ .tag = .nav_ref, .idx = @intCast(@backingInt(i)) }, |
| 1930 | }; | 1930 | }; |
| 1931 | } | 1931 | } |
| 1932 | pub fn unwrap(val: CaptureValue) Unwrapped { | 1932 | pub fn unwrap(val: CaptureValue) Unwrapped { |
| 1933 | return switch (val.tag) { | 1933 | return switch (val.tag) { |
| 1934 | .@"comptime" => .{ .@"comptime" = @enumFromInt(val.idx) }, | 1934 | .@"comptime" => .{ .@"comptime" = @fromBackingInt(@intCast(val.idx)) }, |
| 1935 | .runtime => .{ .runtime = @enumFromInt(val.idx) }, | 1935 | .runtime => .{ .runtime = @fromBackingInt(@intCast(val.idx)) }, |
| 1936 | .nav_val => .{ .nav_val = @enumFromInt(val.idx) }, | 1936 | .nav_val => .{ .nav_val = @fromBackingInt(@intCast(val.idx)) }, |
| 1937 | .nav_ref => .{ .nav_ref = @enumFromInt(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,7 +2605,7 @@ pub const Key = union(enum) { |
| 2605 | pub fn hash64(key: Key, ip: *const InternPool) u64 { | 2605 | pub fn hash64(key: Key, ip: *const InternPool) u64 { |
| 2606 | const asBytes = std.mem.asBytes; | 2606 | const asBytes = std.mem.asBytes; |
| 2607 | const KeyTag = @typeInfo(Key).@"union".tag_type.?; | 2607 | const KeyTag = @typeInfo(Key).@"union".tag_type.?; |
| 2608 | const seed = @intFromEnum(@as(KeyTag, key)); | 2608 | const seed = @backingInt(@as(KeyTag, key)); |
| 2609 | return switch (key) { | 2609 | return switch (key) { |
| 2610 | inline .ptr_type, | 2610 | inline .ptr_type, |
| 2611 | .array_type, | 2611 | .array_type, |
| ... | @@ -2629,7 +2629,7 @@ pub const Key = union(enum) { | ... | @@ -2629,7 +2629,7 @@ pub const Key = union(enum) { |
| 2629 | return Hash.hash(seed, asBytes(&x)); | 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 | .error_union => |x| switch (x.val) { | 2634 | .error_union => |x| switch (x.val) { |
| 2635 | .err_name => |y| Hash.hash(seed + 0, asBytes(&x.ty) ++ asBytes(&y)), | 2635 | .err_name => |y| Hash.hash(seed + 0, asBytes(&x.ty) ++ asBytes(&y)), |
| ... | @@ -2695,7 +2695,7 @@ pub const Key = union(enum) { | ... | @@ -2695,7 +2695,7 @@ pub const Key = union(enum) { |
| 2695 | // Int-to-ptr pointers are hashed separately than decl-referencing pointers. | 2695 | // Int-to-ptr pointers are hashed separately than decl-referencing pointers. |
| 2696 | // This is sound due to pointer provenance rules. | 2696 | // This is sound due to pointer provenance rules. |
| 2697 | const addr_tag: Key.Ptr.BaseAddr.Tag = ptr.base_addr; | 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 | const big_offset: i128 = ptr.byte_offset; | 2699 | const big_offset: i128 = ptr.byte_offset; |
| 2700 | const common = asBytes(&ptr.ty) ++ asBytes(&big_offset); | 2700 | const common = asBytes(&ptr.ty) ++ asBytes(&big_offset); |
| 2701 | return switch (ptr.base_addr) { | 2701 | return switch (ptr.base_addr) { |
| ... | @@ -2829,7 +2829,7 @@ pub const Key = union(enum) { | ... | @@ -2829,7 +2829,7 @@ pub const Key = union(enum) { |
| 2829 | asBytes(&e.is_threadlocal) ++ asBytes(&e.is_dll_import) ++ | 2829 | asBytes(&e.is_threadlocal) ++ asBytes(&e.is_dll_import) ++ |
| 2830 | asBytes(&e.relocation) ++ | 2830 | asBytes(&e.relocation) ++ |
| 2831 | asBytes(&e.is_const) ++ asBytes(&e.alignment) ++ asBytes(&e.@"addrspace") ++ | 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 | .bitpack => |bitpack| Hash.hash(seed, asBytes(&bitpack.ty) ++ asBytes(&bitpack.backing_int_val)), | 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,7 +3304,7 @@ pub const LoadedStructType = struct { |
| 3304 | return switch (i) { | 3304 | return switch (i) { |
| 3305 | .omitted => null, | 3305 | .omitted => null, |
| 3306 | .unresolved => unreachable, | 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,7 +3642,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType { |
| 3642 | _ => |n| .{ | 3642 | _ => |n| .{ |
| 3643 | .tid = unwrapped_index.tid, | 3643 | .tid = unwrapped_index.tid, |
| 3644 | .start = extra_index, | 3644 | .start = extra_index, |
| 3645 | .len = @intFromEnum(n), | 3645 | .len = @backingInt(n), |
| 3646 | }, | 3646 | }, |
| 3647 | }; | 3647 | }; |
| 3648 | extra_index += captures.len; | 3648 | extra_index += captures.len; |
| ... | @@ -3778,7 +3778,7 @@ pub fn loadUnionType(ip: *const InternPool, index: Index) LoadedUnionType { | ... | @@ -3778,7 +3778,7 @@ pub fn loadUnionType(ip: *const InternPool, index: Index) LoadedUnionType { |
| 3778 | _ => |n| .{ | 3778 | _ => |n| .{ |
| 3779 | .tid = unwrapped_index.tid, | 3779 | .tid = unwrapped_index.tid, |
| 3780 | .start = extra_index, | 3780 | .start = extra_index, |
| 3781 | .len = @intFromEnum(n), | 3781 | .len = @backingInt(n), |
| 3782 | }, | 3782 | }, |
| 3783 | }; | 3783 | }; |
| 3784 | extra_index += captures.len; | 3784 | extra_index += captures.len; |
| ... | @@ -3834,30 +3834,30 @@ pub fn loadEnumType(ip: *const InternPool, index: Index) LoadedEnumType { | ... | @@ -3834,30 +3834,30 @@ pub fn loadEnumType(ip: *const InternPool, index: Index) LoadedEnumType { |
| 3834 | var extra_index: u32 = @intCast(extra.end); | 3834 | var extra_index: u32 = @intCast(extra.end); |
| 3835 | const zir_index: TrackedInst.Index.Optional, const captures: CaptureValue.Slice, const owner_union: Index = switch (extra.data.bits.captures_len) { | 3835 | const zir_index: TrackedInst.Index.Optional, const captures: CaptureValue.Slice, const owner_union: Index = switch (extra.data.bits.captures_len) { |
| 3836 | .reified => info: { | 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 | extra_index += 1; | 3838 | extra_index += 1; |
| 3839 | extra_index += 2; // type_hash: PackedU64 | 3839 | extra_index += 2; // type_hash: PackedU64 |
| 3840 | break :info .{ zir_index.toOptional(), .empty, .none }; | 3840 | break :info .{ zir_index.toOptional(), .empty, .none }; |
| 3841 | }, | 3841 | }, |
| 3842 | .generated_union_tag => info: { | 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 | extra_index += 1; | 3844 | extra_index += 1; |
| 3845 | break :info .{ .none, .empty, owner_union }; | 3845 | break :info .{ .none, .empty, owner_union }; |
| 3846 | }, | 3846 | }, |
| 3847 | _ => |n| info: { | 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 | extra_index += 1; | 3849 | extra_index += 1; |
| 3850 | const captures: CaptureValue.Slice = .{ | 3850 | const captures: CaptureValue.Slice = .{ |
| 3851 | .tid = unwrapped_index.tid, | 3851 | .tid = unwrapped_index.tid, |
| 3852 | .start = extra_index, | 3852 | .start = extra_index, |
| 3853 | .len = @intFromEnum(n), | 3853 | .len = @backingInt(n), |
| 3854 | }; | 3854 | }; |
| 3855 | extra_index += captures.len; | 3855 | extra_index += captures.len; |
| 3856 | break :info .{ zir_index.toOptional(), captures, .none }; | 3856 | break :info .{ zir_index.toOptional(), captures, .none }; |
| 3857 | }, | 3857 | }, |
| 3858 | }; | 3858 | }; |
| 3859 | const field_value_map: OptionalMapIndex = if (explicit_int_tag) m: { | 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 | extra_index += 1; | 3861 | extra_index += 1; |
| 3862 | break :m map.toOptional(); | 3862 | break :m map.toOptional(); |
| 3863 | } else .none; | 3863 | } else .none; |
| ... | @@ -4138,7 +4138,7 @@ pub const Index = enum(u32) { | ... | @@ -4138,7 +4138,7 @@ pub const Index = enum(u32) { |
| 4138 | 4138 | ||
| 4139 | pub fn hash(ctx: @This(), a: Index) u32 { | 4139 | pub fn hash(ctx: @This(), a: Index) u32 { |
| 4140 | _ = ctx; | 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,10 +4147,10 @@ pub const Index = enum(u32) { |
| 4147 | index: u32, | 4147 | index: u32, |
| 4148 | 4148 | ||
| 4149 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) Index { | 4149 | fn wrap(unwrapped: Unwrapped, ip: *const InternPool) Index { |
| 4150 | assert(@intFromEnum(unwrapped.tid) <= ip.getTidMask()); | 4150 | assert(@backingInt(unwrapped.tid) <= ip.getTidMask()); |
| 4151 | assert(unwrapped.index <= ip.getIndexMask(u30)); | 4151 | assert(unwrapped.index <= ip.getIndexMask(u30)); |
| 4152 | return @enumFromInt(@shlExact(@as(u32, @intFromEnum(unwrapped.tid)), ip.tid_shift_30) | | 4152 | return @fromBackingInt(@intCast(@shlExact(@as(u32, @backingInt(unwrapped.tid)), ip.tid_shift_30) | |
| 4153 | unwrapped.index); | 4153 | unwrapped.index)); |
| 4154 | } | 4154 | } |
| 4155 | 4155 | ||
| 4156 | pub fn getExtra(unwrapped: Unwrapped, ip: *const InternPool) Local.Extra { | 4156 | pub fn getExtra(unwrapped: Unwrapped, ip: *const InternPool) Local.Extra { |
| ... | @@ -4188,8 +4188,8 @@ pub const Index = enum(u32) { | ... | @@ -4188,8 +4188,8 @@ pub const Index = enum(u32) { |
| 4188 | }; | 4188 | }; |
| 4189 | pub fn unwrap(index: Index, ip: *const InternPool) Unwrapped { | 4189 | pub fn unwrap(index: Index, ip: *const InternPool) Unwrapped { |
| 4190 | return .{ | 4190 | return .{ |
| 4191 | .tid = @enumFromInt(@intFromEnum(index) >> ip.tid_shift_30 & ip.getTidMask()), | 4191 | .tid = @fromBackingInt(@intCast(@backingInt(index) >> ip.tid_shift_30 & ip.getTidMask())), |
| 4192 | .index = @intFromEnum(index) & ip.getIndexMask(u30), | 4192 | .index = @backingInt(index) & ip.getIndexMask(u30), |
| 4193 | }; | 4193 | }; |
| 4194 | } | 4194 | } |
| 4195 | 4195 | ||
| ... | @@ -5794,46 +5794,46 @@ pub const TypeTuple = struct { | ... | @@ -5794,46 +5794,46 @@ pub const TypeTuple = struct { |
| 5794 | /// implement logic that only wants to deal with types because the logic can | 5794 | /// implement logic that only wants to deal with types because the logic can |
| 5795 | /// ignore all simple values. Note that technically, types are values. | 5795 | /// ignore all simple values. Note that technically, types are values. |
| 5796 | pub const SimpleType = enum(u32) { | 5796 | pub const SimpleType = enum(u32) { |
| 5797 | f16 = @intFromEnum(Index.f16_type), | 5797 | f16 = @backingInt(Index.f16_type), |
| 5798 | f32 = @intFromEnum(Index.f32_type), | 5798 | f32 = @backingInt(Index.f32_type), |
| 5799 | f64 = @intFromEnum(Index.f64_type), | 5799 | f64 = @backingInt(Index.f64_type), |
| 5800 | f80 = @intFromEnum(Index.f80_type), | 5800 | f80 = @backingInt(Index.f80_type), |
| 5801 | f128 = @intFromEnum(Index.f128_type), | 5801 | f128 = @backingInt(Index.f128_type), |
| 5802 | usize = @intFromEnum(Index.usize_type), | 5802 | usize = @backingInt(Index.usize_type), |
| 5803 | isize = @intFromEnum(Index.isize_type), | 5803 | isize = @backingInt(Index.isize_type), |
| 5804 | c_char = @intFromEnum(Index.c_char_type), | 5804 | c_char = @backingInt(Index.c_char_type), |
| 5805 | c_short = @intFromEnum(Index.c_short_type), | 5805 | c_short = @backingInt(Index.c_short_type), |
| 5806 | c_ushort = @intFromEnum(Index.c_ushort_type), | 5806 | c_ushort = @backingInt(Index.c_ushort_type), |
| 5807 | c_int = @intFromEnum(Index.c_int_type), | 5807 | c_int = @backingInt(Index.c_int_type), |
| 5808 | c_uint = @intFromEnum(Index.c_uint_type), | 5808 | c_uint = @backingInt(Index.c_uint_type), |
| 5809 | c_long = @intFromEnum(Index.c_long_type), | 5809 | c_long = @backingInt(Index.c_long_type), |
| 5810 | c_ulong = @intFromEnum(Index.c_ulong_type), | 5810 | c_ulong = @backingInt(Index.c_ulong_type), |
| 5811 | c_longlong = @intFromEnum(Index.c_longlong_type), | 5811 | c_longlong = @backingInt(Index.c_longlong_type), |
| 5812 | c_ulonglong = @intFromEnum(Index.c_ulonglong_type), | 5812 | c_ulonglong = @backingInt(Index.c_ulonglong_type), |
| 5813 | c_longdouble = @intFromEnum(Index.c_longdouble_type), | 5813 | c_longdouble = @backingInt(Index.c_longdouble_type), |
| 5814 | anyopaque = @intFromEnum(Index.anyopaque_type), | 5814 | anyopaque = @backingInt(Index.anyopaque_type), |
| 5815 | bool = @intFromEnum(Index.bool_type), | 5815 | bool = @backingInt(Index.bool_type), |
| 5816 | void = @intFromEnum(Index.void_type), | 5816 | void = @backingInt(Index.void_type), |
| 5817 | type = @intFromEnum(Index.type_type), | 5817 | type = @backingInt(Index.type_type), |
| 5818 | anyerror = @intFromEnum(Index.anyerror_type), | 5818 | anyerror = @backingInt(Index.anyerror_type), |
| 5819 | comptime_int = @intFromEnum(Index.comptime_int_type), | 5819 | comptime_int = @backingInt(Index.comptime_int_type), |
| 5820 | comptime_float = @intFromEnum(Index.comptime_float_type), | 5820 | comptime_float = @backingInt(Index.comptime_float_type), |
| 5821 | noreturn = @intFromEnum(Index.noreturn_type), | 5821 | noreturn = @backingInt(Index.noreturn_type), |
| 5822 | null = @intFromEnum(Index.null_type), | 5822 | null = @backingInt(Index.null_type), |
| 5823 | undefined = @intFromEnum(Index.undefined_type), | 5823 | undefined = @backingInt(Index.undefined_type), |
| 5824 | enum_literal = @intFromEnum(Index.enum_literal_type), | 5824 | enum_literal = @backingInt(Index.enum_literal_type), |
| 5825 | 5825 | ||
| 5826 | adhoc_inferred_error_set = @intFromEnum(Index.adhoc_inferred_error_set_type), | 5826 | adhoc_inferred_error_set = @backingInt(Index.adhoc_inferred_error_set_type), |
| 5827 | generic_poison = @intFromEnum(Index.generic_poison_type), | 5827 | generic_poison = @backingInt(Index.generic_poison_type), |
| 5828 | }; | 5828 | }; |
| 5829 | 5829 | ||
| 5830 | pub const SimpleValue = enum(u32) { | 5830 | pub const SimpleValue = enum(u32) { |
| 5831 | void = @intFromEnum(Index.void_value), | 5831 | void = @backingInt(Index.void_value), |
| 5832 | /// This is untyped `null`. | 5832 | /// This is untyped `null`. |
| 5833 | null = @intFromEnum(Index.null_value), | 5833 | null = @backingInt(Index.null_value), |
| 5834 | true = @intFromEnum(Index.bool_true), | 5834 | true = @backingInt(Index.bool_true), |
| 5835 | false = @intFromEnum(Index.bool_false), | 5835 | false = @backingInt(Index.bool_false), |
| 5836 | @"unreachable" = @intFromEnum(Index.unreachable_value), | 5836 | @"unreachable" = @backingInt(Index.unreachable_value), |
| 5837 | }; | 5837 | }; |
| 5838 | 5838 | ||
| 5839 | /// Stored as a power-of-two, with one special value to indicate none. | 5839 | /// Stored as a power-of-two, with one special value to indicate none. |
| ... | @@ -5851,14 +5851,14 @@ pub const Alignment = enum(u6) { | ... | @@ -5851,14 +5851,14 @@ pub const Alignment = enum(u6) { |
| 5851 | pub fn toByteUnits(a: Alignment) ?u64 { | 5851 | pub fn toByteUnits(a: Alignment) ?u64 { |
| 5852 | return switch (a) { | 5852 | return switch (a) { |
| 5853 | .none => null, | 5853 | .none => null, |
| 5854 | else => @as(u64, 1) << @intFromEnum(a), | 5854 | else => @as(u64, 1) << @backingInt(a), |
| 5855 | }; | 5855 | }; |
| 5856 | } | 5856 | } |
| 5857 | 5857 | ||
| 5858 | pub fn fromByteUnits(n: u64) Alignment { | 5858 | pub fn fromByteUnits(n: u64) Alignment { |
| 5859 | if (n == 0) return .none; | 5859 | if (n == 0) return .none; |
| 5860 | assert(std.math.isPowerOfTwo(n)); | 5860 | assert(std.math.isPowerOfTwo(n)); |
| 5861 | return @enumFromInt(@ctz(n)); | 5861 | return @fromBackingInt(@intCast(@ctz(n))); |
| 5862 | } | 5862 | } |
| 5863 | 5863 | ||
| 5864 | pub fn fromNonzeroByteUnits(n: u64) Alignment { | 5864 | pub fn fromNonzeroByteUnits(n: u64) Alignment { |
| ... | @@ -5868,21 +5868,21 @@ pub const Alignment = enum(u6) { | ... | @@ -5868,21 +5868,21 @@ pub const Alignment = enum(u6) { |
| 5868 | 5868 | ||
| 5869 | pub fn toLog2Units(a: Alignment) u6 { | 5869 | pub fn toLog2Units(a: Alignment) u6 { |
| 5870 | assert(a != .none); | 5870 | assert(a != .none); |
| 5871 | return @intFromEnum(a); | 5871 | return @backingInt(a); |
| 5872 | } | 5872 | } |
| 5873 | 5873 | ||
| 5874 | /// This is just a glorified `@enumFromInt` but using it can help | 5874 | /// This is just a glorified `@enumFromInt` but using it can help |
| 5875 | /// document the intended conversion. | 5875 | /// document the intended conversion. |
| 5876 | /// The parameter uses a u32 for convenience at the callsite. | 5876 | /// The parameter uses a u32 for convenience at the callsite. |
| 5877 | pub fn fromLog2Units(a: u32) Alignment { | 5877 | pub fn fromLog2Units(a: u32) Alignment { |
| 5878 | assert(a != @intFromEnum(Alignment.none)); | 5878 | assert(a != @backingInt(Alignment.none)); |
| 5879 | return @enumFromInt(a); | 5879 | return @fromBackingInt(@intCast(a)); |
| 5880 | } | 5880 | } |
| 5881 | 5881 | ||
| 5882 | pub fn order(lhs: Alignment, rhs: Alignment) std.math.Order { | 5882 | pub fn order(lhs: Alignment, rhs: Alignment) std.math.Order { |
| 5883 | assert(lhs != .none); | 5883 | assert(lhs != .none); |
| 5884 | assert(rhs != .none); | 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 | /// Relaxed comparison. We have this as default because a lot of callsites | 5888 | /// Relaxed comparison. We have this as default because a lot of callsites |
| ... | @@ -5896,7 +5896,7 @@ pub const Alignment = enum(u6) { | ... | @@ -5896,7 +5896,7 @@ pub const Alignment = enum(u6) { |
| 5896 | pub fn compareStrict(lhs: Alignment, op: std.math.CompareOperator, rhs: Alignment) bool { | 5896 | pub fn compareStrict(lhs: Alignment, op: std.math.CompareOperator, rhs: Alignment) bool { |
| 5897 | assert(lhs != .none); | 5897 | assert(lhs != .none); |
| 5898 | assert(rhs != .none); | 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 | /// Treats `none` as zero. | 5902 | /// Treats `none` as zero. |
| ... | @@ -5911,7 +5911,7 @@ pub const Alignment = enum(u6) { | ... | @@ -5911,7 +5911,7 @@ pub const Alignment = enum(u6) { |
| 5911 | pub fn maxStrict(lhs: Alignment, rhs: Alignment) Alignment { | 5911 | pub fn maxStrict(lhs: Alignment, rhs: Alignment) Alignment { |
| 5912 | assert(lhs != .none); | 5912 | assert(lhs != .none); |
| 5913 | assert(rhs != .none); | 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 | /// Treats `none` as zero. | 5917 | /// Treats `none` as zero. |
| ... | @@ -5926,7 +5926,7 @@ pub const Alignment = enum(u6) { | ... | @@ -5926,7 +5926,7 @@ pub const Alignment = enum(u6) { |
| 5926 | pub fn minStrict(lhs: Alignment, rhs: Alignment) Alignment { | 5926 | pub fn minStrict(lhs: Alignment, rhs: Alignment) Alignment { |
| 5927 | assert(lhs != .none); | 5927 | assert(lhs != .none); |
| 5928 | assert(rhs != .none); | 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 | /// Given a base address known to be aligned to `a`, | 5932 | /// Given a base address known to be aligned to `a`, |
| ... | @@ -5938,21 +5938,21 @@ pub const Alignment = enum(u6) { | ... | @@ -5938,21 +5938,21 @@ pub const Alignment = enum(u6) { |
| 5938 | /// Align an address forwards to this alignment. | 5938 | /// Align an address forwards to this alignment. |
| 5939 | pub fn forward(a: Alignment, addr: u64) u64 { | 5939 | pub fn forward(a: Alignment, addr: u64) u64 { |
| 5940 | assert(a != .none); | 5940 | assert(a != .none); |
| 5941 | const x = (@as(u64, 1) << @intFromEnum(a)) - 1; | 5941 | const x = (@as(u64, 1) << @backingInt(a)) - 1; |
| 5942 | return (addr + x) & ~x; | 5942 | return (addr + x) & ~x; |
| 5943 | } | 5943 | } |
| 5944 | 5944 | ||
| 5945 | /// Align an address backwards to this alignment. | 5945 | /// Align an address backwards to this alignment. |
| 5946 | pub fn backward(a: Alignment, addr: u64) u64 { | 5946 | pub fn backward(a: Alignment, addr: u64) u64 { |
| 5947 | assert(a != .none); | 5947 | assert(a != .none); |
| 5948 | const x = (@as(u64, 1) << @intFromEnum(a)) - 1; | 5948 | const x = (@as(u64, 1) << @backingInt(a)) - 1; |
| 5949 | return addr & ~x; | 5949 | return addr & ~x; |
| 5950 | } | 5950 | } |
| 5951 | 5951 | ||
| 5952 | /// Check if an address is aligned to this amount. | 5952 | /// Check if an address is aligned to this amount. |
| 5953 | pub fn check(a: Alignment, addr: u64) bool { | 5953 | pub fn check(a: Alignment, addr: u64) bool { |
| 5954 | assert(a != .none); | 5954 | assert(a != .none); |
| 5955 | return @ctz(addr) >= @intFromEnum(a); | 5955 | return @ctz(addr) >= @backingInt(a); |
| 5956 | } | 5956 | } |
| 5957 | 5957 | ||
| 5958 | /// An array of `Alignment` objects existing within the `extra` array. | 5958 | /// An array of `Alignment` objects existing within the `extra` array. |
| ... | @@ -5981,25 +5981,25 @@ pub const Alignment = enum(u6) { | ... | @@ -5981,25 +5981,25 @@ pub const Alignment = enum(u6) { |
| 5981 | }; | 5981 | }; |
| 5982 | 5982 | ||
| 5983 | pub fn toRelaxedCompareUnits(a: Alignment) u8 { | 5983 | pub fn toRelaxedCompareUnits(a: Alignment) u8 { |
| 5984 | const n: u8 = @intFromEnum(a); | 5984 | const n: u8 = @backingInt(a); |
| 5985 | assert(n <= @intFromEnum(Alignment.none)); | 5985 | assert(n <= @backingInt(Alignment.none)); |
| 5986 | if (n == @intFromEnum(Alignment.none)) return 0; | 5986 | if (n == @backingInt(Alignment.none)) return 0; |
| 5987 | return n + 1; | 5987 | return n + 1; |
| 5988 | } | 5988 | } |
| 5989 | 5989 | ||
| 5990 | pub fn toStdMem(a: Alignment) std.mem.Alignment { | 5990 | pub fn toStdMem(a: Alignment) std.mem.Alignment { |
| 5991 | assert(a != .none); | 5991 | assert(a != .none); |
| 5992 | return @enumFromInt(@intFromEnum(a)); | 5992 | return @fromBackingInt(@intCast(@backingInt(a))); |
| 5993 | } | 5993 | } |
| 5994 | 5994 | ||
| 5995 | pub fn fromStdMem(a: std.mem.Alignment) Alignment { | 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 | assert(r != .none); | 5997 | assert(r != .none); |
| 5998 | return r; | 5998 | return r; |
| 5999 | } | 5999 | } |
| 6000 | 6000 | ||
| 6001 | pub fn toLlvm(a: Alignment) std.zig.llvm.Builder.Alignment { | 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,7 +6349,7 @@ pub fn init(ip: *InternPool, gpa: Allocator, io: Io, available_threads: usize) ! |
| 6349 | 6349 | ||
| 6350 | // This inserts all the statically-known values into the intern pool in the | 6350 | // This inserts all the statically-known values into the intern pool in the |
| 6351 | // order expected. | 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 | .empty_tuple_type => assert(try ip.getTupleType(gpa, io, .main, .{ | 6353 | .empty_tuple_type => assert(try ip.getTupleType(gpa, io, .main, .{ |
| 6354 | .types = &.{}, | 6354 | .types = &.{}, |
| 6355 | .values = &.{}, | 6355 | .values = &.{}, |
| ... | @@ -6476,8 +6476,8 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -6476,8 +6476,8 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6476 | .sentinel = .none, | 6476 | .sentinel = .none, |
| 6477 | } }; | 6477 | } }; |
| 6478 | }, | 6478 | }, |
| 6479 | .simple_type => .{ .simple_type = @enumFromInt(@intFromEnum(index)) }, | 6479 | .simple_type => .{ .simple_type = @fromBackingInt(@intCast(@backingInt(index))) }, |
| 6480 | .simple_value => .{ .simple_value = @enumFromInt(@intFromEnum(index)) }, | 6480 | .simple_value => .{ .simple_value = @fromBackingInt(@intCast(@backingInt(index))) }, |
| 6481 | 6481 | ||
| 6482 | .type_vector => { | 6482 | .type_vector => { |
| 6483 | const vector_info = extraData(unwrapped_index.getExtra(ip), Vector, data); | 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,7 +6490,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6490 | .type_pointer => .{ .ptr_type = extraData(unwrapped_index.getExtra(ip), Tag.TypePointer, data) }, | 6490 | .type_pointer => .{ .ptr_type = extraData(unwrapped_index.getExtra(ip), Tag.TypePointer, data) }, |
| 6491 | 6491 | ||
| 6492 | .type_slice => { | 6492 | .type_slice => { |
| 6493 | const many_ptr_index: Index = @enumFromInt(data); | 6493 | const many_ptr_index: Index = @fromBackingInt(@intCast(data)); |
| 6494 | const many_ptr_unwrapped = many_ptr_index.unwrap(ip); | 6494 | const many_ptr_unwrapped = many_ptr_index.unwrap(ip); |
| 6495 | const many_ptr_item = many_ptr_unwrapped.getItem(ip); | 6495 | const many_ptr_item = many_ptr_unwrapped.getItem(ip); |
| 6496 | assert(many_ptr_item.tag == .type_pointer); | 6496 | assert(many_ptr_item.tag == .type_pointer); |
| ... | @@ -6499,17 +6499,17 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -6499,17 +6499,17 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6499 | return .{ .ptr_type = ptr_info }; | 6499 | return .{ .ptr_type = ptr_info }; |
| 6500 | }, | 6500 | }, |
| 6501 | 6501 | ||
| 6502 | .type_optional => .{ .opt_type = @enumFromInt(data) }, | 6502 | .type_optional => .{ .opt_type = @fromBackingInt(@intCast(data)) }, |
| 6503 | .type_anyframe => .{ .anyframe_type = @enumFromInt(data) }, | 6503 | .type_anyframe => .{ .anyframe_type = @fromBackingInt(@intCast(data)) }, |
| 6504 | 6504 | ||
| 6505 | .type_error_union => .{ .error_union_type = extraData(unwrapped_index.getExtra(ip), Key.ErrorUnionType, data) }, | 6505 | .type_error_union => .{ .error_union_type = extraData(unwrapped_index.getExtra(ip), Key.ErrorUnionType, data) }, |
| 6506 | .type_anyerror_union => .{ .error_union_type = .{ | 6506 | .type_anyerror_union => .{ .error_union_type = .{ |
| 6507 | .error_set_type = .anyerror_type, | 6507 | .error_set_type = .anyerror_type, |
| 6508 | .payload_type = @enumFromInt(data), | 6508 | .payload_type = @fromBackingInt(@intCast(data)), |
| 6509 | } }, | 6509 | } }, |
| 6510 | .type_error_set => .{ .error_set_type = extraErrorSet(unwrapped_index.tid, unwrapped_index.getExtra(ip), data) }, | 6510 | .type_error_set => .{ .error_set_type = extraErrorSet(unwrapped_index.tid, unwrapped_index.getExtra(ip), data) }, |
| 6511 | .type_inferred_error_set => .{ | 6511 | .type_inferred_error_set => .{ |
| 6512 | .inferred_error_set_type = @enumFromInt(data), | 6512 | .inferred_error_set_type = @fromBackingInt(@intCast(data)), |
| 6513 | }, | 6513 | }, |
| 6514 | .type_function => .{ .func_type = extraFuncType(unwrapped_index.tid, unwrapped_index.getExtra(ip), data) }, | 6514 | .type_function => .{ .func_type = extraFuncType(unwrapped_index.tid, unwrapped_index.getExtra(ip), data) }, |
| 6515 | .type_tuple => .{ .tuple_type = extraTypeTuple(unwrapped_index.tid, unwrapped_index.getExtra(ip), data) }, | 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,7 +6553,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6553 | .captures = .{ .owned = .{ | 6553 | .captures = .{ .owned = .{ |
| 6554 | .tid = unwrapped_index.tid, | 6554 | .tid = unwrapped_index.tid, |
| 6555 | .start = extra.end, | 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,7 +6593,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6593 | .captures = .{ .owned = .{ | 6593 | .captures = .{ .owned = .{ |
| 6594 | .tid = unwrapped_index.tid, | 6594 | .tid = unwrapped_index.tid, |
| 6595 | .start = extra.end, | 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,18 +6603,18 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6603 | const extra = extraDataTrail(extra_list, Tag.TypeEnum, data); | 6603 | const extra = extraDataTrail(extra_list, Tag.TypeEnum, data); |
| 6604 | break :ns switch (extra.data.bits.captures_len) { | 6604 | break :ns switch (extra.data.bits.captures_len) { |
| 6605 | .reified => .{ .reified = .{ | 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 | .type_hash = extraData(extra_list, PackedU64, extra.end + 1).get(), | 6607 | .type_hash = extraData(extra_list, PackedU64, extra.end + 1).get(), |
| 6608 | } }, | 6608 | } }, |
| 6609 | .generated_union_tag => .{ .generated_union_tag = owner_union: { | 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 | _ => |len| .{ .declared = .{ | 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 | .captures = .{ .owned = .{ | 6614 | .captures = .{ .owned = .{ |
| 6615 | .tid = unwrapped_index.tid, | 6615 | .tid = unwrapped_index.tid, |
| 6616 | .start = extra.end + 1, | 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,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 | .opt_null => .{ .opt = .{ | 6642 | .opt_null => .{ .opt = .{ |
| 6643 | .ty = @enumFromInt(data), | 6643 | .ty = @fromBackingInt(@intCast(data)), |
| 6644 | .val = .none, | 6644 | .val = .none, |
| 6645 | } }, | 6645 | } }, |
| 6646 | .opt_payload => { | 6646 | .opt_payload => { |
| ... | @@ -6820,7 +6820,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -6820,7 +6820,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6820 | .func_decl => .{ .func = extraFuncDecl(unwrapped_index.tid, unwrapped_index.getExtra(ip), data) }, | 6820 | .func_decl => .{ .func = extraFuncDecl(unwrapped_index.tid, unwrapped_index.getExtra(ip), data) }, |
| 6821 | .func_coerced => .{ .func = ip.extraFuncCoerced(unwrapped_index.getExtra(ip), data) }, | 6821 | .func_coerced => .{ .func = ip.extraFuncCoerced(unwrapped_index.getExtra(ip), data) }, |
| 6822 | .only_possible_value => { | 6822 | .only_possible_value => { |
| 6823 | const ty: Index = @enumFromInt(data); | 6823 | const ty: Index = @fromBackingInt(@intCast(data)); |
| 6824 | const ty_unwrapped = ty.unwrap(ip); | 6824 | const ty_unwrapped = ty.unwrap(ip); |
| 6825 | const ty_extra = ty_unwrapped.getExtra(ip); | 6825 | const ty_extra = ty_unwrapped.getExtra(ip); |
| 6826 | const ty_item = ty_unwrapped.getItem(ip); | 6826 | const ty_item = ty_unwrapped.getItem(ip); |
| ... | @@ -6912,7 +6912,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -6912,7 +6912,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 6912 | .val = .{ .payload = extra.val }, | 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 | .enum_tag => .{ .enum_tag = extraData(unwrapped_index.getExtra(ip), Tag.EnumTag, data) }, | 6916 | .enum_tag => .{ .enum_tag = extraData(unwrapped_index.getExtra(ip), Tag.EnumTag, data) }, |
| 6917 | .bitpack => .{ .bitpack = extraData(unwrapped_index.getExtra(ip), Key.Bitpack, data) }, | 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,9 +7015,9 @@ fn extraFuncInstance(ip: *const InternPool, tid: Zcu.PerThread.Id, extra: Local. |
| 7015 | const extra_items = extra.view().items(.@"0"); | 7015 | const extra_items = extra.view().items(.@"0"); |
| 7016 | const analysis_extra_index = extra_index + std.meta.fieldIndex(Tag.FuncInstance, "analysis").?; | 7016 | const analysis_extra_index = extra_index + std.meta.fieldIndex(Tag.FuncInstance, "analysis").?; |
| 7017 | const analysis: FuncAnalysis = @bitCast(@atomicLoad(u32, &extra_items[analysis_extra_index], .unordered)); | 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").?]); | 7018 | const owner_nav: Nav.Index = @fromBackingInt(@intCast(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").?]); | 7019 | const ty: Index = @fromBackingInt(@intCast(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").?]); | 7020 | const generic_owner: Index = @fromBackingInt(@intCast(extra_items[extra_index + std.meta.fieldIndex(Tag.FuncInstance, "generic_owner").?])); |
| 7021 | const func_decl = ip.funcDeclInfo(generic_owner); | 7021 | const func_decl = ip.funcDeclInfo(generic_owner); |
| 7022 | const end_extra_index = extra_index + @as(u32, @typeInfo(Tag.FuncInstance).@"struct".field_names.len); | 7022 | const end_extra_index = extra_index + @as(u32, @typeInfo(Tag.FuncInstance).@"struct".field_names.len); |
| 7023 | return .{ | 7023 | return .{ |
| ... | @@ -7279,7 +7279,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: | ... | @@ -7279,7 +7279,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7279 | try items.ensureUnusedCapacity(1); | 7279 | try items.ensureUnusedCapacity(1); |
| 7280 | items.appendAssumeCapacity(.{ | 7280 | items.appendAssumeCapacity(.{ |
| 7281 | .tag = .type_slice, | 7281 | .tag = .type_slice, |
| 7282 | .data = @intFromEnum(ptr_type_index), | 7282 | .data = @backingInt(ptr_type_index), |
| 7283 | }); | 7283 | }); |
| 7284 | return gop.put(); | 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,20 +7333,20 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7333 | assert(payload_type != .none); | 7333 | assert(payload_type != .none); |
| 7334 | items.appendAssumeCapacity(.{ | 7334 | items.appendAssumeCapacity(.{ |
| 7335 | .tag = .type_optional, | 7335 | .tag = .type_optional, |
| 7336 | .data = @intFromEnum(payload_type), | 7336 | .data = @backingInt(payload_type), |
| 7337 | }); | 7337 | }); |
| 7338 | }, | 7338 | }, |
| 7339 | .anyframe_type => |payload_type| { | 7339 | .anyframe_type => |payload_type| { |
| 7340 | // payload_type might be none, indicating the type is `anyframe`. | 7340 | // payload_type might be none, indicating the type is `anyframe`. |
| 7341 | items.appendAssumeCapacity(.{ | 7341 | items.appendAssumeCapacity(.{ |
| 7342 | .tag = .type_anyframe, | 7342 | .tag = .type_anyframe, |
| 7343 | .data = @intFromEnum(payload_type), | 7343 | .data = @backingInt(payload_type), |
| 7344 | }); | 7344 | }); |
| 7345 | }, | 7345 | }, |
| 7346 | .error_union_type => |error_union_type| { | 7346 | .error_union_type => |error_union_type| { |
| 7347 | items.appendAssumeCapacity(if (error_union_type.error_set_type == .anyerror_type) .{ | 7347 | items.appendAssumeCapacity(if (error_union_type.error_set_type == .anyerror_type) .{ |
| 7348 | .tag = .type_anyerror_union, | 7348 | .tag = .type_anyerror_union, |
| 7349 | .data = @intFromEnum(error_union_type.payload_type), | 7349 | .data = @backingInt(error_union_type.payload_type), |
| 7350 | } else .{ | 7350 | } else .{ |
| 7351 | .tag = .type_error_union, | 7351 | .tag = .type_error_union, |
| 7352 | .data = try addExtra(extra, error_union_type), | 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,18 +7372,18 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7372 | .inferred_error_set_type => |ies_index| { | 7372 | .inferred_error_set_type => |ies_index| { |
| 7373 | items.appendAssumeCapacity(.{ | 7373 | items.appendAssumeCapacity(.{ |
| 7374 | .tag = .type_inferred_error_set, | 7374 | .tag = .type_inferred_error_set, |
| 7375 | .data = @intFromEnum(ies_index), | 7375 | .data = @backingInt(ies_index), |
| 7376 | }); | 7376 | }); |
| 7377 | }, | 7377 | }, |
| 7378 | .simple_type => |simple_type| { | 7378 | .simple_type => |simple_type| { |
| 7379 | assert(@intFromEnum(simple_type) == items.mutate.len); | 7379 | assert(@backingInt(simple_type) == items.mutate.len); |
| 7380 | items.appendAssumeCapacity(.{ | 7380 | items.appendAssumeCapacity(.{ |
| 7381 | .tag = .simple_type, | 7381 | .tag = .simple_type, |
| 7382 | .data = 0, // avoid writing `undefined` bits to a file | 7382 | .data = 0, // avoid writing `undefined` bits to a file |
| 7383 | }); | 7383 | }); |
| 7384 | }, | 7384 | }, |
| 7385 | .simple_value => |simple_value| { | 7385 | .simple_value => |simple_value| { |
| 7386 | assert(@intFromEnum(simple_value) == items.mutate.len); | 7386 | assert(@backingInt(simple_value) == items.mutate.len); |
| 7387 | items.appendAssumeCapacity(.{ | 7387 | items.appendAssumeCapacity(.{ |
| 7388 | .tag = .simple_value, | 7388 | .tag = .simple_value, |
| 7389 | .data = 0, // avoid writing `undefined` bits to a file | 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,7 +7393,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7393 | assert(ty != .none); | 7393 | assert(ty != .none); |
| 7394 | items.appendAssumeCapacity(.{ | 7394 | items.appendAssumeCapacity(.{ |
| 7395 | .tag = .undef, | 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,7 +7535,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7535 | assert(opt.val == .none or ip.indexToKey(opt.ty).opt_type == ip.typeOf(opt.val)); | 7535 | assert(opt.val == .none or ip.indexToKey(opt.ty).opt_type == ip.typeOf(opt.val)); |
| 7536 | items.appendAssumeCapacity(if (opt.val == .none) .{ | 7536 | items.appendAssumeCapacity(if (opt.val == .none) .{ |
| 7537 | .tag = .opt_null, | 7537 | .tag = .opt_null, |
| 7538 | .data = @intFromEnum(opt.ty), | 7538 | .data = @backingInt(opt.ty), |
| 7539 | } else .{ | 7539 | } else .{ |
| 7540 | .tag = .opt_payload, | 7540 | .tag = .opt_payload, |
| 7541 | .data = try addExtra(extra, Tag.TypeValue{ | 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,7 +7735,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7735 | 7735 | ||
| 7736 | .enum_literal => |enum_literal| items.appendAssumeCapacity(.{ | 7736 | .enum_literal => |enum_literal| items.appendAssumeCapacity(.{ |
| 7737 | .tag = .enum_literal, | 7737 | .tag = .enum_literal, |
| 7738 | .data = @intFromEnum(enum_literal), | 7738 | .data = @backingInt(enum_literal), |
| 7739 | }), | 7739 | }), |
| 7740 | 7740 | ||
| 7741 | .enum_tag => |enum_tag| { | 7741 | .enum_tag => |enum_tag| { |
| ... | @@ -7849,7 +7849,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: | ... | @@ -7849,7 +7849,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7849 | if (len == 0) { | 7849 | if (len == 0) { |
| 7850 | items.appendAssumeCapacity(.{ | 7850 | items.appendAssumeCapacity(.{ |
| 7851 | .tag = .only_possible_value, | 7851 | .tag = .only_possible_value, |
| 7852 | .data = @intFromEnum(aggregate.ty), | 7852 | .data = @backingInt(aggregate.ty), |
| 7853 | }); | 7853 | }); |
| 7854 | return gop.put(); | 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,7 +7882,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7882 | // in the aggregate fields. | 7882 | // in the aggregate fields. |
| 7883 | items.appendAssumeCapacity(.{ | 7883 | items.appendAssumeCapacity(.{ |
| 7884 | .tag = .only_possible_value, | 7884 | .tag = .only_possible_value, |
| 7885 | .data = @intFromEnum(aggregate.ty), | 7885 | .data = @backingInt(aggregate.ty), |
| 7886 | }); | 7886 | }); |
| 7887 | return gop.put(); | 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,7 +7977,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerThread.Id, key: |
| 7977 | }), | 7977 | }), |
| 7978 | }); | 7978 | }); |
| 7979 | extra.appendSliceAssumeCapacity(.{@ptrCast(aggregate.storage.elems)}); | 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 | .bitpack => |bitpack| { | 7982 | .bitpack => |bitpack| { |
| 7983 | switch (ip.zigTypeTag(bitpack.ty)) { | 7983 | switch (ip.zigTypeTag(bitpack.ty)) { |
| ... | @@ -8066,7 +8066,7 @@ pub fn getDeclaredStructType( | ... | @@ -8066,7 +8066,7 @@ pub fn getDeclaredStructType( |
| 8066 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeStructPacked{ | 8066 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeStructPacked{ |
| 8067 | .zir_index = ini.zir_index, | 8067 | .zir_index = ini.zir_index, |
| 8068 | .bits = .{ | 8068 | .bits = .{ |
| 8069 | .captures_len = @enumFromInt(ini.captures.len), | 8069 | .captures_len = @fromBackingInt(@intCast(ini.captures.len)), |
| 8070 | .want_layout = false, | 8070 | .want_layout = false, |
| 8071 | }, | 8071 | }, |
| 8072 | .name = undefined, // set by `finish` | 8072 | .name = undefined, // set by `finish` |
| ... | @@ -8077,10 +8077,10 @@ pub fn getDeclaredStructType( | ... | @@ -8077,10 +8077,10 @@ pub fn getDeclaredStructType( |
| 8077 | .field_name_map = field_name_map, | 8077 | .field_name_map = field_name_map, |
| 8078 | }); | 8078 | }); |
| 8079 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture | 8079 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture |
| 8080 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // field_name | 8080 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // field_name |
| 8081 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_type | 8081 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_type |
| 8082 | if (ini.any_field_defaults) { | 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 | items.appendAssumeCapacity(.{ | 8085 | items.appendAssumeCapacity(.{ |
| 8086 | .tag = switch (ini.packed_backing_mode) { | 8086 | .tag = switch (ini.packed_backing_mode) { |
| ... | @@ -8138,10 +8138,10 @@ pub fn getDeclaredStructType( | ... | @@ -8138,10 +8138,10 @@ pub fn getDeclaredStructType( |
| 8138 | extra.appendAssumeCapacity(.{@intCast(ini.captures.len)}); // captures_len | 8138 | extra.appendAssumeCapacity(.{@intCast(ini.captures.len)}); // captures_len |
| 8139 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture | 8139 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture |
| 8140 | } | 8140 | } |
| 8141 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // field_name | 8141 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // field_name |
| 8142 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_type | 8142 | extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_type |
| 8143 | if (ini.any_field_defaults) { | 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 | if (ini.any_field_aligns) { | 8146 | if (ini.any_field_aligns) { |
| 8147 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 3) / 4); // field_align | 8147 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 3) / 4); // field_align |
| ... | @@ -8150,7 +8150,7 @@ pub fn getDeclaredStructType( | ... | @@ -8150,7 +8150,7 @@ pub fn getDeclaredStructType( |
| 8150 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 31) / 32); // field_is_comptime_bits | 8150 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 31) / 32); // field_is_comptime_bits |
| 8151 | } | 8151 | } |
| 8152 | if (!is_extern) { | 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 | extra.appendNTimesAssumeCapacity(.{0}, ini.fields_len); // field_offset | 8155 | extra.appendNTimesAssumeCapacity(.{0}, ini.fields_len); // field_offset |
| 8156 | items.appendAssumeCapacity(.{ | 8156 | items.appendAssumeCapacity(.{ |
| ... | @@ -8222,12 +8222,12 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe | ... | @@ -8222,12 +8222,12 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe |
| 8222 | }); | 8222 | }); |
| 8223 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); // type_hash | 8223 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); // type_hash |
| 8224 | const field_names_start = extra.mutate.len; | 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 | const field_types_start = extra.mutate.len; | 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 | const field_defaults_start = extra.mutate.len; | 8228 | const field_defaults_start = extra.mutate.len; |
| 8229 | if (ini.any_field_defaults) { | 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 | items.appendAssumeCapacity(.{ | 8232 | items.appendAssumeCapacity(.{ |
| 8233 | .tag = switch (ini.packed_backing_int_type) { | 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,12 +8285,12 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe |
| 8285 | }); | 8285 | }); |
| 8286 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); // type_hash | 8286 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); // type_hash |
| 8287 | const field_names_start = extra.mutate.len; | 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 | const field_types_start = extra.mutate.len; | 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 | const field_defaults_start = extra.mutate.len; | 8291 | const field_defaults_start = extra.mutate.len; |
| 8292 | if (ini.any_field_defaults) { | 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 | const field_aligns_start = extra.mutate.len; | 8295 | const field_aligns_start = extra.mutate.len; |
| 8296 | if (ini.any_field_aligns) { | 8296 | if (ini.any_field_aligns) { |
| ... | @@ -8301,7 +8301,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe | ... | @@ -8301,7 +8301,7 @@ pub fn getReifiedStructType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Pe |
| 8301 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 31) / 32); // field_is_comptime_bits | 8301 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 31) / 32); // field_is_comptime_bits |
| 8302 | } | 8302 | } |
| 8303 | if (!is_extern) { | 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 | extra.appendNTimesAssumeCapacity(.{0}, ini.fields_len); // field_offset | 8306 | extra.appendNTimesAssumeCapacity(.{0}, ini.fields_len); // field_offset |
| 8307 | items.appendAssumeCapacity(.{ | 8307 | items.appendAssumeCapacity(.{ |
| ... | @@ -8381,7 +8381,7 @@ pub fn getDeclaredUnionType( | ... | @@ -8381,7 +8381,7 @@ pub fn getDeclaredUnionType( |
| 8381 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeUnionPacked{ | 8381 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeUnionPacked{ |
| 8382 | .zir_index = ini.zir_index, | 8382 | .zir_index = ini.zir_index, |
| 8383 | .bits = .{ | 8383 | .bits = .{ |
| 8384 | .captures_len = @enumFromInt(ini.captures.len), | 8384 | .captures_len = @fromBackingInt(@intCast(ini.captures.len)), |
| 8385 | .want_layout = false, | 8385 | .want_layout = false, |
| 8386 | }, | 8386 | }, |
| 8387 | .name = undefined, // set by `finish` | 8387 | .name = undefined, // set by `finish` |
| ... | @@ -8392,7 +8392,7 @@ pub fn getDeclaredUnionType( | ... | @@ -8392,7 +8392,7 @@ pub fn getDeclaredUnionType( |
| 8392 | .fields_len = ini.fields_len, | 8392 | .fields_len = ini.fields_len, |
| 8393 | }); | 8393 | }); |
| 8394 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture | 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 | items.appendAssumeCapacity(.{ | 8396 | items.appendAssumeCapacity(.{ |
| 8397 | .tag = switch (ini.packed_backing_mode) { | 8397 | .tag = switch (ini.packed_backing_mode) { |
| 8398 | .auto => .type_union_packed_auto, | 8398 | .auto => .type_union_packed_auto, |
| ... | @@ -8446,7 +8446,7 @@ pub fn getDeclaredUnionType( | ... | @@ -8446,7 +8446,7 @@ pub fn getDeclaredUnionType( |
| 8446 | extra.appendAssumeCapacity(.{@intCast(ini.captures.len)}); // captures_len | 8446 | extra.appendAssumeCapacity(.{@intCast(ini.captures.len)}); // captures_len |
| 8447 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture | 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 | if (ini.any_field_aligns) { | 8450 | if (ini.any_field_aligns) { |
| 8451 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 3) / 4); // field_align | 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,9 +8516,9 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per |
| 8516 | }); | 8516 | }); |
| 8517 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); // type_hash | 8517 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); // type_hash |
| 8518 | const field_names_start = extra.mutate.len; | 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 | const field_types_start = extra.mutate.len; | 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 | items.appendAssumeCapacity(.{ | 8522 | items.appendAssumeCapacity(.{ |
| 8523 | .tag = switch (ini.packed_backing_int_type) { | 8523 | .tag = switch (ini.packed_backing_int_type) { |
| 8524 | .none => .type_union_packed_auto, | 8524 | .none => .type_union_packed_auto, |
| ... | @@ -8570,9 +8570,9 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per | ... | @@ -8570,9 +8570,9 @@ pub fn getReifiedUnionType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.Per |
| 8570 | }); | 8570 | }); |
| 8571 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); | 8571 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); |
| 8572 | const field_names_start = extra.mutate.len; | 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 | const field_types_start = extra.mutate.len; | 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 | const field_aligns_start = extra.mutate.len; | 8576 | const field_aligns_start = extra.mutate.len; |
| 8577 | if (ini.any_field_aligns) { | 8577 | if (ini.any_field_aligns) { |
| 8578 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 3) / 4); // field_align | 8578 | extra.appendNTimesAssumeCapacity(.{0}, (ini.fields_len + 3) / 4); // field_align |
| ... | @@ -8657,7 +8657,7 @@ pub fn getDeclaredEnumType( | ... | @@ -8657,7 +8657,7 @@ pub fn getDeclaredEnumType( |
| 8657 | 8657 | ||
| 8658 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeEnum{ | 8658 | const extra_index = addExtraAssumeCapacity(extra, Tag.TypeEnum{ |
| 8659 | .bits = .{ | 8659 | .bits = .{ |
| 8660 | .captures_len = @enumFromInt(ini.captures.len), | 8660 | .captures_len = @fromBackingInt(@intCast(ini.captures.len)), |
| 8661 | .want_layout = false, | 8661 | .want_layout = false, |
| 8662 | }, | 8662 | }, |
| 8663 | .name = undefined, // set by `finish` | 8663 | .name = undefined, // set by `finish` |
| ... | @@ -8667,11 +8667,11 @@ pub fn getDeclaredEnumType( | ... | @@ -8667,11 +8667,11 @@ pub fn getDeclaredEnumType( |
| 8667 | .fields_len = ini.fields_len, | 8667 | .fields_len = ini.fields_len, |
| 8668 | .field_name_map = field_name_map, | 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 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture | 8671 | extra.appendSliceAssumeCapacity(.{@ptrCast(ini.captures)}); // capture |
| 8672 | if (have_values) extra.appendAssumeCapacity(.{@intFromEnum(field_value_map)}); // field_value_map | 8672 | if (have_values) extra.appendAssumeCapacity(.{@backingInt(field_value_map)}); // field_value_map |
| 8673 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // field_name | 8673 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // field_name |
| 8674 | if (have_values) extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_value | 8674 | if (have_values) extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_value |
| 8675 | items.appendAssumeCapacity(.{ | 8675 | items.appendAssumeCapacity(.{ |
| 8676 | .tag = tag, | 8676 | .tag = tag, |
| 8677 | .data = extra_index, | 8677 | .data = extra_index, |
| ... | @@ -8742,13 +8742,13 @@ pub fn getReifiedEnumType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerT | ... | @@ -8742,13 +8742,13 @@ pub fn getReifiedEnumType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu.PerT |
| 8742 | .fields_len = ini.fields_len, | 8742 | .fields_len = ini.fields_len, |
| 8743 | .field_name_map = field_name_map, | 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 | _ = addExtraAssumeCapacity(extra, PackedU64.init(ini.type_hash)); // type_hash | 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 | const field_names_start = extra.mutate.len; | 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 | const field_values_start = extra.mutate.len; | 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 | items.appendAssumeCapacity(.{ | 8752 | items.appendAssumeCapacity(.{ |
| 8753 | .tag = tag, | 8753 | .tag = tag, |
| 8754 | .data = extra_index, | 8754 | .data = extra_index, |
| ... | @@ -8841,10 +8841,10 @@ pub fn getGeneratedEnumTagType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu | ... | @@ -8841,10 +8841,10 @@ pub fn getGeneratedEnumTagType(ip: *InternPool, gpa: Allocator, io: Io, tid: Zcu |
| 8841 | .fields_len = ini.fields_len, | 8841 | .fields_len = ini.fields_len, |
| 8842 | .field_name_map = field_name_map, | 8842 | .field_name_map = field_name_map, |
| 8843 | }); | 8843 | }); |
| 8844 | extra.appendAssumeCapacity(.{@intFromEnum(ini.union_type)}); // owner_union | 8844 | extra.appendAssumeCapacity(.{@backingInt(ini.union_type)}); // owner_union |
| 8845 | if (have_values) extra.appendAssumeCapacity(.{@intFromEnum(field_value_map)}); | 8845 | if (have_values) extra.appendAssumeCapacity(.{@backingInt(field_value_map)}); |
| 8846 | extra.appendNTimesAssumeCapacity(.{@intFromEnum(NullTerminatedString.empty)}, ini.fields_len); // field_name | 8846 | extra.appendNTimesAssumeCapacity(.{@backingInt(NullTerminatedString.empty)}, ini.fields_len); // field_name |
| 8847 | if (have_values) extra.appendNTimesAssumeCapacity(.{@intFromEnum(Index.none)}, ini.fields_len); // field_value | 8847 | if (have_values) extra.appendNTimesAssumeCapacity(.{@backingInt(Index.none)}, ini.fields_len); // field_value |
| 8848 | items.appendAssumeCapacity(.{ | 8848 | items.appendAssumeCapacity(.{ |
| 8849 | .tag = switch (ini.int_tag_mode) { | 8849 | .tag = switch (ini.int_tag_mode) { |
| 8850 | .auto => .type_enum_auto, | 8850 | .auto => .type_enum_auto, |
| ... | @@ -8936,8 +8936,8 @@ pub const WipContainerType = struct { | ... | @@ -8936,8 +8936,8 @@ pub const WipContainerType = struct { |
| 8936 | ) void { | 8936 | ) void { |
| 8937 | const extra = ip.getLocalShared(wip.tid).extra.acquire(); | 8937 | const extra = ip.getLocalShared(wip.tid).extra.acquire(); |
| 8938 | const extra_items = extra.view().items(.@"0"); | 8938 | const extra_items = extra.view().items(.@"0"); |
| 8939 | extra_items[wip.type_name_index] = @intFromEnum(type_name); | 8939 | extra_items[wip.type_name_index] = @backingInt(type_name); |
| 8940 | extra_items[wip.name_nav_index] = @intFromEnum(name_nav); | 8940 | extra_items[wip.name_nav_index] = @backingInt(name_nav); |
| 8941 | } | 8941 | } |
| 8942 | 8942 | ||
| 8943 | pub fn finish( | 8943 | pub fn finish( |
| ... | @@ -8948,7 +8948,7 @@ pub const WipContainerType = struct { | ... | @@ -8948,7 +8948,7 @@ pub const WipContainerType = struct { |
| 8948 | const extra = ip.getLocalShared(wip.tid).extra.acquire(); | 8948 | const extra = ip.getLocalShared(wip.tid).extra.acquire(); |
| 8949 | const extra_items = extra.view().items(.@"0"); | 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 | return wip.index; | 8953 | return wip.index; |
| 8954 | } | 8954 | } |
| ... | @@ -9361,7 +9361,7 @@ pub fn getFuncDeclIes( | ... | @@ -9361,7 +9361,7 @@ pub fn getFuncDeclIes( |
| 9361 | .lbrace_column = key.lbrace_column, | 9361 | .lbrace_column = key.lbrace_column, |
| 9362 | .rbrace_column = key.rbrace_column, | 9362 | .rbrace_column = key.rbrace_column, |
| 9363 | }); | 9363 | }); |
| 9364 | extra.appendAssumeCapacity(.{@intFromEnum(Index.none)}); | 9364 | extra.appendAssumeCapacity(.{@backingInt(Index.none)}); |
| 9365 | 9365 | ||
| 9366 | const func_type_extra_index = addExtraAssumeCapacity(extra, Tag.TypeFunction{ | 9366 | const func_type_extra_index = addExtraAssumeCapacity(extra, Tag.TypeFunction{ |
| 9367 | .params_len = params_len, | 9367 | .params_len = params_len, |
| ... | @@ -9391,7 +9391,7 @@ pub fn getFuncDeclIes( | ... | @@ -9391,7 +9391,7 @@ pub fn getFuncDeclIes( |
| 9391 | .error_set_type = error_set_type, | 9391 | .error_set_type = error_set_type, |
| 9392 | .payload_type = key.bare_return_type, | 9392 | .payload_type = key.bare_return_type, |
| 9393 | }), | 9393 | }), |
| 9394 | @intFromEnum(func_index), | 9394 | @backingInt(func_index), |
| 9395 | func_type_extra_index, | 9395 | func_type_extra_index, |
| 9396 | }, | 9396 | }, |
| 9397 | }); | 9397 | }); |
| ... | @@ -9659,7 +9659,7 @@ fn getFuncInstanceIes( | ... | @@ -9659,7 +9659,7 @@ fn getFuncInstanceIes( |
| 9659 | .branch_quota = 0, | 9659 | .branch_quota = 0, |
| 9660 | .generic_owner = generic_owner, | 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 | extra.appendSliceAssumeCapacity(.{@ptrCast(arg.comptime_args)}); | 9663 | extra.appendSliceAssumeCapacity(.{@ptrCast(arg.comptime_args)}); |
| 9664 | 9664 | ||
| 9665 | const func_type_extra_index = addExtraAssumeCapacity(extra, Tag.TypeFunction{ | 9665 | const func_type_extra_index = addExtraAssumeCapacity(extra, Tag.TypeFunction{ |
| ... | @@ -9690,7 +9690,7 @@ fn getFuncInstanceIes( | ... | @@ -9690,7 +9690,7 @@ fn getFuncInstanceIes( |
| 9690 | .error_set_type = error_set_type, | 9690 | .error_set_type = error_set_type, |
| 9691 | .payload_type = arg.bare_return_type, | 9691 | .payload_type = arg.bare_return_type, |
| 9692 | }), | 9692 | }), |
| 9693 | @intFromEnum(func_index), | 9693 | @backingInt(func_index), |
| 9694 | func_type_extra_index, | 9694 | func_type_extra_index, |
| 9695 | }, | 9695 | }, |
| 9696 | }); | 9696 | }); |
| ... | @@ -9759,7 +9759,7 @@ fn finishFuncInstance( | ... | @@ -9759,7 +9759,7 @@ fn finishFuncInstance( |
| 9759 | 9759 | ||
| 9760 | // TODO: improve this name | 9760 | // TODO: improve this name |
| 9761 | const nav_name = try ip.getOrPutStringFmt(gpa, io, tid, "{f}__anon_{d}", .{ | 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 | }, .no_embedded_nulls); | 9763 | }, .no_embedded_nulls); |
| 9764 | const nav_fqn = try ip.namespacePtr(fn_namespace).internFullyQualifiedName(ip, gpa, io, tid, nav_name); | 9764 | const nav_fqn = try ip.namespacePtr(fn_namespace).internFullyQualifiedName(ip, gpa, io, tid, nav_name); |
| 9765 | const nav_index = try ip.createNav(gpa, io, tid, nav_name, nav_fqn, .{ | 9765 | const nav_index = try ip.createNav(gpa, io, tid, nav_name, nav_fqn, .{ |
| ... | @@ -9776,7 +9776,7 @@ fn finishFuncInstance( | ... | @@ -9776,7 +9776,7 @@ fn finishFuncInstance( |
| 9776 | // Populate the owner_nav field which was left undefined until now. | 9776 | // Populate the owner_nav field which was left undefined until now. |
| 9777 | extra.view().items(.@"0")[ | 9777 | extra.view().items(.@"0")[ |
| 9778 | func_extra_index + std.meta.fieldIndex(Tag.FuncInstance, "owner_nav").? | 9778 | func_extra_index + std.meta.fieldIndex(Tag.FuncInstance, "owner_nav").? |
| 9779 | ] = @intFromEnum(nav_index); | 9779 | ] = @backingInt(nav_index); |
| 9780 | } | 9780 | } |
| 9781 | 9781 | ||
| 9782 | pub fn getIfExists(ip: *const InternPool, key: Key) ?Index { | 9782 | pub fn getIfExists(ip: *const InternPool, key: Key) ?Index { |
| ... | @@ -9891,7 +9891,7 @@ fn addExtraAssumeCapacity(extra: Local.Extra.Mutable, item: anytype) u32 { | ... | @@ -9891,7 +9891,7 @@ fn addExtraAssumeCapacity(extra: Local.Extra.Mutable, item: anytype) u32 { |
| 9891 | TrackedInst.Index, | 9891 | TrackedInst.Index, |
| 9892 | TrackedInst.Index.Optional, | 9892 | TrackedInst.Index.Optional, |
| 9893 | ComptimeAllocIndex, | 9893 | ComptimeAllocIndex, |
| 9894 | => @intFromEnum(@field(item, field_name)), | 9894 | => @backingInt(@field(item, field_name)), |
| 9895 | 9895 | ||
| 9896 | u32, | 9896 | u32, |
| 9897 | i32, | 9897 | i32, |
| ... | @@ -9925,7 +9925,7 @@ fn addLimbsExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 { | ... | @@ -9925,7 +9925,7 @@ fn addLimbsExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 { |
| 9925 | inline for (info.field_names, info.field_types, 0..) |field_name, field_type, i| { | 9925 | inline for (info.field_names, info.field_types, 0..) |field_name, field_type, i| { |
| 9926 | const new: u32 = switch (field_type) { | 9926 | const new: u32 = switch (field_type) { |
| 9927 | u32 => @field(extra, field_name), | 9927 | u32 => @field(extra, field_name), |
| 9928 | Index => @intFromEnum(@field(extra, field_name)), | 9928 | Index => @backingInt(@field(extra, field_name)), |
| 9929 | else => @compileError("bad field type: " ++ @typeName(field_type)), | 9929 | else => @compileError("bad field type: " ++ @typeName(field_type)), |
| 9930 | }; | 9930 | }; |
| 9931 | if (i % 2 == 0) { | 9931 | if (i % 2 == 0) { |
| ... | @@ -9959,7 +9959,7 @@ fn extraDataTrail(extra: Local.Extra, comptime T: type, index: u32) struct { dat | ... | @@ -9959,7 +9959,7 @@ fn extraDataTrail(extra: Local.Extra, comptime T: type, index: u32) struct { dat |
| 9959 | TrackedInst.Index, | 9959 | TrackedInst.Index, |
| 9960 | TrackedInst.Index.Optional, | 9960 | TrackedInst.Index.Optional, |
| 9961 | ComptimeAllocIndex, | 9961 | ComptimeAllocIndex, |
| 9962 | => @enumFromInt(extra_item), | 9962 | => @fromBackingInt(@intCast(extra_item)), |
| 9963 | 9963 | ||
| 9964 | u32, | 9964 | u32, |
| 9965 | i32, | 9965 | i32, |
| ... | @@ -10047,7 +10047,7 @@ pub fn slicePtrType(ip: *const InternPool, index: Index) Index { | ... | @@ -10047,7 +10047,7 @@ pub fn slicePtrType(ip: *const InternPool, index: Index) Index { |
| 10047 | } | 10047 | } |
| 10048 | const item = index.unwrap(ip).getItem(ip); | 10048 | const item = index.unwrap(ip).getItem(ip); |
| 10049 | switch (item.tag) { | 10049 | switch (item.tag) { |
| 10050 | .type_slice => return @enumFromInt(item.data), | 10050 | .type_slice => return @fromBackingInt(@intCast(item.data)), |
| 10051 | else => unreachable, // not a slice type | 10051 | else => unreachable, // not a slice type |
| 10052 | } | 10052 | } |
| 10053 | } | 10053 | } |
| ... | @@ -10135,9 +10135,9 @@ pub fn getCoerced( | ... | @@ -10135,9 +10135,9 @@ pub fn getCoerced( |
| 10135 | .func_decl => return getCoercedFuncDecl(ip, gpa, io, tid, val, new_ty), | 10135 | .func_decl => return getCoercedFuncDecl(ip, gpa, io, tid, val, new_ty), |
| 10136 | .func_instance => return getCoercedFuncInstance(ip, gpa, io, tid, val, new_ty), | 10136 | .func_instance => return getCoercedFuncInstance(ip, gpa, io, tid, val, new_ty), |
| 10137 | .func_coerced => { | 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 | val_item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? | 10139 | val_item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? |
| 10140 | ]); | 10140 | ])); |
| 10141 | switch (func.unwrap(ip).getTag(ip)) { | 10141 | switch (func.unwrap(ip).getTag(ip)) { |
| 10142 | .func_decl => return getCoercedFuncDecl(ip, gpa, io, tid, func, new_ty), | 10142 | .func_decl => return getCoercedFuncDecl(ip, gpa, io, tid, func, new_ty), |
| 10143 | .func_instance => return getCoercedFuncInstance(ip, gpa, io, tid, func, new_ty), | 10143 | .func_instance => return getCoercedFuncInstance(ip, gpa, io, tid, func, new_ty), |
| ... | @@ -10378,9 +10378,9 @@ fn getCoercedFuncDecl( | ... | @@ -10378,9 +10378,9 @@ fn getCoercedFuncDecl( |
| 10378 | new_ty: Index, | 10378 | new_ty: Index, |
| 10379 | ) Allocator.Error!Index { | 10379 | ) Allocator.Error!Index { |
| 10380 | const unwrapped_val = val.unwrap(ip); | 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 | unwrapped_val.getData(ip) + std.meta.fieldIndex(Tag.FuncDecl, "ty").? | 10382 | unwrapped_val.getData(ip) + std.meta.fieldIndex(Tag.FuncDecl, "ty").? |
| 10383 | ]); | 10383 | ])); |
| 10384 | if (new_ty == prev_ty) return val; | 10384 | if (new_ty == prev_ty) return val; |
| 10385 | return getCoercedFunc(ip, gpa, io, tid, val, new_ty); | 10385 | return getCoercedFunc(ip, gpa, io, tid, val, new_ty); |
| 10386 | } | 10386 | } |
| ... | @@ -10394,9 +10394,9 @@ fn getCoercedFuncInstance( | ... | @@ -10394,9 +10394,9 @@ fn getCoercedFuncInstance( |
| 10394 | new_ty: Index, | 10394 | new_ty: Index, |
| 10395 | ) Allocator.Error!Index { | 10395 | ) Allocator.Error!Index { |
| 10396 | const unwrapped_val = val.unwrap(ip); | 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 | unwrapped_val.getData(ip) + std.meta.fieldIndex(Tag.FuncInstance, "ty").? | 10398 | unwrapped_val.getData(ip) + std.meta.fieldIndex(Tag.FuncInstance, "ty").? |
| 10399 | ]); | 10399 | ])); |
| 10400 | if (new_ty == prev_ty) return val; | 10400 | if (new_ty == prev_ty) return val; |
| 10401 | return getCoercedFunc(ip, gpa, io, tid, val, new_ty); | 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,7 +10739,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo |
| 10739 | const extra = extraDataTrail(extra_list, Tag.TypeStructPacked, data); | 10739 | const extra = extraDataTrail(extra_list, Tag.TypeStructPacked, data); |
| 10740 | switch (extra.data.bits.captures_len) { | 10740 | switch (extra.data.bits.captures_len) { |
| 10741 | .reified => n += 2, // type_hash: PackedU64 | 10741 | .reified => n += 2, // type_hash: PackedU64 |
| 10742 | _ => |len| n += @intFromEnum(len), // capture: CaptureValue | 10742 | _ => |len| n += @backingInt(len), // capture: CaptureValue |
| 10743 | } | 10743 | } |
| 10744 | n += extra.data.fields_len; // field_name: NullTerminatedString | 10744 | n += extra.data.fields_len; // field_name: NullTerminatedString |
| 10745 | n += extra.data.fields_len; // field_type: Index | 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,7 +10750,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo |
| 10750 | const extra = extraDataTrail(extra_list, Tag.TypeStructPacked, data); | 10750 | const extra = extraDataTrail(extra_list, Tag.TypeStructPacked, data); |
| 10751 | switch (extra.data.bits.captures_len) { | 10751 | switch (extra.data.bits.captures_len) { |
| 10752 | .reified => n += 2, // type_hash: PackedU64 | 10752 | .reified => n += 2, // type_hash: PackedU64 |
| 10753 | _ => |len| n += @intFromEnum(len), // capture: CaptureValue | 10753 | _ => |len| n += @backingInt(len), // capture: CaptureValue |
| 10754 | } | 10754 | } |
| 10755 | n += extra.data.fields_len; // field_name: NullTerminatedString | 10755 | n += extra.data.fields_len; // field_name: NullTerminatedString |
| 10756 | n += extra.data.fields_len; // field_type: Index | 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,7 +10779,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo |
| 10779 | const extra = extraDataTrail(extra_list, Tag.TypeUnionPacked, data); | 10779 | const extra = extraDataTrail(extra_list, Tag.TypeUnionPacked, data); |
| 10780 | switch (extra.data.bits.captures_len) { | 10780 | switch (extra.data.bits.captures_len) { |
| 10781 | .reified => n += 2, // type_hash: PackedU64 | 10781 | .reified => n += 2, // type_hash: PackedU64 |
| 10782 | _ => |len| n += @intFromEnum(len), // capture: CaptureValue | 10782 | _ => |len| n += @backingInt(len), // capture: CaptureValue |
| 10783 | } | 10783 | } |
| 10784 | n += extra.data.fields_len; // field_type: Index | 10784 | n += extra.data.fields_len; // field_type: Index |
| 10785 | break :b n * @sizeOf(u32); | 10785 | break :b n * @sizeOf(u32); |
| ... | @@ -10795,7 +10795,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo | ... | @@ -10795,7 +10795,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo |
| 10795 | }, | 10795 | }, |
| 10796 | _ => |len| { | 10796 | _ => |len| { |
| 10797 | n += 1; // zir_index: TrackedInst.Index, | 10797 | n += 1; // zir_index: TrackedInst.Index, |
| 10798 | n += @intFromEnum(len); // capture: CaptureValue | 10798 | n += @backingInt(len); // capture: CaptureValue |
| 10799 | }, | 10799 | }, |
| 10800 | } | 10800 | } |
| 10801 | n += extra.fields_len; // field_name: NullTerminatedString | 10801 | n += extra.fields_len; // field_name: NullTerminatedString |
| ... | @@ -10812,7 +10812,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo | ... | @@ -10812,7 +10812,7 @@ fn dumpStatsFallible(ip: *const InternPool, w: *Io.Writer, arena: Allocator) !vo |
| 10812 | }, | 10812 | }, |
| 10813 | _ => |len| { | 10813 | _ => |len| { |
| 10814 | n += 1; // zir_index: TrackedInst.Index, | 10814 | n += 1; // zir_index: TrackedInst.Index, |
| 10815 | n += @intFromEnum(len); // capture: CaptureValue | 10815 | n += @backingInt(len); // capture: CaptureValue |
| 10816 | }, | 10816 | }, |
| 10817 | } | 10817 | } |
| 10818 | n += 1; // field_value_map: MapIndex | 10818 | n += 1; // field_value_map: MapIndex |
| ... | @@ -10931,13 +10931,13 @@ fn dumpAllFallible(ip: *const InternPool, w: *Io.Writer) anyerror!void { | ... | @@ -10931,13 +10931,13 @@ fn dumpAllFallible(ip: *const InternPool, w: *Io.Writer) anyerror!void { |
| 10931 | items.items(.data)[0..local.mutate.items.len], | 10931 | items.items(.data)[0..local.mutate.items.len], |
| 10932 | 0.., | 10932 | 0.., |
| 10933 | ) |tag, data, index| { | 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 | try w.print("${d} = {s}(", .{ i, @tagName(tag) }); | 10935 | try w.print("${d} = {s}(", .{ i, @tagName(tag) }); |
| 10936 | switch (tag) { | 10936 | switch (tag) { |
| 10937 | .removed => {}, | 10937 | .removed => {}, |
| 10938 | 10938 | ||
| 10939 | .simple_type => try w.print("{s}", .{@tagName(@as(SimpleType, @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, @enumFromInt(@intFromEnum(i))))}), | 10940 | .simple_value => try w.print("{s}", .{@tagName(@as(SimpleValue, @fromBackingInt(@intCast(@backingInt(i)))))}), |
| 10941 | 10941 | ||
| 10942 | .type_int_signed, | 10942 | .type_int_signed, |
| 10943 | .type_int_unsigned, | 10943 | .type_int_unsigned, |
| ... | @@ -11054,7 +11054,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator, | ... | @@ -11054,7 +11054,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator, |
| 11054 | 11054 | ||
| 11055 | try gop.value_ptr.append( | 11055 | try gop.value_ptr.append( |
| 11056 | arena, | 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,10 +11272,10 @@ pub fn createNamespace( |
| 11272 | const local = ip.getLocal(tid); | 11272 | const local = ip.getLocal(tid); |
| 11273 | const free_list_next = local.mutate.namespaces.free_list; | 11273 | const free_list_next = local.mutate.namespaces.free_list; |
| 11274 | if (free_list_next != Local.BucketListMutate.free_list_sentinel) { | 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 | const reused_namespace = ip.namespacePtr(reused_namespace_index); | 11276 | const reused_namespace = ip.namespacePtr(reused_namespace_index); |
| 11277 | local.mutate.namespaces.free_list = | 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 | reused_namespace.* = initialization; | 11279 | reused_namespace.* = initialization; |
| 11280 | return reused_namespace_index; | 11280 | return reused_namespace_index; |
| 11281 | } | 11281 | } |
| ... | @@ -11314,8 +11314,8 @@ pub fn destroyNamespace( | ... | @@ -11314,8 +11314,8 @@ pub fn destroyNamespace( |
| 11314 | .generation = undefined, | 11314 | .generation = undefined, |
| 11315 | }; | 11315 | }; |
| 11316 | @field(namespace, Local.namespace_next_free_field) = | 11316 | @field(namespace, Local.namespace_next_free_field) = |
| 11317 | @enumFromInt(local.mutate.namespaces.free_list); | 11317 | @fromBackingInt(@intCast(local.mutate.namespaces.free_list)); |
| 11318 | local.mutate.namespaces.free_list = @intFromEnum(namespace_index); | 11318 | local.mutate.namespaces.free_list = @backingInt(namespace_index); |
| 11319 | } | 11319 | } |
| 11320 | 11320 | ||
| 11321 | pub fn filePtr(ip: *const InternPool, file_index: FileIndex) *Zcu.File { | 11321 | pub fn filePtr(ip: *const InternPool, file_index: FileIndex) *Zcu.File { |
| ... | @@ -11424,10 +11424,10 @@ pub fn getOrPutTrailingString( | ... | @@ -11424,10 +11424,10 @@ pub fn getOrPutTrailingString( |
| 11424 | try string_bytes.ensureUnusedCapacity(1); | 11424 | try string_bytes.ensureUnusedCapacity(1); |
| 11425 | } | 11425 | } |
| 11426 | const key: []const u8 = string_bytes.view().items(.@"0")[start..]; | 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 | .tid = tid, | 11428 | .tid = tid, |
| 11429 | .index = strings.mutate.len - 1, | 11429 | .index = strings.mutate.len - 1, |
| 11430 | }).wrap(ip))); | 11430 | }).wrap(ip)))); |
| 11431 | const has_embedded_null = std.mem.indexOfScalar(u8, key, 0) != null; | 11431 | const has_embedded_null = std.mem.indexOfScalar(u8, key, 0) != null; |
| 11432 | switch (embedded_nulls) { | 11432 | switch (embedded_nulls) { |
| 11433 | .no_embedded_nulls => assert(!has_embedded_null), | 11433 | .no_embedded_nulls => assert(!has_embedded_null), |
| ... | @@ -11452,7 +11452,7 @@ pub fn getOrPutTrailingString( | ... | @@ -11452,7 +11452,7 @@ pub fn getOrPutTrailingString( |
| 11452 | if (entry.hash != hash) continue; | 11452 | if (entry.hash != hash) continue; |
| 11453 | if (!index.eqlSlice(key, ip)) continue; | 11453 | if (!index.eqlSlice(key, ip)) continue; |
| 11454 | string_bytes.shrinkRetainingCapacity(start); | 11454 | string_bytes.shrinkRetainingCapacity(start); |
| 11455 | return @enumFromInt(@intFromEnum(index)); | 11455 | return @fromBackingInt(@intCast(@backingInt(index))); |
| 11456 | } | 11456 | } |
| 11457 | shard.mutate.string_map.mutex.lock(io, tid); | 11457 | shard.mutate.string_map.mutex.lock(io, tid); |
| 11458 | defer shard.mutate.string_map.mutex.unlock(io); | 11458 | defer shard.mutate.string_map.mutex.unlock(io); |
| ... | @@ -11468,7 +11468,7 @@ pub fn getOrPutTrailingString( | ... | @@ -11468,7 +11468,7 @@ pub fn getOrPutTrailingString( |
| 11468 | if (entry.hash != hash) continue; | 11468 | if (entry.hash != hash) continue; |
| 11469 | if (!index.eqlSlice(key, ip)) continue; | 11469 | if (!index.eqlSlice(key, ip)) continue; |
| 11470 | string_bytes.shrinkRetainingCapacity(start); | 11470 | string_bytes.shrinkRetainingCapacity(start); |
| 11471 | return @enumFromInt(@intFromEnum(index)); | 11471 | return @fromBackingInt(@intCast(@backingInt(index))); |
| 11472 | } | 11472 | } |
| 11473 | defer shard.mutate.string_map.len += 1; | 11473 | defer shard.mutate.string_map.len += 1; |
| 11474 | const map_header = map.header().*; | 11474 | const map_header = map.header().*; |
| ... | @@ -11477,7 +11477,7 @@ pub fn getOrPutTrailingString( | ... | @@ -11477,7 +11477,7 @@ pub fn getOrPutTrailingString( |
| 11477 | strings.appendAssumeCapacity(.{string_bytes.mutate.len}); | 11477 | strings.appendAssumeCapacity(.{string_bytes.mutate.len}); |
| 11478 | const entry = &map.entries[map_index]; | 11478 | const entry = &map.entries[map_index]; |
| 11479 | entry.hash = hash; | 11479 | entry.hash = hash; |
| 11480 | entry.release(@enumFromInt(@intFromEnum(value))); | 11480 | entry.release(@fromBackingInt(@intCast(@backingInt(value)))); |
| 11481 | return value; | 11481 | return value; |
| 11482 | } | 11482 | } |
| 11483 | const arena_state = &local.mutate.arena; | 11483 | const arena_state = &local.mutate.arena; |
| ... | @@ -11519,7 +11519,7 @@ pub fn getOrPutTrailingString( | ... | @@ -11519,7 +11519,7 @@ pub fn getOrPutTrailingString( |
| 11519 | string_bytes.appendAssumeCapacity(.{0}); | 11519 | string_bytes.appendAssumeCapacity(.{0}); |
| 11520 | strings.appendAssumeCapacity(.{string_bytes.mutate.len}); | 11520 | strings.appendAssumeCapacity(.{string_bytes.mutate.len}); |
| 11521 | map.entries[map_index] = .{ | 11521 | map.entries[map_index] = .{ |
| 11522 | .value = @enumFromInt(@intFromEnum(value)), | 11522 | .value = @fromBackingInt(@intCast(@backingInt(value))), |
| 11523 | .hash = hash, | 11523 | .hash = hash, |
| 11524 | }; | 11524 | }; |
| 11525 | shard.shared.string_map.release(new_map); | 11525 | shard.shared.string_map.release(new_map); |
| ... | @@ -11710,7 +11710,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { | ... | @@ -11710,7 +11710,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { |
| 11710 | .undef, | 11710 | .undef, |
| 11711 | .opt_null, | 11711 | .opt_null, |
| 11712 | .only_possible_value, | 11712 | .only_possible_value, |
| 11713 | => @enumFromInt(item.data), | 11713 | => @fromBackingInt(@intCast(item.data)), |
| 11714 | 11714 | ||
| 11715 | .simple_type, .simple_value => unreachable, // handled via Index above | 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,7 +11742,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { |
| 11742 | .bitpack, | 11742 | .bitpack, |
| 11743 | => |t| { | 11743 | => |t| { |
| 11744 | const extra_list = unwrapped_index.getExtra(ip); | 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 | .int_u8 => .u8_type, | 11748 | .int_u8 => .u8_type, |
| ... | @@ -11788,7 +11788,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { | ... | @@ -11788,7 +11788,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { |
| 11788 | /// Assumes that the enum's field indexes equal its value tags. | 11788 | /// Assumes that the enum's field indexes equal its value tags. |
| 11789 | pub fn toEnum(ip: *const InternPool, comptime E: type, i: Index) E { | 11789 | pub fn toEnum(ip: *const InternPool, comptime E: type, i: Index) E { |
| 11790 | const int = ip.indexToKey(i).enum_tag.int; | 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 | pub fn toFunc(ip: *const InternPool, i: Index) Key.Func { | 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,9 +11821,9 @@ pub fn funcTypeReturnType(ip: *const InternPool, ty: Index) Index { |
| 11821 | const ty_item = unwrapped_ty.getItem(ip); | 11821 | const ty_item = unwrapped_ty.getItem(ip); |
| 11822 | const child_extra, const child_item = switch (ty_item.tag) { | 11822 | const child_extra, const child_item = switch (ty_item.tag) { |
| 11823 | .type_pointer => child: { | 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 | ty_item.data + std.meta.fieldIndex(Tag.TypePointer, "child").? | 11825 | ty_item.data + std.meta.fieldIndex(Tag.TypePointer, "child").? |
| 11826 | ]); | 11826 | ])); |
| 11827 | const unwrapped_child = child_index.unwrap(ip); | 11827 | const unwrapped_child = child_index.unwrap(ip); |
| 11828 | break :child .{ unwrapped_child.getExtra(ip), unwrapped_child.getItem(ip) }; | 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,9 +11831,9 @@ pub fn funcTypeReturnType(ip: *const InternPool, ty: Index) Index { |
| 11831 | else => unreachable, | 11831 | else => unreachable, |
| 11832 | }; | 11832 | }; |
| 11833 | assert(child_item.tag == .type_function); | 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 | child_item.data + std.meta.fieldIndex(Tag.TypeFunction, "return_type").? | 11835 | child_item.data + std.meta.fieldIndex(Tag.TypeFunction, "return_type").? |
| 11836 | ]); | 11836 | ])); |
| 11837 | } | 11837 | } |
| 11838 | 11838 | ||
| 11839 | pub fn isUndef(ip: *const InternPool, val: Index) bool { | 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,12 +11857,12 @@ pub fn getBackingAddrTag(ip: *const InternPool, val: Index) ?Key.Ptr.BaseAddr.Ta |
| 11857 | .ptr_opt_payload, | 11857 | .ptr_opt_payload, |
| 11858 | .ptr_elem, | 11858 | .ptr_elem, |
| 11859 | .ptr_field, | 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 | base_item.data + std.meta.fieldIndex(tag.Payload(), "base").? | 11861 | base_item.data + std.meta.fieldIndex(tag.Payload(), "base").? |
| 11862 | ]), | 11862 | ])), |
| 11863 | inline .ptr_slice => |tag| base = @enumFromInt(unwrapped_base.getExtra(ip).view().items(.@"0")[ | 11863 | inline .ptr_slice => |tag| base = @fromBackingInt(@intCast(unwrapped_base.getExtra(ip).view().items(.@"0")[ |
| 11864 | base_item.data + std.meta.fieldIndex(tag.Payload(), "ptr").? | 11864 | base_item.data + std.meta.fieldIndex(tag.Payload(), "ptr").? |
| 11865 | ]), | 11865 | ])), |
| 11866 | else => return null, | 11866 | else => return null, |
| 11867 | } | 11867 | } |
| 11868 | } | 11868 | } |
| ... | @@ -12139,7 +12139,7 @@ fn funcAnalysisPtr(ip: *const InternPool, func: Index) *FuncAnalysis { | ... | @@ -12139,7 +12139,7 @@ fn funcAnalysisPtr(ip: *const InternPool, func: Index) *FuncAnalysis { |
| 12139 | .func_instance => item.data + std.meta.fieldIndex(Tag.FuncInstance, "analysis").?, | 12139 | .func_instance => item.data + std.meta.fieldIndex(Tag.FuncInstance, "analysis").?, |
| 12140 | .func_coerced => { | 12140 | .func_coerced => { |
| 12141 | const extra_index = item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").?; | 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 | const unwrapped_coerced_func = coerced_func_index.unwrap(ip); | 12143 | const unwrapped_coerced_func = coerced_func_index.unwrap(ip); |
| 12144 | const coerced_func_item = unwrapped_coerced_func.getItem(ip); | 12144 | const coerced_func_item = unwrapped_coerced_func.getItem(ip); |
| 12145 | return @ptrCast(&unwrapped_coerced_func.getExtra(ip).view().items(.@"0")[ | 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,20 +12201,20 @@ pub fn funcZirBodyInst(ip: *const InternPool, func: Index) TrackedInst.Index { |
| 12201 | const item_extra = unwrapped_func.getExtra(ip); | 12201 | const item_extra = unwrapped_func.getExtra(ip); |
| 12202 | const zir_body_inst_field_index = std.meta.fieldIndex(Tag.FuncDecl, "zir_body_inst").?; | 12202 | const zir_body_inst_field_index = std.meta.fieldIndex(Tag.FuncDecl, "zir_body_inst").?; |
| 12203 | switch (item.tag) { | 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 | .func_instance => { | 12205 | .func_instance => { |
| 12206 | const generic_owner_field_index = std.meta.fieldIndex(Tag.FuncInstance, "generic_owner").?; | 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 | const unwrapped_func_decl = func_decl_index.unwrap(ip); | 12208 | const unwrapped_func_decl = func_decl_index.unwrap(ip); |
| 12209 | const func_decl_item = unwrapped_func_decl.getItem(ip); | 12209 | const func_decl_item = unwrapped_func_decl.getItem(ip); |
| 12210 | const func_decl_extra = unwrapped_func_decl.getExtra(ip); | 12210 | const func_decl_extra = unwrapped_func_decl.getExtra(ip); |
| 12211 | assert(func_decl_item.tag == .func_decl); | 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 | .func_coerced => { | 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 | item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? | 12216 | item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? |
| 12217 | ]); | 12217 | ])); |
| 12218 | return ip.funcZirBodyInst(uncoerced_func_index); | 12218 | return ip.funcZirBodyInst(uncoerced_func_index); |
| 12219 | }, | 12219 | }, |
| 12220 | else => unreachable, | 12220 | else => unreachable, |
| ... | @@ -12224,7 +12224,7 @@ pub fn funcZirBodyInst(ip: *const InternPool, func: Index) TrackedInst.Index { | ... | @@ -12224,7 +12224,7 @@ pub fn funcZirBodyInst(ip: *const InternPool, func: Index) TrackedInst.Index { |
| 12224 | pub fn iesFuncIndex(ip: *const InternPool, ies_index: Index) Index { | 12224 | pub fn iesFuncIndex(ip: *const InternPool, ies_index: Index) Index { |
| 12225 | const item = ies_index.unwrap(ip).getItem(ip); | 12225 | const item = ies_index.unwrap(ip).getItem(ip); |
| 12226 | assert(item.tag == .type_inferred_error_set); | 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 | switch (func_index.unwrap(ip).getTag(ip)) { | 12228 | switch (func_index.unwrap(ip).getTag(ip)) { |
| 12229 | .func_decl, .func_instance => {}, | 12229 | .func_decl, .func_instance => {}, |
| 12230 | else => unreachable, // assertion failed | 12230 | else => unreachable, // assertion failed |
| ... | @@ -12244,9 +12244,9 @@ fn funcIesResolvedPtr(ip: *const InternPool, func_index: Index) *Index { | ... | @@ -12244,9 +12244,9 @@ fn funcIesResolvedPtr(ip: *const InternPool, func_index: Index) *Index { |
| 12244 | .func_decl => func_item.data + @typeInfo(Tag.FuncDecl).@"struct".field_names.len, | 12244 | .func_decl => func_item.data + @typeInfo(Tag.FuncDecl).@"struct".field_names.len, |
| 12245 | .func_instance => func_item.data + @typeInfo(Tag.FuncInstance).@"struct".field_names.len, | 12245 | .func_instance => func_item.data + @typeInfo(Tag.FuncInstance).@"struct".field_names.len, |
| 12246 | .func_coerced => { | 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 | func_item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? | 12248 | func_item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? |
| 12249 | ]); | 12249 | ])); |
| 12250 | const unwrapped_uncoerced_func = uncoerced_func_index.unwrap(ip); | 12250 | const unwrapped_uncoerced_func = uncoerced_func_index.unwrap(ip); |
| 12251 | const uncoerced_func_item = unwrapped_uncoerced_func.getItem(ip); | 12251 | const uncoerced_func_item = unwrapped_uncoerced_func.getItem(ip); |
| 12252 | return @ptrCast(&unwrapped_uncoerced_func.getExtra(ip).view().items(.@"0")[ | 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,9 +12294,9 @@ pub fn unwrapCoercedFunc(ip: *const InternPool, index: Index) Index { |
| 12294 | const unwrapped_index = index.unwrap(ip); | 12294 | const unwrapped_index = index.unwrap(ip); |
| 12295 | const item = unwrapped_index.getItem(ip); | 12295 | const item = unwrapped_index.getItem(ip); |
| 12296 | return switch (item.tag) { | 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 | item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? | 12298 | item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").? |
| 12299 | ]), | 12299 | ])), |
| 12300 | .func_instance, .func_decl => index, | 12300 | .func_instance, .func_decl => index, |
| 12301 | else => unreachable, | 12301 | else => unreachable, |
| 12302 | }; | 12302 | }; |
| ... | @@ -12392,7 +12392,7 @@ const GlobalErrorSet = struct { | ... | @@ -12392,7 +12392,7 @@ const GlobalErrorSet = struct { |
| 12392 | name: NullTerminatedString, | 12392 | name: NullTerminatedString, |
| 12393 | ) Allocator.Error!GlobalErrorSet.Index { | 12393 | ) Allocator.Error!GlobalErrorSet.Index { |
| 12394 | if (name == .empty) return .none; | 12394 | if (name == .empty) return .none; |
| 12395 | const hash = std.hash.int(@intFromEnum(name)); | 12395 | const hash = std.hash.int(@backingInt(name)); |
| 12396 | var map = ges.shared.map.acquire(); | 12396 | var map = ges.shared.map.acquire(); |
| 12397 | const Map = @TypeOf(map); | 12397 | const Map = @TypeOf(map); |
| 12398 | var map_mask = map.header().mask(); | 12398 | var map_mask = map.header().mask(); |
| ... | @@ -12404,7 +12404,7 @@ const GlobalErrorSet = struct { | ... | @@ -12404,7 +12404,7 @@ const GlobalErrorSet = struct { |
| 12404 | const index = entry.acquire(); | 12404 | const index = entry.acquire(); |
| 12405 | if (index == .none) break; | 12405 | if (index == .none) break; |
| 12406 | if (entry.hash != hash) continue; | 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 | ges.mutate.map.mutex.lockUncancelable(io); | 12409 | ges.mutate.map.mutex.lockUncancelable(io); |
| 12410 | defer ges.mutate.map.mutex.unlock(io); | 12410 | defer ges.mutate.map.mutex.unlock(io); |
| ... | @@ -12419,7 +12419,7 @@ const GlobalErrorSet = struct { | ... | @@ -12419,7 +12419,7 @@ const GlobalErrorSet = struct { |
| 12419 | const index = entry.value; | 12419 | const index = entry.value; |
| 12420 | if (index == .none) break; | 12420 | if (index == .none) break; |
| 12421 | if (entry.hash != hash) continue; | 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 | const mutable_names: Names.Mutable = .{ | 12424 | const mutable_names: Names.Mutable = .{ |
| 12425 | .gpa = gpa, | 12425 | .gpa = gpa, |
| ... | @@ -12432,7 +12432,7 @@ const GlobalErrorSet = struct { | ... | @@ -12432,7 +12432,7 @@ const GlobalErrorSet = struct { |
| 12432 | const map_header = map.header().*; | 12432 | const map_header = map.header().*; |
| 12433 | if (ges.mutate.names.len < map_header.capacity * 3 / 5) { | 12433 | if (ges.mutate.names.len < map_header.capacity * 3 / 5) { |
| 12434 | mutable_names.appendAssumeCapacity(.{name}); | 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 | const entry = &map.entries[map_index]; | 12436 | const entry = &map.entries[map_index]; |
| 12437 | entry.hash = hash; | 12437 | entry.hash = hash; |
| 12438 | entry.release(index); | 12438 | entry.release(index); |
| ... | @@ -12475,7 +12475,7 @@ const GlobalErrorSet = struct { | ... | @@ -12475,7 +12475,7 @@ const GlobalErrorSet = struct { |
| 12475 | if (map.entries[map_index].value == .none) break; | 12475 | if (map.entries[map_index].value == .none) break; |
| 12476 | } | 12476 | } |
| 12477 | mutable_names.appendAssumeCapacity(.{name}); | 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 | map.entries[map_index] = .{ .value = index, .hash = hash }; | 12479 | map.entries[map_index] = .{ .value = index, .hash = hash }; |
| 12480 | ges.shared.map.release(new_map); | 12480 | ges.shared.map.release(new_map); |
| 12481 | return index; | 12481 | return index; |
| ... | @@ -12486,7 +12486,7 @@ const GlobalErrorSet = struct { | ... | @@ -12486,7 +12486,7 @@ const GlobalErrorSet = struct { |
| 12486 | name: NullTerminatedString, | 12486 | name: NullTerminatedString, |
| 12487 | ) ?GlobalErrorSet.Index { | 12487 | ) ?GlobalErrorSet.Index { |
| 12488 | if (name == .empty) return .none; | 12488 | if (name == .empty) return .none; |
| 12489 | const hash = std.hash.int(@intFromEnum(name)); | 12489 | const hash = std.hash.int(@backingInt(name)); |
| 12490 | const map = ges.shared.map.acquire(); | 12490 | const map = ges.shared.map.acquire(); |
| 12491 | const map_mask = map.header().mask(); | 12491 | const map_mask = map.header().mask(); |
| 12492 | const names_items = ges.shared.names.acquire().view().items(.@"0"); | 12492 | const names_items = ges.shared.names.acquire().view().items(.@"0"); |
| ... | @@ -12497,7 +12497,7 @@ const GlobalErrorSet = struct { | ... | @@ -12497,7 +12497,7 @@ const GlobalErrorSet = struct { |
| 12497 | const index = entry.acquire(); | 12497 | const index = entry.acquire(); |
| 12498 | if (index == .none) return null; | 12498 | if (index == .none) return null; |
| 12499 | if (entry.hash != hash) continue; | 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,11 +12509,11 @@ pub fn getErrorValue( |
| 12509 | tid: Zcu.PerThread.Id, | 12509 | tid: Zcu.PerThread.Id, |
| 12510 | name: NullTerminatedString, | 12510 | name: NullTerminatedString, |
| 12511 | ) Allocator.Error!Zcu.ErrorInt { | 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 | pub fn getErrorValueIfExists(ip: *const InternPool, name: NullTerminatedString) ?Zcu.ErrorInt { | 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 | const PackedCallingConvention = packed struct(u18) { | 12519 | const PackedCallingConvention = packed struct(u18) { |
| ... | @@ -12544,32 +12544,32 @@ const PackedCallingConvention = packed struct(u18) { | ... | @@ -12544,32 +12544,32 @@ const PackedCallingConvention = packed struct(u18) { |
| 12544 | std.lang.CallingConvention.ArcInterruptOptions => .{ | 12544 | std.lang.CallingConvention.ArcInterruptOptions => .{ |
| 12545 | .tag = tag, | 12545 | .tag = tag, |
| 12546 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), | 12546 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12547 | .extra = @intFromEnum(pl.type), | 12547 | .extra = @backingInt(pl.type), |
| 12548 | }, | 12548 | }, |
| 12549 | std.lang.CallingConvention.ArmInterruptOptions => .{ | 12549 | std.lang.CallingConvention.ArmInterruptOptions => .{ |
| 12550 | .tag = tag, | 12550 | .tag = tag, |
| 12551 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), | 12551 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12552 | .extra = @intFromEnum(pl.type), | 12552 | .extra = @backingInt(pl.type), |
| 12553 | }, | 12553 | }, |
| 12554 | std.lang.CallingConvention.MicroblazeInterruptOptions => .{ | 12554 | std.lang.CallingConvention.MicroblazeInterruptOptions => .{ |
| 12555 | .tag = tag, | 12555 | .tag = tag, |
| 12556 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), | 12556 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12557 | .extra = @intFromEnum(pl.type), | 12557 | .extra = @backingInt(pl.type), |
| 12558 | }, | 12558 | }, |
| 12559 | std.lang.CallingConvention.MipsInterruptOptions => .{ | 12559 | std.lang.CallingConvention.MipsInterruptOptions => .{ |
| 12560 | .tag = tag, | 12560 | .tag = tag, |
| 12561 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), | 12561 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12562 | .extra = @intFromEnum(pl.mode), | 12562 | .extra = @backingInt(pl.mode), |
| 12563 | }, | 12563 | }, |
| 12564 | std.lang.CallingConvention.RiscvInterruptOptions => .{ | 12564 | std.lang.CallingConvention.RiscvInterruptOptions => .{ |
| 12565 | .tag = tag, | 12565 | .tag = tag, |
| 12566 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), | 12566 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12567 | .extra = @intFromEnum(pl.mode), | 12567 | .extra = @backingInt(pl.mode), |
| 12568 | }, | 12568 | }, |
| 12569 | std.lang.CallingConvention.ShInterruptOptions => .{ | 12569 | std.lang.CallingConvention.ShInterruptOptions => .{ |
| 12570 | .tag = tag, | 12570 | .tag = tag, |
| 12571 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), | 12571 | .incoming_stack_alignment = .fromByteUnits(pl.incoming_stack_alignment orelse 0), |
| 12572 | .extra = @intFromEnum(pl.save), | 12572 | .extra = @backingInt(pl.save), |
| 12573 | }, | 12573 | }, |
| 12574 | std.lang.CallingConvention.SpirvKernelOptions => .{ | 12574 | std.lang.CallingConvention.SpirvKernelOptions => .{ |
| 12575 | .tag = tag, | 12575 | .tag = tag, |
| ... | @@ -12579,12 +12579,12 @@ const PackedCallingConvention = packed struct(u18) { | ... | @@ -12579,12 +12579,12 @@ const PackedCallingConvention = packed struct(u18) { |
| 12579 | std.lang.CallingConvention.SpirvFragmentOptions => .{ | 12579 | std.lang.CallingConvention.SpirvFragmentOptions => .{ |
| 12580 | .tag = tag, | 12580 | .tag = tag, |
| 12581 | .incoming_stack_alignment = .none, | 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 | std.lang.CallingConvention.SpirvMeshOptions => .{ | 12584 | std.lang.CallingConvention.SpirvMeshOptions => .{ |
| 12585 | .tag = tag, | 12585 | .tag = tag, |
| 12586 | .incoming_stack_alignment = .none, | 12586 | .incoming_stack_alignment = .none, |
| 12587 | .extra = @intFromEnum(pl.stage_output), | 12587 | .extra = @backingInt(pl.stage_output), |
| 12588 | }, | 12588 | }, |
| 12589 | else => comptime unreachable, | 12589 | else => comptime unreachable, |
| 12590 | }, | 12590 | }, |
| ... | @@ -12615,27 +12615,27 @@ const PackedCallingConvention = packed struct(u18) { | ... | @@ -12615,27 +12615,27 @@ const PackedCallingConvention = packed struct(u18) { |
| 12615 | }, | 12615 | }, |
| 12616 | std.lang.CallingConvention.ArcInterruptOptions => .{ | 12616 | std.lang.CallingConvention.ArcInterruptOptions => .{ |
| 12617 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), | 12617 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12618 | .type = @enumFromInt(cc.extra), | 12618 | .type = @fromBackingInt(@intCast(cc.extra)), |
| 12619 | }, | 12619 | }, |
| 12620 | std.lang.CallingConvention.ArmInterruptOptions => .{ | 12620 | std.lang.CallingConvention.ArmInterruptOptions => .{ |
| 12621 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), | 12621 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12622 | .type = @enumFromInt(cc.extra), | 12622 | .type = @fromBackingInt(@intCast(cc.extra)), |
| 12623 | }, | 12623 | }, |
| 12624 | std.lang.CallingConvention.MicroblazeInterruptOptions => .{ | 12624 | std.lang.CallingConvention.MicroblazeInterruptOptions => .{ |
| 12625 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), | 12625 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12626 | .type = @enumFromInt(cc.extra), | 12626 | .type = @fromBackingInt(@intCast(cc.extra)), |
| 12627 | }, | 12627 | }, |
| 12628 | std.lang.CallingConvention.MipsInterruptOptions => .{ | 12628 | std.lang.CallingConvention.MipsInterruptOptions => .{ |
| 12629 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), | 12629 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12630 | .mode = @enumFromInt(cc.extra), | 12630 | .mode = @fromBackingInt(@intCast(cc.extra)), |
| 12631 | }, | 12631 | }, |
| 12632 | std.lang.CallingConvention.RiscvInterruptOptions => .{ | 12632 | std.lang.CallingConvention.RiscvInterruptOptions => .{ |
| 12633 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), | 12633 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12634 | .mode = @enumFromInt(cc.extra), | 12634 | .mode = @fromBackingInt(@intCast(cc.extra)), |
| 12635 | }, | 12635 | }, |
| 12636 | std.lang.CallingConvention.ShInterruptOptions => .{ | 12636 | std.lang.CallingConvention.ShInterruptOptions => .{ |
| 12637 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), | 12637 | .incoming_stack_alignment = cc.incoming_stack_alignment.toByteUnits(), |
| 12638 | .save = @enumFromInt(cc.extra), | 12638 | .save = @fromBackingInt(@intCast(cc.extra)), |
| 12639 | }, | 12639 | }, |
| 12640 | std.lang.CallingConvention.SpirvKernelOptions => .{ | 12640 | std.lang.CallingConvention.SpirvKernelOptions => .{ |
| 12641 | .x = trailing[0], | 12641 | .x = trailing[0], |
| ... | @@ -12644,10 +12644,10 @@ const PackedCallingConvention = packed struct(u18) { | ... | @@ -12644,10 +12644,10 @@ const PackedCallingConvention = packed struct(u18) { |
| 12644 | }, | 12644 | }, |
| 12645 | std.lang.CallingConvention.SpirvFragmentOptions => .{ | 12645 | std.lang.CallingConvention.SpirvFragmentOptions => .{ |
| 12646 | .pixel_centered_integer = @bitCast(@as(u1, @truncate(cc.extra))), | 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 | std.lang.CallingConvention.SpirvMeshOptions => .{ | 12649 | std.lang.CallingConvention.SpirvMeshOptions => .{ |
| 12650 | .stage_output = @enumFromInt(cc.extra), | 12650 | .stage_output = @fromBackingInt(@intCast(cc.extra)), |
| 12651 | .max_primitives = trailing[0], | 12651 | .max_primitives = trailing[0], |
| 12652 | .max_vertices = trailing[1], | 12652 | .max_vertices = trailing[1], |
| 12653 | }, | 12653 | }, |
| ... | @@ -12713,7 +12713,7 @@ pub fn resolveUnionLayout( | ... | @@ -12713,7 +12713,7 @@ pub fn resolveUnionLayout( |
| 12713 | const item = unwrapped_index.getItem(ip); | 12713 | const item = unwrapped_index.getItem(ip); |
| 12714 | assert(item.tag == .type_union); | 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 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnion, "size").?] = size; | 12717 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnion, "size").?] = size; |
| 12718 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnion, "padding").?] = padding; | 12718 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnion, "padding").?] = padding; |
| 12719 | const flags: *Tag.TypeUnion.Flags = @ptrCast(&extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnion, "flags").?]); | 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,7 +12746,7 @@ pub fn resolvePackedStructLayout( |
| 12746 | else => unreachable, | 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 | /// Asserts that `union_type` is a packed union type. | 12752 | /// Asserts that `union_type` is a packed union type. |
| ... | @@ -12772,8 +12772,8 @@ pub fn resolvePackedUnionLayout( | ... | @@ -12772,8 +12772,8 @@ pub fn resolvePackedUnionLayout( |
| 12772 | else => unreachable, | 12772 | else => unreachable, |
| 12773 | } | 12773 | } |
| 12774 | 12774 | ||
| 12775 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnionPacked, "enum_tag_type").?] = @intFromEnum(enum_tag_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").?] = @intFromEnum(backing_int_type); | 12776 | extra_items[item.data + std.meta.fieldIndex(Tag.TypeUnionPacked, "backing_int_type").?] = @backingInt(backing_int_type); |
| 12777 | } | 12777 | } |
| 12778 | 12778 | ||
| 12779 | /// Asserts that `enum_type` is an enum type. | 12779 | /// Asserts that `enum_type` is an enum type. |
| ... | @@ -12799,7 +12799,7 @@ pub fn resolveEnumLayout( | ... | @@ -12799,7 +12799,7 @@ pub fn resolveEnumLayout( |
| 12799 | else => unreachable, | 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 | /// Sets the "want_layout" flag on the given struct, union, or enum type. Returns true if the flag | 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,11 +353,11 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Module { |
| 353 | // See https://github.com/ziglang/zig/issues/23539 | 353 | // See https://github.com/ziglang/zig/issues/23539 |
| 354 | if (target_util.isDynamicAMDGCNFeature(target, feature)) continue; | 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; | 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, @enumFromInt(feature.index)) == .x32) continue; | 357 | if (target.cpu.arch.isX86() and @as(std.Target.x86.Feature, @fromBackingInt(@intCast(feature.index))) == .x32) continue; |
| 358 | 358 | ||
| 359 | var is_enabled = target.cpu.features.isEnabled(feature.index); | 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 | is_enabled = !omit_frame_pointer; | 361 | is_enabled = !omit_frame_pointer; |
| 362 | } | 362 | } |
| 363 | 363 |
src/Sema.zig+433-433| ... | @@ -142,7 +142,7 @@ const RuntimeIndex = enum(u32) { | ... | @@ -142,7 +142,7 @@ const RuntimeIndex = enum(u32) { |
| 142 | _, | 142 | _, |
| 143 | 143 | ||
| 144 | pub fn increment(ri: *RuntimeIndex) void { | 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,11 +191,11 @@ fn newComptimeAlloc(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type, align |
| 191 | .alignment = alignment, | 191 | .alignment = alignment, |
| 192 | .runtime_index = block.runtime_index, | 192 | .runtime_index = block.runtime_index, |
| 193 | }); | 193 | }); |
| 194 | return @enumFromInt(idx); | 194 | return @fromBackingInt(@intCast(idx)); |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | pub fn getComptimeAlloc(sema: *Sema, idx: ComptimeAllocIndex) *ComptimeAlloc { | 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 | pub const default_branch_quota = 1000; | 201 | pub const default_branch_quota = 1000; |
| ... | @@ -253,7 +253,7 @@ pub const InferredErrorSet = struct { | ... | @@ -253,7 +253,7 @@ pub const InferredErrorSet = struct { |
| 253 | /// be called safely for any of the instructions passed in. | 253 | /// be called safely for any of the instructions passed in. |
| 254 | pub const InstMap = struct { | 254 | pub const InstMap = struct { |
| 255 | items: []Air.Inst.Ref = &[_]Air.Inst.Ref{}, | 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 | pub fn deinit(map: InstMap, allocator: mem.Allocator) void { | 258 | pub fn deinit(map: InstMap, allocator: mem.Allocator) void { |
| 259 | allocator.free(map.items); | 259 | allocator.free(map.items); |
| ... | @@ -261,7 +261,7 @@ pub const InstMap = struct { | ... | @@ -261,7 +261,7 @@ pub const InstMap = struct { |
| 261 | 261 | ||
| 262 | pub fn get(map: InstMap, key: Zir.Inst.Index) ?Air.Inst.Ref { | 262 | pub fn get(map: InstMap, key: Zir.Inst.Index) ?Air.Inst.Ref { |
| 263 | if (!map.contains(key)) return null; | 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 | pub fn putAssumeCapacity( | 267 | pub fn putAssumeCapacity( |
| ... | @@ -269,7 +269,7 @@ pub const InstMap = struct { | ... | @@ -269,7 +269,7 @@ pub const InstMap = struct { |
| 269 | key: Zir.Inst.Index, | 269 | key: Zir.Inst.Index, |
| 270 | ref: Air.Inst.Ref, | 270 | ref: Air.Inst.Ref, |
| 271 | ) void { | 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 | pub fn putAssumeCapacityNoClobber( | 275 | pub fn putAssumeCapacityNoClobber( |
| ... | @@ -290,7 +290,7 @@ pub const InstMap = struct { | ... | @@ -290,7 +290,7 @@ pub const InstMap = struct { |
| 290 | map: *InstMap, | 290 | map: *InstMap, |
| 291 | key: Zir.Inst.Index, | 291 | key: Zir.Inst.Index, |
| 292 | ) GetOrPutResult { | 292 | ) GetOrPutResult { |
| 293 | const index = @intFromEnum(key) - @intFromEnum(map.start); | 293 | const index = @backingInt(key) - @backingInt(map.start); |
| 294 | return GetOrPutResult{ | 294 | return GetOrPutResult{ |
| 295 | .value_ptr = &map.items[index], | 295 | .value_ptr = &map.items[index], |
| 296 | .found_existing = map.items[index] != .none, | 296 | .found_existing = map.items[index] != .none, |
| ... | @@ -299,12 +299,12 @@ pub const InstMap = struct { | ... | @@ -299,12 +299,12 @@ pub const InstMap = struct { |
| 299 | 299 | ||
| 300 | pub fn remove(map: InstMap, key: Zir.Inst.Index) bool { | 300 | pub fn remove(map: InstMap, key: Zir.Inst.Index) bool { |
| 301 | if (!map.contains(key)) return false; | 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 | return true; | 303 | return true; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | pub fn contains(map: InstMap, key: Zir.Inst.Index) bool { | 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 | pub fn ensureSpaceForInstructions( | 310 | pub fn ensureSpaceForInstructions( |
| ... | @@ -313,7 +313,7 @@ pub const InstMap = struct { | ... | @@ -313,7 +313,7 @@ pub const InstMap = struct { |
| 313 | insts: []const Zir.Inst.Index, | 313 | insts: []const Zir.Inst.Index, |
| 314 | ) !void { | 314 | ) !void { |
| 315 | const start, const end = mem.minMax(u32, @ptrCast(insts)); | 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 | if (map_start <= start and end < map.items.len + map_start) | 317 | if (map_start <= start and end < map.items.len + map_start) |
| 318 | return; | 318 | return; |
| 319 | 319 | ||
| ... | @@ -336,7 +336,7 @@ pub const InstMap = struct { | ... | @@ -336,7 +336,7 @@ pub const InstMap = struct { |
| 336 | 336 | ||
| 337 | allocator.free(map.items); | 337 | allocator.free(map.items); |
| 338 | map.items = new_items; | 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,7 +814,7 @@ pub const Block = struct { |
| 814 | try sema.air_instructions.ensureUnusedCapacity(gpa, 1); | 814 | try sema.air_instructions.ensureUnusedCapacity(gpa, 1); |
| 815 | try block.instructions.ensureUnusedCapacity(gpa, 1); | 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 | sema.air_instructions.appendAssumeCapacity(inst); | 818 | sema.air_instructions.appendAssumeCapacity(inst); |
| 819 | block.instructions.appendAssumeCapacity(result_index); | 819 | block.instructions.appendAssumeCapacity(result_index); |
| 820 | return result_index; | 820 | return result_index; |
| ... | @@ -832,10 +832,10 @@ pub const Block = struct { | ... | @@ -832,10 +832,10 @@ pub const Block = struct { |
| 832 | 832 | ||
| 833 | try sema.air_instructions.ensureUnusedCapacity(gpa, 1); | 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 | sema.air_instructions.appendAssumeCapacity(inst); | 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 | return result_index; | 839 | return result_index; |
| 840 | } | 840 | } |
| 841 | 841 | ||
| ... | @@ -1020,7 +1020,7 @@ fn analyzeBodyRuntimeBreak(sema: *Sema, block: *Block, body: []const Zir.Inst.In | ... | @@ -1020,7 +1020,7 @@ fn analyzeBodyRuntimeBreak(sema: *Sema, block: *Block, body: []const Zir.Inst.In |
| 1020 | sema.analyzeBodyInner(block, body) catch |err| switch (err) { | 1020 | sema.analyzeBodyInner(block, body) catch |err| switch (err) { |
| 1021 | error.ComptimeBreak => { | 1021 | error.ComptimeBreak => { |
| 1022 | const zir_datas = sema.code.instructions.items(.data); | 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 | const extra = sema.code.extraData(Zir.Inst.Break, break_data.payload_index).data; | 1024 | const extra = sema.code.extraData(Zir.Inst.Break, break_data.payload_index).data; |
| 1025 | try sema.addRuntimeBreak(block, extra.block_inst, break_data.operand); | 1025 | try sema.addRuntimeBreak(block, extra.block_inst, break_data.operand); |
| 1026 | }, | 1026 | }, |
| ... | @@ -1061,7 +1061,7 @@ fn analyzeInlineBody( | ... | @@ -1061,7 +1061,7 @@ fn analyzeInlineBody( |
| 1061 | error.ComptimeBreak => {}, | 1061 | error.ComptimeBreak => {}, |
| 1062 | else => |e| return e, | 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 | switch (break_inst.tag) { | 1065 | switch (break_inst.tag) { |
| 1066 | .switch_continue => { | 1066 | .switch_continue => { |
| 1067 | // This is handled by separate logic. | 1067 | // This is handled by separate logic. |
| ... | @@ -1145,7 +1145,7 @@ fn analyzeBodyInner( | ... | @@ -1145,7 +1145,7 @@ fn analyzeBodyInner( |
| 1145 | }, inst }); | 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 | // zig fmt: off | 1149 | // zig fmt: off |
| 1150 | .alloc => try sema.zirAlloc(block, inst), | 1150 | .alloc => try sema.zirAlloc(block, inst), |
| 1151 | .alloc_inferred => try sema.zirAllocInferred(block, true), | 1151 | .alloc_inferred => try sema.zirAllocInferred(block, true), |
| ... | @@ -1373,7 +1373,7 @@ fn analyzeBodyInner( | ... | @@ -1373,7 +1373,7 @@ fn analyzeBodyInner( |
| 1373 | .declaration => unreachable, | 1373 | .declaration => unreachable, |
| 1374 | 1374 | ||
| 1375 | .extended => ext: { | 1375 | .extended => ext: { |
| 1376 | const extended = datas[@intFromEnum(inst)].extended; | 1376 | const extended = datas[@backingInt(inst)].extended; |
| 1377 | break :ext switch (extended.opcode) { | 1377 | break :ext switch (extended.opcode) { |
| 1378 | // zig fmt: off | 1378 | // zig fmt: off |
| 1379 | .struct_decl => try sema.zirStructDecl( block, inst), | 1379 | .struct_decl => try sema.zirStructDecl( block, inst), |
| ... | @@ -1624,7 +1624,7 @@ fn analyzeBodyInner( | ... | @@ -1624,7 +1624,7 @@ fn analyzeBodyInner( |
| 1624 | }, | 1624 | }, |
| 1625 | .check_comptime_control_flow => { | 1625 | .check_comptime_control_flow => { |
| 1626 | if (!block.isComptime()) { | 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 | const src = block.nodeOffset(inst_data.src_node); | 1628 | const src = block.nodeOffset(inst_data.src_node); |
| 1629 | const inline_block = inst_data.operand.toIndex().?; | 1629 | const inline_block = inst_data.operand.toIndex().?; |
| 1630 | 1630 | ||
| ... | @@ -1636,7 +1636,7 @@ fn analyzeBodyInner( | ... | @@ -1636,7 +1636,7 @@ fn analyzeBodyInner( |
| 1636 | check_block = check_block.parent.?; | 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 | const runtime_src = block.runtime_cond orelse block.runtime_loop.?; | 1640 | const runtime_src = block.runtime_cond orelse block.runtime_loop.?; |
| 1641 | const msg = msg: { | 1641 | const msg = msg: { |
| 1642 | const msg = try sema.errMsg(src, "comptime control flow inside runtime block", .{}); | 1642 | const msg = try sema.errMsg(src, "comptime control flow inside runtime block", .{}); |
| ... | @@ -1656,13 +1656,13 @@ fn analyzeBodyInner( | ... | @@ -1656,13 +1656,13 @@ fn analyzeBodyInner( |
| 1656 | continue; | 1656 | continue; |
| 1657 | }, | 1657 | }, |
| 1658 | .restore_err_ret_index_unconditional => { | 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 | try sema.restoreErrRetIndex(block, block.nodeOffset(un_node.src_node), un_node.operand, .none); | 1660 | try sema.restoreErrRetIndex(block, block.nodeOffset(un_node.src_node), un_node.operand, .none); |
| 1661 | i += 1; | 1661 | i += 1; |
| 1662 | continue; | 1662 | continue; |
| 1663 | }, | 1663 | }, |
| 1664 | .restore_err_ret_index_fn_entry => { | 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 | try sema.restoreErrRetIndex(block, block.nodeOffset(un_node.src_node), .none, un_node.operand); | 1666 | try sema.restoreErrRetIndex(block, block.nodeOffset(un_node.src_node), .none, un_node.operand); |
| 1667 | i += 1; | 1667 | i += 1; |
| 1668 | continue; | 1668 | continue; |
| ... | @@ -1685,7 +1685,7 @@ fn analyzeBodyInner( | ... | @@ -1685,7 +1685,7 @@ fn analyzeBodyInner( |
| 1685 | .repeat => { | 1685 | .repeat => { |
| 1686 | if (block.isComptime()) { | 1686 | if (block.isComptime()) { |
| 1687 | // Send comptime control flow back to the beginning of this block. | 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 | try sema.emitBackwardBranch(block, src); | 1689 | try sema.emitBackwardBranch(block, src); |
| 1690 | i = 0; | 1690 | i = 0; |
| 1691 | continue; | 1691 | continue; |
| ... | @@ -1700,7 +1700,7 @@ fn analyzeBodyInner( | ... | @@ -1700,7 +1700,7 @@ fn analyzeBodyInner( |
| 1700 | }, | 1700 | }, |
| 1701 | .repeat_inline => { | 1701 | .repeat_inline => { |
| 1702 | // Send comptime control flow back to the beginning of this block. | 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 | try sema.emitBackwardBranch(block, src); | 1704 | try sema.emitBackwardBranch(block, src); |
| 1705 | i = 0; | 1705 | i = 0; |
| 1706 | continue; | 1706 | continue; |
| ... | @@ -1722,7 +1722,7 @@ fn analyzeBodyInner( | ... | @@ -1722,7 +1722,7 @@ fn analyzeBodyInner( |
| 1722 | } else try sema.zirBlock(block, inst), | 1722 | } else try sema.zirBlock(block, inst), |
| 1723 | 1723 | ||
| 1724 | .block_comptime => { | 1724 | .block_comptime => { |
| 1725 | const pl_node = datas[@intFromEnum(inst)].pl_node; | 1725 | const pl_node = datas[@backingInt(inst)].pl_node; |
| 1726 | const src = block.nodeOffset(pl_node.src_node); | 1726 | const src = block.nodeOffset(pl_node.src_node); |
| 1727 | const extra = sema.code.extraData(Zir.Inst.BlockComptime, pl_node.payload_index); | 1727 | const extra = sema.code.extraData(Zir.Inst.BlockComptime, pl_node.payload_index); |
| 1728 | const block_body = sema.code.bodySlice(extra.end, extra.data.body_len); | 1728 | const block_body = sema.code.bodySlice(extra.end, extra.data.body_len); |
| ... | @@ -1760,7 +1760,7 @@ fn analyzeBodyInner( | ... | @@ -1760,7 +1760,7 @@ fn analyzeBodyInner( |
| 1760 | // through a runtime conditional branch, we must retroactively emit | 1760 | // through a runtime conditional branch, we must retroactively emit |
| 1761 | // a block, so we remember the block index here just in case. | 1761 | // a block, so we remember the block index here just in case. |
| 1762 | const block_index = block.instructions.items.len; | 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 | const extra = sema.code.extraData(Zir.Inst.Block, inst_data.payload_index); | 1764 | const extra = sema.code.extraData(Zir.Inst.Block, inst_data.payload_index); |
| 1765 | const inline_body = sema.code.bodySlice(extra.end, extra.data.body_len); | 1765 | const inline_body = sema.code.bodySlice(extra.end, extra.data.body_len); |
| 1766 | const gpa = sema.gpa; | 1766 | const gpa = sema.gpa; |
| ... | @@ -1780,7 +1780,7 @@ fn analyzeBodyInner( | ... | @@ -1780,7 +1780,7 @@ fn analyzeBodyInner( |
| 1780 | // If this block contains a function prototype, we need to reset the | 1780 | // If this block contains a function prototype, we need to reset the |
| 1781 | // current list of parameters and restore it later. | 1781 | // current list of parameters and restore it later. |
| 1782 | // Note: this probably needs to be resolved in a more general manner. | 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 | child_block.inline_block = (if (tags[tag_index] == .repeat_inline) | 1784 | child_block.inline_block = (if (tags[tag_index] == .repeat_inline) |
| 1785 | inline_body[0] | 1785 | inline_body[0] |
| 1786 | else | 1786 | else |
| ... | @@ -1801,7 +1801,7 @@ fn analyzeBodyInner( | ... | @@ -1801,7 +1801,7 @@ fn analyzeBodyInner( |
| 1801 | } else |err| switch (err) { | 1801 | } else |err| switch (err) { |
| 1802 | error.ComptimeBreak => brk_res: { | 1802 | error.ComptimeBreak => brk_res: { |
| 1803 | const break_inst = sema.comptime_break_inst; | 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 | const break_extra = sema.code.extraData(Zir.Inst.Break, break_data.payload_index).data; | 1805 | const break_extra = sema.code.extraData(Zir.Inst.Break, break_data.payload_index).data; |
| 1806 | break :brk_res .{ | 1806 | break :brk_res .{ |
| 1807 | .block_inst = break_extra.block_inst, | 1807 | .block_inst = break_extra.block_inst, |
| ... | @@ -1869,7 +1869,7 @@ fn analyzeBodyInner( | ... | @@ -1869,7 +1869,7 @@ fn analyzeBodyInner( |
| 1869 | break; | 1869 | break; |
| 1870 | }, | 1870 | }, |
| 1871 | .condbr_inline => { | 1871 | .condbr_inline => { |
| 1872 | const inst_data = datas[@intFromEnum(inst)].pl_node; | 1872 | const inst_data = datas[@backingInt(inst)].pl_node; |
| 1873 | const cond_src = block.src(.{ .node_offset_if_cond = inst_data.src_node }); | 1873 | const cond_src = block.src(.{ .node_offset_if_cond = inst_data.src_node }); |
| 1874 | const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); | 1874 | const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); |
| 1875 | const then_body = sema.code.bodySlice(extra.end, extra.data.then_body_len); | 1875 | const then_body = sema.code.bodySlice(extra.end, extra.data.then_body_len); |
| ... | @@ -1898,7 +1898,7 @@ fn analyzeBodyInner( | ... | @@ -1898,7 +1898,7 @@ fn analyzeBodyInner( |
| 1898 | }, | 1898 | }, |
| 1899 | .@"try" => blk: { | 1899 | .@"try" => blk: { |
| 1900 | if (!block.isComptime()) break :blk try sema.zirTry(block, inst); | 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 | const src = block.nodeOffset(inst_data.src_node); | 1902 | const src = block.nodeOffset(inst_data.src_node); |
| 1903 | const operand_src = block.src(.{ .node_offset_try_operand = inst_data.src_node }); | 1903 | const operand_src = block.src(.{ .node_offset_try_operand = inst_data.src_node }); |
| 1904 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); | 1904 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); |
| ... | @@ -1924,7 +1924,7 @@ fn analyzeBodyInner( | ... | @@ -1924,7 +1924,7 @@ fn analyzeBodyInner( |
| 1924 | }, | 1924 | }, |
| 1925 | .try_ptr => blk: { | 1925 | .try_ptr => blk: { |
| 1926 | if (!block.isComptime()) break :blk try sema.zirTryPtr(block, inst); | 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 | const src = block.nodeOffset(inst_data.src_node); | 1928 | const src = block.nodeOffset(inst_data.src_node); |
| 1929 | const operand_src = block.src(.{ .node_offset_try_operand = inst_data.src_node }); | 1929 | const operand_src = block.src(.{ .node_offset_try_operand = inst_data.src_node }); |
| 1930 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); | 1930 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); |
| ... | @@ -1940,7 +1940,7 @@ fn analyzeBodyInner( | ... | @@ -1940,7 +1940,7 @@ fn analyzeBodyInner( |
| 1940 | break :blk result; | 1940 | break :blk result; |
| 1941 | }, | 1941 | }, |
| 1942 | .@"defer" => blk: { | 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 | const defer_body = sema.code.bodySlice(inst_data.index, inst_data.len); | 1944 | const defer_body = sema.code.bodySlice(inst_data.index, inst_data.len); |
| 1945 | if (sema.analyzeBodyInner(block, defer_body)) { | 1945 | if (sema.analyzeBodyInner(block, defer_body)) { |
| 1946 | // The defer terminated noreturn - no more analysis needed. | 1946 | // The defer terminated noreturn - no more analysis needed. |
| ... | @@ -1956,7 +1956,7 @@ fn analyzeBodyInner( | ... | @@ -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 | .inferred_alloc, .inferred_alloc_comptime => true, | 1960 | .inferred_alloc, .inferred_alloc_comptime => true, |
| 1961 | else => false, | 1961 | else => false, |
| 1962 | } else false; | 1962 | } else false; |
| ... | @@ -1998,7 +1998,7 @@ fn resolveInst(sema: *Sema, zir_ref: Zir.Inst.Ref) Air.Inst.Ref { | ... | @@ -1998,7 +1998,7 @@ fn resolveInst(sema: *Sema, zir_ref: Zir.Inst.Ref) Air.Inst.Ref { |
| 1998 | } | 1998 | } |
| 1999 | // First section of indexes correspond to a set number of constant values. | 1999 | // First section of indexes correspond to a set number of constant values. |
| 2000 | // We intentionally map the same indexes to the same values between ZIR and AIR. | 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 | fn resolveConstBool( | 2004 | fn resolveConstBool( |
| ... | @@ -2130,29 +2130,29 @@ fn genericPoisonReason(sema: *Sema, block: *Block, ref: Zir.Inst.Ref) GenericPoi | ... | @@ -2130,29 +2130,29 @@ fn genericPoisonReason(sema: *Sema, block: *Block, ref: Zir.Inst.Ref) GenericPoi |
| 2130 | var cur = ref; | 2130 | var cur = ref; |
| 2131 | while (true) { | 2131 | while (true) { |
| 2132 | const inst = cur.toIndex() orelse return .unknown; | 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 | .validate_array_init_ref_ty => { | 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 | const extra = sema.code.extraData(Zir.Inst.ArrayInitRefTy, pl_node.payload_index).data; | 2136 | const extra = sema.code.extraData(Zir.Inst.ArrayInitRefTy, pl_node.payload_index).data; |
| 2137 | cur = extra.ptr_ty; | 2137 | cur = extra.ptr_ty; |
| 2138 | }, | 2138 | }, |
| 2139 | .array_init_elem_type => { | 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 | cur = bin.lhs; | 2141 | cur = bin.lhs; |
| 2142 | }, | 2142 | }, |
| 2143 | .indexable_ptr_elem_type, .splat_op_result_ty => { | 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 | cur = un_node.operand; | 2145 | cur = un_node.operand; |
| 2146 | }, | 2146 | }, |
| 2147 | .struct_init_field_type => { | 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 | const extra = sema.code.extraData(Zir.Inst.FieldType, pl_node.payload_index).data; | 2149 | const extra = sema.code.extraData(Zir.Inst.FieldType, pl_node.payload_index).data; |
| 2150 | cur = extra.container_type; | 2150 | cur = extra.container_type; |
| 2151 | }, | 2151 | }, |
| 2152 | .elem_type => { | 2152 | .elem_type => { |
| 2153 | // There are two cases here: the pointer type may already have been | 2153 | // There are two cases here: the pointer type may already have been |
| 2154 | // generic poison, or it may have been an anyopaque pointer. | 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 | const operand_ref = sema.resolveInst(un_node.operand); | 2156 | const operand_ref = sema.resolveInst(un_node.operand); |
| 2157 | const operand_val = operand_ref.toInterned() orelse return .unknown; | 2157 | const operand_val = operand_ref.toInterned() orelse return .unknown; |
| 2158 | if (operand_val == .generic_poison_type) { | 2158 | if (operand_val == .generic_poison_type) { |
| ... | @@ -2167,7 +2167,7 @@ fn genericPoisonReason(sema: *Sema, block: *Block, ref: Zir.Inst.Ref) GenericPoi | ... | @@ -2167,7 +2167,7 @@ fn genericPoisonReason(sema: *Sema, block: *Block, ref: Zir.Inst.Ref) GenericPoi |
| 2167 | // A function call can never return generic poison, so we must be | 2167 | // A function call can never return generic poison, so we must be |
| 2168 | // evaluating an `anytype` function parameter. | 2168 | // evaluating an `anytype` function parameter. |
| 2169 | // TODO: better source location - function decl rather than call | 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 | return .{ .anytype_param = block.nodeOffset(pl_node.src_node) }; | 2171 | return .{ .anytype_param = block.nodeOffset(pl_node.src_node) }; |
| 2172 | }, | 2172 | }, |
| 2173 | else => return .unknown, | 2173 | else => return .unknown, |
| ... | @@ -2242,7 +2242,7 @@ fn resolveValue(sema: *Sema, inst: Air.Inst.Ref) ?Value { | ... | @@ -2242,7 +2242,7 @@ fn resolveValue(sema: *Sema, inst: Air.Inst.Ref) ?Value { |
| 2242 | 2242 | ||
| 2243 | // Runtime-known value. We'll be returning `null`, but first, some assertions. | 2243 | // Runtime-known value. We'll be returning `null`, but first, some assertions. |
| 2244 | const air_tags = sema.air_instructions.items(.tag); | 2244 | const air_tags = sema.air_instructions.items(.tag); |
| 2245 | switch (air_tags[@intFromEnum(inst.toIndex().?)]) { | 2245 | switch (air_tags[@backingInt(inst.toIndex().?)]) { |
| 2246 | .inferred_alloc => unreachable, // assertion failure | 2246 | .inferred_alloc => unreachable, // assertion failure |
| 2247 | .inferred_alloc_comptime => unreachable, // assertion failure | 2247 | .inferred_alloc_comptime => unreachable, // assertion failure |
| 2248 | else => {}, | 2248 | else => {}, |
| ... | @@ -3043,7 +3043,7 @@ fn zirErrorSetDecl( | ... | @@ -3043,7 +3043,7 @@ fn zirErrorSetDecl( |
| 3043 | const gpa = comp.gpa; | 3043 | const gpa = comp.gpa; |
| 3044 | const io = comp.io; | 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 | const extra = sema.code.extraData(Zir.Inst.ErrorSetDecl, inst_data.payload_index); | 3047 | const extra = sema.code.extraData(Zir.Inst.ErrorSetDecl, inst_data.payload_index); |
| 3048 | 3048 | ||
| 3049 | var names: InferredErrorSet.NameMap = .{}; | 3049 | var names: InferredErrorSet.NameMap = .{}; |
| ... | @@ -3052,7 +3052,7 @@ fn zirErrorSetDecl( | ... | @@ -3052,7 +3052,7 @@ fn zirErrorSetDecl( |
| 3052 | var extra_index: u32 = @intCast(extra.end); | 3052 | var extra_index: u32 = @intCast(extra.end); |
| 3053 | const extra_index_end = extra_index + extra.data.fields_len; | 3053 | const extra_index_end = extra_index + extra.data.fields_len; |
| 3054 | while (extra_index < extra_index_end) : (extra_index += 1) { | 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 | const name = sema.code.nullTerminatedString(name_index); | 3056 | const name = sema.code.nullTerminatedString(name_index); |
| 3057 | const name_ip = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, name, .no_embedded_nulls); | 3057 | const name_ip = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, name, .no_embedded_nulls); |
| 3058 | _ = try pt.getErrorValue(name_ip); | 3058 | _ = try pt.getErrorValue(name_ip); |
| ... | @@ -3067,7 +3067,7 @@ fn zirRetPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. | ... | @@ -3067,7 +3067,7 @@ fn zirRetPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 3067 | const pt = sema.pt; | 3067 | const pt = sema.pt; |
| 3068 | const zcu = pt.zcu; | 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 | if (block.isComptime() or sema.fn_ret_ty.comptimeOnly(zcu)) { | 3072 | if (block.isComptime() or sema.fn_ret_ty.comptimeOnly(zcu)) { |
| 3073 | return sema.analyzeComptimeAlloc(block, src, sema.fn_ret_ty, .none); | 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,13 +3090,13 @@ fn zirRetPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 3090 | } | 3090 | } |
| 3091 | 3091 | ||
| 3092 | fn zirRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const operand = sema.resolveInst(inst_data.operand); | 3094 | const operand = sema.resolveInst(inst_data.operand); |
| 3095 | return sema.analyzeRef(block, block.tokenOffset(inst_data.src_tok), operand, .none); | 3095 | return sema.analyzeRef(block, block.tokenOffset(inst_data.src_tok), operand, .none); |
| 3096 | } | 3096 | } |
| 3097 | 3097 | ||
| 3098 | fn zirDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 3100 | const src = block.nodeOffset(inst_data.src_node); |
| 3101 | const ptr_src = block.src(.{ .node_offset_deref_ptr = inst_data.src_node }); | 3101 | const ptr_src = block.src(.{ .node_offset_deref_ptr = inst_data.src_node }); |
| 3102 | const operand = sema.resolveInst(inst_data.operand); | 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,7 +3109,7 @@ fn zirDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 3109 | fn zirRefDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 3109 | fn zirRefDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3110 | const pt = sema.pt; | 3110 | const pt = sema.pt; |
| 3111 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 3113 | const src = block.nodeOffset(inst_data.src_node); |
| 3114 | const operand = sema.resolveInst(inst_data.operand); | 3114 | const operand = sema.resolveInst(inst_data.operand); |
| 3115 | const operand_ty = sema.typeOf(operand); | 3115 | const operand_ty = sema.typeOf(operand); |
| ... | @@ -3169,7 +3169,7 @@ fn validateDeref( | ... | @@ -3169,7 +3169,7 @@ fn validateDeref( |
| 3169 | } | 3169 | } |
| 3170 | 3170 | ||
| 3171 | fn zirEnsureResultUsed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const operand = sema.resolveInst(inst_data.operand); | 3173 | const operand = sema.resolveInst(inst_data.operand); |
| 3174 | const src = block.nodeOffset(inst_data.src_node); | 3174 | const src = block.nodeOffset(inst_data.src_node); |
| 3175 | 3175 | ||
| ... | @@ -3212,7 +3212,7 @@ fn ensureResultUsed( | ... | @@ -3212,7 +3212,7 @@ fn ensureResultUsed( |
| 3212 | fn zirEnsureResultNonError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 3212 | fn zirEnsureResultNonError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 3213 | const pt = sema.pt; | 3213 | const pt = sema.pt; |
| 3214 | const zcu = pt.zcu; | 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 | const operand = sema.resolveInst(inst_data.operand); | 3216 | const operand = sema.resolveInst(inst_data.operand); |
| 3217 | const src = block.nodeOffset(inst_data.src_node); | 3217 | const src = block.nodeOffset(inst_data.src_node); |
| 3218 | const operand_ty = sema.typeOf(operand); | 3218 | const operand_ty = sema.typeOf(operand); |
| ... | @@ -3234,7 +3234,7 @@ fn zirEnsureResultNonError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com | ... | @@ -3234,7 +3234,7 @@ fn zirEnsureResultNonError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 3234 | fn zirEnsureErrUnionPayloadVoid(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 3234 | fn zirEnsureErrUnionPayloadVoid(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 3235 | const pt = sema.pt; | 3235 | const pt = sema.pt; |
| 3236 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 3238 | const src = block.nodeOffset(inst_data.src_node); |
| 3239 | const operand = sema.resolveInst(inst_data.operand); | 3239 | const operand = sema.resolveInst(inst_data.operand); |
| 3240 | const operand_ty = sema.typeOf(operand); | 3240 | const operand_ty = sema.typeOf(operand); |
| ... | @@ -3256,7 +3256,7 @@ fn zirEnsureErrUnionPayloadVoid(sema: *Sema, block: *Block, inst: Zir.Inst.Index | ... | @@ -3256,7 +3256,7 @@ fn zirEnsureErrUnionPayloadVoid(sema: *Sema, block: *Block, inst: Zir.Inst.Index |
| 3256 | } | 3256 | } |
| 3257 | 3257 | ||
| 3258 | fn zirIndexablePtrLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 3260 | const src = block.nodeOffset(inst_data.src_node); |
| 3261 | const object = sema.resolveInst(inst_data.operand); | 3261 | const object = sema.resolveInst(inst_data.operand); |
| 3262 | 3262 | ||
| ... | @@ -3320,13 +3320,13 @@ fn zirAllocExtended( | ... | @@ -3320,13 +3320,13 @@ fn zirAllocExtended( |
| 3320 | var extra_index: usize = extra.end; | 3320 | var extra_index: usize = extra.end; |
| 3321 | 3321 | ||
| 3322 | const var_ty: Type = if (small.has_type) blk: { | 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 | extra_index += 1; | 3324 | extra_index += 1; |
| 3325 | break :blk try sema.resolveType(block, ty_src, type_ref); | 3325 | break :blk try sema.resolveType(block, ty_src, type_ref); |
| 3326 | } else undefined; | 3326 | } else undefined; |
| 3327 | 3327 | ||
| 3328 | const alignment = if (small.has_align) blk: { | 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 | extra_index += 1; | 3330 | extra_index += 1; |
| 3331 | break :blk try sema.resolveAlign(block, align_src, align_ref); | 3331 | break :blk try sema.resolveAlign(block, align_src, align_ref); |
| 3332 | } else .none; | 3332 | } else .none; |
| ... | @@ -3361,7 +3361,7 @@ fn zirAllocExtended( | ... | @@ -3361,7 +3361,7 @@ fn zirAllocExtended( |
| 3361 | } | 3361 | } |
| 3362 | 3362 | ||
| 3363 | if (block.isComptime() or small.is_comptime) { | 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 | try sema.air_instructions.append(gpa, .{ | 3365 | try sema.air_instructions.append(gpa, .{ |
| 3366 | .tag = .inferred_alloc_comptime, | 3366 | .tag = .inferred_alloc_comptime, |
| 3367 | .data = .{ .inferred_alloc_comptime = .{ | 3367 | .data = .{ .inferred_alloc_comptime = .{ |
| ... | @@ -3389,7 +3389,7 @@ fn zirAllocExtended( | ... | @@ -3389,7 +3389,7 @@ fn zirAllocExtended( |
| 3389 | } | 3389 | } |
| 3390 | 3390 | ||
| 3391 | fn zirAllocComptime(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); | 3393 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); |
| 3394 | const var_src = block.nodeOffset(inst_data.src_node); | 3394 | const var_src = block.nodeOffset(inst_data.src_node); |
| 3395 | const var_ty = try sema.resolveType(block, ty_src, inst_data.operand); | 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,7 +3400,7 @@ fn zirAllocComptime(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 3400 | fn zirMakePtrConst(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 3400 | fn zirMakePtrConst(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3401 | const pt = sema.pt; | 3401 | const pt = sema.pt; |
| 3402 | const zcu = pt.zcu; | 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 | const alloc = sema.resolveInst(inst_data.operand); | 3404 | const alloc = sema.resolveInst(inst_data.operand); |
| 3405 | const alloc_ty = sema.typeOf(alloc); | 3405 | const alloc_ty = sema.typeOf(alloc); |
| 3406 | const ptr_info = alloc_ty.ptrInfo(zcu); | 3406 | const ptr_info = alloc_ty.ptrInfo(zcu); |
| ... | @@ -3502,7 +3502,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, | ... | @@ -3502,7 +3502,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3502 | 3502 | ||
| 3503 | simple: { | 3503 | simple: { |
| 3504 | if (stores.len != 1) break :simple; | 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 | switch (store_inst.tag) { | 3506 | switch (store_inst.tag) { |
| 3507 | .store, .store_safe => {}, | 3507 | .store, .store_safe => {}, |
| 3508 | .set_union_tag, .optional_payload_ptr_set, .errunion_payload_ptr_set => break :simple, // there's OPV stuff going on! | 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,7 +3536,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3536 | var to_map = try std.array_list.Managed(Air.Inst.Index).initCapacity(sema.arena, stores.len); | 3536 | var to_map = try std.array_list.Managed(Air.Inst.Index).initCapacity(sema.arena, stores.len); |
| 3537 | 3537 | ||
| 3538 | for (stores) |store_inst_idx| { | 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 | const ptr_to_map = switch (store_inst.tag) { | 3540 | const ptr_to_map = switch (store_inst.tag) { |
| 3541 | .store, .store_safe => store_inst.data.bin_op.lhs.toIndex().?, // Map the pointer being stored to. | 3541 | .store, .store_safe => store_inst.data.bin_op.lhs.toIndex().?, // Map the pointer being stored to. |
| 3542 | .set_union_tag => store_inst.data.bin_op.lhs.toIndex().?, // Map the union pointer. | 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,12 +3557,12 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3557 | field: u32, | 3557 | field: u32, |
| 3558 | elem: u64, | 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 | const air_parent_ptr: Air.Inst.Ref, const method: PointerMethod = switch (inst_tag) { | 3561 | const air_parent_ptr: Air.Inst.Ref, const method: PointerMethod = switch (inst_tag) { |
| 3562 | .struct_field_ptr => blk: { | 3562 | .struct_field_ptr => blk: { |
| 3563 | const data = tmp_air.extraData( | 3563 | const data = tmp_air.extraData( |
| 3564 | Air.StructField, | 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 | ).data; | 3566 | ).data; |
| 3567 | break :blk .{ | 3567 | break :blk .{ |
| 3568 | data.struct_operand, | 3568 | data.struct_operand, |
| ... | @@ -3574,7 +3574,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, | ... | @@ -3574,7 +3574,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3574 | .struct_field_ptr_index_2, | 3574 | .struct_field_ptr_index_2, |
| 3575 | .struct_field_ptr_index_3, | 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 | .{ .field = switch (inst_tag) { | 3578 | .{ .field = switch (inst_tag) { |
| 3579 | .struct_field_ptr_index_0 => 0, | 3579 | .struct_field_ptr_index_0 => 0, |
| 3580 | .struct_field_ptr_index_1 => 1, | 3580 | .struct_field_ptr_index_1 => 1, |
| ... | @@ -3584,17 +3584,17 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, | ... | @@ -3584,17 +3584,17 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3584 | } }, | 3584 | } }, |
| 3585 | }, | 3585 | }, |
| 3586 | .ptr_slice_ptr_ptr => .{ | 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 | .{ .field = Value.slice_ptr_index }, | 3588 | .{ .field = Value.slice_ptr_index }, |
| 3589 | }, | 3589 | }, |
| 3590 | .ptr_slice_len_ptr => .{ | 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 | .{ .field = Value.slice_len_index }, | 3592 | .{ .field = Value.slice_len_index }, |
| 3593 | }, | 3593 | }, |
| 3594 | .ptr_elem_ptr => blk: { | 3594 | .ptr_elem_ptr => blk: { |
| 3595 | const data = tmp_air.extraData( | 3595 | const data = tmp_air.extraData( |
| 3596 | Air.Bin, | 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 | ).data; | 3598 | ).data; |
| 3599 | const idx_val = sema.resolveValue(data.rhs).?; | 3599 | const idx_val = sema.resolveValue(data.rhs).?; |
| 3600 | break :blk .{ | 3600 | break :blk .{ |
| ... | @@ -3603,15 +3603,15 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, | ... | @@ -3603,15 +3603,15 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3603 | }; | 3603 | }; |
| 3604 | }, | 3604 | }, |
| 3605 | .ptr_cast => .{ | 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 | .same_addr, | 3607 | .same_addr, |
| 3608 | }, | 3608 | }, |
| 3609 | .optional_payload_ptr_set => .{ | 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 | .opt_payload, | 3611 | .opt_payload, |
| 3612 | }, | 3612 | }, |
| 3613 | .errunion_payload_ptr_set => .{ | 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 | .eu_payload, | 3615 | .eu_payload, |
| 3616 | }, | 3616 | }, |
| 3617 | else => unreachable, | 3617 | else => unreachable, |
| ... | @@ -3688,7 +3688,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, | ... | @@ -3688,7 +3688,7 @@ fn resolveComptimeKnownAllocPtr(sema: *Sema, block: *Block, alloc: Air.Inst.Ref, |
| 3688 | // instructions were already done above. | 3688 | // instructions were already done above. |
| 3689 | 3689 | ||
| 3690 | for (stores) |store_inst_idx| { | 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 | switch (store_inst.tag) { | 3692 | switch (store_inst.tag) { |
| 3693 | .optional_payload_ptr_set, .errunion_payload_ptr_set => {}, // Handled explicitly above | 3693 | .optional_payload_ptr_set, .errunion_payload_ptr_set => {}, // Handled explicitly above |
| 3694 | .set_union_tag => { | 3694 | .set_union_tag => { |
| ... | @@ -3750,9 +3750,9 @@ fn finishResolveComptimeKnownAllocPtr( | ... | @@ -3750,9 +3750,9 @@ fn finishResolveComptimeKnownAllocPtr( |
| 3750 | .operand = .zero_usize, | 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 | for (comptime_info.stores.items(.inst)) |store_inst| { | 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 | if (Value.fromInterned(result_val).canMutateComptimeVarState(zcu)) { | 3758 | if (Value.fromInterned(result_val).canMutateComptimeVarState(zcu)) { |
| ... | @@ -3812,14 +3812,14 @@ fn zirAllocInferredComptime( | ... | @@ -3812,14 +3812,14 @@ fn zirAllocInferredComptime( |
| 3812 | .ptr = undefined, | 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 | fn zirAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 3818 | fn zirAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 3819 | const pt = sema.pt; | 3819 | const pt = sema.pt; |
| 3820 | const zcu = pt.zcu; | 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 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); | 3823 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); |
| 3824 | const var_src = block.nodeOffset(inst_data.src_node); | 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,7 +3848,7 @@ fn zirAllocMut(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 3848 | const pt = sema.pt; | 3848 | const pt = sema.pt; |
| 3849 | const zcu = pt.zcu; | 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 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); | 3852 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); |
| 3853 | const var_src = block.nodeOffset(inst_data.src_node); | 3853 | const var_src = block.nodeOffset(inst_data.src_node); |
| 3854 | 3854 | ||
| ... | @@ -3886,7 +3886,7 @@ fn zirAllocInferred( | ... | @@ -3886,7 +3886,7 @@ fn zirAllocInferred( |
| 3886 | .ptr = undefined, | 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 | const result_index = try block.addInstAsIndex(.{ | 3892 | const result_index = try block.addInstAsIndex(.{ |
| ... | @@ -3908,24 +3908,24 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com | ... | @@ -3908,24 +3908,24 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 3908 | const pt = sema.pt; | 3908 | const pt = sema.pt; |
| 3909 | const zcu = pt.zcu; | 3909 | const zcu = pt.zcu; |
| 3910 | const gpa = sema.gpa; | 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 | const src = block.nodeOffset(inst_data.src_node); | 3912 | const src = block.nodeOffset(inst_data.src_node); |
| 3913 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); | 3913 | const ty_src = block.src(.{ .node_offset_var_decl_ty = inst_data.src_node }); |
| 3914 | const ptr = sema.resolveInst(inst_data.operand); | 3914 | const ptr = sema.resolveInst(inst_data.operand); |
| 3915 | const ptr_inst = ptr.toIndex().?; | 3915 | const ptr_inst = ptr.toIndex().?; |
| 3916 | const target = zcu.getTarget(); | 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 | .inferred_alloc_comptime => { | 3919 | .inferred_alloc_comptime => { |
| 3920 | // The work was already done for us by `Sema.storeToInferredAllocComptime`. Also, since | 3920 | // The work was already done for us by `Sema.storeToInferredAllocComptime`. Also, since |
| 3921 | // we had a value of the exact correct type to store, the result type's layout must be | 3921 | // we had a value of the exact correct type to store, the result type's layout must be |
| 3922 | // already resolved. So all we need to do here is return the pointer. | 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 | const resolved_ptr = iac.ptr; | 3924 | const resolved_ptr = iac.ptr; |
| 3925 | 3925 | ||
| 3926 | if (std.debug.runtime_safety) { | 3926 | if (std.debug.runtime_safety) { |
| 3927 | // The inferred_alloc_comptime should never be referenced again | 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 | const val = switch (zcu.intern_pool.indexToKey(resolved_ptr).ptr.base_addr) { | 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,12 +3948,12 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 3948 | return Air.internedToRef(resolved_ptr); | 3948 | return Air.internedToRef(resolved_ptr); |
| 3949 | }, | 3949 | }, |
| 3950 | .inferred_alloc => { | 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 | const ia2 = sema.unresolved_inferred_allocs.fetchSwapRemove(ptr_inst).?.value; | 3952 | const ia2 = sema.unresolved_inferred_allocs.fetchSwapRemove(ptr_inst).?.value; |
| 3953 | const peer_vals = try sema.arena.alloc(Air.Inst.Ref, ia2.prongs.items.len); | 3953 | const peer_vals = try sema.arena.alloc(Air.Inst.Ref, ia2.prongs.items.len); |
| 3954 | for (peer_vals, ia2.prongs.items) |*peer_val, store_inst| { | 3954 | for (peer_vals, ia2.prongs.items) |*peer_val, store_inst| { |
| 3955 | assert(sema.air_instructions.items(.tag)[@intFromEnum(store_inst)] == .store); | 3955 | assert(sema.air_instructions.items(.tag)[@backingInt(store_inst)] == .store); |
| 3956 | const bin_op = sema.air_instructions.items(.data)[@intFromEnum(store_inst)].bin_op; | 3956 | const bin_op = sema.air_instructions.items(.data)[@backingInt(store_inst)].bin_op; |
| 3957 | peer_val.* = bin_op.rhs; | 3957 | peer_val.* = bin_op.rhs; |
| 3958 | } | 3958 | } |
| 3959 | const final_elem_ty = try sema.resolvePeerTypes(block, ty_src, peer_vals, .none); | 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,7 +3988,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 3988 | return sema.fail(block, mut_src, "local variable in naked function", .{}); | 3988 | return sema.fail(block, mut_src, "local variable in naked function", .{}); |
| 3989 | } | 3989 | } |
| 3990 | // Change it to a normal alloc. | 3990 | // Change it to a normal alloc. |
| 3991 | sema.air_instructions.set(@intFromEnum(ptr_inst), .{ | 3991 | sema.air_instructions.set(@backingInt(ptr_inst), .{ |
| 3992 | .tag = .alloc, | 3992 | .tag = .alloc, |
| 3993 | .data = .{ .ty = final_ptr_ty }, | 3993 | .data = .{ .ty = final_ptr_ty }, |
| 3994 | }); | 3994 | }); |
| ... | @@ -4000,15 +4000,15 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com | ... | @@ -4000,15 +4000,15 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 4000 | var replacement_block = block.makeSubBlock(); | 4000 | var replacement_block = block.makeSubBlock(); |
| 4001 | defer replacement_block.instructions.deinit(gpa); | 4001 | defer replacement_block.instructions.deinit(gpa); |
| 4002 | 4002 | ||
| 4003 | assert(sema.air_instructions.items(.tag)[@intFromEnum(placeholder_inst)] == .store); | 4003 | assert(sema.air_instructions.items(.tag)[@backingInt(placeholder_inst)] == .store); |
| 4004 | const bin_op = sema.air_instructions.items(.data)[@intFromEnum(placeholder_inst)].bin_op; | 4004 | const bin_op = sema.air_instructions.items(.data)[@backingInt(placeholder_inst)].bin_op; |
| 4005 | try sema.storePtr2(&replacement_block, src, bin_op.lhs, src, bin_op.rhs, src, .store); | 4005 | try sema.storePtr2(&replacement_block, src, bin_op.lhs, src, bin_op.rhs, src, .store); |
| 4006 | 4006 | ||
| 4007 | // If only one instruction is produced then we can replace the store | 4007 | // If only one instruction is produced then we can replace the store |
| 4008 | // placeholder instruction with this instruction; no need for an entire block. | 4008 | // placeholder instruction with this instruction; no need for an entire block. |
| 4009 | if (replacement_block.instructions.items.len == 1) { | 4009 | if (replacement_block.instructions.items.len == 1) { |
| 4010 | const only_inst = replacement_block.instructions.items[0]; | 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 | continue; | 4012 | continue; |
| 4013 | } | 4013 | } |
| 4014 | 4014 | ||
| ... | @@ -4019,7 +4019,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com | ... | @@ -4019,7 +4019,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 4019 | gpa, | 4019 | gpa, |
| 4020 | @typeInfo(Air.Block).@"struct".field_names.len + replacement_block.instructions.items.len, | 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 | .tag = .block, | 4023 | .tag = .block, |
| 4024 | .data = .{ .ty_pl = .{ | 4024 | .data = .{ .ty_pl = .{ |
| 4025 | .ty = .void_type, | 4025 | .ty = .void_type, |
| ... | @@ -4049,7 +4049,7 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. | ... | @@ -4049,7 +4049,7 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 4049 | const io = comp.io; | 4049 | const io = comp.io; |
| 4050 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); | 4053 | const extra = sema.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 4054 | const all_args = sema.code.refSlice(extra.end, extra.data.operands_len); | 4054 | const all_args = sema.code.refSlice(extra.end, extra.data.operands_len); |
| 4055 | const arg_pairs: []const [2]Zir.Inst.Ref = @as([*]const [2]Zir.Inst.Ref, @ptrCast(all_args))[0..@divExact(all_args.len, 2)]; | 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,7 +4202,7 @@ fn optEuBasePtrInit(sema: *Sema, block: *Block, ptr: Air.Inst.Ref, src: LazySrcL |
| 4202 | } | 4202 | } |
| 4203 | 4203 | ||
| 4204 | fn zirOptEuBasePtrInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const ptr = sema.resolveInst(un_node.operand); | 4206 | const ptr = sema.resolveInst(un_node.operand); |
| 4207 | const src = block.nodeOffset(un_node.src_node); | 4207 | const src = block.nodeOffset(un_node.src_node); |
| 4208 | try sema.ensureLayoutResolved(sema.typeOf(ptr).childType(sema.pt.zcu), src, .init); | 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,7 +4212,7 @@ fn zirOptEuBasePtrInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compile |
| 4212 | fn zirCoercePtrElemTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4212 | fn zirCoercePtrElemTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4213 | const pt = sema.pt; | 4213 | const pt = sema.pt; |
| 4214 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(pl_node.src_node); | 4216 | const src = block.nodeOffset(pl_node.src_node); |
| 4217 | const extra = sema.code.extraData(Zir.Inst.Bin, pl_node.payload_index).data; | 4217 | const extra = sema.code.extraData(Zir.Inst.Bin, pl_node.payload_index).data; |
| 4218 | const uncoerced_val = sema.resolveInst(extra.rhs); | 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,7 +4265,7 @@ fn zirTryOperandTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is_ref: boo |
| 4265 | const gpa = comp.gpa; | 4265 | const gpa = comp.gpa; |
| 4266 | const io = comp.io; | 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 | const src = block.nodeOffset(un_node.src_node); | 4269 | const src = block.nodeOffset(un_node.src_node); |
| 4270 | 4270 | ||
| 4271 | const operand_ty = try sema.resolveTypeOrPoison(block, src, un_node.operand) orelse return .generic_poison_type; | 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,7 +4311,7 @@ fn zirTryOperandTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is_ref: boo |
| 4311 | fn zirValidateRefTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 4311 | fn zirValidateRefTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4312 | const pt = sema.pt; | 4312 | const pt = sema.pt; |
| 4313 | const zcu = pt.zcu; | 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 | const src = block.tokenOffset(un_tok.src_tok); | 4315 | const src = block.tokenOffset(un_tok.src_tok); |
| 4316 | // In case of GenericPoison, we don't actually have a type, so this will be | 4316 | // In case of GenericPoison, we don't actually have a type, so this will be |
| 4317 | // treated as an untyped address-of operator. | 4317 | // treated as an untyped address-of operator. |
| ... | @@ -4329,7 +4329,7 @@ fn zirValidateRefTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -4329,7 +4329,7 @@ fn zirValidateRefTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 4329 | fn zirValidateConst(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 4329 | fn zirValidateConst(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4330 | if (!block.isComptime()) return; | 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 | const src = block.nodeOffset(un_node.src_node); | 4333 | const src = block.nodeOffset(un_node.src_node); |
| 4334 | const init_ref = sema.resolveInst(un_node.operand); | 4334 | const init_ref = sema.resolveInst(un_node.operand); |
| 4335 | if (!try sema.isComptimeKnown(init_ref)) { | 4335 | if (!try sema.isComptimeKnown(init_ref)) { |
| ... | @@ -4344,7 +4344,7 @@ fn zirValidateArrayInitRefTy( | ... | @@ -4344,7 +4344,7 @@ fn zirValidateArrayInitRefTy( |
| 4344 | ) CompileError!Air.Inst.Ref { | 4344 | ) CompileError!Air.Inst.Ref { |
| 4345 | const pt = sema.pt; | 4345 | const pt = sema.pt; |
| 4346 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(pl_node.src_node); | 4348 | const src = block.nodeOffset(pl_node.src_node); |
| 4349 | const extra = sema.code.extraData(Zir.Inst.ArrayInitRefTy, pl_node.payload_index).data; | 4349 | const extra = sema.code.extraData(Zir.Inst.ArrayInitRefTy, pl_node.payload_index).data; |
| 4350 | const maybe_wrapped_ptr_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, extra.ptr_ty) orelse return .generic_poison_type; | 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,7 +4384,7 @@ fn zirValidateArrayInitTy( |
| 4384 | ) CompileError!void { | 4384 | ) CompileError!void { |
| 4385 | const pt = sema.pt; | 4385 | const pt = sema.pt; |
| 4386 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 4388 | const src = block.nodeOffset(inst_data.src_node); |
| 4389 | const ty_src: LazySrcLoc = if (is_result_ty) src else block.src(.{ .node_offset_init_ty = inst_data.src_node }); | 4389 | const ty_src: LazySrcLoc = if (is_result_ty) src else block.src(.{ .node_offset_init_ty = inst_data.src_node }); |
| 4390 | const extra = sema.code.extraData(Zir.Inst.ArrayInit, inst_data.payload_index).data; | 4390 | const extra = sema.code.extraData(Zir.Inst.ArrayInit, inst_data.payload_index).data; |
| ... | @@ -4445,7 +4445,7 @@ fn zirValidateStructInitTy( | ... | @@ -4445,7 +4445,7 @@ fn zirValidateStructInitTy( |
| 4445 | ) CompileError!void { | 4445 | ) CompileError!void { |
| 4446 | const pt = sema.pt; | 4446 | const pt = sema.pt; |
| 4447 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 4449 | const src = block.nodeOffset(inst_data.src_node); |
| 4450 | // It's okay for the type to be poison: this will result in an anonymous struct init. | 4450 | // It's okay for the type to be poison: this will result in an anonymous struct init. |
| 4451 | const ty = try sema.resolveTypeOrPoison(block, src, inst_data.operand) orelse return; | 4451 | const ty = try sema.resolveTypeOrPoison(block, src, inst_data.operand) orelse return; |
| ... | @@ -4465,11 +4465,11 @@ fn zirValidatePtrStructInit( | ... | @@ -4465,11 +4465,11 @@ fn zirValidatePtrStructInit( |
| 4465 | ) CompileError!void { | 4465 | ) CompileError!void { |
| 4466 | const pt = sema.pt; | 4466 | const pt = sema.pt; |
| 4467 | const zcu = pt.zcu; | 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 | const init_src = block.nodeOffset(validate_inst.src_node); | 4469 | const init_src = block.nodeOffset(validate_inst.src_node); |
| 4470 | const validate_extra = sema.code.extraData(Zir.Inst.Block, validate_inst.payload_index); | 4470 | const validate_extra = sema.code.extraData(Zir.Inst.Block, validate_inst.payload_index); |
| 4471 | const instrs = sema.code.bodySlice(validate_extra.end, validate_extra.data.body_len); | 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 | const field_ptr_extra = sema.code.extraData(Zir.Inst.Field, field_ptr_data.payload_index).data; | 4473 | const field_ptr_extra = sema.code.extraData(Zir.Inst.Field, field_ptr_data.payload_index).data; |
| 4474 | const object_ptr = sema.resolveInst(field_ptr_extra.lhs); | 4474 | const object_ptr = sema.resolveInst(field_ptr_extra.lhs); |
| 4475 | const agg_ty = sema.typeOf(object_ptr).childType(zcu).optEuBaseType(zcu); | 4475 | const agg_ty = sema.typeOf(object_ptr).childType(zcu).optEuBaseType(zcu); |
| ... | @@ -4511,7 +4511,7 @@ fn validateUnionInit( | ... | @@ -4511,7 +4511,7 @@ fn validateUnionInit( |
| 4511 | errdefer msg.destroy(sema.gpa); | 4511 | errdefer msg.destroy(sema.gpa); |
| 4512 | 4512 | ||
| 4513 | for (instrs[1..]) |inst| { | 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 | const inst_src = block.src(.{ .node_offset_initializer = inst_data.src_node }); | 4515 | const inst_src = block.src(.{ .node_offset_initializer = inst_data.src_node }); |
| 4516 | try sema.errNote(inst_src, msg, "additional initializer here", .{}); | 4516 | try sema.errNote(inst_src, msg, "additional initializer here", .{}); |
| 4517 | } | 4517 | } |
| ... | @@ -4542,7 +4542,7 @@ fn validateStructInit( | ... | @@ -4542,7 +4542,7 @@ fn validateStructInit( |
| 4542 | @memset(found_fields, false); | 4542 | @memset(found_fields, false); |
| 4543 | 4543 | ||
| 4544 | for (instrs) |field_ptr| { | 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 | const field_src = block.src(.{ .node_offset_initializer = field_ptr_data.src_node }); | 4546 | const field_src = block.src(.{ .node_offset_initializer = field_ptr_data.src_node }); |
| 4547 | const field_ptr_extra = sema.code.extraData(Zir.Inst.Field, field_ptr_data.payload_index).data; | 4547 | const field_ptr_extra = sema.code.extraData(Zir.Inst.Field, field_ptr_data.payload_index).data; |
| 4548 | const field_name = try ip.getOrPutString( | 4548 | const field_name = try ip.getOrPutString( |
| ... | @@ -4631,11 +4631,11 @@ fn zirValidatePtrArrayInit( | ... | @@ -4631,11 +4631,11 @@ fn zirValidatePtrArrayInit( |
| 4631 | ) CompileError!void { | 4631 | ) CompileError!void { |
| 4632 | const pt = sema.pt; | 4632 | const pt = sema.pt; |
| 4633 | const zcu = pt.zcu; | 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 | const init_src = block.nodeOffset(validate_inst.src_node); | 4635 | const init_src = block.nodeOffset(validate_inst.src_node); |
| 4636 | const validate_extra = sema.code.extraData(Zir.Inst.Block, validate_inst.payload_index); | 4636 | const validate_extra = sema.code.extraData(Zir.Inst.Block, validate_inst.payload_index); |
| 4637 | const instrs = sema.code.bodySlice(validate_extra.end, validate_extra.data.body_len); | 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 | const elem_ptr_extra = sema.code.extraData(Zir.Inst.ElemPtrImm, first_elem_ptr_data.payload_index).data; | 4639 | const elem_ptr_extra = sema.code.extraData(Zir.Inst.ElemPtrImm, first_elem_ptr_data.payload_index).data; |
| 4640 | const array_ptr = sema.resolveInst(elem_ptr_extra.ptr); | 4640 | const array_ptr = sema.resolveInst(elem_ptr_extra.ptr); |
| 4641 | const array_ty = sema.typeOf(array_ptr).childType(zcu).optEuBaseType(zcu); | 4641 | const array_ty = sema.typeOf(array_ptr).childType(zcu).optEuBaseType(zcu); |
| ... | @@ -4695,7 +4695,7 @@ fn zirValidatePtrArrayInit( | ... | @@ -4695,7 +4695,7 @@ fn zirValidatePtrArrayInit( |
| 4695 | fn zirValidateDestructure(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 4695 | fn zirValidateDestructure(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4696 | const pt = sema.pt; | 4696 | const pt = sema.pt; |
| 4697 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.ValidateDestructure, inst_data.payload_index).data; | 4699 | const extra = sema.code.extraData(Zir.Inst.ValidateDestructure, inst_data.payload_index).data; |
| 4700 | const src = block.nodeOffset(inst_data.src_node); | 4700 | const src = block.nodeOffset(inst_data.src_node); |
| 4701 | const destructure_src = block.nodeOffset(extra.destructure_node); | 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,7 +4821,7 @@ pub fn addDeclaredHereNote(sema: *Sema, parent: *Zcu.ErrorMsg, decl_ty: Type) Al |
| 4821 | } | 4821 | } |
| 4822 | 4822 | ||
| 4823 | fn zirStoreToInferredPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const src = block.nodeOffset(pl_node.src_node); | 4825 | const src = block.nodeOffset(pl_node.src_node); |
| 4826 | const bin = sema.code.extraData(Zir.Inst.Bin, pl_node.payload_index).data; | 4826 | const bin = sema.code.extraData(Zir.Inst.Bin, pl_node.payload_index).data; |
| 4827 | const ptr = sema.resolveInst(bin.lhs); | 4827 | const ptr = sema.resolveInst(bin.lhs); |
| ... | @@ -4829,9 +4829,9 @@ fn zirStoreToInferredPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi | ... | @@ -4829,9 +4829,9 @@ fn zirStoreToInferredPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi |
| 4829 | const ptr_inst = ptr.toIndex().?; | 4829 | const ptr_inst = ptr.toIndex().?; |
| 4830 | const air_datas = sema.air_instructions.items(.data); | 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 | .inferred_alloc_comptime => { | 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 | return sema.storeToInferredAllocComptime(block, src, operand, iac); | 4835 | return sema.storeToInferredAllocComptime(block, src, operand, iac); |
| 4836 | }, | 4836 | }, |
| 4837 | .inferred_alloc => { | 4837 | .inferred_alloc => { |
| ... | @@ -4904,7 +4904,7 @@ fn storeToInferredAllocComptime( | ... | @@ -4904,7 +4904,7 @@ fn storeToInferredAllocComptime( |
| 4904 | } | 4904 | } |
| 4905 | 4905 | ||
| 4906 | fn zirSetEvalBranchQuota(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const src = block.nodeOffset(inst_data.src_node); | 4908 | const src = block.nodeOffset(inst_data.src_node); |
| 4909 | const quota: u32 = @intCast(try sema.resolveInt(block, src, inst_data.operand, .u32, .{ .simple = .operand_setEvalBranchQuota })); | 4909 | const quota: u32 = @intCast(try sema.resolveInt(block, src, inst_data.operand, .u32, .{ .simple = .operand_setEvalBranchQuota })); |
| 4910 | sema.branch_quota = @max(sema.branch_quota, quota); | 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,14 +4914,14 @@ fn zirSetEvalBranchQuota(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi |
| 4914 | fn zirStoreNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 4914 | fn zirStoreNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 4915 | const zir_tags = sema.code.instructions.items(.tag); | 4915 | const zir_tags = sema.code.instructions.items(.tag); |
| 4916 | const zir_datas = sema.code.instructions.items(.data); | 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 | const src = block.nodeOffset(inst_data.src_node); | 4918 | const src = block.nodeOffset(inst_data.src_node); |
| 4919 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 4919 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 4920 | const ptr = sema.resolveInst(extra.lhs); | 4920 | const ptr = sema.resolveInst(extra.lhs); |
| 4921 | const operand = sema.resolveInst(extra.rhs); | 4921 | const operand = sema.resolveInst(extra.rhs); |
| 4922 | 4922 | ||
| 4923 | const is_ret = if (extra.lhs.toIndex()) |ptr_index| | 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 | else | 4925 | else |
| 4926 | false; | 4926 | false; |
| 4927 | 4927 | ||
| ... | @@ -4943,7 +4943,7 @@ fn zirStr(sema: *Sema, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | ... | @@ -4943,7 +4943,7 @@ fn zirStr(sema: *Sema, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4943 | const gpa = comp.gpa; | 4943 | const gpa = comp.gpa; |
| 4944 | const io = comp.io; | 4944 | const io = comp.io; |
| 4945 | const ip = &zcu.intern_pool; | 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 | return sema.addStrLit( | 4947 | return sema.addStrLit( |
| 4948 | try ip.getOrPutString(gpa, io, pt.tid, bytes, .maybe_embedded_nulls), | 4948 | try ip.getOrPutString(gpa, io, pt.tid, bytes, .maybe_embedded_nulls), |
| 4949 | bytes.len, | 4949 | bytes.len, |
| ... | @@ -4975,16 +4975,16 @@ fn uavRef(sema: *Sema, val: Value) CompileError!Air.Inst.Ref { | ... | @@ -4975,16 +4975,16 @@ fn uavRef(sema: *Sema, val: Value) CompileError!Air.Inst.Ref { |
| 4975 | fn zirInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4975 | fn zirInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4976 | _ = block; | 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 | return sema.pt.intRef(.comptime_int, int); | 4979 | return sema.pt.intRef(.comptime_int, int); |
| 4980 | } | 4980 | } |
| 4981 | 4981 | ||
| 4982 | fn zirIntBig(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 4982 | fn zirIntBig(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 4983 | _ = block; | 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 | const byte_count = int.len * @sizeOf(std.math.big.Limb); | 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 | // TODO: this allocation and copy is only needed because the limbs may be unaligned. | 4989 | // TODO: this allocation and copy is only needed because the limbs may be unaligned. |
| 4990 | // If ZIR is adjusted so that big int limbs are guaranteed to be aligned, these | 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,7 +5000,7 @@ fn zirIntBig(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 5000 | 5000 | ||
| 5001 | fn zirFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5001 | fn zirFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5002 | _ = block; | 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 | return Air.internedToRef((try sema.pt.floatValue( | 5004 | return Air.internedToRef((try sema.pt.floatValue( |
| 5005 | .comptime_float, | 5005 | .comptime_float, |
| 5006 | number, | 5006 | number, |
| ... | @@ -5009,14 +5009,14 @@ fn zirFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I | ... | @@ -5009,14 +5009,14 @@ fn zirFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 5009 | 5009 | ||
| 5010 | fn zirFloat128(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5010 | fn zirFloat128(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5011 | _ = block; | 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 | const extra = sema.code.extraData(Zir.Inst.Float128, inst_data.payload_index).data; | 5013 | const extra = sema.code.extraData(Zir.Inst.Float128, inst_data.payload_index).data; |
| 5014 | const number = extra.get(); | 5014 | const number = extra.get(); |
| 5015 | return Air.internedToRef((try sema.pt.floatValue(.comptime_float, number)).toIntern()); | 5015 | return Air.internedToRef((try sema.pt.floatValue(.comptime_float, number)).toIntern()); |
| 5016 | } | 5016 | } |
| 5017 | 5017 | ||
| 5018 | fn zirCompileError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const src = block.nodeOffset(inst_data.src_node); | 5020 | const src = block.nodeOffset(inst_data.src_node); |
| 5021 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 5021 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 5022 | const msg = try sema.resolveConstString(block, operand_src, inst_data.operand, .{ .simple = .compile_error_string }); | 5022 | const msg = try sema.resolveConstString(block, operand_src, inst_data.operand, .{ .simple = .compile_error_string }); |
| ... | @@ -5059,7 +5059,7 @@ fn zirCompileLog( | ... | @@ -5059,7 +5059,7 @@ fn zirCompileLog( |
| 5059 | const line_data = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, aw.written(), .no_embedded_nulls); | 5059 | const line_data = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, aw.written(), .no_embedded_nulls); |
| 5060 | 5060 | ||
| 5061 | const line_idx: Zcu.CompileLogLine.Index = if (zcu.free_compile_log_lines.pop()) |idx| idx: { | 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 | .next = .none, | 5063 | .next = .none, |
| 5064 | .data = line_data, | 5064 | .data = line_data, |
| 5065 | }; | 5065 | }; |
| ... | @@ -5069,7 +5069,7 @@ fn zirCompileLog( | ... | @@ -5069,7 +5069,7 @@ fn zirCompileLog( |
| 5069 | .next = .none, | 5069 | .next = .none, |
| 5070 | .data = line_data, | 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 | const gop = try zcu.compile_logs.getOrPut(gpa, sema.owner); | 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,7 +5093,7 @@ fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 5093 | const pt = sema.pt; | 5093 | const pt = sema.pt; |
| 5094 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 5097 | const src = block.nodeOffset(inst_data.src_node); |
| 5098 | const msg_inst = sema.resolveInst(inst_data.operand); | 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,7 +5135,7 @@ fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 5135 | } | 5135 | } |
| 5136 | 5136 | ||
| 5137 | fn zirTrap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const src = block.nodeOffset(src_node); | 5139 | const src = block.nodeOffset(src_node); |
| 5140 | if (block.isComptime()) | 5140 | if (block.isComptime()) |
| 5141 | return sema.fail(block, src, "encountered @trap at comptime", .{}); | 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,7 +5143,7 @@ fn zirTrap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 5143 | } | 5143 | } |
| 5144 | 5144 | ||
| 5145 | fn zirBreakpoint(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void { | 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 | const src = block.nodeOffset(src_node); | 5147 | const src = block.nodeOffset(src_node); |
| 5148 | if (block.isComptime()) | 5148 | if (block.isComptime()) |
| 5149 | return sema.fail(block, src, "encountered @breakpoint at comptime", .{}); | 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,7 +5153,7 @@ fn zirBreakpoint(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat |
| 5153 | fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 5153 | fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 5154 | const pt = sema.pt; | 5154 | const pt = sema.pt; |
| 5155 | const zcu = pt.zcu; | 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 | const src = parent_block.nodeOffset(inst_data.src_node); | 5157 | const src = parent_block.nodeOffset(inst_data.src_node); |
| 5158 | const extra = sema.code.extraData(Zir.Inst.Block, inst_data.payload_index); | 5158 | const extra = sema.code.extraData(Zir.Inst.Block, inst_data.payload_index); |
| 5159 | const body = sema.code.bodySlice(extra.end, extra.data.body_len); | 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,8 +5163,8 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError |
| 5163 | // Reserve space for a Loop instruction so that generated Break instructions can | 5163 | // Reserve space for a Loop instruction so that generated Break instructions can |
| 5164 | // point to it, even if it doesn't end up getting used because the code ends up being | 5164 | // point to it, even if it doesn't end up getting used because the code ends up being |
| 5165 | // comptime evaluated. | 5165 | // comptime evaluated. |
| 5166 | const block_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | 5166 | const block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); |
| 5167 | const loop_inst: Air.Inst.Index = @enumFromInt(@intFromEnum(block_inst) + 1); | 5167 | const loop_inst: Air.Inst.Index = @fromBackingInt(@intCast(@backingInt(block_inst) + 1)); |
| 5168 | try sema.air_instructions.ensureUnusedCapacity(gpa, 2); | 5168 | try sema.air_instructions.ensureUnusedCapacity(gpa, 2); |
| 5169 | sema.air_instructions.appendAssumeCapacity(.{ | 5169 | sema.air_instructions.appendAssumeCapacity(.{ |
| 5170 | .tag = .block, | 5170 | .tag = .block, |
| ... | @@ -5224,7 +5224,7 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -5224,7 +5224,7 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError |
| 5224 | try child_block.instructions.append(gpa, loop_inst); | 5224 | try child_block.instructions.append(gpa, loop_inst); |
| 5225 | 5225 | ||
| 5226 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + loop_block_len + 1); | 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 | Air.Block{ .body_len = @intCast(loop_block_len + 1) }, | 5228 | Air.Block{ .body_len = @intCast(loop_block_len + 1) }, |
| 5229 | ); | 5229 | ); |
| 5230 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(loop_block.instructions.items)); | 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,13 +5233,13 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError |
| 5233 | } | 5233 | } |
| 5234 | 5234 | ||
| 5235 | fn zirSuspendBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = parent_block.nodeOffset(inst_data.src_node); | 5237 | const src = parent_block.nodeOffset(inst_data.src_node); |
| 5238 | return sema.failWithUseOfAsync(parent_block, src); | 5238 | return sema.failWithUseOfAsync(parent_block, src); |
| 5239 | } | 5239 | } |
| 5240 | 5240 | ||
| 5241 | fn zirBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = parent_block.nodeOffset(pl_node.src_node); | 5243 | const src = parent_block.nodeOffset(pl_node.src_node); |
| 5244 | const extra = sema.code.extraData(Zir.Inst.Block, pl_node.payload_index); | 5244 | const extra = sema.code.extraData(Zir.Inst.Block, pl_node.payload_index); |
| 5245 | const body = sema.code.bodySlice(extra.end, extra.data.body_len); | 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,7 +5248,7 @@ fn zirBlock(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErro |
| 5248 | // Reserve space for a Block instruction so that generated Break instructions can | 5248 | // Reserve space for a Block instruction so that generated Break instructions can |
| 5249 | // point to it, even if it doesn't end up getting used because the code ends up being | 5249 | // point to it, even if it doesn't end up getting used because the code ends up being |
| 5250 | // comptime evaluated or is an unlabeled block. | 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 | try sema.air_instructions.append(gpa, .{ | 5252 | try sema.air_instructions.append(gpa, .{ |
| 5253 | .tag = .block, | 5253 | .tag = .block, |
| 5254 | .data = undefined, | 5254 | .data = undefined, |
| ... | @@ -5306,7 +5306,7 @@ fn resolveBlockBody( | ... | @@ -5306,7 +5306,7 @@ fn resolveBlockBody( |
| 5306 | if (child_block.isComptime()) { | 5306 | if (child_block.isComptime()) { |
| 5307 | return sema.resolveInlineBody(child_block, body, body_inst); | 5307 | return sema.resolveInlineBody(child_block, body, body_inst); |
| 5308 | } else { | 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 | var need_debug_scope = false; | 5310 | var need_debug_scope = false; |
| 5311 | child_block.need_debug_scope = &need_debug_scope; | 5311 | child_block.need_debug_scope = &need_debug_scope; |
| 5312 | if (sema.analyzeBodyInner(child_block, body)) { | 5312 | if (sema.analyzeBodyInner(child_block, body)) { |
| ... | @@ -5314,7 +5314,7 @@ fn resolveBlockBody( | ... | @@ -5314,7 +5314,7 @@ fn resolveBlockBody( |
| 5314 | } else |err| switch (err) { | 5314 | } else |err| switch (err) { |
| 5315 | error.ComptimeBreak => { | 5315 | error.ComptimeBreak => { |
| 5316 | const break_inst = sema.comptime_break_inst; | 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 | const extra = sema.code.extraData(Zir.Inst.Break, break_data.payload_index).data; | 5318 | const extra = sema.code.extraData(Zir.Inst.Break, break_data.payload_index).data; |
| 5319 | const breaks_to_body = extra.block_inst == body_inst; | 5319 | const breaks_to_body = extra.block_inst == body_inst; |
| 5320 | 5320 | ||
| ... | @@ -5330,7 +5330,7 @@ fn resolveBlockBody( | ... | @@ -5330,7 +5330,7 @@ fn resolveBlockBody( |
| 5330 | try parent_block.instructions.append(sema.gpa, merges.block_inst); | 5330 | try parent_block.instructions.append(sema.gpa, merges.block_inst); |
| 5331 | try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Block).@"struct".field_names.len + | 5331 | try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Block).@"struct".field_names.len + |
| 5332 | child_block.instructions.items.len); | 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 | .ty = Air.internedToRef(operand_ty.toIntern()), | 5334 | .ty = Air.internedToRef(operand_ty.toIntern()), |
| 5335 | .payload = sema.addExtraAssumeCapacity(Air.Block{ | 5335 | .payload = sema.addExtraAssumeCapacity(Air.Block{ |
| 5336 | .body_len = @intCast(child_block.instructions.items.len), | 5336 | .body_len = @intCast(child_block.instructions.items.len), |
| ... | @@ -5386,7 +5386,7 @@ fn resolveAnalyzedBlock( | ... | @@ -5386,7 +5386,7 @@ fn resolveAnalyzedBlock( |
| 5386 | assert(child_block.instructions.items.len != 0); | 5386 | assert(child_block.instructions.items.len != 0); |
| 5387 | assert(sema.typeOf(child_block.instructions.items[child_block.instructions.items.len - 1].toRef()).isNoReturn(zcu)); | 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 | switch (block_tag) { | 5390 | switch (block_tag) { |
| 5391 | .block => {}, | 5391 | .block => {}, |
| 5392 | .dbg_inline_block => assert(need_debug_scope), | 5392 | .dbg_inline_block => assert(need_debug_scope), |
| ... | @@ -5412,7 +5412,7 @@ fn resolveAnalyzedBlock( | ... | @@ -5412,7 +5412,7 @@ fn resolveAnalyzedBlock( |
| 5412 | try parent_block.instructions.append(gpa, merges.block_inst); | 5412 | try parent_block.instructions.append(gpa, merges.block_inst); |
| 5413 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len + | 5413 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len + |
| 5414 | child_block.instructions.items.len); | 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 | .ty = .noreturn_type, | 5416 | .ty = .noreturn_type, |
| 5417 | .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{ | 5417 | .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{ |
| 5418 | .func = child_block.inlining.?.func, | 5418 | .func = child_block.inlining.?.func, |
| ... | @@ -5450,7 +5450,7 @@ fn resolveAnalyzedBlock( | ... | @@ -5450,7 +5450,7 @@ fn resolveAnalyzedBlock( |
| 5450 | .block => { | 5450 | .block => { |
| 5451 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + | 5451 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + |
| 5452 | child_block.instructions.items.len); | 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 | .ty = .void_type, | 5454 | .ty = .void_type, |
| 5455 | .payload = sema.addExtraAssumeCapacity(Air.Block{ | 5455 | .payload = sema.addExtraAssumeCapacity(Air.Block{ |
| 5456 | .body_len = @intCast(child_block.instructions.items.len), | 5456 | .body_len = @intCast(child_block.instructions.items.len), |
| ... | @@ -5460,7 +5460,7 @@ fn resolveAnalyzedBlock( | ... | @@ -5460,7 +5460,7 @@ fn resolveAnalyzedBlock( |
| 5460 | .dbg_inline_block => { | 5460 | .dbg_inline_block => { |
| 5461 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len + | 5461 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len + |
| 5462 | child_block.instructions.items.len); | 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 | .ty = .void_type, | 5464 | .ty = .void_type, |
| 5465 | .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{ | 5465 | .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{ |
| 5466 | .func = child_block.inlining.?.func, | 5466 | .func = child_block.inlining.?.func, |
| ... | @@ -5473,7 +5473,7 @@ fn resolveAnalyzedBlock( | ... | @@ -5473,7 +5473,7 @@ fn resolveAnalyzedBlock( |
| 5473 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(child_block.instructions.items)); | 5473 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(child_block.instructions.items)); |
| 5474 | // Rewrite the break to just give value {}; the value is | 5474 | // Rewrite the break to just give value {}; the value is |
| 5475 | // comptime-known and will be returned directly. | 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 | return Air.internedToRef(result_val.toIntern()); | 5477 | return Air.internedToRef(result_val.toIntern()); |
| 5478 | } | 5478 | } |
| 5479 | } | 5479 | } |
| ... | @@ -5515,7 +5515,7 @@ fn resolveAnalyzedBlock( | ... | @@ -5515,7 +5515,7 @@ fn resolveAnalyzedBlock( |
| 5515 | .block => { | 5515 | .block => { |
| 5516 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + | 5516 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + |
| 5517 | child_block.instructions.items.len); | 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 | .ty = ty_inst, | 5519 | .ty = ty_inst, |
| 5520 | .payload = sema.addExtraAssumeCapacity(Air.Block{ | 5520 | .payload = sema.addExtraAssumeCapacity(Air.Block{ |
| 5521 | .body_len = @intCast(child_block.instructions.items.len), | 5521 | .body_len = @intCast(child_block.instructions.items.len), |
| ... | @@ -5525,7 +5525,7 @@ fn resolveAnalyzedBlock( | ... | @@ -5525,7 +5525,7 @@ fn resolveAnalyzedBlock( |
| 5525 | .dbg_inline_block => { | 5525 | .dbg_inline_block => { |
| 5526 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len + | 5526 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".field_names.len + |
| 5527 | child_block.instructions.items.len); | 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 | .ty = ty_inst, | 5529 | .ty = ty_inst, |
| 5530 | .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{ | 5530 | .payload = sema.addExtraAssumeCapacity(Air.DbgInlineBlock{ |
| 5531 | .func = child_block.inlining.?.func, | 5531 | .func = child_block.inlining.?.func, |
| ... | @@ -5539,7 +5539,7 @@ fn resolveAnalyzedBlock( | ... | @@ -5539,7 +5539,7 @@ fn resolveAnalyzedBlock( |
| 5539 | // Now that the block has its type resolved, we need to go back into all the break | 5539 | // Now that the block has its type resolved, we need to go back into all the break |
| 5540 | // instructions, and insert type coercion on the operands. | 5540 | // instructions, and insert type coercion on the operands. |
| 5541 | for (merges.br_list.items) |br| { | 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 | const br_operand_src = src; | 5543 | const br_operand_src = src; |
| 5544 | const br_operand_ty = sema.typeOf(br_operand); | 5544 | const br_operand_ty = sema.typeOf(br_operand); |
| 5545 | if (br_operand_ty.eql(resolved_ty)) { | 5545 | if (br_operand_ty.eql(resolved_ty)) { |
| ... | @@ -5552,7 +5552,7 @@ fn resolveAnalyzedBlock( | ... | @@ -5552,7 +5552,7 @@ fn resolveAnalyzedBlock( |
| 5552 | // If no instructions were produced, such as in the case of a coercion of a | 5552 | // If no instructions were produced, such as in the case of a coercion of a |
| 5553 | // constant value to a new type, we can simply point the br operand to it. | 5553 | // constant value to a new type, we can simply point the br operand to it. |
| 5554 | if (coerce_block.instructions.items.len == 0) { | 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 | continue; | 5556 | continue; |
| 5557 | } | 5557 | } |
| 5558 | assert(coerce_block.instructions.items[coerce_block.instructions.items.len - 1].toRef() == coerced_operand); | 5558 | assert(coerce_block.instructions.items[coerce_block.instructions.items.len - 1].toRef() == coerced_operand); |
| ... | @@ -5563,17 +5563,17 @@ fn resolveAnalyzedBlock( | ... | @@ -5563,17 +5563,17 @@ fn resolveAnalyzedBlock( |
| 5563 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + | 5563 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + |
| 5564 | sub_block_len); | 5564 | sub_block_len); |
| 5565 | try sema.air_instructions.ensureUnusedCapacity(gpa, 1); | 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; | 5568 | sema.air_instructions.items(.tag)[@backingInt(br)] = .block; |
| 5569 | sema.air_instructions.items(.data)[@intFromEnum(br)] = .{ .ty_pl = .{ | 5569 | sema.air_instructions.items(.data)[@backingInt(br)] = .{ .ty_pl = .{ |
| 5570 | .ty = .noreturn_type, | 5570 | .ty = .noreturn_type, |
| 5571 | .payload = sema.addExtraAssumeCapacity(Air.Block{ | 5571 | .payload = sema.addExtraAssumeCapacity(Air.Block{ |
| 5572 | .body_len = sub_block_len, | 5572 | .body_len = sub_block_len, |
| 5573 | }), | 5573 | }), |
| 5574 | } }; | 5574 | } }; |
| 5575 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(coerce_block.instructions.items)); | 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 | sema.air_instructions.appendAssumeCapacity(.{ | 5578 | sema.air_instructions.appendAssumeCapacity(.{ |
| 5579 | .tag = .br, | 5579 | .tag = .br, |
| ... | @@ -5592,7 +5592,7 @@ fn zirExport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void | ... | @@ -5592,7 +5592,7 @@ fn zirExport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 5592 | const pt = sema.pt; | 5592 | const pt = sema.pt; |
| 5593 | const zcu = pt.zcu; | 5593 | const zcu = pt.zcu; |
| 5594 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.Export, inst_data.payload_index).data; | 5596 | const extra = sema.code.extraData(Zir.Inst.Export, inst_data.payload_index).data; |
| 5597 | 5597 | ||
| 5598 | const src = block.nodeOffset(inst_data.src_node); | 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,13 +5753,13 @@ fn zirSetFloatMode(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstD |
| 5753 | } | 5753 | } |
| 5754 | 5754 | ||
| 5755 | fn zirSetRuntimeSafety(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 5757 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 5758 | block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand, .{ .simple = .operand_setRuntimeSafety }); | 5758 | block.want_safety = try sema.resolveConstBool(block, operand_src, inst_data.operand, .{ .simple = .operand_setRuntimeSafety }); |
| 5759 | } | 5759 | } |
| 5760 | 5760 | ||
| 5761 | fn zirBreak(sema: *Sema, start_block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const extra = sema.code.extraData(Zir.Inst.Break, inst_data.payload_index).data; | 5763 | const extra = sema.code.extraData(Zir.Inst.Break, inst_data.payload_index).data; |
| 5764 | const operand = sema.resolveInst(inst_data.operand); | 5764 | const operand = sema.resolveInst(inst_data.operand); |
| 5765 | const zir_block = extra.block_inst; | 5765 | const zir_block = extra.block_inst; |
| ... | @@ -5789,13 +5789,13 @@ fn zirBreak(sema: *Sema, start_block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -5789,13 +5789,13 @@ fn zirBreak(sema: *Sema, start_block: *Block, inst: Zir.Inst.Index) CompileError |
| 5789 | } | 5789 | } |
| 5790 | 5790 | ||
| 5791 | fn zirSwitchContinue(sema: *Sema, start_block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const extra = sema.code.extraData(Zir.Inst.Break, inst_data.payload_index).data; | 5793 | const extra = sema.code.extraData(Zir.Inst.Break, inst_data.payload_index).data; |
| 5794 | const operand_src = start_block.nodeOffset(extra.operand_src_node.unwrap().?); | 5794 | const operand_src = start_block.nodeOffset(extra.operand_src_node.unwrap().?); |
| 5795 | const uncoerced_operand = sema.resolveInst(inst_data.operand); | 5795 | const uncoerced_operand = sema.resolveInst(inst_data.operand); |
| 5796 | const switch_inst = extra.block_inst; | 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 | .switch_block, .switch_block_ref => {}, | 5799 | .switch_block, .switch_block_ref => {}, |
| 5800 | .switch_block_err_union => unreachable, // wrong code path! | 5800 | .switch_block_err_union => unreachable, // wrong code path! |
| 5801 | else => unreachable, // assertion failure | 5801 | else => unreachable, // assertion failure |
| ... | @@ -5833,13 +5833,13 @@ fn zirSwitchContinue(sema: *Sema, start_block: *Block, inst: Zir.Inst.Index) Com | ... | @@ -5833,13 +5833,13 @@ fn zirSwitchContinue(sema: *Sema, start_block: *Block, inst: Zir.Inst.Index) Com |
| 5833 | fn zirDbgStmt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 5833 | fn zirDbgStmt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 5834 | if (block.isComptime() or block.ownerModule().strip) return; | 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 | if (block.instructions.items.len != 0) { | 5838 | if (block.instructions.items.len != 0) { |
| 5839 | const idx = block.instructions.items[block.instructions.items.len - 1]; | 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 | // The previous dbg_stmt didn't correspond to any actual code, so replace it. | 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 | .line = inst_data.line, | 5843 | .line = inst_data.line, |
| 5844 | .column = inst_data.column, | 5844 | .column = inst_data.column, |
| 5845 | }; | 5845 | }; |
| ... | @@ -5867,7 +5867,7 @@ fn zirDbgVar( | ... | @@ -5867,7 +5867,7 @@ fn zirDbgVar( |
| 5867 | inst: Zir.Inst.Index, | 5867 | inst: Zir.Inst.Index, |
| 5868 | air_tag: Air.Inst.Tag, | 5868 | air_tag: Air.Inst.Tag, |
| 5869 | ) CompileError!void { | 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 | const operand = sema.resolveInst(str_op.operand); | 5871 | const operand = sema.resolveInst(str_op.operand); |
| 5872 | const name = str_op.getStr(sema.code); | 5872 | const name = str_op.getStr(sema.code); |
| 5873 | try sema.addDbgVar(block, operand, air_tag, name); | 5873 | try sema.addDbgVar(block, operand, air_tag, name); |
| ... | @@ -5911,7 +5911,7 @@ fn addDbgVar( | ... | @@ -5911,7 +5911,7 @@ fn addDbgVar( |
| 5911 | _ = try block.addInst(.{ | 5911 | _ = try block.addInst(.{ |
| 5912 | .tag = air_tag, | 5912 | .tag = air_tag, |
| 5913 | .data = .{ .pl_op = .{ | 5913 | .data = .{ .pl_op = .{ |
| 5914 | .payload = @intFromEnum(name_nts), | 5914 | .payload = @backingInt(name_nts), |
| 5915 | .operand = operand, | 5915 | .operand = operand, |
| 5916 | } }, | 5916 | } }, |
| 5917 | }); | 5917 | }); |
| ... | @@ -5919,7 +5919,7 @@ fn addDbgVar( | ... | @@ -5919,7 +5919,7 @@ fn addDbgVar( |
| 5919 | 5919 | ||
| 5920 | pub fn appendAirString(sema: *Sema, str: []const u8) Allocator.Error!Air.NullTerminatedString { | 5920 | pub fn appendAirString(sema: *Sema, str: []const u8) Allocator.Error!Air.NullTerminatedString { |
| 5921 | if (str.len == 0) return .none; | 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 | const elements_used = str.len / 4 + 1; | 5923 | const elements_used = str.len / 4 + 1; |
| 5924 | const elements = try sema.air_extra.addManyAsSlice(sema.gpa, elements_used); | 5924 | const elements = try sema.air_extra.addManyAsSlice(sema.gpa, elements_used); |
| 5925 | const buffer = mem.sliceAsBytes(elements); | 5925 | const buffer = mem.sliceAsBytes(elements); |
| ... | @@ -5935,7 +5935,7 @@ fn zirDeclRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -5935,7 +5935,7 @@ fn zirDeclRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 5935 | const gpa = comp.gpa; | 5935 | const gpa = comp.gpa; |
| 5936 | const io = comp.io; | 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 | const src = block.tokenOffset(inst_data.src_tok); | 5939 | const src = block.tokenOffset(inst_data.src_tok); |
| 5940 | const decl_name = try zcu.intern_pool.getOrPutString( | 5940 | const decl_name = try zcu.intern_pool.getOrPutString( |
| 5941 | gpa, | 5941 | gpa, |
| ... | @@ -5955,7 +5955,7 @@ fn zirDeclVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -5955,7 +5955,7 @@ fn zirDeclVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 5955 | const gpa = comp.gpa; | 5955 | const gpa = comp.gpa; |
| 5956 | const io = comp.io; | 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 | const src = block.tokenOffset(inst_data.src_tok); | 5959 | const src = block.tokenOffset(inst_data.src_tok); |
| 5960 | const decl_name = try zcu.intern_pool.getOrPutString( | 5960 | const decl_name = try zcu.intern_pool.getOrPutString( |
| 5961 | gpa, | 5961 | gpa, |
| ... | @@ -6144,7 +6144,7 @@ fn popErrorReturnTrace( | ... | @@ -6144,7 +6144,7 @@ fn popErrorReturnTrace( |
| 6144 | then_block.instructions.items.len + else_block.instructions.items.len + | 6144 | then_block.instructions.items.len + else_block.instructions.items.len + |
| 6145 | @typeInfo(Air.Block).@"struct".field_names.len + 1); // +1 for the sole .cond_br instruction in the .block | 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 | try sema.air_instructions.append(gpa, .{ | 6148 | try sema.air_instructions.append(gpa, .{ |
| 6149 | .tag = .cond_br, | 6149 | .tag = .cond_br, |
| 6150 | .data = .{ | 6150 | .data = .{ |
| ... | @@ -6168,8 +6168,8 @@ fn popErrorReturnTrace( | ... | @@ -6168,8 +6168,8 @@ fn popErrorReturnTrace( |
| 6168 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(then_block.instructions.items)); | 6168 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(then_block.instructions.items)); |
| 6169 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(else_block.instructions.items)); | 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 }); | 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(@intFromEnum(cond_br_inst)); | 6172 | sema.air_extra.appendAssumeCapacity(@backingInt(cond_br_inst)); |
| 6173 | } | 6173 | } |
| 6174 | } | 6174 | } |
| 6175 | 6175 | ||
| ... | @@ -6185,7 +6185,7 @@ fn zirCall( | ... | @@ -6185,7 +6185,7 @@ fn zirCall( |
| 6185 | const gpa = comp.gpa; | 6185 | const gpa = comp.gpa; |
| 6186 | const io = comp.io; | 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 | const callee_src = block.src(.{ .node_offset_call_func = inst_data.src_node }); | 6189 | const callee_src = block.src(.{ .node_offset_call_func = inst_data.src_node }); |
| 6190 | const call_src = block.nodeOffset(inst_data.src_node); | 6190 | const call_src = block.nodeOffset(inst_data.src_node); |
| 6191 | const ExtraType = switch (kind) { | 6191 | const ExtraType = switch (kind) { |
| ... | @@ -6195,7 +6195,7 @@ fn zirCall( | ... | @@ -6195,7 +6195,7 @@ fn zirCall( |
| 6195 | const extra = sema.code.extraData(ExtraType, inst_data.payload_index); | 6195 | const extra = sema.code.extraData(ExtraType, inst_data.payload_index); |
| 6196 | const args_len = extra.data.flags.args_len; | 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 | const ensure_result_used = extra.data.flags.ensure_result_used; | 6199 | const ensure_result_used = extra.data.flags.ensure_result_used; |
| 6200 | const pop_error_return_trace = extra.data.flags.pop_error_return_trace; | 6200 | const pop_error_return_trace = extra.data.flags.pop_error_return_trace; |
| 6201 | 6201 | ||
| ... | @@ -6224,7 +6224,7 @@ fn zirCall( | ... | @@ -6224,7 +6224,7 @@ fn zirCall( |
| 6224 | const func_ty = try sema.checkCallArgumentCount(block, func, callee_src, callee_ty, total_args, callee == .method); | 6224 | const func_ty = try sema.checkCallArgumentCount(block, func, callee_src, callee_ty, total_args, callee == .method); |
| 6225 | 6225 | ||
| 6226 | // The block index before the call, so we can potentially insert an error trace save here later. | 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 | // This will be set by `analyzeCall` to indicate whether any parameter was an error (making the | 6229 | // This will be set by `analyzeCall` to indicate whether any parameter was an error (making the |
| 6230 | // error trace potentially dirty). | 6230 | // error trace potentially dirty). |
| ... | @@ -6244,7 +6244,7 @@ fn zirCall( | ... | @@ -6244,7 +6244,7 @@ fn zirCall( |
| 6244 | } }; | 6244 | } }; |
| 6245 | 6245 | ||
| 6246 | // AstGen ensures that a call instruction is always preceded by a dbg_stmt instruction. | 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 | const call_inst = try sema.analyzeCall(block, func, func_ty, callee_src, call_src, modifier, ensure_result_used, args_info, call_dbg_node, .call); | 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 | if (block.ownerModule().error_tracing and | 6250 | if (block.ownerModule().error_tracing and |
| ... | @@ -6530,11 +6530,11 @@ const CallArgsInfo = union(enum) { | ... | @@ -6530,11 +6530,11 @@ const CallArgsInfo = union(enum) { |
| 6530 | 6530 | ||
| 6531 | const arg_body = if (real_arg_idx == 0) blk: { | 6531 | const arg_body = if (real_arg_idx == 0) blk: { |
| 6532 | const start = zir_call.num_args; | 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 | break :blk zir_call.args_body[start..end]; | 6534 | break :blk zir_call.args_body[start..end]; |
| 6535 | } else blk: { | 6535 | } else blk: { |
| 6536 | const start = @intFromEnum(zir_call.args_body[real_arg_idx - 1]); | 6536 | const start = @backingInt(zir_call.args_body[real_arg_idx - 1]); |
| 6537 | const end = @intFromEnum(zir_call.args_body[real_arg_idx]); | 6537 | const end = @backingInt(zir_call.args_body[real_arg_idx]); |
| 6538 | break :blk zir_call.args_body[start..end]; | 6538 | break :blk zir_call.args_body[start..end]; |
| 6539 | }; | 6539 | }; |
| 6540 | 6540 | ||
| ... | @@ -6777,7 +6777,7 @@ fn analyzeCall( | ... | @@ -6777,7 +6777,7 @@ fn analyzeCall( |
| 6777 | // We must discover the generic parameter type. | 6777 | // We must discover the generic parameter type. |
| 6778 | assert(any_generic_types); | 6778 | assert(any_generic_types); |
| 6779 | const param_inst_idx = fn_zir_info.param_body[arg_idx]; | 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 | switch (param_inst.tag) { | 6781 | switch (param_inst.tag) { |
| 6782 | .param_anytype, .param_anytype_comptime => break :ty .generic_poison, | 6782 | .param_anytype, .param_anytype_comptime => break :ty .generic_poison, |
| 6783 | .param, .param_comptime => {}, | 6783 | .param, .param_comptime => {}, |
| ... | @@ -6853,7 +6853,7 @@ fn analyzeCall( | ... | @@ -6853,7 +6853,7 @@ fn analyzeCall( |
| 6853 | } else { | 6853 | } else { |
| 6854 | // We need a dummy instruction with this type. It doesn't actually need to be in any block, | 6854 | // We need a dummy instruction with this type. It doesn't actually need to be in any block, |
| 6855 | // since it will never be referenced at runtime! | 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 | try sema.air_instructions.append(gpa, .{ .tag = .alloc, .data = .{ .ty = arg_ty } }); | 6857 | try sema.air_instructions.append(gpa, .{ .tag = .alloc, .data = .{ .ty = arg_ty } }); |
| 6858 | generic_inst_map.putAssumeCapacityNoClobber(param_inst_idx, dummy.toRef()); | 6858 | generic_inst_map.putAssumeCapacityNoClobber(param_inst_idx, dummy.toRef()); |
| 6859 | } | 6859 | } |
| ... | @@ -7256,7 +7256,7 @@ fn analyzeCall( | ... | @@ -7256,7 +7256,7 @@ fn analyzeCall( |
| 7256 | } | 7256 | } |
| 7257 | 7257 | ||
| 7258 | const need_debug_scope = !block.isComptime() and !block.is_typeof and !block.ownerModule().strip; | 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 | try sema.air_instructions.append(gpa, .{ | 7260 | try sema.air_instructions.append(gpa, .{ |
| 7261 | .tag = if (need_debug_scope) .dbg_inline_block else .block, | 7261 | .tag = if (need_debug_scope) .dbg_inline_block else .block, |
| 7262 | .data = undefined, | 7262 | .data = undefined, |
| ... | @@ -7313,15 +7313,15 @@ fn analyzeCall( | ... | @@ -7313,15 +7313,15 @@ fn analyzeCall( |
| 7313 | if (!block.isComptime() and !block.is_typeof) { | 7313 | if (!block.isComptime() and !block.is_typeof) { |
| 7314 | const zir_tags = sema.code.instructions.items(.tag); | 7314 | const zir_tags = sema.code.instructions.items(.tag); |
| 7315 | const zir_datas = sema.code.instructions.items(.data); | 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 | .param, .param_comptime => { | 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 | const param_name = sema.code.nullTerminatedString(extra.data.name); | 7319 | const param_name = sema.code.nullTerminatedString(extra.data.name); |
| 7320 | const air_inst = sema.inst_map.get(inst).?; | 7320 | const air_inst = sema.inst_map.get(inst).?; |
| 7321 | try sema.addDbgVar(&child_block, air_inst, .dbg_arg_inline, param_name); | 7321 | try sema.addDbgVar(&child_block, air_inst, .dbg_arg_inline, param_name); |
| 7322 | }, | 7322 | }, |
| 7323 | .param_anytype, .param_anytype_comptime => { | 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 | const air_inst = sema.inst_map.get(inst).?; | 7325 | const air_inst = sema.inst_map.get(inst).?; |
| 7326 | try sema.addDbgVar(&child_block, air_inst, .dbg_arg_inline, param_name); | 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,7 +7410,7 @@ fn handleTailCall(sema: *Sema, block: *Block, call_src: LazySrcLoc, func_ty: Typ |
| 7410 | } | 7410 | } |
| 7411 | 7411 | ||
| 7412 | fn zirIntType(sema: *Sema, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const ty = try sema.pt.intType(int_type.signedness, int_type.bit_count); | 7414 | const ty = try sema.pt.intType(int_type.signedness, int_type.bit_count); |
| 7415 | return Air.internedToRef(ty.toIntern()); | 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,7 +7418,7 @@ fn zirIntType(sema: *Sema, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7418 | fn zirOptionalType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7418 | fn zirOptionalType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7419 | const pt = sema.pt; | 7419 | const pt = sema.pt; |
| 7420 | const zcu = pt.zcu; | 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 | const operand_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); | 7422 | const operand_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); |
| 7423 | const child_type = try sema.resolveType(block, operand_src, inst_data.operand); | 7423 | const child_type = try sema.resolveType(block, operand_src, inst_data.operand); |
| 7424 | if (child_type.zigTypeTag(zcu) == .@"opaque") { | 7424 | if (child_type.zigTypeTag(zcu) == .@"opaque") { |
| ... | @@ -7434,12 +7434,12 @@ fn zirOptionalType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -7434,12 +7434,12 @@ fn zirOptionalType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 7434 | fn zirArrayInitElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7434 | fn zirArrayInitElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7435 | const pt = sema.pt; | 7435 | const pt = sema.pt; |
| 7436 | const zcu = pt.zcu; | 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 | const maybe_wrapped_indexable_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, bin.lhs) orelse return .generic_poison_type; | 7438 | const maybe_wrapped_indexable_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, bin.lhs) orelse return .generic_poison_type; |
| 7439 | const indexable_ty = maybe_wrapped_indexable_ty.optEuBaseType(zcu); | 7439 | const indexable_ty = maybe_wrapped_indexable_ty.optEuBaseType(zcu); |
| 7440 | assert(indexable_ty.isIndexable(zcu)); // validated by a previous instruction | 7440 | assert(indexable_ty.isIndexable(zcu)); // validated by a previous instruction |
| 7441 | const elem_ty = switch (indexable_ty.zigTypeTag(zcu)) { | 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 | else => indexable_ty.indexableElem(zcu), | 7443 | else => indexable_ty.indexableElem(zcu), |
| 7444 | }; | 7444 | }; |
| 7445 | return .fromType(elem_ty); | 7445 | return .fromType(elem_ty); |
| ... | @@ -7448,7 +7448,7 @@ fn zirArrayInitElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil | ... | @@ -7448,7 +7448,7 @@ fn zirArrayInitElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil |
| 7448 | fn zirElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7448 | fn zirElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7449 | const pt = sema.pt; | 7449 | const pt = sema.pt; |
| 7450 | const zcu = pt.zcu; | 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 | const maybe_wrapped_ptr_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, un_node.operand) orelse return .generic_poison_type; | 7452 | const maybe_wrapped_ptr_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, un_node.operand) orelse return .generic_poison_type; |
| 7453 | const ptr_ty = maybe_wrapped_ptr_ty.optEuBaseType(zcu); | 7453 | const ptr_ty = maybe_wrapped_ptr_ty.optEuBaseType(zcu); |
| 7454 | assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction | 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,7 +7464,7 @@ fn zirElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 7464 | fn zirIndexablePtrElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7464 | fn zirIndexablePtrElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7465 | const pt = sema.pt; | 7465 | const pt = sema.pt; |
| 7466 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(un_node.src_node); | 7468 | const src = block.nodeOffset(un_node.src_node); |
| 7469 | const ptr_ty = try sema.resolveTypeOrPoison(block, src, un_node.operand) orelse return .generic_poison_type; | 7469 | const ptr_ty = try sema.resolveTypeOrPoison(block, src, un_node.operand) orelse return .generic_poison_type; |
| 7470 | try sema.checkMemOperand(block, src, ptr_ty); | 7470 | try sema.checkMemOperand(block, src, ptr_ty); |
| ... | @@ -7478,7 +7478,7 @@ fn zirIndexablePtrElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com | ... | @@ -7478,7 +7478,7 @@ fn zirIndexablePtrElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com |
| 7478 | fn zirSplatOpResultType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7478 | fn zirSplatOpResultType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7479 | const pt = sema.pt; | 7479 | const pt = sema.pt; |
| 7480 | const zcu = pt.zcu; | 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 | const raw_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, un_node.operand) orelse return .generic_poison_type; | 7483 | const raw_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, un_node.operand) orelse return .generic_poison_type; |
| 7484 | const vec_ty = raw_ty.optEuBaseType(zcu); | 7484 | const vec_ty = raw_ty.optEuBaseType(zcu); |
| ... | @@ -7491,7 +7491,7 @@ fn zirSplatOpResultType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil | ... | @@ -7491,7 +7491,7 @@ fn zirSplatOpResultType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil |
| 7491 | } | 7491 | } |
| 7492 | 7492 | ||
| 7493 | fn zirVectorType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const len_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 7495 | const len_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 7496 | const elem_type_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 7496 | const elem_type_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 7497 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 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,7 +7506,7 @@ fn zirVectorType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 7506 | } | 7506 | } |
| 7507 | 7507 | ||
| 7508 | fn zirArrayType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 7510 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 7511 | const len_src = block.src(.{ .node_offset_array_type_len = inst_data.src_node }); | 7511 | const len_src = block.src(.{ .node_offset_array_type_len = inst_data.src_node }); |
| 7512 | const elem_src = block.src(.{ .node_offset_array_type_elem = inst_data.src_node }); | 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,7 +7529,7 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil |
| 7529 | const io = comp.io; | 7529 | const io = comp.io; |
| 7530 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.ArrayTypeSentinel, inst_data.payload_index).data; | 7533 | const extra = sema.code.extraData(Zir.Inst.ArrayTypeSentinel, inst_data.payload_index).data; |
| 7534 | const len_src = block.src(.{ .node_offset_array_type_len = inst_data.src_node }); | 7534 | const len_src = block.src(.{ .node_offset_array_type_len = inst_data.src_node }); |
| 7535 | const sentinel_src = block.src(.{ .node_offset_array_type_sentinel = inst_data.src_node }); | 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,7 +7565,7 @@ fn validateArrayElemType(sema: *Sema, block: *Block, elem_type: Type, elem_src: |
| 7565 | } | 7565 | } |
| 7566 | 7566 | ||
| 7567 | fn zirAnyframeType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | if (true) { | 7569 | if (true) { |
| 7570 | return sema.failWithUseOfAsync(block, block.nodeOffset(inst_data.src_node)); | 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,7 +7580,7 @@ fn zirAnyframeType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 7580 | fn zirErrorUnionType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7580 | fn zirErrorUnionType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7581 | const pt = sema.pt; | 7581 | const pt = sema.pt; |
| 7582 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 7584 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 7585 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); | 7585 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| 7586 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); | 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,7 +7620,7 @@ fn zirErrorValue(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 7620 | const gpa = comp.gpa; | 7620 | const gpa = comp.gpa; |
| 7621 | const io = comp.io; | 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 | const name = try pt.zcu.intern_pool.getOrPutString( | 7624 | const name = try pt.zcu.intern_pool.getOrPutString( |
| 7625 | gpa, | 7625 | gpa, |
| 7626 | io, | 7626 | io, |
| ... | @@ -7718,7 +7718,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr | ... | @@ -7718,7 +7718,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr |
| 7718 | const pt = sema.pt; | 7718 | const pt = sema.pt; |
| 7719 | const zcu = pt.zcu; | 7719 | const zcu = pt.zcu; |
| 7720 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 7722 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 7723 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 7723 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 7724 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); | 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,7 +7776,7 @@ fn zirEnumLiteral(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 7776 | const gpa = comp.gpa; | 7776 | const gpa = comp.gpa; |
| 7777 | const io = comp.io; | 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 | const name = inst_data.get(sema.code); | 7780 | const name = inst_data.get(sema.code); |
| 7781 | return Air.internedToRef((try pt.intern(.{ | 7781 | return Air.internedToRef((try pt.intern(.{ |
| 7782 | .enum_literal = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, name, .no_embedded_nulls), | 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,7 +7790,7 @@ fn zirDeclLiteral(sema: *Sema, block: *Block, inst: Zir.Inst.Index, do_coerce: b |
| 7790 | const gpa = comp.gpa; | 7790 | const gpa = comp.gpa; |
| 7791 | const io = comp.io; | 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 | const src = block.nodeOffset(inst_data.src_node); | 7794 | const src = block.nodeOffset(inst_data.src_node); |
| 7795 | const extra = sema.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; | 7795 | const extra = sema.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; |
| 7796 | const name = try zcu.intern_pool.getOrPutString( | 7796 | const name = try zcu.intern_pool.getOrPutString( |
| ... | @@ -7851,7 +7851,7 @@ fn analyzeDeclLiteral( | ... | @@ -7851,7 +7851,7 @@ fn analyzeDeclLiteral( |
| 7851 | fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7851 | fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7852 | const pt = sema.pt; | 7852 | const pt = sema.pt; |
| 7853 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 7855 | const src = block.nodeOffset(inst_data.src_node); |
| 7856 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 7856 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 7857 | const operand = sema.resolveInst(inst_data.operand); | 7857 | const operand = sema.resolveInst(inst_data.operand); |
| ... | @@ -7893,7 +7893,7 @@ fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -7893,7 +7893,7 @@ fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 7893 | fn zirEnumFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7893 | fn zirEnumFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 7894 | const pt = sema.pt; | 7894 | const pt = sema.pt; |
| 7895 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 7897 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 7898 | const src = block.nodeOffset(inst_data.src_node); | 7898 | const src = block.nodeOffset(inst_data.src_node); |
| 7899 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 7899 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | @@ -7954,7 +7954,7 @@ fn zirOptionalPayloadPtr( | ... | @@ -7954,7 +7954,7 @@ fn zirOptionalPayloadPtr( |
| 7954 | inst: Zir.Inst.Index, | 7954 | inst: Zir.Inst.Index, |
| 7955 | safety_check: bool, | 7955 | safety_check: bool, |
| 7956 | ) CompileError!Air.Inst.Ref { | 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 | const optional_ptr = sema.resolveInst(inst_data.operand); | 7958 | const optional_ptr = sema.resolveInst(inst_data.operand); |
| 7959 | const src = block.nodeOffset(inst_data.src_node); | 7959 | const src = block.nodeOffset(inst_data.src_node); |
| 7960 | 7960 | ||
| ... | @@ -8042,7 +8042,7 @@ fn zirOptionalPayload( | ... | @@ -8042,7 +8042,7 @@ fn zirOptionalPayload( |
| 8042 | ) CompileError!Air.Inst.Ref { | 8042 | ) CompileError!Air.Inst.Ref { |
| 8043 | const pt = sema.pt; | 8043 | const pt = sema.pt; |
| 8044 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 8046 | const src = block.nodeOffset(inst_data.src_node); |
| 8047 | const operand = sema.resolveInst(inst_data.operand); | 8047 | const operand = sema.resolveInst(inst_data.operand); |
| 8048 | const operand_ty = sema.typeOf(operand); | 8048 | const operand_ty = sema.typeOf(operand); |
| ... | @@ -8093,7 +8093,7 @@ fn zirErrUnionPayload( | ... | @@ -8093,7 +8093,7 @@ fn zirErrUnionPayload( |
| 8093 | ) CompileError!Air.Inst.Ref { | 8093 | ) CompileError!Air.Inst.Ref { |
| 8094 | const pt = sema.pt; | 8094 | const pt = sema.pt; |
| 8095 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 8097 | const src = block.nodeOffset(inst_data.src_node); |
| 8098 | const operand = sema.resolveInst(inst_data.operand); | 8098 | const operand = sema.resolveInst(inst_data.operand); |
| 8099 | const operand_src = src; | 8099 | const operand_src = src; |
| ... | @@ -8147,7 +8147,7 @@ fn zirErrUnionPayloadPtr( | ... | @@ -8147,7 +8147,7 @@ fn zirErrUnionPayloadPtr( |
| 8147 | block: *Block, | 8147 | block: *Block, |
| 8148 | inst: Zir.Inst.Index, | 8148 | inst: Zir.Inst.Index, |
| 8149 | ) CompileError!Air.Inst.Ref { | 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 | const operand = sema.resolveInst(inst_data.operand); | 8151 | const operand = sema.resolveInst(inst_data.operand); |
| 8152 | const src = block.nodeOffset(inst_data.src_node); | 8152 | const src = block.nodeOffset(inst_data.src_node); |
| 8153 | 8153 | ||
| ... | @@ -8236,7 +8236,7 @@ fn analyzeErrUnionPayloadPtr( | ... | @@ -8236,7 +8236,7 @@ fn analyzeErrUnionPayloadPtr( |
| 8236 | 8236 | ||
| 8237 | /// Value in, value out | 8237 | /// Value in, value out |
| 8238 | fn zirErrUnionCode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 8240 | const src = block.nodeOffset(inst_data.src_node); |
| 8241 | const operand = sema.resolveInst(inst_data.operand); | 8241 | const operand = sema.resolveInst(inst_data.operand); |
| 8242 | return sema.analyzeErrUnionCode(block, src, operand); | 8242 | return sema.analyzeErrUnionCode(block, src, operand); |
| ... | @@ -8269,7 +8269,7 @@ fn analyzeErrUnionCode(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air | ... | @@ -8269,7 +8269,7 @@ fn analyzeErrUnionCode(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air |
| 8269 | 8269 | ||
| 8270 | /// Pointer in, value out | 8270 | /// Pointer in, value out |
| 8271 | fn zirErrUnionCodePtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 8273 | const src = block.nodeOffset(inst_data.src_node); |
| 8274 | const operand = sema.resolveInst(inst_data.operand); | 8274 | const operand = sema.resolveInst(inst_data.operand); |
| 8275 | return sema.analyzeErrUnionCodePtr(block, src, operand); | 8275 | return sema.analyzeErrUnionCodePtr(block, src, operand); |
| ... | @@ -8316,7 +8316,7 @@ fn zirFunc( | ... | @@ -8316,7 +8316,7 @@ fn zirFunc( |
| 8316 | const io = comp.io; | 8316 | const io = comp.io; |
| 8317 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.Func, inst_data.payload_index); | 8320 | const extra = sema.code.extraData(Zir.Inst.Func, inst_data.payload_index); |
| 8321 | const target = zcu.getTarget(); | 8321 | const target = zcu.getTarget(); |
| 8322 | const ret_ty_src = block.src(.{ .node_offset_fn_type_ret_ty = inst_data.src_node }); | 8322 | const ret_ty_src = block.src(.{ .node_offset_fn_type_ret_ty = inst_data.src_node }); |
| ... | @@ -8329,7 +8329,7 @@ fn zirFunc( | ... | @@ -8329,7 +8329,7 @@ fn zirFunc( |
| 8329 | else switch (extra.data.ret_ty.body_len) { | 8329 | else switch (extra.data.ret_ty.body_len) { |
| 8330 | 0 => .void, | 8330 | 0 => .void, |
| 8331 | 1 => blk: { | 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 | extra_index += 1; | 8333 | extra_index += 1; |
| 8334 | break :blk try sema.resolveType(block, ret_ty_src, ret_ty_ref); | 8334 | break :blk try sema.resolveType(block, ret_ty_src, ret_ty_ref); |
| 8335 | }, | 8335 | }, |
| ... | @@ -9063,7 +9063,7 @@ fn zirParam( | ... | @@ -9063,7 +9063,7 @@ fn zirParam( |
| 9063 | inst: Zir.Inst.Index, | 9063 | inst: Zir.Inst.Index, |
| 9064 | comptime_syntax: bool, | 9064 | comptime_syntax: bool, |
| 9065 | ) CompileError!void { | 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 | const src = block.tokenOffset(inst_data.src_tok); | 9067 | const src = block.tokenOffset(inst_data.src_tok); |
| 9068 | const extra = sema.code.extraData(Zir.Inst.Param, inst_data.payload_index); | 9068 | const extra = sema.code.extraData(Zir.Inst.Param, inst_data.payload_index); |
| 9069 | const param_name: Zir.NullTerminatedString = extra.data.name; | 9069 | const param_name: Zir.NullTerminatedString = extra.data.name; |
| ... | @@ -9094,7 +9094,7 @@ fn zirParamAnytype( | ... | @@ -9094,7 +9094,7 @@ fn zirParamAnytype( |
| 9094 | inst: Zir.Inst.Index, | 9094 | inst: Zir.Inst.Index, |
| 9095 | comptime_syntax: bool, | 9095 | comptime_syntax: bool, |
| 9096 | ) CompileError!void { | 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 | const param_name: Zir.NullTerminatedString = inst_data.start; | 9098 | const param_name: Zir.NullTerminatedString = inst_data.start; |
| 9099 | 9099 | ||
| 9100 | try block.params.append(sema.arena, .{ | 9100 | try block.params.append(sema.arena, .{ |
| ... | @@ -9105,14 +9105,14 @@ fn zirParamAnytype( | ... | @@ -9105,14 +9105,14 @@ fn zirParamAnytype( |
| 9105 | } | 9105 | } |
| 9106 | 9106 | ||
| 9107 | fn zirAsNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9109 | const src = block.nodeOffset(inst_data.src_node); |
| 9110 | const extra = sema.code.extraData(Zir.Inst.As, inst_data.payload_index).data; | 9110 | const extra = sema.code.extraData(Zir.Inst.As, inst_data.payload_index).data; |
| 9111 | return sema.analyzeAs(block, src, extra.dest_type, extra.operand, false); | 9111 | return sema.analyzeAs(block, src, extra.dest_type, extra.operand, false); |
| 9112 | } | 9112 | } |
| 9113 | 9113 | ||
| 9114 | fn zirAsShiftOperand(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9116 | const src = block.nodeOffset(inst_data.src_node); |
| 9117 | const extra = sema.code.extraData(Zir.Inst.As, inst_data.payload_index).data; | 9117 | const extra = sema.code.extraData(Zir.Inst.As, inst_data.payload_index).data; |
| 9118 | return sema.analyzeAs(block, src, extra.dest_type, extra.operand, true); | 9118 | return sema.analyzeAs(block, src, extra.dest_type, extra.operand, true); |
| ... | @@ -9137,7 +9137,7 @@ fn analyzeAs( | ... | @@ -9137,7 +9137,7 @@ fn analyzeAs( |
| 9137 | } | 9137 | } |
| 9138 | 9138 | ||
| 9139 | const is_ret = if (zir_dest_type.toIndex()) |ptr_index| | 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 | else | 9141 | else |
| 9142 | false; | 9142 | false; |
| 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) { | 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,7 +9149,7 @@ fn analyzeAs( |
| 9149 | fn zirIntFromPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9149 | fn zirIntFromPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9150 | const pt = sema.pt; | 9150 | const pt = sema.pt; |
| 9151 | const zcu = pt.zcu; | 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 | const ptr_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 9153 | const ptr_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 9154 | const operand = sema.resolveInst(inst_data.operand); | 9154 | const operand = sema.resolveInst(inst_data.operand); |
| 9155 | const operand_ty = sema.typeOf(operand); | 9155 | const operand_ty = sema.typeOf(operand); |
| ... | @@ -9207,7 +9207,7 @@ fn zirFieldPtrLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -9207,7 +9207,7 @@ fn zirFieldPtrLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 9207 | const gpa = comp.gpa; | 9207 | const gpa = comp.gpa; |
| 9208 | const io = comp.io; | 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 | const src = block.nodeOffset(inst_data.src_node); | 9211 | const src = block.nodeOffset(inst_data.src_node); |
| 9212 | const field_name_src = block.src(.{ .node_offset_field_name = inst_data.src_node }); | 9212 | const field_name_src = block.src(.{ .node_offset_field_name = inst_data.src_node }); |
| 9213 | const extra = sema.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; | 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,7 +9229,7 @@ fn zirFieldPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 9229 | const gpa = comp.gpa; | 9229 | const gpa = comp.gpa; |
| 9230 | const io = comp.io; | 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 | const src = block.nodeOffset(inst_data.src_node); | 9233 | const src = block.nodeOffset(inst_data.src_node); |
| 9234 | const field_name_src = block.src(.{ .node_offset_field_name = inst_data.src_node }); | 9234 | const field_name_src = block.src(.{ .node_offset_field_name = inst_data.src_node }); |
| 9235 | const extra = sema.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; | 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,7 +9251,7 @@ fn zirStructInitFieldPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi |
| 9251 | const gpa = comp.gpa; | 9251 | const gpa = comp.gpa; |
| 9252 | const io = comp.io; | 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 | const src = block.nodeOffset(inst_data.src_node); | 9255 | const src = block.nodeOffset(inst_data.src_node); |
| 9256 | const field_name_src = block.src(.{ .node_offset_field_name_init = inst_data.src_node }); | 9256 | const field_name_src = block.src(.{ .node_offset_field_name_init = inst_data.src_node }); |
| 9257 | const extra = sema.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; | 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,7 +9275,7 @@ fn zirStructInitFieldPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi |
| 9275 | } | 9275 | } |
| 9276 | 9276 | ||
| 9277 | fn zirFieldPtrNamedLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9279 | const src = block.nodeOffset(inst_data.src_node); |
| 9280 | const field_name_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 9280 | const field_name_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 9281 | const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data; | 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,7 +9285,7 @@ fn zirFieldPtrNamedLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil |
| 9285 | } | 9285 | } |
| 9286 | 9286 | ||
| 9287 | fn zirFieldPtrNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9289 | const src = block.nodeOffset(inst_data.src_node); |
| 9290 | const field_name_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 9290 | const field_name_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 9291 | const extra = sema.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data; | 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,7 +9295,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 9295 | } | 9295 | } |
| 9296 | 9296 | ||
| 9297 | fn zirIntCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9299 | const src = block.nodeOffset(inst_data.src_node); |
| 9300 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 9300 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 9301 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 9301 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | @@ -9367,7 +9367,7 @@ fn intCast( | ... | @@ -9367,7 +9367,7 @@ fn intCast( |
| 9367 | fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9367 | fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9368 | const pt = sema.pt; | 9368 | const pt = sema.pt; |
| 9369 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 9371 | const src = block.nodeOffset(inst_data.src_node); |
| 9372 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 9372 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 9373 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 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,7 +9467,7 @@ fn zirBackingInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 9467 | const pt = sema.pt; | 9467 | const pt = sema.pt; |
| 9468 | const zcu = pt.zcu; | 9468 | const zcu = pt.zcu; |
| 9469 | const gpa = zcu.comp.gpa; | 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 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 9471 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 9472 | 9472 | ||
| 9473 | const operand = sema.resolveInst(inst_data.operand); | 9473 | const operand = sema.resolveInst(inst_data.operand); |
| ... | @@ -9524,7 +9524,7 @@ fn zirBackingInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! | ... | @@ -9524,7 +9524,7 @@ fn zirBackingInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 9524 | fn zirFromBackingIntArgTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9524 | fn zirFromBackingIntArgTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9525 | const pt = sema.pt; | 9525 | const pt = sema.pt; |
| 9526 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 9528 | const src = block.nodeOffset(inst_data.src_node); |
| 9529 | 9529 | ||
| 9530 | const dest_ty = try sema.resolveDestType(block, src, inst_data.operand, .remove_eu_opt, "@fromBackingInt"); | 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,7 +9552,7 @@ fn zirFromBackingInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr |
| 9552 | const zcu = pt.zcu; | 9552 | const zcu = pt.zcu; |
| 9553 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 9556 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 9557 | const src = block.nodeOffset(inst_data.src_node); | 9557 | const src = block.nodeOffset(inst_data.src_node); |
| 9558 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 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,7 +9602,7 @@ fn zirFromBackingInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr |
| 9602 | fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9602 | fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9603 | const pt = sema.pt; | 9603 | const pt = sema.pt; |
| 9604 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 9606 | const src = block.nodeOffset(inst_data.src_node); |
| 9607 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 9607 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 9608 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 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,7 +9665,7 @@ fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 9665 | } | 9665 | } |
| 9666 | 9666 | ||
| 9667 | fn zirElemVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9669 | const src = block.nodeOffset(inst_data.src_node); |
| 9670 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 9670 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 9671 | const array = sema.resolveInst(extra.lhs); | 9671 | const array = sema.resolveInst(extra.lhs); |
| ... | @@ -9674,7 +9674,7 @@ fn zirElemVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -9674,7 +9674,7 @@ fn zirElemVal(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 9674 | } | 9674 | } |
| 9675 | 9675 | ||
| 9676 | fn zirElemPtrLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9678 | const src = block.nodeOffset(inst_data.src_node); |
| 9679 | const elem_index_src = block.src(.{ .node_offset_array_access_index = inst_data.src_node }); | 9679 | const elem_index_src = block.src(.{ .node_offset_array_access_index = inst_data.src_node }); |
| 9680 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 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,7 +9693,7 @@ fn zirElemPtrLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9693 | } | 9693 | } |
| 9694 | 9694 | ||
| 9695 | fn zirElemValImm(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const array = sema.resolveInst(inst_data.operand); | 9697 | const array = sema.resolveInst(inst_data.operand); |
| 9698 | const elem_index = try sema.pt.intRef(.usize, inst_data.idx); | 9698 | const elem_index = try sema.pt.intRef(.usize, inst_data.idx); |
| 9699 | return sema.elemVal(block, LazySrcLoc.unneeded, array, elem_index, LazySrcLoc.unneeded, false); | 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,7 +9702,7 @@ fn zirElemValImm(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 9702 | fn zirElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9702 | fn zirElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9703 | const pt = sema.pt; | 9703 | const pt = sema.pt; |
| 9704 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 9706 | const src = block.nodeOffset(inst_data.src_node); |
| 9707 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 9707 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 9708 | const array_ptr = sema.resolveInst(extra.lhs); | 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,7 +9728,7 @@ fn zirElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 9728 | } | 9728 | } |
| 9729 | 9729 | ||
| 9730 | fn zirElemPtrNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9732 | const src = block.nodeOffset(inst_data.src_node); |
| 9733 | const elem_index_src = block.src(.{ .node_offset_array_access_index = inst_data.src_node }); | 9733 | const elem_index_src = block.src(.{ .node_offset_array_access_index = inst_data.src_node }); |
| 9734 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 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,7 +9741,7 @@ fn zirElemPtrNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9741 | fn zirArrayInitElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 9741 | fn zirArrayInitElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 9742 | const pt = sema.pt; | 9742 | const pt = sema.pt; |
| 9743 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 9745 | const src = block.nodeOffset(inst_data.src_node); |
| 9746 | const extra = sema.code.extraData(Zir.Inst.ElemPtrImm, inst_data.payload_index).data; | 9746 | const extra = sema.code.extraData(Zir.Inst.ElemPtrImm, inst_data.payload_index).data; |
| 9747 | const array_ptr = sema.resolveInst(extra.ptr); | 9747 | const array_ptr = sema.resolveInst(extra.ptr); |
| ... | @@ -9757,7 +9757,7 @@ fn zirArrayInitElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compile | ... | @@ -9757,7 +9757,7 @@ fn zirArrayInitElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compile |
| 9757 | } | 9757 | } |
| 9758 | 9758 | ||
| 9759 | fn zirSliceStart(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9761 | const src = block.nodeOffset(inst_data.src_node); |
| 9762 | const extra = sema.code.extraData(Zir.Inst.SliceStart, inst_data.payload_index).data; | 9762 | const extra = sema.code.extraData(Zir.Inst.SliceStart, inst_data.payload_index).data; |
| 9763 | const array_ptr = sema.resolveInst(extra.lhs); | 9763 | const array_ptr = sema.resolveInst(extra.lhs); |
| ... | @@ -9770,7 +9770,7 @@ fn zirSliceStart(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! | ... | @@ -9770,7 +9770,7 @@ fn zirSliceStart(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 9770 | } | 9770 | } |
| 9771 | 9771 | ||
| 9772 | fn zirSliceEnd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9774 | const src = block.nodeOffset(inst_data.src_node); |
| 9775 | const extra = sema.code.extraData(Zir.Inst.SliceEnd, inst_data.payload_index).data; | 9775 | const extra = sema.code.extraData(Zir.Inst.SliceEnd, inst_data.payload_index).data; |
| 9776 | const array_ptr = sema.resolveInst(extra.lhs); | 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,7 +9784,7 @@ fn zirSliceEnd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 9784 | } | 9784 | } |
| 9785 | 9785 | ||
| 9786 | fn zirSliceSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9788 | const src = block.nodeOffset(inst_data.src_node); |
| 9789 | const sentinel_src = block.src(.{ .node_offset_slice_sentinel = inst_data.src_node }); | 9789 | const sentinel_src = block.src(.{ .node_offset_slice_sentinel = inst_data.src_node }); |
| 9790 | const extra = sema.code.extraData(Zir.Inst.SliceSentinel, inst_data.payload_index).data; | 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,7 +9800,7 @@ fn zirSliceSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 9800 | } | 9800 | } |
| 9801 | 9801 | ||
| 9802 | fn zirSliceLength(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 9804 | const src = block.nodeOffset(inst_data.src_node); |
| 9805 | const extra = sema.code.extraData(Zir.Inst.SliceLength, inst_data.payload_index).data; | 9805 | const extra = sema.code.extraData(Zir.Inst.SliceLength, inst_data.payload_index).data; |
| 9806 | const array_ptr = sema.resolveInst(extra.lhs); | 9806 | const array_ptr = sema.resolveInst(extra.lhs); |
| ... | @@ -9822,7 +9822,7 @@ fn zirSliceSentinelTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE | ... | @@ -9822,7 +9822,7 @@ fn zirSliceSentinelTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE |
| 9822 | const pt = sema.pt; | 9822 | const pt = sema.pt; |
| 9823 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 9827 | const src = block.nodeOffset(inst_data.src_node); |
| 9828 | const ptr_src = block.src(.{ .node_offset_slice_ptr = inst_data.src_node }); | 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,7 +9867,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp |
| 9867 | 9867 | ||
| 9868 | assert(!zir_switch.has_continue); // wrong codepath! | 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 | try sema.air_instructions.append(gpa, .{ | 9871 | try sema.air_instructions.append(gpa, .{ |
| 9872 | .tag = .block, | 9872 | .tag = .block, |
| 9873 | .data = undefined, | 9873 | .data = undefined, |
| ... | @@ -10021,7 +10021,7 @@ fn zirSwitchBlock( | ... | @@ -10021,7 +10021,7 @@ fn zirSwitchBlock( |
| 10021 | ) CompileError!Air.Inst.Ref { | 10021 | ) CompileError!Air.Inst.Ref { |
| 10022 | const zir_switch = sema.code.getSwitchBlock(inst); | 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 | try sema.air_instructions.append(sema.gpa, .{ | 10025 | try sema.air_instructions.append(sema.gpa, .{ |
| 10026 | .tag = .block, | 10026 | .tag = .block, |
| 10027 | .data = undefined, | 10027 | .data = undefined, |
| ... | @@ -10161,7 +10161,7 @@ fn analyzeSwitchBlock( | ... | @@ -10161,7 +10161,7 @@ fn analyzeSwitchBlock( |
| 10161 | return result; | 10161 | return result; |
| 10162 | } else |err| switch (err) { | 10162 | } else |err| switch (err) { |
| 10163 | error.ComptimeBreak => { | 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 | if (break_inst.tag != .switch_continue) return error.ComptimeBreak; | 10165 | if (break_inst.tag != .switch_continue) return error.ComptimeBreak; |
| 10166 | const extra = sema.code.extraData(Zir.Inst.Break, break_inst.data.@"break".payload_index).data; | 10166 | const extra = sema.code.extraData(Zir.Inst.Break, break_inst.data.@"break".payload_index).data; |
| 10167 | if (extra.block_inst != switch_inst) return error.ComptimeBreak; | 10167 | if (extra.block_inst != switch_inst) return error.ComptimeBreak; |
| ... | @@ -10342,7 +10342,7 @@ fn analyzeSwitchBlock( | ... | @@ -10342,7 +10342,7 @@ fn analyzeSwitchBlock( |
| 10342 | break :switch_ref .{ air_ref, true }; | 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 | switch (air_tag) { | 10346 | switch (air_tag) { |
| 10347 | .loop_switch_br, .switch_br => assert(!item_has_opv), | 10347 | .loop_switch_br, .switch_br => assert(!item_has_opv), |
| 10348 | .loop, .block => assert(item_has_opv), | 10348 | .loop, .block => assert(item_has_opv), |
| ... | @@ -10362,8 +10362,8 @@ fn analyzeSwitchBlock( | ... | @@ -10362,8 +10362,8 @@ fn analyzeSwitchBlock( |
| 10362 | var replacement_block = block.makeSubBlock(); | 10362 | var replacement_block = block.makeSubBlock(); |
| 10363 | defer replacement_block.instructions.deinit(gpa); | 10363 | defer replacement_block.instructions.deinit(gpa); |
| 10364 | 10364 | ||
| 10365 | assert(sema.air_instructions.items(.tag)[@intFromEnum(placeholder_inst)] == .br); | 10365 | assert(sema.air_instructions.items(.tag)[@backingInt(placeholder_inst)] == .br); |
| 10366 | const new_operand_maybe_ref = sema.air_instructions.items(.data)[@intFromEnum(placeholder_inst)].br.operand; | 10366 | const new_operand_maybe_ref = sema.air_instructions.items(.data)[@backingInt(placeholder_inst)].br.operand; |
| 10367 | 10367 | ||
| 10368 | if (zir_switch.any_maybe_runtime_capture and !item_has_opv) { | 10368 | if (zir_switch.any_maybe_runtime_capture and !item_has_opv) { |
| 10369 | _ = try replacement_block.addBinOp(.store, operand.loop.operand_alloc, new_operand_maybe_ref); | 10369 | _ = try replacement_block.addBinOp(.store, operand.loop.operand_alloc, new_operand_maybe_ref); |
| ... | @@ -10404,8 +10404,8 @@ fn analyzeSwitchBlock( | ... | @@ -10404,8 +10404,8 @@ fn analyzeSwitchBlock( |
| 10404 | if (replacement_block.instructions.items.len == 1) { | 10404 | if (replacement_block.instructions.items.len == 1) { |
| 10405 | // Optimization: we don't need a block! | 10405 | // Optimization: we don't need a block! |
| 10406 | sema.air_instructions.set( | 10406 | sema.air_instructions.set( |
| 10407 | @intFromEnum(placeholder_inst), | 10407 | @backingInt(placeholder_inst), |
| 10408 | sema.air_instructions.get(@intFromEnum(replacement_block.instructions.items[0])), | 10408 | sema.air_instructions.get(@backingInt(replacement_block.instructions.items[0])), |
| 10409 | ); | 10409 | ); |
| 10410 | continue; | 10410 | continue; |
| 10411 | } | 10411 | } |
| ... | @@ -10414,7 +10414,7 @@ fn analyzeSwitchBlock( | ... | @@ -10414,7 +10414,7 @@ fn analyzeSwitchBlock( |
| 10414 | // No `br` is needed as the block is a switch dispatch so necessarily `noreturn`. | 10414 | // No `br` is needed as the block is a switch dispatch so necessarily `noreturn`. |
| 10415 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + | 10415 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".field_names.len + |
| 10416 | replacement_block.instructions.items.len); | 10416 | replacement_block.instructions.items.len); |
| 10417 | sema.air_instructions.set(@intFromEnum(placeholder_inst), .{ | 10417 | sema.air_instructions.set(@backingInt(placeholder_inst), .{ |
| 10418 | .tag = .block, | 10418 | .tag = .block, |
| 10419 | .data = .{ .ty_pl = .{ | 10419 | .data = .{ .ty_pl = .{ |
| 10420 | .ty = .noreturn_type, | 10420 | .ty = .noreturn_type, |
| ... | @@ -10470,7 +10470,7 @@ fn finishSwitchBr( | ... | @@ -10470,7 +10470,7 @@ fn finishSwitchBr( |
| 10470 | 10470 | ||
| 10471 | // AstGen guarantees that the instruction immediately preceding | 10471 | // AstGen guarantees that the instruction immediately preceding |
| 10472 | // switch_block[_ref]/switch_block_err_union is a dbg_stmt. | 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 | const else_is_named_only = has_else and has_under; | 10475 | const else_is_named_only = has_else and has_under; |
| 10476 | 10476 | ||
| ... | @@ -10499,7 +10499,7 @@ fn finishSwitchBr( | ... | @@ -10499,7 +10499,7 @@ fn finishSwitchBr( |
| 10499 | fn appendAssumeCapacity(hints: *@This(), hint: std.lang.BranchHint) void { | 10499 | fn appendAssumeCapacity(hints: *@This(), hint: std.lang.BranchHint) void { |
| 10500 | const idx_in_bag = hints.count % hints_per_bag; | 10500 | const idx_in_bag = hints.count % hints_per_bag; |
| 10501 | var bag: u32 = if (idx_in_bag > 0) hints.bags.pop().? else 0; | 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 | hints.count += 1; | 10503 | hints.count += 1; |
| 10504 | return hints.bags.appendAssumeCapacity(bag); | 10504 | return hints.bags.appendAssumeCapacity(bag); |
| 10505 | } | 10505 | } |
| ... | @@ -10613,7 +10613,7 @@ fn finishSwitchBr( | ... | @@ -10613,7 +10613,7 @@ fn finishSwitchBr( |
| 10613 | .ranges_len = 0, | 10613 | .ranges_len = 0, |
| 10614 | .body_len = @intCast(case_block.instructions.items.len), | 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 | cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items)); | 10617 | cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items)); |
| 10618 | } | 10618 | } |
| 10619 | } | 10619 | } |
| ... | @@ -10685,7 +10685,7 @@ fn finishSwitchBr( | ... | @@ -10685,7 +10685,7 @@ fn finishSwitchBr( |
| 10685 | .ranges_len = 0, | 10685 | .ranges_len = 0, |
| 10686 | .body_len = @intCast(case_block.instructions.items.len), | 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 | cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items)); | 10689 | cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items)); |
| 10690 | } | 10690 | } |
| 10691 | } | 10691 | } |
| ... | @@ -10828,7 +10828,7 @@ fn finishSwitchBr( | ... | @@ -10828,7 +10828,7 @@ fn finishSwitchBr( |
| 10828 | .ranges_len = 0, | 10828 | .ranges_len = 0, |
| 10829 | .body_len = @intCast(case_block.instructions.items.len), | 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 | cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items)); | 10832 | cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items)); |
| 10833 | } | 10833 | } |
| 10834 | } | 10834 | } |
| ... | @@ -10891,7 +10891,7 @@ fn finishSwitchBr( | ... | @@ -10891,7 +10891,7 @@ fn finishSwitchBr( |
| 10891 | if (seen_field != null) continue; | 10891 | if (seen_field != null) continue; |
| 10892 | const item_val = try pt.enumValueFieldIndex(item_ty, @intCast(field_i)); | 10892 | const item_val = try pt.enumValueFieldIndex(item_ty, @intCast(field_i)); |
| 10893 | const item_ref: Air.Inst.Ref = .fromValue(item_val); | 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 | items_len += 1; | 10895 | items_len += 1; |
| 10896 | } | 10896 | } |
| 10897 | assert(items_len > 0); // `else` must be reachable at this point | 10897 | assert(items_len > 0); // `else` must be reachable at this point |
| ... | @@ -12370,7 +12370,7 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( | ... | @@ -12370,7 +12370,7 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( |
| 12370 | 12370 | ||
| 12371 | { | 12371 | { |
| 12372 | // All branch hints are `.none`, so just add zero elems. | 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 | const need_elems = @divCeil(field_indices.len + 1, 10); | 12374 | const need_elems = @divCeil(field_indices.len + 1, 10); |
| 12375 | try cases_extra.appendNTimes(gpa, 0, need_elems); | 12375 | try cases_extra.appendNTimes(gpa, 0, need_elems); |
| 12376 | } | 12376 | } |
| ... | @@ -12402,15 +12402,15 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( | ... | @@ -12402,15 +12402,15 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( |
| 12402 | .ranges_len = 0, | 12402 | .ranges_len = 0, |
| 12403 | .body_len = @intCast(coerce_block.instructions.items.len), | 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 | cases_extra.appendSliceAssumeCapacity(@ptrCast(coerce_block.instructions.items)); // body | 12406 | cases_extra.appendSliceAssumeCapacity(@ptrCast(coerce_block.instructions.items)); // body |
| 12407 | } | 12407 | } |
| 12408 | } | 12408 | } |
| 12409 | const else_body_len = len: { | 12409 | const else_body_len = len: { |
| 12410 | // 'else' prong is unreachable | 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 | try sema.air_instructions.append(gpa, .{ .tag = .unreach, .data = .{ .no_op = {} } }); | 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 | break :len 1; | 12414 | break :len 1; |
| 12415 | }; | 12415 | }; |
| 12416 | 12416 | ||
| ... | @@ -12439,13 +12439,13 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( | ... | @@ -12439,13 +12439,13 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( |
| 12439 | .simple => |s| { | 12439 | .simple => |s| { |
| 12440 | const air_datas = sema.air_instructions.items(.data); | 12440 | const air_datas = sema.air_instructions.items(.data); |
| 12441 | air_datas[switch_br_inst].pl_op.operand = s.cond; | 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 | sema.addExtraAssumeCapacity(Air.Block{ .body_len = 1 }); | 12443 | sema.addExtraAssumeCapacity(Air.Block{ .body_len = 1 }); |
| 12444 | sema.air_extra.appendAssumeCapacity(switch_br_inst); | 12444 | sema.air_extra.appendAssumeCapacity(switch_br_inst); |
| 12445 | }, | 12445 | }, |
| 12446 | .loop => { | 12446 | .loop => { |
| 12447 | // The block must first extract the tag from the loaded union. | 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 | try sema.air_instructions.append(sema.gpa, .{ | 12449 | try sema.air_instructions.append(sema.gpa, .{ |
| 12450 | .tag = .get_union_tag, | 12450 | .tag = .get_union_tag, |
| 12451 | .data = .{ .ty_op = .{ | 12451 | .data = .{ .ty_op = .{ |
| ... | @@ -12455,9 +12455,9 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( | ... | @@ -12455,9 +12455,9 @@ fn analyzeSwitchPayloadCaptureTaggedUnion( |
| 12455 | }); | 12455 | }); |
| 12456 | const air_datas = sema.air_instructions.items(.data); | 12456 | const air_datas = sema.air_instructions.items(.data); |
| 12457 | air_datas[switch_br_inst].pl_op.operand = tag_inst.toRef(); | 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 | sema.addExtraAssumeCapacity(Air.Block{ .body_len = 2 }); | 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 | sema.air_extra.appendAssumeCapacity(switch_br_inst); | 12461 | sema.air_extra.appendAssumeCapacity(switch_br_inst); |
| 12462 | }, | 12462 | }, |
| 12463 | } | 12463 | } |
| ... | @@ -12674,7 +12674,7 @@ fn maybeErrorUnwrap( | ... | @@ -12674,7 +12674,7 @@ fn maybeErrorUnwrap( |
| 12674 | 12674 | ||
| 12675 | const tags = sema.code.instructions.items(.tag); | 12675 | const tags = sema.code.instructions.items(.tag); |
| 12676 | for (body) |inst| { | 12676 | for (body) |inst| { |
| 12677 | switch (tags[@intFromEnum(inst)]) { | 12677 | switch (tags[@backingInt(inst)]) { |
| 12678 | .@"unreachable" => if (!block.wantSafety()) return false, | 12678 | .@"unreachable" => if (!block.wantSafety()) return false, |
| 12679 | .err_union_code => if (!allow_err_code_inst) return false, | 12679 | .err_union_code => if (!allow_err_code_inst) return false, |
| 12680 | .save_err_ret_index, | 12680 | .save_err_ret_index, |
| ... | @@ -12688,7 +12688,7 @@ fn maybeErrorUnwrap( | ... | @@ -12688,7 +12688,7 @@ fn maybeErrorUnwrap( |
| 12688 | } | 12688 | } |
| 12689 | 12689 | ||
| 12690 | for (body) |inst| { | 12690 | for (body) |inst| { |
| 12691 | const air_inst = switch (tags[@intFromEnum(inst)]) { | 12691 | const air_inst = switch (tags[@backingInt(inst)]) { |
| 12692 | .err_union_code => continue, | 12692 | .err_union_code => continue, |
| 12693 | .dbg_stmt => { | 12693 | .dbg_stmt => { |
| 12694 | try sema.zirDbgStmt(block, inst); | 12694 | try sema.zirDbgStmt(block, inst); |
| ... | @@ -12705,7 +12705,7 @@ fn maybeErrorUnwrap( | ... | @@ -12705,7 +12705,7 @@ fn maybeErrorUnwrap( |
| 12705 | return true; | 12705 | return true; |
| 12706 | }, | 12706 | }, |
| 12707 | .panic => { | 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 | const msg_inst = sema.resolveInst(inst_data.operand); | 12709 | const msg_inst = sema.resolveInst(inst_data.operand); |
| 12710 | 12710 | ||
| 12711 | const panic_fn = try getStdLangValue(sema, operand_src, .@"panic.call"); | 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,9 +12726,9 @@ fn maybeErrorUnwrapCondbr(sema: *Sema, block: *Block, body: []const Zir.Inst.Ind |
| 12726 | const pt = sema.pt; | 12726 | const pt = sema.pt; |
| 12727 | const zcu = pt.zcu; | 12727 | const zcu = pt.zcu; |
| 12728 | const index = cond.toIndex() orelse return; | 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 | const err_operand = sema.resolveInst(err_inst_data.operand); | 12732 | const err_operand = sema.resolveInst(err_inst_data.operand); |
| 12733 | const operand_ty = sema.typeOf(err_operand); | 12733 | const operand_ty = sema.typeOf(err_operand); |
| 12734 | if (operand_ty.zigTypeTag(zcu) == .error_set) { | 12734 | if (operand_ty.zigTypeTag(zcu) == .error_set) { |
| ... | @@ -12745,7 +12745,7 @@ fn maybeErrorUnwrapCondbr(sema: *Sema, block: *Block, body: []const Zir.Inst.Ind | ... | @@ -12745,7 +12745,7 @@ fn maybeErrorUnwrapCondbr(sema: *Sema, block: *Block, body: []const Zir.Inst.Ind |
| 12745 | fn maybeErrorUnwrapComptime(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, operand: Air.Inst.Ref) !void { | 12745 | fn maybeErrorUnwrapComptime(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, operand: Air.Inst.Ref) !void { |
| 12746 | const tags = sema.code.instructions.items(.tag); | 12746 | const tags = sema.code.instructions.items(.tag); |
| 12747 | const inst = for (body) |inst| { | 12747 | const inst = for (body) |inst| { |
| 12748 | switch (tags[@intFromEnum(inst)]) { | 12748 | switch (tags[@backingInt(inst)]) { |
| 12749 | .dbg_stmt, | 12749 | .dbg_stmt, |
| 12750 | .save_err_ret_index, | 12750 | .save_err_ret_index, |
| 12751 | => {}, | 12751 | => {}, |
| ... | @@ -12753,7 +12753,7 @@ fn maybeErrorUnwrapComptime(sema: *Sema, block: *Block, body: []const Zir.Inst.I | ... | @@ -12753,7 +12753,7 @@ fn maybeErrorUnwrapComptime(sema: *Sema, block: *Block, body: []const Zir.Inst.I |
| 12753 | else => return, | 12753 | else => return, |
| 12754 | } | 12754 | } |
| 12755 | } else return; | 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 | const src = block.nodeOffset(inst_data.src_node); | 12757 | const src = block.nodeOffset(inst_data.src_node); |
| 12758 | 12758 | ||
| 12759 | if (try sema.resolveDefinedValue(block, src, operand)) |val| { | 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,7 +12766,7 @@ fn maybeErrorUnwrapComptime(sema: *Sema, block: *Block, body: []const Zir.Inst.I |
| 12766 | fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 12766 | fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 12767 | const pt = sema.pt; | 12767 | const pt = sema.pt; |
| 12768 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 12770 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 12771 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 12771 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 12772 | const name_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 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,7 +12813,7 @@ fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 12813 | fn zirHasDecl(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 12813 | fn zirHasDecl(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 12814 | const pt = sema.pt; | 12814 | const pt = sema.pt; |
| 12815 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 12817 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 12818 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 12818 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 12819 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 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,7 +12834,7 @@ fn zirHasDecl(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 12834 | fn zirImport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 12834 | fn zirImport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 12835 | const pt = sema.pt; | 12835 | const pt = sema.pt; |
| 12836 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.Import, inst_data.payload_index).data; | 12838 | const extra = sema.code.extraData(Zir.Inst.Import, inst_data.payload_index).data; |
| 12839 | const operand_src = block.tokenOffset(inst_data.src_tok); | 12839 | const operand_src = block.tokenOffset(inst_data.src_tok); |
| 12840 | const operand = sema.code.nullTerminatedString(extra.path); | 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,7 +12883,7 @@ fn zirEmbedFile(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 12883 | const pt = sema.pt; | 12883 | const pt = sema.pt; |
| 12884 | const zcu = pt.zcu; | 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 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 12887 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 12888 | const name = try sema.resolveConstString(block, operand_src, inst_data.operand, .{ .simple = .operand_embedFile }); | 12888 | const name = try sema.resolveConstString(block, operand_src, inst_data.operand, .{ .simple = .operand_embedFile }); |
| 12889 | 12889 | ||
| ... | @@ -12916,7 +12916,7 @@ fn zirShl( | ... | @@ -12916,7 +12916,7 @@ fn zirShl( |
| 12916 | ) CompileError!Air.Inst.Ref { | 12916 | ) CompileError!Air.Inst.Ref { |
| 12917 | const pt = sema.pt; | 12917 | const pt = sema.pt; |
| 12918 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 12920 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 12921 | const lhs = sema.resolveInst(extra.lhs); | 12921 | const lhs = sema.resolveInst(extra.lhs); |
| 12922 | const rhs = sema.resolveInst(extra.rhs); | 12922 | const rhs = sema.resolveInst(extra.rhs); |
| ... | @@ -13103,7 +13103,7 @@ fn zirShr( | ... | @@ -13103,7 +13103,7 @@ fn zirShr( |
| 13103 | ) CompileError!Air.Inst.Ref { | 13103 | ) CompileError!Air.Inst.Ref { |
| 13104 | const pt = sema.pt; | 13104 | const pt = sema.pt; |
| 13105 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 13107 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 13108 | const lhs = sema.resolveInst(extra.lhs); | 13108 | const lhs = sema.resolveInst(extra.lhs); |
| 13109 | const rhs = sema.resolveInst(extra.rhs); | 13109 | const rhs = sema.resolveInst(extra.rhs); |
| ... | @@ -13230,7 +13230,7 @@ fn zirBitwise( | ... | @@ -13230,7 +13230,7 @@ fn zirBitwise( |
| 13230 | ) CompileError!Air.Inst.Ref { | 13230 | ) CompileError!Air.Inst.Ref { |
| 13231 | const pt = sema.pt; | 13231 | const pt = sema.pt; |
| 13232 | const zcu = pt.zcu; | 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 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 13234 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 13235 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); | 13235 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| 13236 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); | 13236 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); |
| ... | @@ -13284,7 +13284,7 @@ fn zirBitwise( | ... | @@ -13284,7 +13284,7 @@ fn zirBitwise( |
| 13284 | fn zirBitNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 13284 | fn zirBitNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 13285 | const pt = sema.pt; | 13285 | const pt = sema.pt; |
| 13286 | const zcu = pt.zcu; | 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 | const operand_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); | 13288 | const operand_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); |
| 13289 | const src = block.nodeOffset(inst_data.src_node); | 13289 | const src = block.nodeOffset(inst_data.src_node); |
| 13290 | const operand = sema.resolveInst(inst_data.operand); | 13290 | const operand = sema.resolveInst(inst_data.operand); |
| ... | @@ -13410,7 +13410,7 @@ fn analyzeTupleCat( | ... | @@ -13410,7 +13410,7 @@ fn analyzeTupleCat( |
| 13410 | fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 13410 | fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 13411 | const pt = sema.pt; | 13411 | const pt = sema.pt; |
| 13412 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 13414 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 13415 | const lhs = sema.resolveInst(extra.lhs); | 13415 | const lhs = sema.resolveInst(extra.lhs); |
| 13416 | const rhs = sema.resolveInst(extra.rhs); | 13416 | const rhs = sema.resolveInst(extra.rhs); |
| ... | @@ -13844,7 +13844,7 @@ fn analyzeTupleMul( | ... | @@ -13844,7 +13844,7 @@ fn analyzeTupleMul( |
| 13844 | fn zirNegate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 13844 | fn zirNegate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 13845 | const pt = sema.pt; | 13845 | const pt = sema.pt; |
| 13846 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 13848 | const src = block.nodeOffset(inst_data.src_node); |
| 13849 | const lhs_src = src; | 13849 | const lhs_src = src; |
| 13850 | const rhs_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); | 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,7 +13877,7 @@ fn zirNegate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 13877 | fn zirNegateWrap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 13877 | fn zirNegateWrap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 13878 | const pt = sema.pt; | 13878 | const pt = sema.pt; |
| 13879 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 13881 | const src = block.nodeOffset(inst_data.src_node); |
| 13882 | const lhs_src = src; | 13882 | const lhs_src = src; |
| 13883 | const rhs_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); | 13883 | const rhs_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); |
| ... | @@ -13902,7 +13902,7 @@ fn zirArithmetic( | ... | @@ -13902,7 +13902,7 @@ fn zirArithmetic( |
| 13902 | zir_tag: Zir.Inst.Tag, | 13902 | zir_tag: Zir.Inst.Tag, |
| 13903 | safety: bool, | 13903 | safety: bool, |
| 13904 | ) CompileError!Air.Inst.Ref { | 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 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 13906 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 13907 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); | 13907 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| 13908 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); | 13908 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); |
| ... | @@ -13916,7 +13916,7 @@ fn zirArithmetic( | ... | @@ -13916,7 +13916,7 @@ fn zirArithmetic( |
| 13916 | fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 13916 | fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 13917 | const pt = sema.pt; | 13917 | const pt = sema.pt; |
| 13918 | const zcu = pt.zcu; | 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 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 13920 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 13921 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); | 13921 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| 13922 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); | 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,7 +14025,7 @@ fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins |
| 14025 | fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 14025 | fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14026 | const pt = sema.pt; | 14026 | const pt = sema.pt; |
| 14027 | const zcu = pt.zcu; | 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 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 14029 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14030 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 14030 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14031 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 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,7 +14121,7 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 14121 | fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 14121 | fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14122 | const pt = sema.pt; | 14122 | const pt = sema.pt; |
| 14123 | const zcu = pt.zcu; | 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 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 14125 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14126 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 14126 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14127 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 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,7 +14186,7 @@ fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 14186 | fn zirDivCeil(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 14186 | fn zirDivCeil(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14187 | const pt = sema.pt; | 14187 | const pt = sema.pt; |
| 14188 | const zcu = pt.zcu; | 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 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 14190 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14191 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 14191 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14192 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 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,7 +14251,7 @@ fn zirDivCeil(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 14251 | fn zirDivTrunc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 14251 | fn zirDivTrunc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14252 | const pt = sema.pt; | 14252 | const pt = sema.pt; |
| 14253 | const zcu = pt.zcu; | 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 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 14255 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14256 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 14256 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14257 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 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,7 +14462,7 @@ fn airTag(block: *Block, is_int: bool, normal: Air.Inst.Tag, optimized: Air.Inst |
| 14462 | fn zirModRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 14462 | fn zirModRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14463 | const pt = sema.pt; | 14463 | const pt = sema.pt; |
| 14464 | const zcu = pt.zcu; | 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 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 14466 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14467 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); | 14467 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| 14468 | const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node }); | 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,7 +14563,7 @@ fn zirModRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 14563 | fn zirMod(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 14563 | fn zirMod(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14564 | const pt = sema.pt; | 14564 | const pt = sema.pt; |
| 14565 | const zcu = pt.zcu; | 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 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 14567 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14568 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 14568 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14569 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 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,7 +14627,7 @@ fn zirMod(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins |
| 14627 | fn zirRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 14627 | fn zirRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 14628 | const pt = sema.pt; | 14628 | const pt = sema.pt; |
| 14629 | const zcu = pt.zcu; | 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 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 14631 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 14632 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 14632 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 14633 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 14633 | const rhs_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | @@ -15211,7 +15211,7 @@ fn analyzePtrArithmetic( | ... | @@ -15211,7 +15211,7 @@ fn analyzePtrArithmetic( |
| 15211 | } | 15211 | } |
| 15212 | 15212 | ||
| 15213 | fn zirLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 15215 | const src = block.nodeOffset(inst_data.src_node); |
| 15216 | const ptr_src = src; // TODO better source location | 15216 | const ptr_src = src; // TODO better source location |
| 15217 | const ptr = sema.resolveInst(inst_data.operand); | 15217 | const ptr = sema.resolveInst(inst_data.operand); |
| ... | @@ -15241,7 +15241,7 @@ fn zirAsm( | ... | @@ -15241,7 +15241,7 @@ fn zirAsm( |
| 15241 | const is_global_assembly = sema.func_index == .none; | 15241 | const is_global_assembly = sema.func_index == .none; |
| 15242 | 15242 | ||
| 15243 | const asm_source: []const u8 = if (tmpl_is_expr) s: { | 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 | break :s try sema.resolveConstString(block, src, tmpl, .{ .simple = .inline_assembly_code }); | 15245 | break :s try sema.resolveConstString(block, src, tmpl, .{ .simple = .inline_assembly_code }); |
| 15246 | } else sema.code.nullTerminatedString(extra.data.asm_source); | 15246 | } else sema.code.nullTerminatedString(extra.data.asm_source); |
| 15247 | 15247 | ||
| ... | @@ -15495,7 +15495,7 @@ fn zirCmpEq( | ... | @@ -15495,7 +15495,7 @@ fn zirCmpEq( |
| 15495 | ) CompileError!Air.Inst.Ref { | 15495 | ) CompileError!Air.Inst.Ref { |
| 15496 | const pt = sema.pt; | 15496 | const pt = sema.pt; |
| 15497 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 15499 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 15500 | const src: LazySrcLoc = block.nodeOffset(inst_data.src_node); | 15500 | const src: LazySrcLoc = block.nodeOffset(inst_data.src_node); |
| 15501 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); | 15501 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| ... | @@ -15606,7 +15606,7 @@ fn zirCmp( | ... | @@ -15606,7 +15606,7 @@ fn zirCmp( |
| 15606 | inst: Zir.Inst.Index, | 15606 | inst: Zir.Inst.Index, |
| 15607 | op: std.math.CompareOperator, | 15607 | op: std.math.CompareOperator, |
| 15608 | ) CompileError!Air.Inst.Ref { | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 15610 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 15611 | const src: LazySrcLoc = block.nodeOffset(inst_data.src_node); | 15611 | const src: LazySrcLoc = block.nodeOffset(inst_data.src_node); |
| 15612 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); | 15612 | const lhs_src = block.src(.{ .node_offset_bin_lhs = inst_data.src_node }); |
| ... | @@ -15762,7 +15762,7 @@ fn runtimeBoolCmp( | ... | @@ -15762,7 +15762,7 @@ fn runtimeBoolCmp( |
| 15762 | fn zirSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 15762 | fn zirSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 15763 | const pt = sema.pt; | 15763 | const pt = sema.pt; |
| 15764 | const zcu = pt.zcu; | 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 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 15766 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 15767 | const ty = try sema.resolveType(block, operand_src, inst_data.operand); | 15767 | const ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| 15768 | try sema.ensureLayoutResolved(ty, operand_src, .size_of); | 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,7 +15786,7 @@ fn zirSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 15786 | fn zirBitSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 15786 | fn zirBitSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 15787 | const pt = sema.pt; | 15787 | const pt = sema.pt; |
| 15788 | const zcu = pt.zcu; | 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 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 15790 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 15791 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); | 15791 | const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| 15792 | if (!operand_ty.hasBitRepresentation(zcu) and | 15792 | if (!operand_ty.hasBitRepresentation(zcu) and |
| ... | @@ -15816,7 +15816,7 @@ fn zirClosureGet(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat | ... | @@ -15816,7 +15816,7 @@ fn zirClosureGet(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat |
| 15816 | const ip = &zcu.intern_pool; | 15816 | const ip = &zcu.intern_pool; |
| 15817 | const captures = Type.fromInterned(zcu.namespacePtr(block.namespace).owner_type).getCaptures(zcu); | 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 | const src = block.nodeOffset(src_node); | 15820 | const src = block.nodeOffset(src_node); |
| 15821 | 15821 | ||
| 15822 | const capture_ty = switch (captures.get(ip)[extended.small].unwrap()) { | 15822 | const capture_ty = switch (captures.get(ip)[extended.small].unwrap()) { |
| ... | @@ -15912,7 +15912,7 @@ fn zirFrameAddress( | ... | @@ -15912,7 +15912,7 @@ fn zirFrameAddress( |
| 15912 | block: *Block, | 15912 | block: *Block, |
| 15913 | extended: Zir.Inst.Extended.InstData, | 15913 | extended: Zir.Inst.Extended.InstData, |
| 15914 | ) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(src_node); | 15916 | const src = block.nodeOffset(src_node); |
| 15917 | try sema.requireRuntimeBlock(block, src, null); | 15917 | try sema.requireRuntimeBlock(block, src, null); |
| 15918 | return try block.addNoOp(.frame_addr); | 15918 | return try block.addNoOp(.frame_addr); |
| ... | @@ -16034,7 +16034,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16034,7 +16034,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16034 | const io = comp.io; | 16034 | const io = comp.io; |
| 16035 | const ip = &zcu.intern_pool; | 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 | const src = block.nodeOffset(inst_data.src_node); | 16038 | const src = block.nodeOffset(inst_data.src_node); |
| 16039 | const ty = try sema.resolveType(block, src, inst_data.operand); | 16039 | const ty = try sema.resolveType(block, src, inst_data.operand); |
| 16040 | const type_info_ty = try sema.getStdLangType(src, .Type); | 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,7 +16207,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16207 | }; | 16207 | }; |
| 16208 | return Air.internedToRef((try pt.internUnion(.{ | 16208 | return Air.internedToRef((try pt.internUnion(.{ |
| 16209 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(fn_info_ty, &field_values)).toIntern(), | 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,13 +16217,13 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16217 | const info = ty.intInfo(zcu); | 16217 | const info = ty.intInfo(zcu); |
| 16218 | const field_values = .{ | 16218 | const field_values = .{ |
| 16219 | // signedness: Signedness, | 16219 | // signedness: Signedness, |
| 16220 | (try pt.enumValueFieldIndex(signedness_ty, @intFromEnum(info.signedness))).toIntern(), | 16220 | (try pt.enumValueFieldIndex(signedness_ty, @backingInt(info.signedness))).toIntern(), |
| 16221 | // bits: u16, | 16221 | // bits: u16, |
| 16222 | (try pt.intValue(.u16, info.bits)).toIntern(), | 16222 | (try pt.intValue(.u16, info.bits)).toIntern(), |
| 16223 | }; | 16223 | }; |
| 16224 | return Air.internedToRef((try pt.internUnion(.{ | 16224 | return Air.internedToRef((try pt.internUnion(.{ |
| 16225 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(int_info_ty, &field_values)).toIntern(), | 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,7 +16236,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16236 | }; | 16236 | }; |
| 16237 | return Air.internedToRef((try pt.internUnion(.{ | 16237 | return Air.internedToRef((try pt.internUnion(.{ |
| 16238 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(float_info_ty, &field_vals)).toIntern(), | 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,7 +16279,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16279 | 16279 | ||
| 16280 | const field_values = .{ | 16280 | const field_values = .{ |
| 16281 | // size: Size, | 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 | // attrs: Attributes | 16283 | // attrs: Attributes |
| 16284 | (try pt.aggregateValue(ptr_attrs_ty, &attributes)).toIntern(), | 16284 | (try pt.aggregateValue(ptr_attrs_ty, &attributes)).toIntern(), |
| 16285 | // child: type, | 16285 | // child: type, |
| ... | @@ -16292,7 +16292,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16292,7 +16292,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16292 | }; | 16292 | }; |
| 16293 | return Air.internedToRef((try pt.internUnion(.{ | 16293 | return Air.internedToRef((try pt.internUnion(.{ |
| 16294 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(pointer_ty, &field_values)).toIntern(), | 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,7 +16310,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16310 | }; | 16310 | }; |
| 16311 | return Air.internedToRef((try pt.internUnion(.{ | 16311 | return Air.internedToRef((try pt.internUnion(.{ |
| 16312 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(array_field_ty, &field_values)).toIntern(), | 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,7 +16326,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16326 | }; | 16326 | }; |
| 16327 | return Air.internedToRef((try pt.internUnion(.{ | 16327 | return Air.internedToRef((try pt.internUnion(.{ |
| 16328 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(vector_field_ty, &field_values)).toIntern(), | 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,7 +16339,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16339 | }; | 16339 | }; |
| 16340 | return Air.internedToRef((try pt.internUnion(.{ | 16340 | return Air.internedToRef((try pt.internUnion(.{ |
| 16341 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(optional_field_ty, &field_values)).toIntern(), | 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,7 +16430,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16430 | // Construct Type{ .error_set = errors_val } | 16430 | // Construct Type{ .error_set = errors_val } |
| 16431 | return Air.internedToRef((try pt.internUnion(.{ | 16431 | return Air.internedToRef((try pt.internUnion(.{ |
| 16432 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(error_set_ty, &field_values)).toIntern(), | 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,7 +16445,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16445 | }; | 16445 | }; |
| 16446 | return Air.internedToRef((try pt.internUnion(.{ | 16446 | return Air.internedToRef((try pt.internUnion(.{ |
| 16447 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(error_union_field_ty, &field_values)).toIntern(), | 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,7 +16583,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16583 | }; | 16583 | }; |
| 16584 | return Air.internedToRef((try pt.internUnion(.{ | 16584 | return Air.internedToRef((try pt.internUnion(.{ |
| 16585 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(type_enum_ty, &field_values)).toIntern(), | 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,7 +16763,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16763 | 16763 | ||
| 16764 | const field_values = .{ | 16764 | const field_values = .{ |
| 16765 | // layout: ContainerLayout, | 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 | // tag_type: ?type, | 16768 | // tag_type: ?type, |
| 16769 | enum_tag_ty_val, | 16769 | enum_tag_ty_val, |
| ... | @@ -16782,7 +16782,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16782,7 +16782,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16782 | }; | 16782 | }; |
| 16783 | return Air.internedToRef((try pt.internUnion(.{ | 16783 | return Air.internedToRef((try pt.internUnion(.{ |
| 16784 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(type_union_ty, &field_values)).toIntern(), | 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,7 +17040,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17040 | // is_tuple: bool, | 17040 | // is_tuple: bool, |
| 17041 | Value.makeBool(ty.isTuple(zcu)).toIntern(), | 17041 | Value.makeBool(ty.isTuple(zcu)).toIntern(), |
| 17042 | // layout: ContainerLayout, | 17042 | // layout: ContainerLayout, |
| 17043 | (try pt.enumValueFieldIndex(container_layout_ty, @intFromEnum(layout))).toIntern(), | 17043 | (try pt.enumValueFieldIndex(container_layout_ty, @backingInt(layout))).toIntern(), |
| 17044 | // backing_integer: ?type, | 17044 | // backing_integer: ?type, |
| 17045 | backing_integer_val, | 17045 | backing_integer_val, |
| 17046 | 17046 | ||
| ... | @@ -17056,7 +17056,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -17056,7 +17056,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17056 | }; | 17056 | }; |
| 17057 | return Air.internedToRef((try pt.internUnion(.{ | 17057 | return Air.internedToRef((try pt.internUnion(.{ |
| 17058 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(type_struct_ty, &field_values)).toIntern(), | 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,7 +17071,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17071 | }; | 17071 | }; |
| 17072 | return Air.internedToRef((try pt.internUnion(.{ | 17072 | return Air.internedToRef((try pt.internUnion(.{ |
| 17073 | .ty = type_info_ty.toIntern(), | 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 | .val = (try pt.aggregateValue(type_opaque_ty, &field_values)).toIntern(), | 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,7 +17079,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17079 | const spirv_info = ip.loadSpirvType(ty.toIntern()); | 17079 | const spirv_info = ip.loadSpirvType(ty.toIntern()); |
| 17080 | const spirv_union_ty = try sema.getStdLangType(src, .@"Type.Spirv"); | 17080 | const spirv_union_ty = try sema.getStdLangType(src, .@"Type.Spirv"); |
| 17081 | const spirv_tag_ty = spirv_union_ty.unionTagType(zcu).?; | 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 | const spirv_payload_val: Value = switch (spirv_info.flags.tag) { | 17083 | const spirv_payload_val: Value = switch (spirv_info.flags.tag) { |
| 17084 | .sampler => .void, | 17084 | .sampler => .void, |
| 17085 | .sampled_image, .runtime_array => .fromInterned(spirv_info.ty), | 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,14 +17091,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17091 | const depth_ty = try sema.getStdLangType(src, .@"Type.Spirv.Image.Depth"); | 17091 | const depth_ty = try sema.getStdLangType(src, .@"Type.Spirv.Image.Depth"); |
| 17092 | const access_ty = try sema.getStdLangType(src, .@"Type.Spirv.Image.Access"); | 17092 | const access_ty = try sema.getStdLangType(src, .@"Type.Spirv.Image.Access"); |
| 17093 | const usage_tag_ty = usage_union_ty.unionTagType(zcu).?; | 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 | const usage_val = try pt.unionValue(usage_union_ty, usage_tag_val, .fromInterned(spirv_info.ty)); | 17095 | const usage_val = try pt.unionValue(usage_union_ty, usage_tag_val, .fromInterned(spirv_info.ty)); |
| 17096 | const image_field_vals = [_]InternPool.Index{ | 17096 | const image_field_vals = [_]InternPool.Index{ |
| 17097 | usage_val.toIntern(), | 17097 | usage_val.toIntern(), |
| 17098 | (try pt.enumValueFieldIndex(format_ty, @intFromEnum(spirv_info.flags.format))).toIntern(), | 17098 | (try pt.enumValueFieldIndex(format_ty, @backingInt(spirv_info.flags.format))).toIntern(), |
| 17099 | (try pt.enumValueFieldIndex(dim_ty, @intFromEnum(spirv_info.flags.dim))).toIntern(), | 17099 | (try pt.enumValueFieldIndex(dim_ty, @backingInt(spirv_info.flags.dim))).toIntern(), |
| 17100 | (try pt.enumValueFieldIndex(depth_ty, @intFromEnum(spirv_info.flags.depth))).toIntern(), | 17100 | (try pt.enumValueFieldIndex(depth_ty, @backingInt(spirv_info.flags.depth))).toIntern(), |
| 17101 | (try pt.enumValueFieldIndex(access_ty, @intFromEnum(spirv_info.flags.access))).toIntern(), | 17101 | (try pt.enumValueFieldIndex(access_ty, @backingInt(spirv_info.flags.access))).toIntern(), |
| 17102 | Value.makeBool(spirv_info.flags.is_arrayed).toIntern(), | 17102 | Value.makeBool(spirv_info.flags.is_arrayed).toIntern(), |
| 17103 | Value.makeBool(spirv_info.flags.is_multisampled).toIntern(), | 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,7 +17108,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17108 | const spirv_val = try pt.unionValue(spirv_union_ty, spirv_tag_val, spirv_payload_val); | 17108 | const spirv_val = try pt.unionValue(spirv_union_ty, spirv_tag_val, spirv_payload_val); |
| 17109 | return Air.internedToRef((try pt.internUnion(.{ | 17109 | return Air.internedToRef((try pt.internUnion(.{ |
| 17110 | .ty = type_info_ty.toIntern(), | 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 | .val = spirv_val.toIntern(), | 17112 | .val = spirv_val.toIntern(), |
| 17113 | }))); | 17113 | }))); |
| 17114 | }, | 17114 | }, |
| ... | @@ -17214,14 +17214,14 @@ fn typeInfoNamespaceDecls( | ... | @@ -17214,14 +17214,14 @@ fn typeInfoNamespaceDecls( |
| 17214 | fn zirTypeof(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 17214 | fn zirTypeof(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17215 | _ = block; | 17215 | _ = block; |
| 17216 | const zir_datas = sema.code.instructions.items(.data); | 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 | const operand = sema.resolveInst(inst_data.operand); | 17218 | const operand = sema.resolveInst(inst_data.operand); |
| 17219 | const operand_ty = sema.typeOf(operand); | 17219 | const operand_ty = sema.typeOf(operand); |
| 17220 | return Air.internedToRef(operand_ty.toIntern()); | 17220 | return Air.internedToRef(operand_ty.toIntern()); |
| 17221 | } | 17221 | } |
| 17222 | 17222 | ||
| 17223 | fn zirTypeofBuiltin(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const extra = sema.code.extraData(Zir.Inst.Block, pl_node.payload_index); | 17225 | const extra = sema.code.extraData(Zir.Inst.Block, pl_node.payload_index); |
| 17226 | const body = sema.code.bodySlice(extra.end, extra.data.body_len); | 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,7 +17245,7 @@ fn zirTypeofBuiltin(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 17245 | } | 17245 | } |
| 17246 | 17246 | ||
| 17247 | fn zirTypeofLog2IntType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 17249 | const src = block.nodeOffset(inst_data.src_node); |
| 17250 | const operand = sema.resolveInst(inst_data.operand); | 17250 | const operand = sema.resolveInst(inst_data.operand); |
| 17251 | const operand_ty = sema.typeOf(operand); | 17251 | const operand_ty = sema.typeOf(operand); |
| ... | @@ -17324,7 +17324,7 @@ fn zirTypeofPeer( | ... | @@ -17324,7 +17324,7 @@ fn zirTypeofPeer( |
| 17324 | fn zirBoolNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 17324 | fn zirBoolNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17325 | const pt = sema.pt; | 17325 | const pt = sema.pt; |
| 17326 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 17328 | const src = block.nodeOffset(inst_data.src_node); |
| 17329 | const operand_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); | 17329 | const operand_src = block.src(.{ .node_offset_un_op = inst_data.src_node }); |
| 17330 | const uncasted_operand = sema.resolveInst(inst_data.operand); | 17330 | const uncasted_operand = sema.resolveInst(inst_data.operand); |
| ... | @@ -17356,7 +17356,7 @@ fn zirBoolBr( | ... | @@ -17356,7 +17356,7 @@ fn zirBoolBr( |
| 17356 | const gpa = sema.gpa; | 17356 | const gpa = sema.gpa; |
| 17357 | 17357 | ||
| 17358 | const datas = sema.code.instructions.items(.data); | 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 | const extra = sema.code.extraData(Zir.Inst.BoolBr, inst_data.payload_index); | 17360 | const extra = sema.code.extraData(Zir.Inst.BoolBr, inst_data.payload_index); |
| 17361 | 17361 | ||
| 17362 | const uncoerced_lhs = sema.resolveInst(extra.data.lhs); | 17362 | const uncoerced_lhs = sema.resolveInst(extra.data.lhs); |
| ... | @@ -17382,7 +17382,7 @@ fn zirBoolBr( | ... | @@ -17382,7 +17382,7 @@ fn zirBoolBr( |
| 17382 | return sema.coerce(parent_block, .bool, rhs_result, rhs_src); | 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 | try sema.air_instructions.append(gpa, .{ | 17386 | try sema.air_instructions.append(gpa, .{ |
| 17387 | .tag = .block, | 17387 | .tag = .block, |
| 17388 | .data = .{ .ty_pl = .{ | 17388 | .data = .{ .ty_pl = .{ |
| ... | @@ -17484,7 +17484,7 @@ fn finishCondBr( | ... | @@ -17484,7 +17484,7 @@ fn finishCondBr( |
| 17484 | .payload = cond_br_payload, | 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 | Air.Block{ .body_len = @intCast(child_block.instructions.items.len) }, | 17488 | Air.Block{ .body_len = @intCast(child_block.instructions.items.len) }, |
| 17489 | ); | 17489 | ); |
| 17490 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(child_block.instructions.items)); | 17490 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(child_block.instructions.items)); |
| ... | @@ -17517,7 +17517,7 @@ fn zirIsNonNull( | ... | @@ -17517,7 +17517,7 @@ fn zirIsNonNull( |
| 17517 | block: *Block, | 17517 | block: *Block, |
| 17518 | inst: Zir.Inst.Index, | 17518 | inst: Zir.Inst.Index, |
| 17519 | ) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 17521 | const src = block.nodeOffset(inst_data.src_node); |
| 17522 | const operand = sema.resolveInst(inst_data.operand); | 17522 | const operand = sema.resolveInst(inst_data.operand); |
| 17523 | try sema.checkNullableType(block, src, sema.typeOf(operand)); | 17523 | try sema.checkNullableType(block, src, sema.typeOf(operand)); |
| ... | @@ -17531,7 +17531,7 @@ fn zirIsNonNullPtr( | ... | @@ -17531,7 +17531,7 @@ fn zirIsNonNullPtr( |
| 17531 | ) CompileError!Air.Inst.Ref { | 17531 | ) CompileError!Air.Inst.Ref { |
| 17532 | const pt = sema.pt; | 17532 | const pt = sema.pt; |
| 17533 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 17535 | const src = block.nodeOffset(inst_data.src_node); |
| 17536 | const ptr = sema.resolveInst(inst_data.operand); | 17536 | const ptr = sema.resolveInst(inst_data.operand); |
| 17537 | const ptr_ty = sema.typeOf(ptr); | 17537 | const ptr_ty = sema.typeOf(ptr); |
| ... | @@ -17565,7 +17565,7 @@ fn checkErrorType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !void { | ... | @@ -17565,7 +17565,7 @@ fn checkErrorType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !void { |
| 17565 | } | 17565 | } |
| 17566 | 17566 | ||
| 17567 | fn zirIsNonErr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 17569 | const src = block.nodeOffset(inst_data.src_node); |
| 17570 | const operand = sema.resolveInst(inst_data.operand); | 17570 | const operand = sema.resolveInst(inst_data.operand); |
| 17571 | try sema.checkErrorType(block, src, sema.typeOf(operand)); | 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,7 +17575,7 @@ fn zirIsNonErr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17575 | fn zirIsNonErrPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 17575 | fn zirIsNonErrPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 17576 | const pt = sema.pt; | 17576 | const pt = sema.pt; |
| 17577 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 17579 | const src = block.nodeOffset(inst_data.src_node); |
| 17580 | const ptr = sema.resolveInst(inst_data.operand); | 17580 | const ptr = sema.resolveInst(inst_data.operand); |
| 17581 | const ptr_ty = sema.typeOf(ptr); | 17581 | const ptr_ty = sema.typeOf(ptr); |
| ... | @@ -17587,7 +17587,7 @@ fn zirIsNonErrPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -17587,7 +17587,7 @@ fn zirIsNonErrPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 17587 | } | 17587 | } |
| 17588 | 17588 | ||
| 17589 | fn zirRetIsNonErr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 17591 | const src = block.nodeOffset(inst_data.src_node); |
| 17592 | const operand = sema.resolveInst(inst_data.operand); | 17592 | const operand = sema.resolveInst(inst_data.operand); |
| 17593 | return sema.analyzeIsNonErr(block, src, operand); | 17593 | return sema.analyzeIsNonErr(block, src, operand); |
| ... | @@ -17600,7 +17600,7 @@ fn zirCondbr( | ... | @@ -17600,7 +17600,7 @@ fn zirCondbr( |
| 17600 | ) CompileError!void { | 17600 | ) CompileError!void { |
| 17601 | const pt = sema.pt; | 17601 | const pt = sema.pt; |
| 17602 | const zcu = pt.zcu; | 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 | const cond_src = parent_block.src(.{ .node_offset_if_cond = inst_data.src_node }); | 17604 | const cond_src = parent_block.src(.{ .node_offset_if_cond = inst_data.src_node }); |
| 17605 | const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); | 17605 | const extra = sema.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); |
| 17606 | 17606 | ||
| ... | @@ -17640,9 +17640,9 @@ fn zirCondbr( | ... | @@ -17640,9 +17640,9 @@ fn zirCondbr( |
| 17640 | 17640 | ||
| 17641 | const err_cond = blk: { | 17641 | const err_cond = blk: { |
| 17642 | const index = extra.data.condition.toIndex() orelse break :blk null; | 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 | const err_operand = sema.resolveInst(err_inst_data.operand); | 17646 | const err_operand = sema.resolveInst(err_inst_data.operand); |
| 17647 | const operand_ty = sema.typeOf(err_operand); | 17647 | const operand_ty = sema.typeOf(err_operand); |
| 17648 | assert(operand_ty.zigTypeTag(zcu) == .error_union); | 17648 | assert(operand_ty.zigTypeTag(zcu) == .error_union); |
| ... | @@ -17686,7 +17686,7 @@ fn zirCondbr( | ... | @@ -17686,7 +17686,7 @@ fn zirCondbr( |
| 17686 | } | 17686 | } |
| 17687 | 17687 | ||
| 17688 | fn zirTry(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = parent_block.nodeOffset(inst_data.src_node); | 17690 | const src = parent_block.nodeOffset(inst_data.src_node); |
| 17691 | const operand_src = parent_block.src(.{ .node_offset_try_operand = inst_data.src_node }); | 17691 | const operand_src = parent_block.src(.{ .node_offset_try_operand = inst_data.src_node }); |
| 17692 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); | 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,7 +17753,7 @@ fn zirTry(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError! |
| 17753 | } | 17753 | } |
| 17754 | 17754 | ||
| 17755 | fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = parent_block.nodeOffset(inst_data.src_node); | 17757 | const src = parent_block.nodeOffset(inst_data.src_node); |
| 17758 | const operand_src = parent_block.src(.{ .node_offset_try_operand = inst_data.src_node }); | 17758 | const operand_src = parent_block.src(.{ .node_offset_try_operand = inst_data.src_node }); |
| 17759 | const extra = sema.code.extraData(Zir.Inst.Try, inst_data.payload_index); | 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,7 +17835,7 @@ fn ensurePostHoc(sema: *Sema, block: *Block, dest_block: Zir.Inst.Index) !*Label |
| 17835 | 17835 | ||
| 17836 | try sema.post_hoc_blocks.ensureUnusedCapacity(sema.gpa, 1); | 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 | gop.value_ptr.* = new_block_inst.toRef(); | 17839 | gop.value_ptr.* = new_block_inst.toRef(); |
| 17840 | try sema.air_instructions.append(sema.gpa, .{ | 17840 | try sema.air_instructions.append(sema.gpa, .{ |
| 17841 | .tag = .block, | 17841 | .tag = .block, |
| ... | @@ -17889,7 +17889,7 @@ fn addRuntimeBreak(sema: *Sema, child_block: *Block, block_inst: Zir.Inst.Index, | ... | @@ -17889,7 +17889,7 @@ fn addRuntimeBreak(sema: *Sema, child_block: *Block, block_inst: Zir.Inst.Index, |
| 17889 | } | 17889 | } |
| 17890 | 17890 | ||
| 17891 | fn zirUnreachable(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const src = block.nodeOffset(inst_data.src_node); | 17893 | const src = block.nodeOffset(inst_data.src_node); |
| 17894 | 17894 | ||
| 17895 | if (block.isComptime()) { | 17895 | if (block.isComptime()) { |
| ... | @@ -17918,7 +17918,7 @@ fn zirRetErrValue( | ... | @@ -17918,7 +17918,7 @@ fn zirRetErrValue( |
| 17918 | const gpa = comp.gpa; | 17918 | const gpa = comp.gpa; |
| 17919 | const io = comp.io; | 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 | const src = block.tokenOffset(inst_data.src_tok); | 17922 | const src = block.tokenOffset(inst_data.src_tok); |
| 17923 | const err_name = try zcu.intern_pool.getOrPutString( | 17923 | const err_name = try zcu.intern_pool.getOrPutString( |
| 17924 | gpa, | 17924 | gpa, |
| ... | @@ -17944,7 +17944,7 @@ fn zirRetImplicit( | ... | @@ -17944,7 +17944,7 @@ fn zirRetImplicit( |
| 17944 | ) CompileError!void { | 17944 | ) CompileError!void { |
| 17945 | const pt = sema.pt; | 17945 | const pt = sema.pt; |
| 17946 | const zcu = pt.zcu; | 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 | const r_brace_src = block.tokenOffset(inst_data.src_tok); | 17948 | const r_brace_src = block.tokenOffset(inst_data.src_tok); |
| 17949 | if (block.inlining == null and sema.func_is_naked) { | 17949 | if (block.inlining == null and sema.func_is_naked) { |
| 17950 | assert(!block.isComptime()); | 17950 | assert(!block.isComptime()); |
| ... | @@ -17986,7 +17986,7 @@ fn zirRetImplicit( | ... | @@ -17986,7 +17986,7 @@ fn zirRetImplicit( |
| 17986 | } | 17986 | } |
| 17987 | 17987 | ||
| 17988 | fn zirRetNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const operand = sema.resolveInst(inst_data.operand); | 17990 | const operand = sema.resolveInst(inst_data.operand); |
| 17991 | const src = block.nodeOffset(inst_data.src_node); | 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,7 +17994,7 @@ fn zirRetNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!voi |
| 17994 | } | 17994 | } |
| 17995 | 17995 | ||
| 17996 | fn zirRetLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const src = block.nodeOffset(inst_data.src_node); | 17998 | const src = block.nodeOffset(inst_data.src_node); |
| 17999 | const ret_ptr = sema.resolveInst(inst_data.operand); | 17999 | const ret_ptr = sema.resolveInst(inst_data.operand); |
| 18000 | 18000 | ||
| ... | @@ -18053,13 +18053,13 @@ fn maybePushErrorTrace( | ... | @@ -18053,13 +18053,13 @@ fn maybePushErrorTrace( |
| 18053 | err_block.instructions.items.len + 1, // the error branch contains the `returnError` call and a `br` | 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); | 18056 | const block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); |
| 18057 | const cond_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len + 1); | 18057 | const cond_br_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len + 1)); |
| 18058 | const then_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len + 2); | 18058 | const then_br_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len + 2)); |
| 18059 | const else_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len + 3); | 18059 | const else_br_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len + 3)); |
| 18060 | 18060 | ||
| 18061 | const block_payload = sema.addExtraAssumeCapacity(Air.Block{ .body_len = 1 }); | 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 | sema.air_instructions.appendAssumeCapacity(.{ | 18063 | sema.air_instructions.appendAssumeCapacity(.{ |
| 18064 | .tag = .block, | 18064 | .tag = .block, |
| 18065 | .data = .{ .ty_pl = .{ | 18065 | .data = .{ .ty_pl = .{ |
| ... | @@ -18080,9 +18080,9 @@ fn maybePushErrorTrace( | ... | @@ -18080,9 +18080,9 @@ fn maybePushErrorTrace( |
| 18080 | .else_cov = .none, | 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 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(err_block.instructions.items)); | 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 | sema.air_instructions.appendAssumeCapacity(.{ | 18086 | sema.air_instructions.appendAssumeCapacity(.{ |
| 18087 | .tag = .cond_br, | 18087 | .tag = .cond_br, |
| 18088 | .data = .{ .pl_op = .{ | 18088 | .data = .{ .pl_op = .{ |
| ... | @@ -18112,7 +18112,7 @@ fn wantErrorReturnTracing(sema: *Sema) bool { | ... | @@ -18112,7 +18112,7 @@ fn wantErrorReturnTracing(sema: *Sema) bool { |
| 18112 | fn zirSaveErrRetIndex(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 18112 | fn zirSaveErrRetIndex(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| 18113 | const pt = sema.pt; | 18113 | const pt = sema.pt; |
| 18114 | const zcu = pt.zcu; | 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 | if (!block.ownerModule().error_tracing) return; | 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,7 +18306,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18306 | const io = comp.io; | 18306 | const io = comp.io; |
| 18307 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.PtrType, inst_data.payload_index); | 18310 | const extra = sema.code.extraData(Zir.Inst.PtrType, inst_data.payload_index); |
| 18311 | const elem_ty_src = block.src(.{ .node_offset_ptr_elem = extra.data.src_node }); | 18311 | const elem_ty_src = block.src(.{ .node_offset_ptr_elem = extra.data.src_node }); |
| 18312 | const sentinel_src = block.src(.{ .node_offset_ptr_sentinel = extra.data.src_node }); | 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,7 +18335,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18335 | var extra_i = extra.end; | 18335 | var extra_i = extra.end; |
| 18336 | 18336 | ||
| 18337 | const sentinel = if (inst_data.flags.has_sentinel) blk: { | 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 | extra_i += 1; | 18339 | extra_i += 1; |
| 18340 | const coerced = try sema.coerce(block, elem_ty, sema.resolveInst(ref), sentinel_src); | 18340 | const coerced = try sema.coerce(block, elem_ty, sema.resolveInst(ref), sentinel_src); |
| 18341 | const val = try sema.resolveConstDefinedValue(block, sentinel_src, coerced, .{ .simple = .pointer_sentinel }); | 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,7 +18348,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18348 | } else .none; | 18348 | } else .none; |
| 18349 | 18349 | ||
| 18350 | const abi_align: Alignment = if (inst_data.flags.has_align) blk: { | 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 | extra_i += 1; | 18352 | extra_i += 1; |
| 18353 | const coerced = try sema.coerce(block, align_ty, sema.resolveInst(ref), align_src); | 18353 | const coerced = try sema.coerce(block, align_ty, sema.resolveInst(ref), align_src); |
| 18354 | const val = try sema.resolveConstDefinedValue(block, align_src, coerced, .{ .simple = .@"align" }); | 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,20 +18357,20 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18357 | } else .none; | 18357 | } else .none; |
| 18358 | 18358 | ||
| 18359 | const address_space: std.lang.AddressSpace = if (inst_data.flags.has_addrspace) blk: { | 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 | extra_i += 1; | 18361 | extra_i += 1; |
| 18362 | break :blk try sema.resolveAddressSpace(block, addrspace_src, ref, .pointer); | 18362 | break :blk try sema.resolveAddressSpace(block, addrspace_src, ref, .pointer); |
| 18363 | } else if (elem_ty.zigTypeTag(zcu) == .@"fn" and target.cpu.arch == .avr) .flash else .generic; | 18363 | } else if (elem_ty.zigTypeTag(zcu) == .@"fn" and target.cpu.arch == .avr) .flash else .generic; |
| 18364 | 18364 | ||
| 18365 | const bit_offset: u16 = if (inst_data.flags.has_bit_range) blk: { | 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 | extra_i += 1; | 18367 | extra_i += 1; |
| 18368 | const bit_offset = try sema.resolveInt(block, bitoffset_src, ref, .u16, .{ .simple = .type }); | 18368 | const bit_offset = try sema.resolveInt(block, bitoffset_src, ref, .u16, .{ .simple = .type }); |
| 18369 | break :blk @intCast(bit_offset); | 18369 | break :blk @intCast(bit_offset); |
| 18370 | } else 0; | 18370 | } else 0; |
| 18371 | 18371 | ||
| 18372 | const host_size: u16 = if (inst_data.flags.has_bit_range) blk: { | 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 | extra_i += 1; | 18374 | extra_i += 1; |
| 18375 | const host_size = try sema.resolveInt(block, hostsize_src, ref, .u16, .{ .simple = .type }); | 18375 | const host_size = try sema.resolveInt(block, hostsize_src, ref, .u16, .{ .simple = .type }); |
| 18376 | break :blk @intCast(host_size); | 18376 | break :blk @intCast(host_size); |
| ... | @@ -18425,7 +18425,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -18425,7 +18425,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18425 | } | 18425 | } |
| 18426 | 18426 | ||
| 18427 | fn zirStructInitEmpty(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 18429 | const src = block.nodeOffset(inst_data.src_node); |
| 18430 | const ty_src = block.src(.{ .node_offset_init_ty = inst_data.src_node }); | 18430 | const ty_src = block.src(.{ .node_offset_init_ty = inst_data.src_node }); |
| 18431 | const obj_ty = try sema.resolveType(block, ty_src, inst_data.operand); | 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,7 +18445,7 @@ fn zirStructInitEmpty(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE |
| 18445 | fn zirStructInitEmptyResult(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is_byref: bool) CompileError!Air.Inst.Ref { | 18445 | fn zirStructInitEmptyResult(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is_byref: bool) CompileError!Air.Inst.Ref { |
| 18446 | const pt = sema.pt; | 18446 | const pt = sema.pt; |
| 18447 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 18449 | const src = block.nodeOffset(inst_data.src_node); |
| 18450 | 18450 | ||
| 18451 | // Generic poison means this is an untyped anonymous empty struct/array init | 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,7 +18557,7 @@ fn zirUnionInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 18557 | const pt = sema.pt; | 18557 | const pt = sema.pt; |
| 18558 | const zcu = pt.zcu; | 18558 | const zcu = pt.zcu; |
| 18559 | const ip = &zcu.intern_pool; | 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 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 18561 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 18562 | const field_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 18562 | const field_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 18563 | const payload_src = block.builtinCallArgSrc(inst_data.src_node, 2); | 18563 | const payload_src = block.builtinCallArgSrc(inst_data.src_node, 2); |
| ... | @@ -18601,12 +18601,12 @@ fn zirStructInit( | ... | @@ -18601,12 +18601,12 @@ fn zirStructInit( |
| 18601 | const ip = &zcu.intern_pool; | 18601 | const ip = &zcu.intern_pool; |
| 18602 | 18602 | ||
| 18603 | const zir_datas = sema.code.instructions.items(.data); | 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 | const extra = sema.code.extraData(Zir.Inst.StructInit, inst_data.payload_index); | 18605 | const extra = sema.code.extraData(Zir.Inst.StructInit, inst_data.payload_index); |
| 18606 | const src = block.nodeOffset(inst_data.src_node); | 18606 | const src = block.nodeOffset(inst_data.src_node); |
| 18607 | 18607 | ||
| 18608 | const first_item = sema.code.extraData(Zir.Inst.StructInit.Item, extra.end).data; | 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 | const first_field_type_extra = sema.code.extraData(Zir.Inst.FieldType, first_field_type_data.payload_index).data; | 18610 | const first_field_type_extra = sema.code.extraData(Zir.Inst.FieldType, first_field_type_data.payload_index).data; |
| 18611 | const result_ty = try sema.resolveTypeOrPoison(block, src, first_field_type_extra.container_type) orelse { | 18611 | const result_ty = try sema.resolveTypeOrPoison(block, src, first_field_type_extra.container_type) orelse { |
| 18612 | // The type wasn't actually known, so treat this as an anon struct init. | 18612 | // The type wasn't actually known, so treat this as an anon struct init. |
| ... | @@ -18640,7 +18640,7 @@ fn zirStructInit( | ... | @@ -18640,7 +18640,7 @@ fn zirStructInit( |
| 18640 | const item = sema.code.extraData(Zir.Inst.StructInit.Item, extra_index); | 18640 | const item = sema.code.extraData(Zir.Inst.StructInit.Item, extra_index); |
| 18641 | extra_index = item.end; | 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 | const field_src = block.src(.{ .node_offset_initializer = field_type_data.src_node }); | 18644 | const field_src = block.src(.{ .node_offset_initializer = field_type_data.src_node }); |
| 18645 | const field_type_extra = sema.code.extraData(Zir.Inst.FieldType, field_type_data.payload_index).data; | 18645 | const field_type_extra = sema.code.extraData(Zir.Inst.FieldType, field_type_data.payload_index).data; |
| 18646 | const field_name = try ip.getOrPutString( | 18646 | const field_name = try ip.getOrPutString( |
| ... | @@ -18679,7 +18679,7 @@ fn zirStructInit( | ... | @@ -18679,7 +18679,7 @@ fn zirStructInit( |
| 18679 | 18679 | ||
| 18680 | const item = sema.code.extraData(Zir.Inst.StructInit.Item, extra.end); | 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 | const field_src = block.src(.{ .node_offset_initializer = field_type_data.src_node }); | 18683 | const field_src = block.src(.{ .node_offset_initializer = field_type_data.src_node }); |
| 18684 | const field_type_extra = sema.code.extraData(Zir.Inst.FieldType, field_type_data.payload_index).data; | 18684 | const field_type_extra = sema.code.extraData(Zir.Inst.FieldType, field_type_data.payload_index).data; |
| 18685 | const field_name = try ip.getOrPutString( | 18685 | const field_name = try ip.getOrPutString( |
| ... | @@ -18933,7 +18933,7 @@ fn zirStructInitAnon( | ... | @@ -18933,7 +18933,7 @@ fn zirStructInitAnon( |
| 18933 | block: *Block, | 18933 | block: *Block, |
| 18934 | inst: Zir.Inst.Index, | 18934 | inst: Zir.Inst.Index, |
| 18935 | ) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 18937 | const src = block.nodeOffset(inst_data.src_node); |
| 18938 | const extra = sema.code.extraData(Zir.Inst.StructInitAnon, inst_data.payload_index); | 18938 | const extra = sema.code.extraData(Zir.Inst.StructInitAnon, inst_data.payload_index); |
| 18939 | return sema.structInitAnon(block, src, inst, .anon_init, extra.data, extra.end, false); | 18939 | return sema.structInitAnon(block, src, inst, .anon_init, extra.data, extra.end, false); |
| ... | @@ -18984,7 +18984,7 @@ fn structInitAnon( | ... | @@ -18984,7 +18984,7 @@ fn structInitAnon( |
| 18984 | .anon_init => sema.code.nullTerminatedString(item.data.field_name), | 18984 | .anon_init => sema.code.nullTerminatedString(item.data.field_name), |
| 18985 | .typed_init => name: { | 18985 | .typed_init => name: { |
| 18986 | // `item.data.field_type` references a `field_type` instruction | 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 | const field_type_extra = sema.code.extraData(Zir.Inst.FieldType, field_type_data.payload_index); | 18988 | const field_type_extra = sema.code.extraData(Zir.Inst.FieldType, field_type_data.payload_index); |
| 18989 | break :name sema.code.nullTerminatedString(field_type_extra.data.name_start); | 18989 | break :name sema.code.nullTerminatedString(field_type_extra.data.name_start); |
| 18990 | }, | 18990 | }, |
| ... | @@ -19155,7 +19155,7 @@ fn zirArrayInit( | ... | @@ -19155,7 +19155,7 @@ fn zirArrayInit( |
| 19155 | const pt = sema.pt; | 19155 | const pt = sema.pt; |
| 19156 | const zcu = pt.zcu; | 19156 | const zcu = pt.zcu; |
| 19157 | const gpa = sema.gpa; | 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 | const src = block.nodeOffset(inst_data.src_node); | 19159 | const src = block.nodeOffset(inst_data.src_node); |
| 19160 | 19160 | ||
| 19161 | const extra = sema.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); | 19161 | const extra = sema.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| ... | @@ -19286,7 +19286,7 @@ fn zirArrayInitAnon( | ... | @@ -19286,7 +19286,7 @@ fn zirArrayInitAnon( |
| 19286 | block: *Block, | 19286 | block: *Block, |
| 19287 | inst: Zir.Inst.Index, | 19287 | inst: Zir.Inst.Index, |
| 19288 | ) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 19290 | const src = block.nodeOffset(inst_data.src_node); |
| 19291 | const extra = sema.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); | 19291 | const extra = sema.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 19292 | const operands = sema.code.refSlice(extra.end, extra.data.operands_len); | 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,7 +19406,7 @@ fn addConstantMaybeRef(sema: *Sema, val: Value, is_ref: bool) !Air.Inst.Ref { |
| 19406 | } | 19406 | } |
| 19407 | 19407 | ||
| 19408 | fn zirFieldTypeRef(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const extra = sema.code.extraData(Zir.Inst.FieldTypeRef, inst_data.payload_index).data; | 19410 | const extra = sema.code.extraData(Zir.Inst.FieldTypeRef, inst_data.payload_index).data; |
| 19411 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 19411 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19412 | const field_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 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,7 +19424,7 @@ fn zirStructInitFieldType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp |
| 19424 | const io = comp.io; | 19424 | const io = comp.io; |
| 19425 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data; | 19428 | const extra = sema.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data; |
| 19429 | const ty_src = block.nodeOffset(inst_data.src_node); | 19429 | const ty_src = block.nodeOffset(inst_data.src_node); |
| 19430 | const field_name_src = block.src(.{ .node_offset_field_name_init = inst_data.src_node }); | 19430 | const field_name_src = block.src(.{ .node_offset_field_name_init = inst_data.src_node }); |
| ... | @@ -19528,7 +19528,7 @@ fn zirFrame( | ... | @@ -19528,7 +19528,7 @@ fn zirFrame( |
| 19528 | block: *Block, | 19528 | block: *Block, |
| 19529 | extended: Zir.Inst.Extended.InstData, | 19529 | extended: Zir.Inst.Extended.InstData, |
| 19530 | ) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(src_node); | 19532 | const src = block.nodeOffset(src_node); |
| 19533 | return sema.failWithUseOfAsync(block, src); | 19533 | return sema.failWithUseOfAsync(block, src); |
| 19534 | } | 19534 | } |
| ... | @@ -19536,7 +19536,7 @@ fn zirFrame( | ... | @@ -19536,7 +19536,7 @@ fn zirFrame( |
| 19536 | fn zirAlignOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 19536 | fn zirAlignOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 19537 | const pt = sema.pt; | 19537 | const pt = sema.pt; |
| 19538 | const zcu = pt.zcu; | 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 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 19540 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19541 | const ty = try sema.resolveType(block, operand_src, inst_data.operand); | 19541 | const ty = try sema.resolveType(block, operand_src, inst_data.operand); |
| 19542 | try sema.ensureLayoutResolved(ty, operand_src, .align_of); | 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,7 +19549,7 @@ fn zirAlignOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 19549 | fn zirIntFromBool(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 19549 | fn zirIntFromBool(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 19550 | const pt = sema.pt; | 19550 | const pt = sema.pt; |
| 19551 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 19553 | const src = block.nodeOffset(inst_data.src_node); |
| 19554 | const operand = sema.resolveInst(inst_data.operand); | 19554 | const operand = sema.resolveInst(inst_data.operand); |
| 19555 | const operand_ty = sema.typeOf(operand); | 19555 | const operand_ty = sema.typeOf(operand); |
| ... | @@ -19581,7 +19581,7 @@ fn zirIntFromBool(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -19581,7 +19581,7 @@ fn zirIntFromBool(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 19581 | } | 19581 | } |
| 19582 | 19582 | ||
| 19583 | fn zirErrorName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 19585 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19586 | const uncoerced_operand = sema.resolveInst(inst_data.operand); | 19586 | const uncoerced_operand = sema.resolveInst(inst_data.operand); |
| 19587 | const operand = try sema.coerce(block, .anyerror, uncoerced_operand, operand_src); | 19587 | const operand = try sema.coerce(block, .anyerror, uncoerced_operand, operand_src); |
| ... | @@ -19603,7 +19603,7 @@ fn zirAbs( | ... | @@ -19603,7 +19603,7 @@ fn zirAbs( |
| 19603 | ) CompileError!Air.Inst.Ref { | 19603 | ) CompileError!Air.Inst.Ref { |
| 19604 | const pt = sema.pt; | 19604 | const pt = sema.pt; |
| 19605 | const zcu = pt.zcu; | 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 | const operand = sema.resolveInst(inst_data.operand); | 19607 | const operand = sema.resolveInst(inst_data.operand); |
| 19608 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 19608 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19609 | const operand_ty = sema.typeOf(operand); | 19609 | const operand_ty = sema.typeOf(operand); |
| ... | @@ -19694,7 +19694,7 @@ fn zirUnaryMath( | ... | @@ -19694,7 +19694,7 @@ fn zirUnaryMath( |
| 19694 | air_tag: Air.Inst.Tag, | 19694 | air_tag: Air.Inst.Tag, |
| 19695 | comptime eval: fn (Value, Type, Allocator, Zcu.PerThread) Allocator.Error!Value, | 19695 | comptime eval: fn (Value, Type, Allocator, Zcu.PerThread) Allocator.Error!Value, |
| 19696 | ) CompileError!Air.Inst.Ref { | 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 | const operand = sema.resolveInst(inst_data.operand); | 19698 | const operand = sema.resolveInst(inst_data.operand); |
| 19699 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 19699 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19700 | 19700 | ||
| ... | @@ -19702,7 +19702,7 @@ fn zirUnaryMath( | ... | @@ -19702,7 +19702,7 @@ fn zirUnaryMath( |
| 19702 | } | 19702 | } |
| 19703 | 19703 | ||
| 19704 | fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 19706 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19707 | const src = block.nodeOffset(inst_data.src_node); | 19707 | const src = block.nodeOffset(inst_data.src_node); |
| 19708 | const operand = sema.resolveInst(inst_data.operand); | 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,7 +19752,7 @@ fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 19752 | } | 19752 | } |
| 19753 | 19753 | ||
| 19754 | fn zirReifyInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const signedness_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 19756 | const signedness_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 19757 | const bits_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 19757 | const bits_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 19758 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 19758 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | @@ -19773,7 +19773,7 @@ fn zirReifySliceArgTy( | ... | @@ -19773,7 +19773,7 @@ fn zirReifySliceArgTy( |
| 19773 | const zcu = pt.zcu; | 19773 | const zcu = pt.zcu; |
| 19774 | 19774 | ||
| 19775 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 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 | const src = block.nodeOffset(extra.node); | 19778 | const src = block.nodeOffset(extra.node); |
| 19779 | 19779 | ||
| ... | @@ -20090,7 +20090,7 @@ fn zirReifyStruct( | ... | @@ -20090,7 +20090,7 @@ fn zirReifyStruct( |
| 20090 | const io = comp.io; | 20090 | const io = comp.io; |
| 20091 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.ReifyStruct, extended.operand).data; | 20094 | const extra = sema.code.extraData(Zir.Inst.ReifyStruct, extended.operand).data; |
| 20095 | const tracked_inst = try block.trackZir(inst); | 20095 | const tracked_inst = try block.trackZir(inst); |
| 20096 | 20096 | ||
| ... | @@ -20371,7 +20371,7 @@ fn zirReifyUnion( | ... | @@ -20371,7 +20371,7 @@ fn zirReifyUnion( |
| 20371 | const io = comp.io; | 20371 | const io = comp.io; |
| 20372 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.ReifyUnion, extended.operand).data; | 20375 | const extra = sema.code.extraData(Zir.Inst.ReifyUnion, extended.operand).data; |
| 20376 | const tracked_inst = try block.trackZir(inst); | 20376 | const tracked_inst = try block.trackZir(inst); |
| 20377 | const src: LazySrcLoc = .{ | 20377 | const src: LazySrcLoc = .{ |
| ... | @@ -20592,7 +20592,7 @@ fn zirReifyEnum( | ... | @@ -20592,7 +20592,7 @@ fn zirReifyEnum( |
| 20592 | const io = comp.io; | 20592 | const io = comp.io; |
| 20593 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.ReifyEnum, extended.operand).data; | 20596 | const extra = sema.code.extraData(Zir.Inst.ReifyEnum, extended.operand).data; |
| 20597 | const tracked_inst = try block.trackZir(inst); | 20597 | const tracked_inst = try block.trackZir(inst); |
| 20598 | const src: LazySrcLoc = .{ | 20598 | const src: LazySrcLoc = .{ |
| ... | @@ -21053,7 +21053,7 @@ fn zirCVaEnd(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) C | ... | @@ -21053,7 +21053,7 @@ fn zirCVaEnd(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) C |
| 21053 | } | 21053 | } |
| 21054 | 21054 | ||
| 21055 | fn zirCVaStart(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(src_node); | 21057 | const src = block.nodeOffset(src_node); |
| 21058 | 21058 | ||
| 21059 | const va_list_ty = try sema.getStdLangType(src, .VaList); | 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,7 +21072,7 @@ fn zirTypeName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 21072 | const io = comp.io; | 21072 | const io = comp.io; |
| 21073 | const ip = &zcu.intern_pool; | 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 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 21076 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 21077 | const ty = try sema.resolveType(block, ty_src, inst_data.operand); | 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,7 +21081,7 @@ fn zirTypeName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 21081 | } | 21081 | } |
| 21082 | 21082 | ||
| 21083 | fn zirFrameType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 21085 | const src = block.nodeOffset(inst_data.src_node); |
| 21086 | return sema.failWithUseOfAsync(block, src); | 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,7 +21089,7 @@ fn zirFrameType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 21089 | fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 21089 | fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 21090 | const pt = sema.pt; | 21090 | const pt = sema.pt; |
| 21091 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 21093 | const src = block.nodeOffset(inst_data.src_node); |
| 21094 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 21094 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 21095 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 21095 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | @@ -21152,7 +21152,7 @@ fn zirRoundCast( | ... | @@ -21152,7 +21152,7 @@ fn zirRoundCast( |
| 21152 | 21152 | ||
| 21153 | const operand = sema.resolveInst(extra.rhs); | 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 | const mode: IntFromFloatMode = switch (round_op) { | 21156 | const mode: IntFromFloatMode = switch (round_op) { |
| 21157 | .round => .round, | 21157 | .round => .round, |
| 21158 | .floor => .floor, | 21158 | .floor => .floor, |
| ... | @@ -21266,7 +21266,7 @@ fn zirRoundCast( | ... | @@ -21266,7 +21266,7 @@ fn zirRoundCast( |
| 21266 | fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 21266 | fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 21267 | const pt = sema.pt; | 21267 | const pt = sema.pt; |
| 21268 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 21270 | const src = block.nodeOffset(inst_data.src_node); |
| 21271 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 21271 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 21272 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 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,7 +21308,7 @@ fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 21308 | fn zirPtrFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 21308 | fn zirPtrFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 21309 | const pt = sema.pt; | 21309 | const pt = sema.pt; |
| 21310 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 21312 | const src = block.nodeOffset(inst_data.src_node); |
| 21313 | 21313 | ||
| 21314 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 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,7 +21635,7 @@ fn zirPtrCastFull(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDa |
| 21635 | } | 21635 | } |
| 21636 | 21636 | ||
| 21637 | fn zirPtrCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 21639 | const src = block.nodeOffset(inst_data.src_node); |
| 21640 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 21640 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 21641 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 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,7 +22336,7 @@ fn zirPtrCastNoDest(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Inst |
| 22336 | fn zirTruncate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 22336 | fn zirTruncate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 22337 | const pt = sema.pt; | 22337 | const pt = sema.pt; |
| 22338 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 22340 | const src = block.nodeOffset(inst_data.src_node); |
| 22341 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 22341 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 22342 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 22342 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | @@ -22391,7 +22391,7 @@ fn zirBitCount( | ... | @@ -22391,7 +22391,7 @@ fn zirBitCount( |
| 22391 | ) CompileError!Air.Inst.Ref { | 22391 | ) CompileError!Air.Inst.Ref { |
| 22392 | const pt = sema.pt; | 22392 | const pt = sema.pt; |
| 22393 | const zcu = pt.zcu; | 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 | const src = block.nodeOffset(inst_data.src_node); | 22395 | const src = block.nodeOffset(inst_data.src_node); |
| 22396 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 22396 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 22397 | const operand = sema.resolveInst(inst_data.operand); | 22397 | const operand = sema.resolveInst(inst_data.operand); |
| ... | @@ -22439,7 +22439,7 @@ fn zirBitCount( | ... | @@ -22439,7 +22439,7 @@ fn zirBitCount( |
| 22439 | fn zirByteSwap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 22439 | fn zirByteSwap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 22440 | const pt = sema.pt; | 22440 | const pt = sema.pt; |
| 22441 | const zcu = pt.zcu; | 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 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 22443 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 22444 | const operand = sema.resolveInst(inst_data.operand); | 22444 | const operand = sema.resolveInst(inst_data.operand); |
| 22445 | const operand_ty = sema.typeOf(operand); | 22445 | const operand_ty = sema.typeOf(operand); |
| ... | @@ -22460,7 +22460,7 @@ fn zirByteSwap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -22460,7 +22460,7 @@ fn zirByteSwap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 22460 | } | 22460 | } |
| 22461 | 22461 | ||
| 22462 | fn zirBitReverse(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 22464 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 22465 | const operand = sema.resolveInst(inst_data.operand); | 22465 | const operand = sema.resolveInst(inst_data.operand); |
| 22466 | const operand_ty = sema.typeOf(operand); | 22466 | const operand_ty = sema.typeOf(operand); |
| ... | @@ -22484,7 +22484,7 @@ fn zirOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -22484,7 +22484,7 @@ fn zirOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 22484 | } | 22484 | } |
| 22485 | 22485 | ||
| 22486 | fn bitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!u64 { | 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 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); | 22488 | const src = block.src(.{ .node_offset_bin_op = inst_data.src_node }); |
| 22489 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 22489 | const ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 22490 | const field_name_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 22490 | const field_name_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| ... | @@ -23099,13 +23099,13 @@ fn zirCmpxchg( | ... | @@ -23099,13 +23099,13 @@ fn zirCmpxchg( |
| 23099 | const success_order = try sema.resolveAtomicOrder(block, success_order_src, extra.success_order, .{ .simple = .atomic_order }); | 23099 | const success_order = try sema.resolveAtomicOrder(block, success_order_src, extra.success_order, .{ .simple = .atomic_order }); |
| 23100 | const failure_order = try sema.resolveAtomicOrder(block, failure_order_src, extra.failure_order, .{ .simple = .atomic_order }); | 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 | return sema.fail(block, success_order_src, "success atomic ordering must be monotonic or stricter", .{}); | 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 | return sema.fail(block, failure_order_src, "failure atomic ordering must be monotonic or stricter", .{}); | 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 | return sema.fail(block, failure_order_src, "failure atomic ordering must be no stricter than success", .{}); | 23109 | return sema.fail(block, failure_order_src, "failure atomic ordering must be no stricter than success", .{}); |
| 23110 | } | 23110 | } |
| 23111 | if (failure_order == .release or failure_order == .acq_rel) { | 23111 | if (failure_order == .release or failure_order == .acq_rel) { |
| ... | @@ -23141,8 +23141,8 @@ fn zirCmpxchg( | ... | @@ -23141,8 +23141,8 @@ fn zirCmpxchg( |
| 23141 | } else break :rs expected_src; | 23141 | } else break :rs expected_src; |
| 23142 | } else ptr_src; | 23142 | } else ptr_src; |
| 23143 | 23143 | ||
| 23144 | const flags: u32 = @as(u32, @intFromEnum(success_order)) | | 23144 | const flags: u32 = @as(u32, @backingInt(success_order)) | |
| 23145 | (@as(u32, @intFromEnum(failure_order)) << 3); | 23145 | (@as(u32, @backingInt(failure_order)) << 3); |
| 23146 | 23146 | ||
| 23147 | try sema.requireRuntimeBlock(block, src, runtime_src); | 23147 | try sema.requireRuntimeBlock(block, src, runtime_src); |
| 23148 | return block.addInst(.{ | 23148 | return block.addInst(.{ |
| ... | @@ -23162,7 +23162,7 @@ fn zirCmpxchg( | ... | @@ -23162,7 +23162,7 @@ fn zirCmpxchg( |
| 23162 | fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 23162 | fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 23163 | const pt = sema.pt; | 23163 | const pt = sema.pt; |
| 23164 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 23166 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 23167 | const src = block.nodeOffset(inst_data.src_node); | 23167 | const src = block.nodeOffset(inst_data.src_node); |
| 23168 | const scalar_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 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,7 +23214,7 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 23214 | } | 23214 | } |
| 23215 | 23215 | ||
| 23216 | fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 23218 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 23219 | const op_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 23219 | const op_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 23220 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 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,7 +23282,7 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 23282 | fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 23282 | fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 23283 | const pt = sema.pt; | 23283 | const pt = sema.pt; |
| 23284 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.Shuffle, inst_data.payload_index).data; | 23286 | const extra = sema.code.extraData(Zir.Inst.Shuffle, inst_data.payload_index).data; |
| 23287 | const elem_ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 23287 | const elem_ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 23288 | const mask_src = block.builtinCallArgSrc(inst_data.src_node, 3); | 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,7 +23564,7 @@ fn zirSelect(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) C |
| 23564 | } | 23564 | } |
| 23565 | 23565 | ||
| 23566 | fn zirAtomicLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const extra = sema.code.extraData(Zir.Inst.AtomicLoad, inst_data.payload_index).data; | 23568 | const extra = sema.code.extraData(Zir.Inst.AtomicLoad, inst_data.payload_index).data; |
| 23569 | // zig fmt: off | 23569 | // zig fmt: off |
| 23570 | const elem_ty_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 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,7 +23611,7 @@ fn zirAtomicLoad(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError! |
| 23611 | fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 23611 | fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 23612 | const pt = sema.pt; | 23612 | const pt = sema.pt; |
| 23613 | const zcu = pt.zcu; | 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 | const extra = sema.code.extraData(Zir.Inst.AtomicRmw, inst_data.payload_index).data; | 23615 | const extra = sema.code.extraData(Zir.Inst.AtomicRmw, inst_data.payload_index).data; |
| 23616 | const src = block.nodeOffset(inst_data.src_node); | 23616 | const src = block.nodeOffset(inst_data.src_node); |
| 23617 | // zig fmt: off | 23617 | // zig fmt: off |
| ... | @@ -23676,7 +23676,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -23676,7 +23676,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 23676 | } else break :rs ptr_src; | 23676 | } else break :rs ptr_src; |
| 23677 | } else ptr_src; | 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 | try sema.requireRuntimeBlock(block, src, runtime_src); | 23681 | try sema.requireRuntimeBlock(block, src, runtime_src); |
| 23682 | return block.addInst(.{ | 23682 | return block.addInst(.{ |
| ... | @@ -23692,7 +23692,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -23692,7 +23692,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 23692 | } | 23692 | } |
| 23693 | 23693 | ||
| 23694 | fn zirAtomicStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 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 | const extra = sema.code.extraData(Zir.Inst.AtomicStore, inst_data.payload_index).data; | 23696 | const extra = sema.code.extraData(Zir.Inst.AtomicStore, inst_data.payload_index).data; |
| 23697 | const src = block.nodeOffset(inst_data.src_node); | 23697 | const src = block.nodeOffset(inst_data.src_node); |
| 23698 | // zig fmt: off | 23698 | // zig fmt: off |
| ... | @@ -23726,7 +23726,7 @@ fn zirAtomicStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -23726,7 +23726,7 @@ fn zirAtomicStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 23726 | } | 23726 | } |
| 23727 | 23727 | ||
| 23728 | fn zirMulAdd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const extra = sema.code.extraData(Zir.Inst.MulAdd, inst_data.payload_index).data; | 23730 | const extra = sema.code.extraData(Zir.Inst.MulAdd, inst_data.payload_index).data; |
| 23731 | const src = block.nodeOffset(inst_data.src_node); | 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,7 +23793,7 @@ fn zirMulAdd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 23793 | fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 23793 | fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 23794 | const pt = sema.pt; | 23794 | const pt = sema.pt; |
| 23795 | const zcu = pt.zcu; | 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 | const modifier_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 23797 | const modifier_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 23798 | const func_src = block.builtinCallArgSrc(inst_data.src_node, 1); | 23798 | const func_src = block.builtinCallArgSrc(inst_data.src_node, 1); |
| 23799 | const args_src = block.builtinCallArgSrc(inst_data.src_node, 2); | 23799 | const args_src = block.builtinCallArgSrc(inst_data.src_node, 2); |
| ... | @@ -24081,7 +24081,7 @@ fn zirMinMax( | ... | @@ -24081,7 +24081,7 @@ fn zirMinMax( |
| 24081 | inst: Zir.Inst.Index, | 24081 | inst: Zir.Inst.Index, |
| 24082 | comptime air_tag: Air.Inst.Tag, | 24082 | comptime air_tag: Air.Inst.Tag, |
| 24083 | ) CompileError!Air.Inst.Ref { | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 24085 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 24086 | const src = block.nodeOffset(inst_data.src_node); | 24086 | const src = block.nodeOffset(inst_data.src_node); |
| 24087 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 24087 | const lhs_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| ... | @@ -24262,10 +24262,10 @@ fn analyzeMinMax( | ... | @@ -24262,10 +24262,10 @@ fn analyzeMinMax( |
| 24262 | }, | 24262 | }, |
| 24263 | else => unreachable, | 24263 | else => unreachable, |
| 24264 | }; | 24264 | }; |
| 24265 | if (@intFromEnum(want_strat) < @intFromEnum(cur_strat)) { | 24265 | if (@backingInt(want_strat) < @backingInt(cur_strat)) { |
| 24266 | // `want_strat` overrides `cur_strat`. | 24266 | // `want_strat` overrides `cur_strat`. |
| 24267 | cur_strat = want_strat; | 24267 | cur_strat = want_strat; |
| 24268 | } else if (@intFromEnum(want_strat) == @intFromEnum(cur_strat)) { | 24268 | } else if (@backingInt(want_strat) == @backingInt(cur_strat)) { |
| 24269 | // The behavior depends on the tag. | 24269 | // The behavior depends on the tag. |
| 24270 | switch (cur_strat) { | 24270 | switch (cur_strat) { |
| 24271 | .none, .comptime_float => {}, // no payload, so nop | 24271 | .none, .comptime_float => {}, // no payload, so nop |
| ... | @@ -24470,7 +24470,7 @@ fn zirMemcpy( | ... | @@ -24470,7 +24470,7 @@ fn zirMemcpy( |
| 24470 | air_tag: Air.Inst.Tag, | 24470 | air_tag: Air.Inst.Tag, |
| 24471 | check_aliasing: bool, | 24471 | check_aliasing: bool, |
| 24472 | ) CompileError!void { | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 24474 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 24475 | const src = block.nodeOffset(inst_data.src_node); | 24475 | const src = block.nodeOffset(inst_data.src_node); |
| 24476 | const dest_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 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,7 +24734,7 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 24734 | const io = comp.io; | 24734 | const io = comp.io; |
| 24735 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 24738 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 24739 | const src = block.nodeOffset(inst_data.src_node); | 24739 | const src = block.nodeOffset(inst_data.src_node); |
| 24740 | const dest_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 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,7 +24830,7 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void |
| 24830 | } | 24830 | } |
| 24831 | 24831 | ||
| 24832 | fn zirResume(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 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 | const src = block.nodeOffset(inst_data.src_node); | 24834 | const src = block.nodeOffset(inst_data.src_node); |
| 24835 | return sema.failWithUseOfAsync(block, src); | 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,7 +24843,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 24843 | const io = comp.io; | 24843 | const io = comp.io; |
| 24844 | const ip = &zcu.intern_pool; | 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 | const extra = sema.code.extraData(Zir.Inst.FuncFancy, inst_data.payload_index); | 24847 | const extra = sema.code.extraData(Zir.Inst.FuncFancy, inst_data.payload_index); |
| 24848 | const target = zcu.getTarget(); | 24848 | const target = zcu.getTarget(); |
| 24849 | 24849 | ||
| ... | @@ -24863,7 +24863,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -24863,7 +24863,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 24863 | const val = try sema.resolveGenericBody(block, cc_src, body, inst, cc_ty, .{ .simple = .@"callconv" }); | 24863 | const val = try sema.resolveGenericBody(block, cc_src, body, inst, cc_ty, .{ .simple = .@"callconv" }); |
| 24864 | break :blk try sema.analyzeValueAsCallconv(block, cc_src, val); | 24864 | break :blk try sema.analyzeValueAsCallconv(block, cc_src, val); |
| 24865 | } else if (extra.data.bits.has_cc_ref) blk: { | 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 | extra_index += 1; | 24867 | extra_index += 1; |
| 24868 | const cc_ty = try sema.getStdLangType(cc_src, .CallingConvention); | 24868 | const cc_ty = try sema.getStdLangType(cc_src, .CallingConvention); |
| 24869 | const uncoerced_cc = sema.resolveInst(cc_ref); | 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,7 +24907,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 24907 | const ty = val.toType(); | 24907 | const ty = val.toType(); |
| 24908 | break :blk ty; | 24908 | break :blk ty; |
| 24909 | } else if (extra.data.bits.has_ret_ty_ref) blk: { | 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 | extra_index += 1; | 24911 | extra_index += 1; |
| 24912 | if (extra.data.bits.ret_ty_is_generic) break :blk .generic_poison; | 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,9 +25330,9 @@ fn zirStdLangValue(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstD |
| 25330 | const io = comp.io; | 25330 | const io = comp.io; |
| 25331 | const ip = &zcu.intern_pool; | 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 | const src = block.nodeOffset(src_node); | 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 | const std_lang_type: Zcu.StdLangDecl = switch (value) { | 25337 | const std_lang_type: Zcu.StdLangDecl = switch (value) { |
| 25338 | // zig fmt: off | 25338 | // zig fmt: off |
| ... | @@ -25387,10 +25387,10 @@ fn zirInplaceArithResultTy(sema: *Sema, extended: Zir.Inst.Extended.InstData) Co | ... | @@ -25387,10 +25387,10 @@ fn zirInplaceArithResultTy(sema: *Sema, extended: Zir.Inst.Extended.InstData) Co |
| 25387 | const pt = sema.pt; | 25387 | const pt = sema.pt; |
| 25388 | const zcu = pt.zcu; | 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 | const lhs_ty = sema.typeOf(lhs); | 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 | const ty: Type = switch (op) { | 25394 | const ty: Type = switch (op) { |
| 25395 | .add_eq => ty: { | 25395 | .add_eq => ty: { |
| 25396 | const ptr_size = lhs_ty.ptrSizeOrNull(zcu) orelse break :ty lhs_ty; | 25396 | const ptr_size = lhs_ty.ptrSizeOrNull(zcu) orelse break :ty lhs_ty; |
| ... | @@ -25840,9 +25840,9 @@ fn addSafetyCheckExtra( | ... | @@ -25840,9 +25840,9 @@ fn addSafetyCheckExtra( |
| 25840 | fail_block.instructions.items.len); | 25840 | fail_block.instructions.items.len); |
| 25841 | 25841 | ||
| 25842 | try sema.air_instructions.ensureUnusedCapacity(gpa, 3); | 25842 | try sema.air_instructions.ensureUnusedCapacity(gpa, 3); |
| 25843 | const block_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len); | 25843 | const block_inst: Air.Inst.Index = @fromBackingInt(@intCast(sema.air_instructions.len)); |
| 25844 | const cond_br_inst: Air.Inst.Index = @enumFromInt(@intFromEnum(block_inst) + 1); | 25844 | const cond_br_inst: Air.Inst.Index = @fromBackingInt(@intCast(@backingInt(block_inst) + 1)); |
| 25845 | const br_inst: Air.Inst.Index = @enumFromInt(@intFromEnum(cond_br_inst) + 1); | 25845 | const br_inst: Air.Inst.Index = @fromBackingInt(@intCast(@backingInt(cond_br_inst) + 1)); |
| 25846 | sema.air_instructions.appendAssumeCapacity(.{ | 25846 | sema.air_instructions.appendAssumeCapacity(.{ |
| 25847 | .tag = .block, | 25847 | .tag = .block, |
| 25848 | .data = .{ .ty_pl = .{ | 25848 | .data = .{ .ty_pl = .{ |
| ... | @@ -25852,7 +25852,7 @@ fn addSafetyCheckExtra( | ... | @@ -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 | sema.air_instructions.appendAssumeCapacity(.{ | 25857 | sema.air_instructions.appendAssumeCapacity(.{ |
| 25858 | .tag = .cond_br, | 25858 | .tag = .cond_br, |
| ... | @@ -25874,7 +25874,7 @@ fn addSafetyCheckExtra( | ... | @@ -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 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(fail_block.instructions.items)); | 25878 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(fail_block.instructions.items)); |
| 25879 | 25879 | ||
| 25880 | sema.air_instructions.appendAssumeCapacity(.{ | 25880 | sema.air_instructions.appendAssumeCapacity(.{ |
| ... | @@ -26313,8 +26313,8 @@ fn analyzeSpirvRuntimeArrayLen( | ... | @@ -26313,8 +26313,8 @@ fn analyzeSpirvRuntimeArrayLen( |
| 26313 | 26313 | ||
| 26314 | const struct_operand: Air.Inst.Ref, const field_index: u32 = sf: { | 26314 | const struct_operand: Air.Inst.Ref, const field_index: u32 = sf: { |
| 26315 | if (runtime_array_ptr.toIndex()) |inst| { | 26315 | if (runtime_array_ptr.toIndex()) |inst| { |
| 26316 | const tag = sema.air_instructions.items(.tag)[@intFromEnum(inst)]; | 26316 | const tag = sema.air_instructions.items(.tag)[@backingInt(inst)]; |
| 26317 | const data = sema.air_instructions.items(.data)[@intFromEnum(inst)]; | 26317 | const data = sema.air_instructions.items(.data)[@backingInt(inst)]; |
| 26318 | switch (tag) { | 26318 | switch (tag) { |
| 26319 | .struct_field_ptr => { | 26319 | .struct_field_ptr => { |
| 26320 | const extra = sema.getTmpAir().extraData(Air.StructField, data.ty_pl.payload).data; | 26320 | const extra = sema.getTmpAir().extraData(Air.StructField, data.ty_pl.payload).data; |
| ... | @@ -27592,7 +27592,7 @@ fn elemPtrVector( | ... | @@ -27592,7 +27592,7 @@ fn elemPtrVector( |
| 27592 | .is_volatile = vector_ptr_info.flags.is_volatile, | 27592 | .is_volatile = vector_ptr_info.flags.is_volatile, |
| 27593 | .is_allowzero = vector_ptr_info.flags.is_allowzero, | 27593 | .is_allowzero = vector_ptr_info.flags.is_allowzero, |
| 27594 | .address_space = vector_ptr_info.flags.address_space, | 27594 | .address_space = vector_ptr_info.flags.address_space, |
| 27595 | .vector_index = @enumFromInt(index), | 27595 | .vector_index = @fromBackingInt(@intCast(index)), |
| 27596 | }, | 27596 | }, |
| 27597 | .packed_offset = .{ | 27597 | .packed_offset = .{ |
| 27598 | .host_size = @intCast(vector_len), | 27598 | .host_size = @intCast(vector_len), |
| ... | @@ -29754,7 +29754,7 @@ fn storePtr2( | ... | @@ -29754,7 +29754,7 @@ fn storePtr2( |
| 29754 | /// Handles calling `validateRuntimeValue` if the store is runtime for any reason. | 29754 | /// Handles calling `validateRuntimeValue` if the store is runtime for any reason. |
| 29755 | fn checkComptimeKnownStore(sema: *Sema, block: *Block, store_inst_ref: Air.Inst.Ref, store_src: LazySrcLoc) !void { | 29755 | fn checkComptimeKnownStore(sema: *Sema, block: *Block, store_inst_ref: Air.Inst.Ref, store_src: LazySrcLoc) !void { |
| 29756 | const store_inst = store_inst_ref.toIndex().?; | 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 | const ptr = inst_data.lhs.toIndex() orelse return; | 29758 | const ptr = inst_data.lhs.toIndex() orelse return; |
| 29759 | const operand = inst_data.rhs; | 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,7 +29788,7 @@ fn checkKnownAllocPtr(sema: *Sema, block: *Block, base_ptr: Air.Inst.Ref, new_pt |
| 29788 | const alloc_inst = sema.base_allocs.get(base_ptr_inst) orelse return; | 29788 | const alloc_inst = sema.base_allocs.get(base_ptr_inst) orelse return; |
| 29789 | try sema.base_allocs.put(sema.gpa, new_ptr_inst, alloc_inst); | 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 | .optional_payload_ptr_set, .errunion_payload_ptr_set => { | 29792 | .optional_payload_ptr_set, .errunion_payload_ptr_set => { |
| 29793 | const maybe_comptime_alloc = sema.maybe_comptime_allocs.getPtr(alloc_inst) orelse return; | 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,7 +29805,7 @@ fn checkKnownAllocPtr(sema: *Sema, block: *Block, base_ptr: Air.Inst.Ref, new_pt |
| 29805 | }, | 29805 | }, |
| 29806 | .ptr_elem_ptr => { | 29806 | .ptr_elem_ptr => { |
| 29807 | const tmp_air = sema.getTmpAir(); | 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 | const bin = tmp_air.extraData(Air.Bin, pl_idx).data; | 29809 | const bin = tmp_air.extraData(Air.Bin, pl_idx).data; |
| 29810 | const index_ref = bin.rhs; | 29810 | const index_ref = bin.rhs; |
| 29811 | 29811 | ||
| ... | @@ -29826,12 +29826,12 @@ fn markMaybeComptimeAllocRuntime(sema: *Sema, block: *Block, alloc_inst: Air.Ins | ... | @@ -29826,12 +29826,12 @@ fn markMaybeComptimeAllocRuntime(sema: *Sema, block: *Block, alloc_inst: Air.Ins |
| 29826 | const slice = maybe_comptime_alloc.stores.slice(); | 29826 | const slice = maybe_comptime_alloc.stores.slice(); |
| 29827 | for (slice.items(.inst), slice.items(.src)) |other_inst, other_src| { | 29827 | for (slice.items(.inst), slice.items(.src)) |other_inst, other_src| { |
| 29828 | if (other_src.offset == .unneeded) { | 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 | .set_union_tag, .optional_payload_ptr_set, .errunion_payload_ptr_set => continue, | 29830 | .set_union_tag, .optional_payload_ptr_set, .errunion_payload_ptr_set => continue, |
| 29831 | else => unreachable, // assertion failure | 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 | const other_operand = other_data.rhs; | 29835 | const other_operand = other_data.rhs; |
| 29836 | try sema.validateRuntimeValue(block, other_src, other_operand); | 29836 | try sema.validateRuntimeValue(block, other_src, other_operand); |
| 29837 | } | 29837 | } |
| ... | @@ -32174,7 +32174,7 @@ const PeerResolveStrategy = enum { | ... | @@ -32174,7 +32174,7 @@ const PeerResolveStrategy = enum { |
| 32174 | // Our merging should be order-independent. Thus, even though the union order is arbitrary, | 32174 | // Our merging should be order-independent. Thus, even though the union order is arbitrary, |
| 32175 | // by sorting the tags and switching first on the smaller, we have half as many cases to | 32175 | // by sorting the tags and switching first on the smaller, we have half as many cases to |
| 32176 | // worry about (since we avoid the duplicates). | 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 | const s0 = if (s0_is_a) a else b; | 32178 | const s0 = if (s0_is_a) a else b; |
| 32179 | const s1 = if (s0_is_a) b else a; | 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,7 +33839,7 @@ fn payloadToExtraItems(data: anytype) [@typeInfo(@TypeOf(data)).@"struct".field_ |
| 33839 | val.* = switch (field_type) { | 33839 | val.* = switch (field_type) { |
| 33840 | u32 => @field(data, field_name), | 33840 | u32 => @field(data, field_name), |
| 33841 | i32, Air.CondBr.BranchHints, Air.Asm.Flags => @bitCast(@field(data, field_name)), | 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 | else => @compileError("bad field type: " ++ @typeName(field_type)), | 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,8 +33853,8 @@ fn appendRefsAssumeCapacity(sema: *Sema, refs: []const Air.Inst.Ref) void { |
| 33853 | fn getBreakBlock(sema: *Sema, inst_index: Air.Inst.Index) ?Air.Inst.Index { | 33853 | fn getBreakBlock(sema: *Sema, inst_index: Air.Inst.Index) ?Air.Inst.Index { |
| 33854 | const air_datas = sema.air_instructions.items(.data); | 33854 | const air_datas = sema.air_instructions.items(.data); |
| 33855 | const air_tags = sema.air_instructions.items(.tag); | 33855 | const air_tags = sema.air_instructions.items(.tag); |
| 33856 | switch (air_tags[@intFromEnum(inst_index)]) { | 33856 | switch (air_tags[@backingInt(inst_index)]) { |
| 33857 | .br => return air_datas[@intFromEnum(inst_index)].br.block_inst, | 33857 | .br => return air_datas[@backingInt(inst_index)].br.block_inst, |
| 33858 | else => return null, | 33858 | else => return null, |
| 33859 | } | 33859 | } |
| 33860 | } | 33860 | } |
| ... | @@ -34596,7 +34596,7 @@ pub fn flushExports(sema: *Sema) !void { | ... | @@ -34596,7 +34596,7 @@ pub fn flushExports(sema: *Sema) !void { |
| 34596 | try zcu.single_exports.ensureUnusedCapacity(gpa, 1); | 34596 | try zcu.single_exports.ensureUnusedCapacity(gpa, 1); |
| 34597 | const export_idx: Zcu.Export.Index = zcu.free_exports.pop() orelse idx: { | 34597 | const export_idx: Zcu.Export.Index = zcu.free_exports.pop() orelse idx: { |
| 34598 | _ = try zcu.all_exports.addOne(gpa); | 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 | export_idx.ptr(zcu).* = sema.exports.items[0]; | 34601 | export_idx.ptr(zcu).* = sema.exports.items[0]; |
| 34602 | zcu.single_exports.putAssumeCapacityNoClobber(sema.owner, export_idx); | 34602 | zcu.single_exports.putAssumeCapacityNoClobber(sema.owner, export_idx); |
| ... | @@ -34920,7 +34920,7 @@ pub fn setTypeName( | ... | @@ -34920,7 +34920,7 @@ pub fn setTypeName( |
| 34920 | io, | 34920 | io, |
| 34921 | pt.tid, | 34921 | pt.tid, |
| 34922 | "{f}__{s}_{d}", | 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 | .no_embedded_nulls, | 34924 | .no_embedded_nulls, |
| 34925 | ), .none); | 34925 | ), .none); |
| 34926 | }, | 34926 | }, |
| ... | @@ -34935,7 +34935,7 @@ pub fn setTypeName( | ... | @@ -34935,7 +34935,7 @@ pub fn setTypeName( |
| 34935 | w.print("{f}(", .{block.type_name_ctx.fmt(ip)}) catch return error.OutOfMemory; | 34935 | w.print("{f}(", .{block.type_name_ctx.fmt(ip)}) catch return error.OutOfMemory; |
| 34936 | 34936 | ||
| 34937 | var arg_i: usize = 0; | 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 | .param, .param_comptime, .param_anytype, .param_anytype_comptime => { | 34939 | .param, .param_comptime, .param_anytype, .param_anytype_comptime => { |
| 34940 | const arg = sema.inst_map.get(zir_inst).?; | 34940 | const arg = sema.inst_map.get(zir_inst).?; |
| 34941 | // If this is being called in a generic function then analyzeCall will | 34941 | // If this is being called in a generic function then analyzeCall will |
| ... | @@ -34975,7 +34975,7 @@ pub fn setTypeName( | ... | @@ -34975,7 +34975,7 @@ pub fn setTypeName( |
| 34975 | const ref = inst.toRef(); | 34975 | const ref = inst.toRef(); |
| 34976 | const zir_tags = sema.code.instructions.items(.tag); | 34976 | const zir_tags = sema.code.instructions.items(.tag); |
| 34977 | const zir_data = sema.code.instructions.items(.data); | 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 | .dbg_var_ptr, .dbg_var_val => if (zir_data[i].str_op.operand == ref) { | 34979 | .dbg_var_ptr, .dbg_var_val => if (zir_data[i].str_op.operand == ref) { |
| 34980 | break zir_data[i].str_op.getStr(sema.code); | 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,7 +40,7 @@ pub fn loadComptimePtr(sema: *Sema, block: *Block, src: LazySrcLoc, ptr: Value) |
| 40 | const result_val: Value = try .readFromPackedMemory(elem_ty, pt, buf, ptr_info.packed_offset.bit_offset); | 40 | const result_val: Value = try .readFromPackedMemory(elem_ty, pt, buf, ptr_info.packed_offset.bit_offset); |
| 41 | return .{ .success = .{ .interned = result_val.toIntern() } }; | 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 | return .exceeds_host_size; | 44 | return .exceeds_host_size; |
| 45 | } | 45 | } |
| 46 | const load_ty: Type = try pt.vectorType(.{ | 46 | const load_ty: Type = try pt.vectorType(.{ |
| ... | @@ -52,7 +52,7 @@ pub fn loadComptimePtr(sema: *Sema, block: *Block, src: LazySrcLoc, ptr: Value) | ... | @@ -52,7 +52,7 @@ pub fn loadComptimePtr(sema: *Sema, block: *Block, src: LazySrcLoc, ptr: Value) |
| 52 | .success => |mv| mv, | 52 | .success => |mv| mv, |
| 53 | }; | 53 | }; |
| 54 | const vector_val = try vector_mv.intern(pt, sema.arena); | 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 | return .{ .success = .{ .interned = result_val.toIntern() } }; | 56 | return .{ .success = .{ .interned = result_val.toIntern() } }; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| ... | @@ -115,7 +115,7 @@ pub fn storeComptimePtr( | ... | @@ -115,7 +115,7 @@ pub fn storeComptimePtr( |
| 115 | return storeComptimePtrInner(sema, block, src, ptr, new_backing_int_val); | 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 | return .exceeds_host_size; | 119 | return .exceeds_host_size; |
| 120 | } | 120 | } |
| 121 | const vec_ty: Type = try pt.vectorType(.{ | 121 | const vec_ty: Type = try pt.vectorType(.{ |
| ... | @@ -133,7 +133,7 @@ pub fn storeComptimePtr( | ... | @@ -133,7 +133,7 @@ pub fn storeComptimePtr( |
| 133 | const elem_val = try old_vector_val.elemValue(pt, elem_index); | 133 | const elem_val = try old_vector_val.elemValue(pt, elem_index); |
| 134 | elem.* = elem_val.toIntern(); | 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 | const new_vector_val = try pt.aggregateValue(vec_ty, elems_buf); | 137 | const new_vector_val = try pt.aggregateValue(vec_ty, elems_buf); |
| 138 | return storeComptimePtrInner(sema, block, src, ptr, new_vector_val); | 138 | return storeComptimePtrInner(sema, block, src, ptr, new_vector_val); |
| 139 | } | 139 | } |
| ... | @@ -1076,7 +1076,7 @@ fn checkComptimeVarStore( | ... | @@ -1076,7 +1076,7 @@ fn checkComptimeVarStore( |
| 1076 | alloc_index: ComptimeAllocIndex, | 1076 | alloc_index: ComptimeAllocIndex, |
| 1077 | ) !void { | 1077 | ) !void { |
| 1078 | const runtime_index = sema.getComptimeAlloc(alloc_index).runtime_index; | 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 | if (block.runtime_cond) |cond_src| { | 1080 | if (block.runtime_cond) |cond_src| { |
| 1081 | const msg = msg: { | 1081 | const msg = msg: { |
| 1082 | const msg = try sema.errMsg(src, "store to comptime variable depends on runtime condition", .{}); | 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,7 +375,7 @@ pub fn resolveStructLayout(sema: *Sema, struct_ty: Type) CompileError!void { |
| 375 | } | 375 | } |
| 376 | struct_align = struct_align.maxStrict(field_align); | 376 | struct_align = struct_align.maxStrict(field_align); |
| 377 | if (struct_obj.layout == .auto) { | 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 | switch (field_ty.classify(zcu)) { | 380 | switch (field_ty.classify(zcu)) { |
| 381 | .one_possible_value => {}, | 381 | .one_possible_value => {}, |
| ... | @@ -428,8 +428,8 @@ pub fn resolveStructLayout(sema: *Sema, struct_ty: Type) CompileError!void { | ... | @@ -428,8 +428,8 @@ pub fn resolveStructLayout(sema: *Sema, struct_ty: Type) CompileError!void { |
| 428 | assert(b != .unresolved); | 428 | assert(b != .unresolved); |
| 429 | if (a == .omitted) return false; | 429 | if (a == .omitted) return false; |
| 430 | if (b == .omitted) return true; | 430 | if (b == .omitted) return true; |
| 431 | const a_align = ctx.aligns[@intFromEnum(a)]; | 431 | const a_align = ctx.aligns[@backingInt(a)]; |
| 432 | const b_align = ctx.aligns[@intFromEnum(b)]; | 432 | const b_align = ctx.aligns[@backingInt(b)]; |
| 433 | return a_align.compare(.gt, b_align); | 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,7 +476,7 @@ pub fn print(ty: Type, writer: *std.Io.Writer, pt: Zcu.PerThread, ctx: ?*Compari |
| 476 | }); | 476 | }); |
| 477 | } | 477 | } |
| 478 | if (info.flags.vector_index != .none) { | 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 | try writer.writeAll(") "); | 481 | try writer.writeAll(") "); |
| 482 | } | 482 | } |
| ... | @@ -2660,7 +2660,7 @@ pub fn typeDeclSrcLine(ty: Type, zcu: *Zcu) ?u32 { | ... | @@ -2660,7 +2660,7 @@ pub fn typeDeclSrcLine(ty: Type, zcu: *Zcu) ?u32 { |
| 2660 | .zig => file.zir.?, | 2660 | .zig => file.zir.?, |
| 2661 | .zon => return 0, | 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 | return switch (inst.tag) { | 2664 | return switch (inst.tag) { |
| 2665 | .struct_init, .struct_init_ref => zir.extraData(Zir.Inst.StructInit, inst.data.pl_node.payload_index).data.abs_line, | 2665 | .struct_init, .struct_init_ref => zir.extraData(Zir.Inst.StructInit, inst.data.pl_node.payload_index).data.abs_line, |
| 2666 | .struct_init_anon => zir.extraData(Zir.Inst.StructInitAnon, inst.data.pl_node.payload_index).data.abs_line, | 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,7 +2373,7 @@ pub fn uninterpret(val: anytype, ty: Type, pt: Zcu.PerThread) error{ OutOfMemory |
| 2373 | try pt.nullValue(ty), | 2373 | try pt.nullValue(ty), |
| 2374 | 2374 | ||
| 2375 | .@"enum" => switch (interpret_mode) { | 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 | .by_name => { | 2377 | .by_name => { |
| 2378 | const field_name_ip = try ip.getOrPutString(zcu.gpa, io, pt.tid, @tagName(val), .no_embedded_nulls); | 2378 | const field_name_ip = try ip.getOrPutString(zcu.gpa, io, pt.tid, @tagName(val), .no_embedded_nulls); |
| 2379 | const field_idx = ty.enumFieldIndex(field_name_ip, zcu) orelse return error.TypeMismatch; | 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,7 +402,7 @@ pub const ImportTableAdapter = struct { |
| 402 | zcu: *const Zcu, | 402 | zcu: *const Zcu, |
| 403 | pub fn hash(ctx: ImportTableAdapter, path: Compilation.Path) u32 { | 403 | pub fn hash(ctx: ImportTableAdapter, path: Compilation.Path) u32 { |
| 404 | _ = ctx; | 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 | pub fn eql(ctx: ImportTableAdapter, a_path: Compilation.Path, b_file: File.Index, b_index: usize) bool { | 407 | pub fn eql(ctx: ImportTableAdapter, a_path: Compilation.Path, b_file: File.Index, b_index: usize) bool { |
| 408 | _ = b_index; | 408 | _ = b_index; |
| ... | @@ -414,7 +414,7 @@ pub const ImportTableAdapter = struct { | ... | @@ -414,7 +414,7 @@ pub const ImportTableAdapter = struct { |
| 414 | pub const EmbedTableAdapter = struct { | 414 | pub const EmbedTableAdapter = struct { |
| 415 | pub fn hash(ctx: EmbedTableAdapter, path: Compilation.Path) u32 { | 415 | pub fn hash(ctx: EmbedTableAdapter, path: Compilation.Path) u32 { |
| 416 | _ = ctx; | 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 | pub fn eql(ctx: EmbedTableAdapter, a_path: Compilation.Path, b_file: *EmbedFile, b_index: usize) bool { | 419 | pub fn eql(ctx: EmbedTableAdapter, a_path: Compilation.Path, b_file: *EmbedFile, b_index: usize) bool { |
| 420 | _ = ctx; | 420 | _ = ctx; |
| ... | @@ -614,7 +614,7 @@ pub const StdLangDecl = enum { | ... | @@ -614,7 +614,7 @@ pub const StdLangDecl = enum { |
| 614 | .VaList => .va_list, | 614 | .VaList => .va_list, |
| 615 | .assembly, .@"assembly.Clobbers" => .assembly, | 615 | .assembly, .@"assembly.Clobbers" => .assembly, |
| 616 | else => { | 616 | else => { |
| 617 | if (@intFromEnum(decl) <= @intFromEnum(StdLangDecl.@"Type.Spirv.Image.Access")) { | 617 | if (@backingInt(decl) <= @backingInt(StdLangDecl.@"Type.Spirv.Image.Access")) { |
| 618 | return .main; | 618 | return .main; |
| 619 | } else { | 619 | } else { |
| 620 | return .panic; | 620 | return .panic; |
| ... | @@ -635,7 +635,7 @@ pub const StdLangDecl = enum { | ... | @@ -635,7 +635,7 @@ pub const StdLangDecl = enum { |
| 635 | const name = @tagName(tag); | 635 | const name = @tagName(tag); |
| 636 | const split = (comptime std.mem.lastIndexOfScalar(u8, name, '.')) orelse return .{ .direct = name }; | 636 | const split = (comptime std.mem.lastIndexOfScalar(u8, name, '.')) orelse return .{ .direct = name }; |
| 637 | const parent = @field(StdLangDecl, name[0..split]); | 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 | return .{ .nested = .{ parent, name[split + 1 ..] } }; | 639 | return .{ .nested = .{ parent, name[split + 1 ..] } }; |
| 640 | }, | 640 | }, |
| 641 | }; | 641 | }; |
| ... | @@ -757,7 +757,7 @@ pub const Export = struct { | ... | @@ -757,7 +757,7 @@ pub const Export = struct { |
| 757 | _, | 757 | _, |
| 758 | 758 | ||
| 759 | pub fn ptr(i: Index, zcu: *const Zcu) *Export { | 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,10 +769,10 @@ pub const CompileLogLine = struct { |
| 769 | pub const Index = enum(u32) { | 769 | pub const Index = enum(u32) { |
| 770 | _, | 770 | _, |
| 771 | pub fn get(idx: Index, zcu: *Zcu) *CompileLogLine { | 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 | pub fn toOptional(idx: Index) Optional { | 774 | pub fn toOptional(idx: Index) Optional { |
| 775 | return @enumFromInt(@intFromEnum(idx)); | 775 | return @fromBackingInt(@intCast(@backingInt(idx))); |
| 776 | } | 776 | } |
| 777 | pub const Optional = enum(u32) { | 777 | pub const Optional = enum(u32) { |
| 778 | none = std.math.maxInt(u32), | 778 | none = std.math.maxInt(u32), |
| ... | @@ -780,7 +780,7 @@ pub const CompileLogLine = struct { | ... | @@ -780,7 +780,7 @@ pub const CompileLogLine = struct { |
| 780 | pub fn unwrap(opt: Optional) ?Index { | 780 | pub fn unwrap(opt: Optional) ?Index { |
| 781 | return switch (opt) { | 781 | return switch (opt) { |
| 782 | .none => null, | 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,10 +815,10 @@ pub const InlineReferenceFrame = struct { |
| 815 | pub const Index = enum(u32) { | 815 | pub const Index = enum(u32) { |
| 816 | _, | 816 | _, |
| 817 | pub fn ptr(idx: Index, zcu: *Zcu) *InlineReferenceFrame { | 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 | pub fn toOptional(idx: Index) Optional { | 820 | pub fn toOptional(idx: Index) Optional { |
| 821 | return @enumFromInt(@intFromEnum(idx)); | 821 | return @fromBackingInt(@intCast(@backingInt(idx))); |
| 822 | } | 822 | } |
| 823 | pub const Optional = enum(u32) { | 823 | pub const Optional = enum(u32) { |
| 824 | none = std.math.maxInt(u32), | 824 | none = std.math.maxInt(u32), |
| ... | @@ -826,7 +826,7 @@ pub const InlineReferenceFrame = struct { | ... | @@ -826,7 +826,7 @@ pub const InlineReferenceFrame = struct { |
| 826 | pub fn unwrap(opt: Optional) ?Index { | 826 | pub fn unwrap(opt: Optional) ?Index { |
| 827 | return switch (opt) { | 827 | return switch (opt) { |
| 828 | .none => null, | 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,7 +869,7 @@ pub const Namespace = struct { |
| 869 | 869 | ||
| 870 | pub fn hash(ctx: NavNameContext, nav: InternPool.Nav.Index) u32 { | 870 | pub fn hash(ctx: NavNameContext, nav: InternPool.Nav.Index) u32 { |
| 871 | const name = ctx.zcu.intern_pool.getNav(nav).name; | 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 | pub fn eql(ctx: NavNameContext, a_nav: InternPool.Nav.Index, b_nav: InternPool.Nav.Index, b_index: usize) bool { | 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,7 +885,7 @@ pub const Namespace = struct { |
| 885 | 885 | ||
| 886 | pub fn hash(ctx: NameAdapter, s: InternPool.NullTerminatedString) u32 { | 886 | pub fn hash(ctx: NameAdapter, s: InternPool.NullTerminatedString) u32 { |
| 887 | _ = ctx; | 887 | _ = ctx; |
| 888 | return std.hash.int(@intFromEnum(s)); | 888 | return std.hash.int(@backingInt(s)); |
| 889 | } | 889 | } |
| 890 | 890 | ||
| 891 | pub fn eql(ctx: NameAdapter, a: InternPool.NullTerminatedString, b_nav: InternPool.Nav.Index, b_index: usize) bool { | 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,7 +1235,7 @@ pub const EmbedFile = struct { |
| 1235 | pub const Index = enum(u32) { | 1235 | pub const Index = enum(u32) { |
| 1236 | _, | 1236 | _, |
| 1237 | pub fn get(idx: Index, zcu: *const Zcu) *EmbedFile { | 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,7 +1625,7 @@ pub const SrcLoc = struct { |
| 1625 | // that contains this input. | 1625 | // that contains this input. |
| 1626 | const node_tags = tree.nodes.items(.tag); | 1626 | const node_tags = tree.nodes.items(.tag); |
| 1627 | for (node_tags, 0..) |node_tag, node_usize| { | 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 | switch (node_tag) { | 1629 | switch (node_tag) { |
| 1630 | .for_simple, .@"for" => { | 1630 | .for_simple, .@"for" => { |
| 1631 | const for_full = tree.fullFor(node).?; | 1631 | const for_full = tree.fullFor(node).?; |
| ... | @@ -1665,7 +1665,7 @@ pub const SrcLoc = struct { | ... | @@ -1665,7 +1665,7 @@ pub const SrcLoc = struct { |
| 1665 | var buf: [2]Ast.Node.Index = undefined; | 1665 | var buf: [2]Ast.Node.Index = undefined; |
| 1666 | const call_full = tree.fullCall(buf[0..1], node) orelse { | 1666 | const call_full = tree.fullCall(buf[0..1], node) orelse { |
| 1667 | assert(tree.nodeTag(node) == .builtin_call); | 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 | switch (tree.nodeTag(call_args_node)) { | 1669 | switch (tree.nodeTag(call_args_node)) { |
| 1670 | .array_init_one, | 1670 | .array_init_one, |
| 1671 | .array_init_one_comma, | 1671 | .array_init_one_comma, |
| ... | @@ -2740,7 +2740,7 @@ pub const LazySrcLoc = struct { | ... | @@ -2740,7 +2740,7 @@ pub const LazySrcLoc = struct { |
| 2740 | // Otherwise, make sure ZIR is loaded. | 2740 | // Otherwise, make sure ZIR is loaded. |
| 2741 | const zir = file.zir.?; | 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 | const base_node: Ast.Node.Index = switch (inst.tag) { | 2744 | const base_node: Ast.Node.Index = switch (inst.tag) { |
| 2745 | .declaration => inst.data.declaration.src_node, | 2745 | .declaration => inst.data.declaration.src_node, |
| 2746 | .struct_init, .struct_init_ref => zir.extraData(Zir.Inst.StructInit, inst.data.pl_node.payload_index).data.abs_node, | 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,7 +2789,7 @@ pub const LazySrcLoc = struct { |
| 2789 | if (lhs_resolved.file_scope != rhs_resolved.file_scope) { | 2789 | if (lhs_resolved.file_scope != rhs_resolved.file_scope) { |
| 2790 | const lhs_path = lhs_resolved.file_scope.path; | 2790 | const lhs_path = lhs_resolved.file_scope.path; |
| 2791 | const rhs_path = rhs_resolved.file_scope.path; | 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 | std.mem.order(u8, lhs_path.sub_path, rhs_path.sub_path).differ().?; | 2793 | std.mem.order(u8, lhs_path.sub_path, rhs_path.sub_path).differ().?; |
| 2794 | } | 2794 | } |
| 2795 | const prev_prot = zcu.comp.io.swapCancelProtection(.blocked); | 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,10 +3009,10 @@ pub fn loadZirCacheBody(gpa: Allocator, header: Zir.Header, cache_br: *Io.Reader |
| 3009 | if (data_has_safety_tag) { | 3009 | if (data_has_safety_tag) { |
| 3010 | const tags = zir.instructions.items(.tag); | 3010 | const tags = zir.instructions.items(.tag); |
| 3011 | for (zir.instructions.items(.data), 0..) |*data, i| { | 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 | const as_struct = @as(*HackDataLayout, @ptrCast(data)); | 3013 | const as_struct = @as(*HackDataLayout, @ptrCast(data)); |
| 3014 | as_struct.* = .{ | 3014 | as_struct.* = .{ |
| 3015 | .safety_tag = @intFromEnum(union_tag), | 3015 | .safety_tag = @backingInt(union_tag), |
| 3016 | .data = safety_buffer[i], | 3016 | .data = safety_buffer[i], |
| 3017 | }; | 3017 | }; |
| 3018 | } | 3018 | } |
| ... | @@ -3408,8 +3408,8 @@ pub fn mapOldZirToNew( | ... | @@ -3408,8 +3408,8 @@ pub fn mapOldZirToNew( |
| 3408 | // updates. If they have, we need to ignore this mapping. These properties are essentially | 3408 | // updates. If they have, we need to ignore this mapping. These properties are essentially |
| 3409 | // everything passed into `InternPool.getDeclaredStructType` (likewise for unions, enums, | 3409 | // everything passed into `InternPool.getDeclaredStructType` (likewise for unions, enums, |
| 3410 | // and opaques). | 3410 | // and opaques). |
| 3411 | const old_tag = old_zir.instructions.items(.data)[@intFromEnum(match_item.old_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)[@intFromEnum(match_item.new_inst)].extended.opcode; | 3412 | const new_tag = new_zir.instructions.items(.data)[@backingInt(match_item.new_inst)].extended.opcode; |
| 3413 | if (old_tag != new_tag) continue; | 3413 | if (old_tag != new_tag) continue; |
| 3414 | switch (old_tag) { | 3414 | switch (old_tag) { |
| 3415 | .struct_decl => { | 3415 | .struct_decl => { |
| ... | @@ -3756,7 +3756,7 @@ pub fn resetUnit(zcu: *Zcu, unit: AnalUnit) void { | ... | @@ -3756,7 +3756,7 @@ pub fn resetUnit(zcu: *Zcu, unit: AnalUnit) void { |
| 3756 | exports: { | 3756 | exports: { |
| 3757 | const base: u32, const len: u32 = index: { | 3757 | const base: u32, const len: u32 = index: { |
| 3758 | if (zcu.single_exports.fetchSwapRemove(unit)) |kv| { | 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 | if (zcu.multi_exports.fetchSwapRemove(unit)) |kv| { | 3761 | if (zcu.multi_exports.fetchSwapRemove(unit)) |kv| { |
| 3762 | break :index .{ kv.value.index, kv.value.len }; | 3762 | break :index .{ kv.value.index, kv.value.len }; |
| ... | @@ -3764,7 +3764,7 @@ pub fn resetUnit(zcu: *Zcu, unit: AnalUnit) void { | ... | @@ -3764,7 +3764,7 @@ pub fn resetUnit(zcu: *Zcu, unit: AnalUnit) void { |
| 3764 | break :exports; | 3764 | break :exports; |
| 3765 | }; | 3765 | }; |
| 3766 | for (zcu.all_exports.items[base..][0..len], base..) |exp, exp_index_usize| { | 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 | if (zcu.llvm_object) |llvm_object| { | 3768 | if (zcu.llvm_object) |llvm_object| { |
| 3769 | _ = llvm_object; // TODO: delete exports from LLVM | 3769 | _ = llvm_object; // TODO: delete exports from LLVM |
| 3770 | } else if (zcu.comp.bin_file) |lf| { | 3770 | } else if (zcu.comp.bin_file) |lf| { |
| ... | @@ -3780,7 +3780,7 @@ pub fn resetUnit(zcu: *Zcu, unit: AnalUnit) void { | ... | @@ -3780,7 +3780,7 @@ pub fn resetUnit(zcu: *Zcu, unit: AnalUnit) void { |
| 3780 | break :exports; | 3780 | break :exports; |
| 3781 | }; | 3781 | }; |
| 3782 | for (base..base + len) |exp_index| { | 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,7 +3836,7 @@ pub fn resetUnit(zcu: *Zcu, unit: AnalUnit) void { |
| 3836 | pub fn addInlineReferenceFrame(zcu: *Zcu, frame: InlineReferenceFrame) Allocator.Error!Zcu.InlineReferenceFrame.Index { | 3836 | pub fn addInlineReferenceFrame(zcu: *Zcu, frame: InlineReferenceFrame) Allocator.Error!Zcu.InlineReferenceFrame.Index { |
| 3837 | const frame_idx: InlineReferenceFrame.Index = zcu.free_inline_reference_frames.pop() orelse idx: { | 3837 | const frame_idx: InlineReferenceFrame.Index = zcu.free_inline_reference_frames.pop() orelse idx: { |
| 3838 | _ = try zcu.inline_reference_frames.addOne(zcu.gpa); | 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 | frame_idx.ptr(zcu).* = frame; | 3841 | frame_idx.ptr(zcu).* = frame; |
| 3842 | return frame_idx; | 3842 | return frame_idx; |
| ... | @@ -4251,7 +4251,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana | ... | @@ -4251,7 +4251,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4251 | if (!gop.found_existing) { | 4251 | if (!gop.found_existing) { |
| 4252 | refs_log.debug("type '{f}': ref comptime %{}", .{ | 4252 | refs_log.debug("type '{f}': ref comptime %{}", .{ |
| 4253 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), | 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 | gop.value_ptr.* = referencer; | 4256 | gop.value_ptr.* = referencer; |
| 4257 | } | 4257 | } |
| ... | @@ -4285,7 +4285,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana | ... | @@ -4285,7 +4285,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4285 | if (!gop.found_existing) { | 4285 | if (!gop.found_existing) { |
| 4286 | refs_log.debug("type '{f}': ref test %{}", .{ | 4286 | refs_log.debug("type '{f}': ref test %{}", .{ |
| 4287 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), | 4287 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), |
| 4288 | @intFromEnum(inst_info.inst), | 4288 | @backingInt(inst_info.inst), |
| 4289 | }); | 4289 | }); |
| 4290 | gop.value_ptr.* = referencer; | 4290 | gop.value_ptr.* = referencer; |
| 4291 | } | 4291 | } |
| ... | @@ -4308,7 +4308,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana | ... | @@ -4308,7 +4308,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4308 | if (!gop.found_existing) { | 4308 | if (!gop.found_existing) { |
| 4309 | refs_log.debug("type '{f}': ref named %{}", .{ | 4309 | refs_log.debug("type '{f}': ref named %{}", .{ |
| 4310 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), | 4310 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), |
| 4311 | @intFromEnum(inst_info.inst), | 4311 | @backingInt(inst_info.inst), |
| 4312 | }); | 4312 | }); |
| 4313 | gop.value_ptr.* = referencer; | 4313 | gop.value_ptr.* = referencer; |
| 4314 | } | 4314 | } |
| ... | @@ -4325,7 +4325,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana | ... | @@ -4325,7 +4325,7 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(Ana |
| 4325 | if (!gop.found_existing) { | 4325 | if (!gop.found_existing) { |
| 4326 | refs_log.debug("type '{f}': ref named %{}", .{ | 4326 | refs_log.debug("type '{f}': ref named %{}", .{ |
| 4327 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), | 4327 | Type.fromInterned(ty).containerTypeName(ip).fmt(ip), |
| 4328 | @intFromEnum(inst_info.inst), | 4328 | @backingInt(inst_info.inst), |
| 4329 | }); | 4329 | }); |
| 4330 | gop.value_ptr.* = referencer; | 4330 | gop.value_ptr.* = referencer; |
| 4331 | } | 4331 | } |
| ... | @@ -4494,16 +4494,16 @@ fn formatAnalUnit(data: FormatAnalUnit, writer: *Io.Writer) Io.Writer.Error!void | ... | @@ -4494,16 +4494,16 @@ fn formatAnalUnit(data: FormatAnalUnit, writer: *Io.Writer) Io.Writer.Error!void |
| 4494 | const cu = ip.getComptimeUnit(cu_id); | 4494 | const cu = ip.getComptimeUnit(cu_id); |
| 4495 | if (cu.zir_index.resolveFull(ip)) |resolved| { | 4495 | if (cu.zir_index.resolveFull(ip)) |resolved| { |
| 4496 | const file_path = zcu.fileByIndex(resolved.file).path; | 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 | } else { | 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) }), | 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), @intFromEnum(ty) }), | 4503 | .type_layout, .struct_defaults => |ty, tag| return writer.print("{t}('{f}' [{}])", .{ tag, Type.fromInterned(ty).containerTypeName(ip).fmt(ip), @backingInt(ty) }), |
| 4504 | .func => |func| { | 4504 | .func => |func| { |
| 4505 | const nav = zcu.funcInfo(func).owner_nav; | 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 | .memoized_state => return writer.writeAll("memoized_state"), | 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,7 +4519,7 @@ fn formatDependee(data: FormatDependee, writer: *Io.Writer) Io.Writer.Error!void |
| 4519 | return writer.writeAll("inst(<lost>)"); | 4519 | return writer.writeAll("inst(<lost>)"); |
| 4520 | }; | 4520 | }; |
| 4521 | const file_path = zcu.fileByIndex(info.file).path; | 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 | .nav_val, .nav_ty => |nav, tag| { | 4524 | .nav_val, .nav_ty => |nav, tag| { |
| 4525 | const fqn = ip.getNav(nav).fqn; | 4525 | const fqn = ip.getNav(nav).fqn; |
| ... | @@ -4546,14 +4546,14 @@ fn formatDependee(data: FormatDependee, writer: *Io.Writer) Io.Writer.Error!void | ... | @@ -4546,14 +4546,14 @@ fn formatDependee(data: FormatDependee, writer: *Io.Writer) Io.Writer.Error!void |
| 4546 | return writer.writeAll("namespace(<lost>)"); | 4546 | return writer.writeAll("namespace(<lost>)"); |
| 4547 | }; | 4547 | }; |
| 4548 | const file_path = zcu.fileByIndex(info.file).path; | 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 | .namespace_name => |k| { | 4551 | .namespace_name => |k| { |
| 4552 | const info = k.namespace.resolveFull(ip) orelse { | 4552 | const info = k.namespace.resolveFull(ip) orelse { |
| 4553 | return writer.print("namespace(<lost>, '{f}')", .{k.name.fmt(ip)}); | 4553 | return writer.print("namespace(<lost>, '{f}')", .{k.name.fmt(ip)}); |
| 4554 | }; | 4554 | }; |
| 4555 | const file_path = zcu.fileByIndex(info.file).path; | 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 | .memoized_state => return writer.writeAll("memoized_state"), | 4558 | .memoized_state => return writer.writeAll("memoized_state"), |
| 4559 | } | 4559 | } |
| ... | @@ -5276,7 +5276,7 @@ pub const CodegenTaskPool = struct { | ... | @@ -5276,7 +5276,7 @@ pub const CodegenTaskPool = struct { |
| 5276 | @memset(task_funcs, .none); | 5276 | @memset(task_funcs, .none); |
| 5277 | 5277 | ||
| 5278 | var free: std.ArrayList(Index) = try .initCapacity(arena, max_funcs_in_flight); | 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 | return .{ | 5281 | return .{ |
| 5282 | .available_air_bytes = max_air_bytes_in_flight, | 5282 | .available_air_bytes = max_air_bytes_in_flight, |
| ... | @@ -5349,10 +5349,10 @@ pub const CodegenTaskPool = struct { | ... | @@ -5349,10 +5349,10 @@ pub const CodegenTaskPool = struct { |
| 5349 | errdefer comptime unreachable; | 5349 | errdefer comptime unreachable; |
| 5350 | 5350 | ||
| 5351 | assert(zcu.pending_codegen_jobs.fetchAdd(1, .monotonic) > 0); // the "Code Generation" node is still active | 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); | 5352 | assert(pool.task_funcs[@backingInt(index)] == .none); |
| 5353 | pool.task_funcs[@intFromEnum(index)] = func_index; | 5353 | pool.task_funcs[@backingInt(index)] = func_index; |
| 5354 | pool.task_air_bytes[@intFromEnum(index)] = actual_air_bytes; | 5354 | pool.task_air_bytes[@backingInt(index)] = actual_air_bytes; |
| 5355 | pool.task_futures[@intFromEnum(index)] = if (move_air) io.async( | 5355 | pool.task_futures[@backingInt(index)] = if (move_air) io.async( |
| 5356 | workerCodegenOwnedAir, | 5356 | workerCodegenOwnedAir, |
| 5357 | .{ zcu, func_index, air.* }, | 5357 | .{ zcu, func_index, air.* }, |
| 5358 | ) else io.async( | 5358 | ) else io.async( |
| ... | @@ -5373,14 +5373,14 @@ pub const CodegenTaskPool = struct { | ... | @@ -5373,14 +5373,14 @@ pub const CodegenTaskPool = struct { |
| 5373 | zcu: *const Zcu, | 5373 | zcu: *const Zcu, |
| 5374 | ) PerThread.RunCodegenError!struct { InternPool.Index, codegen.AnyMir } { | 5374 | ) PerThread.RunCodegenError!struct { InternPool.Index, codegen.AnyMir } { |
| 5375 | const io = zcu.comp.io; | 5375 | const io = zcu.comp.io; |
| 5376 | const func = pool.task_funcs[@intFromEnum(index)]; | 5376 | const func = pool.task_funcs[@backingInt(index)]; |
| 5377 | assert(func != .none); | 5377 | assert(func != .none); |
| 5378 | const effective_air_bytes = pool.task_air_bytes[@intFromEnum(index)]; | 5378 | const effective_air_bytes = pool.task_air_bytes[@backingInt(index)]; |
| 5379 | const result = pool.task_futures[@intFromEnum(index)].await(io); | 5379 | const result = pool.task_futures[@backingInt(index)].await(io); |
| 5380 | 5380 | ||
| 5381 | pool.task_funcs[@intFromEnum(index)] = .none; | 5381 | pool.task_funcs[@backingInt(index)] = .none; |
| 5382 | pool.task_air_bytes[@intFromEnum(index)] = undefined; | 5382 | pool.task_air_bytes[@backingInt(index)] = undefined; |
| 5383 | pool.task_futures[@intFromEnum(index)] = undefined; | 5383 | pool.task_futures[@backingInt(index)] = undefined; |
| 5384 | 5384 | ||
| 5385 | { | 5385 | { |
| 5386 | pool.mutex.lockUncancelable(io); | 5386 | pool.mutex.lockUncancelable(io); |
src/Zcu/PerThread.zig+18-18| ... | @@ -73,7 +73,7 @@ pub const Id = if (InternPool.single_threaded) enum { | ... | @@ -73,7 +73,7 @@ pub const Id = if (InternPool.single_threaded) enum { |
| 73 | pub fn allocate(arena: Allocator, n: usize) Allocator.Error!void { | 73 | pub fn allocate(arena: Allocator, n: usize) Allocator.Error!void { |
| 74 | assert(available_tids.items.len == 0); | 74 | assert(available_tids.items.len == 0); |
| 75 | try available_tids.ensureTotalCapacityPrecise(arena, n - 1); | 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 | switch (build_options.io_mode) { | 77 | switch (build_options.io_mode) { |
| 78 | .threaded => { | 78 | .threaded => { |
| 79 | // Called from the main thread, so mark ourselves as such. | 79 | // Called from the main thread, so mark ourselves as such. |
| ... | @@ -194,7 +194,7 @@ pub fn update( | ... | @@ -194,7 +194,7 @@ pub fn update( |
| 194 | // because `workerUpdateEmbedFile` can't invalidate it. The different here is that one | 194 | // because `workerUpdateEmbedFile` can't invalidate it. The different here is that one |
| 195 | // `@embedFile` can't trigger analysis of a new `@embedFile`! | 195 | // `@embedFile` can't trigger analysis of a new `@embedFile`! |
| 196 | for (0.., zcu.embed_table.keys()) |ef_index_usize, ef| { | 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 | astgen_group.async(io, workerUpdateEmbedFile, .{ | 198 | astgen_group.async(io, workerUpdateEmbedFile, .{ |
| 199 | comp, ef_index, ef, | 199 | comp, ef_index, ef, |
| 200 | }); | 200 | }); |
| ... | @@ -390,7 +390,7 @@ fn workerUpdateFile( | ... | @@ -390,7 +390,7 @@ fn workerUpdateFile( |
| 390 | // Discover all imports in the file. Imports of modules we ignore for now since we don't | 390 | // Discover all imports in the file. Imports of modules we ignore for now since we don't |
| 391 | // know which module we're in, but imports of file paths might need us to queue up other | 391 | // know which module we're in, but imports of file paths might need us to queue up other |
| 392 | // AstGen jobs. | 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 | if (imports_index != 0) { | 394 | if (imports_index != 0) { |
| 395 | const extra = file.zir.?.extraData(Zir.Inst.Imports, imports_index); | 395 | const extra = file.zir.?.extraData(Zir.Inst.Imports, imports_index); |
| 396 | var import_i: u32 = 0; | 396 | var import_i: u32 = 0; |
| ... | @@ -853,7 +853,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void { | ... | @@ -853,7 +853,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void { |
| 853 | 853 | ||
| 854 | const old_inst = tracked_inst.inst.unwrap() orelse continue; // we can't continue tracking lost insts | 854 | const old_inst = tracked_inst.inst.unwrap() orelse continue; // we can't continue tracking lost insts |
| 855 | const tracked_inst_index = (InternPool.TrackedInst.Index.Unwrapped{ | 855 | const tracked_inst_index = (InternPool.TrackedInst.Index.Unwrapped{ |
| 856 | .tid = @enumFromInt(tid), | 856 | .tid = @fromBackingInt(@intCast(tid)), |
| 857 | .index = @intCast(tracked_inst_unwrapped_index), | 857 | .index = @intCast(tracked_inst_unwrapped_index), |
| 858 | }).wrap(ip); | 858 | }).wrap(ip); |
| 859 | const new_inst = updated_file.inst_map.get(old_inst) orelse { | 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,8 +868,8 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void { |
| 868 | 868 | ||
| 869 | const old_zir = file.prev_zir.?.*; | 869 | const old_zir = file.prev_zir.?.*; |
| 870 | const new_zir = file.zir.?; | 870 | const new_zir = file.zir.?; |
| 871 | const old_tag = old_zir.instructions.items(.tag)[@intFromEnum(old_inst)]; | 871 | const old_tag = old_zir.instructions.items(.tag)[@backingInt(old_inst)]; |
| 872 | const old_data = old_zir.instructions.items(.data)[@intFromEnum(old_inst)]; | 872 | const old_data = old_zir.instructions.items(.data)[@backingInt(old_inst)]; |
| 873 | 873 | ||
| 874 | switch (old_tag) { | 874 | switch (old_tag) { |
| 875 | .declaration => { | 875 | .declaration => { |
| ... | @@ -1882,7 +1882,7 @@ fn analyzeNavVal( | ... | @@ -1882,7 +1882,7 @@ fn analyzeNavVal( |
| 1882 | }); | 1882 | }); |
| 1883 | 1883 | ||
| 1884 | if (zir_decl.linkage == .@"export") { | 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 | const name_slice = zir.nullTerminatedString(zir_decl.name); | 1886 | const name_slice = zir.nullTerminatedString(zir_decl.name); |
| 1887 | const name_ip = try ip.getOrPutString(gpa, io, pt.tid, name_slice, .no_embedded_nulls); | 1887 | const name_ip = try ip.getOrPutString(gpa, io, pt.tid, name_slice, .no_embedded_nulls); |
| 1888 | try sema.analyzeExportSelfNav(&block, export_src, name_ip); | 1888 | try sema.analyzeExportSelfNav(&block, export_src, name_ip); |
| ... | @@ -2623,7 +2623,7 @@ fn computeAliveFiles(pt: Zcu.PerThread) Allocator.Error!bool { | ... | @@ -2623,7 +2623,7 @@ fn computeAliveFiles(pt: Zcu.PerThread) Allocator.Error!bool { |
| 2623 | if (file.status != .success) continue; // ZIR not valid if there was a file failure | 2623 | if (file.status != .success) continue; // ZIR not valid if there was a file failure |
| 2624 | 2624 | ||
| 2625 | const zir = file.zir.?; | 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 | if (imports_index == 0) continue; // this Zig file has no imports | 2627 | if (imports_index == 0) continue; // this Zig file has no imports |
| 2628 | const extra = zir.extraData(Zir.Inst.Imports, imports_index); | 2628 | const extra = zir.extraData(Zir.Inst.Imports, imports_index); |
| 2629 | var extra_index = extra.end; | 2629 | var extra_index = extra.end; |
| ... | @@ -2794,7 +2794,7 @@ pub fn updateBuiltinModule(pt: Zcu.PerThread, opts: Builtin) Allocator.Error!voi | ... | @@ -2794,7 +2794,7 @@ pub fn updateBuiltinModule(pt: Zcu.PerThread, opts: Builtin) Allocator.Error!voi |
| 2794 | assert(!file.zir.?.hasCompileErrors()); | 2794 | assert(!file.zir.?.hasCompileErrors()); |
| 2795 | { | 2795 | { |
| 2796 | // Check that it has only one import, which is 'std'. | 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 | assert(imports_idx != 0); // there is an import | 2798 | assert(imports_idx != 0); // there is an import |
| 2799 | const extra = file.zir.?.extraData(Zir.Inst.Imports, imports_idx); | 2799 | const extra = file.zir.?.extraData(Zir.Inst.Imports, imports_idx); |
| 2800 | assert(extra.data.imports_len == 1); // there is exactly one import | 2800 | assert(extra.data.imports_len == 1); // there is exactly one import |
| ... | @@ -2838,11 +2838,11 @@ pub fn embedFile( | ... | @@ -2838,11 +2838,11 @@ pub fn embedFile( |
| 2838 | const gop = try zcu.embed_table.getOrPutAdapted(gpa, path, Zcu.EmbedTableAdapter{}); | 2838 | const gop = try zcu.embed_table.getOrPutAdapted(gpa, path, Zcu.EmbedTableAdapter{}); |
| 2839 | if (gop.found_existing) { | 2839 | if (gop.found_existing) { |
| 2840 | path.deinit(gpa); // we're not using this key | 2840 | path.deinit(gpa); // we're not using this key |
| 2841 | return @enumFromInt(gop.index); | 2841 | return @fromBackingInt(@intCast(gop.index)); |
| 2842 | } | 2842 | } |
| 2843 | errdefer _ = zcu.embed_table.pop(); | 2843 | errdefer _ = zcu.embed_table.pop(); |
| 2844 | gop.key_ptr.* = try pt.newEmbedFile(path); | 2844 | gop.key_ptr.* = try pt.newEmbedFile(path); |
| 2845 | return @enumFromInt(gop.index); | 2845 | return @fromBackingInt(@intCast(gop.index)); |
| 2846 | } | 2846 | } |
| 2847 | 2847 | ||
| 2848 | const embed_file: *Zcu.EmbedFile, const embed_file_idx: Zcu.EmbedFile.Index = ef: { | 2848 | const embed_file: *Zcu.EmbedFile, const embed_file_idx: Zcu.EmbedFile.Index = ef: { |
| ... | @@ -2851,11 +2851,11 @@ pub fn embedFile( | ... | @@ -2851,11 +2851,11 @@ pub fn embedFile( |
| 2851 | const gop = try zcu.embed_table.getOrPutAdapted(gpa, path, Zcu.EmbedTableAdapter{}); | 2851 | const gop = try zcu.embed_table.getOrPutAdapted(gpa, path, Zcu.EmbedTableAdapter{}); |
| 2852 | if (gop.found_existing) { | 2852 | if (gop.found_existing) { |
| 2853 | path.deinit(gpa); // we're not using this key | 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 | } else { | 2855 | } else { |
| 2856 | errdefer _ = zcu.embed_table.pop(); | 2856 | errdefer _ = zcu.embed_table.pop(); |
| 2857 | gop.key_ptr.* = try pt.newEmbedFile(path); | 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,7 +3394,7 @@ fn analyzeFuncBodyInner( |
| 3394 | gop.value_ptr.* = .fromValue(opv); | 3394 | gop.value_ptr.* = .fromValue(opv); |
| 3395 | continue; | 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 | gop.value_ptr.* = arg_index.toRef(); | 3398 | gop.value_ptr.* = arg_index.toRef(); |
| 3399 | inner_block.instructions.appendAssumeCapacity(arg_index); | 3399 | inner_block.instructions.appendAssumeCapacity(arg_index); |
| 3400 | sema.air_instructions.appendAssumeCapacity(.{ | 3400 | sema.air_instructions.appendAssumeCapacity(.{ |
| ... | @@ -3441,7 +3441,7 @@ fn analyzeFuncBodyInner( | ... | @@ -3441,7 +3441,7 @@ fn analyzeFuncBodyInner( |
| 3441 | for (sema.unresolved_inferred_allocs.keys()) |ptr_inst| { | 3441 | for (sema.unresolved_inferred_allocs.keys()) |ptr_inst| { |
| 3442 | // The lack of a resolve_inferred_alloc means that this instruction | 3442 | // The lack of a resolve_inferred_alloc means that this instruction |
| 3443 | // is unused so it just has to be a no-op. | 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 | .tag = .alloc, | 3445 | .tag = .alloc, |
| 3446 | .data = .{ .ty = .ptr_const_comptime_int }, | 3446 | .data = .{ .ty = .ptr_const_comptime_int }, |
| 3447 | }); | 3447 | }); |
| ... | @@ -3466,7 +3466,7 @@ fn analyzeFuncBodyInner( | ... | @@ -3466,7 +3466,7 @@ fn analyzeFuncBodyInner( |
| 3466 | .body_len = @intCast(inner_block.instructions.items.len), | 3466 | .body_len = @intCast(inner_block.instructions.items.len), |
| 3467 | }); | 3467 | }); |
| 3468 | sema.air_extra.appendSliceAssumeCapacity(@ptrCast(inner_block.instructions.items)); | 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 | // Resolving inferred error sets is done *before* setting the function | 3471 | // Resolving inferred error sets is done *before* setting the function |
| 3472 | // state to success, so that "unable to resolve inferred error set" errors | 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,7 +3640,7 @@ pub fn processExports(pt: Zcu.PerThread) !void { |
| 3640 | }, | 3640 | }, |
| 3641 | }; | 3641 | }; |
| 3642 | if (!found_existing) value_ptr.* = .empty; | 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,7 +3994,7 @@ pub fn ptrType(pt: Zcu.PerThread, info: InternPool.Key.PtrType) Allocator.Error! |
| 3994 | canon_info.packed_offset.host_size = 0; | 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 | return .fromInterned(try pt.intern(.{ .ptr_type = canon_info })); | 4000 | return .fromInterned(try pt.intern(.{ .ptr_type = canon_info })); |
src/codegen.zig+6-6| ... | @@ -793,7 +793,7 @@ fn lowerNavRef( | ... | @@ -793,7 +793,7 @@ fn lowerNavRef( |
| 793 | @panic("TODO add out_reloc for this"); | 793 | @panic("TODO add out_reloc for this"); |
| 794 | } else { | 794 | } else { |
| 795 | try wasm.func_table_fixups.append(gpa, .{ | 795 | try wasm.func_table_fixups.append(gpa, .{ |
| 796 | .table_index = @enumFromInt(gop.index), | 796 | .table_index = @fromBackingInt(@intCast(gop.index)), |
| 797 | .offset = @intCast(w.end), | 797 | .offset = @intCast(w.end), |
| 798 | }); | 798 | }); |
| 799 | } | 799 | } |
| ... | @@ -855,7 +855,7 @@ pub fn genNavRef( | ... | @@ -855,7 +855,7 @@ pub fn genNavRef( |
| 855 | .internal => { | 855 | .internal => { |
| 856 | const sym_index = try zo.getOrCreateMetadataForNav(zcu, nav_index); | 856 | const sym_index = try zo.getOrCreateMetadataForNav(zcu, nav_index); |
| 857 | if (is_threadlocal) zo.symbol(sym_index).flags.is_tls = true; | 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 | .strong, .weak => { | 860 | .strong, .weak => { |
| 861 | const sym_index = try elf_file.getGlobalSymbol(nav.name.toSlice(ip), lib_name.toSlice(ip)); | 861 | const sym_index = try elf_file.getGlobalSymbol(nav.name.toSlice(ip), lib_name.toSlice(ip)); |
| ... | @@ -866,7 +866,7 @@ pub fn genNavRef( | ... | @@ -866,7 +866,7 @@ pub fn genNavRef( |
| 866 | .link_once => unreachable, | 866 | .link_once => unreachable, |
| 867 | } | 867 | } |
| 868 | if (is_threadlocal) zo.symbol(sym_index).flags.is_tls = true; | 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 | .link_once => unreachable, | 871 | .link_once => unreachable, |
| 872 | } | 872 | } |
| ... | @@ -878,7 +878,7 @@ pub fn genNavRef( | ... | @@ -878,7 +878,7 @@ pub fn genNavRef( |
| 878 | .internal => { | 878 | .internal => { |
| 879 | const sym_index = try zo.getOrCreateMetadataForNav(macho_file, nav_index); | 879 | const sym_index = try zo.getOrCreateMetadataForNav(macho_file, nav_index); |
| 880 | if (is_threadlocal) zo.symbols.items[sym_index].flags.tlv = true; | 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 | .strong, .weak => { | 883 | .strong, .weak => { |
| 884 | const sym_index = try macho_file.getGlobalSymbol(nav.name.toSlice(ip), lib_name.toSlice(ip)); | 884 | const sym_index = try macho_file.getGlobalSymbol(nav.name.toSlice(ip), lib_name.toSlice(ip)); |
| ... | @@ -889,12 +889,12 @@ pub fn genNavRef( | ... | @@ -889,12 +889,12 @@ pub fn genNavRef( |
| 889 | .link_once => unreachable, | 889 | .link_once => unreachable, |
| 890 | } | 890 | } |
| 891 | if (is_threadlocal) zo.symbols.items[sym_index].flags.tlv = true; | 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 | .link_once => unreachable, | 894 | .link_once => unreachable, |
| 895 | } | 895 | } |
| 896 | } else if (lf.cast(.coff2)) |coff| { | 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 | } else { | 898 | } else { |
| 899 | std.debug.panic("TODO genNavRef for '{t}'", .{lf.tag}); | 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,8 +72,8 @@ pub fn generate( |
| 72 | const air_main_body = air.getMainBody(); | 72 | const air_main_body = air.getMainBody(); |
| 73 | var param_it: Select.CallAbiIterator = .init; | 73 | var param_it: Select.CallAbiIterator = .init; |
| 74 | const air_args = for (air_main_body, 0..) |air_inst_index, body_index| { | 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]; | 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)[@intFromEnum(air_inst_index)].arg; | 76 | const arg = air.instructions.items(.data)[@backingInt(air_inst_index)].arg; |
| 77 | const param_ty = arg.ty.toType(); | 77 | const param_ty = arg.ty.toType(); |
| 78 | const param_vi = param_vi: { | 78 | const param_vi = param_vi: { |
| 79 | if (arg.zir_param_index >= named_params_len) { | 79 | if (arg.zir_param_index >= named_params_len) { |
| ... | @@ -82,17 +82,17 @@ pub fn generate( | ... | @@ -82,17 +82,17 @@ pub fn generate( |
| 82 | } | 82 | } |
| 83 | break :param_vi try param_it.param(&isel, param_ty); | 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 | try isel.live_values.putNoClobber(gpa, air_inst_index, param_vi.?); | 86 | try isel.live_values.putNoClobber(gpa, air_inst_index, param_vi.?); |
| 87 | } else unreachable; | 87 | } else unreachable; |
| 88 | 88 | ||
| 89 | const saved_gra_start = if (mod.strip) param_it.ngrn else Select.CallAbiIterator.ngrn_start; | 89 | const saved_gra_start = if (mod.strip) param_it.ngrn else Select.CallAbiIterator.ngrn_start; |
| 90 | const saved_gra_end = if (is_sysv_var_args) Select.CallAbiIterator.ngrn_end else param_it.ngrn; | 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 | const saved_vra_start = if (mod.strip) param_it.nsrn else Select.CallAbiIterator.nsrn_start; | 93 | const saved_vra_start = if (mod.strip) param_it.nsrn else Select.CallAbiIterator.nsrn_start; |
| 94 | const saved_vra_end = if (is_sysv_var_args) Select.CallAbiIterator.nsrn_end else param_it.nsrn; | 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 | const frame_record = 2; | 97 | const frame_record = 2; |
| 98 | const named_stack_args: Select.Value.Indirect = .{ | 98 | const named_stack_args: Select.Value.Indirect = .{ |
| ... | @@ -106,13 +106,13 @@ pub fn generate( | ... | @@ -106,13 +106,13 @@ pub fn generate( |
| 106 | .__stack = stack_var_args, | 106 | .__stack = stack_var_args, |
| 107 | .__gr_top = gr_top, | 107 | .__gr_top = gr_top, |
| 108 | .__vr_top = vr_top, | 108 | .__vr_top = vr_top, |
| 109 | .__gr_offs = @as(i32, @intFromEnum(Select.CallAbiIterator.ngrn_end) - @intFromEnum(param_it.ngrn)) * -8, | 109 | .__gr_offs = @as(i32, @backingInt(Select.CallAbiIterator.ngrn_end) - @backingInt(param_it.ngrn)) * -8, |
| 110 | .__vr_offs = @as(i32, @intFromEnum(Select.CallAbiIterator.nsrn_end) - @intFromEnum(param_it.nsrn)) * -16, | 110 | .__vr_offs = @as(i32, @backingInt(Select.CallAbiIterator.nsrn_end) - @backingInt(param_it.nsrn)) * -16, |
| 111 | } } else .{ .other = stack_var_args }; | 111 | } } else .{ .other = stack_var_args }; |
| 112 | 112 | ||
| 113 | // translate arg locations from caller-based to callee-based | 113 | // translate arg locations from caller-based to callee-based |
| 114 | for (air_args) |air_inst_index| { | 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 | const arg_vi = isel.live_values.get(air_inst_index).?; | 116 | const arg_vi = isel.live_values.get(air_inst_index).?; |
| 117 | const passed_vi = switch (arg_vi.parent(&isel)) { | 117 | const passed_vi = switch (arg_vi.parent(&isel)) { |
| 118 | .unallocated, .stack_slot => arg_vi, | 118 | .unallocated, .stack_slot => arg_vi, |
| ... | @@ -125,9 +125,9 @@ pub fn generate( | ... | @@ -125,9 +125,9 @@ pub fn generate( |
| 125 | const first_passed_part_vi = part_it.next().?; | 125 | const first_passed_part_vi = part_it.next().?; |
| 126 | const hint_ra = first_passed_part_vi.hint(&isel).?; | 126 | const hint_ra = first_passed_part_vi.hint(&isel).?; |
| 127 | passed_vi.setParent(&isel, .{ .stack_slot = if (hint_ra.isVector()) | 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 | else | 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 | .stack_slot => |stack_slot| { | 132 | .stack_slot => |stack_slot| { |
| 133 | assert(stack_slot.base == .sp); | 133 | assert(stack_slot.base == .sp); |
| ... | @@ -140,7 +140,7 @@ pub fn generate( | ... | @@ -140,7 +140,7 @@ pub fn generate( |
| 140 | ret: { | 140 | ret: { |
| 141 | var ret_it: Select.CallAbiIterator = .init; | 141 | var ret_it: Select.CallAbiIterator = .init; |
| 142 | const ret_vi = try ret_it.ret(&isel, .fromInterned(func_type.return_type)) orelse break :ret; | 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 | try isel.live_values.putNoClobber(gpa, Select.Block.main, ret_vi); | 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,7 +363,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 363 | return writer.print("{f}{s}{f}{s}#0x{d}{s}.{c}0x{x}", .{ | 363 | return writer.print("{f}{s}{f}{s}#0x{d}{s}.{c}0x{x}", .{ |
| 364 | fmtCase(group.op, dis.case), | 364 | fmtCase(group.op, dis.case), |
| 365 | dis.mnemonic_operands_separator, | 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 | dis.operands_separator, | 367 | dis.operands_separator, |
| 368 | @as(u6, group.b5) << 5 | | 368 | @as(u6, group.b5) << 5 | |
| 369 | @as(u6, group.b40) << 0, | 369 | @as(u6, group.b40) << 0, |
| ... | @@ -383,7 +383,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -383,7 +383,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 383 | const decoded = integer.decode(); | 383 | const decoded = integer.decode(); |
| 384 | if (decoded == .unallocated) break :unallocated; | 384 | if (decoded == .unallocated) break :unallocated; |
| 385 | const group = integer.group; | 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 | return writer.print("{f}{s}{f}{s}{f}{s}[{f}]{s}#{s}0x{x}", .{ | 387 | return writer.print("{f}{s}{f}{s}{f}{s}[{f}]{s}#{s}0x{x}", .{ |
| 388 | fmtCase(decoded, dis.case), | 388 | fmtCase(decoded, dis.case), |
| 389 | dis.mnemonic_operands_separator, | 389 | dis.mnemonic_operands_separator, |
| ... | @@ -394,7 +394,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -394,7 +394,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 394 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), | 394 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), |
| 395 | dis.operands_separator, | 395 | dis.operands_separator, |
| 396 | if (group.imm7 < 0) "-" else "", | 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 | .vector => |vector| { | 400 | .vector => |vector| { |
| ... | @@ -412,7 +412,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -412,7 +412,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 412 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), | 412 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), |
| 413 | dis.operands_separator, | 413 | dis.operands_separator, |
| 414 | if (group.imm7 < 0) "-" else "", | 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,7 +421,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 421 | const decoded = integer.decode(); | 421 | const decoded = integer.decode(); |
| 422 | if (decoded == .unallocated) break :unallocated; | 422 | if (decoded == .unallocated) break :unallocated; |
| 423 | const group = integer.group; | 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 | try writer.print("{f}{s}{f}{s}{f}{s}[{f}", .{ | 425 | try writer.print("{f}{s}{f}{s}{f}{s}[{f}", .{ |
| 426 | fmtCase(decoded, dis.case), | 426 | fmtCase(decoded, dis.case), |
| 427 | dis.mnemonic_operands_separator, | 427 | dis.mnemonic_operands_separator, |
| ... | @@ -434,7 +434,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -434,7 +434,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 434 | if (group.imm7 != 0) try writer.print("{s}#{s}0x{x}", .{ | 434 | if (group.imm7 != 0) try writer.print("{s}#{s}0x{x}", .{ |
| 435 | dis.operands_separator, | 435 | dis.operands_separator, |
| 436 | if (group.imm7 < 0) "-" else "", | 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 | return writer.writeByte(']'); | 439 | return writer.writeByte(']'); |
| 440 | }, | 440 | }, |
| ... | @@ -455,7 +455,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -455,7 +455,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 455 | if (group.imm7 != 0) try writer.print("{s}#{s}0x{x}", .{ | 455 | if (group.imm7 != 0) try writer.print("{s}#{s}0x{x}", .{ |
| 456 | dis.operands_separator, | 456 | dis.operands_separator, |
| 457 | if (group.imm7 < 0) "-" else "", | 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 | return writer.writeByte(']'); | 460 | return writer.writeByte(']'); |
| 461 | }, | 461 | }, |
| ... | @@ -465,7 +465,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -465,7 +465,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 465 | const decoded = integer.decode(); | 465 | const decoded = integer.decode(); |
| 466 | if (decoded == .unallocated) break :unallocated; | 466 | if (decoded == .unallocated) break :unallocated; |
| 467 | const group = integer.group; | 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 | return writer.print("{f}{s}{f}{s}{f}{s}[{f}{s}#{s}0x{x}]!", .{ | 469 | return writer.print("{f}{s}{f}{s}{f}{s}[{f}{s}#{s}0x{x}]!", .{ |
| 470 | fmtCase(decoded, dis.case), | 470 | fmtCase(decoded, dis.case), |
| 471 | dis.mnemonic_operands_separator, | 471 | dis.mnemonic_operands_separator, |
| ... | @@ -476,7 +476,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -476,7 +476,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 476 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), | 476 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), |
| 477 | dis.operands_separator, | 477 | dis.operands_separator, |
| 478 | if (group.imm7 < 0) "-" else "", | 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 | .vector => |vector| { | 482 | .vector => |vector| { |
| ... | @@ -494,7 +494,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -494,7 +494,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 494 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), | 494 | group.Rn.decode(.{ .sp = true }).x().fmtCase(dis.case), |
| 495 | dis.operands_separator, | 495 | dis.operands_separator, |
| 496 | if (group.imm7 < 0) "-" else "", | 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,7 +597,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 597 | fmtCase(group.option, dis.case), | 597 | fmtCase(group.option, dis.case), |
| 598 | }); | 598 | }); |
| 599 | if (group.S) try writer.print(" #{d}", .{ | 599 | if (group.S) try writer.print(" #{d}", .{ |
| 600 | @intFromEnum(group.size), | 600 | @backingInt(group.size), |
| 601 | }); | 601 | }); |
| 602 | } | 602 | } |
| 603 | return writer.writeByte(']'); | 603 | return writer.writeByte(']'); |
| ... | @@ -627,7 +627,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -627,7 +627,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 627 | }); | 627 | }); |
| 628 | if (group.imm12 > 0) try writer.print("{s}#0x{x}", .{ | 628 | if (group.imm12 > 0) try writer.print("{s}#0x{x}", .{ |
| 629 | dis.operands_separator, | 629 | dis.operands_separator, |
| 630 | @as(u15, group.imm12) << @intFromEnum(group.size), | 630 | @as(u15, group.imm12) << @backingInt(group.size), |
| 631 | }); | 631 | }); |
| 632 | return writer.writeByte(']'); | 632 | return writer.writeByte(']'); |
| 633 | }, | 633 | }, |
| ... | @@ -969,10 +969,10 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -969,10 +969,10 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 969 | else | 969 | else |
| 970 | fmtCase(decoded, dis.case), | 970 | fmtCase(decoded, dis.case), |
| 971 | dis.mnemonic_operands_separator, | 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 | dis.operands_separator, | 973 | dis.operands_separator, |
| 974 | group.Rn.decode(.{ .V = true }).element( | 974 | group.Rn.decode(.{ .V = true }).element( |
| 975 | @enumFromInt(elem_size), | 975 | @fromBackingInt(@intCast(elem_size)), |
| 976 | @intCast(group.imm5 >> (elem_size + 1)), | 976 | @intCast(group.imm5 >> (elem_size + 1)), |
| 977 | ).fmtCase(dis.case), | 977 | ).fmtCase(dis.case), |
| 978 | }); | 978 | }); |
| ... | @@ -1066,11 +1066,11 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -1066,11 +1066,11 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 1066 | .unallocated => unreachable, | 1066 | .unallocated => unreachable, |
| 1067 | .dup => |dup| group.Rd.decode(.{ .V = true }).vector(.wrap(.{ | 1067 | .dup => |dup| group.Rd.decode(.{ .V = true }).vector(.wrap(.{ |
| 1068 | .size = dup.Q, | 1068 | .size = dup.Q, |
| 1069 | .elem_size = @enumFromInt(elem_size), | 1069 | .elem_size = @fromBackingInt(@intCast(elem_size)), |
| 1070 | })), | 1070 | })), |
| 1071 | inline .smov, .umov => |mov| group.Rd.decode(.{}).general(mov.Q), | 1071 | inline .smov, .umov => |mov| group.Rd.decode(.{}).general(mov.Q), |
| 1072 | .ins => group.Rd.decode(.{ .V = true }).element( | 1072 | .ins => group.Rd.decode(.{ .V = true }).element( |
| 1073 | @enumFromInt(elem_size), | 1073 | @fromBackingInt(@intCast(elem_size)), |
| 1074 | @intCast(group.imm5 >> (elem_size + 1)), | 1074 | @intCast(group.imm5 >> (elem_size + 1)), |
| 1075 | ), | 1075 | ), |
| 1076 | }.fmtCase(dis.case), | 1076 | }.fmtCase(dis.case), |
| ... | @@ -1079,7 +1079,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -1079,7 +1079,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 1079 | .unallocated => unreachable, | 1079 | .unallocated => unreachable, |
| 1080 | .dup => |dup| switch (dup.imm4) { | 1080 | .dup => |dup| switch (dup.imm4) { |
| 1081 | .element => group.Rn.decode(.{ .V = true }).element( | 1081 | .element => group.Rn.decode(.{ .V = true }).element( |
| 1082 | @enumFromInt(elem_size), | 1082 | @fromBackingInt(@intCast(elem_size)), |
| 1083 | @intCast(group.imm5 >> (elem_size + 1)), | 1083 | @intCast(group.imm5 >> (elem_size + 1)), |
| 1084 | ), | 1084 | ), |
| 1085 | .general => group.Rn.decode(.{}).general(switch (elem_size) { | 1085 | .general => group.Rn.decode(.{}).general(switch (elem_size) { |
| ... | @@ -1090,12 +1090,12 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -1090,12 +1090,12 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 1090 | _ => unreachable, | 1090 | _ => unreachable, |
| 1091 | }, | 1091 | }, |
| 1092 | .smov, .umov => group.Rn.decode(.{ .V = true }).element( | 1092 | .smov, .umov => group.Rn.decode(.{ .V = true }).element( |
| 1093 | @enumFromInt(elem_size), | 1093 | @fromBackingInt(@intCast(elem_size)), |
| 1094 | @intCast(group.imm5 >> (elem_size + 1)), | 1094 | @intCast(group.imm5 >> (elem_size + 1)), |
| 1095 | ), | 1095 | ), |
| 1096 | .ins => |ins| switch (ins.op) { | 1096 | .ins => |ins| switch (ins.op) { |
| 1097 | .element => group.Rn.decode(.{ .V = true }).element( | 1097 | .element => group.Rn.decode(.{ .V = true }).element( |
| 1098 | @enumFromInt(elem_size), | 1098 | @fromBackingInt(@intCast(elem_size)), |
| 1099 | @intCast(group.imm4 >> @intCast(elem_size)), | 1099 | @intCast(group.imm4 >> @intCast(elem_size)), |
| 1100 | ), | 1100 | ), |
| 1101 | .general => group.Rn.decode(.{}).general(switch (elem_size) { | 1101 | .general => group.Rn.decode(.{}).general(switch (elem_size) { |
| ... | @@ -1263,7 +1263,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr | ... | @@ -1263,7 +1263,7 @@ pub fn printInstruction(dis: Disassemble, inst: aarch64.encoding.Instruction, wr |
| 1263 | .size = group.Q, | 1263 | .size = group.Q, |
| 1264 | .elem_size = switch (group.o2) { | 1264 | .elem_size = switch (group.o2) { |
| 1265 | 0b1 => .half, | 1265 | 0b1 => .half, |
| 1266 | 0b0 => DataProcessingVector.Sz.toSize(@enumFromInt(group.op)), | 1266 | 0b0 => DataProcessingVector.Sz.toSize(@fromBackingInt(@intCast(group.op))), |
| 1267 | }, | 1267 | }, |
| 1268 | })).fmtCase(dis.case), | 1268 | })).fmtCase(dis.case), |
| 1269 | }); | 1269 | }); |
| ... | @@ -1404,7 +1404,7 @@ pub const RegisterFormatter = struct { | ... | @@ -1404,7 +1404,7 @@ pub const RegisterFormatter = struct { |
| 1404 | .r30, | 1404 | .r30, |
| 1405 | => |alias| try writer.print("{c}{d}", .{ | 1405 | => |alias| try writer.print("{c}{d}", .{ |
| 1406 | data.case.convert(size.prefix()), | 1406 | data.case.convert(size.prefix()), |
| 1407 | @intFromEnum(alias.encode(.{})), | 1407 | @backingInt(alias.encode(.{})), |
| 1408 | }), | 1408 | }), |
| 1409 | .zr => try writer.print("{c}{f}", .{ | 1409 | .zr => try writer.print("{c}{f}", .{ |
| 1410 | data.case.convert(size.prefix()), | 1410 | data.case.convert(size.prefix()), |
| ... | @@ -1420,7 +1420,7 @@ pub const RegisterFormatter = struct { | ... | @@ -1420,7 +1420,7 @@ pub const RegisterFormatter = struct { |
| 1420 | }, | 1420 | }, |
| 1421 | .scalar => |size| try writer.print("{c}{d}", .{ | 1421 | .scalar => |size| try writer.print("{c}{d}", .{ |
| 1422 | data.case.convert(size.prefix()), | 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 | .vector => |arrangement| try writer.print("{f}.{f}", .{ | 1425 | .vector => |arrangement| try writer.print("{f}.{f}", .{ |
| 1426 | fmtCase(data.reg.alias, data.case), | 1426 | fmtCase(data.reg.alias, data.case), |
| ... | @@ -1433,7 +1433,7 @@ pub const RegisterFormatter = struct { | ... | @@ -1433,7 +1433,7 @@ pub const RegisterFormatter = struct { |
| 1433 | }), | 1433 | }), |
| 1434 | .scalable => try writer.print("{c}{d}", .{ | 1434 | .scalable => try writer.print("{c}{d}", .{ |
| 1435 | data.case.convert('z'), | 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,11 +122,11 @@ pub fn emit( |
| 122 | zcu, | 122 | zcu, |
| 123 | atom_index, | 123 | atom_index, |
| 124 | if (lf.cast(.elf)) |ef| | 124 | if (lf.cast(.elf)) |ef| |
| 125 | @enumFromInt(ef.zigObjectPtr().?.getOrCreateMetadataForLazySymbol(ef, pt, lazy_reloc.symbol) catch |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)})) | 126 | return zcu.codegenFail(func.owner_nav, "{s} creating lazy symbol", .{@errorName(err)}))) |
| 127 | else if (lf.cast(.macho)) |mf| | 127 | else if (lf.cast(.macho)) |mf| |
| 128 | @enumFromInt(mf.getZigObject().?.getOrCreateMetadataForLazySymbol(mf, pt, lazy_reloc.symbol) catch |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)})) | 129 | return zcu.codegenFail(func.owner_nav, "{s} creating lazy symbol", .{@errorName(err)}))) |
| 130 | else | 130 | else |
| 131 | return zcu.codegenFail(func.owner_nav, "external symbols unimplemented for {t}", .{lf.tag}), | 131 | return zcu.codegenFail(func.owner_nav, "external symbols unimplemented for {t}", .{lf.tag}), |
| 132 | mir.body[lazy_reloc.reloc.label], | 132 | mir.body[lazy_reloc.reloc.label], |
| ... | @@ -139,9 +139,9 @@ pub fn emit( | ... | @@ -139,9 +139,9 @@ pub fn emit( |
| 139 | zcu, | 139 | zcu, |
| 140 | atom_index, | 140 | atom_index, |
| 141 | if (lf.cast(.elf)) |ef| | 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 | else if (lf.cast(.macho)) |mf| | 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 | else | 145 | else |
| 146 | return zcu.codegenFail(func.owner_nav, "external symbols unimplemented for {t}", .{lf.tag}), | 146 | return zcu.codegenFail(func.owner_nav, "external symbols unimplemented for {t}", .{lf.tag}), |
| 147 | mir.body[global_reloc.reloc.label], | 147 | mir.body[global_reloc.reloc.label], |
| ... | @@ -189,7 +189,7 @@ fn emitReloc( | ... | @@ -189,7 +189,7 @@ fn emitReloc( |
| 189 | else => unreachable, | 189 | else => unreachable, |
| 190 | .data_processing_immediate => |decoded| if (lf.cast(.elf)) |ef| { | 190 | .data_processing_immediate => |decoded| if (lf.cast(.elf)) |ef| { |
| 191 | const zo = ef.zigObjectPtr().?; | 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 | const r_type: std.elf.R_AARCH64 = switch (decoded.decode()) { | 193 | const r_type: std.elf.R_AARCH64 = switch (decoded.decode()) { |
| 194 | else => unreachable, | 194 | else => unreachable, |
| 195 | .pc_relative_addressing => |pc_relative_addressing| switch (pc_relative_addressing.group.op) { | 195 | .pc_relative_addressing => |pc_relative_addressing| switch (pc_relative_addressing.group.op) { |
| ... | @@ -212,12 +212,12 @@ fn emitReloc( | ... | @@ -212,12 +212,12 @@ fn emitReloc( |
| 212 | }; | 212 | }; |
| 213 | try atom.addReloc(gpa, .{ | 213 | try atom.addReloc(gpa, .{ |
| 214 | .r_offset = offset, | 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 | .r_addend = @bitCast(addend), | 216 | .r_addend = @bitCast(addend), |
| 217 | }, zo); | 217 | }, zo); |
| 218 | } else if (lf.cast(.macho)) |mf| { | 218 | } else if (lf.cast(.macho)) |mf| { |
| 219 | const zo = mf.getZigObject().?; | 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 | switch (decoded.decode()) { | 221 | switch (decoded.decode()) { |
| 222 | else => unreachable, | 222 | else => unreachable, |
| 223 | .pc_relative_addressing => |pc_relative_addressing| switch (pc_relative_addressing.group.op) { | 223 | .pc_relative_addressing => |pc_relative_addressing| switch (pc_relative_addressing.group.op) { |
| ... | @@ -225,7 +225,7 @@ fn emitReloc( | ... | @@ -225,7 +225,7 @@ fn emitReloc( |
| 225 | .adrp => try atom.addReloc(mf, .{ | 225 | .adrp => try atom.addReloc(mf, .{ |
| 226 | .tag = .@"extern", | 226 | .tag = .@"extern", |
| 227 | .offset = offset, | 227 | .offset = offset, |
| 228 | .target = @intFromEnum(sym_index), | 228 | .target = @backingInt(sym_index), |
| 229 | .addend = @bitCast(addend), | 229 | .addend = @bitCast(addend), |
| 230 | .type = switch (kind) { | 230 | .type = switch (kind) { |
| 231 | .direct => .page, | 231 | .direct => .page, |
| ... | @@ -235,7 +235,7 @@ fn emitReloc( | ... | @@ -235,7 +235,7 @@ fn emitReloc( |
| 235 | .pcrel = true, | 235 | .pcrel = true, |
| 236 | .has_subtractor = false, | 236 | .has_subtractor = false, |
| 237 | .length = 2, | 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,7 +243,7 @@ fn emitReloc( |
| 243 | .add => try atom.addReloc(mf, .{ | 243 | .add => try atom.addReloc(mf, .{ |
| 244 | .tag = .@"extern", | 244 | .tag = .@"extern", |
| 245 | .offset = offset, | 245 | .offset = offset, |
| 246 | .target = @intFromEnum(sym_index), | 246 | .target = @backingInt(sym_index), |
| 247 | .addend = @bitCast(addend), | 247 | .addend = @bitCast(addend), |
| 248 | .type = switch (kind) { | 248 | .type = switch (kind) { |
| 249 | .direct => .pageoff, | 249 | .direct => .pageoff, |
| ... | @@ -253,7 +253,7 @@ fn emitReloc( | ... | @@ -253,7 +253,7 @@ fn emitReloc( |
| 253 | .pcrel = false, | 253 | .pcrel = false, |
| 254 | .has_subtractor = false, | 254 | .has_subtractor = false, |
| 255 | .length = 2, | 255 | .length = 2, |
| 256 | .symbolnum = @intCast(@intFromEnum(sym_index)), | 256 | .symbolnum = @intCast(@backingInt(sym_index)), |
| 257 | }, | 257 | }, |
| 258 | }), | 258 | }), |
| 259 | .sub => unreachable, | 259 | .sub => unreachable, |
| ... | @@ -262,36 +262,36 @@ fn emitReloc( | ... | @@ -262,36 +262,36 @@ fn emitReloc( |
| 262 | }, | 262 | }, |
| 263 | .branch_exception_generating_system => |decoded| if (lf.cast(.elf)) |ef| { | 263 | .branch_exception_generating_system => |decoded| if (lf.cast(.elf)) |ef| { |
| 264 | const zo = ef.zigObjectPtr().?; | 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 | const r_type: std.elf.R_AARCH64 = switch (decoded.decode().unconditional_branch_immediate.group.op) { | 266 | const r_type: std.elf.R_AARCH64 = switch (decoded.decode().unconditional_branch_immediate.group.op) { |
| 267 | .b => .JUMP26, | 267 | .b => .JUMP26, |
| 268 | .bl => .CALL26, | 268 | .bl => .CALL26, |
| 269 | }; | 269 | }; |
| 270 | try atom.addReloc(gpa, .{ | 270 | try atom.addReloc(gpa, .{ |
| 271 | .r_offset = offset, | 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 | .r_addend = @bitCast(addend), | 273 | .r_addend = @bitCast(addend), |
| 274 | }, zo); | 274 | }, zo); |
| 275 | } else if (lf.cast(.macho)) |mf| { | 275 | } else if (lf.cast(.macho)) |mf| { |
| 276 | const zo = mf.getZigObject().?; | 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 | try atom.addReloc(mf, .{ | 278 | try atom.addReloc(mf, .{ |
| 279 | .tag = .@"extern", | 279 | .tag = .@"extern", |
| 280 | .offset = offset, | 280 | .offset = offset, |
| 281 | .target = @intFromEnum(sym_index), | 281 | .target = @backingInt(sym_index), |
| 282 | .addend = @bitCast(addend), | 282 | .addend = @bitCast(addend), |
| 283 | .type = .branch, | 283 | .type = .branch, |
| 284 | .meta = .{ | 284 | .meta = .{ |
| 285 | .pcrel = true, | 285 | .pcrel = true, |
| 286 | .has_subtractor = false, | 286 | .has_subtractor = false, |
| 287 | .length = 2, | 287 | .length = 2, |
| 288 | .symbolnum = @intCast(@intFromEnum(sym_index)), | 288 | .symbolnum = @intCast(@backingInt(sym_index)), |
| 289 | }, | 289 | }, |
| 290 | }); | 290 | }); |
| 291 | }, | 291 | }, |
| 292 | .load_store => |decoded| if (lf.cast(.elf)) |ef| { | 292 | .load_store => |decoded| if (lf.cast(.elf)) |ef| { |
| 293 | const zo = ef.zigObjectPtr().?; | 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 | const r_type: std.elf.R_AARCH64 = switch (decoded.decode().register_unsigned_immediate.decode()) { | 295 | const r_type: std.elf.R_AARCH64 = switch (decoded.decode().register_unsigned_immediate.decode()) { |
| 296 | .integer => |integer| switch (integer.decode()) { | 296 | .integer => |integer| switch (integer.decode()) { |
| 297 | .unallocated, .prfm => unreachable, | 297 | .unallocated, .prfm => unreachable, |
| ... | @@ -332,16 +332,16 @@ fn emitReloc( | ... | @@ -332,16 +332,16 @@ fn emitReloc( |
| 332 | }; | 332 | }; |
| 333 | try atom.addReloc(gpa, .{ | 333 | try atom.addReloc(gpa, .{ |
| 334 | .r_offset = offset, | 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 | .r_addend = @bitCast(addend), | 336 | .r_addend = @bitCast(addend), |
| 337 | }, zo); | 337 | }, zo); |
| 338 | } else if (lf.cast(.macho)) |mf| { | 338 | } else if (lf.cast(.macho)) |mf| { |
| 339 | const zo = mf.getZigObject().?; | 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 | try atom.addReloc(mf, .{ | 341 | try atom.addReloc(mf, .{ |
| 342 | .tag = .@"extern", | 342 | .tag = .@"extern", |
| 343 | .offset = offset, | 343 | .offset = offset, |
| 344 | .target = @intFromEnum(sym_index), | 344 | .target = @backingInt(sym_index), |
| 345 | .addend = @bitCast(addend), | 345 | .addend = @bitCast(addend), |
| 346 | .type = switch (kind) { | 346 | .type = switch (kind) { |
| 347 | .direct => .pageoff, | 347 | .direct => .pageoff, |
| ... | @@ -351,7 +351,7 @@ fn emitReloc( | ... | @@ -351,7 +351,7 @@ fn emitReloc( |
| 351 | .pcrel = false, | 351 | .pcrel = false, |
| 352 | .has_subtractor = false, | 352 | .has_subtractor = false, |
| 353 | .length = 2, | 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,9 +52,9 @@ pub const Block = struct { |
| 52 | live_registers: LiveRegisters, | 52 | live_registers: LiveRegisters, |
| 53 | target_label: u32, | 53 | target_label: u32, |
| 54 | 54 | ||
| 55 | pub const main: Air.Inst.Index = @enumFromInt( | 55 | pub const main: Air.Inst.Index = @fromBackingInt(@intCast( |
| 56 | std.math.maxInt(@typeInfo(Air.Inst.Index).@"enum".tag_type), | 56 | std.math.maxInt(@typeInfo(Air.Inst.Index).@"enum".tag_type), |
| 57 | ); | 57 | )); |
| 58 | 58 | ||
| 59 | fn branch(target_block: *const Block, isel: *Select) !void { | 59 | fn branch(target_block: *const Block, isel: *Select) !void { |
| 60 | if (isel.instructions.items.len > target_block.target_label) { | 60 | if (isel.instructions.items.len > target_block.target_label) { |
| ... | @@ -72,19 +72,19 @@ pub const Loop = struct { | ... | @@ -72,19 +72,19 @@ pub const Loop = struct { |
| 72 | live_registers: LiveRegisters, | 72 | live_registers: LiveRegisters, |
| 73 | repeat_list: u32, | 73 | repeat_list: u32, |
| 74 | 74 | ||
| 75 | pub const invalid: Air.Inst.Index = @enumFromInt( | 75 | pub const invalid: Air.Inst.Index = @fromBackingInt(@intCast( |
| 76 | std.math.maxInt(@typeInfo(Air.Inst.Index).@"enum".tag_type), | 76 | std.math.maxInt(@typeInfo(Air.Inst.Index).@"enum".tag_type), |
| 77 | ); | 77 | )); |
| 78 | 78 | ||
| 79 | pub const Index = enum(u32) { | 79 | pub const Index = enum(u32) { |
| 80 | _, | 80 | _, |
| 81 | 81 | ||
| 82 | fn inst(li: Loop.Index, isel: *Select) Air.Inst.Index { | 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 | fn get(li: Loop.Index, isel: *Select) *Loop { | 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,7 +133,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 133 | var air_body_index: usize = 0; | 133 | var air_body_index: usize = 0; |
| 134 | var air_inst_index = air_body[air_body_index]; | 134 | var air_inst_index = air_body[air_body_index]; |
| 135 | const initial_def_order_len = isel.def_order.count(); | 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 | // No "scalarize" legalizations are enabled, so these instructions never appear. | 137 | // No "scalarize" legalizations are enabled, so these instructions never appear. |
| 138 | .legalize_vec_elem_val => unreachable, | 138 | .legalize_vec_elem_val => unreachable, |
| 139 | .legalize_vec_store_elem => unreachable, | 139 | .legalize_vec_store_elem => unreachable, |
| ... | @@ -152,7 +152,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -152,7 +152,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 152 | 152 | ||
| 153 | air_body_index += 1; | 153 | air_body_index += 1; |
| 154 | air_inst_index = air_body[air_body_index]; | 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 | .add, | 157 | .add, |
| 158 | .add_safe, | 158 | .add_safe, |
| ... | @@ -209,7 +209,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -209,7 +209,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 209 | .slice_elem_val, | 209 | .slice_elem_val, |
| 210 | .ptr_elem_val, | 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 | try isel.analyzeUse(bin_op.lhs); | 214 | try isel.analyzeUse(bin_op.lhs); |
| 215 | try isel.analyzeUse(bin_op.rhs); | 215 | try isel.analyzeUse(bin_op.rhs); |
| ... | @@ -217,7 +217,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -217,7 +217,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 217 | 217 | ||
| 218 | air_body_index += 1; | 218 | air_body_index += 1; |
| 219 | air_inst_index = air_body[air_body_index]; | 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 | .ptr_add, | 222 | .ptr_add, |
| 223 | .ptr_sub, | 223 | .ptr_sub, |
| ... | @@ -229,7 +229,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -229,7 +229,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 229 | .slice_elem_ptr, | 229 | .slice_elem_ptr, |
| 230 | .ptr_elem_ptr, | 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 | const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data; | 233 | const bin_op = isel.air.extraData(Air.Bin, ty_pl.payload).data; |
| 234 | 234 | ||
| 235 | try isel.analyzeUse(bin_op.lhs); | 235 | try isel.analyzeUse(bin_op.lhs); |
| ... | @@ -238,17 +238,17 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -238,17 +238,17 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 238 | 238 | ||
| 239 | air_body_index += 1; | 239 | air_body_index += 1; |
| 240 | air_inst_index = air_body[air_body_index]; | 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 | .alloc => { | 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 | isel.stack_align = isel.stack_align.maxStrict(ty.ptrAlignment(zcu)); | 246 | isel.stack_align = isel.stack_align.maxStrict(ty.ptrAlignment(zcu)); |
| 247 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); | 247 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| 248 | 248 | ||
| 249 | air_body_index += 1; | 249 | air_body_index += 1; |
| 250 | air_inst_index = air_body[air_body_index]; | 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 | .inferred_alloc, | 253 | .inferred_alloc, |
| 254 | .inferred_alloc_comptime, | 254 | .inferred_alloc_comptime, |
| ... | @@ -260,7 +260,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -260,7 +260,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 260 | .spirv_runtime_array_len, | 260 | .spirv_runtime_array_len, |
| 261 | => unreachable, | 261 | => unreachable, |
| 262 | .ret_ptr => { | 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 | if (isel.live_values.get(Block.main)) |ret_vi| switch (ret_vi.parent(isel)) { | 265 | if (isel.live_values.get(Block.main)) |ret_vi| switch (ret_vi.parent(isel)) { |
| 266 | .unallocated, .stack_slot => isel.stack_align = isel.stack_align.maxStrict(ty.ptrAlignment(zcu)), | 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,10 +271,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 271 | 271 | ||
| 272 | air_body_index += 1; | 272 | air_body_index += 1; |
| 273 | air_inst_index = air_body[air_body_index]; | 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 | .assembly => { | 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 | const unwrapped_asm = isel.air.unwrapAsm(air_inst_index); | 278 | const unwrapped_asm = isel.air.unwrapAsm(air_inst_index); |
| 279 | 279 | ||
| 280 | for (unwrapped_asm.outputs) |operand| if (operand != .none) try isel.analyzeUse(operand); | 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,7 +282,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 282 | 282 | ||
| 283 | air_body_index += 1; | 283 | air_body_index += 1; |
| 284 | air_inst_index = air_body[air_body_index]; | 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 | .not, | 287 | .not, |
| 288 | .clz, | 288 | .clz, |
| ... | @@ -327,14 +327,14 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -327,14 +327,14 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 327 | .c_va_arg, | 327 | .c_va_arg, |
| 328 | .c_va_copy, | 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 | try isel.analyzeUse(ty_op.operand); | 332 | try isel.analyzeUse(ty_op.operand); |
| 333 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); | 333 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| 334 | 334 | ||
| 335 | air_body_index += 1; | 335 | air_body_index += 1; |
| 336 | air_inst_index = air_body[air_body_index]; | 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 | .bit_cast, | 339 | .bit_cast, |
| 340 | .ptr_cast, | 340 | .ptr_cast, |
| ... | @@ -345,7 +345,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -345,7 +345,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 345 | .int_from_error, | 345 | .int_from_error, |
| 346 | .union_from_enum, | 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 | maybe_noop: { | 349 | maybe_noop: { |
| 350 | if (ty_op.ty.toInterned().? != isel.air.typeOf(ty_op.operand, ip).toIntern()) break :maybe_noop; | 350 | if (ty_op.ty.toInterned().? != isel.air.typeOf(ty_op.operand, ip).toIntern()) break :maybe_noop; |
| 351 | if (true) break :maybe_noop; | 351 | if (true) break :maybe_noop; |
| ... | @@ -360,7 +360,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -360,7 +360,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 360 | 360 | ||
| 361 | air_body_index += 1; | 361 | air_body_index += 1; |
| 362 | air_inst_index = air_body[air_body_index]; | 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 | .bit_cast_safe => unreachable, // legalized | 365 | .bit_cast_safe => unreachable, // legalized |
| 366 | inline .block, .dbg_inline_block => |air_tag| { | 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,7 +388,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 388 | 388 | ||
| 389 | air_body_index += 1; | 389 | air_body_index += 1; |
| 390 | air_inst_index = air_body[air_body_index]; | 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 | .loop => { | 393 | .loop => { |
| 394 | const air_body_block = isel.air.unwrapBlock(air_inst_index); | 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,7 +397,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 397 | const initial_dom_len = isel.dom_len; | 397 | const initial_dom_len = isel.dom_len; |
| 398 | isel.dom_start = @intCast(isel.dom.items.len); | 398 | isel.dom_start = @intCast(isel.dom.items.len); |
| 399 | isel.dom_len = @intCast(isel.blocks.count()); | 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 | try isel.loops.putNoClobber(gpa, air_inst_index, .{ | 401 | try isel.loops.putNoClobber(gpa, air_inst_index, .{ |
| 402 | .def_order = @intCast(isel.def_order.count()), | 402 | .def_order = @intCast(isel.def_order.count()), |
| 403 | .dom = isel.dom_start, | 403 | .dom = isel.dom_start, |
| ... | @@ -420,7 +420,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -420,7 +420,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 420 | }, | 420 | }, |
| 421 | .repeat, .trap, .unreach => air_body_index += 1, | 421 | .repeat, .trap, .unreach => air_body_index += 1, |
| 422 | .br => { | 422 | .br => { |
| 423 | const br = air_data[@intFromEnum(air_inst_index)].br; | 423 | const br = air_data[@backingInt(air_inst_index)].br; |
| 424 | const block_index = isel.blocks.getIndex(br.block_inst).?; | 424 | const block_index = isel.blocks.getIndex(br.block_inst).?; |
| 425 | if (block_index < isel.dom_len) isel.dom.items[isel.dom_start + block_index / @bitSizeOf(DomInt)] |= @as(DomInt, 1) << @truncate(block_index); | 425 | if (block_index < isel.dom_len) isel.dom.items[isel.dom_start + block_index / @bitSizeOf(DomInt)] |= @as(DomInt, 1) << @truncate(block_index); |
| 426 | try isel.analyzeUse(br.operand); | 426 | try isel.analyzeUse(br.operand); |
| ... | @@ -430,7 +430,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -430,7 +430,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 430 | .breakpoint, .dbg_stmt, .dbg_empty_stmt, .dbg_var_ptr, .dbg_var_val, .dbg_arg_inline, .c_va_end => { | 430 | .breakpoint, .dbg_stmt, .dbg_empty_stmt, .dbg_var_ptr, .dbg_var_val, .dbg_arg_inline, .c_va_end => { |
| 431 | air_body_index += 1; | 431 | air_body_index += 1; |
| 432 | air_inst_index = air_body[air_body_index]; | 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 | .call, | 435 | .call, |
| 436 | .call_always_tail, | 436 | .call_always_tail, |
| ... | @@ -486,7 +486,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -486,7 +486,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 486 | 486 | ||
| 487 | var ret_it: CallAbiIterator = .init; | 487 | var ret_it: CallAbiIterator = .init; |
| 488 | if (try ret_it.ret(isel, isel.air.typeOfIndex(air_inst_index, ip))) |ret_vi| { | 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 | switch (ret_vi.parent(isel)) { | 490 | switch (ret_vi.parent(isel)) { |
| 491 | .unallocated, .stack_slot => {}, | 491 | .unallocated, .stack_slot => {}, |
| 492 | .value, .constant => unreachable, | 492 | .value, .constant => unreachable, |
| ... | @@ -504,7 +504,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -504,7 +504,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 504 | 504 | ||
| 505 | air_body_index += 1; | 505 | air_body_index += 1; |
| 506 | air_inst_index = air_body[air_body_index]; | 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 | .sqrt, | 509 | .sqrt, |
| 510 | .sin, | 510 | .sin, |
| ... | @@ -534,17 +534,17 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -534,17 +534,17 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 534 | .error_name, | 534 | .error_name, |
| 535 | .cmp_lte_errors_len, | 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 | try isel.analyzeUse(un_op); | 539 | try isel.analyzeUse(un_op); |
| 540 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); | 540 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| 541 | 541 | ||
| 542 | air_body_index += 1; | 542 | air_body_index += 1; |
| 543 | air_inst_index = air_body[air_body_index]; | 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 | .cmp_vector, .cmp_vector_optimized => { | 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 | const extra = isel.air.extraData(Air.VectorCmp, ty_pl.payload).data; | 548 | const extra = isel.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 549 | 549 | ||
| 550 | try isel.analyzeUse(extra.lhs); | 550 | try isel.analyzeUse(extra.lhs); |
| ... | @@ -553,7 +553,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -553,7 +553,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 553 | 553 | ||
| 554 | air_body_index += 1; | 554 | air_body_index += 1; |
| 555 | air_inst_index = air_body[air_body_index]; | 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 | .cond_br => { | 558 | .cond_br => { |
| 559 | const cond_br = isel.air.unwrapCondBr(air_inst_index); | 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,7 +583,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 583 | const initial_dom_len = isel.dom_len; | 583 | const initial_dom_len = isel.dom_len; |
| 584 | isel.dom_start = @intCast(isel.dom.items.len); | 584 | isel.dom_start = @intCast(isel.dom.items.len); |
| 585 | isel.dom_len = @intCast(isel.blocks.count()); | 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 | try isel.loops.putNoClobber(gpa, air_inst_index, .{ | 587 | try isel.loops.putNoClobber(gpa, air_inst_index, .{ |
| 588 | .def_order = @intCast(isel.def_order.count()), | 588 | .def_order = @intCast(isel.def_order.count()), |
| 589 | .dom = isel.dom_start, | 589 | .dom = isel.dom_start, |
| ... | @@ -609,7 +609,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -609,7 +609,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 609 | air_body_index += 1; | 609 | air_body_index += 1; |
| 610 | }, | 610 | }, |
| 611 | .switch_dispatch => { | 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 | try isel.analyzeUse(br.operand); | 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,7 +624,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 624 | 624 | ||
| 625 | air_body_index += 1; | 625 | air_body_index += 1; |
| 626 | air_inst_index = air_body[air_body_index]; | 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 | .try_ptr, .try_ptr_cold => { | 629 | .try_ptr, .try_ptr_cold => { |
| 630 | const unwrapped_try = isel.air.unwrapTryPtr(air_inst_index); | 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,10 +635,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 635 | 635 | ||
| 636 | air_body_index += 1; | 636 | air_body_index += 1; |
| 637 | air_inst_index = air_body[air_body_index]; | 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 | .ret, .ret_safe, .ret_load => { | 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 | isel.returns = true; | 642 | isel.returns = true; |
| 643 | 643 | ||
| 644 | const block_index = 0; | 644 | const block_index = 0; |
| ... | @@ -661,17 +661,17 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -661,17 +661,17 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 661 | .atomic_store_release, | 661 | .atomic_store_release, |
| 662 | .atomic_store_seq_cst, | 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 | try isel.analyzeUse(bin_op.lhs); | 666 | try isel.analyzeUse(bin_op.lhs); |
| 667 | try isel.analyzeUse(bin_op.rhs); | 667 | try isel.analyzeUse(bin_op.rhs); |
| 668 | 668 | ||
| 669 | air_body_index += 1; | 669 | air_body_index += 1; |
| 670 | air_inst_index = air_body[air_body_index]; | 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 | .struct_field_ptr, .agg_field_val => { | 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 | const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data; | 675 | const extra = isel.air.extraData(Air.StructField, ty_pl.payload).data; |
| 676 | 676 | ||
| 677 | try isel.analyzeUse(extra.struct_operand); | 677 | try isel.analyzeUse(extra.struct_operand); |
| ... | @@ -679,10 +679,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -679,10 +679,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 679 | 679 | ||
| 680 | air_body_index += 1; | 680 | air_body_index += 1; |
| 681 | air_inst_index = air_body[air_body_index]; | 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 | .slice_len => { | 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 | try isel.analyzeUse(ty_op.operand); | 687 | try isel.analyzeUse(ty_op.operand); |
| 688 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); | 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,10 +694,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 694 | 694 | ||
| 695 | air_body_index += 1; | 695 | air_body_index += 1; |
| 696 | air_inst_index = air_body[air_body_index]; | 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 | .slice_ptr => { | 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 | try isel.analyzeUse(ty_op.operand); | 702 | try isel.analyzeUse(ty_op.operand); |
| 703 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); | 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,17 +709,17 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 709 | 709 | ||
| 710 | air_body_index += 1; | 710 | air_body_index += 1; |
| 711 | air_inst_index = air_body[air_body_index]; | 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 | .reduce, .reduce_optimized => { | 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 | try isel.analyzeUse(reduce.operand); | 717 | try isel.analyzeUse(reduce.operand); |
| 718 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); | 718 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| 719 | 719 | ||
| 720 | air_body_index += 1; | 720 | air_body_index += 1; |
| 721 | air_inst_index = air_body[air_body_index]; | 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 | .shuffle_one => { | 724 | .shuffle_one => { |
| 725 | const extra = isel.air.unwrapShuffleOne(zcu, air_inst_index); | 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,7 +729,7 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 729 | 729 | ||
| 730 | air_body_index += 1; | 730 | air_body_index += 1; |
| 731 | air_inst_index = air_body[air_body_index]; | 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 | .shuffle_two => { | 734 | .shuffle_two => { |
| 735 | const extra = isel.air.unwrapShuffleTwo(zcu, air_inst_index); | 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,10 +740,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 740 | 740 | ||
| 741 | air_body_index += 1; | 741 | air_body_index += 1; |
| 742 | air_inst_index = air_body[air_body_index]; | 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 | .select, .mul_add => { | 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 | const bin_op = isel.air.extraData(Air.Bin, pl_op.payload).data; | 747 | const bin_op = isel.air.extraData(Air.Bin, pl_op.payload).data; |
| 748 | 748 | ||
| 749 | try isel.analyzeUse(pl_op.operand); | 749 | try isel.analyzeUse(pl_op.operand); |
| ... | @@ -753,10 +753,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -753,10 +753,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 753 | 753 | ||
| 754 | air_body_index += 1; | 754 | air_body_index += 1; |
| 755 | air_inst_index = air_body[air_body_index]; | 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 | .cmpxchg_weak, .cmpxchg_strong => { | 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 | const extra = isel.air.extraData(Air.Cmpxchg, ty_pl.payload).data; | 760 | const extra = isel.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 761 | 761 | ||
| 762 | try isel.analyzeUse(extra.ptr); | 762 | try isel.analyzeUse(extra.ptr); |
| ... | @@ -766,20 +766,20 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -766,20 +766,20 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 766 | 766 | ||
| 767 | air_body_index += 1; | 767 | air_body_index += 1; |
| 768 | air_inst_index = air_body[air_body_index]; | 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 | .atomic_load => { | 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 | try isel.analyzeUse(atomic_load.ptr); | 774 | try isel.analyzeUse(atomic_load.ptr); |
| 775 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); | 775 | try isel.def_order.putNoClobber(gpa, air_inst_index, {}); |
| 776 | 776 | ||
| 777 | air_body_index += 1; | 777 | air_body_index += 1; |
| 778 | air_inst_index = air_body[air_body_index]; | 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 | .atomic_rmw => { | 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 | const extra = isel.air.extraData(Air.AtomicRmw, pl_op.payload).data; | 783 | const extra = isel.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 784 | 784 | ||
| 785 | try isel.analyzeUse(extra.operand); | 785 | try isel.analyzeUse(extra.operand); |
| ... | @@ -787,10 +787,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -787,10 +787,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 787 | 787 | ||
| 788 | air_body_index += 1; | 788 | air_body_index += 1; |
| 789 | air_inst_index = air_body[air_body_index]; | 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 | .aggregate_init => { | 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 | const elements: []const Air.Inst.Ref = @ptrCast(isel.air.extra.items[ty_pl.payload..][0..@intCast(ty_pl.ty.toType().arrayLen(zcu))]); | 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 | for (elements) |element| try isel.analyzeUse(element); | 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,10 +798,10 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 798 | 798 | ||
| 799 | air_body_index += 1; | 799 | air_body_index += 1; |
| 800 | air_inst_index = air_body[air_body_index]; | 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 | .union_init => { | 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 | const extra = isel.air.extraData(Air.UnionInit, ty_pl.payload).data; | 805 | const extra = isel.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 806 | 806 | ||
| 807 | try isel.analyzeUse(extra.init); | 807 | try isel.analyzeUse(extra.init); |
| ... | @@ -809,19 +809,19 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -809,19 +809,19 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 809 | 809 | ||
| 810 | air_body_index += 1; | 810 | air_body_index += 1; |
| 811 | air_inst_index = air_body[air_body_index]; | 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 | .prefetch => { | 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 | try isel.analyzeUse(prefetch.ptr); | 817 | try isel.analyzeUse(prefetch.ptr); |
| 818 | 818 | ||
| 819 | air_body_index += 1; | 819 | air_body_index += 1; |
| 820 | air_inst_index = air_body[air_body_index]; | 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 | .field_parent_ptr => { | 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 | const extra = isel.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 825 | const extra = isel.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 826 | 826 | ||
| 827 | try isel.analyzeUse(extra.field_ptr); | 827 | try isel.analyzeUse(extra.field_ptr); |
| ... | @@ -829,16 +829,16 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { | ... | @@ -829,16 +829,16 @@ pub fn analyze(isel: *Select, air_body: []const Air.Inst.Index) !void { |
| 829 | 829 | ||
| 830 | air_body_index += 1; | 830 | air_body_index += 1; |
| 831 | air_inst_index = air_body[air_body_index]; | 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 | .set_err_return_trace => { | 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 | try isel.analyzeUse(un_op); | 837 | try isel.analyzeUse(un_op); |
| 838 | 838 | ||
| 839 | air_body_index += 1; | 839 | air_body_index += 1; |
| 840 | air_inst_index = air_body[air_body_index]; | 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 | assert(air_body_index == air_body.len); | 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,11 +923,11 @@ pub fn body(isel: *Select, air_body: []const Air.Inst.Index) error{ OutOfMemory, |
| 923 | inst_index: Air.Inst.Index, | 923 | inst_index: Air.Inst.Index, |
| 924 | 924 | ||
| 925 | fn tag(it: *@This(), inst_index: Air.Inst.Index) Air.Inst.Tag { | 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 | fn data(it: *@This(), inst_index: Air.Inst.Index) Air.Inst.Data { | 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 | fn next(it: *@This()) ?Air.Inst.Tag { | 933 | fn next(it: *@This()) ?Air.Inst.Tag { |
| ... | @@ -7619,7 +7619,7 @@ pub fn layout( | ... | @@ -7619,7 +7619,7 @@ pub fn layout( |
| 7619 | 7619 | ||
| 7620 | // callee saved gr area | 7620 | // callee saved gr area |
| 7621 | save_ra = .r19; | 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 | if (!isel.saved_registers.contains(save_ra)) continue; | 7623 | if (!isel.saved_registers.contains(save_ra)) continue; |
| 7624 | saves_size = std.mem.alignForward(u10, saves_size, 8); | 7624 | saves_size = std.mem.alignForward(u10, saves_size, 8); |
| 7625 | saves_buf[saves_len] = .{ | 7625 | saves_buf[saves_len] = .{ |
| ... | @@ -7641,7 +7641,7 @@ pub fn layout( | ... | @@ -7641,7 +7641,7 @@ pub fn layout( |
| 7641 | 7641 | ||
| 7642 | // callee saved vr area | 7642 | // callee saved vr area |
| 7643 | save_ra = .v8; | 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 | if (!isel.saved_registers.contains(save_ra)) continue; | 7645 | if (!isel.saved_registers.contains(save_ra)) continue; |
| 7646 | saves_size = std.mem.alignForward(u10, saves_size, 8); | 7646 | saves_size = std.mem.alignForward(u10, saves_size, 8); |
| 7647 | saves_buf[saves_len] = .{ | 7647 | saves_buf[saves_len] = .{ |
| ... | @@ -7681,7 +7681,7 @@ pub fn layout( | ... | @@ -7681,7 +7681,7 @@ pub fn layout( |
| 7681 | 7681 | ||
| 7682 | // incoming vr arguments | 7682 | // incoming vr arguments |
| 7683 | save_ra = if (mod.strip) incoming.nsrn else CallAbiIterator.nsrn_start; | 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 | saves_size = std.mem.alignForward(u10, saves_size, 16); | 7685 | saves_size = std.mem.alignForward(u10, saves_size, 16); |
| 7686 | saves_buf[saves_len] = .{ | 7686 | saves_buf[saves_len] = .{ |
| 7687 | .class = .vector, | 7687 | .class = .vector, |
| ... | @@ -7736,7 +7736,7 @@ pub fn layout( | ... | @@ -7736,7 +7736,7 @@ pub fn layout( |
| 7736 | 1 => saves_size += 8, | 7736 | 1 => saves_size += 8, |
| 7737 | } | 7737 | } |
| 7738 | save_ra = if (mod.strip) incoming.ngrn else CallAbiIterator.ngrn_start; | 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 | saves_size = std.mem.alignForward(u10, saves_size, 8); | 7740 | saves_size = std.mem.alignForward(u10, saves_size, 8); |
| 7741 | saves_buf[saves_len] = .{ | 7741 | saves_buf[saves_len] = .{ |
| 7742 | .class = .integer, | 7742 | .class = .integer, |
| ... | @@ -7917,7 +7917,7 @@ fn fmtDom(isel: *Select, inst: Air.Inst.Index, start: u32, len: u32) struct { | ... | @@ -7917,7 +7917,7 @@ fn fmtDom(isel: *Select, inst: Air.Inst.Index, start: u32, len: u32) struct { |
| 7917 | start: u32, | 7917 | start: u32, |
| 7918 | len: u32, | 7918 | len: u32, |
| 7919 | pub fn format(data: @This(), writer: *std.Io.Writer) std.Io.Writer.Error!void { | 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 | var first = true; | 7921 | var first = true; |
| 7922 | for (data.isel.blocks.keys()[0..data.len], 0..) |block_inst_index, dom_index| { | 7922 | for (data.isel.blocks.keys()[0..data.len], 0..) |block_inst_index, dom_index| { |
| 7923 | if (@as(u1, @truncate(data.isel.dom.items[ | 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,7 +7930,7 @@ fn fmtDom(isel: *Select, inst: Air.Inst.Index, start: u32, len: u32) struct { |
| 7930 | } | 7930 | } |
| 7931 | switch (block_inst_index) { | 7931 | switch (block_inst_index) { |
| 7932 | Block.main => try writer.writeAll(" %main"), | 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 | if (!first) try writer.writeByte(' '); | 7936 | if (!first) try writer.writeByte(' '); |
| ... | @@ -7949,7 +7949,7 @@ fn fmtLoopLive(isel: *Select, loop_inst: Air.Inst.Index) struct { | ... | @@ -7949,7 +7949,7 @@ fn fmtLoopLive(isel: *Select, loop_inst: Air.Inst.Index) struct { |
| 7949 | const live_insts = | 7949 | const live_insts = |
| 7950 | data.isel.loop_live.list.items[loops[loop_index].live..loops[loop_index + 1].live]; | 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 | var first = true; | 7953 | var first = true; |
| 7954 | for (live_insts) |live_inst| { | 7954 | for (live_insts) |live_inst| { |
| 7955 | if (first) { | 7955 | if (first) { |
| ... | @@ -7957,7 +7957,7 @@ fn fmtLoopLive(isel: *Select, loop_inst: Air.Inst.Index) struct { | ... | @@ -7957,7 +7957,7 @@ fn fmtLoopLive(isel: *Select, loop_inst: Air.Inst.Index) struct { |
| 7957 | } else { | 7957 | } else { |
| 7958 | try writer.writeByte(','); | 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 | if (!first) try writer.writeByte(' '); | 7962 | if (!first) try writer.writeByte(' '); |
| 7963 | try writer.writeByte('}'); | 7963 | try writer.writeByte('}'); |
| ... | @@ -8090,7 +8090,7 @@ fn movImmediate(isel: *Select, dst_reg: Register, src_imm: u64) !void { | ... | @@ -8090,7 +8090,7 @@ fn movImmediate(isel: *Select, dst_reg: Register, src_imm: u64) !void { |
| 8090 | .doubleword => .xzr, | 8090 | .doubleword => .xzr, |
| 8091 | }, | 8091 | }, |
| 8092 | .{ .immediate = .{ | 8092 | .{ .immediate = .{ |
| 8093 | .N = @enumFromInt(elem_width >> 6), | 8093 | .N = @fromBackingInt(@intCast(elem_width >> 6)), |
| 8094 | .immr = hi + mid_masked, | 8094 | .immr = hi + mid_masked, |
| 8095 | .imms = ((((lo + hi) & smask) | mid_masked) - 1) | -%@as(u6, @truncate(elem_width)) << 1, | 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,18 +8107,18 @@ fn movImmediate(isel: *Select, dst_reg: Register, src_imm: u64) !void { |
| 8107 | try isel.emit(if (remaining_parts > 0) .movk( | 8107 | try isel.emit(if (remaining_parts > 0) .movk( |
| 8108 | dst_reg, | 8108 | dst_reg, |
| 8109 | parts[part_index], | 8109 | parts[part_index], |
| 8110 | .{ .lsl = @enumFromInt(part_index) }, | 8110 | .{ .lsl = @fromBackingInt(@intCast(part_index)) }, |
| 8111 | ) else switch (fill_part) { | 8111 | ) else switch (fill_part) { |
| 8112 | else => unreachable, | 8112 | else => unreachable, |
| 8113 | min_part => .movz( | 8113 | min_part => .movz( |
| 8114 | dst_reg, | 8114 | dst_reg, |
| 8115 | parts[part_index], | 8115 | parts[part_index], |
| 8116 | .{ .lsl = @enumFromInt(part_index) }, | 8116 | .{ .lsl = @fromBackingInt(@intCast(part_index)) }, |
| 8117 | ), | 8117 | ), |
| 8118 | max_part => .movn( | 8118 | max_part => .movn( |
| 8119 | dst_reg, | 8119 | dst_reg, |
| 8120 | ~parts[part_index], | 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,7 +8954,7 @@ pub const Value = struct { |
| 8954 | _, | 8954 | _, |
| 8955 | 8955 | ||
| 8956 | fn get(vi: Value.Index, isel: *Select) *Value { | 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 | fn setAlignment(vi: Value.Index, isel: *Select, new_alignment: InternPool.Alignment) void { | 8960 | fn setAlignment(vi: Value.Index, isel: *Select, new_alignment: InternPool.Alignment) void { |
| ... | @@ -9099,15 +9099,15 @@ pub const Value = struct { | ... | @@ -9099,15 +9099,15 @@ pub const Value = struct { |
| 9099 | assert(parts_len > 1); | 9099 | assert(parts_len > 1); |
| 9100 | const value = vi.get(isel); | 9100 | const value = vi.get(isel); |
| 9101 | assert(value.flags.parts_len_minus_one == 0); | 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 | value.flags.parts_len_minus_one = @intCast(parts_len - 1); | 9103 | value.flags.parts_len_minus_one = @intCast(parts_len - 1); |
| 9104 | } | 9104 | } |
| 9105 | 9105 | ||
| 9106 | fn addPart(vi: Value.Index, isel: *Select, part_offset: u64, part_size: u64) Value.Index { | 9106 | fn addPart(vi: Value.Index, isel: *Select, part_offset: u64, part_size: u64) Value.Index { |
| 9107 | const part_vi = isel.initValueAdvanced(vi.alignment(isel), part_offset, part_size); | 9107 | const part_vi = isel.initValueAdvanced(vi.alignment(isel), part_offset, part_size); |
| 9108 | tracking_log.debug("${d} <- ${d}[{d}]", .{ | 9108 | tracking_log.debug("${d} <- ${d}[{d}]", .{ |
| 9109 | @intFromEnum(part_vi), | 9109 | @backingInt(part_vi), |
| 9110 | @intFromEnum(vi), | 9110 | @backingInt(vi), |
| 9111 | part_offset, | 9111 | part_offset, |
| 9112 | }); | 9112 | }); |
| 9113 | part_vi.setParent(isel, .{ .value = vi }); | 9113 | part_vi.setParent(isel, .{ .value = vi }); |
| ... | @@ -9132,7 +9132,7 @@ pub const Value = struct { | ... | @@ -9132,7 +9132,7 @@ pub const Value = struct { |
| 9132 | const end_vi = vi.partAtOffset(isel, part_size - 1 + part_offset); | 9132 | const end_vi = vi.partAtOffset(isel, part_size - 1 + part_offset); |
| 9133 | return .{ | 9133 | return .{ |
| 9134 | .vi = start_vi, | 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 | comptime { | 9138 | comptime { |
| ... | @@ -9148,7 +9148,7 @@ pub const Value = struct { | ... | @@ -9148,7 +9148,7 @@ pub const Value = struct { |
| 9148 | last += 1; | 9148 | last += 1; |
| 9149 | while (true) { | 9149 | while (true) { |
| 9150 | const mid = (first + last) / 2; | 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 | if (mid == first) return mid_vi; | 9152 | if (mid == first) return mid_vi; |
| 9153 | if (offset < mid_vi.get(isel).offset_from_parent) last = mid else first = mid; | 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,7 +10042,7 @@ pub const Value = struct { |
| 10042 | fn allocStackSlot(vi: Value.Index, isel: *Select) Value.Indirect { | 10042 | fn allocStackSlot(vi: Value.Index, isel: *Select) Value.Indirect { |
| 10043 | const offset = vi.alignment(isel).forward(isel.stack_size); | 10043 | const offset = vi.alignment(isel).forward(isel.stack_size); |
| 10044 | isel.stack_size = @intCast(offset + vi.size(isel)); | 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 | return .{ | 10046 | return .{ |
| 10047 | .base = .sp, | 10047 | .base = .sp, |
| 10048 | .offset = @intCast(offset), | 10048 | .offset = @intCast(offset), |
| ... | @@ -10145,7 +10145,7 @@ pub const Value = struct { | ... | @@ -10145,7 +10145,7 @@ pub const Value = struct { |
| 10145 | pub fn next(it: *PartIterator) ?Value.Index { | 10145 | pub fn next(it: *PartIterator) ?Value.Index { |
| 10146 | if (it.remaining == 0) return null; | 10146 | if (it.remaining == 0) return null; |
| 10147 | it.remaining -= 1; | 10147 | it.remaining -= 1; |
| 10148 | defer it.vi = @enumFromInt(@intFromEnum(it.vi) + 1); | 10148 | defer it.vi = @fromBackingInt(@intCast(@backingInt(it.vi) + 1)); |
| 10149 | return it.vi; | 10149 | return it.vi; |
| 10150 | } | 10150 | } |
| 10151 | 10151 | ||
| ... | @@ -11229,7 +11229,7 @@ fn initValueAdvanced( | ... | @@ -11229,7 +11229,7 @@ fn initValueAdvanced( |
| 11229 | } }, | 11229 | } }, |
| 11230 | .parts = undefined, | 11230 | .parts = undefined, |
| 11231 | }; | 11231 | }; |
| 11232 | return @enumFromInt(isel.values.items.len); | 11232 | return @fromBackingInt(@intCast(isel.values.items.len)); |
| 11233 | } | 11233 | } |
| 11234 | const WhichValues = enum { only_referenced, all }; | 11234 | const WhichValues = enum { only_referenced, all }; |
| 11235 | pub fn dumpValues(isel: *Select, which: WhichValues) void { | 11235 | pub fn dumpValues(isel: *Select, which: WhichValues) void { |
| ... | @@ -11278,9 +11278,9 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { | ... | @@ -11278,9 +11278,9 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { |
| 11278 | defer roots.deinit(gpa); | 11278 | defer roots.deinit(gpa); |
| 11279 | { | 11279 | { |
| 11280 | try roots.ensureTotalCapacity(gpa, isel.values.items.len); | 11280 | try roots.ensureTotalCapacity(gpa, isel.values.items.len); |
| 11281 | var vi: Value.Index = @enumFromInt(isel.values.items.len); | 11281 | var vi: Value.Index = @fromBackingInt(@intCast(isel.values.items.len)); |
| 11282 | while (@intFromEnum(vi) > 0) { | 11282 | while (@backingInt(vi) > 0) { |
| 11283 | vi = @enumFromInt(@intFromEnum(vi) - 1); | 11283 | vi = @fromBackingInt(@intCast(@backingInt(vi) - 1)); |
| 11284 | if (which == .only_referenced and vi.get(isel).refs == 0) continue; | 11284 | if (which == .only_referenced and vi.get(isel).refs == 0) continue; |
| 11285 | while (true) switch (vi.parent(isel)) { | 11285 | while (true) switch (vi.parent(isel)) { |
| 11286 | .unallocated, .stack_slot, .constant => break, | 11286 | .unallocated, .stack_slot, .constant => break, |
| ... | @@ -11296,14 +11296,14 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { | ... | @@ -11296,14 +11296,14 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { |
| 11296 | const vi = root_entry.key; | 11296 | const vi = root_entry.key; |
| 11297 | const value = vi.get(isel); | 11297 | const value = vi.get(isel); |
| 11298 | try stderr.splatByteAll(' ', 2 * (@as(usize, 1) + root_entry.value)); | 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 | var first = true; | 11301 | var first = true; |
| 11302 | if (reverse_live_values.get(vi)) |aiis| for (aiis.items) |aii| { | 11302 | if (reverse_live_values.get(vi)) |aiis| for (aiis.items) |aii| { |
| 11303 | if (aii == Block.main) { | 11303 | if (aii == Block.main) { |
| 11304 | try stderr.print("{s}%main", .{if (first) " <- " else ", "}); | 11304 | try stderr.print("{s}%main", .{if (first) " <- " else ", "}); |
| 11305 | } else { | 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 | first = false; | 11308 | first = false; |
| 11309 | }; | 11309 | }; |
| ... | @@ -11324,8 +11324,8 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { | ... | @@ -11324,8 +11324,8 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { |
| 11324 | if (value.offset_from_parent != 0) try stderr.print("+0x{x}", .{value.offset_from_parent}); | 11324 | if (value.offset_from_parent != 0) try stderr.print("+0x{x}", .{value.offset_from_parent}); |
| 11325 | try stderr.writeByte(']'); | 11325 | try stderr.writeByte(']'); |
| 11326 | }, | 11326 | }, |
| 11327 | .value => try stderr.print(" ${d}+0x{x}", .{ @intFromEnum(value.parent_payload.value), 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}]", .{ @intFromEnum(value.parent_payload.address), value.offset_from_parent }), | 11328 | .address => try stderr.print(" ${d}[0x{x}]", .{ @backingInt(value.parent_payload.address), value.offset_from_parent }), |
| 11329 | .constant => try stderr.print(" <{f}, {f}>", .{ | 11329 | .constant => try stderr.print(" <{f}, {f}>", .{ |
| 11330 | isel.fmtType(value.parent_payload.constant.typeOf(zcu)), | 11330 | isel.fmtType(value.parent_payload.constant.typeOf(zcu)), |
| 11331 | isel.fmtConstant(value.parent_payload.constant), | 11331 | isel.fmtConstant(value.parent_payload.constant), |
| ... | @@ -11350,7 +11350,7 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { | ... | @@ -11350,7 +11350,7 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { |
| 11350 | var part_index = value.flags.parts_len_minus_one; | 11350 | var part_index = value.flags.parts_len_minus_one; |
| 11351 | if (part_index > 0) while (true) : (part_index -= 1) { | 11351 | if (part_index > 0) while (true) : (part_index -= 1) { |
| 11352 | roots.putAssumeCapacityNoClobber( | 11352 | roots.putAssumeCapacityNoClobber( |
| 11353 | @enumFromInt(@intFromEnum(value.parts) + part_index), | 11353 | @fromBackingInt(@intCast(@backingInt(value.parts) + part_index)), |
| 11354 | root_entry.value + 1, | 11354 | root_entry.value + 1, |
| 11355 | ); | 11355 | ); |
| 11356 | if (part_index == 0) break; | 11356 | if (part_index == 0) break; |
| ... | @@ -11517,7 +11517,7 @@ const TryAllocRegResult = union(enum) { | ... | @@ -11517,7 +11517,7 @@ const TryAllocRegResult = union(enum) { |
| 11517 | fn tryAllocIntReg(isel: *Select) TryAllocRegResult { | 11517 | fn tryAllocIntReg(isel: *Select) TryAllocRegResult { |
| 11518 | var failed_result: TryAllocRegResult = .out_of_registers; | 11518 | var failed_result: TryAllocRegResult = .out_of_registers; |
| 11519 | var ra: Register.Alias = .r0; | 11519 | var ra: Register.Alias = .r0; |
| 11520 | while (true) : (ra = @enumFromInt(@intFromEnum(ra) + 1)) { | 11520 | while (true) : (ra = @fromBackingInt(@intCast(@backingInt(ra) + 1))) { |
| 11521 | if (ra == .r18) continue; // The Platform Register | 11521 | if (ra == .r18) continue; // The Platform Register |
| 11522 | if (ra == Register.Alias.fp) continue; | 11522 | if (ra == Register.Alias.fp) continue; |
| 11523 | const live_vi = isel.live_registers.getPtr(ra); | 11523 | const live_vi = isel.live_registers.getPtr(ra); |
| ... | @@ -11555,7 +11555,7 @@ fn allocIntReg(isel: *Select) !Register.Alias { | ... | @@ -11555,7 +11555,7 @@ fn allocIntReg(isel: *Select) !Register.Alias { |
| 11555 | fn tryAllocVecReg(isel: *Select) TryAllocRegResult { | 11555 | fn tryAllocVecReg(isel: *Select) TryAllocRegResult { |
| 11556 | var failed_result: TryAllocRegResult = .out_of_registers; | 11556 | var failed_result: TryAllocRegResult = .out_of_registers; |
| 11557 | var ra: Register.Alias = .v0; | 11557 | var ra: Register.Alias = .v0; |
| 11558 | while (true) : (ra = @enumFromInt(@intFromEnum(ra) + 1)) { | 11558 | while (true) : (ra = @fromBackingInt(@intCast(@backingInt(ra) + 1))) { |
| 11559 | const live_vi = isel.live_registers.getPtr(ra); | 11559 | const live_vi = isel.live_registers.getPtr(ra); |
| 11560 | switch (live_vi.*) { | 11560 | switch (live_vi.*) { |
| 11561 | _ => switch (failed_result) { | 11561 | _ => switch (failed_result) { |
| ... | @@ -11632,8 +11632,8 @@ fn use(isel: *Select, air_ref: Air.Inst.Ref) !Value.Index { | ... | @@ -11632,8 +11632,8 @@ fn use(isel: *Select, air_ref: Air.Inst.Ref) !Value.Index { |
| 11632 | const ty = isel.air.typeOf(air_ref, ip); | 11632 | const ty = isel.air.typeOf(air_ref, ip); |
| 11633 | const vi = isel.initValue(ty); | 11633 | const vi = isel.initValue(ty); |
| 11634 | tracking_log.debug("${d} <- %{d}", .{ | 11634 | tracking_log.debug("${d} <- %{d}", .{ |
| 11635 | @intFromEnum(vi), | 11635 | @backingInt(vi), |
| 11636 | @intFromEnum(air_inst_index), | 11636 | @backingInt(air_inst_index), |
| 11637 | }); | 11637 | }); |
| 11638 | live_gop.value_ptr.* = vi.ref(isel); | 11638 | live_gop.value_ptr.* = vi.ref(isel); |
| 11639 | break :vi_ty .{ vi, ty }; | 11639 | break :vi_ty .{ vi, ty }; |
| ... | @@ -11642,7 +11642,7 @@ fn use(isel: *Select, air_ref: Air.Inst.Ref) !Value.Index { | ... | @@ -11642,7 +11642,7 @@ fn use(isel: *Select, air_ref: Air.Inst.Ref) !Value.Index { |
| 11642 | const ty = constant.typeOf(zcu); | 11642 | const ty = constant.typeOf(zcu); |
| 11643 | const vi = isel.initValue(ty); | 11643 | const vi = isel.initValue(ty); |
| 11644 | tracking_log.debug("${d} <- <{f}, {f}>", .{ | 11644 | tracking_log.debug("${d} <- <{f}, {f}>", .{ |
| 11645 | @intFromEnum(vi), | 11645 | @backingInt(vi), |
| 11646 | isel.fmtType(ty), | 11646 | isel.fmtType(ty), |
| 11647 | isel.fmtConstant(constant), | 11647 | isel.fmtConstant(constant), |
| 11648 | }); | 11648 | }); |
| ... | @@ -11857,8 +11857,8 @@ fn merge( | ... | @@ -11857,8 +11857,8 @@ fn merge( |
| 11857 | } | 11857 | } |
| 11858 | 11858 | ||
| 11859 | const call = struct { | 11859 | const call = struct { |
| 11860 | const param_reg: Value.Index = @enumFromInt(@intFromEnum(Value.Index.allocating) - 2); | 11860 | const param_reg: Value.Index = @fromBackingInt(@intCast(@backingInt(Value.Index.allocating) - 2)); |
| 11861 | const callee_clobbered_reg: Value.Index = @enumFromInt(@intFromEnum(Value.Index.allocating) - 1); | 11861 | const callee_clobbered_reg: Value.Index = @fromBackingInt(@intCast(@backingInt(Value.Index.allocating) - 1)); |
| 11862 | const caller_saved_regs: LiveRegisters = .init(.{ | 11862 | const caller_saved_regs: LiveRegisters = .init(.{ |
| 11863 | .r0 = param_reg, | 11863 | .r0 = param_reg, |
| 11864 | .r1 = param_reg, | 11864 | .r1 = param_reg, |
| ... | @@ -12454,7 +12454,7 @@ pub const CallAbiIterator = struct { | ... | @@ -12454,7 +12454,7 @@ pub const CallAbiIterator = struct { |
| 12454 | wip_vi.setAlignment(isel, natural_alignment.maxStrict(.@"8")); | 12454 | wip_vi.setAlignment(isel, natural_alignment.maxStrict(.@"8")); |
| 12455 | if (it.ngrn == ngrn_end) return it.stack(isel, wip_vi); | 12455 | if (it.ngrn == ngrn_end) return it.stack(isel, wip_vi); |
| 12456 | wip_vi.setHint(isel, it.ngrn); | 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 | fn integers(it: *CallAbiIterator, isel: *Select, wip_vi: Value.Index, part_sizes: [2]u64) void { | 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,11 +12463,11 @@ pub const CallAbiIterator = struct { |
| 12463 | assert(natural_alignment.order(.@"16").compare(.lte)); | 12463 | assert(natural_alignment.order(.@"16").compare(.lte)); |
| 12464 | wip_vi.setAlignment(isel, natural_alignment.maxStrict(.@"8")); | 12464 | wip_vi.setAlignment(isel, natural_alignment.maxStrict(.@"8")); |
| 12465 | // C.8 | 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 | @typeInfo(Register.Alias).@"enum".tag_type, | 12467 | @typeInfo(Register.Alias).@"enum".tag_type, |
| 12468 | @intFromEnum(it.ngrn), | 12468 | @backingInt(it.ngrn), |
| 12469 | 2, | 12469 | 2, |
| 12470 | )); | 12470 | ))); |
| 12471 | if (it.ngrn == ngrn_end) return it.stack(isel, wip_vi); | 12471 | if (it.ngrn == ngrn_end) return it.stack(isel, wip_vi); |
| 12472 | wip_vi.setParts(isel, part_sizes.len); | 12472 | wip_vi.setParts(isel, part_sizes.len); |
| 12473 | for (0.., part_sizes) |part_index, part_size| | 12473 | for (0.., part_sizes) |part_index, part_size| |
| ... | @@ -12482,7 +12482,7 @@ pub const CallAbiIterator = struct { | ... | @@ -12482,7 +12482,7 @@ pub const CallAbiIterator = struct { |
| 12482 | wip_vi.setIsVector(isel); | 12482 | wip_vi.setIsVector(isel); |
| 12483 | if (it.nsrn == nsrn_end) return it.stack(isel, wip_vi); | 12483 | if (it.nsrn == nsrn_end) return it.stack(isel, wip_vi); |
| 12484 | wip_vi.setHint(isel, it.nsrn); | 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 | fn vectors( | 12488 | fn vectors( |
| ... | @@ -12497,7 +12497,7 @@ pub const CallAbiIterator = struct { | ... | @@ -12497,7 +12497,7 @@ pub const CallAbiIterator = struct { |
| 12497 | const natural_alignment = wip_vi.alignment(isel); | 12497 | const natural_alignment = wip_vi.alignment(isel); |
| 12498 | assert(natural_alignment.order(.@"16").compare(.lte)); | 12498 | assert(natural_alignment.order(.@"16").compare(.lte)); |
| 12499 | wip_vi.setAlignment(isel, natural_alignment.maxStrict(.@"8")); | 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 | if (parts_len == 1) return it.vector(isel, wip_vi); | 12501 | if (parts_len == 1) return it.vector(isel, wip_vi); |
| 12502 | wip_vi.setParts(isel, parts_len); | 12502 | wip_vi.setParts(isel, parts_len); |
| 12503 | const fdt_size = @as(u64, 1) << fdt_log2_size; | 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,11 +34,11 @@ pub const Register = struct { |
| 34 | quad = 4, | 34 | quad = 4, |
| 35 | 35 | ||
| 36 | pub fn n(ss: ScalarSize) ScalarSize { | 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 | pub fn w(ss: ScalarSize) ScalarSize { | 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 | pub fn prefix(ss: ScalarSize) u8 { | 44 | pub fn prefix(ss: ScalarSize) u8 { |
| ... | @@ -68,10 +68,10 @@ pub const Register = struct { | ... | @@ -68,10 +68,10 @@ pub const Register = struct { |
| 68 | elem_size: Instruction.DataProcessingVector.Size, | 68 | elem_size: Instruction.DataProcessingVector.Size, |
| 69 | }; | 69 | }; |
| 70 | pub fn wrap(unwrapped: Unwrapped) Arrangement { | 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 | pub fn unwrap(arrangement: Arrangement) Unwrapped { | 73 | pub fn unwrap(arrangement: Arrangement) Unwrapped { |
| 74 | return @bitCast(@intFromEnum(arrangement)); | 74 | return @bitCast(@backingInt(arrangement)); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | pub fn len(arrangement: Arrangement) u5 { | 77 | pub fn len(arrangement: Arrangement) u5 { |
| ... | @@ -395,9 +395,9 @@ pub const Register = struct { | ... | @@ -395,9 +395,9 @@ pub const Register = struct { |
| 395 | 395 | ||
| 396 | pub fn decode(enc: Encoded, opts: struct { sp: bool = false, V: bool = false }) Alias { | 396 | pub fn decode(enc: Encoded, opts: struct { sp: bool = false, V: bool = false }) Alias { |
| 397 | return switch (opts.V) { | 397 | return switch (opts.V) { |
| 398 | false => @enumFromInt(@intFromEnum(Alias.r0) + @intFromEnum(enc) + | 398 | false => @fromBackingInt(@intCast(@backingInt(Alias.r0) + @backingInt(enc) + |
| 399 | @intFromBool(opts.sp and enc == comptime Alias.sp.encode(.{ .sp = true }))), | 399 | @intFromBool(opts.sp and enc == comptime Alias.sp.encode(.{ .sp = true })))), |
| 400 | true => @enumFromInt(@intFromEnum(Alias.v0) + @intFromEnum(enc)), | 400 | true => @fromBackingInt(@intCast(@backingInt(Alias.v0) + @backingInt(enc))), |
| 401 | }; | 401 | }; |
| 402 | } | 402 | } |
| 403 | }; | 403 | }; |
| ... | @@ -503,38 +503,38 @@ pub const Register = struct { | ... | @@ -503,38 +503,38 @@ pub const Register = struct { |
| 503 | 503 | ||
| 504 | pub fn alias(ra: Alias, fa: Format.Alias) Register { | 504 | pub fn alias(ra: Alias, fa: Format.Alias) Register { |
| 505 | switch (fa) { | 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 | .other => switch (ra) { | 507 | .other => switch (ra) { |
| 508 | else => unreachable, | 508 | else => unreachable, |
| 509 | .pc, .fpcr, .fpsr, .ffr => {}, | 509 | .pc, .fpcr, .fpsr, .ffr => {}, |
| 510 | }, | 510 | }, |
| 511 | .vector => assert(@intFromEnum(ra) >= @intFromEnum(Alias.v0) and @intFromEnum(ra) <= @intFromEnum(Alias.v31)), | 511 | .vector => assert(@backingInt(ra) >= @backingInt(Alias.v0) and @backingInt(ra) <= @backingInt(Alias.v31)), |
| 512 | .predicate => assert(@intFromEnum(ra) >= @intFromEnum(Alias.p0) and @intFromEnum(ra) <= @intFromEnum(Alias.p15)), | 512 | .predicate => assert(@backingInt(ra) >= @backingInt(Alias.p0) and @backingInt(ra) <= @backingInt(Alias.p15)), |
| 513 | } | 513 | } |
| 514 | return .{ .alias = ra, .format = .{ .alias = fa } }; | 514 | return .{ .alias = ra, .format = .{ .alias = fa } }; |
| 515 | } | 515 | } |
| 516 | pub fn general(ra: Alias, gs: GeneralSize) Register { | 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 | return .{ .alias = ra, .format = .{ .general = gs } }; | 518 | return .{ .alias = ra, .format = .{ .general = gs } }; |
| 519 | } | 519 | } |
| 520 | pub fn scalar(ra: Alias, ss: ScalarSize) Register { | 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 | return .{ .alias = ra, .format = .{ .scalar = ss } }; | 522 | return .{ .alias = ra, .format = .{ .scalar = ss } }; |
| 523 | } | 523 | } |
| 524 | pub fn vector(ra: Alias, arrangement: Arrangement) Register { | 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 | return .{ .alias = ra, .format = .{ .vector = arrangement } }; | 526 | return .{ .alias = ra, .format = .{ .vector = arrangement } }; |
| 527 | } | 527 | } |
| 528 | pub fn element(ra: Alias, ss: ScalarSize, index: u4) Register { | 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 | return .{ .alias = ra, .format = .{ .element = .{ .size = ss, .index = index } } }; | 530 | return .{ .alias = ra, .format = .{ .element = .{ .size = ss, .index = index } } }; |
| 531 | } | 531 | } |
| 532 | pub fn z(ra: Alias) Register { | 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 | return .{ .alias = ra, .format = .scalable }; | 534 | return .{ .alias = ra, .format = .scalable }; |
| 535 | } | 535 | } |
| 536 | pub fn p(ra: Alias) Register { | 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 | return .{ .alias = ra, .format = .{ .scalar = .predicate } }; | 538 | return .{ .alias = ra, .format = .{ .scalar = .predicate } }; |
| 539 | } | 539 | } |
| 540 | 540 | ||
| ... | @@ -700,7 +700,7 @@ pub const Register = struct { | ... | @@ -700,7 +700,7 @@ pub const Register = struct { |
| 700 | } | 700 | } |
| 701 | 701 | ||
| 702 | pub fn encode(ra: Alias, comptime opts: struct { sp: bool = false, V: bool = false }) Encoded { | 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 | .r0 => if (opts.V) unreachable else 0, | 704 | .r0 => if (opts.V) unreachable else 0, |
| 705 | .r1 => if (opts.V) unreachable else 1, | 705 | .r1 => if (opts.V) unreachable else 1, |
| 706 | .r2 => if (opts.V) unreachable else 2, | 706 | .r2 => if (opts.V) unreachable else 2, |
| ... | @@ -770,7 +770,7 @@ pub const Register = struct { | ... | @@ -770,7 +770,7 @@ pub const Register = struct { |
| 770 | .fpcr, .fpsr => unreachable, | 770 | .fpcr, .fpsr => unreachable, |
| 771 | .p0, .p1, .p2, .p3, .p4, .p5, .p6, .p7, .p8, .p9, .p10, .p11, .p12, .p13, .p14, .p15 => unreachable, | 771 | .p0, .p1, .p2, .p3, .p4, .p5, .p6, .p7, .p8, .p9, .p10, .p11, .p12, .p13, .p14, .p15 => unreachable, |
| 772 | .ffr => unreachable, | 772 | .ffr => unreachable, |
| 773 | })); | 773 | }))); |
| 774 | } | 774 | } |
| 775 | }; | 775 | }; |
| 776 | 776 | ||
| ... | @@ -806,21 +806,21 @@ pub const Register = struct { | ... | @@ -806,21 +806,21 @@ pub const Register = struct { |
| 806 | else => null, | 806 | else => null, |
| 807 | 'r' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| switch (n) { | 807 | 'r' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| switch (n) { |
| 808 | 0...30 => .{ | 808 | 0...30 => .{ |
| 809 | .alias = @enumFromInt(@intFromEnum(Alias.r0) + n), | 809 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.r0) + n)), |
| 810 | .format = .{ .alias = .general }, | 810 | .format = .{ .alias = .general }, |
| 811 | }, | 811 | }, |
| 812 | 31 => null, | 812 | 31 => null, |
| 813 | } else |_| null, | 813 | } else |_| null, |
| 814 | 'x' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| switch (n) { | 814 | 'x' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| switch (n) { |
| 815 | 0...30 => .{ | 815 | 0...30 => .{ |
| 816 | .alias = @enumFromInt(@intFromEnum(Alias.r0) + n), | 816 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.r0) + n)), |
| 817 | .format = .{ .general = .doubleword }, | 817 | .format = .{ .general = .doubleword }, |
| 818 | }, | 818 | }, |
| 819 | 31 => null, | 819 | 31 => null, |
| 820 | } else |_| if (toLowerEqlAssertLower(reg, "xzr")) .xzr else null, | 820 | } else |_| if (toLowerEqlAssertLower(reg, "xzr")) .xzr else null, |
| 821 | 'w' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| switch (n) { | 821 | 'w' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| switch (n) { |
| 822 | 0...30 => .{ | 822 | 0...30 => .{ |
| 823 | .alias = @enumFromInt(@intFromEnum(Alias.r0) + n), | 823 | .alias = @fromBackingInt(@intCast(@backingInt(Alias.r0) + n)), |
| 824 | .format = .{ .general = .word }, | 824 | .format = .{ .general = .word }, |
| 825 | }, | 825 | }, |
| 826 | 31 => null, | 826 | 31 => null, |
| ... | @@ -839,27 +839,27 @@ pub const Register = struct { | ... | @@ -839,27 +839,27 @@ pub const Register = struct { |
| 839 | 'f' => return if (toLowerEqlAssertLower(reg, "fp")) .fp else null, | 839 | 'f' => return if (toLowerEqlAssertLower(reg, "fp")) .fp else null, |
| 840 | 'p' => return if (toLowerEqlAssertLower(reg, "pc")) .pc else null, | 840 | 'p' => return if (toLowerEqlAssertLower(reg, "pc")) .pc else null, |
| 841 | 'v' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ | 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 | .format = .{ .alias = .vector }, | 843 | .format = .{ .alias = .vector }, |
| 844 | } else |_| null, | 844 | } else |_| null, |
| 845 | 'q' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ | 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 | .format = .{ .scalar = .quad }, | 847 | .format = .{ .scalar = .quad }, |
| 848 | } else |_| null, | 848 | } else |_| null, |
| 849 | 'd' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ | 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 | .format = .{ .scalar = .double }, | 851 | .format = .{ .scalar = .double }, |
| 852 | } else |_| null, | 852 | } else |_| null, |
| 853 | 's' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ | 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 | .format = .{ .scalar = .single }, | 855 | .format = .{ .scalar = .single }, |
| 856 | } else |_| if (toLowerEqlAssertLower(reg, "sp")) .sp else null, | 856 | } else |_| if (toLowerEqlAssertLower(reg, "sp")) .sp else null, |
| 857 | 'h' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ | 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 | .format = .{ .scalar = .half }, | 859 | .format = .{ .scalar = .half }, |
| 860 | } else |_| null, | 860 | } else |_| null, |
| 861 | 'b' => if (std.fmt.parseInt(u5, reg[1..], 10)) |n| .{ | 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 | .format = .{ .scalar = .byte }, | 863 | .format = .{ .scalar = .byte }, |
| 864 | } else |_| null, | 864 | } else |_| null, |
| 865 | }; | 865 | }; |
| ... | @@ -1363,7 +1363,7 @@ pub const ConditionCode = enum(u4) { | ... | @@ -1363,7 +1363,7 @@ pub const ConditionCode = enum(u4) { |
| 1363 | pub const cc: ConditionCode = .lo; | 1363 | pub const cc: ConditionCode = .lo; |
| 1364 | 1364 | ||
| 1365 | pub fn invert(cond: ConditionCode) ConditionCode { | 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,7 +2772,7 @@ pub const Instruction = packed union { |
| 2772 | 2772 | ||
| 2773 | /// C6.2.37 BR | 2773 | /// C6.2.37 BR |
| 2774 | pub const Br = packed struct { | 2774 | pub const Br = packed struct { |
| 2775 | Rm: Register.Encoded = @enumFromInt(0), | 2775 | Rm: Register.Encoded = @fromBackingInt(@intCast(0)), |
| 2776 | Rn: Register.Encoded, | 2776 | Rn: Register.Encoded, |
| 2777 | M: bool = false, | 2777 | M: bool = false, |
| 2778 | A: bool = false, | 2778 | A: bool = false, |
| ... | @@ -2786,7 +2786,7 @@ pub const Instruction = packed union { | ... | @@ -2786,7 +2786,7 @@ pub const Instruction = packed union { |
| 2786 | 2786 | ||
| 2787 | /// C6.2.35 BLR | 2787 | /// C6.2.35 BLR |
| 2788 | pub const Blr = packed struct { | 2788 | pub const Blr = packed struct { |
| 2789 | Rm: Register.Encoded = @enumFromInt(0), | 2789 | Rm: Register.Encoded = @fromBackingInt(@intCast(0)), |
| 2790 | Rn: Register.Encoded, | 2790 | Rn: Register.Encoded, |
| 2791 | M: bool = false, | 2791 | M: bool = false, |
| 2792 | A: bool = false, | 2792 | A: bool = false, |
| ... | @@ -2800,7 +2800,7 @@ pub const Instruction = packed union { | ... | @@ -2800,7 +2800,7 @@ pub const Instruction = packed union { |
| 2800 | 2800 | ||
| 2801 | /// C6.2.254 RET | 2801 | /// C6.2.254 RET |
| 2802 | pub const Ret = packed struct { | 2802 | pub const Ret = packed struct { |
| 2803 | Rm: Register.Encoded = @enumFromInt(0), | 2803 | Rm: Register.Encoded = @fromBackingInt(@intCast(0)), |
| 2804 | Rn: Register.Encoded, | 2804 | Rn: Register.Encoded, |
| 2805 | M: bool = false, | 2805 | M: bool = false, |
| 2806 | A: bool = false, | 2806 | A: bool = false, |
| ... | @@ -11131,11 +11131,11 @@ pub const Instruction = packed union { | ... | @@ -11131,11 +11131,11 @@ pub const Instruction = packed union { |
| 11131 | double = 0b11, | 11131 | double = 0b11, |
| 11132 | 11132 | ||
| 11133 | pub fn n(s: Size) Size { | 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 | pub fn w(s: Size) Size { | 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 | pub fn toScalarSize(s: Size) Register.ScalarSize { | 11141 | pub fn toScalarSize(s: Size) Register.ScalarSize { |
| ... | @@ -12379,12 +12379,12 @@ pub const Instruction = packed union { | ... | @@ -12379,12 +12379,12 @@ pub const Instruction = packed union { |
| 12379 | switch (d.format) { | 12379 | switch (d.format) { |
| 12380 | else => unreachable, | 12380 | else => unreachable, |
| 12381 | .scalar => |elem_size| { | 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 | return .{ .data_processing_vector = .{ .simd_scalar_copy = .{ | 12383 | return .{ .data_processing_vector = .{ .simd_scalar_copy = .{ |
| 12384 | .dup = .{ | 12384 | .dup = .{ |
| 12385 | .Rd = d.alias.encode(.{ .V = true }), | 12385 | .Rd = d.alias.encode(.{ .V = true }), |
| 12386 | .Rn = n.alias.encode(.{ .V = true }), | 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,7 +12400,7 @@ pub const Instruction = packed union { |
| 12400 | .Rd = d.alias.encode(.{ .V = true }), | 12400 | .Rd = d.alias.encode(.{ .V = true }), |
| 12401 | .Rn = n.alias.encode(.{ .V = true }), | 12401 | .Rn = n.alias.encode(.{ .V = true }), |
| 12402 | .imm4 = .element, | 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 | .Q = arrangement.size(), | 12404 | .Q = arrangement.size(), |
| 12405 | }, | 12405 | }, |
| 12406 | } } }; | 12406 | } } }; |
| ... | @@ -12415,7 +12415,7 @@ pub const Instruction = packed union { | ... | @@ -12415,7 +12415,7 @@ pub const Instruction = packed union { |
| 12415 | .Rd = d.alias.encode(.{ .V = true }), | 12415 | .Rd = d.alias.encode(.{ .V = true }), |
| 12416 | .Rn = n.alias.encode(.{}), | 12416 | .Rn = n.alias.encode(.{}), |
| 12417 | .imm4 = .general, | 12417 | .imm4 = .general, |
| 12418 | .imm5 = @shlExact(@as(u5, 0b1), @intFromEnum(elem_size)), | 12418 | .imm5 = @shlExact(@as(u5, 0b1), @backingInt(elem_size)), |
| 12419 | .Q = arrangement.size(), | 12419 | .Q = arrangement.size(), |
| 12420 | }, | 12420 | }, |
| 12421 | } } }; | 12421 | } } }; |
| ... | @@ -12867,7 +12867,7 @@ pub const Instruction = packed union { | ... | @@ -12867,7 +12867,7 @@ pub const Instruction = packed union { |
| 12867 | .fcmp = .{ | 12867 | .fcmp = .{ |
| 12868 | .opc0 = .register, | 12868 | .opc0 = .register, |
| 12869 | .Rn = n.alias.encode(.{ .V = true }), | 12869 | .Rn = n.alias.encode(.{ .V = true }), |
| 12870 | .Rm = @enumFromInt(0b00000), | 12870 | .Rm = @fromBackingInt(@intCast(0b00000)), |
| 12871 | .ftype = .fromScalarSize(ftype), | 12871 | .ftype = .fromScalarSize(ftype), |
| 12872 | }, | 12872 | }, |
| 12873 | } } }, | 12873 | } } }, |
| ... | @@ -12892,7 +12892,7 @@ pub const Instruction = packed union { | ... | @@ -12892,7 +12892,7 @@ pub const Instruction = packed union { |
| 12892 | .fcmpe = .{ | 12892 | .fcmpe = .{ |
| 12893 | .opc0 = .zero, | 12893 | .opc0 = .zero, |
| 12894 | .Rn = n.alias.encode(.{ .V = true }), | 12894 | .Rn = n.alias.encode(.{ .V = true }), |
| 12895 | .Rm = @enumFromInt(0b00000), | 12895 | .Rm = @fromBackingInt(@intCast(0b00000)), |
| 12896 | .ftype = .fromScalarSize(ftype), | 12896 | .ftype = .fromScalarSize(ftype), |
| 12897 | }, | 12897 | }, |
| 12898 | } } }, | 12898 | } } }, |
| ... | @@ -14194,8 +14194,8 @@ pub const Instruction = packed union { | ... | @@ -14194,8 +14194,8 @@ pub const Instruction = packed union { |
| 14194 | .ins = .{ | 14194 | .ins = .{ |
| 14195 | .Rd = d.alias.encode(.{ .V = true }), | 14195 | .Rd = d.alias.encode(.{ .V = true }), |
| 14196 | .Rn = n.alias.encode(.{ .V = true }), | 14196 | .Rn = n.alias.encode(.{ .V = true }), |
| 14197 | .imm4 = .{ .element = element.index << @intCast(@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) << @intFromEnum(elem_size), | 14198 | .imm5 = (@as(u5, d.format.element.index) << 1 | @as(u5, 0b1) << 0) << @backingInt(elem_size), |
| 14199 | .op = .element, | 14199 | .op = .element, |
| 14200 | }, | 14200 | }, |
| 14201 | } } }; | 14201 | } } }; |
| ... | @@ -14211,7 +14211,7 @@ pub const Instruction = packed union { | ... | @@ -14211,7 +14211,7 @@ pub const Instruction = packed union { |
| 14211 | .Rd = d.alias.encode(.{ .V = true }), | 14211 | .Rd = d.alias.encode(.{ .V = true }), |
| 14212 | .Rn = n.alias.encode(.{}), | 14212 | .Rn = n.alias.encode(.{}), |
| 14213 | .imm4 = .{ .general = .general }, | 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 | .op = .general, | 14215 | .op = .general, |
| 14216 | }, | 14216 | }, |
| 14217 | } } }; | 14217 | } } }; |
| ... | @@ -14246,7 +14246,7 @@ pub const Instruction = packed union { | ... | @@ -14246,7 +14246,7 @@ pub const Instruction = packed union { |
| 14246 | .Rt = t1.alias.encode(.{}), | 14246 | .Rt = t1.alias.encode(.{}), |
| 14247 | .Rn = post_index.base.alias.encode(.{ .sp = true }), | 14247 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 14248 | .Rt2 = t2.alias.encode(.{}), | 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 | .sf = sf, | 14250 | .sf = sf, |
| 14251 | }, | 14251 | }, |
| 14252 | } } } }; | 14252 | } } } }; |
| ... | @@ -14258,7 +14258,7 @@ pub const Instruction = packed union { | ... | @@ -14258,7 +14258,7 @@ pub const Instruction = packed union { |
| 14258 | .Rt = t1.alias.encode(.{}), | 14258 | .Rt = t1.alias.encode(.{}), |
| 14259 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), | 14259 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 14260 | .Rt2 = t2.alias.encode(.{}), | 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 | .sf = sf, | 14262 | .sf = sf, |
| 14263 | }, | 14263 | }, |
| 14264 | } } } }; | 14264 | } } } }; |
| ... | @@ -14270,7 +14270,7 @@ pub const Instruction = packed union { | ... | @@ -14270,7 +14270,7 @@ pub const Instruction = packed union { |
| 14270 | .Rt = t1.alias.encode(.{}), | 14270 | .Rt = t1.alias.encode(.{}), |
| 14271 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), | 14271 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), |
| 14272 | .Rt2 = t2.alias.encode(.{}), | 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 | .sf = sf, | 14274 | .sf = sf, |
| 14275 | }, | 14275 | }, |
| 14276 | } } } }; | 14276 | } } } }; |
| ... | @@ -14288,7 +14288,7 @@ pub const Instruction = packed union { | ... | @@ -14288,7 +14288,7 @@ pub const Instruction = packed union { |
| 14288 | .Rt = t1.alias.encode(.{ .V = true }), | 14288 | .Rt = t1.alias.encode(.{ .V = true }), |
| 14289 | .Rn = post_index.base.alias.encode(.{ .sp = true }), | 14289 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 14290 | .Rt2 = t2.alias.encode(.{ .V = true }), | 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 | .opc = .encode(vs), | 14292 | .opc = .encode(vs), |
| 14293 | }, | 14293 | }, |
| 14294 | } } } }; | 14294 | } } } }; |
| ... | @@ -14300,7 +14300,7 @@ pub const Instruction = packed union { | ... | @@ -14300,7 +14300,7 @@ pub const Instruction = packed union { |
| 14300 | .Rt = t1.alias.encode(.{ .V = true }), | 14300 | .Rt = t1.alias.encode(.{ .V = true }), |
| 14301 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), | 14301 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), |
| 14302 | .Rt2 = t2.alias.encode(.{ .V = true }), | 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 | .opc = .encode(vs), | 14304 | .opc = .encode(vs), |
| 14305 | }, | 14305 | }, |
| 14306 | } } } }; | 14306 | } } } }; |
| ... | @@ -14312,7 +14312,7 @@ pub const Instruction = packed union { | ... | @@ -14312,7 +14312,7 @@ pub const Instruction = packed union { |
| 14312 | .Rt = t1.alias.encode(.{ .V = true }), | 14312 | .Rt = t1.alias.encode(.{ .V = true }), |
| 14313 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), | 14313 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 14314 | .Rt2 = t2.alias.encode(.{ .V = true }), | 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 | .opc = .encode(vs), | 14316 | .opc = .encode(vs), |
| 14317 | }, | 14317 | }, |
| 14318 | } } } }; | 14318 | } } } }; |
| ... | @@ -14377,7 +14377,7 @@ pub const Instruction = packed union { | ... | @@ -14377,7 +14377,7 @@ pub const Instruction = packed union { |
| 14377 | .ldr = .{ | 14377 | .ldr = .{ |
| 14378 | .Rt = t.alias.encode(.{}), | 14378 | .Rt = t.alias.encode(.{}), |
| 14379 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), | 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 | .sf = sf, | 14381 | .sf = sf, |
| 14382 | }, | 14382 | }, |
| 14383 | } } } }; | 14383 | } } } }; |
| ... | @@ -14455,7 +14455,7 @@ pub const Instruction = packed union { | ... | @@ -14455,7 +14455,7 @@ pub const Instruction = packed union { |
| 14455 | .ldr = .{ | 14455 | .ldr = .{ |
| 14456 | .Rt = t.alias.encode(.{ .V = true }), | 14456 | .Rt = t.alias.encode(.{ .V = true }), |
| 14457 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), | 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 | .opc1 = .encode(vs), | 14459 | .opc1 = .encode(vs), |
| 14460 | .size = .encode(vs), | 14460 | .size = .encode(vs), |
| 14461 | }, | 14461 | }, |
| ... | @@ -14705,7 +14705,7 @@ pub const Instruction = packed union { | ... | @@ -14705,7 +14705,7 @@ pub const Instruction = packed union { |
| 14705 | .Rt = t.alias.encode(.{}), | 14705 | .Rt = t.alias.encode(.{}), |
| 14706 | .Rn = post_index.base.alias.encode(.{ .sp = true }), | 14706 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 14707 | .imm9 = post_index.index, | 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,7 +14716,7 @@ pub const Instruction = packed union { |
| 14716 | .Rt = t.alias.encode(.{}), | 14716 | .Rt = t.alias.encode(.{}), |
| 14717 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), | 14717 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 14718 | .imm9 = pre_index.index, | 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,7 +14727,7 @@ pub const Instruction = packed union { |
| 14727 | .Rt = t.alias.encode(.{}), | 14727 | .Rt = t.alias.encode(.{}), |
| 14728 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), | 14728 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), |
| 14729 | .imm12 = unsigned_offset.offset, | 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,7 +14745,7 @@ pub const Instruction = packed union { |
| 14745 | }, | 14745 | }, |
| 14746 | .option = extended_register_explicit.option, | 14746 | .option = extended_register_explicit.option, |
| 14747 | .Rm = extended_register_explicit.index.alias.encode(.{}), | 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,7 +14787,7 @@ pub const Instruction = packed union { |
| 14787 | .Rt = t.alias.encode(.{}), | 14787 | .Rt = t.alias.encode(.{}), |
| 14788 | .Rn = post_index.base.alias.encode(.{ .sp = true }), | 14788 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 14789 | .imm9 = post_index.index, | 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,7 +14798,7 @@ pub const Instruction = packed union { |
| 14798 | .Rt = t.alias.encode(.{}), | 14798 | .Rt = t.alias.encode(.{}), |
| 14799 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), | 14799 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 14800 | .imm9 = pre_index.index, | 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,7 +14809,7 @@ pub const Instruction = packed union { |
| 14809 | .Rt = t.alias.encode(.{}), | 14809 | .Rt = t.alias.encode(.{}), |
| 14810 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), | 14810 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), |
| 14811 | .imm12 = @intCast(@shrExact(unsigned_offset.offset, 1)), | 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,7 +14828,7 @@ pub const Instruction = packed union { |
| 14828 | }, | 14828 | }, |
| 14829 | .option = extended_register_explicit.option, | 14829 | .option = extended_register_explicit.option, |
| 14830 | .Rm = extended_register_explicit.index.alias.encode(.{}), | 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,7 +14984,7 @@ pub const Instruction = packed union { |
| 14984 | .Rt = t.alias.encode(.{}), | 14984 | .Rt = t.alias.encode(.{}), |
| 14985 | .Rn = n.alias.encode(.{ .sp = true }), | 14985 | .Rn = n.alias.encode(.{ .sp = true }), |
| 14986 | .imm9 = simm, | 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,7 +14996,7 @@ pub const Instruction = packed union { |
| 14996 | .Rt = t.alias.encode(.{}), | 14996 | .Rt = t.alias.encode(.{}), |
| 14997 | .Rn = n.alias.encode(.{ .sp = true }), | 14997 | .Rn = n.alias.encode(.{ .sp = true }), |
| 14998 | .imm9 = simm, | 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,7 +15778,7 @@ pub const Instruction = packed union { |
| 15778 | .Rt = t1.alias.encode(.{}), | 15778 | .Rt = t1.alias.encode(.{}), |
| 15779 | .Rn = post_index.base.alias.encode(.{ .sp = true }), | 15779 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 15780 | .Rt2 = t2.alias.encode(.{}), | 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 | .sf = sf, | 15782 | .sf = sf, |
| 15783 | }, | 15783 | }, |
| 15784 | } } } }; | 15784 | } } } }; |
| ... | @@ -15790,7 +15790,7 @@ pub const Instruction = packed union { | ... | @@ -15790,7 +15790,7 @@ pub const Instruction = packed union { |
| 15790 | .Rt = t1.alias.encode(.{}), | 15790 | .Rt = t1.alias.encode(.{}), |
| 15791 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), | 15791 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 15792 | .Rt2 = t2.alias.encode(.{}), | 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 | .sf = sf, | 15794 | .sf = sf, |
| 15795 | }, | 15795 | }, |
| 15796 | } } } }; | 15796 | } } } }; |
| ... | @@ -15802,7 +15802,7 @@ pub const Instruction = packed union { | ... | @@ -15802,7 +15802,7 @@ pub const Instruction = packed union { |
| 15802 | .Rt = t1.alias.encode(.{}), | 15802 | .Rt = t1.alias.encode(.{}), |
| 15803 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), | 15803 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), |
| 15804 | .Rt2 = t2.alias.encode(.{}), | 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 | .sf = sf, | 15806 | .sf = sf, |
| 15807 | }, | 15807 | }, |
| 15808 | } } } }; | 15808 | } } } }; |
| ... | @@ -15820,7 +15820,7 @@ pub const Instruction = packed union { | ... | @@ -15820,7 +15820,7 @@ pub const Instruction = packed union { |
| 15820 | .Rt = t1.alias.encode(.{ .V = true }), | 15820 | .Rt = t1.alias.encode(.{ .V = true }), |
| 15821 | .Rn = post_index.base.alias.encode(.{ .sp = true }), | 15821 | .Rn = post_index.base.alias.encode(.{ .sp = true }), |
| 15822 | .Rt2 = t2.alias.encode(.{ .V = true }), | 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 | .opc = .encode(vs), | 15824 | .opc = .encode(vs), |
| 15825 | }, | 15825 | }, |
| 15826 | } } } }; | 15826 | } } } }; |
| ... | @@ -15832,7 +15832,7 @@ pub const Instruction = packed union { | ... | @@ -15832,7 +15832,7 @@ pub const Instruction = packed union { |
| 15832 | .Rt = t1.alias.encode(.{ .V = true }), | 15832 | .Rt = t1.alias.encode(.{ .V = true }), |
| 15833 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), | 15833 | .Rn = signed_offset.base.alias.encode(.{ .sp = true }), |
| 15834 | .Rt2 = t2.alias.encode(.{ .V = true }), | 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 | .opc = .encode(vs), | 15836 | .opc = .encode(vs), |
| 15837 | }, | 15837 | }, |
| 15838 | } } } }; | 15838 | } } } }; |
| ... | @@ -15844,7 +15844,7 @@ pub const Instruction = packed union { | ... | @@ -15844,7 +15844,7 @@ pub const Instruction = packed union { |
| 15844 | .Rt = t1.alias.encode(.{ .V = true }), | 15844 | .Rt = t1.alias.encode(.{ .V = true }), |
| 15845 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), | 15845 | .Rn = pre_index.base.alias.encode(.{ .sp = true }), |
| 15846 | .Rt2 = t2.alias.encode(.{ .V = true }), | 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 | .opc = .encode(vs), | 15848 | .opc = .encode(vs), |
| 15849 | }, | 15849 | }, |
| 15850 | } } } }; | 15850 | } } } }; |
| ... | @@ -15893,7 +15893,7 @@ pub const Instruction = packed union { | ... | @@ -15893,7 +15893,7 @@ pub const Instruction = packed union { |
| 15893 | .str = .{ | 15893 | .str = .{ |
| 15894 | .Rt = t.alias.encode(.{}), | 15894 | .Rt = t.alias.encode(.{}), |
| 15895 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), | 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 | .sf = sf, | 15897 | .sf = sf, |
| 15898 | }, | 15898 | }, |
| 15899 | } } } }; | 15899 | } } } }; |
| ... | @@ -15931,7 +15931,7 @@ pub const Instruction = packed union { | ... | @@ -15931,7 +15931,7 @@ pub const Instruction = packed union { |
| 15931 | .str = .{ | 15931 | .str = .{ |
| 15932 | .Rt = t.alias.encode(.{ .V = true }), | 15932 | .Rt = t.alias.encode(.{ .V = true }), |
| 15933 | .Rn = unsigned_offset.base.alias.encode(.{ .sp = true }), | 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 | .opc1 = .encode(vs), | 15935 | .opc1 = .encode(vs), |
| 15936 | .size = .encode(vs), | 15936 | .size = .encode(vs), |
| 15937 | }, | 15937 | }, |
src/codegen/c.zig+98-98| ... | @@ -1657,10 +1657,10 @@ pub const DeclGen = struct { | ... | @@ -1657,10 +1657,10 @@ pub const DeclGen = struct { |
| 1657 | switch (name) { | 1657 | switch (name) { |
| 1658 | .nav => |nav| try renderNavName(w, nav, ip), | 1658 | .nav => |nav| try renderNavName(w, nav, ip), |
| 1659 | .nav_never_tail => |nav| try w.print("zig_never_tail_{f}__{d}", .{ | 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 | .nav_never_inline => |nav| try w.print("zig_never_inline_{f}__{d}", .{ | 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 | .@"export" => |@"export"| try w.print("{f}", .{fmtIdentSolo(@"export".extern_name.toSlice(ip))}), | 1665 | .@"export" => |@"export"| try w.print("{f}", .{fmtIdentSolo(@"export".extern_name.toSlice(ip))}), |
| 1666 | } | 1666 | } |
| ... | @@ -2121,7 +2121,7 @@ pub fn genTagNameFn( | ... | @@ -2121,7 +2121,7 @@ pub fn genTagNameFn( |
| 2121 | try w.print("static {s} zig_tagName_{f}__{d}({s} tag) {{\n", .{ | 2121 | try w.print("static {s} zig_tagName_{f}__{d}({s} tag) {{\n", .{ |
| 2122 | slice_const_u8_sentinel_0_type_name, | 2122 | slice_const_u8_sentinel_0_type_name, |
| 2123 | fmtIdentUnsolo(loaded_enum.name.toSlice(ip)), | 2123 | fmtIdentUnsolo(loaded_enum.name.toSlice(ip)), |
| 2124 | @intFromEnum(enum_ty.toIntern()), | 2124 | @backingInt(enum_ty.toIntern()), |
| 2125 | enum_type_name, | 2125 | enum_type_name, |
| 2126 | }); | 2126 | }); |
| 2127 | for (loaded_enum.field_names.get(ip), 0..) |field_name, field_index| { | 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,7 +2636,7 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) Error!void { |
| 2636 | if (f.liveness.isUnused(inst) and !f.air.mustLower(inst, ip)) | 2636 | if (f.liveness.isUnused(inst) and !f.air.mustLower(inst, ip)) |
| 2637 | continue; | 2637 | continue; |
| 2638 | 2638 | ||
| 2639 | const result_value = switch (air_tags[@intFromEnum(inst)]) { | 2639 | const result_value = switch (air_tags[@backingInt(inst)]) { |
| 2640 | // zig fmt: off | 2640 | // zig fmt: off |
| 2641 | .inferred_alloc, .inferred_alloc_comptime => unreachable, | 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,7 +2948,7 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) Error!void { |
| 2948 | } | 2948 | } |
| 2949 | 2949 | ||
| 2950 | fn airSliceField(f: *Function, inst: Air.Inst.Index, is_ptr: bool, field_name: []const u8) !CValue { | 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 | const inst_ty = f.typeOfIndex(inst); | 2953 | const inst_ty = f.typeOfIndex(inst); |
| 2954 | const operand = try f.resolveInst(ty_op.operand); | 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,7 +2970,7 @@ fn airSliceField(f: *Function, inst: Air.Inst.Index, is_ptr: bool, field_name: [ |
| 2970 | fn airPtrElemVal(f: *Function, inst: Air.Inst.Index) !CValue { | 2970 | fn airPtrElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 2971 | const zcu = f.dg.pt.zcu; | 2971 | const zcu = f.dg.pt.zcu; |
| 2972 | const inst_ty = f.typeOfIndex(inst); | 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 | assert(inst_ty.hasRuntimeBits(zcu)); | 2974 | assert(inst_ty.hasRuntimeBits(zcu)); |
| 2975 | 2975 | ||
| 2976 | const ptr = try f.resolveInst(bin_op.lhs); | 2976 | const ptr = try f.resolveInst(bin_op.lhs); |
| ... | @@ -2996,7 +2996,7 @@ fn airPtrElemVal(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -2996,7 +2996,7 @@ fn airPtrElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 2996 | fn airPtrElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { | 2996 | fn airPtrElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 2997 | const pt = f.dg.pt; | 2997 | const pt = f.dg.pt; |
| 2998 | const zcu = pt.zcu; | 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 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; | 3000 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3001 | 3001 | ||
| 3002 | const inst_ty = f.typeOfIndex(inst); | 3002 | const inst_ty = f.typeOfIndex(inst); |
| ... | @@ -3028,7 +3028,7 @@ fn airPtrElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3028,7 +3028,7 @@ fn airPtrElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3028 | fn airSliceElemVal(f: *Function, inst: Air.Inst.Index) !CValue { | 3028 | fn airSliceElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3029 | const zcu = f.dg.pt.zcu; | 3029 | const zcu = f.dg.pt.zcu; |
| 3030 | const inst_ty = f.typeOfIndex(inst); | 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 | assert(inst_ty.hasRuntimeBits(zcu)); | 3032 | assert(inst_ty.hasRuntimeBits(zcu)); |
| 3033 | 3033 | ||
| 3034 | const slice = try f.resolveInst(bin_op.lhs); | 3034 | const slice = try f.resolveInst(bin_op.lhs); |
| ... | @@ -3050,7 +3050,7 @@ fn airSliceElemVal(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3050,7 +3050,7 @@ fn airSliceElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3050 | fn airSliceElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { | 3050 | fn airSliceElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3051 | const pt = f.dg.pt; | 3051 | const pt = f.dg.pt; |
| 3052 | const zcu = pt.zcu; | 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 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; | 3054 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3055 | 3055 | ||
| 3056 | const inst_ty = f.typeOfIndex(inst); | 3056 | const inst_ty = f.typeOfIndex(inst); |
| ... | @@ -3077,7 +3077,7 @@ fn airSliceElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3077,7 +3077,7 @@ fn airSliceElemPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3077 | 3077 | ||
| 3078 | fn airArrayElemVal(f: *Function, inst: Air.Inst.Index) !CValue { | 3078 | fn airArrayElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3079 | const zcu = f.dg.pt.zcu; | 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 | const inst_ty = f.typeOfIndex(inst); | 3081 | const inst_ty = f.typeOfIndex(inst); |
| 3082 | assert(inst_ty.hasRuntimeBits(zcu)); | 3082 | assert(inst_ty.hasRuntimeBits(zcu)); |
| 3083 | 3083 | ||
| ... | @@ -3098,7 +3098,7 @@ fn airArrayElemVal(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3098,7 +3098,7 @@ fn airArrayElemVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3098 | } | 3098 | } |
| 3099 | 3099 | ||
| 3100 | fn airLegalizeVecStoreElem(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const extra = f.air.extraData(Air.Bin, pl_op.payload).data; | 3102 | const extra = f.air.extraData(Air.Bin, pl_op.payload).data; |
| 3103 | 3103 | ||
| 3104 | const vec_ptr = try f.resolveInst(pl_op.operand); | 3104 | const vec_ptr = try f.resolveInst(pl_op.operand); |
| ... | @@ -3209,7 +3209,7 @@ fn airArg(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3209,7 +3209,7 @@ fn airArg(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3209 | fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue { | 3209 | fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3210 | const pt = f.dg.pt; | 3210 | const pt = f.dg.pt; |
| 3211 | const zcu = pt.zcu; | 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 | const ptr_ty = f.typeOf(ty_op.operand); | 3214 | const ptr_ty = f.typeOf(ty_op.operand); |
| 3215 | const ptr_scalar_ty = ptr_ty.scalarType(zcu); | 3215 | const ptr_scalar_ty = ptr_ty.scalarType(zcu); |
| ... | @@ -3243,7 +3243,7 @@ fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3243,7 +3243,7 @@ fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3243 | else => |index| { | 3243 | else => |index| { |
| 3244 | try w.writeByte('&'); | 3244 | try w.writeByte('&'); |
| 3245 | try f.writeCValue(w, operand, .other); | 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 | try w.writeAll(", sizeof("); | 3249 | try w.writeAll(", sizeof("); |
| ... | @@ -3256,7 +3256,7 @@ fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3256,7 +3256,7 @@ fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3256 | .none => try f.writeCValueDeref(w, operand), | 3256 | .none => try f.writeCValueDeref(w, operand), |
| 3257 | else => |index| { | 3257 | else => |index| { |
| 3258 | try f.writeCValue(w, operand, .other); | 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,13 +3269,13 @@ fn airLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3269 | fn airRet(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !void { | 3269 | fn airRet(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !void { |
| 3270 | const pt = f.dg.pt; | 3270 | const pt = f.dg.pt; |
| 3271 | const zcu = pt.zcu; | 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 | const w = &f.code.writer; | 3273 | const w = &f.code.writer; |
| 3274 | const op_inst = un_op.toIndex(); | 3274 | const op_inst = un_op.toIndex(); |
| 3275 | const op_ty = f.typeOf(un_op); | 3275 | const op_ty = f.typeOf(un_op); |
| 3276 | const ret_ty = if (is_ptr) op_ty.childType(zcu) else op_ty; | 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 | try reap(f, inst, &.{un_op}); | 3279 | try reap(f, inst, &.{un_op}); |
| 3280 | _ = try airCall(f, op_inst.?, .always_tail); | 3280 | _ = try airCall(f, op_inst.?, .always_tail); |
| 3281 | } else if (ret_ty.hasRuntimeBits(zcu)) { | 3281 | } else if (ret_ty.hasRuntimeBits(zcu)) { |
| ... | @@ -3301,7 +3301,7 @@ fn airRet(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !void { | ... | @@ -3301,7 +3301,7 @@ fn airRet(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !void { |
| 3301 | fn airIntCast(f: *Function, inst: Air.Inst.Index) !CValue { | 3301 | fn airIntCast(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3302 | const pt = f.dg.pt; | 3302 | const pt = f.dg.pt; |
| 3303 | const zcu = pt.zcu; | 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 | const operand = try f.resolveInst(ty_op.operand); | 3306 | const operand = try f.resolveInst(ty_op.operand); |
| 3307 | try reap(f, inst, &.{ty_op.operand}); | 3307 | try reap(f, inst, &.{ty_op.operand}); |
| ... | @@ -3332,7 +3332,7 @@ fn airIntCast(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3332,7 +3332,7 @@ fn airIntCast(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3332 | fn airTrunc(f: *Function, inst: Air.Inst.Index) !CValue { | 3332 | fn airTrunc(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3333 | const pt = f.dg.pt; | 3333 | const pt = f.dg.pt; |
| 3334 | const zcu = pt.zcu; | 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 | const operand = try f.resolveInst(ty_op.operand); | 3337 | const operand = try f.resolveInst(ty_op.operand); |
| 3338 | try reap(f, inst, &.{ty_op.operand}); | 3338 | try reap(f, inst, &.{ty_op.operand}); |
| ... | @@ -3419,7 +3419,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { | ... | @@ -3419,7 +3419,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 3419 | const pt = f.dg.pt; | 3419 | const pt = f.dg.pt; |
| 3420 | const zcu = pt.zcu; | 3420 | const zcu = pt.zcu; |
| 3421 | // *a = b; | 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 | const ptr_ty = f.typeOf(bin_op.lhs); | 3424 | const ptr_ty = f.typeOf(bin_op.lhs); |
| 3425 | const ptr_scalar_ty = ptr_ty.scalarType(zcu); | 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,7 +3482,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 3482 | else => |index| { | 3482 | else => |index| { |
| 3483 | try w.writeByte('&'); | 3483 | try w.writeByte('&'); |
| 3484 | try f.writeCValue(w, ptr_val, .other); | 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 | try w.writeAll(", &"); | 3488 | try w.writeAll(", &"); |
| ... | @@ -3508,7 +3508,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { | ... | @@ -3508,7 +3508,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 3508 | .none => try f.writeCValueDeref(w, ptr_val), | 3508 | .none => try f.writeCValueDeref(w, ptr_val), |
| 3509 | else => |index| { | 3509 | else => |index| { |
| 3510 | try f.writeCValue(w, ptr_val, .other); | 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 | try w.writeAll(" = "); | 3514 | try w.writeAll(" = "); |
| ... | @@ -3522,7 +3522,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { | ... | @@ -3522,7 +3522,7 @@ fn airStore(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 3522 | fn airOverflow(f: *Function, inst: Air.Inst.Index, operation: []const u8, info: BuiltinInfo) !CValue { | 3522 | fn airOverflow(f: *Function, inst: Air.Inst.Index, operation: []const u8, info: BuiltinInfo) !CValue { |
| 3523 | const pt = f.dg.pt; | 3523 | const pt = f.dg.pt; |
| 3524 | const zcu = pt.zcu; | 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 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; | 3526 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3527 | 3527 | ||
| 3528 | const lhs = try f.resolveInst(bin_op.lhs); | 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,7 +3584,7 @@ fn airOverflow(f: *Function, inst: Air.Inst.Index, operation: []const u8, info: |
| 3584 | fn airNot(f: *Function, inst: Air.Inst.Index) !CValue { | 3584 | fn airNot(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3585 | const pt = f.dg.pt; | 3585 | const pt = f.dg.pt; |
| 3586 | const zcu = pt.zcu; | 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 | const operand_ty = f.typeOf(ty_op.operand); | 3588 | const operand_ty = f.typeOf(ty_op.operand); |
| 3589 | const scalar_ty = operand_ty.scalarType(zcu); | 3589 | const scalar_ty = operand_ty.scalarType(zcu); |
| 3590 | if (scalar_ty.toIntern() != .bool_type) return try airUnBuiltinCall(f, inst, ty_op.operand, "not", .bits); | 3590 | if (scalar_ty.toIntern() != .bool_type) return try airUnBuiltinCall(f, inst, ty_op.operand, "not", .bits); |
| ... | @@ -3619,7 +3619,7 @@ fn airBinOp( | ... | @@ -3619,7 +3619,7 @@ fn airBinOp( |
| 3619 | ) !CValue { | 3619 | ) !CValue { |
| 3620 | const pt = f.dg.pt; | 3620 | const pt = f.dg.pt; |
| 3621 | const zcu = pt.zcu; | 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 | const operand_ty = f.typeOf(bin_op.lhs); | 3623 | const operand_ty = f.typeOf(bin_op.lhs); |
| 3624 | const scalar_ty = operand_ty.scalarType(zcu); | 3624 | const scalar_ty = operand_ty.scalarType(zcu); |
| 3625 | if ((scalar_ty.isInt(zcu) and scalar_ty.bitSize(zcu) > 64) or scalar_ty.isRuntimeFloat()) | 3625 | if ((scalar_ty.isInt(zcu) and scalar_ty.bitSize(zcu) > 64) or scalar_ty.isRuntimeFloat()) |
| ... | @@ -3715,7 +3715,7 @@ fn airEquality( | ... | @@ -3715,7 +3715,7 @@ fn airEquality( |
| 3715 | ) !CValue { | 3715 | ) !CValue { |
| 3716 | const pt = f.dg.pt; | 3716 | const pt = f.dg.pt; |
| 3717 | const zcu = pt.zcu; | 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 | const operand_ty = f.typeOf(bin_op.lhs); | 3720 | const operand_ty = f.typeOf(bin_op.lhs); |
| 3721 | if (operand_ty.isAbiInt(zcu)) { | 3721 | if (operand_ty.isAbiInt(zcu)) { |
| ... | @@ -3799,7 +3799,7 @@ fn airEquality( | ... | @@ -3799,7 +3799,7 @@ fn airEquality( |
| 3799 | } | 3799 | } |
| 3800 | 3800 | ||
| 3801 | fn airCmpLteErrorsLen(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const operand = try f.resolveInst(un_op); | 3804 | const operand = try f.resolveInst(un_op); |
| 3805 | try reap(f, inst, &.{un_op}); | 3805 | try reap(f, inst, &.{un_op}); |
| ... | @@ -3817,7 +3817,7 @@ fn airCmpLteErrorsLen(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -3817,7 +3817,7 @@ fn airCmpLteErrorsLen(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3817 | fn airPtrAddSub(f: *Function, inst: Air.Inst.Index, operator: u8) !CValue { | 3817 | fn airPtrAddSub(f: *Function, inst: Air.Inst.Index, operator: u8) !CValue { |
| 3818 | const pt = f.dg.pt; | 3818 | const pt = f.dg.pt; |
| 3819 | const zcu = pt.zcu; | 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 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; | 3821 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3822 | 3822 | ||
| 3823 | const lhs = try f.resolveInst(bin_op.lhs); | 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,7 +3857,7 @@ fn airPtrAddSub(f: *Function, inst: Air.Inst.Index, operator: u8) !CValue { |
| 3857 | fn airMinMax(f: *Function, inst: Air.Inst.Index, operator: u8, operation: []const u8) !CValue { | 3857 | fn airMinMax(f: *Function, inst: Air.Inst.Index, operator: u8, operation: []const u8) !CValue { |
| 3858 | const pt = f.dg.pt; | 3858 | const pt = f.dg.pt; |
| 3859 | const zcu = pt.zcu; | 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 | const inst_ty = f.typeOfIndex(inst); | 3862 | const inst_ty = f.typeOfIndex(inst); |
| 3863 | const inst_scalar_ty = inst_ty.scalarType(zcu); | 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,7 +3897,7 @@ fn airMinMax(f: *Function, inst: Air.Inst.Index, operator: u8, operation: []cons |
| 3897 | } | 3897 | } |
| 3898 | 3898 | ||
| 3899 | fn airSlice(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; | 3901 | const bin_op = f.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3902 | 3902 | ||
| 3903 | const ptr = try f.resolveInst(bin_op.lhs); | 3903 | const ptr = try f.resolveInst(bin_op.lhs); |
| ... | @@ -4014,13 +4014,13 @@ fn airCall( | ... | @@ -4014,13 +4014,13 @@ fn airCall( |
| 4014 | .never_tail => { | 4014 | .never_tail => { |
| 4015 | try f.need_never_tail_funcs.put(gpa, fn_nav, {}); | 4015 | try f.need_never_tail_funcs.put(gpa, fn_nav, {}); |
| 4016 | try w.print("zig_never_tail_{f}__{d}", .{ | 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 | .never_inline => { | 4020 | .never_inline => { |
| 4021 | try f.need_never_inline_funcs.put(gpa, fn_nav, {}); | 4021 | try f.need_never_inline_funcs.put(gpa, fn_nav, {}); |
| 4022 | try w.print("zig_never_inline_{f}__{d}", .{ | 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 | else => unreachable, | 4026 | else => unreachable, |
| ... | @@ -4056,7 +4056,7 @@ fn airCall( | ... | @@ -4056,7 +4056,7 @@ fn airCall( |
| 4056 | } | 4056 | } |
| 4057 | 4057 | ||
| 4058 | fn airDbgStmt(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const w = &f.code.writer; | 4060 | const w = &f.code.writer; |
| 4061 | // TODO re-evaluate whether to emit these or not. If we naively emit | 4061 | // TODO re-evaluate whether to emit these or not. If we naively emit |
| 4062 | // these directives, the output file will report bogus line numbers because | 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,9 +4093,9 @@ fn airDbgInlineBlock(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4093 | fn airDbgVar(f: *Function, inst: Air.Inst.Index) !CValue { | 4093 | fn airDbgVar(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4094 | const pt = f.dg.pt; | 4094 | const pt = f.dg.pt; |
| 4095 | const zcu = pt.zcu; | 4095 | const zcu = pt.zcu; |
| 4096 | const tag = f.air.instructions.items(.tag)[@intFromEnum(inst)]; | 4096 | const tag = f.air.instructions.items(.tag)[@backingInt(inst)]; |
| 4097 | const pl_op = f.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | 4097 | const pl_op = f.air.instructions.items(.data)[@backingInt(inst)].pl_op; |
| 4098 | const name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); | 4098 | const name: Air.NullTerminatedString = @fromBackingInt(@intCast(pl_op.payload)); |
| 4099 | const operand_is_undef = if (pl_op.operand.toInterned()) |ip_index| Value.fromInterned(ip_index).isUndef(zcu) else false; | 4099 | const operand_is_undef = if (pl_op.operand.toInterned()) |ip_index| Value.fromInterned(ip_index).isUndef(zcu) else false; |
| 4100 | if (!operand_is_undef) _ = try f.resolveInst(pl_op.operand); | 4100 | if (!operand_is_undef) _ = try f.resolveInst(pl_op.operand); |
| 4101 | 4101 | ||
| ... | @@ -4236,7 +4236,7 @@ fn lowerTry( | ... | @@ -4236,7 +4236,7 @@ fn lowerTry( |
| 4236 | } | 4236 | } |
| 4237 | 4237 | ||
| 4238 | fn airBr(f: *Function, inst: Air.Inst.Index) !void { | 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 | const block = f.blocks.get(branch.block_inst).?; | 4240 | const block = f.blocks.get(branch.block_inst).?; |
| 4241 | const result = block.result; | 4241 | const result = block.result; |
| 4242 | const w = &f.code.writer; | 4242 | const w = &f.code.writer; |
| ... | @@ -4263,14 +4263,14 @@ fn airBr(f: *Function, inst: Air.Inst.Index) !void { | ... | @@ -4263,14 +4263,14 @@ fn airBr(f: *Function, inst: Air.Inst.Index) !void { |
| 4263 | } | 4263 | } |
| 4264 | 4264 | ||
| 4265 | fn airRepeat(f: *Function, inst: Air.Inst.Index) !void { | 4265 | fn airRepeat(f: *Function, inst: Air.Inst.Index) !void { |
| 4266 | const repeat = f.air.instructions.items(.data)[@intFromEnum(inst)].repeat; | 4266 | const repeat = f.air.instructions.items(.data)[@backingInt(inst)].repeat; |
| 4267 | try f.code.writer.print("goto zig_loop_{d};\n", .{@intFromEnum(repeat.loop_inst)}); | 4267 | try f.code.writer.print("goto zig_loop_{d};\n", .{@backingInt(repeat.loop_inst)}); |
| 4268 | } | 4268 | } |
| 4269 | 4269 | ||
| 4270 | fn airSwitchDispatch(f: *Function, inst: Air.Inst.Index) !void { | 4270 | fn airSwitchDispatch(f: *Function, inst: Air.Inst.Index) !void { |
| 4271 | const pt = f.dg.pt; | 4271 | const pt = f.dg.pt; |
| 4272 | const zcu = pt.zcu; | 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 | const w = &f.code.writer; | 4274 | const w = &f.code.writer; |
| 4275 | 4275 | ||
| 4276 | if (br.operand.toInterned()) |cond_ip_index| { | 4276 | if (br.operand.toInterned()) |cond_ip_index| { |
| ... | @@ -4294,7 +4294,7 @@ fn airSwitchDispatch(f: *Function, inst: Air.Inst.Index) !void { | ... | @@ -4294,7 +4294,7 @@ fn airSwitchDispatch(f: *Function, inst: Air.Inst.Index) !void { |
| 4294 | } | 4294 | } |
| 4295 | } | 4295 | } |
| 4296 | } else switch_br.cases_len; | 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 | return; | 4298 | return; |
| 4299 | } | 4299 | } |
| 4300 | 4300 | ||
| ... | @@ -4306,7 +4306,7 @@ fn airSwitchDispatch(f: *Function, inst: Air.Inst.Index) !void { | ... | @@ -4306,7 +4306,7 @@ fn airSwitchDispatch(f: *Function, inst: Air.Inst.Index) !void { |
| 4306 | try f.writeCValue(w, cond, .other); | 4306 | try f.writeCValue(w, cond, .other); |
| 4307 | try w.writeByte(';'); | 4307 | try w.writeByte(';'); |
| 4308 | try f.newline(); | 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 | fn airPtrCast(f: *Function, inst: Air.Inst.Index) Error!CValue { | 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,7 +4325,7 @@ fn airPtrCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4325 | 4325 | ||
| 4326 | // For slice casts we need to assign both fields. | 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 | const operand = try f.resolveInst(ty_op.operand); | 4329 | const operand = try f.resolveInst(ty_op.operand); |
| 4330 | 4330 | ||
| 4331 | const w = &f.code.writer; | 4331 | const w = &f.code.writer; |
| ... | @@ -4352,7 +4352,7 @@ fn airPtrCast(f: *Function, inst: Air.Inst.Index) Error!CValue { | ... | @@ -4352,7 +4352,7 @@ fn airPtrCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4352 | fn airSimpleCast(f: *Function, inst: Air.Inst.Index) Error!CValue { | 4352 | fn airSimpleCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4353 | const zcu = f.dg.pt.zcu; | 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 | const dest_ty = f.typeOfIndex(inst); | 4356 | const dest_ty = f.typeOfIndex(inst); |
| 4357 | const operand_ty = f.typeOf(ty_op.operand); | 4357 | const operand_ty = f.typeOf(ty_op.operand); |
| 4358 | const operand = try f.resolveInst(ty_op.operand); | 4358 | const operand = try f.resolveInst(ty_op.operand); |
| ... | @@ -4378,7 +4378,7 @@ fn airSimpleCast(f: *Function, inst: Air.Inst.Index) Error!CValue { | ... | @@ -4378,7 +4378,7 @@ fn airSimpleCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4378 | fn airNopCast(f: *Function, inst: Air.Inst.Index) Error!CValue { | 4378 | fn airNopCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4379 | const zcu = f.dg.pt.zcu; | 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 | const dest_ty = f.typeOfIndex(inst); | 4382 | const dest_ty = f.typeOfIndex(inst); |
| 4383 | const operand_ty = f.typeOf(ty_op.operand); | 4383 | const operand_ty = f.typeOf(ty_op.operand); |
| 4384 | const operand = try f.resolveInst(ty_op.operand); | 4384 | const operand = try f.resolveInst(ty_op.operand); |
| ... | @@ -4393,7 +4393,7 @@ fn airNopCast(f: *Function, inst: Air.Inst.Index) Error!CValue { | ... | @@ -4393,7 +4393,7 @@ fn airNopCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4393 | fn airUnionFromEnum(f: *Function, inst: Air.Inst.Index) Error!CValue { | 4393 | fn airUnionFromEnum(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4394 | const zcu = f.dg.pt.zcu; | 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 | const dest_ty = f.typeOfIndex(inst); | 4397 | const dest_ty = f.typeOfIndex(inst); |
| 4398 | const operand_ty = f.typeOf(ty_op.operand); | 4398 | const operand_ty = f.typeOf(ty_op.operand); |
| 4399 | const operand = try f.resolveInst(ty_op.operand); | 4399 | const operand = try f.resolveInst(ty_op.operand); |
| ... | @@ -4418,7 +4418,7 @@ fn airBitCast(f: *Function, inst: Air.Inst.Index) Error!CValue { | ... | @@ -4418,7 +4418,7 @@ fn airBitCast(f: *Function, inst: Air.Inst.Index) Error!CValue { |
| 4418 | const zcu = pt.zcu; | 4418 | const zcu = pt.zcu; |
| 4419 | const w = &f.code.writer; | 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 | const dest_ty = f.typeOfIndex(inst); | 4422 | const dest_ty = f.typeOfIndex(inst); |
| 4423 | 4423 | ||
| 4424 | const operand = try f.resolveInst(ty_op.operand); | 4424 | const operand = try f.resolveInst(ty_op.operand); |
| ... | @@ -4594,7 +4594,7 @@ fn airLoop(f: *Function, inst: Air.Inst.Index) !void { | ... | @@ -4594,7 +4594,7 @@ fn airLoop(f: *Function, inst: Air.Inst.Index) !void { |
| 4594 | // this label. Since we need a label for arbitrary `repeat` | 4594 | // this label. Since we need a label for arbitrary `repeat` |
| 4595 | // anyway, there's actually no need to use a "real" looping | 4595 | // anyway, there's actually no need to use a "real" looping |
| 4596 | // construct at all! | 4596 | // construct at all! |
| 4597 | try w.print("zig_loop_{d}:", .{@intFromEnum(inst)}); | 4597 | try w.print("zig_loop_{d}:", .{@backingInt(inst)}); |
| 4598 | try f.newline(); | 4598 | try f.newline(); |
| 4599 | try genBodyInner(f, block.body); // no need to restore state, we're noreturn | 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,7 +4647,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index, is_dispatch_loop: bool) !void |
| 4647 | const cond_val = if (is_dispatch_loop) cond: { | 4647 | const cond_val = if (is_dispatch_loop) cond: { |
| 4648 | const new_local = try f.allocLocal(inst, cond_ty); | 4648 | const new_local = try f.allocLocal(inst, cond_ty); |
| 4649 | try f.copyCValue(new_local, init_condition); | 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 | try f.newline(); | 4651 | try f.newline(); |
| 4652 | try f.loop_switch_conds.put(gpa, inst, new_local.new_local); | 4652 | try f.loop_switch_conds.put(gpa, inst, new_local.new_local); |
| 4653 | break :cond new_local; | 4653 | break :cond new_local; |
| ... | @@ -4757,7 +4757,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index, is_dispatch_loop: bool) !void | ... | @@ -4757,7 +4757,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index, is_dispatch_loop: bool) !void |
| 4757 | f.indent(); | 4757 | f.indent(); |
| 4758 | try f.newline(); | 4758 | try f.newline(); |
| 4759 | if (is_dispatch_loop) { | 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 | try f.newline(); | 4761 | try f.newline(); |
| 4762 | } | 4762 | } |
| 4763 | try genBodyResolveState(f, inst, liveness.deaths[case.idx], case.body, true); | 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,7 +4781,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index, is_dispatch_loop: bool) !void |
| 4781 | try lowerSwitchToConditions(f, inst, cond_val, lowered_cond_ty, switch_br, liveness, is_dispatch_loop, true); | 4781 | try lowerSwitchToConditions(f, inst, cond_val, lowered_cond_ty, switch_br, liveness, is_dispatch_loop, true); |
| 4782 | } | 4782 | } |
| 4783 | if (is_dispatch_loop) { | 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 | const else_body = it.elseBody(); | 4786 | const else_body = it.elseBody(); |
| 4787 | if (else_body.len > 0) { | 4787 | if (else_body.len > 0) { |
| ... | @@ -4838,7 +4838,7 @@ fn lowerSwitchToConditions( | ... | @@ -4838,7 +4838,7 @@ fn lowerSwitchToConditions( |
| 4838 | f.indent(); | 4838 | f.indent(); |
| 4839 | try f.newline(); | 4839 | try f.newline(); |
| 4840 | if (is_dispatch_loop) { | 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 | try genBodyResolveState(f, inst, liveness.deaths[case.idx], case.body, true); | 4843 | try genBodyResolveState(f, inst, liveness.deaths[case.idx], case.body, true); |
| 4844 | try f.outdent(); | 4844 | try f.outdent(); |
| ... | @@ -4850,7 +4850,7 @@ fn lowerSwitchToConditions( | ... | @@ -4850,7 +4850,7 @@ fn lowerSwitchToConditions( |
| 4850 | 4850 | ||
| 4851 | if (!only_ranges) { | 4851 | if (!only_ranges) { |
| 4852 | if (is_dispatch_loop) { | 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 | const else_body = it.elseBody(); | 4855 | const else_body = it.elseBody(); |
| 4856 | if (else_body.len > 0) { | 4856 | if (else_body.len > 0) { |
| ... | @@ -5210,7 +5210,7 @@ fn airIsNull( | ... | @@ -5210,7 +5210,7 @@ fn airIsNull( |
| 5210 | ) !CValue { | 5210 | ) !CValue { |
| 5211 | const pt = f.dg.pt; | 5211 | const pt = f.dg.pt; |
| 5212 | const zcu = pt.zcu; | 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 | const w = &f.code.writer; | 5215 | const w = &f.code.writer; |
| 5216 | const operand = try f.resolveInst(un_op); | 5216 | const operand = try f.resolveInst(un_op); |
| ... | @@ -5268,7 +5268,7 @@ fn airIsNull( | ... | @@ -5268,7 +5268,7 @@ fn airIsNull( |
| 5268 | fn airOptionalPayload(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValue { | 5268 | fn airOptionalPayload(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValue { |
| 5269 | const pt = f.dg.pt; | 5269 | const pt = f.dg.pt; |
| 5270 | const zcu = pt.zcu; | 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 | const inst_ty = f.typeOfIndex(inst); | 5273 | const inst_ty = f.typeOfIndex(inst); |
| 5274 | const operand_ty = f.typeOf(ty_op.operand); | 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,7 +5305,7 @@ fn airOptionalPayload(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValue |
| 5305 | fn airOptionalPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue { | 5305 | fn airOptionalPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5306 | const pt = f.dg.pt; | 5306 | const pt = f.dg.pt; |
| 5307 | const zcu = pt.zcu; | 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 | const w = &f.code.writer; | 5309 | const w = &f.code.writer; |
| 5310 | const operand = try f.resolveInst(ty_op.operand); | 5310 | const operand = try f.resolveInst(ty_op.operand); |
| 5311 | try reap(f, inst, &.{ty_op.operand}); | 5311 | try reap(f, inst, &.{ty_op.operand}); |
| ... | @@ -5418,7 +5418,7 @@ fn fieldLocation( | ... | @@ -5418,7 +5418,7 @@ fn fieldLocation( |
| 5418 | } | 5418 | } |
| 5419 | 5419 | ||
| 5420 | fn airStructFieldPtr(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const extra = f.air.extraData(Air.StructField, ty_pl.payload).data; | 5422 | const extra = f.air.extraData(Air.StructField, ty_pl.payload).data; |
| 5423 | 5423 | ||
| 5424 | const container_ptr_val = try f.resolveInst(extra.struct_operand); | 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,7 +5428,7 @@ fn airStructFieldPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5428 | } | 5428 | } |
| 5429 | 5429 | ||
| 5430 | fn airStructFieldPtrIndex(f: *Function, inst: Air.Inst.Index, index: u8) !CValue { | 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 | const container_ptr_val = try f.resolveInst(ty_op.operand); | 5433 | const container_ptr_val = try f.resolveInst(ty_op.operand); |
| 5434 | try reap(f, inst, &.{ty_op.operand}); | 5434 | try reap(f, inst, &.{ty_op.operand}); |
| ... | @@ -5439,7 +5439,7 @@ fn airStructFieldPtrIndex(f: *Function, inst: Air.Inst.Index, index: u8) !CValue | ... | @@ -5439,7 +5439,7 @@ fn airStructFieldPtrIndex(f: *Function, inst: Air.Inst.Index, index: u8) !CValue |
| 5439 | fn airFieldParentPtr(f: *Function, inst: Air.Inst.Index) !CValue { | 5439 | fn airFieldParentPtr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5440 | const pt = f.dg.pt; | 5440 | const pt = f.dg.pt; |
| 5441 | const zcu = pt.zcu; | 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 | const extra = f.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 5443 | const extra = f.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 5444 | 5444 | ||
| 5445 | const container_ptr_ty = f.typeOfIndex(inst); | 5445 | const container_ptr_ty = f.typeOfIndex(inst); |
| ... | @@ -5535,7 +5535,7 @@ fn airAggFieldVal(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5535,7 +5535,7 @@ fn airAggFieldVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5535 | const pt = f.dg.pt; | 5535 | const pt = f.dg.pt; |
| 5536 | const zcu = pt.zcu; | 5536 | const zcu = pt.zcu; |
| 5537 | const ip = &zcu.intern_pool; | 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 | const extra = f.air.extraData(Air.StructField, ty_pl.payload).data; | 5539 | const extra = f.air.extraData(Air.StructField, ty_pl.payload).data; |
| 5540 | 5540 | ||
| 5541 | const inst_ty = f.typeOfIndex(inst); | 5541 | const inst_ty = f.typeOfIndex(inst); |
| ... | @@ -5573,7 +5573,7 @@ fn airAggFieldVal(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5573,7 +5573,7 @@ fn airAggFieldVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5573 | fn airUnwrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { | 5573 | fn airUnwrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5574 | const pt = f.dg.pt; | 5574 | const pt = f.dg.pt; |
| 5575 | const zcu = pt.zcu; | 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 | const inst_ty = f.typeOfIndex(inst); | 5578 | const inst_ty = f.typeOfIndex(inst); |
| 5579 | const operand = try f.resolveInst(ty_op.operand); | 5579 | const operand = try f.resolveInst(ty_op.operand); |
| ... | @@ -5599,7 +5599,7 @@ fn airUnwrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5599,7 +5599,7 @@ fn airUnwrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5599 | fn airUnwrapErrUnionPay(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValue { | 5599 | fn airUnwrapErrUnionPay(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValue { |
| 5600 | const pt = f.dg.pt; | 5600 | const pt = f.dg.pt; |
| 5601 | const zcu = pt.zcu; | 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 | const inst_ty = f.typeOfIndex(inst); | 5604 | const inst_ty = f.typeOfIndex(inst); |
| 5605 | const operand = try f.resolveInst(ty_op.operand); | 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,7 +5635,7 @@ fn airUnwrapErrUnionPay(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValu |
| 5635 | 5635 | ||
| 5636 | fn airWrapOptional(f: *Function, inst: Air.Inst.Index) !CValue { | 5636 | fn airWrapOptional(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5637 | const zcu = f.dg.pt.zcu; | 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 | const inst_ty = f.typeOfIndex(inst); | 5640 | const inst_ty = f.typeOfIndex(inst); |
| 5641 | 5641 | ||
| ... | @@ -5673,7 +5673,7 @@ fn airWrapOptional(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5673,7 +5673,7 @@ fn airWrapOptional(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5673 | fn airWrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { | 5673 | fn airWrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5674 | const pt = f.dg.pt; | 5674 | const pt = f.dg.pt; |
| 5675 | const zcu = pt.zcu; | 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 | const inst_ty = f.typeOfIndex(inst); | 5678 | const inst_ty = f.typeOfIndex(inst); |
| 5679 | const payload_ty = inst_ty.errorUnionPayload(zcu); | 5679 | const payload_ty = inst_ty.errorUnionPayload(zcu); |
| ... | @@ -5703,7 +5703,7 @@ fn airWrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5703,7 +5703,7 @@ fn airWrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5703 | fn airErrUnionPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue { | 5703 | fn airErrUnionPayloadPtrSet(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5704 | const pt = f.dg.pt; | 5704 | const pt = f.dg.pt; |
| 5705 | const w = &f.code.writer; | 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 | const inst_ty = f.typeOfIndex(inst); | 5707 | const inst_ty = f.typeOfIndex(inst); |
| 5708 | const operand = try f.resolveInst(ty_op.operand); | 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,7 +5746,7 @@ fn airSaveErrReturnTraceIndex(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5746 | fn airWrapErrUnionPay(f: *Function, inst: Air.Inst.Index) !CValue { | 5746 | fn airWrapErrUnionPay(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5747 | const pt = f.dg.pt; | 5747 | const pt = f.dg.pt; |
| 5748 | const zcu = pt.zcu; | 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 | const inst_ty = f.typeOfIndex(inst); | 5751 | const inst_ty = f.typeOfIndex(inst); |
| 5752 | const payload_ty = inst_ty.errorUnionPayload(zcu); | 5752 | const payload_ty = inst_ty.errorUnionPayload(zcu); |
| ... | @@ -5774,7 +5774,7 @@ fn airWrapErrUnionPay(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5774,7 +5774,7 @@ fn airWrapErrUnionPay(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5774 | 5774 | ||
| 5775 | fn airIsErr(f: *Function, inst: Air.Inst.Index, is_ptr: bool, operator: []const u8) !CValue { | 5775 | fn airIsErr(f: *Function, inst: Air.Inst.Index, is_ptr: bool, operator: []const u8) !CValue { |
| 5776 | const pt = f.dg.pt; | 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 | const w = &f.code.writer; | 5779 | const w = &f.code.writer; |
| 5780 | const operand = try f.resolveInst(un_op); | 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,7 +5798,7 @@ fn airIsErr(f: *Function, inst: Air.Inst.Index, is_ptr: bool, operator: []const |
| 5798 | fn airArrayToSlice(f: *Function, inst: Air.Inst.Index) !CValue { | 5798 | fn airArrayToSlice(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5799 | const pt = f.dg.pt; | 5799 | const pt = f.dg.pt; |
| 5800 | const zcu = pt.zcu; | 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 | const operand = try f.resolveInst(ty_op.operand); | 5803 | const operand = try f.resolveInst(ty_op.operand); |
| 5804 | try reap(f, inst, &.{ty_op.operand}); | 5804 | try reap(f, inst, &.{ty_op.operand}); |
| ... | @@ -5835,7 +5835,7 @@ fn airArrayToSlice(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5835,7 +5835,7 @@ fn airArrayToSlice(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5835 | fn airFloatCast(f: *Function, inst: Air.Inst.Index) !CValue { | 5835 | fn airFloatCast(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5836 | const pt = f.dg.pt; | 5836 | const pt = f.dg.pt; |
| 5837 | const zcu = pt.zcu; | 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 | const inst_ty = f.typeOfIndex(inst); | 5840 | const inst_ty = f.typeOfIndex(inst); |
| 5841 | const inst_scalar_ty = inst_ty.scalarType(zcu); | 5841 | const inst_scalar_ty = inst_ty.scalarType(zcu); |
| ... | @@ -5939,7 +5939,7 @@ fn airBinBuiltinCall( | ... | @@ -5939,7 +5939,7 @@ fn airBinBuiltinCall( |
| 5939 | ) !CValue { | 5939 | ) !CValue { |
| 5940 | const pt = f.dg.pt; | 5940 | const pt = f.dg.pt; |
| 5941 | const zcu = pt.zcu; | 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 | const operand_ty = f.typeOf(bin_op.lhs); | 5944 | const operand_ty = f.typeOf(bin_op.lhs); |
| 5945 | const is_big = lowersToBigInt(operand_ty, zcu); | 5945 | const is_big = lowersToBigInt(operand_ty, zcu); |
| ... | @@ -6052,7 +6052,7 @@ fn airCmpBuiltinCall( | ... | @@ -6052,7 +6052,7 @@ fn airCmpBuiltinCall( |
| 6052 | fn airCmpxchg(f: *Function, inst: Air.Inst.Index, flavor: [*:0]const u8) !CValue { | 6052 | fn airCmpxchg(f: *Function, inst: Air.Inst.Index, flavor: [*:0]const u8) !CValue { |
| 6053 | const pt = f.dg.pt; | 6053 | const pt = f.dg.pt; |
| 6054 | const zcu = pt.zcu; | 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 | const extra = f.air.extraData(Air.Cmpxchg, ty_pl.payload).data; | 6056 | const extra = f.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 6057 | const inst_ty = f.typeOfIndex(inst); | 6057 | const inst_ty = f.typeOfIndex(inst); |
| 6058 | const ptr = try f.resolveInst(extra.ptr); | 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,7 +6151,7 @@ fn airCmpxchg(f: *Function, inst: Air.Inst.Index, flavor: [*:0]const u8) !CValue |
| 6151 | fn airAtomicRmw(f: *Function, inst: Air.Inst.Index) !CValue { | 6151 | fn airAtomicRmw(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6152 | const pt = f.dg.pt; | 6152 | const pt = f.dg.pt; |
| 6153 | const zcu = pt.zcu; | 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 | const extra = f.air.extraData(Air.AtomicRmw, pl_op.payload).data; | 6155 | const extra = f.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 6156 | const inst_ty = f.typeOfIndex(inst); | 6156 | const inst_ty = f.typeOfIndex(inst); |
| 6157 | const ptr_ty = f.typeOf(pl_op.operand); | 6157 | const ptr_ty = f.typeOf(pl_op.operand); |
| ... | @@ -6208,7 +6208,7 @@ fn airAtomicRmw(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6208,7 +6208,7 @@ fn airAtomicRmw(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6208 | fn airAtomicLoad(f: *Function, inst: Air.Inst.Index) !CValue { | 6208 | fn airAtomicLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6209 | const pt = f.dg.pt; | 6209 | const pt = f.dg.pt; |
| 6210 | const zcu = pt.zcu; | 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 | const ptr = try f.resolveInst(atomic_load.ptr); | 6212 | const ptr = try f.resolveInst(atomic_load.ptr); |
| 6213 | try reap(f, inst, &.{atomic_load.ptr}); | 6213 | try reap(f, inst, &.{atomic_load.ptr}); |
| 6214 | const ptr_ty = f.typeOf(atomic_load.ptr); | 6214 | const ptr_ty = f.typeOf(atomic_load.ptr); |
| ... | @@ -6246,7 +6246,7 @@ fn airAtomicLoad(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6246,7 +6246,7 @@ fn airAtomicLoad(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6246 | fn airAtomicStore(f: *Function, inst: Air.Inst.Index, order: [*:0]const u8) !CValue { | 6246 | fn airAtomicStore(f: *Function, inst: Air.Inst.Index, order: [*:0]const u8) !CValue { |
| 6247 | const pt = f.dg.pt; | 6247 | const pt = f.dg.pt; |
| 6248 | const zcu = pt.zcu; | 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 | const ptr_ty = f.typeOf(bin_op.lhs); | 6250 | const ptr_ty = f.typeOf(bin_op.lhs); |
| 6251 | const ty = ptr_ty.childType(zcu); | 6251 | const ty = ptr_ty.childType(zcu); |
| 6252 | const ptr = try f.resolveInst(bin_op.lhs); | 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,7 +6283,7 @@ fn airAtomicStore(f: *Function, inst: Air.Inst.Index, order: [*:0]const u8) !CVa |
| 6283 | fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { | 6283 | fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 6284 | const pt = f.dg.pt; | 6284 | const pt = f.dg.pt; |
| 6285 | const zcu = pt.zcu; | 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 | const dest_ty = f.typeOf(bin_op.lhs); | 6287 | const dest_ty = f.typeOf(bin_op.lhs); |
| 6288 | const dest_slice = try f.resolveInst(bin_op.lhs); | 6288 | const dest_slice = try f.resolveInst(bin_op.lhs); |
| 6289 | const value = try f.resolveInst(bin_op.rhs); | 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,7 +6389,7 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 6389 | fn airMemcpy(f: *Function, inst: Air.Inst.Index, function_paren: []const u8) !CValue { | 6389 | fn airMemcpy(f: *Function, inst: Air.Inst.Index, function_paren: []const u8) !CValue { |
| 6390 | const pt = f.dg.pt; | 6390 | const pt = f.dg.pt; |
| 6391 | const zcu = pt.zcu; | 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 | const dest_ptr = try f.resolveInst(bin_op.lhs); | 6393 | const dest_ptr = try f.resolveInst(bin_op.lhs); |
| 6394 | const src_ptr = try f.resolveInst(bin_op.rhs); | 6394 | const src_ptr = try f.resolveInst(bin_op.rhs); |
| 6395 | const dest_ty = f.typeOf(bin_op.lhs); | 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,7 +6431,7 @@ fn airMemcpy(f: *Function, inst: Air.Inst.Index, function_paren: []const u8) !CV |
| 6431 | fn airSetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { | 6431 | fn airSetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6432 | const pt = f.dg.pt; | 6432 | const pt = f.dg.pt; |
| 6433 | const zcu = pt.zcu; | 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 | const union_ptr = try f.resolveInst(bin_op.lhs); | 6435 | const union_ptr = try f.resolveInst(bin_op.lhs); |
| 6436 | const new_tag = try f.resolveInst(bin_op.rhs); | 6436 | const new_tag = try f.resolveInst(bin_op.rhs); |
| 6437 | try reap(f, inst, &.{ bin_op.lhs, bin_op.rhs }); | 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,7 +6452,7 @@ fn airSetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6452 | fn airGetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { | 6452 | fn airGetUnionTag(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6453 | const pt = f.dg.pt; | 6453 | const pt = f.dg.pt; |
| 6454 | const zcu = pt.zcu; | 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 | const operand = try f.resolveInst(ty_op.operand); | 6457 | const operand = try f.resolveInst(ty_op.operand); |
| 6458 | try reap(f, inst, &.{ty_op.operand}); | 6458 | try reap(f, inst, &.{ty_op.operand}); |
| ... | @@ -6476,7 +6476,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6476,7 +6476,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6476 | const zcu = f.dg.pt.zcu; | 6476 | const zcu = f.dg.pt.zcu; |
| 6477 | const ip = &zcu.intern_pool; | 6477 | const ip = &zcu.intern_pool; |
| 6478 | const gpa = zcu.comp.gpa; | 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 | const inst_ty = f.typeOfIndex(inst); | 6481 | const inst_ty = f.typeOfIndex(inst); |
| 6482 | const enum_ty = f.typeOf(un_op); | 6482 | const enum_ty = f.typeOf(un_op); |
| ... | @@ -6489,7 +6489,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6489,7 +6489,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6489 | try f.need_tag_name_funcs.put(gpa, enum_ty.toIntern(), {}); | 6489 | try f.need_tag_name_funcs.put(gpa, enum_ty.toIntern(), {}); |
| 6490 | try w.print(" = zig_tagName_{f}__{d}(", .{ | 6490 | try w.print(" = zig_tagName_{f}__{d}(", .{ |
| 6491 | fmtIdentUnsolo(enum_ty.containerTypeName(ip).toSlice(ip)), | 6491 | fmtIdentUnsolo(enum_ty.containerTypeName(ip).toSlice(ip)), |
| 6492 | @intFromEnum(enum_ty.toIntern()), | 6492 | @backingInt(enum_ty.toIntern()), |
| 6493 | }); | 6493 | }); |
| 6494 | try f.writeCValue(w, operand, .other); | 6494 | try f.writeCValue(w, operand, .other); |
| 6495 | try w.writeAll(");"); | 6495 | try w.writeAll(");"); |
| ... | @@ -6499,7 +6499,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6499,7 +6499,7 @@ fn airTagName(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6499 | } | 6499 | } |
| 6500 | 6500 | ||
| 6501 | fn airErrorName(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const w = &f.code.writer; | 6504 | const w = &f.code.writer; |
| 6505 | const inst_ty = f.typeOfIndex(inst); | 6505 | const inst_ty = f.typeOfIndex(inst); |
| ... | @@ -6516,7 +6516,7 @@ fn airErrorName(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6516,7 +6516,7 @@ fn airErrorName(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6516 | } | 6516 | } |
| 6517 | 6517 | ||
| 6518 | fn airSplat(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const operand = try f.resolveInst(ty_op.operand); | 6521 | const operand = try f.resolveInst(ty_op.operand); |
| 6522 | try reap(f, inst, &.{ty_op.operand}); | 6522 | try reap(f, inst, &.{ty_op.operand}); |
| ... | @@ -6538,7 +6538,7 @@ fn airSplat(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6538,7 +6538,7 @@ fn airSplat(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6538 | } | 6538 | } |
| 6539 | 6539 | ||
| 6540 | fn airSelect(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const extra = f.air.extraData(Air.Bin, pl_op.payload).data; | 6542 | const extra = f.air.extraData(Air.Bin, pl_op.payload).data; |
| 6543 | 6543 | ||
| 6544 | const pred = try f.resolveInst(pl_op.operand); | 6544 | const pred = try f.resolveInst(pl_op.operand); |
| ... | @@ -6645,7 +6645,7 @@ fn airShuffleTwo(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6645,7 +6645,7 @@ fn airShuffleTwo(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6645 | fn airReduce(f: *Function, inst: Air.Inst.Index) !CValue { | 6645 | fn airReduce(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6646 | const pt = f.dg.pt; | 6646 | const pt = f.dg.pt; |
| 6647 | const zcu = pt.zcu; | 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 | const scalar_ty = f.typeOfIndex(inst); | 6650 | const scalar_ty = f.typeOfIndex(inst); |
| 6651 | const operand = try f.resolveInst(reduce.operand); | 6651 | const operand = try f.resolveInst(reduce.operand); |
| ... | @@ -6784,7 +6784,7 @@ fn airAggregateInit(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6784,7 +6784,7 @@ fn airAggregateInit(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6784 | const pt = f.dg.pt; | 6784 | const pt = f.dg.pt; |
| 6785 | const zcu = pt.zcu; | 6785 | const zcu = pt.zcu; |
| 6786 | const ip = &zcu.intern_pool; | 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 | const inst_ty = f.typeOfIndex(inst); | 6788 | const inst_ty = f.typeOfIndex(inst); |
| 6789 | const len: usize = @intCast(inst_ty.arrayLen(zcu)); | 6789 | const len: usize = @intCast(inst_ty.arrayLen(zcu)); |
| 6790 | const elements: []const Air.Inst.Ref = @ptrCast(f.air.extra.items[ty_pl.payload..][0..len]); | 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,7 +6860,7 @@ fn airUnionInit(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6860 | const pt = f.dg.pt; | 6860 | const pt = f.dg.pt; |
| 6861 | const zcu = pt.zcu; | 6861 | const zcu = pt.zcu; |
| 6862 | const ip = &zcu.intern_pool; | 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 | const extra = f.air.extraData(Air.UnionInit, ty_pl.payload).data; | 6864 | const extra = f.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 6865 | const field_index = extra.field_index; | 6865 | const field_index = extra.field_index; |
| 6866 | 6866 | ||
| ... | @@ -6904,7 +6904,7 @@ fn airUnionInit(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6904,7 +6904,7 @@ fn airUnionInit(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6904 | fn airPrefetch(f: *Function, inst: Air.Inst.Index) !CValue { | 6904 | fn airPrefetch(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6905 | const pt = f.dg.pt; | 6905 | const pt = f.dg.pt; |
| 6906 | const zcu = pt.zcu; | 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 | const ptr_ty = f.typeOf(prefetch.ptr); | 6909 | const ptr_ty = f.typeOf(prefetch.ptr); |
| 6910 | const ptr = try f.resolveInst(prefetch.ptr); | 6910 | const ptr = try f.resolveInst(prefetch.ptr); |
| ... | @@ -6918,7 +6918,7 @@ fn airPrefetch(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6918,7 +6918,7 @@ fn airPrefetch(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6918 | try f.writeCValueMember(w, ptr, .{ .identifier = "ptr" }) | 6918 | try f.writeCValueMember(w, ptr, .{ .identifier = "ptr" }) |
| 6919 | else | 6919 | else |
| 6920 | try f.writeCValue(w, ptr, .other); | 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 | try f.newline(); | 6922 | try f.newline(); |
| 6923 | }, | 6923 | }, |
| 6924 | // The available prefetch intrinsics do not accept a cache argument; only | 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,7 +6930,7 @@ fn airPrefetch(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6930 | } | 6930 | } |
| 6931 | 6931 | ||
| 6932 | fn airWasmMemorySize(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const w = &f.code.writer; | 6935 | const w = &f.code.writer; |
| 6936 | const inst_ty = f.typeOfIndex(inst); | 6936 | const inst_ty = f.typeOfIndex(inst); |
| ... | @@ -6945,7 +6945,7 @@ fn airWasmMemorySize(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6945,7 +6945,7 @@ fn airWasmMemorySize(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6945 | } | 6945 | } |
| 6946 | 6946 | ||
| 6947 | fn airWasmMemoryGrow(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const w = &f.code.writer; | 6950 | const w = &f.code.writer; |
| 6951 | const inst_ty = f.typeOfIndex(inst); | 6951 | const inst_ty = f.typeOfIndex(inst); |
| ... | @@ -6965,7 +6965,7 @@ fn airWasmMemoryGrow(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6965,7 +6965,7 @@ fn airWasmMemoryGrow(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6965 | fn airMulAdd(f: *Function, inst: Air.Inst.Index) !CValue { | 6965 | fn airMulAdd(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6966 | const pt = f.dg.pt; | 6966 | const pt = f.dg.pt; |
| 6967 | const zcu = pt.zcu; | 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 | const bin_op = f.air.extraData(Air.Bin, pl_op.payload).data; | 6969 | const bin_op = f.air.extraData(Air.Bin, pl_op.payload).data; |
| 6970 | 6970 | ||
| 6971 | const mulend1 = try f.resolveInst(bin_op.lhs); | 6971 | const mulend1 = try f.resolveInst(bin_op.lhs); |
| ... | @@ -7000,7 +7000,7 @@ fn airMulAdd(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -7000,7 +7000,7 @@ fn airMulAdd(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7000 | } | 7000 | } |
| 7001 | 7001 | ||
| 7002 | fn airRuntimeNavPtr(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const w = &f.code.writer; | 7004 | const w = &f.code.writer; |
| 7005 | const local = try f.allocLocal(inst, .fromInterned(ty_nav.ty)); | 7005 | const local = try f.allocLocal(inst, .fromInterned(ty_nav.ty)); |
| 7006 | try f.writeCValue(w, local, .other); | 7006 | try f.writeCValue(w, local, .other); |
| ... | @@ -7032,7 +7032,7 @@ fn airCVaStart(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -7032,7 +7032,7 @@ fn airCVaStart(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7032 | } | 7032 | } |
| 7033 | 7033 | ||
| 7034 | fn airCVaArg(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const inst_ty = f.typeOfIndex(inst); | 7037 | const inst_ty = f.typeOfIndex(inst); |
| 7038 | const va_list = try f.resolveInst(ty_op.operand); | 7038 | const va_list = try f.resolveInst(ty_op.operand); |
| ... | @@ -7051,7 +7051,7 @@ fn airCVaArg(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -7051,7 +7051,7 @@ fn airCVaArg(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7051 | } | 7051 | } |
| 7052 | 7052 | ||
| 7053 | fn airCVaEnd(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const va_list = try f.resolveInst(un_op); | 7056 | const va_list = try f.resolveInst(un_op); |
| 7057 | try reap(f, inst, &.{un_op}); | 7057 | try reap(f, inst, &.{un_op}); |
| ... | @@ -7065,7 +7065,7 @@ fn airCVaEnd(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -7065,7 +7065,7 @@ fn airCVaEnd(f: *Function, inst: Air.Inst.Index) !CValue { |
| 7065 | } | 7065 | } |
| 7066 | 7066 | ||
| 7067 | fn airCVaCopy(f: *Function, inst: Air.Inst.Index) !CValue { | 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 | const inst_ty = f.typeOfIndex(inst); | 7070 | const inst_ty = f.typeOfIndex(inst); |
| 7071 | const va_list = try f.resolveInst(ty_op.operand); | 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,9 +7830,9 @@ fn freeLocal(f: *Function, inst: ?Air.Inst.Index, local_index: LocalIndex, ref_i |
| 7830 | const local = f.locals.items[local_index]; | 7830 | const local = f.locals.items[local_index]; |
| 7831 | if (inst) |i| { | 7831 | if (inst) |i| { |
| 7832 | if (ref_inst) |operand| { | 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 | } else { | 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 | } else { | 7837 | } else { |
| 7838 | if (ref_inst) |operand| { | 7838 | if (ref_inst) |operand| { |
| ... | @@ -7915,11 +7915,11 @@ fn renderNavName(w: *Writer, nav_index: InternPool.Nav.Index, ip: *const InternP | ... | @@ -7915,11 +7915,11 @@ fn renderNavName(w: *Writer, nav_index: InternPool.Nav.Index, ip: *const InternP |
| 7915 | const fqn_slice = ip.getNav(nav_index).fqn.toSlice(ip); | 7915 | const fqn_slice = ip.getNav(nav_index).fqn.toSlice(ip); |
| 7916 | try w.print("{f}__{d}", .{ | 7916 | try w.print("{f}__{d}", .{ |
| 7917 | fmtIdentUnsolo(fqn_slice[0..@min(fqn_slice.len, 100)]), | 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 | fn renderUavName(w: *Writer, uav: Value) !void { | 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,7 +904,7 @@ pub const CType = union(enum) { |
| 904 | }, | 904 | }, |
| 905 | .error_set => switch (ty.toIntern()) { | 905 | .error_set => switch (ty.toIntern()) { |
| 906 | .anyerror_type => try w.writeAll("anyerror"), | 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 | .optional => try w.print("opt_{f}", .{fmtZigType(ty.optionalChild(zcu), zcu)}), | 909 | .optional => try w.print("opt_{f}", .{fmtZigType(ty.optionalChild(zcu), zcu)}), |
| 910 | .error_union => try w.print("errunion_{f}", .{fmtZigType(ty.errorUnionPayload(zcu), zcu)}), | 910 | .error_union => try w.print("errunion_{f}", .{fmtZigType(ty.errorUnionPayload(zcu), zcu)}), |
| ... | @@ -944,7 +944,7 @@ pub const CType = union(enum) { | ... | @@ -944,7 +944,7 @@ pub const CType = union(enum) { |
| 944 | 944 | ||
| 945 | .array => if (ty.sentinel(zcu)) |s| try w.print("arr_{d}s{d}_{f}", .{ | 945 | .array => if (ty.sentinel(zcu)) |s| try w.print("arr_{d}s{d}_{f}", .{ |
| 946 | ty.arrayLen(zcu), | 946 | ty.arrayLen(zcu), |
| 947 | @intFromEnum(s.toIntern()), | 947 | @backingInt(s.toIntern()), |
| 948 | fmtZigType(ty.childType(zcu), zcu), | 948 | fmtZigType(ty.childType(zcu), zcu), |
| 949 | }) else try w.print("arr_{d}_{f}", .{ | 949 | }) else try w.print("arr_{d}_{f}", .{ |
| 950 | ty.arrayLen(zcu), | 950 | ty.arrayLen(zcu), |
src/codegen/llvm.zig+9-9| ... | @@ -1739,14 +1739,14 @@ pub const Object = struct { | ... | @@ -1739,14 +1739,14 @@ pub const Object = struct { |
| 1739 | assert(zcu.intern_pool.typeOf(val) == .type_type); | 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 | try o.lazy_abi_aligns.ensureUnusedCapacity(gpa, 1); | 1743 | try o.lazy_abi_aligns.ensureUnusedCapacity(gpa, 1); |
| 1744 | const fwd_ref = try o.builder.alignmentForwardReference(); | 1744 | const fwd_ref = try o.builder.alignmentForwardReference(); |
| 1745 | o.lazy_abi_aligns.appendAssumeCapacity(fwd_ref); | 1745 | o.lazy_abi_aligns.appendAssumeCapacity(fwd_ref); |
| 1746 | } | 1746 | } |
| 1747 | 1747 | ||
| 1748 | if (!o.builder.strip) { | 1748 | if (!o.builder.strip) { |
| 1749 | assert(@intFromEnum(index) == o.debug_types.items.len); | 1749 | assert(@backingInt(index) == o.debug_types.items.len); |
| 1750 | try o.debug_types.ensureUnusedCapacity(gpa, 1); | 1750 | try o.debug_types.ensureUnusedCapacity(gpa, 1); |
| 1751 | const fwd_ref = try o.builder.debugForwardReference(); | 1751 | const fwd_ref = try o.builder.debugForwardReference(); |
| 1752 | o.debug_types.appendAssumeCapacity(fwd_ref); | 1752 | o.debug_types.appendAssumeCapacity(fwd_ref); |
| ... | @@ -1766,13 +1766,13 @@ pub const Object = struct { | ... | @@ -1766,13 +1766,13 @@ pub const Object = struct { |
| 1766 | const ty: Type = .fromInterned(val); | 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 | o.builder.resolveAlignmentForwardReference(fwd_ref, .fromByteUnits(1)); | 1770 | o.builder.resolveAlignmentForwardReference(fwd_ref, .fromByteUnits(1)); |
| 1771 | } | 1771 | } |
| 1772 | 1772 | ||
| 1773 | if (!o.builder.strip) { | 1773 | if (!o.builder.strip) { |
| 1774 | assert(val != .anyerror_type); | 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 | const name_str = try o.builder.metadataStringFmt("{f}", .{ty.fmt(pt)}); | 1776 | const name_str = try o.builder.metadataStringFmt("{f}", .{ty.fmt(pt)}); |
| 1777 | // If `ty` is a function, use a dummy *function* type to prevent existing debug | 1777 | // If `ty` is a function, use a dummy *function* type to prevent existing debug |
| 1778 | // subprograms from becoming ill-formed. | 1778 | // subprograms from becoming ill-formed. |
| ... | @@ -1793,12 +1793,12 @@ pub const Object = struct { | ... | @@ -1793,12 +1793,12 @@ pub const Object = struct { |
| 1793 | const ty: Type = .fromInterned(val); | 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 | o.builder.resolveAlignmentForwardReference(fwd_ref, ty.abiAlignment(zcu).toLlvm()); | 1797 | o.builder.resolveAlignmentForwardReference(fwd_ref, ty.abiAlignment(zcu).toLlvm()); |
| 1798 | } | 1798 | } |
| 1799 | 1799 | ||
| 1800 | if (!o.builder.strip) { | 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 | if (val == .anyerror_type) { | 1802 | if (val == .anyerror_type) { |
| 1803 | // Don't lower this now; it will be populated in `emit` instead. | 1803 | // Don't lower this now; it will be populated in `emit` instead. |
| 1804 | assert(o.debug_anyerror_fwd_ref == fwd_ref.toOptional()); | 1804 | assert(o.debug_anyerror_fwd_ref == fwd_ref.toOptional()); |
| ... | @@ -1845,7 +1845,7 @@ pub const Object = struct { | ... | @@ -1845,7 +1845,7 @@ pub const Object = struct { |
| 1845 | pub fn getDebugType(o: *Object, pt: Zcu.PerThread, ty: Type) Allocator.Error!Builder.Metadata { | 1845 | pub fn getDebugType(o: *Object, pt: Zcu.PerThread, ty: Type) Allocator.Error!Builder.Metadata { |
| 1846 | assert(!o.builder.strip); | 1846 | assert(!o.builder.strip); |
| 1847 | const index = try o.type_pool.get(pt, .{ .llvm = o }, ty.toIntern()); | 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 | /// In codegen logic, instead of calling this directly, use `getDebugType` to get a forward | 1851 | /// In codegen logic, instead of calling this directly, use `getDebugType` to get a forward |
| ... | @@ -3958,7 +3958,7 @@ pub const Object = struct { | ... | @@ -3958,7 +3958,7 @@ pub const Object = struct { |
| 3958 | errdefer assert(o.uav_map.remove(.{ .val = uav_val, .@"addrspace" = @"addrspace" })); | 3958 | errdefer assert(o.uav_map.remove(.{ .val = uav_val, .@"addrspace" = @"addrspace" })); |
| 3959 | 3959 | ||
| 3960 | const llvm_ty = try o.lowerType(uav_ty, .in_memory); | 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 | const llvm_variable = try o.builder.addVariable(llvm_name, llvm_ty, llvm_addrspace); | 3962 | const llvm_variable = try o.builder.addVariable(llvm_name, llvm_ty, llvm_addrspace); |
| 3963 | gop.value_ptr.* = llvm_variable; | 3963 | gop.value_ptr.* = llvm_variable; |
| 3964 | try llvm_variable.setInitializer(try o.lowerValue(uav_val, .in_memory), &o.builder); | 3964 | try llvm_variable.setInitializer(try o.lowerValue(uav_val, .in_memory), &o.builder); |
| ... | @@ -4195,7 +4195,7 @@ pub const Object = struct { | ... | @@ -4195,7 +4195,7 @@ pub const Object = struct { |
| 4195 | 4195 | ||
| 4196 | pub fn lazyAbiAlignment(o: *Object, pt: Zcu.PerThread, ty: Type) Allocator.Error!Builder.Alignment.Lazy { | 4196 | pub fn lazyAbiAlignment(o: *Object, pt: Zcu.PerThread, ty: Type) Allocator.Error!Builder.Alignment.Lazy { |
| 4197 | const index = try o.type_pool.get(pt, .{ .llvm = o }, ty.toIntern()); | 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 | pub fn getIsNamedEnumValueFunction(o: *Object, enum_ty: Type) Allocator.Error!Builder.Function.Index { | 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,7 +351,7 @@ fn genBody(self: *FuncGen, body: []const Air.Inst.Index, coverage_point: Air.Cov |
| 351 | for (body) |inst| { | 351 | for (body) |inst| { |
| 352 | if (self.liveness.isUnused(inst) and !self.air.mustLower(inst, ip)) continue; | 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 | // zig fmt: off | 355 | // zig fmt: off |
| 356 | 356 | ||
| 357 | // Required due to `.scalarize_bit_cast_vector_non_elementwise` being enabled. | 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,7 +1061,7 @@ fn airRet(self: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!vo |
| 1061 | const o = self.object; | 1061 | const o = self.object; |
| 1062 | const zcu = o.zcu; | 1062 | const zcu = o.zcu; |
| 1063 | const ip = &zcu.intern_pool; | 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 | const ret_ty = self.typeOf(un_op); | 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,7 +1136,7 @@ fn airRetLoad(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 1136 | const o = self.object; | 1136 | const o = self.object; |
| 1137 | const zcu = o.zcu; | 1137 | const zcu = o.zcu; |
| 1138 | const ip = &zcu.intern_pool; | 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 | const ptr_ty = self.typeOf(un_op); | 1140 | const ptr_ty = self.typeOf(un_op); |
| 1141 | const ret_ty = ptr_ty.childType(zcu); | 1141 | const ret_ty = ptr_ty.childType(zcu); |
| 1142 | const fn_info = zcu.typeToFunc(.fromInterned(ip.getNav(self.nav_index).resolved.?.type)).?; | 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,7 +1162,7 @@ fn airRetLoad(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 1162 | } | 1162 | } |
| 1163 | 1163 | ||
| 1164 | fn airCVaArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const list = try self.resolveInst(ty_op.operand); | 1166 | const list = try self.resolveInst(ty_op.operand); |
| 1167 | const arg_ty = ty_op.ty.toType(); | 1167 | const arg_ty = ty_op.ty.toType(); |
| 1168 | const llvm_arg_ty = try self.object.lowerType(arg_ty, .by_value); | 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,7 +1173,7 @@ fn airCVaArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 1173 | fn airCVaCopy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 1173 | fn airCVaCopy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 1174 | const o = self.object; | 1174 | const o = self.object; |
| 1175 | const zcu = o.zcu; | 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 | const src_list = try self.resolveInst(ty_op.operand); | 1177 | const src_list = try self.resolveInst(ty_op.operand); |
| 1178 | const va_list_ty = ty_op.ty.toType(); | 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,7 +1187,7 @@ fn airCVaCopy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 1187 | } | 1187 | } |
| 1188 | 1188 | ||
| 1189 | fn airCVaEnd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const src_list = try self.resolveInst(un_op); | 1191 | const src_list = try self.resolveInst(un_op); |
| 1192 | 1192 | ||
| 1193 | _ = try self.wip.callIntrinsic(.normal, .none, .va_end, &.{src_list.typeOfWip(&self.wip)}, &.{src_list}, ""); | 1193 | _ = try self.wip.callIntrinsic(.normal, .none, .va_end, &.{src_list.typeOfWip(&self.wip)}, &.{src_list}, ""); |
| ... | @@ -1214,7 +1214,7 @@ fn airCmp( | ... | @@ -1214,7 +1214,7 @@ fn airCmp( |
| 1214 | op: math.CompareOperator, | 1214 | op: math.CompareOperator, |
| 1215 | fast: Builder.FastMathKind, | 1215 | fast: Builder.FastMathKind, |
| 1216 | ) Allocator.Error!Builder.Value { | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 1218 | const lhs = try self.resolveInst(bin_op.lhs); |
| 1219 | const rhs = try self.resolveInst(bin_op.rhs); | 1219 | const rhs = try self.resolveInst(bin_op.rhs); |
| 1220 | const operand_ty = self.typeOf(bin_op.lhs); | 1220 | const operand_ty = self.typeOf(bin_op.lhs); |
| ... | @@ -1223,7 +1223,7 @@ fn airCmp( | ... | @@ -1223,7 +1223,7 @@ fn airCmp( |
| 1223 | } | 1223 | } |
| 1224 | 1224 | ||
| 1225 | fn airCmpVector(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 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 | const extra = self.air.extraData(Air.VectorCmp, ty_pl.payload).data; | 1227 | const extra = self.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 1228 | 1228 | ||
| 1229 | const lhs = try self.resolveInst(extra.lhs); | 1229 | const lhs = try self.resolveInst(extra.lhs); |
| ... | @@ -1236,7 +1236,7 @@ fn airCmpVector(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind | ... | @@ -1236,7 +1236,7 @@ fn airCmpVector(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind |
| 1236 | 1236 | ||
| 1237 | fn airCmpLteErrorsLen(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 1237 | fn airCmpLteErrorsLen(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 1238 | const o = self.object; | 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 | const operand = try self.resolveInst(un_op); | 1240 | const operand = try self.resolveInst(un_op); |
| 1241 | const errors_len_ptr = try o.getErrorsLen(); | 1241 | const errors_len_ptr = try o.getErrorsLen(); |
| 1242 | const errors_len_val = try self.load(errors_len_ptr.toValue(&o.builder), .none, .anyerror, .normal); | 1242 | const errors_len_val = try self.load(errors_len_ptr.toValue(&o.builder), .none, .anyerror, .normal); |
| ... | @@ -1392,7 +1392,7 @@ fn lowerBlock( | ... | @@ -1392,7 +1392,7 @@ fn lowerBlock( |
| 1392 | 1392 | ||
| 1393 | fn airBr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { | 1393 | fn airBr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 1394 | const zcu = self.object.zcu; | 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 | const block = self.blocks.get(branch.block_inst).?; | 1396 | const block = self.blocks.get(branch.block_inst).?; |
| 1397 | 1397 | ||
| 1398 | // Add the values to the lists only if the break provides a value. | 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,7 +1408,7 @@ fn airBr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 1408 | } | 1408 | } |
| 1409 | 1409 | ||
| 1410 | fn airRepeat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { | 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 | const loop_bb = self.loops.get(repeat.loop_inst).?; | 1412 | const loop_bb = self.loops.get(repeat.loop_inst).?; |
| 1413 | loop_bb.ptr(&self.wip).incoming += 1; | 1413 | loop_bb.ptr(&self.wip).incoming += 1; |
| 1414 | _ = try self.wip.br(loop_bb); | 1414 | _ = try self.wip.br(loop_bb); |
| ... | @@ -1603,7 +1603,7 @@ fn lowerSwitchDispatch( | ... | @@ -1603,7 +1603,7 @@ fn lowerSwitchDispatch( |
| 1603 | } | 1603 | } |
| 1604 | 1604 | ||
| 1605 | fn airSwitchDispatch(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { | 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 | const dispatch_info = self.switch_dispatch_info.get(br.block_inst).?; | 1607 | const dispatch_info = self.switch_dispatch_info.get(br.block_inst).?; |
| 1608 | return self.lowerSwitchDispatch(br.block_inst, br.operand, dispatch_info); | 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,7 +1850,7 @@ fn airSwitchBr(self: *FuncGen, inst: Air.Inst.Index, is_dispatch_loop: bool) Tod |
| 1850 | const table_val = try o.builder.arrayConst(table_llvm_ty, table_elems); | 1850 | const table_val = try o.builder.arrayConst(table_llvm_ty, table_elems); |
| 1851 | 1851 | ||
| 1852 | const table_variable = try o.builder.addVariable( | 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 | table_llvm_ty, | 1854 | table_llvm_ty, |
| 1855 | .default, | 1855 | .default, |
| 1856 | ); | 1856 | ); |
| ... | @@ -2018,7 +2018,7 @@ fn airLoop(self: *FuncGen, inst: Air.Inst.Index) TodoError!void { | ... | @@ -2018,7 +2018,7 @@ fn airLoop(self: *FuncGen, inst: Air.Inst.Index) TodoError!void { |
| 2018 | fn airArrayToSlice(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 2018 | fn airArrayToSlice(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2019 | const o = self.object; | 2019 | const o = self.object; |
| 2020 | const zcu = o.zcu; | 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 | const operand_ty = self.typeOf(ty_op.operand); | 2022 | const operand_ty = self.typeOf(ty_op.operand); |
| 2023 | const array_ty = operand_ty.childType(zcu); | 2023 | const array_ty = operand_ty.childType(zcu); |
| 2024 | const llvm_usize = try o.lowerType(.usize, .by_value); | 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,7 +2031,7 @@ fn airArrayToSlice(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder |
| 2031 | fn airFloatFromInt(self: *FuncGen, inst: Air.Inst.Index) TodoError!Builder.Value { | 2031 | fn airFloatFromInt(self: *FuncGen, inst: Air.Inst.Index) TodoError!Builder.Value { |
| 2032 | const o = self.object; | 2032 | const o = self.object; |
| 2033 | const zcu = o.zcu; | 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 | const operand = try self.resolveInst(ty_op.operand); | 2036 | const operand = try self.resolveInst(ty_op.operand); |
| 2037 | const operand_ty = self.typeOf(ty_op.operand); | 2037 | const operand_ty = self.typeOf(ty_op.operand); |
| ... | @@ -2100,7 +2100,7 @@ fn airIntFromFloat( | ... | @@ -2100,7 +2100,7 @@ fn airIntFromFloat( |
| 2100 | const o = self.object; | 2100 | const o = self.object; |
| 2101 | const zcu = o.zcu; | 2101 | const zcu = o.zcu; |
| 2102 | const target = zcu.getTarget(); | 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 | const operand = try self.resolveInst(ty_op.operand); | 2105 | const operand = try self.resolveInst(ty_op.operand); |
| 2106 | const operand_ty = self.typeOf(ty_op.operand); | 2106 | const operand_ty = self.typeOf(ty_op.operand); |
| ... | @@ -2188,21 +2188,21 @@ fn sliceOrArrayLenInBytes(fg: *FuncGen, ptr: Builder.Value, ty: Type) Allocator. | ... | @@ -2188,21 +2188,21 @@ fn sliceOrArrayLenInBytes(fg: *FuncGen, ptr: Builder.Value, ty: Type) Allocator. |
| 2188 | } | 2188 | } |
| 2189 | 2189 | ||
| 2190 | fn airSliceField(self: *FuncGen, inst: Air.Inst.Index, index: u32) Allocator.Error!Builder.Value { | 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 | const operand = try self.resolveInst(ty_op.operand); | 2192 | const operand = try self.resolveInst(ty_op.operand); |
| 2193 | return self.wip.extractValue(operand, &.{index}, ""); | 2193 | return self.wip.extractValue(operand, &.{index}, ""); |
| 2194 | } | 2194 | } |
| 2195 | 2195 | ||
| 2196 | fn airPtrSliceFieldPtr(self: *FuncGen, inst: Air.Inst.Index, index: u1) Allocator.Error!Builder.Value { | 2196 | fn airPtrSliceFieldPtr(self: *FuncGen, inst: Air.Inst.Index, index: u1) Allocator.Error!Builder.Value { |
| 2197 | const zcu = self.object.zcu; | 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 | const slice_ptr = try self.resolveInst(ty_op.operand); | 2199 | const slice_ptr = try self.resolveInst(ty_op.operand); |
| 2200 | return self.ptraddConst(slice_ptr, index * Type.usize.abiSize(zcu)); | 2200 | return self.ptraddConst(slice_ptr, index * Type.usize.abiSize(zcu)); |
| 2201 | } | 2201 | } |
| 2202 | 2202 | ||
| 2203 | fn airSliceElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 2203 | fn airSliceElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2204 | const zcu = self.object.zcu; | 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 | const slice_ty = self.typeOf(bin_op.lhs); | 2206 | const slice_ty = self.typeOf(bin_op.lhs); |
| 2207 | const slice = try self.resolveInst(bin_op.lhs); | 2207 | const slice = try self.resolveInst(bin_op.lhs); |
| 2208 | const index = try self.resolveInst(bin_op.rhs); | 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,7 +2219,7 @@ fn airSliceElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder |
| 2219 | 2219 | ||
| 2220 | fn airSliceElemPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 2220 | fn airSliceElemPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2221 | const zcu = self.object.zcu; | 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 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 2223 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2224 | const slice_ty = self.typeOf(bin_op.lhs); | 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,7 +2232,7 @@ fn airSliceElemPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder |
| 2232 | fn airArrayElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 2232 | fn airArrayElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2233 | const zcu = self.object.zcu; | 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 | const array_ty = self.typeOf(bin_op.lhs); | 2236 | const array_ty = self.typeOf(bin_op.lhs); |
| 2237 | const array_llvm_val = try self.resolveInst(bin_op.lhs); | 2237 | const array_llvm_val = try self.resolveInst(bin_op.lhs); |
| 2238 | const rhs = try self.resolveInst(bin_op.rhs); | 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,7 +2247,7 @@ fn airArrayElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder |
| 2247 | } | 2247 | } |
| 2248 | 2248 | ||
| 2249 | fn airLegalizeVecElemVal(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const vec = try fg.resolveInst(bin_op.lhs); | 2251 | const vec = try fg.resolveInst(bin_op.lhs); |
| 2252 | const index = try fg.resolveInst(bin_op.rhs); | 2252 | const index = try fg.resolveInst(bin_op.rhs); |
| 2253 | return fg.wip.extractElement(vec, index, ""); | 2253 | return fg.wip.extractElement(vec, index, ""); |
| ... | @@ -2255,7 +2255,7 @@ fn airLegalizeVecElemVal(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui | ... | @@ -2255,7 +2255,7 @@ fn airLegalizeVecElemVal(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui |
| 2255 | fn airLegalizeVecStoreElem(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 2255 | fn airLegalizeVecStoreElem(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2256 | const zcu = fg.object.zcu; | 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 | const extra = fg.air.extraData(Air.Bin, pl_op.payload).data; | 2259 | const extra = fg.air.extraData(Air.Bin, pl_op.payload).data; |
| 2260 | 2260 | ||
| 2261 | const ptr_ty = fg.typeOf(pl_op.operand); | 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,7 +2276,7 @@ fn airLegalizeVecStoreElem(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!B |
| 2276 | 2276 | ||
| 2277 | fn airPtrElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 2277 | fn airPtrElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2278 | const zcu = self.object.zcu; | 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 | const ptr_ty = self.typeOf(bin_op.lhs); | 2280 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 2281 | const elem_ty = ptr_ty.indexableElem(zcu); | 2281 | const elem_ty = ptr_ty.indexableElem(zcu); |
| 2282 | const base_ptr = try self.resolveInst(bin_op.lhs); | 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,7 +2294,7 @@ fn airPtrElemVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.V |
| 2294 | 2294 | ||
| 2295 | fn airPtrElemPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 2295 | fn airPtrElemPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2296 | const zcu = self.object.zcu; | 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 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 2298 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2299 | const ptr_ty = self.typeOf(bin_op.lhs); | 2299 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 2300 | const elem_ty = ptr_ty.indexableElem(zcu); | 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,7 +2307,7 @@ fn airPtrElemPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.V |
| 2307 | } | 2307 | } |
| 2308 | 2308 | ||
| 2309 | fn airStructFieldPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data; | 2311 | const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 2312 | const struct_ptr = try self.resolveInst(struct_field.struct_operand); | 2312 | const struct_ptr = try self.resolveInst(struct_field.struct_operand); |
| 2313 | const struct_ptr_ty = self.typeOf(struct_field.struct_operand); | 2313 | const struct_ptr_ty = self.typeOf(struct_field.struct_operand); |
| ... | @@ -2319,7 +2319,7 @@ fn airStructFieldPtrIndex( | ... | @@ -2319,7 +2319,7 @@ fn airStructFieldPtrIndex( |
| 2319 | inst: Air.Inst.Index, | 2319 | inst: Air.Inst.Index, |
| 2320 | field_index: u32, | 2320 | field_index: u32, |
| 2321 | ) Allocator.Error!Builder.Value { | 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 | const struct_ptr = try self.resolveInst(ty_op.operand); | 2323 | const struct_ptr = try self.resolveInst(ty_op.operand); |
| 2324 | const struct_ptr_ty = self.typeOf(ty_op.operand); | 2324 | const struct_ptr_ty = self.typeOf(ty_op.operand); |
| 2325 | return self.fieldPtr(struct_ptr, struct_ptr_ty, field_index); | 2325 | return self.fieldPtr(struct_ptr, struct_ptr_ty, field_index); |
| ... | @@ -2328,7 +2328,7 @@ fn airStructFieldPtrIndex( | ... | @@ -2328,7 +2328,7 @@ fn airStructFieldPtrIndex( |
| 2328 | fn airAggFieldVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 2328 | fn airAggFieldVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2329 | const o = self.object; | 2329 | const o = self.object; |
| 2330 | const zcu = o.zcu; | 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 | const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data; | 2332 | const struct_field = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 2333 | const struct_ty = self.typeOf(struct_field.struct_operand); | 2333 | const struct_ty = self.typeOf(struct_field.struct_operand); |
| 2334 | const struct_llvm_val = try self.resolveInst(struct_field.struct_operand); | 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,7 +2386,7 @@ fn airAggFieldVal(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder. |
| 2386 | fn airFieldParentPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 2386 | fn airFieldParentPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 2387 | const o = self.object; | 2387 | const o = self.object; |
| 2388 | const zcu = o.zcu; | 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 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 2390 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 2391 | 2391 | ||
| 2392 | const field_ptr = try self.resolveInst(extra.field_ptr); | 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,7 +2409,7 @@ fn airFieldParentPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Build |
| 2409 | } | 2409 | } |
| 2410 | 2410 | ||
| 2411 | fn airNot(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const operand = try self.resolveInst(ty_op.operand); | 2413 | const operand = try self.resolveInst(ty_op.operand); |
| 2414 | 2414 | ||
| 2415 | return self.wip.not(operand, ""); | 2415 | return self.wip.not(operand, ""); |
| ... | @@ -2421,7 +2421,7 @@ fn airUnreach(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { | ... | @@ -2421,7 +2421,7 @@ fn airUnreach(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!void { |
| 2421 | } | 2421 | } |
| 2422 | 2422 | ||
| 2423 | fn airDbgStmt(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | self.prev_dbg_line = @intCast(self.base_line + dbg_stmt.line + 1); | 2425 | self.prev_dbg_line = @intCast(self.base_line + dbg_stmt.line + 1); |
| 2426 | self.prev_dbg_column = @intCast(dbg_stmt.column + 1); | 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,9 +2445,9 @@ fn airDbgVarPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 2445 | const o = self.object; | 2445 | const o = self.object; |
| 2446 | const pt = self.pt; | 2446 | const pt = self.pt; |
| 2447 | const zcu = o.zcu; | 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 | const operand = try self.resolveInst(pl_op.operand); | 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 | const ptr_ty = self.typeOf(pl_op.operand); | 2451 | const ptr_ty = self.typeOf(pl_op.operand); |
| 2452 | 2452 | ||
| 2453 | const debug_local_var = try o.builder.debugLocalVar( | 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,10 +2477,10 @@ fn airDbgVarPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 2477 | fn airDbgVarVal(self: *FuncGen, inst: Air.Inst.Index, is_arg: bool) Allocator.Error!Builder.Value { | 2477 | fn airDbgVarVal(self: *FuncGen, inst: Air.Inst.Index, is_arg: bool) Allocator.Error!Builder.Value { |
| 2478 | const o = self.object; | 2478 | const o = self.object; |
| 2479 | const pt = self.pt; | 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 | const operand = try self.resolveInst(pl_op.operand); | 2481 | const operand = try self.resolveInst(pl_op.operand); |
| 2482 | const operand_ty = self.typeOf(pl_op.operand); | 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 | const name_slice = name.toSlice(self.air); | 2484 | const name_slice = name.toSlice(self.air); |
| 2485 | const metadata_name = if (name_slice.len > 0) try o.builder.metadataString(name_slice) else null; | 2485 | const metadata_name = if (name_slice.len > 0) try o.builder.metadataString(name_slice) else null; |
| 2486 | const debug_local_var = if (is_arg) try o.builder.debugParameter( | 2486 | const debug_local_var = if (is_arg) try o.builder.debugParameter( |
| ... | @@ -2933,7 +2933,7 @@ fn airIsNonNull( | ... | @@ -2933,7 +2933,7 @@ fn airIsNonNull( |
| 2933 | ) Allocator.Error!Builder.Value { | 2933 | ) Allocator.Error!Builder.Value { |
| 2934 | const o = self.object; | 2934 | const o = self.object; |
| 2935 | const zcu = o.zcu; | 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 | const operand = try self.resolveInst(un_op); | 2937 | const operand = try self.resolveInst(un_op); |
| 2938 | const operand_ty = self.typeOf(un_op); | 2938 | const operand_ty = self.typeOf(un_op); |
| 2939 | const optional_ty = if (operand_is_ptr) operand_ty.childType(zcu) else operand_ty; | 2939 | const optional_ty = if (operand_is_ptr) operand_ty.childType(zcu) else operand_ty; |
| ... | @@ -2981,7 +2981,7 @@ fn airIsErr( | ... | @@ -2981,7 +2981,7 @@ fn airIsErr( |
| 2981 | ) Allocator.Error!Builder.Value { | 2981 | ) Allocator.Error!Builder.Value { |
| 2982 | const o = self.object; | 2982 | const o = self.object; |
| 2983 | const zcu = o.zcu; | 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 | const operand = try self.resolveInst(un_op); | 2985 | const operand = try self.resolveInst(un_op); |
| 2986 | const operand_ty = self.typeOf(un_op); | 2986 | const operand_ty = self.typeOf(un_op); |
| 2987 | const err_union_ty = if (operand_is_ptr) operand_ty.childType(zcu) else operand_ty; | 2987 | const err_union_ty = if (operand_is_ptr) operand_ty.childType(zcu) else operand_ty; |
| ... | @@ -3021,7 +3021,7 @@ fn airIsErr( | ... | @@ -3021,7 +3021,7 @@ fn airIsErr( |
| 3021 | } | 3021 | } |
| 3022 | 3022 | ||
| 3023 | fn airOptionalPayloadPtr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const operand = try self.resolveInst(ty_op.operand); | 3025 | const operand = try self.resolveInst(ty_op.operand); |
| 3026 | // If `Type.optionalReprIsPayload`, then the address should be the same. Otherwise, optional | 3026 | // If `Type.optionalReprIsPayload`, then the address should be the same. Otherwise, optional |
| 3027 | // layouts always put the payload at offset 0, so... the address should still be the same. | 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,7 +3033,7 @@ fn airOptionalPayloadPtrSet(self: *FuncGen, inst: Air.Inst.Index) Allocator.Erro |
| 3033 | 3033 | ||
| 3034 | const o = self.object; | 3034 | const o = self.object; |
| 3035 | const zcu = o.zcu; | 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 | const operand = try self.resolveInst(ty_op.operand); | 3037 | const operand = try self.resolveInst(ty_op.operand); |
| 3038 | const optional_ptr_ty = self.typeOf(ty_op.operand); | 3038 | const optional_ptr_ty = self.typeOf(ty_op.operand); |
| 3039 | const optional_ty = optional_ptr_ty.childType(zcu); | 3039 | const optional_ty = optional_ptr_ty.childType(zcu); |
| ... | @@ -3073,7 +3073,7 @@ fn airOptionalPayloadPtrSet(self: *FuncGen, inst: Air.Inst.Index) Allocator.Erro | ... | @@ -3073,7 +3073,7 @@ fn airOptionalPayloadPtrSet(self: *FuncGen, inst: Air.Inst.Index) Allocator.Erro |
| 3073 | 3073 | ||
| 3074 | fn airOptionalPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3074 | fn airOptionalPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3075 | const zcu = self.object.zcu; | 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 | const operand = try self.resolveInst(ty_op.operand); | 3077 | const operand = try self.resolveInst(ty_op.operand); |
| 3078 | const optional_ty = self.typeOf(ty_op.operand); | 3078 | const optional_ty = self.typeOf(ty_op.operand); |
| 3079 | const payload_ty = self.typeOfIndex(inst); | 3079 | const payload_ty = self.typeOfIndex(inst); |
| ... | @@ -3090,7 +3090,7 @@ fn airOptionalPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Buil | ... | @@ -3090,7 +3090,7 @@ fn airOptionalPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Buil |
| 3090 | fn airErrUnionPayload(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3090 | fn airErrUnionPayload(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3091 | const o = fg.object; | 3091 | const o = fg.object; |
| 3092 | const zcu = o.zcu; | 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 | const operand = try fg.resolveInst(ty_op.operand); | 3094 | const operand = try fg.resolveInst(ty_op.operand); |
| 3095 | const err_union_ty = fg.typeOf(ty_op.operand); | 3095 | const err_union_ty = fg.typeOf(ty_op.operand); |
| 3096 | const payload_ty = fg.typeOfIndex(inst); | 3096 | const payload_ty = fg.typeOfIndex(inst); |
| ... | @@ -3106,7 +3106,7 @@ fn airErrUnionPayload(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builde | ... | @@ -3106,7 +3106,7 @@ fn airErrUnionPayload(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builde |
| 3106 | fn airErrUnionPayloadPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3106 | fn airErrUnionPayloadPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3107 | const o = fg.object; | 3107 | const o = fg.object; |
| 3108 | const zcu = o.zcu; | 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 | const operand = try fg.resolveInst(ty_op.operand); | 3110 | const operand = try fg.resolveInst(ty_op.operand); |
| 3111 | const payload_ty = fg.typeOfIndex(inst).childType(zcu); | 3111 | const payload_ty = fg.typeOfIndex(inst).childType(zcu); |
| 3112 | return fg.ptraddConst(operand, codegen.errUnionPayloadOffset(payload_ty, zcu)); | 3112 | return fg.ptraddConst(operand, codegen.errUnionPayloadOffset(payload_ty, zcu)); |
| ... | @@ -3119,7 +3119,7 @@ fn airErrUnionErr( | ... | @@ -3119,7 +3119,7 @@ fn airErrUnionErr( |
| 3119 | ) Allocator.Error!Builder.Value { | 3119 | ) Allocator.Error!Builder.Value { |
| 3120 | const o = self.object; | 3120 | const o = self.object; |
| 3121 | const zcu = o.zcu; | 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 | const operand = try self.resolveInst(ty_op.operand); | 3123 | const operand = try self.resolveInst(ty_op.operand); |
| 3124 | const operand_ty = self.typeOf(ty_op.operand); | 3124 | const operand_ty = self.typeOf(ty_op.operand); |
| 3125 | const err_union_ty = if (operand_is_ptr) operand_ty.childType(zcu) else operand_ty; | 3125 | const err_union_ty = if (operand_is_ptr) operand_ty.childType(zcu) else operand_ty; |
| ... | @@ -3149,7 +3149,7 @@ fn airErrUnionErr( | ... | @@ -3149,7 +3149,7 @@ fn airErrUnionErr( |
| 3149 | fn airErrUnionPayloadPtrSet(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3149 | fn airErrUnionPayloadPtrSet(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3150 | const o = self.object; | 3150 | const o = self.object; |
| 3151 | const zcu = o.zcu; | 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 | const operand = try self.resolveInst(ty_op.operand); | 3153 | const operand = try self.resolveInst(ty_op.operand); |
| 3154 | const err_union_ptr_ty = self.typeOf(ty_op.operand); | 3154 | const err_union_ptr_ty = self.typeOf(ty_op.operand); |
| 3155 | const err_union_ty = err_union_ptr_ty.childType(zcu); | 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,7 +3181,7 @@ fn airErrReturnTrace(self: *FuncGen, _: Air.Inst.Index) Allocator.Error!Builder. |
| 3181 | } | 3181 | } |
| 3182 | 3182 | ||
| 3183 | fn airSetErrReturnTrace(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | self.err_ret_trace = try self.resolveInst(un_op); | 3185 | self.err_ret_trace = try self.resolveInst(un_op); |
| 3186 | return .none; | 3186 | return .none; |
| 3187 | } | 3187 | } |
| ... | @@ -3189,7 +3189,7 @@ fn airSetErrReturnTrace(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bu | ... | @@ -3189,7 +3189,7 @@ fn airSetErrReturnTrace(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bu |
| 3189 | fn airSaveErrReturnTraceIndex(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3189 | fn airSaveErrReturnTraceIndex(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3190 | const zcu = self.object.zcu; | 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 | const struct_ty = ty_pl.ty.toType(); | 3193 | const struct_ty = ty_pl.ty.toType(); |
| 3194 | const field_index = ty_pl.payload; | 3194 | const field_index = ty_pl.payload; |
| 3195 | 3195 | ||
| ... | @@ -3205,7 +3205,7 @@ fn airSaveErrReturnTraceIndex(self: *FuncGen, inst: Air.Inst.Index) Allocator.Er | ... | @@ -3205,7 +3205,7 @@ fn airSaveErrReturnTraceIndex(self: *FuncGen, inst: Air.Inst.Index) Allocator.Er |
| 3205 | fn airWrapOptional(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3205 | fn airWrapOptional(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3206 | const o = self.object; | 3206 | const o = self.object; |
| 3207 | const zcu = o.zcu; | 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 | const payload_ty = self.typeOf(ty_op.operand); | 3209 | const payload_ty = self.typeOf(ty_op.operand); |
| 3210 | comptime assert(optional_layout_version == 3); | 3210 | comptime assert(optional_layout_version == 3); |
| 3211 | assert(payload_ty.hasRuntimeBits(zcu)); | 3211 | assert(payload_ty.hasRuntimeBits(zcu)); |
| ... | @@ -3228,7 +3228,7 @@ fn airWrapOptional(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder | ... | @@ -3228,7 +3228,7 @@ fn airWrapOptional(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder |
| 3228 | fn airWrapErrUnionPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3228 | fn airWrapErrUnionPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3229 | const o = self.object; | 3229 | const o = self.object; |
| 3230 | const zcu = o.zcu; | 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 | const err_un_ty = self.typeOfIndex(inst); | 3232 | const err_un_ty = self.typeOfIndex(inst); |
| 3233 | const operand = try self.resolveInst(ty_op.operand); | 3233 | const operand = try self.resolveInst(ty_op.operand); |
| 3234 | const payload_ty = self.typeOf(ty_op.operand); | 3234 | const payload_ty = self.typeOf(ty_op.operand); |
| ... | @@ -3250,7 +3250,7 @@ fn airWrapErrUnionPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error! | ... | @@ -3250,7 +3250,7 @@ fn airWrapErrUnionPayload(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error! |
| 3250 | fn airWrapErrUnionErr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3250 | fn airWrapErrUnionErr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3251 | const o = self.object; | 3251 | const o = self.object; |
| 3252 | const zcu = o.zcu; | 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 | const err_un_ty = self.typeOfIndex(inst); | 3254 | const err_un_ty = self.typeOfIndex(inst); |
| 3255 | const payload_ty = err_un_ty.errorUnionPayload(zcu); | 3255 | const payload_ty = err_un_ty.errorUnionPayload(zcu); |
| 3256 | const operand = try self.resolveInst(ty_op.operand); | 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,7 +3271,7 @@ fn airWrapErrUnionErr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Buil |
| 3271 | 3271 | ||
| 3272 | fn airWasmMemorySize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3272 | fn airWasmMemorySize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3273 | const o = self.object; | 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 | const index = pl_op.payload; | 3275 | const index = pl_op.payload; |
| 3276 | const llvm_usize = try o.lowerType(.usize, .by_value); | 3276 | const llvm_usize = try o.lowerType(.usize, .by_value); |
| 3277 | return self.wip.callIntrinsic(.normal, .none, .@"wasm.memory.size", &.{llvm_usize}, &.{ | 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,7 +3281,7 @@ fn airWasmMemorySize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Build |
| 3281 | 3281 | ||
| 3282 | fn airWasmMemoryGrow(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3282 | fn airWasmMemoryGrow(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3283 | const o = self.object; | 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 | const index = pl_op.payload; | 3285 | const index = pl_op.payload; |
| 3286 | const llvm_isize = try o.lowerType(.isize, .by_value); | 3286 | const llvm_isize = try o.lowerType(.isize, .by_value); |
| 3287 | return self.wip.callIntrinsic(.normal, .none, .@"wasm.memory.grow", &.{llvm_isize}, &.{ | 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,7 +3291,7 @@ fn airWasmMemoryGrow(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Build |
| 3291 | 3291 | ||
| 3292 | fn airRuntimeNavPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3292 | fn airRuntimeNavPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3293 | const o = fg.object; | 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 | const llvm_ptr = try o.lowerNavRef(ty_nav.nav); | 3295 | const llvm_ptr = try o.lowerNavRef(ty_nav.nav); |
| 3296 | return llvm_ptr.toValue(); | 3296 | return llvm_ptr.toValue(); |
| 3297 | } | 3297 | } |
| ... | @@ -3299,7 +3299,7 @@ fn airRuntimeNavPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder. | ... | @@ -3299,7 +3299,7 @@ fn airRuntimeNavPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder. |
| 3299 | fn airMin(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3299 | fn airMin(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3300 | const o = self.object; | 3300 | const o = self.object; |
| 3301 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3303 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3304 | const rhs = try self.resolveInst(bin_op.rhs); | 3304 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3305 | const inst_ty = self.typeOfIndex(inst); | 3305 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3319,7 +3319,7 @@ fn airMin(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | ... | @@ -3319,7 +3319,7 @@ fn airMin(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3319 | fn airMax(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3319 | fn airMax(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3320 | const o = self.object; | 3320 | const o = self.object; |
| 3321 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3323 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3324 | const rhs = try self.resolveInst(bin_op.rhs); | 3324 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3325 | const inst_ty = self.typeOfIndex(inst); | 3325 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3337,7 +3337,7 @@ fn airMax(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | ... | @@ -3337,7 +3337,7 @@ fn airMax(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3337 | } | 3337 | } |
| 3338 | 3338 | ||
| 3339 | fn airSlice(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 3341 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3342 | const ptr = try self.resolveInst(bin_op.lhs); | 3342 | const ptr = try self.resolveInst(bin_op.lhs); |
| 3343 | const len = try self.resolveInst(bin_op.rhs); | 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,7 +3347,7 @@ fn airSlice(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 3347 | 3347 | ||
| 3348 | fn airAdd(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 3348 | fn airAdd(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3349 | const zcu = self.object.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3351 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3352 | const rhs = try self.resolveInst(bin_op.rhs); | 3352 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3353 | const inst_ty = self.typeOfIndex(inst); | 3353 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3366,7 +3366,7 @@ fn airSafeArithmetic( | ... | @@ -3366,7 +3366,7 @@ fn airSafeArithmetic( |
| 3366 | const o = fg.object; | 3366 | const o = fg.object; |
| 3367 | const zcu = o.zcu; | 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 | const lhs = try fg.resolveInst(bin_op.lhs); | 3370 | const lhs = try fg.resolveInst(bin_op.lhs); |
| 3371 | const rhs = try fg.resolveInst(bin_op.rhs); | 3371 | const rhs = try fg.resolveInst(bin_op.rhs); |
| 3372 | const inst_ty = fg.typeOfIndex(inst); | 3372 | const inst_ty = fg.typeOfIndex(inst); |
| ... | @@ -3403,7 +3403,7 @@ fn airSafeArithmetic( | ... | @@ -3403,7 +3403,7 @@ fn airSafeArithmetic( |
| 3403 | } | 3403 | } |
| 3404 | 3404 | ||
| 3405 | fn airAddWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3407 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3408 | const rhs = try self.resolveInst(bin_op.rhs); | 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,7 +3413,7 @@ fn airAddWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 3413 | fn airAddSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3413 | fn airAddSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3414 | const o = self.object; | 3414 | const o = self.object; |
| 3415 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3417 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3418 | const rhs = try self.resolveInst(bin_op.rhs); | 3418 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3419 | const inst_ty = self.typeOfIndex(inst); | 3419 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3431,7 +3431,7 @@ fn airAddSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value | ... | @@ -3431,7 +3431,7 @@ fn airAddSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 3431 | 3431 | ||
| 3432 | fn airSub(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 3432 | fn airSub(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3433 | const zcu = self.object.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3435 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3436 | const rhs = try self.resolveInst(bin_op.rhs); | 3436 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3437 | const inst_ty = self.typeOfIndex(inst); | 3437 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3442,7 +3442,7 @@ fn airSub(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo | ... | @@ -3442,7 +3442,7 @@ fn airSub(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo |
| 3442 | } | 3442 | } |
| 3443 | 3443 | ||
| 3444 | fn airSubWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3446 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3447 | const rhs = try self.resolveInst(bin_op.rhs); | 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,7 +3452,7 @@ fn airSubWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 3452 | fn airSubSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3452 | fn airSubSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3453 | const o = self.object; | 3453 | const o = self.object; |
| 3454 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3456 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3457 | const rhs = try self.resolveInst(bin_op.rhs); | 3457 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3458 | const inst_ty = self.typeOfIndex(inst); | 3458 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3470,7 +3470,7 @@ fn airSubSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value | ... | @@ -3470,7 +3470,7 @@ fn airSubSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 3470 | 3470 | ||
| 3471 | fn airMul(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 3471 | fn airMul(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3472 | const zcu = self.object.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3474 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3475 | const rhs = try self.resolveInst(bin_op.rhs); | 3475 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3476 | const inst_ty = self.typeOfIndex(inst); | 3476 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3481,7 +3481,7 @@ fn airMul(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo | ... | @@ -3481,7 +3481,7 @@ fn airMul(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo |
| 3481 | } | 3481 | } |
| 3482 | 3482 | ||
| 3483 | fn airMulWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3485 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3486 | const rhs = try self.resolveInst(bin_op.rhs); | 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,7 +3491,7 @@ fn airMulWrap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 3491 | fn airMulSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3491 | fn airMulSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3492 | const o = self.object; | 3492 | const o = self.object; |
| 3493 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3495 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3496 | const rhs = try self.resolveInst(bin_op.rhs); | 3496 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3497 | const inst_ty = self.typeOfIndex(inst); | 3497 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3508,7 +3508,7 @@ fn airMulSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value | ... | @@ -3508,7 +3508,7 @@ fn airMulSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 3508 | } | 3508 | } |
| 3509 | 3509 | ||
| 3510 | fn airDivFloat(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3512 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3513 | const rhs = try self.resolveInst(bin_op.rhs); | 3513 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3514 | const inst_ty = self.typeOfIndex(inst); | 3514 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3518,7 +3518,7 @@ fn airDivFloat(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) | ... | @@ -3518,7 +3518,7 @@ fn airDivFloat(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) |
| 3518 | 3518 | ||
| 3519 | fn airDivTrunc(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 3519 | fn airDivTrunc(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3520 | const zcu = self.object.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3522 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3523 | const rhs = try self.resolveInst(bin_op.rhs); | 3523 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3524 | const inst_ty = self.typeOfIndex(inst); | 3524 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3534,7 +3534,7 @@ fn airDivTrunc(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) | ... | @@ -3534,7 +3534,7 @@ fn airDivTrunc(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) |
| 3534 | fn airDivFloor(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 3534 | fn airDivFloor(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3535 | const o = self.object; | 3535 | const o = self.object; |
| 3536 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3538 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3539 | const rhs = try self.resolveInst(bin_op.rhs); | 3539 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3540 | const inst_ty = self.typeOfIndex(inst); | 3540 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3583,7 +3583,7 @@ fn airDivFloor(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) | ... | @@ -3583,7 +3583,7 @@ fn airDivFloor(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) |
| 3583 | fn airDivCeil(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 3583 | fn airDivCeil(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3584 | const o = self.object; | 3584 | const o = self.object; |
| 3585 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3587 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3588 | const rhs = try self.resolveInst(bin_op.rhs); | 3588 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3589 | const inst_ty = self.typeOfIndex(inst); | 3589 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3654,7 +3654,7 @@ fn airDivCeil(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) | ... | @@ -3654,7 +3654,7 @@ fn airDivCeil(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) |
| 3654 | 3654 | ||
| 3655 | fn airDivExact(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 3655 | fn airDivExact(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3656 | const zcu = self.object.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3658 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3659 | const rhs = try self.resolveInst(bin_op.rhs); | 3659 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3660 | const inst_ty = self.typeOfIndex(inst); | 3660 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3671,7 +3671,7 @@ fn airDivExact(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) | ... | @@ -3671,7 +3671,7 @@ fn airDivExact(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) |
| 3671 | 3671 | ||
| 3672 | fn airRem(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 3672 | fn airRem(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3673 | const zcu = self.object.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3675 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3676 | const rhs = try self.resolveInst(bin_op.rhs); | 3676 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3677 | const inst_ty = self.typeOfIndex(inst); | 3677 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3688,7 +3688,7 @@ fn airRem(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo | ... | @@ -3688,7 +3688,7 @@ fn airRem(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo |
| 3688 | fn airMod(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 3688 | fn airMod(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { |
| 3689 | const o = self.object; | 3689 | const o = self.object; |
| 3690 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 3692 | const lhs = try self.resolveInst(bin_op.lhs); |
| 3693 | const rhs = try self.resolveInst(bin_op.rhs); | 3693 | const rhs = try self.resolveInst(bin_op.rhs); |
| 3694 | const inst_ty = self.typeOfIndex(inst); | 3694 | const inst_ty = self.typeOfIndex(inst); |
| ... | @@ -3738,7 +3738,7 @@ fn airMod(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo | ... | @@ -3738,7 +3738,7 @@ fn airMod(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo |
| 3738 | 3738 | ||
| 3739 | fn airPtrAdd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3739 | fn airPtrAdd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3740 | const zcu = self.object.zcu; | 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 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 3742 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3743 | const ptr_or_slice = try self.resolveInst(bin_op.lhs); | 3743 | const ptr_or_slice = try self.resolveInst(bin_op.lhs); |
| 3744 | const index = try self.resolveInst(bin_op.rhs); | 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,7 +3754,7 @@ fn airPtrAdd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 3754 | fn airPtrSub(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 3754 | fn airPtrSub(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 3755 | const o = self.object; | 3755 | const o = self.object; |
| 3756 | const zcu = o.zcu; | 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 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 3758 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3759 | const ptr_or_slice = try self.resolveInst(bin_op.lhs); | 3759 | const ptr_or_slice = try self.resolveInst(bin_op.lhs); |
| 3760 | const llvm_usize_ty = try o.lowerType(.usize, .by_value); | 3760 | const llvm_usize_ty = try o.lowerType(.usize, .by_value); |
| ... | @@ -3778,7 +3778,7 @@ fn airOverflow( | ... | @@ -3778,7 +3778,7 @@ fn airOverflow( |
| 3778 | ) Allocator.Error!Builder.Value { | 3778 | ) Allocator.Error!Builder.Value { |
| 3779 | const o = self.object; | 3779 | const o = self.object; |
| 3780 | const zcu = o.zcu; | 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 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 3782 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3783 | 3783 | ||
| 3784 | const lhs = try self.resolveInst(extra.lhs); | 3784 | const lhs = try self.resolveInst(extra.lhs); |
| ... | @@ -4097,7 +4097,7 @@ fn buildFloatOp( | ... | @@ -4097,7 +4097,7 @@ fn buildFloatOp( |
| 4097 | } | 4097 | } |
| 4098 | 4098 | ||
| 4099 | fn airMulAdd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; | 4101 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 4102 | 4102 | ||
| 4103 | const mulend1 = try self.resolveInst(extra.lhs); | 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,7 +4111,7 @@ fn airMulAdd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 4111 | fn airShlWithOverflow(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 4111 | fn airShlWithOverflow(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4112 | const o = self.object; | 4112 | const o = self.object; |
| 4113 | const zcu = o.zcu; | 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 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 4115 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 4116 | 4116 | ||
| 4117 | const lhs = try self.resolveInst(extra.lhs); | 4117 | const lhs = try self.resolveInst(extra.lhs); |
| ... | @@ -4160,21 +4160,21 @@ fn airShlWithOverflow(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Buil | ... | @@ -4160,21 +4160,21 @@ fn airShlWithOverflow(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Buil |
| 4160 | } | 4160 | } |
| 4161 | 4161 | ||
| 4162 | fn airAnd(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 4164 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4165 | const rhs = try self.resolveInst(bin_op.rhs); | 4165 | const rhs = try self.resolveInst(bin_op.rhs); |
| 4166 | return self.wip.bin(.@"and", lhs, rhs, ""); | 4166 | return self.wip.bin(.@"and", lhs, rhs, ""); |
| 4167 | } | 4167 | } |
| 4168 | 4168 | ||
| 4169 | fn airOr(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 4171 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4172 | const rhs = try self.resolveInst(bin_op.rhs); | 4172 | const rhs = try self.resolveInst(bin_op.rhs); |
| 4173 | return self.wip.bin(.@"or", lhs, rhs, ""); | 4173 | return self.wip.bin(.@"or", lhs, rhs, ""); |
| 4174 | } | 4174 | } |
| 4175 | 4175 | ||
| 4176 | fn airXor(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 4178 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4179 | const rhs = try self.resolveInst(bin_op.rhs); | 4179 | const rhs = try self.resolveInst(bin_op.rhs); |
| 4180 | return self.wip.bin(.xor, lhs, rhs, ""); | 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,7 +4183,7 @@ fn airXor(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4183 | fn airShlExact(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 4183 | fn airShlExact(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4184 | const o = self.object; | 4184 | const o = self.object; |
| 4185 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 4188 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4189 | const rhs = try self.resolveInst(bin_op.rhs); | 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,7 +4206,7 @@ fn airShlExact(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Val |
| 4206 | fn airShl(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 4206 | fn airShl(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4207 | const o = self.object; | 4207 | const o = self.object; |
| 4208 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 4211 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4212 | const rhs = try self.resolveInst(bin_op.rhs); | 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,7 +4224,7 @@ fn airShl(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4224 | fn airShlSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 4224 | fn airShlSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4225 | const o = self.object; | 4225 | const o = self.object; |
| 4226 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 4229 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4230 | const rhs = try self.resolveInst(bin_op.rhs); | 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,7 +4306,7 @@ fn airShlSat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 4306 | fn airShr(self: *FuncGen, inst: Air.Inst.Index, is_exact: bool) Allocator.Error!Builder.Value { | 4306 | fn airShr(self: *FuncGen, inst: Air.Inst.Index, is_exact: bool) Allocator.Error!Builder.Value { |
| 4307 | const o = self.object; | 4307 | const o = self.object; |
| 4308 | const zcu = o.zcu; | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 4311 | const lhs = try self.resolveInst(bin_op.lhs); |
| 4312 | const rhs = try self.resolveInst(bin_op.rhs); | 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,7 +4330,7 @@ fn airShr(self: *FuncGen, inst: Air.Inst.Index, is_exact: bool) Allocator.Error! |
| 4330 | fn airAbs(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 4330 | fn airAbs(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4331 | const o = self.object; | 4331 | const o = self.object; |
| 4332 | const zcu = o.zcu; | 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 | const operand = try self.resolveInst(ty_op.operand); | 4334 | const operand = try self.resolveInst(ty_op.operand); |
| 4335 | const operand_ty = self.typeOf(ty_op.operand); | 4335 | const operand_ty = self.typeOf(ty_op.operand); |
| 4336 | const scalar_ty = operand_ty.scalarType(zcu); | 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,7 +4352,7 @@ fn airAbs(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4352 | fn airIntCast(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Builder.Value { | 4352 | fn airIntCast(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Builder.Value { |
| 4353 | const o = fg.object; | 4353 | const o = fg.object; |
| 4354 | const zcu = o.zcu; | 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 | const dest_ty = fg.typeOfIndex(inst); | 4356 | const dest_ty = fg.typeOfIndex(inst); |
| 4357 | const dest_llvm_ty = try o.lowerType(dest_ty, .by_value); | 4357 | const dest_llvm_ty = try o.lowerType(dest_ty, .by_value); |
| 4358 | const operand = try fg.resolveInst(ty_op.operand); | 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,7 +4459,7 @@ fn airIntCast(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error! |
| 4459 | } | 4459 | } |
| 4460 | 4460 | ||
| 4461 | fn airTrunc(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const operand = try self.resolveInst(ty_op.operand); | 4463 | const operand = try self.resolveInst(ty_op.operand); |
| 4464 | const dest_llvm_ty = try self.object.lowerType(self.typeOfIndex(inst), .by_value); | 4464 | const dest_llvm_ty = try self.object.lowerType(self.typeOfIndex(inst), .by_value); |
| 4465 | return self.wip.cast(.trunc, operand, dest_llvm_ty, ""); | 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,7 +4468,7 @@ fn airTrunc(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 4468 | fn airFptrunc(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 4468 | fn airFptrunc(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4469 | const o = self.object; | 4469 | const o = self.object; |
| 4470 | const zcu = o.zcu; | 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 | const operand = try self.resolveInst(ty_op.operand); | 4472 | const operand = try self.resolveInst(ty_op.operand); |
| 4473 | const operand_ty = self.typeOf(ty_op.operand); | 4473 | const operand_ty = self.typeOf(ty_op.operand); |
| 4474 | const dest_ty = self.typeOfIndex(inst); | 4474 | const dest_ty = self.typeOfIndex(inst); |
| ... | @@ -4502,7 +4502,7 @@ fn airFptrunc(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu | ... | @@ -4502,7 +4502,7 @@ fn airFptrunc(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 4502 | fn airFpext(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 4502 | fn airFpext(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4503 | const o = self.object; | 4503 | const o = self.object; |
| 4504 | const zcu = o.zcu; | 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 | const operand = try self.resolveInst(ty_op.operand); | 4506 | const operand = try self.resolveInst(ty_op.operand); |
| 4507 | const operand_ty = self.typeOf(ty_op.operand); | 4507 | const operand_ty = self.typeOf(ty_op.operand); |
| 4508 | const dest_ty = self.typeOfIndex(inst); | 4508 | const dest_ty = self.typeOfIndex(inst); |
| ... | @@ -4543,7 +4543,7 @@ fn airBitCast(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error! | ... | @@ -4543,7 +4543,7 @@ fn airBitCast(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error! |
| 4543 | const o = fg.object; | 4543 | const o = fg.object; |
| 4544 | const zcu = o.zcu; | 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 | const operand_ty = fg.typeOf(ty_op.operand); | 4547 | const operand_ty = fg.typeOf(ty_op.operand); |
| 4548 | const dest_ty = fg.typeOfIndex(inst); | 4548 | const dest_ty = fg.typeOfIndex(inst); |
| 4549 | const operand = try fg.resolveInst(ty_op.operand); | 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,7 +4588,7 @@ fn airBitCast(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error! |
| 4588 | 4588 | ||
| 4589 | fn airNopCast(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 4589 | fn airNopCast(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4590 | const zcu = fg.object.zcu; | 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 | const operand_ty = fg.typeOf(ty_op.operand); | 4592 | const operand_ty = fg.typeOf(ty_op.operand); |
| 4593 | const dest_ty = fg.typeOfIndex(inst); | 4593 | const dest_ty = fg.typeOfIndex(inst); |
| 4594 | assert(isByRef(operand_ty, zcu) == isByRef(dest_ty, zcu)); | 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,7 +4599,7 @@ fn airNopCast(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 4599 | fn airPtrFromInt(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 4599 | fn airPtrFromInt(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4600 | const o = fg.object; | 4600 | const o = fg.object; |
| 4601 | const zcu = o.zcu; | 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 | const operand_ty = fg.typeOf(ty_op.operand); | 4603 | const operand_ty = fg.typeOf(ty_op.operand); |
| 4604 | const dest_ty = fg.typeOfIndex(inst); | 4604 | const dest_ty = fg.typeOfIndex(inst); |
| 4605 | assert(operand_ty.scalarType(zcu).toIntern() == .usize_type); | 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,7 +4613,7 @@ fn airPtrFromInt(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Val |
| 4613 | fn airIntFromPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 4613 | fn airIntFromPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4614 | const o = fg.object; | 4614 | const o = fg.object; |
| 4615 | const zcu = o.zcu; | 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 | const operand_ty = fg.typeOf(ty_op.operand); | 4617 | const operand_ty = fg.typeOf(ty_op.operand); |
| 4618 | const dest_ty = fg.typeOfIndex(inst); | 4618 | const dest_ty = fg.typeOfIndex(inst); |
| 4619 | assert(operand_ty.scalarType(zcu).isPtrAtRuntime(zcu)); | 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,7 +4625,7 @@ fn airIntFromPtr(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Val |
| 4625 | } | 4625 | } |
| 4626 | 4626 | ||
| 4627 | fn airUnionFromEnum(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const enum_ty = fg.typeOf(ty_op.operand); | 4629 | const enum_ty = fg.typeOf(ty_op.operand); |
| 4630 | const union_ty = fg.typeOfIndex(inst); | 4630 | const union_ty = fg.typeOfIndex(inst); |
| 4631 | const enum_val = try fg.resolveInst(ty_op.operand); | 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,7 +4652,7 @@ fn airArg(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4652 | 4652 | ||
| 4653 | const mod = file.mod.?; | 4653 | const mod = file.mod.?; |
| 4654 | if (mod.strip) return arg_val; | 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 | const zir = &file.zir.?; | 4656 | const zir = &file.zir.?; |
| 4657 | const name = zir.nullTerminatedString(zir.getParamName(zir.getParamBody(func_zir.inst)[arg.zir_param_index]).?); | 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,7 +4791,7 @@ fn buildAlloca( |
| 4791 | fn airStore(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Builder.Value { | 4791 | fn airStore(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Builder.Value { |
| 4792 | const o = fg.object; | 4792 | const o = fg.object; |
| 4793 | const zcu = o.zcu; | 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 | const ptr = try fg.resolveInst(bin_op.lhs); | 4795 | const ptr = try fg.resolveInst(bin_op.lhs); |
| 4796 | const ptr_ty = fg.typeOf(bin_op.lhs); | 4796 | const ptr_ty = fg.typeOf(bin_op.lhs); |
| 4797 | const ptr_info = ptr_ty.ptrInfo(zcu); | 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,7 +4914,7 @@ fn airStore(fg: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Bu |
| 4914 | fn airLoad(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 4914 | fn airLoad(fg: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 4915 | const o = fg.object; | 4915 | const o = fg.object; |
| 4916 | const zcu = o.zcu; | 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 | const ptr_ty = fg.typeOf(ty_op.operand); | 4918 | const ptr_ty = fg.typeOf(ty_op.operand); |
| 4919 | const ptr_info = ptr_ty.ptrInfo(zcu); | 4919 | const ptr_info = ptr_ty.ptrInfo(zcu); |
| 4920 | const ptr = try fg.resolveInst(ty_op.operand); | 4920 | const ptr = try fg.resolveInst(ty_op.operand); |
| ... | @@ -5024,7 +5024,7 @@ fn airCmpxchg( | ... | @@ -5024,7 +5024,7 @@ fn airCmpxchg( |
| 5024 | ) Allocator.Error!Builder.Value { | 5024 | ) Allocator.Error!Builder.Value { |
| 5025 | const o = self.object; | 5025 | const o = self.object; |
| 5026 | const zcu = o.zcu; | 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 | const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data; | 5028 | const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 5029 | const ptr = try self.resolveInst(extra.ptr); | 5029 | const ptr = try self.resolveInst(extra.ptr); |
| 5030 | const ptr_ty = self.typeOf(extra.ptr); | 5030 | const ptr_ty = self.typeOf(extra.ptr); |
| ... | @@ -5090,7 +5090,7 @@ fn airCmpxchg( | ... | @@ -5090,7 +5090,7 @@ fn airCmpxchg( |
| 5090 | fn airAtomicRmw(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 5090 | fn airAtomicRmw(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5091 | const o = self.object; | 5091 | const o = self.object; |
| 5092 | const zcu = o.zcu; | 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 | const extra = self.air.extraData(Air.AtomicRmw, pl_op.payload).data; | 5094 | const extra = self.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 5095 | const ptr = try self.resolveInst(pl_op.operand); | 5095 | const ptr = try self.resolveInst(pl_op.operand); |
| 5096 | const ptr_ty = self.typeOf(pl_op.operand); | 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,7 +5155,7 @@ fn airAtomicRmw(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 5155 | fn airAtomicLoad(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 5155 | fn airAtomicLoad(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5156 | const o = self.object; | 5156 | const o = self.object; |
| 5157 | const zcu = o.zcu; | 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 | const ptr = try self.resolveInst(atomic_load.ptr); | 5159 | const ptr = try self.resolveInst(atomic_load.ptr); |
| 5160 | const ptr_ty = self.typeOf(atomic_load.ptr); | 5160 | const ptr_ty = self.typeOf(atomic_load.ptr); |
| 5161 | const info = ptr_ty.ptrInfo(zcu); | 5161 | const info = ptr_ty.ptrInfo(zcu); |
| ... | @@ -5203,7 +5203,7 @@ fn airAtomicStore( | ... | @@ -5203,7 +5203,7 @@ fn airAtomicStore( |
| 5203 | ordering: Builder.AtomicOrdering, | 5203 | ordering: Builder.AtomicOrdering, |
| 5204 | ) Allocator.Error!Builder.Value { | 5204 | ) Allocator.Error!Builder.Value { |
| 5205 | const zcu = self.object.zcu; | 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 | const ptr_ty = self.typeOf(bin_op.lhs); | 5207 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 5208 | const operand_ty = ptr_ty.childType(zcu); | 5208 | const operand_ty = ptr_ty.childType(zcu); |
| 5209 | if (!operand_ty.hasRuntimeBits(zcu)) return .none; | 5209 | if (!operand_ty.hasRuntimeBits(zcu)) return .none; |
| ... | @@ -5240,7 +5240,7 @@ fn airAtomicStore( | ... | @@ -5240,7 +5240,7 @@ fn airAtomicStore( |
| 5240 | fn airMemset(self: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Builder.Value { | 5240 | fn airMemset(self: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error!Builder.Value { |
| 5241 | const o = self.object; | 5241 | const o = self.object; |
| 5242 | const zcu = o.zcu; | 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 | const dest_slice = try self.resolveInst(bin_op.lhs); | 5244 | const dest_slice = try self.resolveInst(bin_op.lhs); |
| 5245 | const ptr_ty = self.typeOf(bin_op.lhs); | 5245 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 5246 | const elem_ty = self.typeOf(bin_op.rhs); | 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,7 +5389,7 @@ fn airMemset(self: *FuncGen, inst: Air.Inst.Index, safety: bool) Allocator.Error |
| 5389 | 5389 | ||
| 5390 | fn airMemcpy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 5390 | fn airMemcpy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5391 | const zcu = self.object.zcu; | 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 | const dest_slice = try self.resolveInst(bin_op.lhs); | 5393 | const dest_slice = try self.resolveInst(bin_op.lhs); |
| 5394 | const dest_ptr_ty = self.typeOf(bin_op.lhs); | 5394 | const dest_ptr_ty = self.typeOf(bin_op.lhs); |
| 5395 | const src_slice = try self.resolveInst(bin_op.rhs); | 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,7 +5417,7 @@ fn airMemcpy(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value |
| 5417 | 5417 | ||
| 5418 | fn airMemmove(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 5418 | fn airMemmove(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5419 | const zcu = self.object.zcu; | 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 | const dest_slice = try self.resolveInst(bin_op.lhs); | 5421 | const dest_slice = try self.resolveInst(bin_op.lhs); |
| 5422 | const dest_ptr_ty = self.typeOf(bin_op.lhs); | 5422 | const dest_ptr_ty = self.typeOf(bin_op.lhs); |
| 5423 | const src_slice = try self.resolveInst(bin_op.rhs); | 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,7 +5441,7 @@ fn airMemmove(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 5441 | 5441 | ||
| 5442 | fn airSetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 5442 | fn airSetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5443 | const zcu = self.object.zcu; | 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 | const un_ptr_ty = self.typeOf(bin_op.lhs); | 5445 | const un_ptr_ty = self.typeOf(bin_op.lhs); |
| 5446 | const un_ty = un_ptr_ty.childType(zcu); | 5446 | const un_ty = un_ptr_ty.childType(zcu); |
| 5447 | const layout = un_ty.unionGetLayout(zcu); | 5447 | const layout = un_ty.unionGetLayout(zcu); |
| ... | @@ -5466,7 +5466,7 @@ fn airSetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder. | ... | @@ -5466,7 +5466,7 @@ fn airSetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder. |
| 5466 | fn airGetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 5466 | fn airGetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5467 | const o = self.object; | 5467 | const o = self.object; |
| 5468 | const zcu = o.zcu; | 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 | const un_ty = self.typeOf(ty_op.operand); | 5470 | const un_ty = self.typeOf(ty_op.operand); |
| 5471 | const layout = un_ty.unionGetLayout(zcu); | 5471 | const layout = un_ty.unionGetLayout(zcu); |
| 5472 | assert(layout.tag_size != 0); | 5472 | assert(layout.tag_size != 0); |
| ... | @@ -5477,7 +5477,7 @@ fn airGetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder. | ... | @@ -5477,7 +5477,7 @@ fn airGetUnionTag(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder. |
| 5477 | } | 5477 | } |
| 5478 | 5478 | ||
| 5479 | fn airUnaryOp(self: *FuncGen, inst: Air.Inst.Index, comptime op: FloatOp) Allocator.Error!Builder.Value { | 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 | const operand = try self.resolveInst(un_op); | 5481 | const operand = try self.resolveInst(un_op); |
| 5482 | const operand_ty = self.typeOf(un_op); | 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,7 +5485,7 @@ fn airUnaryOp(self: *FuncGen, inst: Air.Inst.Index, comptime op: FloatOp) Alloca |
| 5485 | } | 5485 | } |
| 5486 | 5486 | ||
| 5487 | fn airNeg(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allocator.Error!Builder.Value { | 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 | const operand = try self.resolveInst(un_op); | 5489 | const operand = try self.resolveInst(un_op); |
| 5490 | const operand_ty = self.typeOf(un_op); | 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,7 +5494,7 @@ fn airNeg(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) Allo |
| 5494 | 5494 | ||
| 5495 | fn airClzCtz(self: *FuncGen, inst: Air.Inst.Index, intrinsic: Builder.Intrinsic) Allocator.Error!Builder.Value { | 5495 | fn airClzCtz(self: *FuncGen, inst: Air.Inst.Index, intrinsic: Builder.Intrinsic) Allocator.Error!Builder.Value { |
| 5496 | const o = self.object; | 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 | const inst_ty = self.typeOfIndex(inst); | 5498 | const inst_ty = self.typeOfIndex(inst); |
| 5499 | const operand_ty = self.typeOf(ty_op.operand); | 5499 | const operand_ty = self.typeOf(ty_op.operand); |
| 5500 | const operand = try self.resolveInst(ty_op.operand); | 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,7 +5512,7 @@ fn airClzCtz(self: *FuncGen, inst: Air.Inst.Index, intrinsic: Builder.Intrinsic) |
| 5512 | 5512 | ||
| 5513 | fn airBitOp(self: *FuncGen, inst: Air.Inst.Index, intrinsic: Builder.Intrinsic) Allocator.Error!Builder.Value { | 5513 | fn airBitOp(self: *FuncGen, inst: Air.Inst.Index, intrinsic: Builder.Intrinsic) Allocator.Error!Builder.Value { |
| 5514 | const o = self.object; | 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 | const inst_ty = self.typeOfIndex(inst); | 5516 | const inst_ty = self.typeOfIndex(inst); |
| 5517 | const operand_ty = self.typeOf(ty_op.operand); | 5517 | const operand_ty = self.typeOf(ty_op.operand); |
| 5518 | const operand = try self.resolveInst(ty_op.operand); | 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,7 +5531,7 @@ fn airBitOp(self: *FuncGen, inst: Air.Inst.Index, intrinsic: Builder.Intrinsic) |
| 5531 | fn airByteSwap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 5531 | fn airByteSwap(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5532 | const o = self.object; | 5532 | const o = self.object; |
| 5533 | const zcu = o.zcu; | 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 | const operand_ty = self.typeOf(ty_op.operand); | 5535 | const operand_ty = self.typeOf(ty_op.operand); |
| 5536 | var bits = operand_ty.intInfo(zcu).bits; | 5536 | var bits = operand_ty.intInfo(zcu).bits; |
| 5537 | assert(bits % 8 == 0); | 5537 | assert(bits % 8 == 0); |
| ... | @@ -5566,7 +5566,7 @@ fn airErrorSetHasValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui | ... | @@ -5566,7 +5566,7 @@ fn airErrorSetHasValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui |
| 5566 | const o = self.object; | 5566 | const o = self.object; |
| 5567 | const zcu = o.zcu; | 5567 | const zcu = o.zcu; |
| 5568 | const ip = &zcu.intern_pool; | 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 | const operand = try self.resolveInst(ty_op.operand); | 5570 | const operand = try self.resolveInst(ty_op.operand); |
| 5571 | const error_set_ty = ty_op.ty.toType(); | 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,7 +5596,7 @@ fn airErrorSetHasValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui |
| 5596 | 5596 | ||
| 5597 | fn airIsNamedEnumValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 5597 | fn airIsNamedEnumValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5598 | const o = self.object; | 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 | const operand = try self.resolveInst(un_op); | 5600 | const operand = try self.resolveInst(un_op); |
| 5601 | const enum_ty = self.typeOf(un_op); | 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,7 +5614,7 @@ fn airIsNamedEnumValue(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Bui |
| 5614 | 5614 | ||
| 5615 | fn airTagName(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 5615 | fn airTagName(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5616 | const o = self.object; | 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 | const operand = try self.resolveInst(un_op); | 5618 | const operand = try self.resolveInst(un_op); |
| 5619 | const enum_ty = self.typeOf(un_op); | 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,7 +5633,7 @@ fn airTagName(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Valu |
| 5633 | fn airErrorName(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 5633 | fn airErrorName(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 5634 | const o = self.object; | 5634 | const o = self.object; |
| 5635 | const zcu = o.zcu; | 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 | const operand = try self.resolveInst(un_op); | 5637 | const operand = try self.resolveInst(un_op); |
| 5638 | const slice_ty = self.typeOfIndex(inst); | 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,14 +5646,14 @@ fn airErrorName(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 5646 | } | 5646 | } |
| 5647 | 5647 | ||
| 5648 | fn airSplat(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const scalar = try self.resolveInst(ty_op.operand); | 5650 | const scalar = try self.resolveInst(ty_op.operand); |
| 5651 | const vector_ty = self.typeOfIndex(inst); | 5651 | const vector_ty = self.typeOfIndex(inst); |
| 5652 | return self.wip.splatVector(try self.object.lowerType(vector_ty, .by_value), scalar, ""); | 5652 | return self.wip.splatVector(try self.object.lowerType(vector_ty, .by_value), scalar, ""); |
| 5653 | } | 5653 | } |
| 5654 | 5654 | ||
| 5655 | fn airSelect(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; | 5657 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 5658 | const pred = try self.resolveInst(pl_op.operand); | 5658 | const pred = try self.resolveInst(pl_op.operand); |
| 5659 | const a = try self.resolveInst(extra.lhs); | 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,7 +5921,7 @@ fn airReduce(self: *FuncGen, inst: Air.Inst.Index, fast: Builder.FastMathKind) A |
| 5921 | const zcu = o.zcu; | 5921 | const zcu = o.zcu; |
| 5922 | const target = zcu.getTarget(); | 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 | const operand = try self.resolveInst(reduce.operand); | 5925 | const operand = try self.resolveInst(reduce.operand); |
| 5926 | const operand_ty = self.typeOf(reduce.operand); | 5926 | const operand_ty = self.typeOf(reduce.operand); |
| 5927 | const llvm_operand_ty = try o.lowerType(operand_ty, .by_value); | 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,7 +6029,7 @@ fn airAggregateInit(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builde |
| 6029 | const o = self.object; | 6029 | const o = self.object; |
| 6030 | const zcu = o.zcu; | 6030 | const zcu = o.zcu; |
| 6031 | const ip = &zcu.intern_pool; | 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 | const result_ty = self.typeOfIndex(inst); | 6033 | const result_ty = self.typeOfIndex(inst); |
| 6034 | const len: usize = @intCast(result_ty.arrayLen(zcu)); | 6034 | const len: usize = @intCast(result_ty.arrayLen(zcu)); |
| 6035 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra.items[ty_pl.payload..][0..len]); | 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,7 +6126,7 @@ fn airUnionInit(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 6126 | const o = self.object; | 6126 | const o = self.object; |
| 6127 | const zcu = o.zcu; | 6127 | const zcu = o.zcu; |
| 6128 | const ip = &zcu.intern_pool; | 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 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; | 6130 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 6131 | const union_ty = self.typeOfIndex(inst); | 6131 | const union_ty = self.typeOfIndex(inst); |
| 6132 | const union_obj = zcu.typeToUnion(union_ty).?; | 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,16 +6167,16 @@ fn airUnionInit(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Va |
| 6167 | 6167 | ||
| 6168 | fn airPrefetch(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 6168 | fn airPrefetch(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 6169 | const o = self.object; | 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); | 6172 | comptime assert(@backingInt(std.lang.PrefetchOptions.Rw.read) == 0); |
| 6173 | comptime assert(@intFromEnum(std.lang.PrefetchOptions.Rw.write) == 1); | 6173 | comptime assert(@backingInt(std.lang.PrefetchOptions.Rw.write) == 1); |
| 6174 | 6174 | ||
| 6175 | comptime assert(prefetch.locality >= 0); | 6175 | comptime assert(prefetch.locality >= 0); |
| 6176 | comptime assert(prefetch.locality <= 3); | 6176 | comptime assert(prefetch.locality <= 3); |
| 6177 | 6177 | ||
| 6178 | comptime assert(@intFromEnum(std.lang.PrefetchOptions.Cache.instruction) == 0); | 6178 | comptime assert(@backingInt(std.lang.PrefetchOptions.Cache.instruction) == 0); |
| 6179 | comptime assert(@intFromEnum(std.lang.PrefetchOptions.Cache.data) == 1); | 6179 | comptime assert(@backingInt(std.lang.PrefetchOptions.Cache.data) == 1); |
| 6180 | 6180 | ||
| 6181 | // LLVM fails during codegen of instruction cache prefetchs for these architectures. | 6181 | // LLVM fails during codegen of instruction cache prefetchs for these architectures. |
| 6182 | // This is an LLVM bug as the prefetch intrinsic should be a noop if not supported | 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,7 +6215,7 @@ fn airPrefetch(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Val |
| 6215 | } | 6215 | } |
| 6216 | 6216 | ||
| 6217 | fn airAddrSpaceCast(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 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 | const inst_ty = self.typeOfIndex(inst); | 6219 | const inst_ty = self.typeOfIndex(inst); |
| 6220 | const operand = try self.resolveInst(ty_op.operand); | 6220 | const operand = try self.resolveInst(ty_op.operand); |
| 6221 | return self.wip.cast(.addrspacecast, operand, try self.object.lowerType(inst_ty, .by_value), ""); | 6221 | return self.wip.cast(.addrspacecast, operand, try self.object.lowerType(inst_ty, .by_value), ""); |
| ... | @@ -6238,7 +6238,7 @@ fn workIntrinsic( | ... | @@ -6238,7 +6238,7 @@ fn workIntrinsic( |
| 6238 | fn airWorkItemId(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 6238 | fn airWorkItemId(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 6239 | const target = self.object.zcu.getTarget(); | 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 | const dimension = pl_op.payload; | 6242 | const dimension = pl_op.payload; |
| 6243 | 6243 | ||
| 6244 | return switch (target.cpu.arch) { | 6244 | return switch (target.cpu.arch) { |
| ... | @@ -6251,7 +6251,7 @@ fn airWorkItemId(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.V | ... | @@ -6251,7 +6251,7 @@ fn airWorkItemId(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.V |
| 6251 | fn airWorkGroupSize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 6251 | fn airWorkGroupSize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 6252 | const target = self.object.zcu.getTarget(); | 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 | const dimension = pl_op.payload; | 6255 | const dimension = pl_op.payload; |
| 6256 | 6256 | ||
| 6257 | switch (target.cpu.arch) { | 6257 | switch (target.cpu.arch) { |
| ... | @@ -6278,7 +6278,7 @@ fn airWorkGroupSize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builde | ... | @@ -6278,7 +6278,7 @@ fn airWorkGroupSize(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builde |
| 6278 | fn airWorkGroupId(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { | 6278 | fn airWorkGroupId(self: *FuncGen, inst: Air.Inst.Index) Allocator.Error!Builder.Value { |
| 6279 | const target = self.object.zcu.getTarget(); | 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 | const dimension = pl_op.payload; | 6282 | const dimension = pl_op.payload; |
| 6283 | 6283 | ||
| 6284 | return switch (target.cpu.arch) { | 6284 | return switch (target.cpu.arch) { |
src/codegen/llvm/bindings.zig+1-1| ... | @@ -5,7 +5,7 @@ pub const Bool = enum(c_int) { | ... | @@ -5,7 +5,7 @@ pub const Bool = enum(c_int) { |
| 5 | _, | 5 | _, |
| 6 | 6 | ||
| 7 | pub fn fromBool(b: bool) Bool { | 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 | pub fn toBool(b: Bool) bool { | 11 | pub fn toBool(b: Bool) bool { |
src/codegen/riscv64/CodeGen.zig+130-130| ... | @@ -798,11 +798,11 @@ pub fn generate( | ... | @@ -798,11 +798,11 @@ pub fn generate( |
| 798 | 798 | ||
| 799 | try function.frame_allocs.resize(gpa, FrameIndex.named_count); | 799 | try function.frame_allocs.resize(gpa, FrameIndex.named_count); |
| 800 | function.frame_allocs.set( | 800 | function.frame_allocs.set( |
| 801 | @intFromEnum(FrameIndex.stack_frame), | 801 | @backingInt(FrameIndex.stack_frame), |
| 802 | FrameAlloc.init(.{ .size = 0, .alignment = .@"1" }), | 802 | FrameAlloc.init(.{ .size = 0, .alignment = .@"1" }), |
| 803 | ); | 803 | ); |
| 804 | function.frame_allocs.set( | 804 | function.frame_allocs.set( |
| 805 | @intFromEnum(FrameIndex.call_frame), | 805 | @backingInt(FrameIndex.call_frame), |
| 806 | FrameAlloc.init(.{ .size = 0, .alignment = .@"1" }), | 806 | FrameAlloc.init(.{ .size = 0, .alignment = .@"1" }), |
| 807 | ); | 807 | ); |
| 808 | 808 | ||
| ... | @@ -813,22 +813,22 @@ pub fn generate( | ... | @@ -813,22 +813,22 @@ pub fn generate( |
| 813 | 813 | ||
| 814 | function.args = call_info.args; | 814 | function.args = call_info.args; |
| 815 | function.ret_mcv = call_info.return_value; | 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 | .size = Type.u64.abiSize(zcu), | 817 | .size = Type.u64.abiSize(zcu), |
| 818 | .alignment = Type.u64.abiAlignment(zcu).min(call_info.stack_align), | 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 | .size = Type.u64.abiSize(zcu), | 821 | .size = Type.u64.abiSize(zcu), |
| 822 | .alignment = Alignment.min( | 822 | .alignment = Alignment.min( |
| 823 | call_info.stack_align, | 823 | call_info.stack_align, |
| 824 | Alignment.fromNonzeroByteUnits(function.target.stackAlignment()), | 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 | .size = call_info.stack_byte_count, | 828 | .size = call_info.stack_byte_count, |
| 829 | .alignment = call_info.stack_align, | 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 | .size = 0, | 832 | .size = 0, |
| 833 | .alignment = Type.u64.abiAlignment(zcu), | 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,7 +1080,7 @@ fn setVl(func: *Func, dst_reg: Register, avl: u64, options: bits.VType) !void { |
| 1080 | .data = .{ | 1080 | .data = .{ |
| 1081 | .i_type = .{ | 1081 | .i_type = .{ |
| 1082 | .rd = dst_reg, | 1082 | .rd = dst_reg, |
| 1083 | .rs1 = @enumFromInt(avl), | 1083 | .rs1 = @fromBackingInt(@intCast(avl)), |
| 1084 | .imm12 = Immediate.u(options_int), | 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,7 +1297,7 @@ fn genLazy(func: *Func, lazy_sym: link.File.LazySymbol) InnerError!void { |
| 1297 | }) catch |err| | 1297 | }) catch |err| |
| 1298 | return func.fail("{s} creating lazy symbol", .{@errorName(err)}); | 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 | const cmp_reg, const cmp_lock = try func.allocReg(.int); | 1302 | const cmp_reg, const cmp_lock = try func.allocReg(.int); |
| 1303 | defer func.register_manager.unlockReg(cmp_lock); | 1303 | defer func.register_manager.unlockReg(cmp_lock); |
| ... | @@ -1381,7 +1381,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -1381,7 +1381,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { |
| 1381 | 1381 | ||
| 1382 | func.reused_operands = @TypeOf(func.reused_operands).empty; | 1382 | func.reused_operands = @TypeOf(func.reused_operands).empty; |
| 1383 | try func.inst_tracking.ensureUnusedCapacity(func.gpa, 1); | 1383 | try func.inst_tracking.ensureUnusedCapacity(func.gpa, 1); |
| 1384 | const tag = air_tags[@intFromEnum(inst)]; | 1384 | const tag = air_tags[@backingInt(inst)]; |
| 1385 | switch (tag) { | 1385 | switch (tag) { |
| 1386 | // zig fmt: off | 1386 | // zig fmt: off |
| 1387 | 1387 | ||
| ... | @@ -1661,7 +1661,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -1661,7 +1661,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { |
| 1661 | 1661 | ||
| 1662 | if (std.debug.runtime_safety) { | 1662 | if (std.debug.runtime_safety) { |
| 1663 | if (func.air_bookkeeping < old_air_bookkeeping + 1) { | 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 | { // check consistency of tracked registers | 1667 | { // check consistency of tracked registers |
| ... | @@ -1768,7 +1768,7 @@ fn setFrameLoc( | ... | @@ -1768,7 +1768,7 @@ fn setFrameLoc( |
| 1768 | offset: *i32, | 1768 | offset: *i32, |
| 1769 | comptime aligned: bool, | 1769 | comptime aligned: bool, |
| 1770 | ) void { | 1770 | ) void { |
| 1771 | const frame_i = @intFromEnum(frame_index); | 1771 | const frame_i = @backingInt(frame_index); |
| 1772 | if (aligned) { | 1772 | if (aligned) { |
| 1773 | const alignment: InternPool.Alignment = func.frame_allocs.items(.abi_align)[frame_i]; | 1773 | const alignment: InternPool.Alignment = func.frame_allocs.items(.abi_align)[frame_i]; |
| 1774 | offset.* = math.sign(offset.*) * @as(i32, @intCast(alignment.backward(@intCast(@abs(offset.*))))); | 1774 | offset.* = math.sign(offset.*) * @as(i32, @intCast(alignment.backward(@intCast(@abs(offset.*))))); |
| ... | @@ -1787,13 +1787,13 @@ fn computeFrameLayout(func: *Func) !FrameLayout { | ... | @@ -1787,13 +1787,13 @@ fn computeFrameLayout(func: *Func) !FrameLayout { |
| 1787 | const frame_align = func.frame_allocs.items(.abi_align); | 1787 | const frame_align = func.frame_allocs.items(.abi_align); |
| 1788 | 1788 | ||
| 1789 | for (stack_frame_order, FrameIndex.named_count..) |*frame_order, frame_index| | 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 | const SortContext = struct { | 1793 | const SortContext = struct { |
| 1794 | frame_align: @TypeOf(frame_align), | 1794 | frame_align: @TypeOf(frame_align), |
| 1795 | pub fn lessThan(context: @This(), lhs: FrameIndex, rhs: FrameIndex) bool { | 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 | const sort_context = SortContext{ .frame_align = frame_align }; | 1799 | const sort_context = SortContext{ .frame_align = frame_align }; |
| ... | @@ -1810,38 +1810,38 @@ fn computeFrameLayout(func: *Func) !FrameLayout { | ... | @@ -1810,38 +1810,38 @@ fn computeFrameLayout(func: *Func) !FrameLayout { |
| 1810 | const total_alloc_size: i32 = blk: { | 1810 | const total_alloc_size: i32 = blk: { |
| 1811 | var i: i32 = 0; | 1811 | var i: i32 = 0; |
| 1812 | for (stack_frame_order) |frame_index| { | 1812 | for (stack_frame_order) |frame_index| { |
| 1813 | i += frame_size[@intFromEnum(frame_index)]; | 1813 | i += frame_size[@backingInt(frame_index)]; |
| 1814 | } | 1814 | } |
| 1815 | break :blk i; | 1815 | break :blk i; |
| 1816 | }; | 1816 | }; |
| 1817 | 1817 | ||
| 1818 | const saved_reg_size = save_reg_list.size(); | 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 | // The total frame size is calculated by the amount of s registers you need to save * 8, as each | 1821 | // The total frame size is calculated by the amount of s registers you need to save * 8, as each |
| 1822 | // register is 8 bytes, the total allocation sizes, and 16 more register for the spilled ra and s0 | 1822 | // register is 8 bytes, the total allocation sizes, and 16 more register for the spilled ra and s0 |
| 1823 | // register. Finally we align the frame size to the alignment of the base pointer. | 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)]; | 1824 | const args_frame_size = frame_size[@backingInt(FrameIndex.args_frame)]; |
| 1825 | const spill_frame_size = frame_size[@intFromEnum(FrameIndex.spill_frame)]; | 1825 | const spill_frame_size = frame_size[@backingInt(FrameIndex.spill_frame)]; |
| 1826 | const call_frame_size = frame_size[@intFromEnum(FrameIndex.call_frame)]; | 1826 | const call_frame_size = frame_size[@backingInt(FrameIndex.call_frame)]; |
| 1827 | 1827 | ||
| 1828 | // TODO: this 64 should be a 16, but we were clobbering the top and bottom of the frame. | 1828 | // TODO: this 64 should be a 16, but we were clobbering the top and bottom of the frame. |
| 1829 | // maybe everything can go from the bottom? | 1829 | // maybe everything can go from the bottom? |
| 1830 | const acc_frame_size: i32 = std.mem.alignForward( | 1830 | const acc_frame_size: i32 = std.mem.alignForward( |
| 1831 | i32, | 1831 | i32, |
| 1832 | total_alloc_size + 64 + args_frame_size + spill_frame_size + call_frame_size, | 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 | log.debug("frame size: {d}", .{acc_frame_size}); | 1835 | log.debug("frame size: {d}", .{acc_frame_size}); |
| 1836 | 1836 | ||
| 1837 | // store the ra at total_size - 8, so it's the very first thing in the stack | 1837 | // store the ra at total_size - 8, so it's the very first thing in the stack |
| 1838 | // relative to the fp | 1838 | // relative to the fp |
| 1839 | func.frame_locs.set( | 1839 | func.frame_locs.set( |
| 1840 | @intFromEnum(FrameIndex.ret_addr), | 1840 | @backingInt(FrameIndex.ret_addr), |
| 1841 | .{ .base = .sp, .disp = acc_frame_size - 8 }, | 1841 | .{ .base = .sp, .disp = acc_frame_size - 8 }, |
| 1842 | ); | 1842 | ); |
| 1843 | func.frame_locs.set( | 1843 | func.frame_locs.set( |
| 1844 | @intFromEnum(FrameIndex.base_ptr), | 1844 | @backingInt(FrameIndex.base_ptr), |
| 1845 | .{ .base = .sp, .disp = acc_frame_size - 16 }, | 1845 | .{ .base = .sp, .disp = acc_frame_size - 16 }, |
| 1846 | ); | 1846 | ); |
| 1847 | 1847 | ||
| ... | @@ -1983,19 +1983,19 @@ fn allocFrameIndex(func: *Func, alloc: FrameAlloc) !FrameIndex { | ... | @@ -1983,19 +1983,19 @@ fn allocFrameIndex(func: *Func, alloc: FrameAlloc) !FrameIndex { |
| 1983 | const frame_size = frame_allocs_slice.items(.abi_size); | 1983 | const frame_size = frame_allocs_slice.items(.abi_size); |
| 1984 | const frame_align = frame_allocs_slice.items(.abi_align); | 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 | stack_frame_align.* = stack_frame_align.max(alloc.abi_align); | 1987 | stack_frame_align.* = stack_frame_align.max(alloc.abi_align); |
| 1988 | 1988 | ||
| 1989 | for (func.free_frame_indices.keys(), 0..) |frame_index, free_i| { | 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 | if (abi_size != alloc.abi_size) continue; | 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 | abi_align.* = abi_align.max(alloc.abi_align); | 1993 | abi_align.* = abi_align.max(alloc.abi_align); |
| 1994 | 1994 | ||
| 1995 | _ = func.free_frame_indices.swapRemoveAt(free_i); | 1995 | _ = func.free_frame_indices.swapRemoveAt(free_i); |
| 1996 | return frame_index; | 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 | try func.frame_allocs.append(func.gpa, alloc); | 1999 | try func.frame_allocs.append(func.gpa, alloc); |
| 2000 | log.debug("allocated frame {}", .{frame_index}); | 2000 | log.debug("allocated frame {}", .{frame_index}); |
| 2001 | return frame_index; | 2001 | return frame_index; |
| ... | @@ -2186,13 +2186,13 @@ fn airRetPtr(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -2186,13 +2186,13 @@ fn airRetPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 2186 | } | 2186 | } |
| 2187 | 2187 | ||
| 2188 | fn airFptrunc(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airFptrunc for {}", .{func.target.cpu.arch}); | 2190 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airFptrunc for {}", .{func.target.cpu.arch}); |
| 2191 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 2191 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2192 | } | 2192 | } |
| 2193 | 2193 | ||
| 2194 | fn airFpext(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airFpext for {}", .{func.target.cpu.arch}); | 2196 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airFpext for {}", .{func.target.cpu.arch}); |
| 2197 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 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,7 +2200,7 @@ fn airFpext(func: *Func, inst: Air.Inst.Index) !void { |
| 2200 | fn airIntCast(func: *Func, inst: Air.Inst.Index) !void { | 2200 | fn airIntCast(func: *Func, inst: Air.Inst.Index) !void { |
| 2201 | const pt = func.pt; | 2201 | const pt = func.pt; |
| 2202 | const zcu = pt.zcu; | 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 | const src_ty = func.typeOf(ty_op.operand); | 2204 | const src_ty = func.typeOf(ty_op.operand); |
| 2205 | const dst_ty = func.typeOfIndex(inst); | 2205 | const dst_ty = func.typeOfIndex(inst); |
| 2206 | 2206 | ||
| ... | @@ -2241,7 +2241,7 @@ fn airIntCast(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -2241,7 +2241,7 @@ fn airIntCast(func: *Func, inst: Air.Inst.Index) !void { |
| 2241 | } | 2241 | } |
| 2242 | 2242 | ||
| 2243 | fn airTrunc(func: *Func, inst: Air.Inst.Index) !void { | 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 | if (func.liveness.isUnused(inst)) | 2245 | if (func.liveness.isUnused(inst)) |
| 2246 | return func.finishAir(inst, .unreach, .{ ty_op.operand, .none, .none }); | 2246 | return func.finishAir(inst, .unreach, .{ ty_op.operand, .none, .none }); |
| 2247 | // we assume no zeroext in the "Zig ABI", so it's fine to just not truncate it. | 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,7 +2257,7 @@ fn airTrunc(func: *Func, inst: Air.Inst.Index) !void { |
| 2257 | } | 2257 | } |
| 2258 | 2258 | ||
| 2259 | fn airNot(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 2261 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 2262 | const pt = func.pt; | 2262 | const pt = func.pt; |
| 2263 | const zcu = pt.zcu; | 2263 | const zcu = pt.zcu; |
| ... | @@ -2319,7 +2319,7 @@ fn airNot(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -2319,7 +2319,7 @@ fn airNot(func: *Func, inst: Air.Inst.Index) !void { |
| 2319 | fn airSlice(func: *Func, inst: Air.Inst.Index) !void { | 2319 | fn airSlice(func: *Func, inst: Air.Inst.Index) !void { |
| 2320 | const pt = func.pt; | 2320 | const pt = func.pt; |
| 2321 | const zcu = pt.zcu; | 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 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; | 2323 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2324 | 2324 | ||
| 2325 | const slice_ty = func.typeOfIndex(inst); | 2325 | const slice_ty = func.typeOfIndex(inst); |
| ... | @@ -2343,7 +2343,7 @@ fn airSlice(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -2343,7 +2343,7 @@ fn airSlice(func: *Func, inst: Air.Inst.Index) !void { |
| 2343 | fn airBinOp(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { | 2343 | fn airBinOp(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 2344 | const pt = func.pt; | 2344 | const pt = func.pt; |
| 2345 | const zcu = pt.zcu; | 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 | const dst_mcv = try func.binOp(inst, tag, bin_op.lhs, bin_op.rhs); | 2347 | const dst_mcv = try func.binOp(inst, tag, bin_op.lhs, bin_op.rhs); |
| 2348 | 2348 | ||
| 2349 | const dst_ty = func.typeOfIndex(inst); | 2349 | const dst_ty = func.typeOfIndex(inst); |
| ... | @@ -2873,7 +2873,7 @@ fn genBinOp( | ... | @@ -2873,7 +2873,7 @@ fn genBinOp( |
| 2873 | } | 2873 | } |
| 2874 | 2874 | ||
| 2875 | fn airPtrArithmetic(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { | 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 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; | 2877 | const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2878 | const dst_mcv = try func.binOp(inst, tag, bin_op.lhs, bin_op.rhs); | 2878 | const dst_mcv = try func.binOp(inst, tag, bin_op.lhs, bin_op.rhs); |
| 2879 | return func.finishAir(inst, dst_mcv, .{ bin_op.lhs, bin_op.rhs, .none }); | 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,7 +2882,7 @@ fn airPtrArithmetic(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void |
| 2882 | fn airAddWithOverflow(func: *Func, inst: Air.Inst.Index) !void { | 2882 | fn airAddWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 2883 | const pt = func.pt; | 2883 | const pt = func.pt; |
| 2884 | const zcu = pt.zcu; | 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 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; | 2886 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2887 | 2887 | ||
| 2888 | const rhs_ty = func.typeOf(extra.rhs); | 2888 | const rhs_ty = func.typeOf(extra.rhs); |
| ... | @@ -3010,7 +3010,7 @@ fn airAddWithOverflow(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3010,7 +3010,7 @@ fn airAddWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3010 | fn airSubWithOverflow(func: *Func, inst: Air.Inst.Index) !void { | 3010 | fn airSubWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3011 | const pt = func.pt; | 3011 | const pt = func.pt; |
| 3012 | const zcu = pt.zcu; | 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 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; | 3014 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3015 | 3015 | ||
| 3016 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 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,7 +3135,7 @@ fn airSubWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3135 | fn airMulWithOverflow(func: *Func, inst: Air.Inst.Index) !void { | 3135 | fn airMulWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3136 | const pt = func.pt; | 3136 | const pt = func.pt; |
| 3137 | const zcu = pt.zcu; | 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 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; | 3139 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3140 | 3140 | ||
| 3141 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 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,7 +3210,7 @@ fn airMulWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3210 | 3210 | ||
| 3211 | fn airShlWithOverflow(func: *Func, inst: Air.Inst.Index) !void { | 3211 | fn airShlWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3212 | const zcu = func.pt.zcu; | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) | 3214 | const result: MCValue = if (func.liveness.isUnused(inst)) |
| 3215 | .unreach | 3215 | .unreach |
| 3216 | else if (func.typeOf(bin_op.lhs).isVector(zcu) and !func.typeOf(bin_op.rhs).isVector(zcu)) | 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,20 +3221,20 @@ fn airShlWithOverflow(func: *Func, inst: Air.Inst.Index) !void { |
| 3221 | } | 3221 | } |
| 3222 | 3222 | ||
| 3223 | fn airSubSat(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airSubSat", .{}); | 3225 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airSubSat", .{}); |
| 3226 | return func.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | 3226 | return func.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 3227 | } | 3227 | } |
| 3228 | 3228 | ||
| 3229 | fn airMulSat(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airMulSat", .{}); | 3231 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airMulSat", .{}); |
| 3232 | return func.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | 3232 | return func.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 3233 | } | 3233 | } |
| 3234 | 3234 | ||
| 3235 | fn airShlSat(func: *Func, inst: Air.Inst.Index) !void { | 3235 | fn airShlSat(func: *Func, inst: Air.Inst.Index) !void { |
| 3236 | const zcu = func.pt.zcu; | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) | 3238 | const result: MCValue = if (func.liveness.isUnused(inst)) |
| 3239 | .unreach | 3239 | .unreach |
| 3240 | else if (func.typeOf(bin_op.lhs).isVector(zcu) and !func.typeOf(bin_op.rhs).isVector(zcu)) | 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,7 +3246,7 @@ fn airShlSat(func: *Func, inst: Air.Inst.Index) !void { |
| 3246 | 3246 | ||
| 3247 | fn airOptionalPayload(func: *Func, inst: Air.Inst.Index) !void { | 3247 | fn airOptionalPayload(func: *Func, inst: Air.Inst.Index) !void { |
| 3248 | const zcu = func.pt.zcu; | 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 | const result: MCValue = result: { | 3250 | const result: MCValue = result: { |
| 3251 | const pl_ty = func.typeOfIndex(inst); | 3251 | const pl_ty = func.typeOfIndex(inst); |
| 3252 | if (!pl_ty.hasRuntimeBits(zcu)) break :result .none; | 3252 | if (!pl_ty.hasRuntimeBits(zcu)) break :result .none; |
| ... | @@ -3268,7 +3268,7 @@ fn airOptionalPayload(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3268,7 +3268,7 @@ fn airOptionalPayload(func: *Func, inst: Air.Inst.Index) !void { |
| 3268 | } | 3268 | } |
| 3269 | 3269 | ||
| 3270 | fn airOptionalPayloadPtr(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement .optional_payload_ptr for {}", .{func.target.cpu.arch}); | 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 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 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,7 +3276,7 @@ fn airOptionalPayloadPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3276 | fn airOptionalPayloadPtrSet(func: *Func, inst: Air.Inst.Index) !void { | 3276 | fn airOptionalPayloadPtrSet(func: *Func, inst: Air.Inst.Index) !void { |
| 3277 | const zcu = func.pt.zcu; | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 3280 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 3281 | const dst_ty = func.typeOfIndex(inst); | 3281 | const dst_ty = func.typeOfIndex(inst); |
| 3282 | const src_ty = func.typeOf(ty_op.operand); | 3282 | const src_ty = func.typeOf(ty_op.operand); |
| ... | @@ -3310,7 +3310,7 @@ fn airOptionalPayloadPtrSet(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3310,7 +3310,7 @@ fn airOptionalPayloadPtrSet(func: *Func, inst: Air.Inst.Index) !void { |
| 3310 | } | 3310 | } |
| 3311 | 3311 | ||
| 3312 | fn airUnwrapErrErr(func: *Func, inst: Air.Inst.Index) !void { | 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 | const pt = func.pt; | 3314 | const pt = func.pt; |
| 3315 | const zcu = pt.zcu; | 3315 | const zcu = pt.zcu; |
| 3316 | const err_union_ty = func.typeOf(ty_op.operand); | 3316 | const err_union_ty = func.typeOf(ty_op.operand); |
| ... | @@ -3359,7 +3359,7 @@ fn airUnwrapErrErr(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3359,7 +3359,7 @@ fn airUnwrapErrErr(func: *Func, inst: Air.Inst.Index) !void { |
| 3359 | } | 3359 | } |
| 3360 | 3360 | ||
| 3361 | fn airUnwrapErrPayload(func: *Func, inst: Air.Inst.Index) !void { | 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 | const operand_ty = func.typeOf(ty_op.operand); | 3363 | const operand_ty = func.typeOf(ty_op.operand); |
| 3364 | const operand = try func.resolveInst(ty_op.operand); | 3364 | const operand = try func.resolveInst(ty_op.operand); |
| 3365 | const result = try func.genUnwrapErrUnionPayloadMir(operand_ty, operand); | 3365 | const result = try func.genUnwrapErrUnionPayloadMir(operand_ty, operand); |
| ... | @@ -3410,21 +3410,21 @@ fn genUnwrapErrUnionPayloadMir( | ... | @@ -3410,21 +3410,21 @@ fn genUnwrapErrUnionPayloadMir( |
| 3410 | 3410 | ||
| 3411 | // *(E!T) -> E | 3411 | // *(E!T) -> E |
| 3412 | fn airUnwrapErrErrPtr(func: *Func, inst: Air.Inst.Index) !void { | 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 | 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}); | 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 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 3415 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 3416 | } | 3416 | } |
| 3417 | 3417 | ||
| 3418 | // *(E!T) -> *T | 3418 | // *(E!T) -> *T |
| 3419 | fn airUnwrapErrPayloadPtr(func: *Func, inst: Air.Inst.Index) !void { | 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 | 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}); | 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 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 3422 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 3423 | } | 3423 | } |
| 3424 | 3424 | ||
| 3425 | // *(E!T) => *T | 3425 | // *(E!T) => *T |
| 3426 | fn airErrUnionPayloadPtrSet(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 3428 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 3429 | const zcu = func.pt.zcu; | 3429 | const zcu = func.pt.zcu; |
| 3430 | const src_ty = func.typeOf(ty_op.operand); | 3430 | const src_ty = func.typeOf(ty_op.operand); |
| ... | @@ -3488,7 +3488,7 @@ fn airSaveErrReturnTraceIndex(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3488,7 +3488,7 @@ fn airSaveErrReturnTraceIndex(func: *Func, inst: Air.Inst.Index) !void { |
| 3488 | fn airWrapOptional(func: *Func, inst: Air.Inst.Index) !void { | 3488 | fn airWrapOptional(func: *Func, inst: Air.Inst.Index) !void { |
| 3489 | const pt = func.pt; | 3489 | const pt = func.pt; |
| 3490 | const zcu = pt.zcu; | 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 | const result: MCValue = result: { | 3492 | const result: MCValue = result: { |
| 3493 | const pl_ty = func.typeOf(ty_op.operand); | 3493 | const pl_ty = func.typeOf(ty_op.operand); |
| 3494 | if (!pl_ty.hasRuntimeBits(zcu)) break :result .{ .immediate = 1 }; | 3494 | if (!pl_ty.hasRuntimeBits(zcu)) break :result .{ .immediate = 1 }; |
| ... | @@ -3531,7 +3531,7 @@ fn airWrapOptional(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3531,7 +3531,7 @@ fn airWrapOptional(func: *Func, inst: Air.Inst.Index) !void { |
| 3531 | fn airWrapErrUnionPayload(func: *Func, inst: Air.Inst.Index) !void { | 3531 | fn airWrapErrUnionPayload(func: *Func, inst: Air.Inst.Index) !void { |
| 3532 | const pt = func.pt; | 3532 | const pt = func.pt; |
| 3533 | const zcu = pt.zcu; | 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 | const eu_ty = ty_op.ty.toType(); | 3536 | const eu_ty = ty_op.ty.toType(); |
| 3537 | const pl_ty = eu_ty.errorUnionPayload(zcu); | 3537 | const pl_ty = eu_ty.errorUnionPayload(zcu); |
| ... | @@ -3556,7 +3556,7 @@ fn airWrapErrUnionPayload(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3556,7 +3556,7 @@ fn airWrapErrUnionPayload(func: *Func, inst: Air.Inst.Index) !void { |
| 3556 | fn airWrapErrUnionErr(func: *Func, inst: Air.Inst.Index) !void { | 3556 | fn airWrapErrUnionErr(func: *Func, inst: Air.Inst.Index) !void { |
| 3557 | const pt = func.pt; | 3557 | const pt = func.pt; |
| 3558 | const zcu = pt.zcu; | 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 | const eu_ty = ty_op.ty.toType(); | 3561 | const eu_ty = ty_op.ty.toType(); |
| 3562 | const pl_ty = eu_ty.errorUnionPayload(zcu); | 3562 | const pl_ty = eu_ty.errorUnionPayload(zcu); |
| ... | @@ -3579,7 +3579,7 @@ fn airWrapErrUnionErr(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3579,7 +3579,7 @@ fn airWrapErrUnionErr(func: *Func, inst: Air.Inst.Index) !void { |
| 3579 | fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void { | 3579 | fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3580 | const zcu = func.pt.zcu; | 3580 | const zcu = func.pt.zcu; |
| 3581 | const ip = &zcu.intern_pool; | 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 | const ptr_ty: Type = .fromInterned(ty_nav.ty); | 3583 | const ptr_ty: Type = .fromInterned(ty_nav.ty); |
| 3584 | 3584 | ||
| 3585 | const nav = ip.getNav(ty_nav.nav); | 3585 | const nav = ip.getNav(ty_nav.nav); |
| ... | @@ -3597,8 +3597,8 @@ fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3597,8 +3597,8 @@ fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3597 | .tag = .pseudo_load_tlv, | 3597 | .tag = .pseudo_load_tlv, |
| 3598 | .data = .{ .reloc = .{ | 3598 | .data = .{ .reloc = .{ |
| 3599 | .register = dest_mcv.getReg().?, | 3599 | .register = dest_mcv.getReg().?, |
| 3600 | .atom_index = @enumFromInt(try func.owner.getSymbolIndex(func)), | 3600 | .atom_index = @fromBackingInt(@intCast(try func.owner.getSymbolIndex(func))), |
| 3601 | .sym_index = @enumFromInt(tlv_sym_index), | 3601 | .sym_index = @fromBackingInt(@intCast(tlv_sym_index)), |
| 3602 | } }, | 3602 | } }, |
| 3603 | }); | 3603 | }); |
| 3604 | } else { | 3604 | } else { |
| ... | @@ -3608,8 +3608,8 @@ fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3608,8 +3608,8 @@ fn airRuntimeNavPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3608 | .tag = .pseudo_load_tlv, | 3608 | .tag = .pseudo_load_tlv, |
| 3609 | .data = .{ .reloc = .{ | 3609 | .data = .{ .reloc = .{ |
| 3610 | .register = tmp_reg, | 3610 | .register = tmp_reg, |
| 3611 | .atom_index = @enumFromInt(try func.owner.getSymbolIndex(func)), | 3611 | .atom_index = @fromBackingInt(@intCast(try func.owner.getSymbolIndex(func))), |
| 3612 | .sym_index = @enumFromInt(tlv_sym_index), | 3612 | .sym_index = @fromBackingInt(@intCast(tlv_sym_index)), |
| 3613 | } }, | 3613 | } }, |
| 3614 | }); | 3614 | }); |
| 3615 | try func.genCopy(ptr_ty, dest_mcv, .{ .register = tmp_reg }); | 3615 | try func.genCopy(ptr_ty, dest_mcv, .{ .register = tmp_reg }); |
| ... | @@ -3674,7 +3674,7 @@ fn genTry( | ... | @@ -3674,7 +3674,7 @@ fn genTry( |
| 3674 | } | 3674 | } |
| 3675 | 3675 | ||
| 3676 | fn airSlicePtr(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result = result: { | 3678 | const result = result: { |
| 3679 | const src_mcv = try func.resolveInst(ty_op.operand); | 3679 | const src_mcv = try func.resolveInst(ty_op.operand); |
| 3680 | if (func.reuseOperand(inst, ty_op.operand, 0, src_mcv)) break :result src_mcv; | 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,7 +3688,7 @@ fn airSlicePtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3688 | } | 3688 | } |
| 3689 | 3689 | ||
| 3690 | fn airSliceLen(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 3692 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 3693 | const src_mcv = try func.resolveInst(ty_op.operand); | 3693 | const src_mcv = try func.resolveInst(ty_op.operand); |
| 3694 | const ty = func.typeOfIndex(inst); | 3694 | const ty = func.typeOfIndex(inst); |
| ... | @@ -3721,7 +3721,7 @@ fn airSliceLen(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3721,7 +3721,7 @@ fn airSliceLen(func: *Func, inst: Air.Inst.Index) !void { |
| 3721 | } | 3721 | } |
| 3722 | 3722 | ||
| 3723 | fn airPtrSliceLenPtr(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 3725 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 3726 | const src_mcv = try func.resolveInst(ty_op.operand); | 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,7 +3736,7 @@ fn airPtrSliceLenPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3736 | } | 3736 | } |
| 3737 | 3737 | ||
| 3738 | fn airPtrSlicePtrPtr(func: *Func, inst: Air.Inst.Index) !void { | 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 | const opt_mcv = try func.resolveInst(ty_op.operand); | 3741 | const opt_mcv = try func.resolveInst(ty_op.operand); |
| 3742 | const dst_mcv = if (func.reuseOperand(inst, ty_op.operand, 0, opt_mcv)) | 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,7 +3749,7 @@ fn airPtrSlicePtrPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3749 | fn airSliceElemVal(func: *Func, inst: Air.Inst.Index) !void { | 3749 | fn airSliceElemVal(func: *Func, inst: Air.Inst.Index) !void { |
| 3750 | const pt = func.pt; | 3750 | const pt = func.pt; |
| 3751 | const zcu = pt.zcu; | 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 | const result: MCValue = result: { | 3754 | const result: MCValue = result: { |
| 3755 | const elem_ty = func.typeOfIndex(inst); | 3755 | const elem_ty = func.typeOfIndex(inst); |
| ... | @@ -3766,7 +3766,7 @@ fn airSliceElemVal(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3766,7 +3766,7 @@ fn airSliceElemVal(func: *Func, inst: Air.Inst.Index) !void { |
| 3766 | } | 3766 | } |
| 3767 | 3767 | ||
| 3768 | fn airSliceElemPtr(func: *Func, inst: Air.Inst.Index) !void { | 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 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; | 3770 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3771 | const dst_mcv = try func.genSliceElemPtr(extra.lhs, extra.rhs); | 3771 | const dst_mcv = try func.genSliceElemPtr(extra.lhs, extra.rhs); |
| 3772 | return func.finishAir(inst, dst_mcv, .{ extra.lhs, extra.rhs, .none }); | 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,7 +3817,7 @@ fn genSliceElemPtr(func: *Func, lhs: Air.Inst.Ref, rhs: Air.Inst.Ref) !MCValue { |
| 3817 | fn airArrayElemVal(func: *Func, inst: Air.Inst.Index) !void { | 3817 | fn airArrayElemVal(func: *Func, inst: Air.Inst.Index) !void { |
| 3818 | const pt = func.pt; | 3818 | const pt = func.pt; |
| 3819 | const zcu = pt.zcu; | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 3821 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 3822 | const result_ty = func.typeOfIndex(inst); | 3822 | const result_ty = func.typeOfIndex(inst); |
| 3823 | 3823 | ||
| ... | @@ -3901,7 +3901,7 @@ fn airPtrElemVal(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -3901,7 +3901,7 @@ fn airPtrElemVal(func: *Func, inst: Air.Inst.Index) !void { |
| 3901 | const is_volatile = false; // TODO | 3901 | const is_volatile = false; // TODO |
| 3902 | const pt = func.pt; | 3902 | const pt = func.pt; |
| 3903 | const zcu = pt.zcu; | 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 | const base_ptr_ty = func.typeOf(bin_op.lhs); | 3905 | const base_ptr_ty = func.typeOf(bin_op.lhs); |
| 3906 | 3906 | ||
| 3907 | const result: MCValue = if (!is_volatile and func.liveness.isUnused(inst)) .unreach else result: { | 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,7 +3956,7 @@ fn airPtrElemVal(func: *Func, inst: Air.Inst.Index) !void { |
| 3956 | fn airPtrElemPtr(func: *Func, inst: Air.Inst.Index) !void { | 3956 | fn airPtrElemPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3957 | const pt = func.pt; | 3957 | const pt = func.pt; |
| 3958 | const zcu = pt.zcu; | 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 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; | 3960 | const extra = func.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3961 | 3961 | ||
| 3962 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 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,7 +3998,7 @@ fn airPtrElemPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 3998 | } | 3998 | } |
| 3999 | 3999 | ||
| 4000 | fn airSetUnionTag(func: *Func, inst: Air.Inst.Index) !void { | 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 | _ = bin_op; | 4002 | _ = bin_op; |
| 4003 | return func.fail("TODO implement airSetUnionTag for {}", .{func.target.cpu.arch}); | 4003 | return func.fail("TODO implement airSetUnionTag for {}", .{func.target.cpu.arch}); |
| 4004 | // return func.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | 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,7 +4007,7 @@ fn airSetUnionTag(func: *Func, inst: Air.Inst.Index) !void { |
| 4007 | fn airGetUnionTag(func: *Func, inst: Air.Inst.Index) !void { | 4007 | fn airGetUnionTag(func: *Func, inst: Air.Inst.Index) !void { |
| 4008 | const pt = func.pt; | 4008 | const pt = func.pt; |
| 4009 | const zcu = pt.zcu; | 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 | const tag_ty = func.typeOfIndex(inst); | 4012 | const tag_ty = func.typeOfIndex(inst); |
| 4013 | const union_ty = func.typeOf(ty_op.operand); | 4013 | const union_ty = func.typeOf(ty_op.operand); |
| ... | @@ -4053,7 +4053,7 @@ fn airGetUnionTag(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -4053,7 +4053,7 @@ fn airGetUnionTag(func: *Func, inst: Air.Inst.Index) !void { |
| 4053 | } | 4053 | } |
| 4054 | 4054 | ||
| 4055 | fn airClz(func: *Func, inst: Air.Inst.Index) !void { | 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 | const operand = try func.resolveInst(ty_op.operand); | 4057 | const operand = try func.resolveInst(ty_op.operand); |
| 4058 | const ty = func.typeOf(ty_op.operand); | 4058 | const ty = func.typeOf(ty_op.operand); |
| 4059 | 4059 | ||
| ... | @@ -4109,13 +4109,13 @@ fn airClz(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -4109,13 +4109,13 @@ fn airClz(func: *Func, inst: Air.Inst.Index) !void { |
| 4109 | } | 4109 | } |
| 4110 | 4110 | ||
| 4111 | fn airCtz(func: *Func, inst: Air.Inst.Index) !void { | 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 | _ = ty_op; | 4113 | _ = ty_op; |
| 4114 | return func.fail("TODO: finish ctz", .{}); | 4114 | return func.fail("TODO: finish ctz", .{}); |
| 4115 | } | 4115 | } |
| 4116 | 4116 | ||
| 4117 | fn airPopcount(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 4119 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 4120 | const pt = func.pt; | 4120 | const pt = func.pt; |
| 4121 | const zcu = pt.zcu; | 4121 | const zcu = pt.zcu; |
| ... | @@ -4141,7 +4141,7 @@ fn airPopcount(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -4141,7 +4141,7 @@ fn airPopcount(func: *Func, inst: Air.Inst.Index) !void { |
| 4141 | .r_type = .{ | 4141 | .r_type = .{ |
| 4142 | .rd = dst_reg, | 4142 | .rd = dst_reg, |
| 4143 | .rs1 = operand_reg, | 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,7 +4154,7 @@ fn airPopcount(func: *Func, inst: Air.Inst.Index) !void { |
| 4154 | fn airAbs(func: *Func, inst: Air.Inst.Index) !void { | 4154 | fn airAbs(func: *Func, inst: Air.Inst.Index) !void { |
| 4155 | const pt = func.pt; | 4155 | const pt = func.pt; |
| 4156 | const zcu = pt.zcu; | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 4158 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 4159 | const ty = func.typeOf(ty_op.operand); | 4159 | const ty = func.typeOf(ty_op.operand); |
| 4160 | const scalar_ty = ty.scalarType(zcu); | 4160 | const scalar_ty = ty.scalarType(zcu); |
| ... | @@ -4252,7 +4252,7 @@ fn airAbs(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -4252,7 +4252,7 @@ fn airAbs(func: *Func, inst: Air.Inst.Index) !void { |
| 4252 | } | 4252 | } |
| 4253 | 4253 | ||
| 4254 | fn airByteSwap(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 4256 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 4257 | const pt = func.pt; | 4257 | const pt = func.pt; |
| 4258 | const zcu = pt.zcu; | 4258 | const zcu = pt.zcu; |
| ... | @@ -4314,7 +4314,7 @@ fn airByteSwap(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -4314,7 +4314,7 @@ fn airByteSwap(func: *Func, inst: Air.Inst.Index) !void { |
| 4314 | } | 4314 | } |
| 4315 | 4315 | ||
| 4316 | fn airBitReverse(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airBitReverse for {}", .{func.target.cpu.arch}); | 4318 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airBitReverse for {}", .{func.target.cpu.arch}); |
| 4319 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 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,7 +4322,7 @@ fn airBitReverse(func: *Func, inst: Air.Inst.Index) !void { |
| 4322 | fn airUnaryMath(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { | 4322 | fn airUnaryMath(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 4323 | const pt = func.pt; | 4323 | const pt = func.pt; |
| 4324 | const zcu = pt.zcu; | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 4326 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 4327 | const ty = func.typeOf(un_op); | 4327 | const ty = func.typeOf(un_op); |
| 4328 | 4328 | ||
| ... | @@ -4432,7 +4432,7 @@ fn reuseOperandAdvanced( | ... | @@ -4432,7 +4432,7 @@ fn reuseOperandAdvanced( |
| 4432 | fn airLoad(func: *Func, inst: Air.Inst.Index) !void { | 4432 | fn airLoad(func: *Func, inst: Air.Inst.Index) !void { |
| 4433 | const pt = func.pt; | 4433 | const pt = func.pt; |
| 4434 | const zcu = pt.zcu; | 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 | const elem_ty = func.typeOfIndex(inst); | 4436 | const elem_ty = func.typeOfIndex(inst); |
| 4437 | 4437 | ||
| 4438 | const result: MCValue = result: { | 4438 | const result: MCValue = result: { |
| ... | @@ -4512,7 +4512,7 @@ fn airStore(func: *Func, inst: Air.Inst.Index, safety: bool) !void { | ... | @@ -4512,7 +4512,7 @@ fn airStore(func: *Func, inst: Air.Inst.Index, safety: bool) !void { |
| 4512 | } else { | 4512 | } else { |
| 4513 | // TODO if the value is undef, don't lower this instruction | 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 | const ptr = try func.resolveInst(bin_op.lhs); | 4516 | const ptr = try func.resolveInst(bin_op.lhs); |
| 4517 | const value = try func.resolveInst(bin_op.rhs); | 4517 | const value = try func.resolveInst(bin_op.rhs); |
| 4518 | const ptr_ty = func.typeOf(bin_op.lhs); | 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,14 +4559,14 @@ fn store(func: *Func, ptr_mcv: MCValue, src_mcv: MCValue, ptr_ty: Type) !void { |
| 4559 | } | 4559 | } |
| 4560 | 4560 | ||
| 4561 | fn airStructFieldPtr(func: *Func, inst: Air.Inst.Index) !void { | 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 | const extra = func.air.extraData(Air.StructField, ty_pl.payload).data; | 4563 | const extra = func.air.extraData(Air.StructField, ty_pl.payload).data; |
| 4564 | const result = try func.structFieldPtr(inst, extra.struct_operand, extra.field_index); | 4564 | const result = try func.structFieldPtr(inst, extra.struct_operand, extra.field_index); |
| 4565 | return func.finishAir(inst, result, .{ extra.struct_operand, .none, .none }); | 4565 | return func.finishAir(inst, result, .{ extra.struct_operand, .none, .none }); |
| 4566 | } | 4566 | } |
| 4567 | 4567 | ||
| 4568 | fn airStructFieldPtrIndex(func: *Func, inst: Air.Inst.Index, index: u8) !void { | 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 | const result = try func.structFieldPtr(inst, ty_op.operand, index); | 4570 | const result = try func.structFieldPtr(inst, ty_op.operand, index); |
| 4571 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 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,7 +4598,7 @@ fn airAggFieldVal(func: *Func, inst: Air.Inst.Index) !void { |
| 4598 | const pt = func.pt; | 4598 | const pt = func.pt; |
| 4599 | const zcu = pt.zcu; | 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 | const extra = func.air.extraData(Air.StructField, ty_pl.payload).data; | 4602 | const extra = func.air.extraData(Air.StructField, ty_pl.payload).data; |
| 4603 | const operand = extra.struct_operand; | 4603 | const operand = extra.struct_operand; |
| 4604 | const index = extra.field_index; | 4604 | const index = extra.field_index; |
| ... | @@ -4746,7 +4746,7 @@ fn airArg(func: *Func, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4746,7 +4746,7 @@ fn airArg(func: *Func, inst: Air.Inst.Index) InnerError!void { |
| 4746 | 4746 | ||
| 4747 | try func.genCopy(arg_ty, dst_mcv, src_mcv); | 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 | // can delete `func.func_index` if this logic is moved to emit | 4750 | // can delete `func.func_index` if this logic is moved to emit |
| 4751 | const func_zir = zcu.funcInfo(func.func_index).zir_body_inst.resolveFull(&zcu.intern_pool).?; | 4751 | const func_zir = zcu.funcInfo(func.func_index).zir_body_inst.resolveFull(&zcu.intern_pool).?; |
| 4752 | const file = zcu.fileByIndex(func_zir.file); | 4752 | const file = zcu.fileByIndex(func_zir.file); |
| ... | @@ -4871,10 +4871,10 @@ fn genCall( | ... | @@ -4871,10 +4871,10 @@ fn genCall( |
| 4871 | }); | 4871 | }); |
| 4872 | const frame_allocs_slice = func.frame_allocs.slice(); | 4872 | const frame_allocs_slice = func.frame_allocs.slice(); |
| 4873 | const stack_frame_size = | 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 | stack_frame_size.* = @max(stack_frame_size.*, needed_call_frame.abi_size); | 4875 | stack_frame_size.* = @max(stack_frame_size.*, needed_call_frame.abi_size); |
| 4876 | const stack_frame_align = | 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 | stack_frame_align.* = stack_frame_align.max(needed_call_frame.abi_align); | 4878 | stack_frame_align.* = stack_frame_align.max(needed_call_frame.abi_align); |
| 4879 | } | 4879 | } |
| 4880 | 4880 | ||
| ... | @@ -4958,7 +4958,7 @@ fn genCall( | ... | @@ -4958,7 +4958,7 @@ fn genCall( |
| 4958 | .func => |func_val| { | 4958 | .func => |func_val| { |
| 4959 | if (func.bin_file.cast(.elf)) |elf_file| { | 4959 | if (func.bin_file.cast(.elf)) |elf_file| { |
| 4960 | const zo = elf_file.zigObjectPtr().?; | 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 | if (func.mod.pic) { | 4963 | if (func.mod.pic) { |
| 4964 | return func.fail("TODO: genCall pic", .{}); | 4964 | return func.fail("TODO: genCall pic", .{}); |
| ... | @@ -4978,7 +4978,7 @@ fn genCall( | ... | @@ -4978,7 +4978,7 @@ fn genCall( |
| 4978 | .@"extern" => |@"extern"| { | 4978 | .@"extern" => |@"extern"| { |
| 4979 | const lib_name = @"extern".lib_name.toSlice(&zcu.intern_pool); | 4979 | const lib_name = @"extern".lib_name.toSlice(&zcu.intern_pool); |
| 4980 | const name = @"extern".name.toSlice(&zcu.intern_pool); | 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 | const elf_file = func.bin_file.cast(.elf).?; | 4983 | const elf_file = func.bin_file.cast(.elf).?; |
| 4984 | _ = try func.addInst(.{ | 4984 | _ = try func.addInst(.{ |
| ... | @@ -4986,7 +4986,7 @@ fn genCall( | ... | @@ -4986,7 +4986,7 @@ fn genCall( |
| 4986 | .data = .{ .reloc = .{ | 4986 | .data = .{ .reloc = .{ |
| 4987 | .register = .ra, | 4987 | .register = .ra, |
| 4988 | .atom_index = atom_index, | 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,7 +5021,7 @@ fn genCall( |
| 5021 | fn airRet(func: *Func, inst: Air.Inst.Index, safety: bool) !void { | 5021 | fn airRet(func: *Func, inst: Air.Inst.Index, safety: bool) !void { |
| 5022 | const pt = func.pt; | 5022 | const pt = func.pt; |
| 5023 | const zcu = pt.zcu; | 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 | if (safety) { | 5026 | if (safety) { |
| 5027 | // safe | 5027 | // safe |
| ... | @@ -5087,7 +5087,7 @@ fn airRet(func: *Func, inst: Air.Inst.Index, safety: bool) !void { | ... | @@ -5087,7 +5087,7 @@ fn airRet(func: *Func, inst: Air.Inst.Index, safety: bool) !void { |
| 5087 | } | 5087 | } |
| 5088 | 5088 | ||
| 5089 | fn airRetLoad(func: *Func, inst: Air.Inst.Index) !void { | 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 | const ptr = try func.resolveInst(un_op); | 5091 | const ptr = try func.resolveInst(un_op); |
| 5092 | 5092 | ||
| 5093 | const ptr_ty = func.typeOf(un_op); | 5093 | const ptr_ty = func.typeOf(un_op); |
| ... | @@ -5113,7 +5113,7 @@ fn airRetLoad(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -5113,7 +5113,7 @@ fn airRetLoad(func: *Func, inst: Air.Inst.Index) !void { |
| 5113 | } | 5113 | } |
| 5114 | 5114 | ||
| 5115 | fn airCmp(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { | 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 | const pt = func.pt; | 5117 | const pt = func.pt; |
| 5118 | const zcu = pt.zcu; | 5118 | const zcu = pt.zcu; |
| 5119 | 5119 | ||
| ... | @@ -5176,7 +5176,7 @@ fn airCmpVector(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -5176,7 +5176,7 @@ fn airCmpVector(func: *Func, inst: Air.Inst.Index) !void { |
| 5176 | } | 5176 | } |
| 5177 | 5177 | ||
| 5178 | fn airCmpLteErrorsLen(func: *Func, inst: Air.Inst.Index) !void { | 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 | const operand = try func.resolveInst(un_op); | 5180 | const operand = try func.resolveInst(un_op); |
| 5181 | _ = operand; | 5181 | _ = operand; |
| 5182 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airCmpLteErrorsLen for {}", .{func.target.cpu.arch}); | 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,7 +5184,7 @@ fn airCmpLteErrorsLen(func: *Func, inst: Air.Inst.Index) !void { |
| 5184 | } | 5184 | } |
| 5185 | 5185 | ||
| 5186 | fn airDbgStmt(func: *Func, inst: Air.Inst.Index) !void { | 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 | _ = try func.addInst(.{ | 5189 | _ = try func.addInst(.{ |
| 5190 | .tag = .pseudo_dbg_line_column, | 5190 | .tag = .pseudo_dbg_line_column, |
| ... | @@ -5203,13 +5203,13 @@ fn airDbgInlineBlock(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -5203,13 +5203,13 @@ fn airDbgInlineBlock(func: *Func, inst: Air.Inst.Index) !void { |
| 5203 | } | 5203 | } |
| 5204 | 5204 | ||
| 5205 | fn airDbgVar(func: *Func, inst: Air.Inst.Index) InnerError!void { | 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 | const operand = pl_op.operand; | 5207 | const operand = pl_op.operand; |
| 5208 | const ty = func.typeOf(operand); | 5208 | const ty = func.typeOf(operand); |
| 5209 | const mcv = try func.resolveInst(operand); | 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 | func.genVarDbgInfo(tag, ty, mcv, name.toSlice(func.air)) catch |err| | 5213 | func.genVarDbgInfo(tag, ty, mcv, name.toSlice(func.air)) catch |err| |
| 5214 | return func.fail("failed to generate variable debug info: {s}", .{@errorName(err)}); | 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,7 +5409,7 @@ fn isNull(func: *Func, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) !MC |
| 5409 | } | 5409 | } |
| 5410 | 5410 | ||
| 5411 | fn airIsNull(func: *Func, inst: Air.Inst.Index) !void { | 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 | const operand = try func.resolveInst(un_op); | 5413 | const operand = try func.resolveInst(un_op); |
| 5414 | const ty = func.typeOf(un_op); | 5414 | const ty = func.typeOf(un_op); |
| 5415 | const result = try func.isNull(inst, ty, operand); | 5415 | const result = try func.isNull(inst, ty, operand); |
| ... | @@ -5417,7 +5417,7 @@ fn airIsNull(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -5417,7 +5417,7 @@ fn airIsNull(func: *Func, inst: Air.Inst.Index) !void { |
| 5417 | } | 5417 | } |
| 5418 | 5418 | ||
| 5419 | fn airIsNullPtr(func: *Func, inst: Air.Inst.Index) !void { | 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 | const operand = try func.resolveInst(un_op); | 5421 | const operand = try func.resolveInst(un_op); |
| 5422 | _ = operand; | 5422 | _ = operand; |
| 5423 | const ty = func.typeOf(un_op); | 5423 | const ty = func.typeOf(un_op); |
| ... | @@ -5429,7 +5429,7 @@ fn airIsNullPtr(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -5429,7 +5429,7 @@ fn airIsNullPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 5429 | } | 5429 | } |
| 5430 | 5430 | ||
| 5431 | fn airIsNonNull(func: *Func, inst: Air.Inst.Index) !void { | 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 | const operand = try func.resolveInst(un_op); | 5433 | const operand = try func.resolveInst(un_op); |
| 5434 | const ty = func.typeOf(un_op); | 5434 | const ty = func.typeOf(un_op); |
| 5435 | const result = try func.isNull(inst, ty, operand); | 5435 | const result = try func.isNull(inst, ty, operand); |
| ... | @@ -5449,7 +5449,7 @@ fn airIsNonNull(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -5449,7 +5449,7 @@ fn airIsNonNull(func: *Func, inst: Air.Inst.Index) !void { |
| 5449 | } | 5449 | } |
| 5450 | 5450 | ||
| 5451 | fn airIsNonNullPtr(func: *Func, inst: Air.Inst.Index) !void { | 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 | const operand = try func.resolveInst(un_op); | 5453 | const operand = try func.resolveInst(un_op); |
| 5454 | _ = operand; | 5454 | _ = operand; |
| 5455 | const ty = func.typeOf(un_op); | 5455 | const ty = func.typeOf(un_op); |
| ... | @@ -5461,7 +5461,7 @@ fn airIsNonNullPtr(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -5461,7 +5461,7 @@ fn airIsNonNullPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 5461 | } | 5461 | } |
| 5462 | 5462 | ||
| 5463 | fn airIsErr(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 5465 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 5466 | const operand = try func.resolveInst(un_op); | 5466 | const operand = try func.resolveInst(un_op); |
| 5467 | const operand_ty = func.typeOf(un_op); | 5467 | const operand_ty = func.typeOf(un_op); |
| ... | @@ -5473,7 +5473,7 @@ fn airIsErr(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -5473,7 +5473,7 @@ fn airIsErr(func: *Func, inst: Air.Inst.Index) !void { |
| 5473 | fn airIsErrPtr(func: *Func, inst: Air.Inst.Index) !void { | 5473 | fn airIsErrPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 5474 | const pt = func.pt; | 5474 | const pt = func.pt; |
| 5475 | const zcu = pt.zcu; | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 5477 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 5478 | const operand_ptr = try func.resolveInst(un_op); | 5478 | const operand_ptr = try func.resolveInst(un_op); |
| 5479 | const operand: MCValue = blk: { | 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,7 +5553,7 @@ fn isErr(func: *Func, maybe_inst: ?Air.Inst.Index, eu_ty: Type, eu_mcv: MCValue) |
| 5553 | } | 5553 | } |
| 5554 | 5554 | ||
| 5555 | fn airIsNonErr(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 5557 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 5558 | const operand = try func.resolveInst(un_op); | 5558 | const operand = try func.resolveInst(un_op); |
| 5559 | const ty = func.typeOf(un_op); | 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,7 +5589,7 @@ fn isNonErr(func: *Func, inst: Air.Inst.Index, eu_ty: Type, eu_mcv: MCValue) !MC |
| 5589 | fn airIsNonErrPtr(func: *Func, inst: Air.Inst.Index) !void { | 5589 | fn airIsNonErrPtr(func: *Func, inst: Air.Inst.Index) !void { |
| 5590 | const pt = func.pt; | 5590 | const pt = func.pt; |
| 5591 | const zcu = pt.zcu; | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 5593 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 5594 | const operand_ptr = try func.resolveInst(un_op); | 5594 | const operand_ptr = try func.resolveInst(un_op); |
| 5595 | const operand: MCValue = blk: { | 5595 | const operand: MCValue = blk: { |
| ... | @@ -5843,7 +5843,7 @@ fn airLoopSwitchBr(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -5843,7 +5843,7 @@ fn airLoopSwitchBr(func: *Func, inst: Air.Inst.Index) !void { |
| 5843 | } | 5843 | } |
| 5844 | 5844 | ||
| 5845 | fn airSwitchDispatch(func: *Func, inst: Air.Inst.Index) !void { | 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 | const block_ty = func.typeOfIndex(br.block_inst); | 5848 | const block_ty = func.typeOfIndex(br.block_inst); |
| 5849 | const block_tracking = func.inst_tracking.getPtr(br.block_inst).?; | 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,7 +5905,7 @@ fn performReloc(func: *Func, inst: Mir.Inst.Index) void { |
| 5905 | 5905 | ||
| 5906 | fn airBr(func: *Func, inst: Air.Inst.Index) !void { | 5906 | fn airBr(func: *Func, inst: Air.Inst.Index) !void { |
| 5907 | const zcu = func.pt.zcu; | 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 | const block_ty = func.typeOfIndex(br.block_inst); | 5910 | const block_ty = func.typeOfIndex(br.block_inst); |
| 5911 | const block_unused = !block_ty.hasRuntimeBits(zcu) or func.liveness.isUnused(br.block_inst); | 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,7 +5968,7 @@ fn airBr(func: *Func, inst: Air.Inst.Index) !void { |
| 5968 | } | 5968 | } |
| 5969 | 5969 | ||
| 5970 | fn airRepeat(func: *Func, inst: Air.Inst.Index) !void { | 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 | const repeat_info = func.loops.get(loop_inst).?; | 5972 | const repeat_info = func.loops.get(loop_inst).?; |
| 5973 | try func.restoreState(repeat_info.state, &.{}, .{ | 5973 | try func.restoreState(repeat_info.state, &.{}, .{ |
| 5974 | .emit_instructions = true, | 5974 | .emit_instructions = true, |
| ... | @@ -5981,8 +5981,8 @@ fn airRepeat(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -5981,8 +5981,8 @@ fn airRepeat(func: *Func, inst: Air.Inst.Index) !void { |
| 5981 | } | 5981 | } |
| 5982 | 5982 | ||
| 5983 | fn airBoolOp(func: *Func, inst: Air.Inst.Index) !void { | 5983 | fn airBoolOp(func: *Func, inst: Air.Inst.Index) !void { |
| 5984 | const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 5984 | const bin_op = func.air.instructions.items(.data)[@backingInt(inst)].bin_op; |
| 5985 | const tag: Air.Inst.Tag = func.air.instructions.items(.tag)[@intFromEnum(inst)]; | 5985 | const tag: Air.Inst.Tag = func.air.instructions.items(.tag)[@backingInt(inst)]; |
| 5986 | 5986 | ||
| 5987 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 5987 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 5988 | const lhs = try func.resolveInst(bin_op.lhs); | 5988 | const lhs = try func.resolveInst(bin_op.lhs); |
| ... | @@ -6404,7 +6404,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -6404,7 +6404,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { |
| 6404 | .tag = .pseudo_extern_fn_reloc, | 6404 | .tag = .pseudo_extern_fn_reloc, |
| 6405 | .data = .{ .reloc = .{ | 6405 | .data = .{ .reloc = .{ |
| 6406 | .register = random_link_reg, | 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 | .sym_index = sym_offset.sym, | 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,7 +7035,7 @@ fn genSetReg(func: *Func, ty: Type, reg: Register, src_mcv: MCValue) InnerError! |
| 7035 | }, | 7035 | }, |
| 7036 | .lea_symbol => |sym_off| { | 7036 | .lea_symbol => |sym_off| { |
| 7037 | assert(sym_off.off == 0); | 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 | _ = try func.addInst(.{ | 7040 | _ = try func.addInst(.{ |
| 7041 | .tag = .pseudo_load_symbol, | 7041 | .tag = .pseudo_load_symbol, |
| ... | @@ -7154,8 +7154,8 @@ fn genSetMem( | ... | @@ -7154,8 +7154,8 @@ fn genSetMem( |
| 7154 | const mem_size = switch (base) { | 7154 | const mem_size = switch (base) { |
| 7155 | .frame => |base_fi| mem_size: { | 7155 | .frame => |base_fi| mem_size: { |
| 7156 | assert(disp >= 0); | 7156 | assert(disp >= 0); |
| 7157 | const frame_abi_size = func.frame_allocs.items(.abi_size)[@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)[@intFromEnum(base_fi)]; | 7158 | const frame_spill_pad = func.frame_allocs.items(.spill_pad)[@backingInt(base_fi)]; |
| 7159 | assert(frame_abi_size - frame_spill_pad - disp >= abi_size); | 7159 | assert(frame_abi_size - frame_spill_pad - disp >= abi_size); |
| 7160 | break :mem_size if (frame_abi_size - frame_spill_pad - disp == abi_size) | 7160 | break :mem_size if (frame_abi_size - frame_spill_pad - disp == abi_size) |
| 7161 | frame_abi_size | 7161 | frame_abi_size |
| ... | @@ -7225,7 +7225,7 @@ fn airBitCast(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -7225,7 +7225,7 @@ fn airBitCast(func: *Func, inst: Air.Inst.Index) !void { |
| 7225 | const pt = func.pt; | 7225 | const pt = func.pt; |
| 7226 | const zcu = pt.zcu; | 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 | const result = if (func.liveness.isUnused(inst)) .unreach else result: { | 7229 | const result = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 7230 | const src_mcv = try func.resolveInst(ty_op.operand); | 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,7 +7262,7 @@ fn airBitCast(func: *Func, inst: Air.Inst.Index) !void { |
| 7262 | fn airArrayToSlice(func: *Func, inst: Air.Inst.Index) !void { | 7262 | fn airArrayToSlice(func: *Func, inst: Air.Inst.Index) !void { |
| 7263 | const pt = func.pt; | 7263 | const pt = func.pt; |
| 7264 | const zcu = pt.zcu; | 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 | const slice_ty = func.typeOfIndex(inst); | 7267 | const slice_ty = func.typeOfIndex(inst); |
| 7268 | const ptr_ty = func.typeOf(ty_op.operand); | 7268 | const ptr_ty = func.typeOf(ty_op.operand); |
| ... | @@ -7284,7 +7284,7 @@ fn airArrayToSlice(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -7284,7 +7284,7 @@ fn airArrayToSlice(func: *Func, inst: Air.Inst.Index) !void { |
| 7284 | } | 7284 | } |
| 7285 | 7285 | ||
| 7286 | fn airFloatFromInt(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 7288 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 7289 | const pt = func.pt; | 7289 | const pt = func.pt; |
| 7290 | const zcu = pt.zcu; | 7290 | const zcu = pt.zcu; |
| ... | @@ -7348,7 +7348,7 @@ fn airFloatFromInt(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -7348,7 +7348,7 @@ fn airFloatFromInt(func: *Func, inst: Air.Inst.Index) !void { |
| 7348 | } | 7348 | } |
| 7349 | 7349 | ||
| 7350 | fn airIntFromFloat(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 7352 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 7353 | const pt = func.pt; | 7353 | const pt = func.pt; |
| 7354 | const zcu = pt.zcu; | 7354 | const zcu = pt.zcu; |
| ... | @@ -7410,7 +7410,7 @@ fn airCmpxchg(func: *Func, inst: Air.Inst.Index, strength: enum { weak, strong } | ... | @@ -7410,7 +7410,7 @@ fn airCmpxchg(func: *Func, inst: Air.Inst.Index, strength: enum { weak, strong } |
| 7410 | 7410 | ||
| 7411 | const pt = func.pt; | 7411 | const pt = func.pt; |
| 7412 | const zcu = pt.zcu; | 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 | const extra = func.air.extraData(Air.Cmpxchg, ty_pl.payload).data; | 7414 | const extra = func.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 7415 | 7415 | ||
| 7416 | const ptr_ty = func.typeOf(extra.ptr); | 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,7 +7547,7 @@ fn airCmpxchg(func: *Func, inst: Air.Inst.Index, strength: enum { weak, strong } |
| 7547 | fn airAtomicRmw(func: *Func, inst: Air.Inst.Index) !void { | 7547 | fn airAtomicRmw(func: *Func, inst: Air.Inst.Index) !void { |
| 7548 | const pt = func.pt; | 7548 | const pt = func.pt; |
| 7549 | const zcu = pt.zcu; | 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 | const extra = func.air.extraData(Air.AtomicRmw, pl_op.payload).data; | 7551 | const extra = func.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 7552 | 7552 | ||
| 7553 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 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,7 +7689,7 @@ fn airAtomicRmw(func: *Func, inst: Air.Inst.Index) !void { |
| 7689 | fn airAtomicLoad(func: *Func, inst: Air.Inst.Index) !void { | 7689 | fn airAtomicLoad(func: *Func, inst: Air.Inst.Index) !void { |
| 7690 | const pt = func.pt; | 7690 | const pt = func.pt; |
| 7691 | const zcu = pt.zcu; | 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 | const order: std.lang.AtomicOrder = atomic_load.order; | 7693 | const order: std.lang.AtomicOrder = atomic_load.order; |
| 7694 | 7694 | ||
| 7695 | const ptr_ty = func.typeOf(atomic_load.ptr); | 7695 | const ptr_ty = func.typeOf(atomic_load.ptr); |
| ... | @@ -7737,7 +7737,7 @@ fn airAtomicLoad(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -7737,7 +7737,7 @@ fn airAtomicLoad(func: *Func, inst: Air.Inst.Index) !void { |
| 7737 | } | 7737 | } |
| 7738 | 7738 | ||
| 7739 | fn airAtomicStore(func: *Func, inst: Air.Inst.Index, order: std.lang.AtomicOrder) !void { | 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 | const ptr_ty = func.typeOf(bin_op.lhs); | 7742 | const ptr_ty = func.typeOf(bin_op.lhs); |
| 7743 | const ptr_mcv = try func.resolveInst(bin_op.lhs); | 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,7 +7780,7 @@ fn airAtomicStore(func: *Func, inst: Air.Inst.Index, order: std.lang.AtomicOrder |
| 7780 | fn airMemset(func: *Func, inst: Air.Inst.Index, safety: bool) !void { | 7780 | fn airMemset(func: *Func, inst: Air.Inst.Index, safety: bool) !void { |
| 7781 | const pt = func.pt; | 7781 | const pt = func.pt; |
| 7782 | const zcu = pt.zcu; | 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 | result: { | 7785 | result: { |
| 7786 | if (!safety and (try func.resolveInst(bin_op.rhs)) == .undef) break :result; | 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,7 +7861,7 @@ fn airMemset(func: *Func, inst: Air.Inst.Index, safety: bool) !void { |
| 7861 | fn airMemcpy(func: *Func, inst: Air.Inst.Index) !void { | 7861 | fn airMemcpy(func: *Func, inst: Air.Inst.Index) !void { |
| 7862 | const pt = func.pt; | 7862 | const pt = func.pt; |
| 7863 | const zcu = pt.zcu; | 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 | const dst_ptr = try func.resolveInst(bin_op.lhs); | 7866 | const dst_ptr = try func.resolveInst(bin_op.lhs); |
| 7867 | const src_ptr = try func.resolveInst(bin_op.rhs); | 7867 | const src_ptr = try func.resolveInst(bin_op.rhs); |
| ... | @@ -7909,7 +7909,7 @@ fn airMemmove(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -7909,7 +7909,7 @@ fn airMemmove(func: *Func, inst: Air.Inst.Index) !void { |
| 7909 | fn airTagName(func: *Func, inst: Air.Inst.Index) !void { | 7909 | fn airTagName(func: *Func, inst: Air.Inst.Index) !void { |
| 7910 | const pt = func.pt; | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { | 7913 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: { |
| 7914 | const enum_ty = func.typeOf(un_op); | 7914 | const enum_ty = func.typeOf(un_op); |
| 7915 | 7915 | ||
| ... | @@ -7954,13 +7954,13 @@ fn airErrorName(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -7954,13 +7954,13 @@ fn airErrorName(func: *Func, inst: Air.Inst.Index) !void { |
| 7954 | } | 7954 | } |
| 7955 | 7955 | ||
| 7956 | fn airSplat(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airSplat for riscv64", .{}); | 7958 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airSplat for riscv64", .{}); |
| 7959 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 7959 | return func.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 7960 | } | 7960 | } |
| 7961 | 7961 | ||
| 7962 | fn airSelect(func: *Func, inst: Air.Inst.Index) !void { | 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 | const extra = func.air.extraData(Air.Bin, pl_op.payload).data; | 7964 | const extra = func.air.extraData(Air.Bin, pl_op.payload).data; |
| 7965 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airSelect for riscv64", .{}); | 7965 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airSelect for riscv64", .{}); |
| 7966 | return func.finishAir(inst, result, .{ pl_op.operand, extra.lhs, extra.rhs }); | 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,7 +7977,7 @@ fn airShuffleTwo(func: *Func, inst: Air.Inst.Index) !void { |
| 7977 | } | 7977 | } |
| 7978 | 7978 | ||
| 7979 | fn airReduce(func: *Func, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airReduce for riscv64", .{}); | 7981 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement airReduce for riscv64", .{}); |
| 7982 | return func.finishAir(inst, result, .{ reduce.operand, .none, .none }); | 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,7 +7987,7 @@ fn airAggregateInit(func: *Func, inst: Air.Inst.Index) !void { |
| 7987 | const zcu = pt.zcu; | 7987 | const zcu = pt.zcu; |
| 7988 | const result_ty = func.typeOfIndex(inst); | 7988 | const result_ty = func.typeOfIndex(inst); |
| 7989 | const len: usize = @intCast(result_ty.arrayLen(zcu)); | 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 | const elements: []const Air.Inst.Ref = @ptrCast(func.air.extra.items[ty_pl.payload..][0..len]); | 7991 | const elements: []const Air.Inst.Ref = @ptrCast(func.air.extra.items[ty_pl.payload..][0..len]); |
| 7992 | 7992 | ||
| 7993 | const result: MCValue = result: { | 7993 | const result: MCValue = result: { |
| ... | @@ -8085,7 +8085,7 @@ fn airAggregateInit(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -8085,7 +8085,7 @@ fn airAggregateInit(func: *Func, inst: Air.Inst.Index) !void { |
| 8085 | } | 8085 | } |
| 8086 | 8086 | ||
| 8087 | fn airUnionInit(func: *Func, inst: Air.Inst.Index) !void { | 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 | const extra = func.air.extraData(Air.UnionInit, ty_pl.payload).data; | 8089 | const extra = func.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 8090 | _ = extra; | 8090 | _ = extra; |
| 8091 | return func.fail("TODO implement airUnionInit for riscv64", .{}); | 8091 | return func.fail("TODO implement airUnionInit for riscv64", .{}); |
| ... | @@ -8093,14 +8093,14 @@ fn airUnionInit(func: *Func, inst: Air.Inst.Index) !void { | ... | @@ -8093,14 +8093,14 @@ fn airUnionInit(func: *Func, inst: Air.Inst.Index) !void { |
| 8093 | } | 8093 | } |
| 8094 | 8094 | ||
| 8095 | fn airPrefetch(func: *Func, inst: Air.Inst.Index) !void { | 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 | // TODO: RISC-V does have prefetch instruction variants. | 8097 | // TODO: RISC-V does have prefetch instruction variants. |
| 8098 | // see here: https://raw.githubusercontent.com/riscv/riscv-CMOs/master/specifications/cmobase-v1.0.1.pdf | 8098 | // see here: https://raw.githubusercontent.com/riscv/riscv-CMOs/master/specifications/cmobase-v1.0.1.pdf |
| 8099 | return func.finishAir(inst, .unreach, .{ prefetch.ptr, .none, .none }); | 8099 | return func.finishAir(inst, .unreach, .{ prefetch.ptr, .none, .none }); |
| 8100 | } | 8100 | } |
| 8101 | 8101 | ||
| 8102 | fn airMulAdd(func: *Func, inst: Air.Inst.Index) !void { | 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 | const extra = func.air.extraData(Air.Bin, pl_op.payload).data; | 8104 | const extra = func.air.extraData(Air.Bin, pl_op.payload).data; |
| 8105 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else { | 8105 | const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else { |
| 8106 | return func.fail("TODO implement airMulAdd for riscv64", .{}); | 8106 | return func.fail("TODO implement airMulAdd for riscv64", .{}); |
| ... | @@ -8379,7 +8379,7 @@ fn typeOf(func: *Func, inst: Air.Inst.Ref) Type { | ... | @@ -8379,7 +8379,7 @@ fn typeOf(func: *Func, inst: Air.Inst.Ref) Type { |
| 8379 | 8379 | ||
| 8380 | fn typeOfIndex(func: *Func, inst: Air.Inst.Index) Type { | 8380 | fn typeOfIndex(func: *Func, inst: Air.Inst.Index) Type { |
| 8381 | const zcu = func.pt.zcu; | 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 | .loop_switch_br => func.typeOf(func.air.unwrapSwitch(inst).operand), | 8383 | .loop_switch_br => func.typeOf(func.air.unwrapSwitch(inst).operand), |
| 8384 | else => func.air.typeOfIndex(inst, &zcu.intern_pool), | 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,25 +47,25 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 47 | const elf_file = emit.bin_file.cast(.elf).?; | 47 | const elf_file = emit.bin_file.cast(.elf).?; |
| 48 | const zo = elf_file.zigObjectPtr().?; | 48 | const zo = elf_file.zigObjectPtr().?; |
| 49 | 49 | ||
| 50 | const atom_ptr = zo.symbol(@intFromEnum(symbol.atom_index)).atom(elf_file).?; | 50 | const atom_ptr = zo.symbol(@backingInt(symbol.atom_index)).atom(elf_file).?; |
| 51 | const sym = zo.symbol(@intFromEnum(symbol.sym_index)); | 51 | const sym = zo.symbol(@backingInt(symbol.sym_index)); |
| 52 | 52 | ||
| 53 | if (emit.lower.pic) { | 53 | if (emit.lower.pic) { |
| 54 | return emit.fail("know when to emit GOT relocation for symbol '{s}'", .{sym.name(elf_file)}); | 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); | 57 | const hi_r_type: u32 = @backingInt(std.elf.R_RISCV.HI20); |
| 58 | const lo_r_type: u32 = @intFromEnum(std.elf.R_RISCV.LO12_I); | 58 | const lo_r_type: u32 = @backingInt(std.elf.R_RISCV.LO12_I); |
| 59 | 59 | ||
| 60 | try atom_ptr.addReloc(gpa, .{ | 60 | try atom_ptr.addReloc(gpa, .{ |
| 61 | .r_offset = start_offset, | 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 | .r_addend = 0, | 63 | .r_addend = 0, |
| 64 | }, zo); | 64 | }, zo); |
| 65 | 65 | ||
| 66 | try atom_ptr.addReloc(gpa, .{ | 66 | try atom_ptr.addReloc(gpa, .{ |
| 67 | .r_offset = start_offset + 4, | 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 | .r_addend = 0, | 69 | .r_addend = 0, |
| 70 | }, zo); | 70 | }, zo); |
| 71 | }, | 71 | }, |
| ... | @@ -73,38 +73,38 @@ pub fn emitMir(emit: *Emit) Error!void { | ... | @@ -73,38 +73,38 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 73 | const elf_file = emit.bin_file.cast(.elf).?; | 73 | const elf_file = emit.bin_file.cast(.elf).?; |
| 74 | const zo = elf_file.zigObjectPtr().?; | 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 | const R_RISCV = std.elf.R_RISCV; | 78 | const R_RISCV = std.elf.R_RISCV; |
| 79 | 79 | ||
| 80 | try atom_ptr.addReloc(gpa, .{ | 80 | try atom_ptr.addReloc(gpa, .{ |
| 81 | .r_offset = start_offset, | 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 | .r_addend = 0, | 83 | .r_addend = 0, |
| 84 | }, zo); | 84 | }, zo); |
| 85 | 85 | ||
| 86 | try atom_ptr.addReloc(gpa, .{ | 86 | try atom_ptr.addReloc(gpa, .{ |
| 87 | .r_offset = start_offset + 4, | 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 | .r_addend = 0, | 89 | .r_addend = 0, |
| 90 | }, zo); | 90 | }, zo); |
| 91 | 91 | ||
| 92 | try atom_ptr.addReloc(gpa, .{ | 92 | try atom_ptr.addReloc(gpa, .{ |
| 93 | .r_offset = start_offset + 8, | 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 | .r_addend = 0, | 95 | .r_addend = 0, |
| 96 | }, zo); | 96 | }, zo); |
| 97 | }, | 97 | }, |
| 98 | .call_extern_fn_reloc => |symbol| { | 98 | .call_extern_fn_reloc => |symbol| { |
| 99 | const elf_file = emit.bin_file.cast(.elf).?; | 99 | const elf_file = emit.bin_file.cast(.elf).?; |
| 100 | const zo = elf_file.zigObjectPtr().?; | 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 | try atom_ptr.addReloc(gpa, .{ | 105 | try atom_ptr.addReloc(gpa, .{ |
| 106 | .r_offset = start_offset, | 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 | .r_addend = 0, | 108 | .r_addend = 0, |
| 109 | }, zo); | 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,7 +554,7 @@ fn pushPopRegList(lower: *Lower, comptime spilling: bool, reg_list: Mir.Register |
| 554 | 554 | ||
| 555 | var reg_i: u31 = 0; | 555 | var reg_i: u31 = 0; |
| 556 | while (it.next()) |i| { | 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 | const reg = abi.Registers.all_preserved[i]; | 558 | const reg = abi.Registers.all_preserved[i]; |
| 559 | 559 | ||
| 560 | const reg_class = reg.class(); | 560 | const reg_class = reg.class(); |
src/codegen/riscv64/bits.zig+6-6| ... | @@ -75,7 +75,7 @@ pub const Memory = struct { | ... | @@ -75,7 +75,7 @@ pub const Memory = struct { |
| 75 | }; | 75 | }; |
| 76 | }, | 76 | }, |
| 77 | .frame => |index| { | 77 | .frame => |index| { |
| 78 | const base_loc = mir.frame_locs.get(@intFromEnum(index)); | 78 | const base_loc = mir.frame_locs.get(@backingInt(index)); |
| 79 | return .{ | 79 | return .{ |
| 80 | .base = base_loc.base, | 80 | .base = base_loc.base, |
| 81 | .disp = base_loc.disp + offset, | 81 | .disp = base_loc.disp + offset, |
| ... | @@ -191,7 +191,7 @@ pub const Register = enum(u8) { | ... | @@ -191,7 +191,7 @@ pub const Register = enum(u8) { |
| 191 | /// seperate IDs for `x0` and `f0`. We will assume that each register set has 32 registers | 191 | /// seperate IDs for `x0` and `f0`. We will assume that each register set has 32 registers |
| 192 | /// and is repeated twice, once for the named version, once for the number version. | 192 | /// and is repeated twice, once for the named version, once for the number version. |
| 193 | pub fn id(reg: Register) std.math.IntFittingRange(0, @typeInfo(Register).@"enum".field_names.len) { | 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 | // zig fmt: off | 195 | // zig fmt: off |
| 196 | @intFromEnum(Register.zero) ... @intFromEnum(Register.x31) => @intFromEnum(Register.zero), | 196 | @intFromEnum(Register.zero) ... @intFromEnum(Register.x31) => @intFromEnum(Register.zero), |
| 197 | @intFromEnum(Register.ft0) ... @intFromEnum(Register.f31) => @intFromEnum(Register.ft0), | 197 | @intFromEnum(Register.ft0) ... @intFromEnum(Register.f31) => @intFromEnum(Register.ft0), |
| ... | @@ -204,7 +204,7 @@ pub const Register = enum(u8) { | ... | @@ -204,7 +204,7 @@ pub const Register = enum(u8) { |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | pub fn encodeId(reg: Register) u5 { | 206 | pub fn encodeId(reg: Register) u5 { |
| 207 | return @truncate(@intFromEnum(reg)); | 207 | return @truncate(@backingInt(reg)); |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | pub fn dwarfNum(reg: Register) u8 { | 210 | pub fn dwarfNum(reg: Register) u8 { |
| ... | @@ -212,7 +212,7 @@ pub const Register = enum(u8) { | ... | @@ -212,7 +212,7 @@ pub const Register = enum(u8) { |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | pub fn bitSize(reg: Register, zcu: *const Zcu) u32 { | 214 | pub fn bitSize(reg: Register, zcu: *const Zcu) u32 { |
| 215 | return switch (@intFromEnum(reg)) { | 215 | return switch (@backingInt(reg)) { |
| 216 | // zig fmt: off | 216 | // zig fmt: off |
| 217 | @intFromEnum(Register.zero) ... @intFromEnum(Register.x31) => 64, | 217 | @intFromEnum(Register.zero) ... @intFromEnum(Register.x31) => 64, |
| 218 | @intFromEnum(Register.ft0) ... @intFromEnum(Register.f31) => if (zcu.getTarget().cpu.has(.riscv, .d)) 64 else 32, | 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,7 +223,7 @@ pub const Register = enum(u8) { |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | pub fn class(reg: Register) abi.RegisterClass { | 225 | pub fn class(reg: Register) abi.RegisterClass { |
| 226 | return switch (@intFromEnum(reg)) { | 226 | return switch (@backingInt(reg)) { |
| 227 | // zig fmt: off | 227 | // zig fmt: off |
| 228 | @intFromEnum(Register.zero) ... @intFromEnum(Register.x31) => .int, | 228 | @intFromEnum(Register.zero) ... @intFromEnum(Register.x31) => .int, |
| 229 | @intFromEnum(Register.ft0) ... @intFromEnum(Register.f31) => .float, | 229 | @intFromEnum(Register.ft0) ... @intFromEnum(Register.f31) => .float, |
| ... | @@ -254,7 +254,7 @@ pub const FrameIndex = enum(u32) { | ... | @@ -254,7 +254,7 @@ pub const FrameIndex = enum(u32) { |
| 254 | pub const named_count = @typeInfo(FrameIndex).@"enum".field_names.len; | 254 | pub const named_count = @typeInfo(FrameIndex).@"enum".field_names.len; |
| 255 | 255 | ||
| 256 | pub fn isNamed(fi: FrameIndex) bool { | 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,7 +523,7 @@ pub const Instruction = union(Lir.Format) { |
| 523 | } | 523 | } |
| 524 | 524 | ||
| 525 | pub fn fromLir(lir: Lir, ops: []const Operand) Instruction { | 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 | switch (lir.format) { | 528 | switch (lir.format) { |
| 529 | .R => { | 529 | .R => { |
| ... | @@ -545,26 +545,26 @@ pub const Instruction = union(Lir.Format) { | ... | @@ -545,26 +545,26 @@ pub const Instruction = union(Lir.Format) { |
| 545 | 545 | ||
| 546 | .opcode = opcode, | 546 | .opcode = opcode, |
| 547 | .funct3 = fmt.rm, | 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 | .fcvt => |fcvt| .{ | 550 | .fcvt => |fcvt| .{ |
| 551 | .rd = ops[0].reg.encodeId(), | 551 | .rd = ops[0].reg.encodeId(), |
| 552 | .rs1 = ops[1].reg.encodeId(), | 552 | .rs1 = ops[1].reg.encodeId(), |
| 553 | .rs2 = @intFromEnum(fcvt.width), | 553 | .rs2 = @backingInt(fcvt.width), |
| 554 | 554 | ||
| 555 | .opcode = opcode, | 555 | .opcode = opcode, |
| 556 | .funct3 = fcvt.rm, | 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 | .vecls => |vec| .{ | 559 | .vecls => |vec| .{ |
| 560 | .rd = ops[0].reg.encodeId(), | 560 | .rd = ops[0].reg.encodeId(), |
| 561 | .rs1 = ops[1].reg.encodeId(), | 561 | .rs1 = ops[1].reg.encodeId(), |
| 562 | 562 | ||
| 563 | .rs2 = @intFromEnum(vec.umop), | 563 | .rs2 = @backingInt(vec.umop), |
| 564 | 564 | ||
| 565 | .opcode = opcode, | 565 | .opcode = opcode, |
| 566 | .funct3 = @intFromEnum(vec.width), | 566 | .funct3 = @backingInt(vec.width), |
| 567 | .funct7 = (@as(u7, vec.nf) << 4) | (@as(u7, @intFromBool(vec.mew)) << 3) | (@as(u7, @intFromEnum(vec.mop)) << 1) | @intFromBool(vec.vm), | 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 | .vecmath => |vec| .{ | 569 | .vecmath => |vec| .{ |
| 570 | .rd = ops[0].reg.encodeId(), | 570 | .rd = ops[0].reg.encodeId(), |
| ... | @@ -572,7 +572,7 @@ pub const Instruction = union(Lir.Format) { | ... | @@ -572,7 +572,7 @@ pub const Instruction = union(Lir.Format) { |
| 572 | .rs2 = ops[2].reg.encodeId(), | 572 | .rs2 = ops[2].reg.encodeId(), |
| 573 | 573 | ||
| 574 | .opcode = opcode, | 574 | .opcode = opcode, |
| 575 | .funct3 = @intFromEnum(vec.funct3), | 575 | .funct3 = @backingInt(vec.funct3), |
| 576 | .funct7 = (@as(u7, vec.funct6) << 1) | @intFromBool(vec.vm), | 576 | .funct7 = (@as(u7, vec.funct6) << 1) | @intFromBool(vec.vm), |
| 577 | }, | 577 | }, |
| 578 | .amo => |amo| .{ | 578 | .amo => |amo| .{ |
| ... | @@ -581,7 +581,7 @@ pub const Instruction = union(Lir.Format) { | ... | @@ -581,7 +581,7 @@ pub const Instruction = union(Lir.Format) { |
| 581 | .rs2 = ops[2].reg.encodeId(), | 581 | .rs2 = ops[2].reg.encodeId(), |
| 582 | 582 | ||
| 583 | .opcode = opcode, | 583 | .opcode = opcode, |
| 584 | .funct3 = @intFromEnum(amo.width), | 584 | .funct3 = @backingInt(amo.width), |
| 585 | .funct7 = @as(u7, amo.funct5) << 2 | | 585 | .funct7 = @as(u7, amo.funct5) << 2 | |
| 586 | @as(u7, @intFromBool(ops[3].barrier == .rl)) << 1 | | 586 | @as(u7, @intFromBool(ops[3].barrier == .rl)) << 1 | |
| 587 | @as(u7, @intFromBool(ops[4].barrier == .aq)), | 587 | @as(u7, @intFromBool(ops[4].barrier == .aq)), |
| ... | @@ -629,9 +629,9 @@ pub const Instruction = union(Lir.Format) { | ... | @@ -629,9 +629,9 @@ pub const Instruction = union(Lir.Format) { |
| 629 | .rd = 0, | 629 | .rd = 0, |
| 630 | .rs1 = 0, | 630 | .rs1 = 0, |
| 631 | .funct3 = 0, | 631 | .funct3 = 0, |
| 632 | .imm0_11 = (@as(u12, @intFromEnum(fence.fm)) << 8) | | 632 | .imm0_11 = (@as(u12, @backingInt(fence.fm)) << 8) | |
| 633 | (@as(u12, @intFromEnum(ops[1].barrier)) << 4) | | 633 | (@as(u12, @backingInt(ops[1].barrier)) << 4) | |
| 634 | @as(u12, @intFromEnum(ops[0].barrier)), | 634 | @as(u12, @backingInt(ops[0].barrier)), |
| 635 | .opcode = opcode, | 635 | .opcode = opcode, |
| 636 | }, | 636 | }, |
| 637 | else => unreachable, | 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,7 +466,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 466 | try self.ensureProcessDeathCapacity(Air.Liveness.bpi); | 466 | try self.ensureProcessDeathCapacity(Air.Liveness.bpi); |
| 467 | 467 | ||
| 468 | self.reused_operands = @TypeOf(self.reused_operands).empty; | 468 | self.reused_operands = @TypeOf(self.reused_operands).empty; |
| 469 | switch (air_tags[@intFromEnum(inst)]) { | 469 | switch (air_tags[@backingInt(inst)]) { |
| 470 | // zig fmt: off | 470 | // zig fmt: off |
| 471 | 471 | ||
| 472 | // No "scalarize" legalizations are enabled, so these instructions never appear. | 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,21 +726,21 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 726 | 726 | ||
| 727 | if (std.debug.runtime_safety) { | 727 | if (std.debug.runtime_safety) { |
| 728 | if (self.air_bookkeeping < old_air_bookkeeping + 1) { | 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 | fn airAddSat(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement add_sat for {}", .{self.target.cpu.arch}); | 737 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement add_sat for {}", .{self.target.cpu.arch}); |
| 738 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | 738 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 739 | } | 739 | } |
| 740 | 740 | ||
| 741 | fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | 741 | fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 742 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | 742 | const tag = self.air.instructions.items(.tag)[@backingInt(inst)]; |
| 743 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 743 | const ty_pl = self.air.instructions.items(.data)[@backingInt(inst)].ty_pl; |
| 744 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 744 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 745 | const pt = self.pt; | 745 | const pt = self.pt; |
| 746 | const zcu = pt.zcu; | 746 | const zcu = pt.zcu; |
| ... | @@ -825,7 +825,7 @@ fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -825,7 +825,7 @@ fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
| 825 | const zcu = pt.zcu; | 825 | const zcu = pt.zcu; |
| 826 | const vector_ty = self.typeOfIndex(inst); | 826 | const vector_ty = self.typeOfIndex(inst); |
| 827 | const len = vector_ty.vectorLen(zcu); | 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 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra.items[ty_pl.payload..][0..len]); | 829 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra.items[ty_pl.payload..][0..len]); |
| 830 | const result: MCValue = res: { | 830 | const result: MCValue = res: { |
| 831 | if (self.liveness.isUnused(inst)) break :res MCValue.dead; | 831 | if (self.liveness.isUnused(inst)) break :res MCValue.dead; |
| ... | @@ -850,7 +850,7 @@ fn airAlloc(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -850,7 +850,7 @@ fn airAlloc(self: *Self, inst: Air.Inst.Index) !void { |
| 850 | } | 850 | } |
| 851 | 851 | ||
| 852 | fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement array_elem_val for {}", .{self.target.cpu.arch}); | 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 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | 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,7 +858,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 858 | fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { | 858 | fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { |
| 859 | const pt = self.pt; | 859 | const pt = self.pt; |
| 860 | const zcu = pt.zcu; | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 862 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 863 | const ptr_ty = self.typeOf(ty_op.operand); | 863 | const ptr_ty = self.typeOf(ty_op.operand); |
| 864 | const ptr = try self.resolveInst(ty_op.operand); | 864 | const ptr = try self.resolveInst(ty_op.operand); |
| ... | @@ -993,7 +993,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) InnerError!void { | ... | @@ -993,7 +993,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) InnerError!void { |
| 993 | const func_zir = zcu.funcInfo(self.func_index).zir_body_inst.resolveFull(&zcu.intern_pool).?; | 993 | const func_zir = zcu.funcInfo(self.func_index).zir_body_inst.resolveFull(&zcu.intern_pool).?; |
| 994 | const file = zcu.fileByIndex(func_zir.file); | 994 | const file = zcu.fileByIndex(func_zir.file); |
| 995 | if (!file.mod.?.strip) { | 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 | const zir = &file.zir.?; | 997 | const zir = &file.zir.?; |
| 998 | const name = zir.nullTerminatedString(zir.getParamName(zir.getParamBody(func_zir.inst)[arg.zir_param_index]).?); | 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,7 +1015,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) InnerError!void { |
| 1015 | } | 1015 | } |
| 1016 | 1016 | ||
| 1017 | fn airAtomicLoad(self: *Self, inst: Air.Inst.Index) !void { | 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 | return self.fail("TODO implement airAtomicLoad for {}", .{ | 1020 | return self.fail("TODO implement airAtomicLoad for {}", .{ |
| 1021 | self.target.cpu.arch, | 1021 | self.target.cpu.arch, |
| ... | @@ -1023,7 +1023,7 @@ fn airAtomicLoad(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1023,7 +1023,7 @@ fn airAtomicLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 1023 | } | 1023 | } |
| 1024 | 1024 | ||
| 1025 | fn airAtomicRmw(self: *Self, inst: Air.Inst.Index) !void { | 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 | return self.fail("TODO implement airAtomicRmw for {}", .{ | 1028 | return self.fail("TODO implement airAtomicRmw for {}", .{ |
| 1029 | self.target.cpu.arch, | 1029 | self.target.cpu.arch, |
| ... | @@ -1031,7 +1031,7 @@ fn airAtomicRmw(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1031,7 +1031,7 @@ fn airAtomicRmw(self: *Self, inst: Air.Inst.Index) !void { |
| 1031 | } | 1031 | } |
| 1032 | 1032 | ||
| 1033 | fn airBinOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 1035 | const lhs = try self.resolveInst(bin_op.lhs); |
| 1036 | const rhs = try self.resolveInst(bin_op.rhs); | 1036 | const rhs = try self.resolveInst(bin_op.rhs); |
| 1037 | const lhs_ty = self.typeOf(bin_op.lhs); | 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,7 +1048,7 @@ fn airBinOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 1048 | } | 1048 | } |
| 1049 | 1049 | ||
| 1050 | fn airPtrArithmetic(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { | 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 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 1052 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 1053 | const lhs = try self.resolveInst(bin_op.lhs); | 1053 | const lhs = try self.resolveInst(bin_op.lhs); |
| 1054 | const rhs = try self.resolveInst(bin_op.rhs); | 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,7 +1066,7 @@ fn airPtrArithmetic(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void |
| 1066 | } | 1066 | } |
| 1067 | 1067 | ||
| 1068 | fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result = if (self.liveness.isUnused(inst)) .dead else result: { | 1070 | const result = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1071 | const operand = try self.resolveInst(ty_op.operand); | 1071 | const operand = try self.resolveInst(ty_op.operand); |
| 1072 | if (self.reuseOperand(inst, ty_op.operand, 0, operand)) break :result operand; | 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,7 +1086,7 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { |
| 1086 | } | 1086 | } |
| 1087 | 1087 | ||
| 1088 | fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airBitReverse for {}", .{self.target.cpu.arch}); | 1090 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airBitReverse for {}", .{self.target.cpu.arch}); |
| 1091 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 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,7 +1134,7 @@ fn lowerBlock(self: *Self, inst: Air.Inst.Index, body: []const Air.Inst.Index) ! |
| 1134 | } | 1134 | } |
| 1135 | 1135 | ||
| 1136 | fn airBr(self: *Self, inst: Air.Inst.Index) !void { | 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 | try self.br(branch.block_inst, branch.operand); | 1138 | try self.br(branch.block_inst, branch.operand); |
| 1139 | return self.finishAir(inst, .dead, .{ branch.operand, .none, .none }); | 1139 | return self.finishAir(inst, .dead, .{ branch.operand, .none, .none }); |
| 1140 | } | 1140 | } |
| ... | @@ -1172,7 +1172,7 @@ fn airBreakpoint(self: *Self) !void { | ... | @@ -1172,7 +1172,7 @@ fn airBreakpoint(self: *Self) !void { |
| 1172 | fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void { | 1172 | fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void { |
| 1173 | const pt = self.pt; | 1173 | const pt = self.pt; |
| 1174 | const zcu = pt.zcu; | 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 | // We have hardware byteswapper in SPARCv9, don't let mainstream compilers mislead you. | 1177 | // We have hardware byteswapper in SPARCv9, don't let mainstream compilers mislead you. |
| 1178 | // That being said, the strategy to lower this is: | 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,13 +1359,13 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.lang.CallModifier) ! |
| 1359 | } | 1359 | } |
| 1360 | 1360 | ||
| 1361 | fn airClz(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airClz for {}", .{self.target.cpu.arch}); | 1363 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airClz for {}", .{self.target.cpu.arch}); |
| 1364 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 1364 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1365 | } | 1365 | } |
| 1366 | 1366 | ||
| 1367 | fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { | 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 | const pt = self.pt; | 1369 | const pt = self.pt; |
| 1370 | const zcu = pt.zcu; | 1370 | const zcu = pt.zcu; |
| 1371 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 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,7 +1423,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 1423 | } | 1423 | } |
| 1424 | 1424 | ||
| 1425 | fn airCmpLteErrorsLen(self: *Self, inst: Air.Inst.Index) !void { | 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 | const operand = try self.resolveInst(un_op); | 1427 | const operand = try self.resolveInst(un_op); |
| 1428 | _ = operand; | 1428 | _ = operand; |
| 1429 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airCmpLteErrorsLen for {}", .{self.target.cpu.arch}); | 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,7 +1584,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { |
| 1584 | } | 1584 | } |
| 1585 | 1585 | ||
| 1586 | fn airCtz(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airCtz for {}", .{self.target.cpu.arch}); | 1588 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airCtz for {}", .{self.target.cpu.arch}); |
| 1589 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 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,7 +1596,7 @@ fn airDbgInlineBlock(self: *Self, inst: Air.Inst.Index) !void { |
| 1596 | } | 1596 | } |
| 1597 | 1597 | ||
| 1598 | fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void { | 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 | _ = try self.addInst(.{ | 1601 | _ = try self.addInst(.{ |
| 1602 | .tag = .dbg_line, | 1602 | .tag = .dbg_line, |
| ... | @@ -1612,8 +1612,8 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1612,8 +1612,8 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void { |
| 1612 | } | 1612 | } |
| 1613 | 1613 | ||
| 1614 | fn airDbgVar(self: *Self, inst: Air.Inst.Index) !void { | 1614 | fn airDbgVar(self: *Self, inst: Air.Inst.Index) !void { |
| 1615 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | 1615 | const pl_op = self.air.instructions.items(.data)[@backingInt(inst)].pl_op; |
| 1616 | const name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); | 1616 | const name: Air.NullTerminatedString = @fromBackingInt(@intCast(pl_op.payload)); |
| 1617 | const operand = pl_op.operand; | 1617 | const operand = pl_op.operand; |
| 1618 | // TODO emit debug info for this variable | 1618 | // TODO emit debug info for this variable |
| 1619 | _ = name; | 1619 | _ = name; |
| ... | @@ -1621,13 +1621,13 @@ fn airDbgVar(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1621,13 +1621,13 @@ fn airDbgVar(self: *Self, inst: Air.Inst.Index) !void { |
| 1621 | } | 1621 | } |
| 1622 | 1622 | ||
| 1623 | fn airDiv(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement div for {}", .{self.target.cpu.arch}); | 1625 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement div for {}", .{self.target.cpu.arch}); |
| 1626 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | 1626 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 1627 | } | 1627 | } |
| 1628 | 1628 | ||
| 1629 | fn airErrorName(self: *Self, inst: Air.Inst.Index) !void { | 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 | const operand = try self.resolveInst(un_op); | 1631 | const operand = try self.resolveInst(un_op); |
| 1632 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else { | 1632 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else { |
| 1633 | _ = operand; | 1633 | _ = operand; |
| ... | @@ -1637,13 +1637,13 @@ fn airErrorName(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1637,13 +1637,13 @@ fn airErrorName(self: *Self, inst: Air.Inst.Index) !void { |
| 1637 | } | 1637 | } |
| 1638 | 1638 | ||
| 1639 | fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement .errunion_payload_ptr_set for {}", .{self.target.cpu.arch}); | 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 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 1642 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1643 | } | 1643 | } |
| 1644 | 1644 | ||
| 1645 | fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airIntFromFloat for {}", .{ | 1647 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airIntFromFloat for {}", .{ |
| 1648 | self.target.cpu.arch, | 1648 | self.target.cpu.arch, |
| 1649 | }); | 1649 | }); |
| ... | @@ -1651,13 +1651,13 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1651,13 +1651,13 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void { |
| 1651 | } | 1651 | } |
| 1652 | 1652 | ||
| 1653 | fn airGetUnionTag(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airGetUnionTag for {}", .{self.target.cpu.arch}); | 1655 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airGetUnionTag for {}", .{self.target.cpu.arch}); |
| 1656 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 1656 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1657 | } | 1657 | } |
| 1658 | 1658 | ||
| 1659 | fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { | 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 | if (self.liveness.isUnused(inst)) | 1661 | if (self.liveness.isUnused(inst)) |
| 1662 | return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none }); | 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,7 +1677,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { |
| 1677 | } | 1677 | } |
| 1678 | 1678 | ||
| 1679 | fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airFloatFromInt for {}", .{ | 1681 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airFloatFromInt for {}", .{ |
| 1682 | self.target.cpu.arch, | 1682 | self.target.cpu.arch, |
| 1683 | }); | 1683 | }); |
| ... | @@ -1685,7 +1685,7 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1685,7 +1685,7 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void { |
| 1685 | } | 1685 | } |
| 1686 | 1686 | ||
| 1687 | fn airIsErr(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 1689 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1690 | const operand = try self.resolveInst(un_op); | 1690 | const operand = try self.resolveInst(un_op); |
| 1691 | const ty = self.typeOf(un_op); | 1691 | const ty = self.typeOf(un_op); |
| ... | @@ -1695,7 +1695,7 @@ fn airIsErr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1695,7 +1695,7 @@ fn airIsErr(self: *Self, inst: Air.Inst.Index) !void { |
| 1695 | } | 1695 | } |
| 1696 | 1696 | ||
| 1697 | fn airIsNonErr(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 1699 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1700 | const operand = try self.resolveInst(un_op); | 1700 | const operand = try self.resolveInst(un_op); |
| 1701 | const ty = self.typeOf(un_op); | 1701 | const ty = self.typeOf(un_op); |
| ... | @@ -1705,7 +1705,7 @@ fn airIsNonErr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1705,7 +1705,7 @@ fn airIsNonErr(self: *Self, inst: Air.Inst.Index) !void { |
| 1705 | } | 1705 | } |
| 1706 | 1706 | ||
| 1707 | fn airIsNull(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 1709 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1710 | const operand = try self.resolveInst(un_op); | 1710 | const operand = try self.resolveInst(un_op); |
| 1711 | break :result try self.isNull(operand); | 1711 | break :result try self.isNull(operand); |
| ... | @@ -1714,7 +1714,7 @@ fn airIsNull(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1714,7 +1714,7 @@ fn airIsNull(self: *Self, inst: Air.Inst.Index) !void { |
| 1714 | } | 1714 | } |
| 1715 | 1715 | ||
| 1716 | fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 1718 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1719 | const operand = try self.resolveInst(un_op); | 1719 | const operand = try self.resolveInst(un_op); |
| 1720 | break :result try self.isNonNull(operand); | 1720 | break :result try self.isNonNull(operand); |
| ... | @@ -1725,7 +1725,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1725,7 +1725,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void { |
| 1725 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { | 1725 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 1726 | const pt = self.pt; | 1726 | const pt = self.pt; |
| 1727 | const zcu = pt.zcu; | 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 | const elem_ty = self.typeOfIndex(inst); | 1729 | const elem_ty = self.typeOfIndex(inst); |
| 1730 | const elem_size = elem_ty.abiSize(zcu); | 1730 | const elem_size = elem_ty.abiSize(zcu); |
| 1731 | const result: MCValue = result: { | 1731 | const result: MCValue = result: { |
| ... | @@ -1771,7 +1771,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void { | ... | @@ -1771,7 +1771,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void { |
| 1771 | } else { | 1771 | } else { |
| 1772 | // TODO if the value is undef, don't lower this instruction | 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 | const extra = self.air.extraData(Air.Bin, pl_op.payload); | 1775 | const extra = self.air.extraData(Air.Bin, pl_op.payload); |
| 1776 | 1776 | ||
| 1777 | const operand = pl_op.operand; | 1777 | const operand = pl_op.operand; |
| ... | @@ -1785,8 +1785,8 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void { | ... | @@ -1785,8 +1785,8 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void { |
| 1785 | } | 1785 | } |
| 1786 | 1786 | ||
| 1787 | fn airMinMax(self: *Self, inst: Air.Inst.Index) !void { | 1787 | fn airMinMax(self: *Self, inst: Air.Inst.Index) !void { |
| 1788 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | 1788 | const tag = self.air.instructions.items(.tag)[@backingInt(inst)]; |
| 1789 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 1789 | const bin_op = self.air.instructions.items(.data)[@backingInt(inst)].bin_op; |
| 1790 | const lhs = try self.resolveInst(bin_op.lhs); | 1790 | const lhs = try self.resolveInst(bin_op.lhs); |
| 1791 | const rhs = try self.resolveInst(bin_op.rhs); | 1791 | const rhs = try self.resolveInst(bin_op.rhs); |
| 1792 | const lhs_ty = self.typeOf(bin_op.lhs); | 1792 | const lhs_ty = self.typeOf(bin_op.lhs); |
| ... | @@ -1801,7 +1801,7 @@ fn airMinMax(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1801,7 +1801,7 @@ fn airMinMax(self: *Self, inst: Air.Inst.Index) !void { |
| 1801 | } | 1801 | } |
| 1802 | 1802 | ||
| 1803 | fn airMod(self: *Self, inst: Air.Inst.Index) !void { | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 1805 | const lhs = try self.resolveInst(bin_op.lhs); |
| 1806 | const rhs = try self.resolveInst(bin_op.rhs); | 1806 | const rhs = try self.resolveInst(bin_op.rhs); |
| 1807 | const lhs_ty = self.typeOf(bin_op.lhs); | 1807 | const lhs_ty = self.typeOf(bin_op.lhs); |
| ... | @@ -1939,14 +1939,14 @@ fn airMod(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1939,14 +1939,14 @@ fn airMod(self: *Self, inst: Air.Inst.Index) !void { |
| 1939 | } | 1939 | } |
| 1940 | 1940 | ||
| 1941 | fn airMulSat(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement mul_sat for {}", .{self.target.cpu.arch}); | 1943 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement mul_sat for {}", .{self.target.cpu.arch}); |
| 1944 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | 1944 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 1945 | } | 1945 | } |
| 1946 | 1946 | ||
| 1947 | fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | 1947 | fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 1948 | //const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | 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 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 1950 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 1951 | const pt = self.pt; | 1951 | const pt = self.pt; |
| 1952 | const zcu = pt.zcu; | 1952 | const zcu = pt.zcu; |
| ... | @@ -2012,7 +2012,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2012,7 +2012,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 2012 | } | 2012 | } |
| 2013 | 2013 | ||
| 2014 | fn airNot(self: *Self, inst: Air.Inst.Index) !void { | 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 | const pt = self.pt; | 2016 | const pt = self.pt; |
| 2017 | const zcu = pt.zcu; | 2017 | const zcu = pt.zcu; |
| 2018 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 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,51 +2109,51 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void { |
| 2109 | } | 2109 | } |
| 2110 | 2110 | ||
| 2111 | fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement .optional_payload for {}", .{self.target.cpu.arch}); | 2113 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement .optional_payload for {}", .{self.target.cpu.arch}); |
| 2114 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 2114 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2115 | } | 2115 | } |
| 2116 | 2116 | ||
| 2117 | fn airOptionalPayloadPtr(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement .optional_payload_ptr for {}", .{self.target.cpu.arch}); | 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 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 2120 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2121 | } | 2121 | } |
| 2122 | 2122 | ||
| 2123 | fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement .optional_payload_ptr_set for {}", .{self.target.cpu.arch}); | 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 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 2126 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2127 | } | 2127 | } |
| 2128 | 2128 | ||
| 2129 | fn airPopcount(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airPopcount for {}", .{self.target.cpu.arch}); | 2131 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airPopcount for {}", .{self.target.cpu.arch}); |
| 2132 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 2132 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2133 | } | 2133 | } |
| 2134 | 2134 | ||
| 2135 | fn airPrefetch(self: *Self, inst: Air.Inst.Index) !void { | 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 | // TODO Emit a PREFETCH/IPREFETCH as necessary, see A.7 and A.42 | 2137 | // TODO Emit a PREFETCH/IPREFETCH as necessary, see A.7 and A.42 |
| 2138 | return self.finishAir(inst, MCValue.dead, .{ prefetch.ptr, .none, .none }); | 2138 | return self.finishAir(inst, MCValue.dead, .{ prefetch.ptr, .none, .none }); |
| 2139 | } | 2139 | } |
| 2140 | 2140 | ||
| 2141 | fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { | 2141 | fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2142 | const is_volatile = false; // TODO | 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 | 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}); | 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 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | 2145 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 2146 | } | 2146 | } |
| 2147 | 2147 | ||
| 2148 | fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void { | 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 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 2150 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2151 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement ptr_elem_ptr for {}", .{self.target.cpu.arch}); | 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 | return self.finishAir(inst, result, .{ extra.lhs, extra.rhs, .none }); | 2152 | return self.finishAir(inst, result, .{ extra.lhs, extra.rhs, .none }); |
| 2153 | } | 2153 | } |
| 2154 | 2154 | ||
| 2155 | fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2157 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2158 | const ptr_bits = self.target.ptrBitWidth(); | 2158 | const ptr_bits = self.target.ptrBitWidth(); |
| 2159 | const ptr_bytes = @divExact(ptr_bits, 8); | 2159 | const ptr_bytes = @divExact(ptr_bits, 8); |
| ... | @@ -2170,7 +2170,7 @@ fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2170,7 +2170,7 @@ fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2170 | } | 2170 | } |
| 2171 | 2171 | ||
| 2172 | fn airPtrSlicePtrPtr(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2174 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2175 | const mcv = try self.resolveInst(ty_op.operand); | 2175 | const mcv = try self.resolveInst(ty_op.operand); |
| 2176 | switch (mcv) { | 2176 | switch (mcv) { |
| ... | @@ -2185,7 +2185,7 @@ fn airPtrSlicePtrPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2185,7 +2185,7 @@ fn airPtrSlicePtrPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2185 | } | 2185 | } |
| 2186 | 2186 | ||
| 2187 | fn airRem(self: *Self, inst: Air.Inst.Index) !void { | 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 | const lhs = try self.resolveInst(bin_op.lhs); | 2189 | const lhs = try self.resolveInst(bin_op.lhs); |
| 2190 | const rhs = try self.resolveInst(bin_op.rhs); | 2190 | const rhs = try self.resolveInst(bin_op.rhs); |
| 2191 | const lhs_ty = self.typeOf(bin_op.lhs); | 2191 | const lhs_ty = self.typeOf(bin_op.lhs); |
| ... | @@ -2206,14 +2206,14 @@ fn airRem(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2206,14 +2206,14 @@ fn airRem(self: *Self, inst: Air.Inst.Index) !void { |
| 2206 | } | 2206 | } |
| 2207 | 2207 | ||
| 2208 | fn airRet(self: *Self, inst: Air.Inst.Index) !void { | 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 | const operand = try self.resolveInst(un_op); | 2210 | const operand = try self.resolveInst(un_op); |
| 2211 | try self.ret(operand); | 2211 | try self.ret(operand); |
| 2212 | return self.finishAir(inst, .dead, .{ un_op, .none, .none }); | 2212 | return self.finishAir(inst, .dead, .{ un_op, .none, .none }); |
| 2213 | } | 2213 | } |
| 2214 | 2214 | ||
| 2215 | fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void { | 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 | const ptr = try self.resolveInst(un_op); | 2217 | const ptr = try self.resolveInst(un_op); |
| 2218 | _ = ptr; | 2218 | _ = ptr; |
| 2219 | return self.fail("TODO implement airRetLoad for {}", .{self.target.cpu.arch}); | 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,14 +2226,14 @@ fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2226 | } | 2226 | } |
| 2227 | 2227 | ||
| 2228 | fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void { | 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 | _ = bin_op; | 2230 | _ = bin_op; |
| 2231 | return self.fail("TODO implement airSetUnionTag for {}", .{self.target.cpu.arch}); | 2231 | return self.fail("TODO implement airSetUnionTag for {}", .{self.target.cpu.arch}); |
| 2232 | } | 2232 | } |
| 2233 | 2233 | ||
| 2234 | fn airShlSat(self: *Self, inst: Air.Inst.Index) !void { | 2234 | fn airShlSat(self: *Self, inst: Air.Inst.Index) !void { |
| 2235 | const zcu = self.pt.zcu; | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) | 2237 | const result: MCValue = if (self.liveness.isUnused(inst)) |
| 2238 | .dead | 2238 | .dead |
| 2239 | else if (self.typeOf(bin_op.lhs).isVector(zcu) and !self.typeOf(bin_op.rhs).isVector(zcu)) | 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,7 +2244,7 @@ fn airShlSat(self: *Self, inst: Air.Inst.Index) !void { |
| 2244 | } | 2244 | } |
| 2245 | 2245 | ||
| 2246 | fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | 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 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 2248 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2249 | const pt = self.pt; | 2249 | const pt = self.pt; |
| 2250 | const zcu = pt.zcu; | 2250 | const zcu = pt.zcu; |
| ... | @@ -2338,7 +2338,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2338,7 +2338,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 2338 | } | 2338 | } |
| 2339 | 2339 | ||
| 2340 | fn airSlice(self: *Self, inst: Air.Inst.Index) !void { | 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 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 2342 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2343 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2343 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2344 | const ptr = try self.resolveInst(bin_op.lhs); | 2344 | const ptr = try self.resolveInst(bin_op.lhs); |
| ... | @@ -2358,7 +2358,7 @@ fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2358,7 +2358,7 @@ fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2358 | const pt = self.pt; | 2358 | const pt = self.pt; |
| 2359 | const zcu = pt.zcu; | 2359 | const zcu = pt.zcu; |
| 2360 | const is_volatile = false; // TODO | 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 | if (!is_volatile and self.liveness.isUnused(inst)) return self.finishAir(inst, .dead, .{ bin_op.lhs, bin_op.rhs, .none }); | 2363 | if (!is_volatile and self.liveness.isUnused(inst)) return self.finishAir(inst, .dead, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 2364 | const result: MCValue = result: { | 2364 | const result: MCValue = result: { |
| ... | @@ -2400,7 +2400,7 @@ fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2400,7 +2400,7 @@ fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2400 | } | 2400 | } |
| 2401 | 2401 | ||
| 2402 | fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2404 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2405 | const ptr_bits = self.target.ptrBitWidth(); | 2405 | const ptr_bits = self.target.ptrBitWidth(); |
| 2406 | const ptr_bytes = @divExact(ptr_bits, 8); | 2406 | const ptr_bytes = @divExact(ptr_bits, 8); |
| ... | @@ -2421,7 +2421,7 @@ fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2421,7 +2421,7 @@ fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void { |
| 2421 | } | 2421 | } |
| 2422 | 2422 | ||
| 2423 | fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2425 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2426 | const mcv = try self.resolveInst(ty_op.operand); | 2426 | const mcv = try self.resolveInst(ty_op.operand); |
| 2427 | switch (mcv) { | 2427 | switch (mcv) { |
| ... | @@ -2440,7 +2440,7 @@ fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2440,7 +2440,7 @@ fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void { |
| 2440 | } | 2440 | } |
| 2441 | 2441 | ||
| 2442 | fn airSplat(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airSplat for {}", .{self.target.cpu.arch}); | 2444 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement airSplat for {}", .{self.target.cpu.arch}); |
| 2445 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 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,7 +2451,7 @@ fn airStore(self: *Self, inst: Air.Inst.Index, safety: bool) !void { |
| 2451 | } else { | 2451 | } else { |
| 2452 | // TODO if the value is undef, don't lower this instruction | 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 | const ptr = try self.resolveInst(bin_op.lhs); | 2455 | const ptr = try self.resolveInst(bin_op.lhs); |
| 2456 | const value = try self.resolveInst(bin_op.rhs); | 2456 | const value = try self.resolveInst(bin_op.rhs); |
| 2457 | const ptr_ty = self.typeOf(bin_op.lhs); | 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,20 +2463,20 @@ fn airStore(self: *Self, inst: Air.Inst.Index, safety: bool) !void { |
| 2463 | } | 2463 | } |
| 2464 | 2464 | ||
| 2465 | fn airStructFieldPtr(self: *Self, inst: Air.Inst.Index) !void { | 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 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; | 2467 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 2468 | const result = try self.structFieldPtr(inst, extra.struct_operand, extra.field_index); | 2468 | const result = try self.structFieldPtr(inst, extra.struct_operand, extra.field_index); |
| 2469 | return self.finishAir(inst, result, .{ extra.struct_operand, .none, .none }); | 2469 | return self.finishAir(inst, result, .{ extra.struct_operand, .none, .none }); |
| 2470 | } | 2470 | } |
| 2471 | 2471 | ||
| 2472 | fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void { | 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 | const result = try self.structFieldPtr(inst, ty_op.operand, index); | 2474 | const result = try self.structFieldPtr(inst, ty_op.operand, index); |
| 2475 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 2475 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2476 | } | 2476 | } |
| 2477 | 2477 | ||
| 2478 | fn airAggFieldVal(self: *Self, inst: Air.Inst.Index) !void { | 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 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; | 2480 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 2481 | const operand = extra.struct_operand; | 2481 | const operand = extra.struct_operand; |
| 2482 | const index = extra.field_index; | 2482 | const index = extra.field_index; |
| ... | @@ -2546,7 +2546,7 @@ fn airAggFieldVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2546,7 +2546,7 @@ fn airAggFieldVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2546 | } | 2546 | } |
| 2547 | 2547 | ||
| 2548 | fn airSubSat(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement sub_sat for {}", .{self.target.cpu.arch}); | 2550 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement sub_sat for {}", .{self.target.cpu.arch}); |
| 2551 | return self.finishAir(inst, result, .{ bin_op.lhs, bin_op.rhs, .none }); | 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,7 +2557,7 @@ fn airSwitch(self: *Self, inst: Air.Inst.Index) !void { |
| 2557 | } | 2557 | } |
| 2558 | 2558 | ||
| 2559 | fn airTagName(self: *Self, inst: Air.Inst.Index) !void { | 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 | const operand = try self.resolveInst(un_op); | 2561 | const operand = try self.resolveInst(un_op); |
| 2562 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else { | 2562 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else { |
| 2563 | _ = operand; | 2563 | _ = operand; |
| ... | @@ -2567,7 +2567,7 @@ fn airTagName(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2567,7 +2567,7 @@ fn airTagName(self: *Self, inst: Air.Inst.Index) !void { |
| 2567 | } | 2567 | } |
| 2568 | 2568 | ||
| 2569 | fn airTrunc(self: *Self, inst: Air.Inst.Index) !void { | 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 | const operand = try self.resolveInst(ty_op.operand); | 2571 | const operand = try self.resolveInst(ty_op.operand); |
| 2572 | const operand_ty = self.typeOf(ty_op.operand); | 2572 | const operand_ty = self.typeOf(ty_op.operand); |
| 2573 | const dest_ty = self.typeOfIndex(inst); | 2573 | const dest_ty = self.typeOfIndex(inst); |
| ... | @@ -2597,7 +2597,7 @@ fn airTry(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2597,7 +2597,7 @@ fn airTry(self: *Self, inst: Air.Inst.Index) !void { |
| 2597 | } | 2597 | } |
| 2598 | 2598 | ||
| 2599 | fn airUnaryMath(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) | 2601 | const result: MCValue = if (self.liveness.isUnused(inst)) |
| 2602 | .dead | 2602 | .dead |
| 2603 | else | 2603 | else |
| ... | @@ -2606,7 +2606,7 @@ fn airUnaryMath(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2606,7 +2606,7 @@ fn airUnaryMath(self: *Self, inst: Air.Inst.Index) !void { |
| 2606 | } | 2606 | } |
| 2607 | 2607 | ||
| 2608 | fn airUnionInit(self: *Self, inst: Air.Inst.Index) !void { | 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 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; | 2610 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 2611 | _ = extra; | 2611 | _ = extra; |
| 2612 | return self.fail("TODO implement airUnionInit for {}", .{self.target.cpu.arch}); | 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,7 +2615,7 @@ fn airUnionInit(self: *Self, inst: Air.Inst.Index) !void { |
| 2615 | fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void { | 2615 | fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2616 | const pt = self.pt; | 2616 | const pt = self.pt; |
| 2617 | const zcu = pt.zcu; | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2619 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2620 | const error_union_ty = self.typeOf(ty_op.operand); | 2620 | const error_union_ty = self.typeOf(ty_op.operand); |
| 2621 | const payload_ty = error_union_ty.errorUnionPayload(zcu); | 2621 | const payload_ty = error_union_ty.errorUnionPayload(zcu); |
| ... | @@ -2630,7 +2630,7 @@ fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2630,7 +2630,7 @@ fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2630 | fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void { | 2630 | fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 2631 | const pt = self.pt; | 2631 | const pt = self.pt; |
| 2632 | const zcu = pt.zcu; | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2634 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2635 | const error_union_ty = self.typeOf(ty_op.operand); | 2635 | const error_union_ty = self.typeOf(ty_op.operand); |
| 2636 | const payload_ty = error_union_ty.errorUnionPayload(zcu); | 2636 | const payload_ty = error_union_ty.errorUnionPayload(zcu); |
| ... | @@ -2645,7 +2645,7 @@ fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2645,7 +2645,7 @@ fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 2645 | fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { | 2645 | fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2646 | const pt = self.pt; | 2646 | const pt = self.pt; |
| 2647 | const zcu = pt.zcu; | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2649 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2650 | const error_union_ty = ty_op.ty.toType(); | 2650 | const error_union_ty = ty_op.ty.toType(); |
| 2651 | const payload_ty = error_union_ty.errorUnionPayload(zcu); | 2651 | const payload_ty = error_union_ty.errorUnionPayload(zcu); |
| ... | @@ -2659,14 +2659,14 @@ fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2659,14 +2659,14 @@ fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2659 | 2659 | ||
| 2660 | /// T to E!T | 2660 | /// T to E!T |
| 2661 | fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else return self.fail("TODO implement wrap errunion payload for {}", .{self.target.cpu.arch}); | 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 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 2664 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 2665 | } | 2665 | } |
| 2666 | 2666 | ||
| 2667 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { | 2667 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { |
| 2668 | const pt = self.pt; | 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 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2670 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2671 | const optional_ty = self.typeOfIndex(inst); | 2671 | const optional_ty = self.typeOfIndex(inst); |
| 2672 | 2672 | ||
| ... | @@ -4670,7 +4670,7 @@ fn trunc( | ... | @@ -4670,7 +4670,7 @@ fn trunc( |
| 4670 | defer if (lock) |reg| self.register_manager.unlockReg(reg); | 4670 | defer if (lock) |reg| self.register_manager.unlockReg(reg); |
| 4671 | 4671 | ||
| 4672 | const dest_reg = if (maybe_inst) |inst| blk: { | 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 | if (operand == .register and self.reuseOperand(inst, ty_op.operand, 0, operand)) { | 4675 | if (operand == .register and self.reuseOperand(inst, ty_op.operand, 0, operand)) { |
| 4676 | break :blk operand_reg; | 4676 | break :blk operand_reg; |
src/codegen/sparc64/bits.zig+31-31| ... | @@ -15,7 +15,7 @@ pub const Register = enum(u6) { | ... | @@ -15,7 +15,7 @@ pub const Register = enum(u6) { |
| 15 | // zig fmt: on | 15 | // zig fmt: on |
| 16 | 16 | ||
| 17 | pub fn id(reg: Register) u5 { | 17 | pub fn id(reg: Register) u5 { |
| 18 | return @truncate(@intFromEnum(reg)); | 18 | return @truncate(@backingInt(reg)); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | pub fn enc(reg: Register) u5 { | 21 | pub fn enc(reg: Register) u5 { |
| ... | @@ -95,9 +95,9 @@ pub const FloatingPointRegister = enum(u7) { | ... | @@ -95,9 +95,9 @@ pub const FloatingPointRegister = enum(u7) { |
| 95 | 95 | ||
| 96 | pub fn id(self: FloatingPointRegister) u6 { | 96 | pub fn id(self: FloatingPointRegister) u6 { |
| 97 | return switch (self.size()) { | 97 | return switch (self.size()) { |
| 98 | 32 => @as(u6, @truncate(@intFromEnum(self))), | 98 | 32 => @as(u6, @truncate(@backingInt(self))), |
| 99 | 64 => @as(u6, @truncate((@intFromEnum(self) - 32) * 2)), | 99 | 64 => @as(u6, @truncate((@backingInt(self) - 32) * 2)), |
| 100 | 128 => @as(u6, @truncate((@intFromEnum(self) - 64) * 4)), | 100 | 128 => @as(u6, @truncate((@backingInt(self) - 64) * 4)), |
| 101 | else => unreachable, | 101 | else => unreachable, |
| 102 | }; | 102 | }; |
| 103 | } | 103 | } |
| ... | @@ -113,7 +113,7 @@ pub const FloatingPointRegister = enum(u7) { | ... | @@ -113,7 +113,7 @@ pub const FloatingPointRegister = enum(u7) { |
| 113 | 113 | ||
| 114 | /// Returns the bit-width of the register. | 114 | /// Returns the bit-width of the register. |
| 115 | pub fn size(self: FloatingPointRegister) u8 { | 115 | pub fn size(self: FloatingPointRegister) u8 { |
| 116 | return switch (@intFromEnum(self)) { | 116 | return switch (@backingInt(self)) { |
| 117 | 0...31 => 32, | 117 | 0...31 => 32, |
| 118 | 32...63 => 64, | 118 | 32...63 => 64, |
| 119 | 64...79 => 128, | 119 | 64...79 => 128, |
| ... | @@ -695,8 +695,8 @@ pub const Instruction = union(enum) { | ... | @@ -695,8 +695,8 @@ pub const Instruction = union(enum) { |
| 695 | /// Encodes the condition into the instruction bit pattern. | 695 | /// Encodes the condition into the instruction bit pattern. |
| 696 | pub fn enc(cond: Condition) u4 { | 696 | pub fn enc(cond: Condition) u4 { |
| 697 | return switch (cond) { | 697 | return switch (cond) { |
| 698 | .icond => |c| @intFromEnum(c), | 698 | .icond => |c| @backingInt(c), |
| 699 | .fcond => |c| @intFromEnum(c), | 699 | .fcond => |c| @backingInt(c), |
| 700 | }; | 700 | }; |
| 701 | } | 701 | } |
| 702 | 702 | ||
| ... | @@ -802,8 +802,8 @@ pub const Instruction = union(enum) { | ... | @@ -802,8 +802,8 @@ pub const Instruction = union(enum) { |
| 802 | // Discard the last two bits since those are implicitly zero. | 802 | // Discard the last two bits since those are implicitly zero. |
| 803 | const udisp_truncated = @as(u19, @truncate(udisp >> 2)); | 803 | const udisp_truncated = @as(u19, @truncate(udisp >> 2)); |
| 804 | 804 | ||
| 805 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | 805 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); |
| 806 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | 806 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); |
| 807 | return Instruction{ | 807 | return Instruction{ |
| 808 | .format_2c = .{ | 808 | .format_2c = .{ |
| 809 | .a = @intFromBool(annul), | 809 | .a = @intFromBool(annul), |
| ... | @@ -831,7 +831,7 @@ pub const Instruction = union(enum) { | ... | @@ -831,7 +831,7 @@ pub const Instruction = union(enum) { |
| 831 | return Instruction{ | 831 | return Instruction{ |
| 832 | .format_2d = .{ | 832 | .format_2d = .{ |
| 833 | .a = @intFromBool(annul), | 833 | .a = @intFromBool(annul), |
| 834 | .rcond = @intFromEnum(rcond), | 834 | .rcond = @backingInt(rcond), |
| 835 | .op2 = op2, | 835 | .op2 = op2, |
| 836 | .p = @intFromBool(pt), | 836 | .p = @intFromBool(pt), |
| 837 | .rs1 = rs1.enc(), | 837 | .rs1 = rs1.enc(), |
| ... | @@ -890,7 +890,7 @@ pub const Instruction = union(enum) { | ... | @@ -890,7 +890,7 @@ pub const Instruction = union(enum) { |
| 890 | .rd = rd.enc(), | 890 | .rd = rd.enc(), |
| 891 | .op3 = op3, | 891 | .op3 = op3, |
| 892 | .rs1 = rs1.enc(), | 892 | .rs1 = rs1.enc(), |
| 893 | .rcond = @intFromEnum(rcond), | 893 | .rcond = @backingInt(rcond), |
| 894 | .rs2 = rs2.enc(), | 894 | .rs2 = rs2.enc(), |
| 895 | }, | 895 | }, |
| 896 | }; | 896 | }; |
| ... | @@ -902,7 +902,7 @@ pub const Instruction = union(enum) { | ... | @@ -902,7 +902,7 @@ pub const Instruction = union(enum) { |
| 902 | .rd = rd.enc(), | 902 | .rd = rd.enc(), |
| 903 | .op3 = op3, | 903 | .op3 = op3, |
| 904 | .rs1 = rs1.enc(), | 904 | .rs1 = rs1.enc(), |
| 905 | .rcond = @intFromEnum(rcond), | 905 | .rcond = @backingInt(rcond), |
| 906 | .simm10 = @as(u10, @bitCast(imm)), | 906 | .simm10 = @as(u10, @bitCast(imm)), |
| 907 | }, | 907 | }, |
| 908 | }; | 908 | }; |
| ... | @@ -933,7 +933,7 @@ pub const Instruction = union(enum) { | ... | @@ -933,7 +933,7 @@ pub const Instruction = union(enum) { |
| 933 | .rd = rd.enc(), | 933 | .rd = rd.enc(), |
| 934 | .op3 = op3, | 934 | .op3 = op3, |
| 935 | .rs1 = rs1.enc(), | 935 | .rs1 = rs1.enc(), |
| 936 | .imm_asi = @intFromEnum(asi), | 936 | .imm_asi = @backingInt(asi), |
| 937 | .rs2 = rs2.enc(), | 937 | .rs2 = rs2.enc(), |
| 938 | }, | 938 | }, |
| 939 | }; | 939 | }; |
| ... | @@ -955,7 +955,7 @@ pub const Instruction = union(enum) { | ... | @@ -955,7 +955,7 @@ pub const Instruction = union(enum) { |
| 955 | .rd = rd.enc(), | 955 | .rd = rd.enc(), |
| 956 | .op3 = op3, | 956 | .op3 = op3, |
| 957 | .rs1 = rs1.enc(), | 957 | .rs1 = rs1.enc(), |
| 958 | .x = @intFromEnum(sw), | 958 | .x = @backingInt(sw), |
| 959 | .rs2 = rs2.enc(), | 959 | .rs2 = rs2.enc(), |
| 960 | }, | 960 | }, |
| 961 | }; | 961 | }; |
| ... | @@ -994,8 +994,8 @@ pub const Instruction = union(enum) { | ... | @@ -994,8 +994,8 @@ pub const Instruction = union(enum) { |
| 994 | }; | 994 | }; |
| 995 | } | 995 | } |
| 996 | fn format3o(op: u2, op3: u6, opf: u9, ccr: CCR, rs1: Register, rs2: Register) Instruction { | 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)); | 997 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); |
| 998 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | 998 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); |
| 999 | return Instruction{ | 999 | return Instruction{ |
| 1000 | .format_3o = .{ | 1000 | .format_3o = .{ |
| 1001 | .op = op, | 1001 | .op = op, |
| ... | @@ -1050,8 +1050,8 @@ pub const Instruction = union(enum) { | ... | @@ -1050,8 +1050,8 @@ pub const Instruction = union(enum) { |
| 1050 | } | 1050 | } |
| 1051 | 1051 | ||
| 1052 | fn format4a(op3: u6, ccr: CCR, rs1: Register, rs2: Register, rd: Register) Instruction { | 1052 | fn format4a(op3: u6, ccr: CCR, rs1: Register, rs2: Register, rd: Register) Instruction { |
| 1053 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | 1053 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); |
| 1054 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | 1054 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); |
| 1055 | return Instruction{ | 1055 | return Instruction{ |
| 1056 | .format_4a = .{ | 1056 | .format_4a = .{ |
| 1057 | .rd = rd.enc(), | 1057 | .rd = rd.enc(), |
| ... | @@ -1065,8 +1065,8 @@ pub const Instruction = union(enum) { | ... | @@ -1065,8 +1065,8 @@ pub const Instruction = union(enum) { |
| 1065 | } | 1065 | } |
| 1066 | 1066 | ||
| 1067 | fn format4b(op3: u6, ccr: CCR, rs1: Register, imm: i11, rd: Register) Instruction { | 1067 | fn format4b(op3: u6, ccr: CCR, rs1: Register, imm: i11, rd: Register) Instruction { |
| 1068 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | 1068 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); |
| 1069 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | 1069 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); |
| 1070 | return Instruction{ | 1070 | return Instruction{ |
| 1071 | .format_4b = .{ | 1071 | .format_4b = .{ |
| 1072 | .rd = rd.enc(), | 1072 | .rd = rd.enc(), |
| ... | @@ -1080,9 +1080,9 @@ pub const Instruction = union(enum) { | ... | @@ -1080,9 +1080,9 @@ pub const Instruction = union(enum) { |
| 1080 | } | 1080 | } |
| 1081 | 1081 | ||
| 1082 | fn format4c(op3: u6, cond: Condition, ccr: CCR, rs2: Register, rd: Register) Instruction { | 1082 | fn format4c(op3: u6, cond: Condition, ccr: CCR, rs2: Register, rd: Register) Instruction { |
| 1083 | const ccr_cc2 = @as(u1, @truncate(@intFromEnum(ccr) >> 2)); | 1083 | const ccr_cc2 = @as(u1, @truncate(@backingInt(ccr) >> 2)); |
| 1084 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | 1084 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); |
| 1085 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | 1085 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); |
| 1086 | return Instruction{ | 1086 | return Instruction{ |
| 1087 | .format_4c = .{ | 1087 | .format_4c = .{ |
| 1088 | .rd = rd.enc(), | 1088 | .rd = rd.enc(), |
| ... | @@ -1097,9 +1097,9 @@ pub const Instruction = union(enum) { | ... | @@ -1097,9 +1097,9 @@ pub const Instruction = union(enum) { |
| 1097 | } | 1097 | } |
| 1098 | 1098 | ||
| 1099 | fn format4d(op3: u6, cond: Condition, ccr: CCR, imm: i11, rd: Register) Instruction { | 1099 | fn format4d(op3: u6, cond: Condition, ccr: CCR, imm: i11, rd: Register) Instruction { |
| 1100 | const ccr_cc2 = @as(u1, @truncate(@intFromEnum(ccr) >> 2)); | 1100 | const ccr_cc2 = @as(u1, @truncate(@backingInt(ccr) >> 2)); |
| 1101 | const ccr_cc1 = @as(u1, @truncate(@intFromEnum(ccr) >> 1)); | 1101 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); |
| 1102 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | 1102 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); |
| 1103 | return Instruction{ | 1103 | return Instruction{ |
| 1104 | .format_4d = .{ | 1104 | .format_4d = .{ |
| 1105 | .rd = rd.enc(), | 1105 | .rd = rd.enc(), |
| ... | @@ -1114,8 +1114,8 @@ pub const Instruction = union(enum) { | ... | @@ -1114,8 +1114,8 @@ pub const Instruction = union(enum) { |
| 1114 | } | 1114 | } |
| 1115 | 1115 | ||
| 1116 | fn format4e(op3: u6, ccr: CCR, rs1: Register, rd: Register, sw_trap: u7) Instruction { | 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)); | 1117 | const ccr_cc1 = @as(u1, @truncate(@backingInt(ccr) >> 1)); |
| 1118 | const ccr_cc0 = @as(u1, @truncate(@intFromEnum(ccr))); | 1118 | const ccr_cc0 = @as(u1, @truncate(@backingInt(ccr))); |
| 1119 | return Instruction{ | 1119 | return Instruction{ |
| 1120 | .format_4e = .{ | 1120 | .format_4e = .{ |
| 1121 | .rd = rd.enc(), | 1121 | .rd = rd.enc(), |
| ... | @@ -1141,7 +1141,7 @@ pub const Instruction = union(enum) { | ... | @@ -1141,7 +1141,7 @@ pub const Instruction = union(enum) { |
| 1141 | .rd = rd.enc(), | 1141 | .rd = rd.enc(), |
| 1142 | .op3 = op3, | 1142 | .op3 = op3, |
| 1143 | .rs1 = rs1.enc(), | 1143 | .rs1 = rs1.enc(), |
| 1144 | .rcond = @intFromEnum(rcond), | 1144 | .rcond = @backingInt(rcond), |
| 1145 | .opf_low = opf_low, | 1145 | .opf_low = opf_low, |
| 1146 | .rs2 = rs2.enc(), | 1146 | .rs2 = rs2.enc(), |
| 1147 | }, | 1147 | }, |
| ... | @@ -1467,8 +1467,8 @@ pub const Instruction = union(enum) { | ... | @@ -1467,8 +1467,8 @@ pub const Instruction = union(enum) { |
| 1467 | pub fn trap(comptime s2: type, cond: ICondition, ccr: CCR, rs1: Register, rs2: s2) Instruction { | 1467 | pub fn trap(comptime s2: type, cond: ICondition, ccr: CCR, rs1: Register, rs2: s2) Instruction { |
| 1468 | // Tcc instructions abuse the rd field to store the conditionals. | 1468 | // Tcc instructions abuse the rd field to store the conditionals. |
| 1469 | return switch (s2) { | 1469 | return switch (s2) { |
| 1470 | Register => format4a(0b11_1010, ccr, rs1, rs2, @as(Register, @enumFromInt(@intFromEnum(cond)))), | 1470 | Register => format4a(0b11_1010, ccr, rs1, rs2, @as(Register, @fromBackingInt(@intCast(@backingInt(cond))))), |
| 1471 | u7 => format4e(0b11_1010, ccr, rs1, @as(Register, @enumFromInt(@intFromEnum(cond))), rs2), | 1471 | u7 => format4e(0b11_1010, ccr, rs1, @as(Register, @fromBackingInt(@intCast(@backingInt(cond)))), rs2), |
| 1472 | else => unreachable, | 1472 | else => unreachable, |
| 1473 | }; | 1473 | }; |
| 1474 | } | 1474 | } |
src/codegen/spirv/Assembler.zig+10-10| ... | @@ -267,7 +267,7 @@ fn processTypeInstruction(ass: *Assembler) !AsmValue { | ... | @@ -267,7 +267,7 @@ fn processTypeInstruction(ass: *Assembler) !AsmValue { |
| 267 | break :blk result_id; | 267 | break :blk result_id; |
| 268 | }, | 268 | }, |
| 269 | .OpTypePointer => blk: { | 269 | .OpTypePointer => blk: { |
| 270 | const storage_class: StorageClass = @enumFromInt(operands[1].value); | 270 | const storage_class: StorageClass = @fromBackingInt(@intCast(operands[1].value)); |
| 271 | const child_type = try ass.resolveRefId(operands[2].ref_id); | 271 | const child_type = try ass.resolveRefId(operands[2].ref_id); |
| 272 | const result_id = cg.allocId(); | 272 | const result_id = cg.allocId(); |
| 273 | try section.emit(cg.gpa, .OpTypePointer, .{ | 273 | try section.emit(cg.gpa, .OpTypePointer, .{ |
| ... | @@ -290,12 +290,12 @@ fn processTypeInstruction(ass: *Assembler) !AsmValue { | ... | @@ -290,12 +290,12 @@ fn processTypeInstruction(ass: *Assembler) !AsmValue { |
| 290 | try section.emit(gpa, .OpTypeImage, .{ | 290 | try section.emit(gpa, .OpTypeImage, .{ |
| 291 | .id_result = result_id, | 291 | .id_result = result_id, |
| 292 | .sampled_type = sampled_type, | 292 | .sampled_type = sampled_type, |
| 293 | .dim = @enumFromInt(operands[2].value), | 293 | .dim = @fromBackingInt(@intCast(operands[2].value)), |
| 294 | .depth = operands[3].literal32, | 294 | .depth = operands[3].literal32, |
| 295 | .arrayed = operands[4].literal32, | 295 | .arrayed = operands[4].literal32, |
| 296 | .ms = operands[5].literal32, | 296 | .ms = operands[5].literal32, |
| 297 | .sampled = operands[6].literal32, | 297 | .sampled = operands[6].literal32, |
| 298 | .image_format = @enumFromInt(operands[7].value), | 298 | .image_format = @fromBackingInt(@intCast(operands[7].value)), |
| 299 | }); | 299 | }); |
| 300 | break :blk result_id; | 300 | break :blk result_id; |
| 301 | }, | 301 | }, |
| ... | @@ -350,7 +350,7 @@ fn processGenericInstruction(ass: *Assembler) !?AsmValue { | ... | @@ -350,7 +350,7 @@ fn processGenericInstruction(ass: *Assembler) !?AsmValue { |
| 350 | .OpEntryPoint => unreachable, | 350 | .OpEntryPoint => unreachable, |
| 351 | .OpExecutionMode, .OpExecutionModeId => &cg.sections.execution_modes, | 351 | .OpExecutionMode, .OpExecutionModeId => &cg.sections.execution_modes, |
| 352 | .OpVariable => section: { | 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 | if (storage_class == .function) break :section &ass.cg.prologue; | 354 | if (storage_class == .function) break :section &ass.cg.prologue; |
| 355 | maybe_spv_decl_index = try cg.allocDecl(.global); | 355 | maybe_spv_decl_index = try cg.allocDecl(.global); |
| 356 | if (!target.cpu.has(.spirv, .v1_4) and storage_class != .input and storage_class != .output) { | 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,7 +404,7 @@ fn processGenericInstruction(ass: *Assembler) !?AsmValue { |
| 404 | } | 404 | } |
| 405 | 405 | ||
| 406 | const actual_word_count = section.instructions.items.len - first_word; | 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 | switch (ass.inst.opcode) { | 409 | switch (ass.inst.opcode) { |
| 410 | .OpKill, | 410 | .OpKill, |
| ... | @@ -487,7 +487,7 @@ fn processSpecConstVector(ass: *Assembler) !?AsmValue { | ... | @@ -487,7 +487,7 @@ fn processSpecConstVector(ass: *Assembler) !?AsmValue { |
| 487 | }; | 487 | }; |
| 488 | try annotations.emitRaw(gpa, .OpDecorate, 3); | 488 | try annotations.emitRaw(gpa, .OpDecorate, 3); |
| 489 | annotations.writeOperand(Id, elem_id); | 489 | annotations.writeOperand(Id, elem_id); |
| 490 | annotations.writeWord(@intFromEnum(spec.Decoration.spec_id)); | 490 | annotations.writeWord(@backingInt(spec.Decoration.spec_id)); |
| 491 | annotations.writeWord(spec_id_word); | 491 | annotations.writeWord(spec_id_word); |
| 492 | } | 492 | } |
| 493 | 493 | ||
| ... | @@ -561,7 +561,7 @@ fn parseInstruction(ass: *Assembler) !void { | ... | @@ -561,7 +561,7 @@ fn parseInstruction(ass: *Assembler) !void { |
| 561 | }; | 561 | }; |
| 562 | 562 | ||
| 563 | const inst = spec.InstructionSet.core.instructions()[index]; | 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 | const expected_operands = inst.operands; | 566 | const expected_operands = inst.operands; |
| 567 | // This is a loop because the result-id is not always the first operand. | 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,16 +855,16 @@ fn parseContextDependentNumber(ass: *Assembler) !void { |
| 855 | var offset: usize = 0; | 855 | var offset: usize = 0; |
| 856 | while (offset < words.len) { | 856 | while (offset < words.len) { |
| 857 | const word_count = words[offset] >> 16; | 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 | defer offset += word_count; | 859 | defer offset += word_count; |
| 860 | if (word_count == 0) break; | 860 | if (word_count == 0) break; |
| 861 | switch (opcode) { | 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 | const width: u16 = @intCast(words[offset + 2]); | 863 | const width: u16 = @intCast(words[offset + 2]); |
| 864 | const signedness: std.lang.Signedness = if (words[offset + 3] == 0) .unsigned else .signed; | 864 | const signedness: std.lang.Signedness = if (words[offset + 3] == 0) .unsigned else .signed; |
| 865 | return ass.parseContextDependentInt(signedness, width); | 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 | const bits = words[offset + 2]; | 868 | const bits = words[offset + 2]; |
| 869 | return switch (bits) { | 869 | return switch (bits) { |
| 870 | 16 => ass.parseContextDependentFloat(16), | 870 | 16 => ass.parseContextDependentFloat(16), |
src/codegen/spirv/CodeGen.zig+89-89| ... | @@ -432,11 +432,11 @@ pub fn addEntryPointDeps( | ... | @@ -432,11 +432,11 @@ pub fn addEntryPointDeps( |
| 432 | const decl = cg.declPtr(decl_index); | 432 | const decl = cg.declPtr(decl_index); |
| 433 | const deps = cg.decl_deps.items[decl.begin_dep..decl.end_dep]; | 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 | return; | 436 | return; |
| 437 | } | 437 | } |
| 438 | 438 | ||
| 439 | seen.set(@intFromEnum(decl_index)); | 439 | seen.set(@backingInt(decl_index)); |
| 440 | 440 | ||
| 441 | if (decl.kind == .global) { | 441 | if (decl.kind == .global) { |
| 442 | try interface.append(cg.gpa, decl.result_id); | 442 | try interface.append(cg.gpa, decl.result_id); |
| ... | @@ -778,11 +778,11 @@ pub fn allocDecl(cg: *CodeGen, kind: Decl.Kind) !Decl.Index { | ... | @@ -778,11 +778,11 @@ pub fn allocDecl(cg: *CodeGen, kind: Decl.Kind) !Decl.Index { |
| 778 | .result_id = cg.allocId(), | 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 | pub fn declPtr(cg: *CodeGen, index: Decl.Index) *Decl { | 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 | pub fn debugName(cg: *CodeGen, target: Id, name: []const u8) !void { | 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,7 +1054,7 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void { |
| 1054 | .id_result_type = ptr_ty_id, | 1054 | .id_result_type = ptr_ty_id, |
| 1055 | .id_result = result_id, | 1055 | .id_result = result_id, |
| 1056 | .set = try cg.importInstructionSet(.zig), | 1056 | .set = try cg.importInstructionSet(.zig), |
| 1057 | .instruction = .{ .inst = @intFromEnum(spec.Zig.InvocationGlobal) }, | 1057 | .instruction = .{ .inst = @backingInt(spec.Zig.InvocationGlobal) }, |
| 1058 | .id_ref_4 = &.{initializer_id}, | 1058 | .id_ref_4 = &.{initializer_id}, |
| 1059 | }); | 1059 | }); |
| 1060 | }, | 1060 | }, |
| ... | @@ -1269,14 +1269,14 @@ fn resolveUav(cg: *CodeGen, val: InternPool.Index) !Id { | ... | @@ -1269,14 +1269,14 @@ fn resolveUav(cg: *CodeGen, val: InternPool.Index) !Id { |
| 1269 | try cg.sections.functions.append(gpa, cg.prologue); | 1269 | try cg.sections.functions.append(gpa, cg.prologue); |
| 1270 | try cg.sections.functions.append(gpa, cg.body); | 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 | const fn_decl_ptr_ty_id = try cg.ptrType(ty_id, .function); | 1274 | const fn_decl_ptr_ty_id = try cg.ptrType(ty_id, .function); |
| 1275 | try cg.sections.globals.emit(gpa, .OpExtInst, .{ | 1275 | try cg.sections.globals.emit(gpa, .OpExtInst, .{ |
| 1276 | .id_result_type = fn_decl_ptr_ty_id, | 1276 | .id_result_type = fn_decl_ptr_ty_id, |
| 1277 | .id_result = result_id, | 1277 | .id_result = result_id, |
| 1278 | .set = try cg.importInstructionSet(.zig), | 1278 | .set = try cg.importInstructionSet(.zig), |
| 1279 | .instruction = .{ .inst = @intFromEnum(spec.Zig.InvocationGlobal) }, | 1279 | .instruction = .{ .inst = @backingInt(spec.Zig.InvocationGlobal) }, |
| 1280 | .id_ref_4 = &.{initializer_id}, | 1280 | .id_ref_4 = &.{initializer_id}, |
| 1281 | }); | 1281 | }); |
| 1282 | } | 1282 | } |
| ... | @@ -2760,7 +2760,7 @@ const Temporary = struct { | ... | @@ -2760,7 +2760,7 @@ const Temporary = struct { |
| 2760 | // If the value is a scalar, then this is a no-op. | 2760 | // If the value is a scalar, then this is a no-op. |
| 2761 | if (!temp.ty.isVector(zcu)) { | 2761 | if (!temp.ty.isVector(zcu)) { |
| 2762 | return switch (temp.value) { | 2762 | return switch (temp.value) { |
| 2763 | .singleton => |id| .{ .base = @intFromEnum(id), .len = 1 }, | 2763 | .singleton => |id| .{ .base = @backingInt(id), .len = 1 }, |
| 2764 | .exploded_vector => |range| range, | 2764 | .exploded_vector => |range| range, |
| 2765 | }; | 2765 | }; |
| 2766 | } | 2766 | } |
| ... | @@ -3367,7 +3367,7 @@ const CompositeInt = struct { | ... | @@ -3367,7 +3367,7 @@ const CompositeInt = struct { |
| 3367 | .id_result_type = limb_ty_id, | 3367 | .id_result_type = limb_ty_id, |
| 3368 | .id_result = hi, | 3368 | .id_result = hi, |
| 3369 | .set = set, | 3369 | .set = set, |
| 3370 | .instruction = .{ .inst = @intFromEnum(spec.OpenClOpcode.u_mul_hi) }, | 3370 | .instruction = .{ .inst = @backingInt(spec.OpenClOpcode.u_mul_hi) }, |
| 3371 | .id_ref_4 = &.{ ci.limbs[i], other.limbs[j] }, | 3371 | .id_ref_4 = &.{ ci.limbs[i], other.limbs[j] }, |
| 3372 | }); | 3372 | }); |
| 3373 | }, | 3373 | }, |
| ... | @@ -3805,7 +3805,7 @@ const UnaryOp = enum { | ... | @@ -3805,7 +3805,7 @@ const UnaryOp = enum { |
| 3805 | 3805 | ||
| 3806 | pub fn extInstOpcode(op: UnaryOp, target: *const std.Target) ?u32 { | 3806 | pub fn extInstOpcode(op: UnaryOp, target: *const std.Target) ?u32 { |
| 3807 | return switch (target.os.tag) { | 3807 | return switch (target.os.tag) { |
| 3808 | .opencl => @intFromEnum(@as(spec.OpenClOpcode, switch (op) { | 3808 | .opencl => @backingInt(@as(spec.OpenClOpcode, switch (op) { |
| 3809 | .i_abs => .s_abs, | 3809 | .i_abs => .s_abs, |
| 3810 | .f_abs => .fabs, | 3810 | .f_abs => .fabs, |
| 3811 | .clz => .clz, | 3811 | .clz => .clz, |
| ... | @@ -3828,7 +3828,7 @@ const UnaryOp = enum { | ... | @@ -3828,7 +3828,7 @@ const UnaryOp = enum { |
| 3828 | // Note: We'll need to check these for floating point accuracy | 3828 | // Note: We'll need to check these for floating point accuracy |
| 3829 | // Vulkan does not put tight requirements on these, for correction | 3829 | // Vulkan does not put tight requirements on these, for correction |
| 3830 | // we might want to emulate them at some point. | 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 | .i_abs => .SAbs, | 3832 | .i_abs => .SAbs, |
| 3833 | .f_abs => .FAbs, | 3833 | .f_abs => .FAbs, |
| 3834 | .floor => .Floor, | 3834 | .floor => .Floor, |
| ... | @@ -3970,7 +3970,7 @@ fn buildWideMul( | ... | @@ -3970,7 +3970,7 @@ fn buildWideMul( |
| 3970 | .id_result_type = arith_op_ty_id, | 3970 | .id_result_type = arith_op_ty_id, |
| 3971 | .id_result = overflow_results.at(i), | 3971 | .id_result = overflow_results.at(i), |
| 3972 | .set = set, | 3972 | .set = set, |
| 3973 | .instruction = .{ .inst = @intFromEnum(overflow_inst) }, | 3973 | .instruction = .{ .inst = @backingInt(overflow_inst) }, |
| 3974 | .id_ref_4 = &.{ lhs_op.at(i), rhs_op.at(i) }, | 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,7 +4355,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) Error!void { |
| 4355 | return; | 4355 | return; |
| 4356 | 4356 | ||
| 4357 | const air_tags = cg.air.instructions.items(.tag); | 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 | // zig fmt: off | 4359 | // zig fmt: off |
| 4360 | .add, .add_wrap, .add_optimized => try cg.airArithOp(inst, .OpFAdd, .OpIAdd, .OpIAdd), | 4360 | .add, .add_wrap, .add_optimized => try cg.airArithOp(inst, .OpFAdd, .OpIAdd, .OpIAdd), |
| 4361 | .sub, .sub_wrap, .sub_optimized => try cg.airArithOp(inst, .OpFSub, .OpISub, .OpISub), | 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,7 +4535,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) Error!void { |
| 4535 | } | 4535 | } |
| 4536 | 4536 | ||
| 4537 | fn airBinOpSimple(cg: *CodeGen, inst: Air.Inst.Index, op: Opcode) !?Id { | 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 | const lhs = try cg.temporary(bin_op.lhs); | 4539 | const lhs = try cg.temporary(bin_op.lhs); |
| 4540 | const rhs = try cg.temporary(bin_op.rhs); | 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,7 +4546,7 @@ fn airBinOpSimple(cg: *CodeGen, inst: Air.Inst.Index, op: Opcode) !?Id { |
| 4546 | const BitwiseOp = enum { bit_and, bit_or, xor }; | 4546 | const BitwiseOp = enum { bit_and, bit_or, xor }; |
| 4547 | 4547 | ||
| 4548 | fn airBitwiseOp(cg: *CodeGen, inst: Air.Inst.Index, op: BitwiseOp) !?Id { | 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 | const lhs = try cg.temporary(bin_op.lhs); | 4550 | const lhs = try cg.temporary(bin_op.lhs); |
| 4551 | const rhs = try cg.temporary(bin_op.rhs); | 4551 | const rhs = try cg.temporary(bin_op.rhs); |
| 4552 | const info = cg.arithmeticTypeInfo(lhs.ty); | 4552 | const info = cg.arithmeticTypeInfo(lhs.ty); |
| ... | @@ -4587,7 +4587,7 @@ fn airBitwiseOp(cg: *CodeGen, inst: Air.Inst.Index, op: BitwiseOp) !?Id { | ... | @@ -4587,7 +4587,7 @@ fn airBitwiseOp(cg: *CodeGen, inst: Air.Inst.Index, op: BitwiseOp) !?Id { |
| 4587 | 4587 | ||
| 4588 | fn airShift(cg: *CodeGen, inst: Air.Inst.Index, unsigned: Opcode, signed: Opcode) !?Id { | 4588 | fn airShift(cg: *CodeGen, inst: Air.Inst.Index, unsigned: Opcode, signed: Opcode) !?Id { |
| 4589 | const zcu = cg.zcu; | 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 | const base = try cg.temporary(bin_op.lhs); | 4592 | const base = try cg.temporary(bin_op.lhs); |
| 4593 | const shift = try cg.temporary(bin_op.rhs); | 4593 | const shift = try cg.temporary(bin_op.rhs); |
| ... | @@ -4661,7 +4661,7 @@ const MinMax = enum { | ... | @@ -4661,7 +4661,7 @@ const MinMax = enum { |
| 4661 | info: ArithmeticTypeInfo, | 4661 | info: ArithmeticTypeInfo, |
| 4662 | ) u32 { | 4662 | ) u32 { |
| 4663 | return switch (target.os.tag) { | 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 | .float => switch (op) { | 4665 | .float => switch (op) { |
| 4666 | .min => .fmin, | 4666 | .min => .fmin, |
| 4667 | .max => .fmax, | 4667 | .max => .fmax, |
| ... | @@ -4678,7 +4678,7 @@ const MinMax = enum { | ... | @@ -4678,7 +4678,7 @@ const MinMax = enum { |
| 4678 | }, | 4678 | }, |
| 4679 | .bool => unreachable, | 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 | .float => switch (op) { | 4682 | .float => switch (op) { |
| 4683 | .min => .FMin, | 4683 | .min => .FMin, |
| 4684 | .max => .FMax, | 4684 | .max => .FMax, |
| ... | @@ -4701,7 +4701,7 @@ const MinMax = enum { | ... | @@ -4701,7 +4701,7 @@ const MinMax = enum { |
| 4701 | }; | 4701 | }; |
| 4702 | 4702 | ||
| 4703 | fn airMinMax(cg: *CodeGen, inst: Air.Inst.Index, op: MinMax) !?Id { | 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 | const lhs = try cg.temporary(bin_op.lhs); | 4706 | const lhs = try cg.temporary(bin_op.lhs); |
| 4707 | const rhs = try cg.temporary(bin_op.rhs); | 4707 | const rhs = try cg.temporary(bin_op.rhs); |
| ... | @@ -4781,7 +4781,7 @@ fn normalize(cg: *CodeGen, value: Temporary, info: ArithmeticTypeInfo) !Temporar | ... | @@ -4781,7 +4781,7 @@ fn normalize(cg: *CodeGen, value: Temporary, info: ArithmeticTypeInfo) !Temporar |
| 4781 | } | 4781 | } |
| 4782 | 4782 | ||
| 4783 | fn airDivFloor(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const lhs = try cg.temporary(bin_op.lhs); | 4786 | const lhs = try cg.temporary(bin_op.lhs); |
| 4787 | const rhs = try cg.temporary(bin_op.rhs); | 4787 | const rhs = try cg.temporary(bin_op.rhs); |
| ... | @@ -4822,7 +4822,7 @@ fn airDivFloor(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -4822,7 +4822,7 @@ fn airDivFloor(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 4822 | } | 4822 | } |
| 4823 | 4823 | ||
| 4824 | fn airDivTrunc(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const lhs = try cg.temporary(bin_op.lhs); | 4826 | const lhs = try cg.temporary(bin_op.lhs); |
| 4827 | const rhs = try cg.temporary(bin_op.rhs); | 4827 | const rhs = try cg.temporary(bin_op.rhs); |
| 4828 | const info = cg.arithmeticTypeInfo(lhs.ty); | 4828 | const info = cg.arithmeticTypeInfo(lhs.ty); |
| ... | @@ -4848,7 +4848,7 @@ fn airDivTrunc(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -4848,7 +4848,7 @@ fn airDivTrunc(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 4848 | } | 4848 | } |
| 4849 | 4849 | ||
| 4850 | fn airUnOpSimple(cg: *CodeGen, inst: Air.Inst.Index, op: UnaryOp) !?Id { | 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 | const operand = try cg.temporary(un_op); | 4852 | const operand = try cg.temporary(un_op); |
| 4853 | const result = try cg.buildUnary(op, operand); | 4853 | const result = try cg.buildUnary(op, operand); |
| 4854 | return try result.materialize(cg); | 4854 | return try result.materialize(cg); |
| ... | @@ -4861,7 +4861,7 @@ fn airArithOp( | ... | @@ -4861,7 +4861,7 @@ fn airArithOp( |
| 4861 | comptime sop: Opcode, | 4861 | comptime sop: Opcode, |
| 4862 | comptime uop: Opcode, | 4862 | comptime uop: Opcode, |
| 4863 | ) !?Id { | 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 | const lhs = try cg.temporary(bin_op.lhs); | 4865 | const lhs = try cg.temporary(bin_op.lhs); |
| 4866 | const rhs = try cg.temporary(bin_op.rhs); | 4866 | const rhs = try cg.temporary(bin_op.rhs); |
| 4867 | const info = cg.arithmeticTypeInfo(lhs.ty); | 4867 | const info = cg.arithmeticTypeInfo(lhs.ty); |
| ... | @@ -4898,7 +4898,7 @@ fn airArithOp( | ... | @@ -4898,7 +4898,7 @@ fn airArithOp( |
| 4898 | fn airAbs(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 4898 | fn airAbs(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 4899 | const zcu = cg.zcu; | 4899 | const zcu = cg.zcu; |
| 4900 | const target = zcu.getTarget(); | 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 | const value = try cg.temporary(ty_op.operand); | 4902 | const value = try cg.temporary(ty_op.operand); |
| 4903 | // Note: operand_ty may be signed, while ty is always unsigned. | 4903 | // Note: operand_ty may be signed, while ty is always unsigned. |
| 4904 | const result_ty = cg.typeOfIndex(inst); | 4904 | const result_ty = cg.typeOfIndex(inst); |
| ... | @@ -4970,7 +4970,7 @@ fn airAddSubOverflow( | ... | @@ -4970,7 +4970,7 @@ fn airAddSubOverflow( |
| 4970 | 4970 | ||
| 4971 | _ = s_opcode; | 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 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 4974 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 4975 | const lhs = try cg.temporary(extra.lhs); | 4975 | const lhs = try cg.temporary(extra.lhs); |
| 4976 | const rhs = try cg.temporary(extra.rhs); | 4976 | const rhs = try cg.temporary(extra.rhs); |
| ... | @@ -5087,7 +5087,7 @@ fn airAddSubOverflow( | ... | @@ -5087,7 +5087,7 @@ fn airAddSubOverflow( |
| 5087 | fn airMulOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 5087 | fn airMulOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5088 | const pt = cg.pt; | 5088 | const pt = cg.pt; |
| 5089 | const gpa = cg.gpa; | 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 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 5091 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5092 | const lhs = try cg.temporary(extra.lhs); | 5092 | const lhs = try cg.temporary(extra.lhs); |
| 5093 | const rhs = try cg.temporary(extra.rhs); | 5093 | const rhs = try cg.temporary(extra.rhs); |
| ... | @@ -5416,7 +5416,7 @@ fn airMulOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -5416,7 +5416,7 @@ fn airMulOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5416 | fn airShlOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 5416 | fn airShlOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5417 | const zcu = cg.zcu; | 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 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 5420 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5421 | 5421 | ||
| 5422 | const base = try cg.temporary(extra.lhs); | 5422 | const base = try cg.temporary(extra.lhs); |
| ... | @@ -5451,7 +5451,7 @@ fn airShlOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -5451,7 +5451,7 @@ fn airShlOverflow(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5451 | } | 5451 | } |
| 5452 | 5452 | ||
| 5453 | fn airMulAdd(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const extra = cg.air.extraData(Air.Bin, pl_op.payload).data; | 5455 | const extra = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 5456 | 5456 | ||
| 5457 | const a = try cg.temporary(extra.lhs); | 5457 | const a = try cg.temporary(extra.lhs); |
| ... | @@ -5479,10 +5479,10 @@ fn airMulAdd(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -5479,10 +5479,10 @@ fn airMulAdd(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5479 | 5479 | ||
| 5480 | const set = try cg.importExtendedSet(); | 5480 | const set = try cg.importExtendedSet(); |
| 5481 | const opcode: u32 = switch (target.os.tag) { | 5481 | const opcode: u32 = switch (target.os.tag) { |
| 5482 | .opencl => @intFromEnum(spec.OpenClOpcode.fma), | 5482 | .opencl => @backingInt(spec.OpenClOpcode.fma), |
| 5483 | // NOTE: Vulkan's FMA does not meet Zig's nor OpenCL's precision guarantees and needs | 5483 | // NOTE: Vulkan's FMA does not meet Zig's nor OpenCL's precision guarantees and needs |
| 5484 | // to be emulated. | 5484 | // to be emulated. |
| 5485 | .vulkan, .opengl => @intFromEnum(spec.GlslOpcode.Fma), | 5485 | .vulkan, .opengl => @backingInt(spec.GlslOpcode.Fma), |
| 5486 | else => unreachable, | 5486 | else => unreachable, |
| 5487 | }; | 5487 | }; |
| 5488 | 5488 | ||
| ... | @@ -5504,7 +5504,7 @@ fn airClzCtz(cg: *CodeGen, inst: Air.Inst.Index, op: UnaryOp) !?Id { | ... | @@ -5504,7 +5504,7 @@ fn airClzCtz(cg: *CodeGen, inst: Air.Inst.Index, op: UnaryOp) !?Id { |
| 5504 | if (cg.liveness.isUnused(inst)) return null; | 5504 | if (cg.liveness.isUnused(inst)) return null; |
| 5505 | 5505 | ||
| 5506 | const zcu = cg.zcu; | 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 | const operand = try cg.temporary(ty_op.operand); | 5508 | const operand = try cg.temporary(ty_op.operand); |
| 5509 | 5509 | ||
| 5510 | const scalar_result_ty = cg.typeOfIndex(inst).scalarType(zcu); | 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,7 +5526,7 @@ fn airClzCtz(cg: *CodeGen, inst: Air.Inst.Index, op: UnaryOp) !?Id { |
| 5526 | } | 5526 | } |
| 5527 | 5527 | ||
| 5528 | fn airSelect(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const extra = cg.air.extraData(Air.Bin, pl_op.payload).data; | 5530 | const extra = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 5531 | const pred = try cg.temporary(pl_op.operand); | 5531 | const pred = try cg.temporary(pl_op.operand); |
| 5532 | const a = try cg.temporary(extra.lhs); | 5532 | const a = try cg.temporary(extra.lhs); |
| ... | @@ -5537,7 +5537,7 @@ fn airSelect(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -5537,7 +5537,7 @@ fn airSelect(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5537 | } | 5537 | } |
| 5538 | 5538 | ||
| 5539 | fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const operand_id = try cg.resolve(ty_op.operand); | 5542 | const operand_id = try cg.resolve(ty_op.operand); |
| 5543 | const result_ty = cg.typeOfIndex(inst); | 5543 | const result_ty = cg.typeOfIndex(inst); |
| ... | @@ -5547,7 +5547,7 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -5547,7 +5547,7 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5547 | 5547 | ||
| 5548 | fn airReduce(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 5548 | fn airReduce(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5549 | const zcu = cg.zcu; | 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 | const operand = try cg.resolve(reduce.operand); | 5551 | const operand = try cg.resolve(reduce.operand); |
| 5552 | const operand_ty = cg.typeOf(reduce.operand); | 5552 | const operand_ty = cg.typeOf(reduce.operand); |
| 5553 | const scalar_ty = operand_ty.scalarType(zcu); | 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,7 +5763,7 @@ fn ptrAdd(cg: *CodeGen, result_ty: Type, ptr_ty: Type, ptr_id: Id, offset_id: Id |
| 5763 | } | 5763 | } |
| 5764 | 5764 | ||
| 5765 | fn airPtrAdd(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 5767 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5768 | const ptr_id = try cg.resolve(bin_op.lhs); | 5768 | const ptr_id = try cg.resolve(bin_op.lhs); |
| 5769 | const offset_id = try cg.resolve(bin_op.rhs); | 5769 | const offset_id = try cg.resolve(bin_op.rhs); |
| ... | @@ -5774,7 +5774,7 @@ fn airPtrAdd(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -5774,7 +5774,7 @@ fn airPtrAdd(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 5774 | } | 5774 | } |
| 5775 | 5775 | ||
| 5776 | fn airPtrSub(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 5778 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5779 | const ptr_id = try cg.resolve(bin_op.lhs); | 5779 | const ptr_id = try cg.resolve(bin_op.lhs); |
| 5780 | const ptr_ty = cg.typeOf(bin_op.lhs); | 5780 | const ptr_ty = cg.typeOf(bin_op.lhs); |
| ... | @@ -5979,7 +5979,7 @@ fn airCmp( | ... | @@ -5979,7 +5979,7 @@ fn airCmp( |
| 5979 | inst: Air.Inst.Index, | 5979 | inst: Air.Inst.Index, |
| 5980 | comptime op: std.math.CompareOperator, | 5980 | comptime op: std.math.CompareOperator, |
| 5981 | ) !?Id { | 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 | const lhs = try cg.temporary(bin_op.lhs); | 5983 | const lhs = try cg.temporary(bin_op.lhs); |
| 5984 | const rhs = try cg.temporary(bin_op.rhs); | 5984 | const rhs = try cg.temporary(bin_op.rhs); |
| 5985 | 5985 | ||
| ... | @@ -5988,7 +5988,7 @@ fn airCmp( | ... | @@ -5988,7 +5988,7 @@ fn airCmp( |
| 5988 | } | 5988 | } |
| 5989 | 5989 | ||
| 5990 | fn airVectorCmp(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const vec_cmp = cg.air.extraData(Air.VectorCmp, ty_pl.payload).data; | 5992 | const vec_cmp = cg.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 5993 | const lhs = try cg.temporary(vec_cmp.lhs); | 5993 | const lhs = try cg.temporary(vec_cmp.lhs); |
| 5994 | const rhs = try cg.temporary(vec_cmp.rhs); | 5994 | const rhs = try cg.temporary(vec_cmp.rhs); |
| ... | @@ -6126,7 +6126,7 @@ fn bitCast( | ... | @@ -6126,7 +6126,7 @@ fn bitCast( |
| 6126 | } | 6126 | } |
| 6127 | 6127 | ||
| 6128 | fn airBitCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const operand_ty = cg.typeOf(ty_op.operand); | 6130 | const operand_ty = cg.typeOf(ty_op.operand); |
| 6131 | const result_ty = cg.typeOfIndex(inst); | 6131 | const result_ty = cg.typeOfIndex(inst); |
| 6132 | if (operand_ty.toIntern() == .bool_type) { | 6132 | if (operand_ty.toIntern() == .bool_type) { |
| ... | @@ -6145,7 +6145,7 @@ fn airBitCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6145,7 +6145,7 @@ fn airBitCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6145 | } | 6145 | } |
| 6146 | 6146 | ||
| 6147 | fn airIntCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const src = try cg.temporary(ty_op.operand); | 6149 | const src = try cg.temporary(ty_op.operand); |
| 6150 | const dst_ty = cg.typeOfIndex(inst); | 6150 | const dst_ty = cg.typeOfIndex(inst); |
| 6151 | 6151 | ||
| ... | @@ -6391,7 +6391,7 @@ fn intFromPtr(cg: *CodeGen, operand_id: Id) !Id { | ... | @@ -6391,7 +6391,7 @@ fn intFromPtr(cg: *CodeGen, operand_id: Id) !Id { |
| 6391 | 6391 | ||
| 6392 | fn airFloatFromInt(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 6392 | fn airFloatFromInt(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6393 | const gpa = cg.gpa; | 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 | const operand_ty = cg.typeOf(ty_op.operand); | 6395 | const operand_ty = cg.typeOf(ty_op.operand); |
| 6396 | const operand_id = try cg.resolve(ty_op.operand); | 6396 | const operand_id = try cg.resolve(ty_op.operand); |
| 6397 | const result_ty = cg.typeOfIndex(inst); | 6397 | const result_ty = cg.typeOfIndex(inst); |
| ... | @@ -6415,7 +6415,7 @@ fn airFloatFromInt(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6415,7 +6415,7 @@ fn airFloatFromInt(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6415 | 6415 | ||
| 6416 | fn airIntFromFloat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 6416 | fn airIntFromFloat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6417 | const gpa = cg.gpa; | 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 | const operand_id = try cg.resolve(ty_op.operand); | 6419 | const operand_id = try cg.resolve(ty_op.operand); |
| 6420 | const result_ty = cg.typeOfIndex(inst); | 6420 | const result_ty = cg.typeOfIndex(inst); |
| 6421 | const result_info = cg.arithmeticTypeInfo(result_ty); | 6421 | const result_info = cg.arithmeticTypeInfo(result_ty); |
| ... | @@ -6437,7 +6437,7 @@ fn airIntFromFloat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6437,7 +6437,7 @@ fn airIntFromFloat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6437 | } | 6437 | } |
| 6438 | 6438 | ||
| 6439 | fn airFloatCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const operand = try cg.temporary(ty_op.operand); | 6441 | const operand = try cg.temporary(ty_op.operand); |
| 6442 | const dest_ty = cg.typeOfIndex(inst); | 6442 | const dest_ty = cg.typeOfIndex(inst); |
| 6443 | const result = try cg.buildConvert(dest_ty, operand); | 6443 | const result = try cg.buildConvert(dest_ty, operand); |
| ... | @@ -6445,7 +6445,7 @@ fn airFloatCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6445,7 +6445,7 @@ fn airFloatCast(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6445 | } | 6445 | } |
| 6446 | 6446 | ||
| 6447 | fn airNot(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const operand = try cg.temporary(ty_op.operand); | 6449 | const operand = try cg.temporary(ty_op.operand); |
| 6450 | const result_ty = cg.typeOfIndex(inst); | 6450 | const result_ty = cg.typeOfIndex(inst); |
| 6451 | const info = cg.arithmeticTypeInfo(result_ty); | 6451 | const info = cg.arithmeticTypeInfo(result_ty); |
| ... | @@ -6473,7 +6473,7 @@ fn airNot(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6473,7 +6473,7 @@ fn airNot(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6473 | 6473 | ||
| 6474 | fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 6474 | fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6475 | const zcu = cg.zcu; | 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 | const array_ptr_ty = cg.typeOf(ty_op.operand); | 6477 | const array_ptr_ty = cg.typeOf(ty_op.operand); |
| 6478 | const array_ty = array_ptr_ty.childType(zcu); | 6478 | const array_ty = array_ptr_ty.childType(zcu); |
| 6479 | const slice_ty = cg.typeOfIndex(inst); | 6479 | const slice_ty = cg.typeOfIndex(inst); |
| ... | @@ -6496,7 +6496,7 @@ fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6496,7 +6496,7 @@ fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6496 | } | 6496 | } |
| 6497 | 6497 | ||
| 6498 | fn airSlice(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 6500 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6501 | const ptr_id = try cg.resolve(bin_op.lhs); | 6501 | const ptr_id = try cg.resolve(bin_op.lhs); |
| 6502 | const len_id = try cg.resolve(bin_op.rhs); | 6502 | const len_id = try cg.resolve(bin_op.rhs); |
| ... | @@ -6511,7 +6511,7 @@ fn airAggregateInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6511,7 +6511,7 @@ fn airAggregateInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6511 | const zcu = cg.zcu; | 6511 | const zcu = cg.zcu; |
| 6512 | const ip = &zcu.intern_pool; | 6512 | const ip = &zcu.intern_pool; |
| 6513 | const target = cg.zcu.getTarget(); | 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 | const result_ty = cg.typeOfIndex(inst); | 6515 | const result_ty = cg.typeOfIndex(inst); |
| 6516 | const len: usize = @intCast(result_ty.arrayLen(zcu)); | 6516 | const len: usize = @intCast(result_ty.arrayLen(zcu)); |
| 6517 | const elements: []const Air.Inst.Ref = @ptrCast(cg.air.extra.items[ty_pl.payload..][0..len]); | 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,7 +6645,7 @@ fn sliceOrArrayPtr(cg: *CodeGen, operand_id: Id, ty: Type) !Id { |
| 6645 | } | 6645 | } |
| 6646 | 6646 | ||
| 6647 | fn airMemcpy(cg: *CodeGen, inst: Air.Inst.Index) !void { | 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 | const dest_slice = try cg.resolve(bin_op.lhs); | 6649 | const dest_slice = try cg.resolve(bin_op.lhs); |
| 6650 | const src_slice = try cg.resolve(bin_op.rhs); | 6650 | const src_slice = try cg.resolve(bin_op.rhs); |
| 6651 | const dest_ty = cg.typeOf(bin_op.lhs); | 6651 | const dest_ty = cg.typeOf(bin_op.lhs); |
| ... | @@ -6675,7 +6675,7 @@ fn airMemmove(cg: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -6675,7 +6675,7 @@ fn airMemmove(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 6675 | } | 6675 | } |
| 6676 | 6676 | ||
| 6677 | fn airSliceField(cg: *CodeGen, inst: Air.Inst.Index, field: u32) !?Id { | 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 | const field_ty = cg.typeOfIndex(inst); | 6679 | const field_ty = cg.typeOfIndex(inst); |
| 6680 | const operand_id = try cg.resolve(ty_op.operand); | 6680 | const operand_id = try cg.resolve(ty_op.operand); |
| 6681 | return try cg.extractField(field_ty, operand_id, field); | 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,7 +6683,7 @@ fn airSliceField(cg: *CodeGen, inst: Air.Inst.Index, field: u32) !?Id { |
| 6683 | 6683 | ||
| 6684 | fn airSpirvRuntimeArrayLen(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 6684 | fn airSpirvRuntimeArrayLen(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6685 | const gpa = cg.gpa; | 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 | const extra = cg.air.extraData(Air.StructField, ty_pl.payload).data; | 6687 | const extra = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 6688 | const struct_ptr_id = try cg.resolve(extra.struct_operand); | 6688 | const struct_ptr_id = try cg.resolve(extra.struct_operand); |
| 6689 | const u32_ty_id = try cg.intType(.unsigned, 32); | 6689 | const u32_ty_id = try cg.intType(.unsigned, 32); |
| ... | @@ -6699,7 +6699,7 @@ fn airSpirvRuntimeArrayLen(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6699,7 +6699,7 @@ fn airSpirvRuntimeArrayLen(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6699 | 6699 | ||
| 6700 | fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 6700 | fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6701 | const zcu = cg.zcu; | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 6703 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6704 | const slice_ty = cg.typeOf(bin_op.lhs); | 6704 | const slice_ty = cg.typeOf(bin_op.lhs); |
| 6705 | if (!slice_ty.isVolatilePtr(zcu) and cg.liveness.isUnused(inst)) return null; | 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,7 +6716,7 @@ fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6716 | 6716 | ||
| 6717 | fn airSliceElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 6717 | fn airSliceElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6718 | const zcu = cg.zcu; | 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 | const slice_ty = cg.typeOf(bin_op.lhs); | 6720 | const slice_ty = cg.typeOf(bin_op.lhs); |
| 6721 | if (!slice_ty.isVolatilePtr(zcu) and cg.liveness.isUnused(inst)) return null; | 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,7 +6749,7 @@ fn ptrElemPtr(cg: *CodeGen, ptr_ty: Type, ptr_id: Id, index_id: Id) !Id { |
| 6749 | 6749 | ||
| 6750 | fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 6750 | fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6751 | const zcu = cg.zcu; | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 6753 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6754 | const src_ptr_ty = cg.typeOf(bin_op.lhs); | 6754 | const src_ptr_ty = cg.typeOf(bin_op.lhs); |
| 6755 | const elem_ty = src_ptr_ty.childType(zcu); | 6755 | const elem_ty = src_ptr_ty.childType(zcu); |
| ... | @@ -6764,7 +6764,7 @@ fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6764,7 +6764,7 @@ fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6764 | fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 6764 | fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6765 | const gpa = cg.gpa; | 6765 | const gpa = cg.gpa; |
| 6766 | const zcu = cg.zcu; | 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 | const array_ty = cg.typeOf(bin_op.lhs); | 6768 | const array_ty = cg.typeOf(bin_op.lhs); |
| 6769 | const elem_ty = array_ty.childType(zcu); | 6769 | const elem_ty = array_ty.childType(zcu); |
| 6770 | const array_id = try cg.resolve(bin_op.lhs); | 6770 | const array_id = try cg.resolve(bin_op.lhs); |
| ... | @@ -6815,7 +6815,7 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6815,7 +6815,7 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6815 | 6815 | ||
| 6816 | fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 6816 | fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6817 | const zcu = cg.zcu; | 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 | const ptr_ty = cg.typeOf(bin_op.lhs); | 6819 | const ptr_ty = cg.typeOf(bin_op.lhs); |
| 6820 | const elem_ty = cg.typeOfIndex(inst); | 6820 | const elem_ty = cg.typeOfIndex(inst); |
| 6821 | const ptr_id = try cg.resolve(bin_op.lhs); | 6821 | const ptr_id = try cg.resolve(bin_op.lhs); |
| ... | @@ -6826,7 +6826,7 @@ fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6826,7 +6826,7 @@ fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6826 | 6826 | ||
| 6827 | fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) !void { | 6827 | fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 6828 | const zcu = cg.zcu; | 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 | const un_ptr_ty = cg.typeOf(bin_op.lhs); | 6830 | const un_ptr_ty = cg.typeOf(bin_op.lhs); |
| 6831 | const un_ty = un_ptr_ty.childType(zcu); | 6831 | const un_ty = un_ptr_ty.childType(zcu); |
| 6832 | const layout = cg.unionLayout(un_ty); | 6832 | const layout = cg.unionLayout(un_ty); |
| ... | @@ -6849,7 +6849,7 @@ fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -6849,7 +6849,7 @@ fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 6849 | } | 6849 | } |
| 6850 | 6850 | ||
| 6851 | fn airGetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const un_ty = cg.typeOf(ty_op.operand); | 6853 | const un_ty = cg.typeOf(ty_op.operand); |
| 6854 | 6854 | ||
| 6855 | const zcu = cg.zcu; | 6855 | const zcu = cg.zcu; |
| ... | @@ -6937,7 +6937,7 @@ fn unionInit( | ... | @@ -6937,7 +6937,7 @@ fn unionInit( |
| 6937 | fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 6937 | fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6938 | const zcu = cg.zcu; | 6938 | const zcu = cg.zcu; |
| 6939 | const ip = &zcu.intern_pool; | 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 | const extra = cg.air.extraData(Air.UnionInit, ty_pl.payload).data; | 6941 | const extra = cg.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 6942 | const ty = cg.typeOfIndex(inst); | 6942 | const ty = cg.typeOfIndex(inst); |
| 6943 | 6943 | ||
| ... | @@ -6953,7 +6953,7 @@ fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -6953,7 +6953,7 @@ fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6953 | fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 6953 | fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 6954 | const pt = cg.pt; | 6954 | const pt = cg.pt; |
| 6955 | const zcu = cg.zcu; | 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 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; | 6957 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 6958 | 6958 | ||
| 6959 | const object_ty = cg.typeOf(struct_field.struct_operand); | 6959 | const object_ty = cg.typeOf(struct_field.struct_operand); |
| ... | @@ -7058,7 +7058,7 @@ fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -7058,7 +7058,7 @@ fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7058 | fn airFieldParentPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 7058 | fn airFieldParentPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7059 | const zcu = cg.zcu; | 7059 | const zcu = cg.zcu; |
| 7060 | const target = zcu.getTarget(); | 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 | const extra = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 7062 | const extra = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 7063 | 7063 | ||
| 7064 | const parent_ptr_ty = ty_pl.ty.toType(); | 7064 | const parent_ptr_ty = ty_pl.ty.toType(); |
| ... | @@ -7190,7 +7190,7 @@ fn structFieldPtr( | ... | @@ -7190,7 +7190,7 @@ fn structFieldPtr( |
| 7190 | } | 7190 | } |
| 7191 | 7191 | ||
| 7192 | fn airStructFieldPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; | 7194 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 7195 | const struct_ptr = try cg.resolve(struct_field.struct_operand); | 7195 | const struct_ptr = try cg.resolve(struct_field.struct_operand); |
| 7196 | const struct_ptr_ty = cg.typeOf(struct_field.struct_operand); | 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,7 +7199,7 @@ fn airStructFieldPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7199 | } | 7199 | } |
| 7200 | 7200 | ||
| 7201 | fn airStructFieldPtrIndex(cg: *CodeGen, inst: Air.Inst.Index, field_index: u32) !?Id { | 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 | const struct_ptr = try cg.resolve(ty_op.operand); | 7203 | const struct_ptr = try cg.resolve(ty_op.operand); |
| 7204 | const struct_ptr_ty = cg.typeOf(ty_op.operand); | 7204 | const struct_ptr_ty = cg.typeOf(ty_op.operand); |
| 7205 | const result_ptr_ty = cg.typeOfIndex(inst); | 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,7 +7437,7 @@ fn lowerBlock(cg: *CodeGen, inst: Air.Inst.Index, body: []const Air.Inst.Index) |
| 7437 | assert(cg.block_stack.items.len > 0); | 7437 | assert(cg.block_stack.items.len > 0); |
| 7438 | 7438 | ||
| 7439 | // Check if the target of the branch was this current block. | 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 | const jump_to_this_block_id = cg.allocId(); | 7441 | const jump_to_this_block_id = cg.allocId(); |
| 7442 | const bool_ty_id = try cg.resolveType(.bool, .direct); | 7442 | const bool_ty_id = try cg.resolveType(.bool, .direct); |
| 7443 | try cg.body.emit(gpa, .OpIEqual, .{ | 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,7 +7506,7 @@ fn lowerBlock(cg: *CodeGen, inst: Air.Inst.Index, body: []const Air.Inst.Index) |
| 7506 | 7506 | ||
| 7507 | fn airBr(cg: *CodeGen, inst: Air.Inst.Index) !void { | 7507 | fn airBr(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7508 | const zcu = cg.zcu; | 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 | const operand_ty = cg.typeOf(br.operand); | 7510 | const operand_ty = cg.typeOf(br.operand); |
| 7511 | 7511 | ||
| 7512 | if (operand_ty.hasRuntimeBits(zcu)) { | 7512 | if (operand_ty.hasRuntimeBits(zcu)) { |
| ... | @@ -7515,7 +7515,7 @@ fn airBr(cg: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -7515,7 +7515,7 @@ fn airBr(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7515 | try cg.store(operand_ty, block_result_var_id, operand_id, .{}); | 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 | try cg.structuredBreak(next_block); | 7519 | try cg.structuredBreak(next_block); |
| 7520 | } | 7520 | } |
| 7521 | 7521 | ||
| ... | @@ -7611,7 +7611,7 @@ fn airLoop(cg: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -7611,7 +7611,7 @@ fn airLoop(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7611 | fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 7611 | fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7612 | const zcu = cg.zcu; | 7612 | const zcu = cg.zcu; |
| 7613 | const pt = cg.pt; | 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 | const ptr_ty = cg.typeOf(ty_op.operand); | 7615 | const ptr_ty = cg.typeOf(ty_op.operand); |
| 7616 | const ptr_info = ptr_ty.ptrInfo(zcu); | 7616 | const ptr_info = ptr_ty.ptrInfo(zcu); |
| 7617 | const elem_ty = cg.typeOfIndex(inst); | 7617 | const elem_ty = cg.typeOfIndex(inst); |
| ... | @@ -7655,7 +7655,7 @@ fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -7655,7 +7655,7 @@ fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7655 | try cg.resolveType(elem_ty, .indirect), | 7655 | try cg.resolveType(elem_ty, .indirect), |
| 7656 | cg.storageClass(ptr_info.flags.address_space), | 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 | return try cg.load(elem_ty, ptr_id, .{ | 7661 | return try cg.load(elem_ty, ptr_id, .{ |
| ... | @@ -7667,7 +7667,7 @@ fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -7667,7 +7667,7 @@ fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7667 | fn airStore(cg: *CodeGen, inst: Air.Inst.Index) !void { | 7667 | fn airStore(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7668 | const zcu = cg.zcu; | 7668 | const zcu = cg.zcu; |
| 7669 | const pt = cg.pt; | 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 | const ptr_ty = cg.typeOf(bin_op.lhs); | 7671 | const ptr_ty = cg.typeOf(bin_op.lhs); |
| 7672 | const ptr_info = ptr_ty.ptrInfo(zcu); | 7672 | const ptr_info = ptr_ty.ptrInfo(zcu); |
| 7673 | const elem_ty: Type = .fromInterned(ptr_info.child); | 7673 | const elem_ty: Type = .fromInterned(ptr_info.child); |
| ... | @@ -7729,7 +7729,7 @@ fn airStore(cg: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -7729,7 +7729,7 @@ fn airStore(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7729 | try cg.resolveType(elem_ty, .indirect), | 7729 | try cg.resolveType(elem_ty, .indirect), |
| 7730 | cg.storageClass(ptr_info.flags.address_space), | 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,7 +7742,7 @@ fn airStore(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7742 | fn airRet(cg: *CodeGen, inst: Air.Inst.Index) !void { | 7742 | fn airRet(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7743 | const gpa = cg.gpa; | 7743 | const gpa = cg.gpa; |
| 7744 | const zcu = cg.zcu; | 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 | const ret_ty = cg.typeOf(operand); | 7746 | const ret_ty = cg.typeOf(operand); |
| 7747 | if (!ret_ty.hasRuntimeBits(zcu)) { | 7747 | if (!ret_ty.hasRuntimeBits(zcu)) { |
| 7748 | const fn_info = zcu.typeToFunc(zcu.navValue(cg.owner_nav).typeOf(zcu)).?; | 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,7 +7764,7 @@ fn airRet(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7764 | fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) !void { | 7764 | fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7765 | const gpa = cg.gpa; | 7765 | const gpa = cg.gpa; |
| 7766 | const zcu = cg.zcu; | 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 | const ptr_ty = cg.typeOf(un_op); | 7768 | const ptr_ty = cg.typeOf(un_op); |
| 7769 | const ret_ty = ptr_ty.childType(zcu); | 7769 | const ret_ty = ptr_ty.childType(zcu); |
| 7770 | 7770 | ||
| ... | @@ -7856,7 +7856,7 @@ fn airTry(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -7856,7 +7856,7 @@ fn airTry(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7856 | 7856 | ||
| 7857 | fn airErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 7857 | fn airErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7858 | const zcu = cg.zcu; | 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 | const operand_id = try cg.resolve(ty_op.operand); | 7860 | const operand_id = try cg.resolve(ty_op.operand); |
| 7861 | const err_union_ty = cg.typeOf(ty_op.operand); | 7861 | const err_union_ty = cg.typeOf(ty_op.operand); |
| 7862 | const err_ty_id = try cg.resolveType(.anyerror, .direct); | 7862 | const err_ty_id = try cg.resolveType(.anyerror, .direct); |
| ... | @@ -7878,7 +7878,7 @@ fn airErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -7878,7 +7878,7 @@ fn airErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7878 | } | 7878 | } |
| 7879 | 7879 | ||
| 7880 | fn airErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const operand_id = try cg.resolve(ty_op.operand); | 7882 | const operand_id = try cg.resolve(ty_op.operand); |
| 7883 | const payload_ty = cg.typeOfIndex(inst); | 7883 | const payload_ty = cg.typeOfIndex(inst); |
| 7884 | const eu_layout = cg.errorUnionLayout(payload_ty); | 7884 | const eu_layout = cg.errorUnionLayout(payload_ty); |
| ... | @@ -7892,7 +7892,7 @@ fn airErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -7892,7 +7892,7 @@ fn airErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7892 | 7892 | ||
| 7893 | fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 7893 | fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7894 | const zcu = cg.zcu; | 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 | const err_union_ty = cg.typeOfIndex(inst); | 7896 | const err_union_ty = cg.typeOfIndex(inst); |
| 7897 | const payload_ty = err_union_ty.errorUnionPayload(zcu); | 7897 | const payload_ty = err_union_ty.errorUnionPayload(zcu); |
| 7898 | const operand_id = try cg.resolve(ty_op.operand); | 7898 | const operand_id = try cg.resolve(ty_op.operand); |
| ... | @@ -7917,7 +7917,7 @@ fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -7917,7 +7917,7 @@ fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7917 | } | 7917 | } |
| 7918 | 7918 | ||
| 7919 | fn airWrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 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 | const err_union_ty = cg.typeOfIndex(inst); | 7921 | const err_union_ty = cg.typeOfIndex(inst); |
| 7922 | const operand_id = try cg.resolve(ty_op.operand); | 7922 | const operand_id = try cg.resolve(ty_op.operand); |
| 7923 | const payload_ty = cg.typeOf(ty_op.operand); | 7923 | const payload_ty = cg.typeOf(ty_op.operand); |
| ... | @@ -7941,7 +7941,7 @@ fn airWrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -7941,7 +7941,7 @@ fn airWrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 7941 | 7941 | ||
| 7942 | fn airIsNull(cg: *CodeGen, inst: Air.Inst.Index, is_pointer: bool, pred: enum { is_null, is_non_null }) !?Id { | 7942 | fn airIsNull(cg: *CodeGen, inst: Air.Inst.Index, is_pointer: bool, pred: enum { is_null, is_non_null }) !?Id { |
| 7943 | const zcu = cg.zcu; | 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 | const operand_id = try cg.resolve(un_op); | 7945 | const operand_id = try cg.resolve(un_op); |
| 7946 | const operand_ty = cg.typeOf(un_op); | 7946 | const operand_ty = cg.typeOf(un_op); |
| 7947 | const optional_ty = if (is_pointer) operand_ty.childType(zcu) else operand_ty; | 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,7 +8018,7 @@ fn airIsNull(cg: *CodeGen, inst: Air.Inst.Index, is_pointer: bool, pred: enum { |
| 8018 | 8018 | ||
| 8019 | fn airIsErr(cg: *CodeGen, inst: Air.Inst.Index, pred: enum { is_err, is_non_err }) !?Id { | 8019 | fn airIsErr(cg: *CodeGen, inst: Air.Inst.Index, pred: enum { is_err, is_non_err }) !?Id { |
| 8020 | const zcu = cg.zcu; | 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 | const operand_id = try cg.resolve(un_op); | 8022 | const operand_id = try cg.resolve(un_op); |
| 8023 | const err_union_ty = cg.typeOf(un_op); | 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,7 +8056,7 @@ fn airIsErr(cg: *CodeGen, inst: Air.Inst.Index, pred: enum { is_err, is_non_err |
| 8056 | 8056 | ||
| 8057 | fn airUnwrapOptional(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 8057 | fn airUnwrapOptional(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8058 | const zcu = cg.zcu; | 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 | const operand_id = try cg.resolve(ty_op.operand); | 8060 | const operand_id = try cg.resolve(ty_op.operand); |
| 8061 | const optional_ty = cg.typeOf(ty_op.operand); | 8061 | const optional_ty = cg.typeOf(ty_op.operand); |
| 8062 | const payload_ty = cg.typeOfIndex(inst); | 8062 | const payload_ty = cg.typeOfIndex(inst); |
| ... | @@ -8072,7 +8072,7 @@ fn airUnwrapOptional(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -8072,7 +8072,7 @@ fn airUnwrapOptional(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8072 | 8072 | ||
| 8073 | fn airUnwrapOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 8073 | fn airUnwrapOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8074 | const zcu = cg.zcu; | 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 | const operand_id = try cg.resolve(ty_op.operand); | 8076 | const operand_id = try cg.resolve(ty_op.operand); |
| 8077 | const operand_ty = cg.typeOf(ty_op.operand); | 8077 | const operand_ty = cg.typeOf(ty_op.operand); |
| 8078 | const optional_ty = operand_ty.childType(zcu); | 8078 | const optional_ty = operand_ty.childType(zcu); |
| ... | @@ -8096,7 +8096,7 @@ fn airUnwrapOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -8096,7 +8096,7 @@ fn airUnwrapOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8096 | 8096 | ||
| 8097 | fn airSetOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 8097 | fn airSetOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8098 | const zcu = cg.zcu; | 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 | const ptr_ty = cg.typeOf(ty_op.operand); | 8101 | const ptr_ty = cg.typeOf(ty_op.operand); |
| 8102 | const ptr_id = try cg.resolve(ty_op.operand); | 8102 | const ptr_id = try cg.resolve(ty_op.operand); |
| ... | @@ -8129,7 +8129,7 @@ fn airSetOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -8129,7 +8129,7 @@ fn airSetOptionalPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8129 | 8129 | ||
| 8130 | fn airWrapOptional(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 8130 | fn airWrapOptional(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8131 | const zcu = cg.zcu; | 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 | const payload_ty = cg.typeOf(ty_op.operand); | 8133 | const payload_ty = cg.typeOf(ty_op.operand); |
| 8134 | 8134 | ||
| 8135 | assert(payload_ty.hasRuntimeBits(zcu)); | 8135 | assert(payload_ty.hasRuntimeBits(zcu)); |
| ... | @@ -8424,7 +8424,7 @@ fn airLoopSwitchBr(cg: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -8424,7 +8424,7 @@ fn airLoopSwitchBr(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 8424 | // switch_dispatch signals "continue the loop" by using this sentinel as the | 8424 | // switch_dispatch signals "continue the loop" by using this sentinel as the |
| 8425 | // next_block in structuredBreak. at switch_merge, a phi + comparison distinguishes | 8425 | // next_block in structuredBreak. at switch_merge, a phi + comparison distinguishes |
| 8426 | // dispatch (continue) from break (exit) | 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 | try cg.loop_switches.putNoClobber(gpa, inst, .{ | 8429 | try cg.loop_switches.putNoClobber(gpa, inst, .{ |
| 8430 | .cond_var = cond_var, | 8430 | .cond_var = cond_var, |
| ... | @@ -8627,7 +8627,7 @@ fn airLoopSwitchBr(cg: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -8627,7 +8627,7 @@ fn airLoopSwitchBr(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 8627 | } | 8627 | } |
| 8628 | 8628 | ||
| 8629 | fn airSwitchDispatch(cg: *CodeGen, inst: Air.Inst.Index) !void { | 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 | const loop_switch = cg.loop_switches.get(br.block_inst).?; | 8631 | const loop_switch = cg.loop_switches.get(br.block_inst).?; |
| 8632 | const cond_ty = cg.typeOf(br.operand); | 8632 | const cond_ty = cg.typeOf(br.operand); |
| 8633 | const operand = try cg.resolve(br.operand); | 8633 | const operand = try cg.resolve(br.operand); |
| ... | @@ -8643,7 +8643,7 @@ fn airUnreach(cg: *CodeGen) !void { | ... | @@ -8643,7 +8643,7 @@ fn airUnreach(cg: *CodeGen) !void { |
| 8643 | 8643 | ||
| 8644 | fn airDbgStmt(cg: *CodeGen, inst: Air.Inst.Index) !void { | 8644 | fn airDbgStmt(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 8645 | const zcu = cg.zcu; | 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 | const path = zcu.navFileScope(cg.owner_nav).sub_file_path; | 8647 | const path = zcu.navFileScope(cg.owner_nav).sub_file_path; |
| 8648 | 8648 | ||
| 8649 | if (zcu.comp.config.root_strip) return; | 8649 | if (zcu.comp.config.root_strip) return; |
| ... | @@ -8670,12 +8670,12 @@ fn airDbgInlineBlock(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | ... | @@ -8670,12 +8670,12 @@ fn airDbgInlineBlock(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8670 | } | 8670 | } |
| 8671 | 8671 | ||
| 8672 | fn airDbgVar(cg: *CodeGen, inst: Air.Inst.Index) !void { | 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 | const target_id = switch (try cg.resolvePtr(pl_op.operand)) { | 8674 | const target_id = switch (try cg.resolvePtr(pl_op.operand)) { |
| 8675 | .tracked => return, | 8675 | .tracked => return, |
| 8676 | .id => |id| id, | 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 | try cg.debugName(target_id, name.toSlice(cg.air)); | 8679 | try cg.debugName(target_id, name.toSlice(cg.air)); |
| 8680 | } | 8680 | } |
| 8681 | 8681 | ||
| ... | @@ -8944,7 +8944,7 @@ fn builtin3D( | ... | @@ -8944,7 +8944,7 @@ fn builtin3D( |
| 8944 | 8944 | ||
| 8945 | fn airWorkItemId(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 8945 | fn airWorkItemId(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8946 | if (cg.liveness.isUnused(inst)) return null; | 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 | const dimension = pl_op.payload; | 8948 | const dimension = pl_op.payload; |
| 8949 | return try cg.builtin3D(.u32, .local_invocation_id, dimension, 0); | 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,14 +8952,14 @@ fn airWorkItemId(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8952 | // TODO: this must be an OpConstant/OpSpec but even then the driver crashes. | 8952 | // TODO: this must be an OpConstant/OpSpec but even then the driver crashes. |
| 8953 | fn airWorkGroupSize(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 8953 | fn airWorkGroupSize(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8954 | if (cg.liveness.isUnused(inst)) return null; | 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 | const dimension = pl_op.payload; | 8956 | const dimension = pl_op.payload; |
| 8957 | return try cg.builtin3D(.u32, .workgroup_size, dimension, 0); | 8957 | return try cg.builtin3D(.u32, .workgroup_size, dimension, 0); |
| 8958 | } | 8958 | } |
| 8959 | 8959 | ||
| 8960 | fn airWorkGroupId(cg: *CodeGen, inst: Air.Inst.Index) !?Id { | 8960 | fn airWorkGroupId(cg: *CodeGen, inst: Air.Inst.Index) !?Id { |
| 8961 | if (cg.liveness.isUnused(inst)) return null; | 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 | const dimension = pl_op.payload; | 8963 | const dimension = pl_op.payload; |
| 8964 | return try cg.builtin3D(.u32, .workgroup_id, dimension, 0); | 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,7 +50,7 @@ pub fn emitRaw( |
| 50 | ) !void { | 50 | ) !void { |
| 51 | const word_count = 1 + operand_words; | 51 | const word_count = 1 + operand_words; |
| 52 | try section.instructions.ensureUnusedCapacity(allocator, word_count); | 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 | /// Write an entire instruction, including all operands | 56 | /// Write an entire instruction, including all operands |
| ... | @@ -70,7 +70,7 @@ pub fn emitAssumeCapacity( | ... | @@ -70,7 +70,7 @@ pub fn emitAssumeCapacity( |
| 70 | operands: opcode.Operands(), | 70 | operands: opcode.Operands(), |
| 71 | ) !void { | 71 | ) !void { |
| 72 | const word_count = instructionSize(opcode, operands); | 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 | section.writeOperands(opcode.Operands(), operands); | 74 | section.writeOperands(opcode.Operands(), operands); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| ... | @@ -82,7 +82,7 @@ pub fn emit( | ... | @@ -82,7 +82,7 @@ pub fn emit( |
| 82 | ) !void { | 82 | ) !void { |
| 83 | const word_count = instructionSize(opcode, operands); | 83 | const word_count = instructionSize(opcode, operands); |
| 84 | try section.instructions.ensureUnusedCapacity(allocator, word_count); | 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 | section.writeOperands(opcode.Operands(), operands); | 86 | section.writeOperands(opcode.Operands(), operands); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| ... | @@ -115,16 +115,16 @@ fn writeOperands(section: *Section, comptime Operands: type, operands: Operands) | ... | @@ -115,16 +115,16 @@ fn writeOperands(section: *Section, comptime Operands: type, operands: Operands) |
| 115 | pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand) void { | 115 | pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand) void { |
| 116 | switch (Operand) { | 116 | switch (Operand) { |
| 117 | spec.LiteralSpecConstantOpInteger => unreachable, | 117 | spec.LiteralSpecConstantOpInteger => unreachable, |
| 118 | spec.Id => section.writeWord(@intFromEnum(operand)), | 118 | spec.Id => section.writeWord(@backingInt(operand)), |
| 119 | spec.LiteralInteger => section.writeWord(operand), | 119 | spec.LiteralInteger => section.writeWord(operand), |
| 120 | spec.LiteralString => section.writeString(operand), | 120 | spec.LiteralString => section.writeString(operand), |
| 121 | spec.LiteralContextDependentNumber => section.writeContextDependentNumber(operand), | 121 | spec.LiteralContextDependentNumber => section.writeContextDependentNumber(operand), |
| 122 | spec.LiteralExtInstInteger => section.writeWord(operand.inst), | 122 | spec.LiteralExtInstInteger => section.writeWord(operand.inst), |
| 123 | spec.PairLiteralIntegerIdRef => section.writeWords(&.{ operand.value, @enumFromInt(operand.label) }), | 123 | spec.PairLiteralIntegerIdRef => section.writeWords(&.{ operand.value, @fromBackingInt(@intCast(operand.label)) }), |
| 124 | spec.PairIdRefLiteralInteger => section.writeWords(&.{ @intFromEnum(operand.target), operand.member }), | 124 | spec.PairIdRefLiteralInteger => section.writeWords(&.{ @backingInt(operand.target), operand.member }), |
| 125 | spec.PairIdRefIdRef => section.writeWords(&.{ @intFromEnum(operand[0]), @intFromEnum(operand[1]) }), | 125 | spec.PairIdRefIdRef => section.writeWords(&.{ @backingInt(operand[0]), @backingInt(operand[1]) }), |
| 126 | else => switch (@typeInfo(Operand)) { | 126 | else => switch (@typeInfo(Operand)) { |
| 127 | .@"enum" => section.writeWord(@intFromEnum(operand)), | 127 | .@"enum" => section.writeWord(@backingInt(operand)), |
| 128 | .optional => |info| if (operand) |child| section.writeOperand(info.child, child), | 128 | .optional => |info| if (operand) |child| section.writeOperand(info.child, child), |
| 129 | .pointer => |info| { | 129 | .pointer => |info| { |
| 130 | std.debug.assert(info.size == .slice); // Should be no other pointer types in the spec. | 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,7 +200,7 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand |
| 200 | fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operand) void { | 200 | fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operand) void { |
| 201 | return switch (operand) { | 201 | return switch (operand) { |
| 202 | inline else => |op, tag| { | 202 | inline else => |op, tag| { |
| 203 | section.writeWord(@intFromEnum(tag)); | 203 | section.writeWord(@backingInt(tag)); |
| 204 | section.writeOperands( | 204 | section.writeOperands( |
| 205 | @FieldType(Operand, @tagName(tag)), | 205 | @FieldType(Operand, @tagName(tag)), |
| 206 | op, | 206 | op, |
src/codegen/spirv/spec.zig+2-2| ... | @@ -21,7 +21,7 @@ pub const Id = enum(Word) { | ... | @@ -21,7 +21,7 @@ pub const Id = enum(Word) { |
| 21 | pub fn format(self: Id, writer: *std.Io.Writer) std.Io.Writer.Error!void { | 21 | pub fn format(self: Id, writer: *std.Io.Writer) std.Io.Writer.Error!void { |
| 22 | switch (self) { | 22 | switch (self) { |
| 23 | .none => try writer.writeAll("(none)"), | 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,7 +32,7 @@ pub const IdRange = struct { |
| 32 | 32 | ||
| 33 | pub fn at(range: IdRange, i: usize) Id { | 33 | pub fn at(range: IdRange, i: usize) Id { |
| 34 | std.debug.assert(i < range.len); | 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,7 +482,7 @@ fn processDeath(cg: *CodeGen, ref: Air.Inst.Ref) void { |
| 482 | if (value.local.value < reserved_indexes) { | 482 | if (value.local.value < reserved_indexes) { |
| 483 | return; // function arguments can never be re-used | 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 | value.local.references -= 1; // if this panics, a call to `reuseOperand` was forgotten by the developer | 486 | value.local.references -= 1; // if this panics, a call to `reuseOperand` was forgotten by the developer |
| 487 | if (value.local.references == 0) { | 487 | if (value.local.references == 0) { |
| 488 | value.free(cg); | 488 | value.free(cg); |
| ... | @@ -499,7 +499,7 @@ pub fn addTag(cg: *CodeGen, tag: Mir.Inst.Tag) error{OutOfMemory}!void { | ... | @@ -499,7 +499,7 @@ pub fn addTag(cg: *CodeGen, tag: Mir.Inst.Tag) error{OutOfMemory}!void { |
| 499 | 499 | ||
| 500 | pub fn addExtended(cg: *CodeGen, opcode: std.wasm.MiscOpcode) error{OutOfMemory}!void { | 500 | pub fn addExtended(cg: *CodeGen, opcode: std.wasm.MiscOpcode) error{OutOfMemory}!void { |
| 501 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); | 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 | try cg.addInst(.{ .tag = .misc_prefix, .data = .{ .payload = extra_index } }); | 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,7 +532,7 @@ pub fn addImm128(cg: *CodeGen, index: u32) error{OutOfMemory}!void { |
| 532 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); | 532 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); |
| 533 | // tag + 128bit value | 533 | // tag + 128bit value |
| 534 | try cg.mir_extra.ensureUnusedCapacity(cg.gpa, 5); | 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 | cg.mir_extra.appendSliceAssumeCapacity(@alignCast(mem.bytesAsSlice(u32, &simd_values))); | 536 | cg.mir_extra.appendSliceAssumeCapacity(@alignCast(mem.bytesAsSlice(u32, &simd_values))); |
| 537 | try cg.addInst(.{ .tag = .simd_prefix, .data = .{ .payload = extra_index } }); | 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,14 +555,14 @@ pub fn addMemArg(cg: *CodeGen, tag: Mir.Inst.Tag, mem_arg: Mir.MemArg) error{Out |
| 555 | /// Inserts an instruction from the 'atomics' feature which accesses wasm's linear memory dependent on the | 555 | /// Inserts an instruction from the 'atomics' feature which accesses wasm's linear memory dependent on the |
| 556 | /// given `tag`. | 556 | /// given `tag`. |
| 557 | pub fn addAtomicMemArg(cg: *CodeGen, tag: std.wasm.AtomicsOpcode, mem_arg: Mir.MemArg) error{OutOfMemory}!void { | 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 | _ = try cg.addExtra(mem_arg); | 559 | _ = try cg.addExtra(mem_arg); |
| 560 | try cg.addInst(.{ .tag = .atomics_prefix, .data = .{ .payload = extra_index } }); | 560 | try cg.addInst(.{ .tag = .atomics_prefix, .data = .{ .payload = extra_index } }); |
| 561 | } | 561 | } |
| 562 | 562 | ||
| 563 | /// Helper function to emit atomic mir opcodes. | 563 | /// Helper function to emit atomic mir opcodes. |
| 564 | pub fn addAtomicTag(cg: *CodeGen, tag: std.wasm.AtomicsOpcode) error{OutOfMemory}!void { | 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 | try cg.addInst(.{ .tag = .atomics_prefix, .data = .{ .payload = extra_index } }); | 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,7 +589,7 @@ fn addExtraAssumeCapacity(cg: *CodeGen, extra: anytype) error{OutOfMemory}!u32 { |
| 589 | i32 => @bitCast(@field(extra, field_name)), | 589 | i32 => @bitCast(@field(extra, field_name)), |
| 590 | InternPool.Index, | 590 | InternPool.Index, |
| 591 | InternPool.Nav.Index, | 591 | InternPool.Nav.Index, |
| 592 | => @intFromEnum(@field(extra, field_name)), | 592 | => @backingInt(@field(extra, field_name)), |
| 593 | else => @compileError("Unsupported field type " ++ @typeName(field_type)), | 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,7 +1304,7 @@ fn buildPointerOffset(cg: *CodeGen, ptr_value: WValue, offset: u64, action: enum |
| 1304 | fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 1304 | fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1305 | const zcu = cg.pt.zcu; | 1305 | const zcu = cg.pt.zcu; |
| 1306 | const air_tags = cg.air.instructions.items(.tag); | 1306 | const air_tags = cg.air.instructions.items(.tag); |
| 1307 | return switch (air_tags[@intFromEnum(inst)]) { | 1307 | return switch (air_tags[@backingInt(inst)]) { |
| 1308 | // No soft float legalizations are enabled. | 1308 | // No soft float legalizations are enabled. |
| 1309 | .legalize_compiler_rt_call => unreachable, | 1309 | .legalize_compiler_rt_call => unreachable, |
| 1310 | 1310 | ||
| ... | @@ -1312,7 +1312,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1312,7 +1312,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1312 | 1312 | ||
| 1313 | .legalize_vec_elem_val => cg.airArrayElemVal(inst), | 1313 | .legalize_vec_elem_val => cg.airArrayElemVal(inst), |
| 1314 | .legalize_vec_store_elem => { | 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 | const bin_op = cg.air.extraData(Air.Bin, pl_op.payload).data; | 1316 | const bin_op = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 1317 | const vec_ptr = try cg.resolveInst(pl_op.operand); | 1317 | const vec_ptr = try cg.resolveInst(pl_op.operand); |
| 1318 | const elem_idx = try cg.resolveInst(bin_op.lhs); | 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,7 +1345,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1345 | .div_floor, | 1345 | .div_floor, |
| 1346 | .div_ceil, | 1346 | .div_ceil, |
| 1347 | => |tag| { | 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 | const lhs = try cg.resolveInst(bin_op.lhs); | 1349 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 1350 | const rhs = try cg.resolveInst(bin_op.rhs); | 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,7 +1399,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1399 | } | 1399 | } |
| 1400 | }, | 1400 | }, |
| 1401 | .div_float => { | 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 | const lhs = try cg.resolveInst(bin_op.lhs); | 1403 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 1404 | const rhs = try cg.resolveInst(bin_op.rhs); | 1404 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 1405 | const ty = cg.typeOfIndex(inst); | 1405 | const ty = cg.typeOfIndex(inst); |
| ... | @@ -1412,7 +1412,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1412,7 +1412,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1412 | try cg.finishAir(inst, result, &.{ bin_op.lhs, bin_op.rhs }); | 1412 | try cg.finishAir(inst, result, &.{ bin_op.lhs, bin_op.rhs }); |
| 1413 | }, | 1413 | }, |
| 1414 | .abs => { | 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 | const operand = try cg.resolveInst(ty_op.operand); | 1416 | const operand = try cg.resolveInst(ty_op.operand); |
| 1417 | 1417 | ||
| 1418 | const ty = cg.typeOf(ty_op.operand); | 1418 | const ty = cg.typeOf(ty_op.operand); |
| ... | @@ -1433,7 +1433,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1433,7 +1433,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1433 | } | 1433 | } |
| 1434 | }, | 1434 | }, |
| 1435 | .mul_add => { | 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 | const bin_op = cg.air.extraData(Air.Bin, pl_op.payload).data; | 1437 | const bin_op = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 1438 | const addend = try cg.resolveInst(pl_op.operand); | 1438 | const addend = try cg.resolveInst(pl_op.operand); |
| 1439 | const lhs = try cg.resolveInst(bin_op.lhs); | 1439 | const lhs = try cg.resolveInst(bin_op.lhs); |
| ... | @@ -1453,7 +1453,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1453,7 +1453,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1453 | .mul_sat, | 1453 | .mul_sat, |
| 1454 | .shl_sat, | 1454 | .shl_sat, |
| 1455 | => |tag| { | 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 | const lhs = try cg.resolveInst(bin_op.lhs); | 1457 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 1458 | const rhs = try cg.resolveInst(bin_op.rhs); | 1458 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 1459 | const ty = cg.typeOfIndex(inst); | 1459 | const ty = cg.typeOfIndex(inst); |
| ... | @@ -1479,7 +1479,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1479,7 +1479,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1479 | .mul_with_overflow, | 1479 | .mul_with_overflow, |
| 1480 | .shl_with_overflow, | 1480 | .shl_with_overflow, |
| 1481 | => |tag| { | 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 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 1483 | const extra = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 1484 | 1484 | ||
| 1485 | const lhs = try cg.resolveInst(extra.lhs); | 1485 | const lhs = try cg.resolveInst(extra.lhs); |
| ... | @@ -1512,7 +1512,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1512,7 +1512,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1512 | }, | 1512 | }, |
| 1513 | 1513 | ||
| 1514 | .add_wrap, .sub_wrap, .mul_wrap, .shl => |tag| { | 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 | const lhs = try cg.resolveInst(bin_op.lhs); | 1516 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 1517 | const rhs = try cg.resolveInst(bin_op.rhs); | 1517 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 1518 | const ty = cg.typeOfIndex(inst); | 1518 | const ty = cg.typeOfIndex(inst); |
| ... | @@ -1535,7 +1535,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1535,7 +1535,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1535 | }, | 1535 | }, |
| 1536 | 1536 | ||
| 1537 | .bit_and, .bit_or, .xor, .shl_exact, .shr, .shr_exact => |tag| { | 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 | const lhs = try cg.resolveInst(bin_op.lhs); | 1539 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 1540 | const rhs = try cg.resolveInst(bin_op.rhs); | 1540 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 1541 | const ty = cg.typeOfIndex(inst); | 1541 | const ty = cg.typeOfIndex(inst); |
| ... | @@ -1558,7 +1558,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1558,7 +1558,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1558 | }, | 1558 | }, |
| 1559 | 1559 | ||
| 1560 | .not => { | 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 | const operand = try cg.resolveInst(ty_op.operand); | 1562 | const operand = try cg.resolveInst(ty_op.operand); |
| 1563 | const ty = cg.typeOf(ty_op.operand); | 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,7 +1581,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1581 | .union_from_enum => cg.airUnionFromEnum(inst), | 1581 | .union_from_enum => cg.airUnionFromEnum(inst), |
| 1582 | 1582 | ||
| 1583 | .int_cast => { | 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 | const dest_ty = ty_op.ty.toType(); | 1586 | const dest_ty = ty_op.ty.toType(); |
| 1587 | const operand = try cg.resolveInst(ty_op.operand); | 1587 | const operand = try cg.resolveInst(ty_op.operand); |
| ... | @@ -1609,7 +1609,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1609,7 +1609,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1609 | try cg.finishAir(inst, result, &.{ty_op.operand}); | 1609 | try cg.finishAir(inst, result, &.{ty_op.operand}); |
| 1610 | }, | 1610 | }, |
| 1611 | .trunc => { | 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 | const operand = try cg.resolveInst(ty_op.operand); | 1614 | const operand = try cg.resolveInst(ty_op.operand); |
| 1615 | const dest_ty = ty_op.ty.toType(); | 1615 | const dest_ty = ty_op.ty.toType(); |
| ... | @@ -1632,7 +1632,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1632,7 +1632,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1632 | }, | 1632 | }, |
| 1633 | 1633 | ||
| 1634 | .fptrunc, .fpext => |tag| { | 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 | const operand = try cg.resolveInst(ty_op.operand); | 1637 | const operand = try cg.resolveInst(ty_op.operand); |
| 1638 | const src_ty = cg.typeOf(ty_op.operand); | 1638 | const src_ty = cg.typeOf(ty_op.operand); |
| ... | @@ -1655,7 +1655,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1655,7 +1655,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1655 | }, | 1655 | }, |
| 1656 | 1656 | ||
| 1657 | .int_from_float => { | 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 | const operand = try cg.resolveInst(ty_op.operand); | 1659 | const operand = try cg.resolveInst(ty_op.operand); |
| 1660 | const src_ty = cg.typeOf(ty_op.operand); | 1660 | const src_ty = cg.typeOf(ty_op.operand); |
| 1661 | const dest_ty = cg.typeOfIndex(inst); | 1661 | const dest_ty = cg.typeOfIndex(inst); |
| ... | @@ -1668,7 +1668,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1668,7 +1668,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1668 | try cg.finishAir(inst, result, &.{ty_op.operand}); | 1668 | try cg.finishAir(inst, result, &.{ty_op.operand}); |
| 1669 | }, | 1669 | }, |
| 1670 | .float_from_int => { | 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 | const operand = try cg.resolveInst(ty_op.operand); | 1672 | const operand = try cg.resolveInst(ty_op.operand); |
| 1673 | const src_ty = cg.typeOf(ty_op.operand); | 1673 | const src_ty = cg.typeOf(ty_op.operand); |
| 1674 | const dest_ty = cg.typeOfIndex(inst); | 1674 | const dest_ty = cg.typeOfIndex(inst); |
| ... | @@ -1682,7 +1682,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1682,7 +1682,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1682 | }, | 1682 | }, |
| 1683 | 1683 | ||
| 1684 | .clz, .ctz, .popcount, .byte_swap, .bit_reverse => |tag| { | 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 | const operand = try cg.resolveInst(ty_op.operand); | 1686 | const operand = try cg.resolveInst(ty_op.operand); |
| 1687 | 1687 | ||
| 1688 | const ty = cg.typeOf(ty_op.operand); | 1688 | const ty = cg.typeOf(ty_op.operand); |
| ... | @@ -1704,7 +1704,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -1704,7 +1704,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1704 | }, | 1704 | }, |
| 1705 | 1705 | ||
| 1706 | .sqrt, .sin, .cos, .tan, .exp, .exp2, .log, .log2, .log10, .floor, .ceil, .round, .trunc_float, .neg => |tag| { | 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 | const operand = try cg.resolveInst(un_op); | 1708 | const operand = try cg.resolveInst(un_op); |
| 1709 | const ty = cg.typeOfIndex(inst); | 1709 | const ty = cg.typeOfIndex(inst); |
| 1710 | 1710 | ||
| ... | @@ -1935,7 +1935,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -1935,7 +1935,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 1935 | if (std.debug.runtime_safety and cg.air_bookkeeping < old_bookkeeping_value + 1) { | 1935 | if (std.debug.runtime_safety and cg.air_bookkeeping < old_bookkeeping_value + 1) { |
| 1936 | std.debug.panic("Missing call to `finishAir` in AIR instruction %{d} ('{t}')", .{ | 1936 | std.debug.panic("Missing call to `finishAir` in AIR instruction %{d} ('{t}')", .{ |
| 1937 | inst, | 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,7 +1943,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 1943 | 1943 | ||
| 1944 | fn airRet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 1944 | fn airRet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1945 | const zcu = cg.pt.zcu; | 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 | const operand = try cg.resolveInst(un_op); | 1947 | const operand = try cg.resolveInst(un_op); |
| 1948 | const fn_info = zcu.typeToFunc(zcu.navValue(cg.owner_nav).typeOf(zcu)).?; | 1948 | const fn_info = zcu.typeToFunc(zcu.navValue(cg.owner_nav).typeOf(zcu)).?; |
| 1949 | const ret_ty = Type.fromInterned(fn_info.return_type); | 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,7 +1999,7 @@ fn airRetPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 1999 | 1999 | ||
| 2000 | fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 2000 | fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2001 | const zcu = cg.pt.zcu; | 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 | const operand = try cg.resolveInst(un_op); | 2003 | const operand = try cg.resolveInst(un_op); |
| 2004 | const ret_ty = cg.typeOf(un_op).childType(zcu); | 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,12 +2174,12 @@ fn airVaStart(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2174 | } | 2174 | } |
| 2175 | 2175 | ||
| 2176 | fn airVaEnd(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | return cg.finishAir(inst, .none, &.{un_op}); | 2178 | return cg.finishAir(inst, .none, &.{un_op}); |
| 2179 | } | 2179 | } |
| 2180 | 2180 | ||
| 2181 | fn airVaCopy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const operand = try cg.resolveInst(ty_op.operand); | 2183 | const operand = try cg.resolveInst(ty_op.operand); |
| 2184 | 2184 | ||
| 2185 | const result = try cg.load(operand, .usize, 0); | 2185 | const result = try cg.load(operand, .usize, 0); |
| ... | @@ -2189,7 +2189,7 @@ fn airVaCopy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -2189,7 +2189,7 @@ fn airVaCopy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2189 | 2189 | ||
| 2190 | fn airVaArg(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 2190 | fn airVaArg(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2191 | const zcu = cg.pt.zcu; | 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 | const operand = try cg.resolveInst(ty_op.operand); | 2193 | const operand = try cg.resolveInst(ty_op.operand); |
| 2194 | 2194 | ||
| 2195 | const ty = cg.typeOfIndex(inst); | 2195 | const ty = cg.typeOfIndex(inst); |
| ... | @@ -2261,7 +2261,7 @@ fn airAlloc(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -2261,7 +2261,7 @@ fn airAlloc(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2261 | fn airStore(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { | 2261 | fn airStore(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 2262 | const pt = cg.pt; | 2262 | const pt = cg.pt; |
| 2263 | const zcu = pt.zcu; | 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 | const lhs = try cg.resolveInst(bin_op.lhs); | 2266 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 2267 | const rhs = try cg.resolveInst(bin_op.rhs); | 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,7 +2278,7 @@ fn airStore(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 2278 | assert(ptr_info.packed_offset.host_size == 0); // legalize .expand_packed_store | 2278 | assert(ptr_info.packed_offset.host_size == 0); // legalize .expand_packed_store |
| 2279 | break :offset 0; | 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 | try cg.store(lhs, rhs, elem_ty, offset); | 2283 | try cg.store(lhs, rhs, elem_ty, offset); |
| 2284 | return cg.finishAir(inst, .none, &.{ bin_op.lhs, bin_op.rhs }); | 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,7 +2312,7 @@ fn store(cg: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerErr |
| 2312 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); | 2312 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); |
| 2313 | // stores as := opcode, offset, alignment (opcode::memarg) | 2313 | // stores as := opcode, offset, alignment (opcode::memarg) |
| 2314 | try cg.mir_extra.appendSlice(cg.gpa, &[_]u32{ | 2314 | try cg.mir_extra.appendSlice(cg.gpa, &[_]u32{ |
| 2315 | @intFromEnum(std.wasm.SimdOpcode.v128_store), | 2315 | @backingInt(std.wasm.SimdOpcode.v128_store), |
| 2316 | offset + lhs.offset(), | 2316 | offset + lhs.offset(), |
| 2317 | @intCast(ty.abiAlignment(zcu).toByteUnits().?), | 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,7 +2353,7 @@ fn store(cg: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerErr |
| 2353 | fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 2353 | fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2354 | const pt = cg.pt; | 2354 | const pt = cg.pt; |
| 2355 | const zcu = pt.zcu; | 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 | const operand = try cg.resolveInst(ty_op.operand); | 2357 | const operand = try cg.resolveInst(ty_op.operand); |
| 2358 | const elem_ty = ty_op.ty.toType(); | 2358 | const elem_ty = ty_op.ty.toType(); |
| 2359 | const ptr_ty = cg.typeOf(ty_op.operand); | 2359 | const ptr_ty = cg.typeOf(ty_op.operand); |
| ... | @@ -2366,7 +2366,7 @@ fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -2366,7 +2366,7 @@ fn airLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 2366 | assert(ptr_info.packed_offset.host_size == 0); // legalize .expand_packed_load | 2366 | assert(ptr_info.packed_offset.host_size == 0); // legalize .expand_packed_load |
| 2367 | break :offset 0; | 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 | const result = try cg.load(operand, elem_ty, offset); | 2371 | const result = try cg.load(operand, elem_ty, offset); |
| 2372 | return cg.finishAir(inst, result, &.{ty_op.operand}); | 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,7 +2400,7 @@ fn load(cg: *CodeGen, operand: WValue, ty: Type, offset: u32) InnerError!WValue |
| 2400 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); | 2400 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); |
| 2401 | // stores as := opcode, offset, alignment (opcode::memarg) | 2401 | // stores as := opcode, offset, alignment (opcode::memarg) |
| 2402 | try cg.mir_extra.appendSlice(cg.gpa, &[_]u32{ | 2402 | try cg.mir_extra.appendSlice(cg.gpa, &[_]u32{ |
| 2403 | @intFromEnum(std.wasm.SimdOpcode.v128_load), | 2403 | @backingInt(std.wasm.SimdOpcode.v128_load), |
| 2404 | offset + operand.offset(), | 2404 | offset + operand.offset(), |
| 2405 | @intCast(ty.abiAlignment(zcu).toByteUnits().?), | 2405 | @intCast(ty.abiAlignment(zcu).toByteUnits().?), |
| 2406 | }); | 2406 | }); |
| ... | @@ -5241,7 +5241,7 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5241,7 +5241,7 @@ fn airCondBr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5241 | } | 5241 | } |
| 5242 | 5242 | ||
| 5243 | fn airCmp(cg: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) InnerError!void { | 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 | const lhs = try cg.resolveInst(bin_op.lhs); | 5245 | const lhs = try cg.resolveInst(bin_op.lhs); |
| 5246 | const rhs = try cg.resolveInst(bin_op.rhs); | 5246 | const rhs = try cg.resolveInst(bin_op.rhs); |
| 5247 | const operand_ty = cg.typeOf(bin_op.lhs); | 5247 | const operand_ty = cg.typeOf(bin_op.lhs); |
| ... | @@ -5473,7 +5473,7 @@ fn airCmpVector(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5473,7 +5473,7 @@ fn airCmpVector(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5473 | } | 5473 | } |
| 5474 | 5474 | ||
| 5475 | fn airCmpLteErrorsLen(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const operand = try cg.resolveInst(un_op); | 5477 | const operand = try cg.resolveInst(un_op); |
| 5478 | 5478 | ||
| 5479 | try cg.emitWValue(operand); | 5479 | try cg.emitWValue(operand); |
| ... | @@ -5486,7 +5486,7 @@ fn airCmpLteErrorsLen(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5486,7 +5486,7 @@ fn airCmpLteErrorsLen(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5486 | } | 5486 | } |
| 5487 | 5487 | ||
| 5488 | fn airBr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const block = cg.blocks.get(br.block_inst).?; | 5490 | const block = cg.blocks.get(br.block_inst).?; |
| 5491 | 5491 | ||
| 5492 | // if operand has codegen bits we should break with a value | 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,7 +5505,7 @@ fn airBr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5505 | } | 5505 | } |
| 5506 | 5506 | ||
| 5507 | fn airRepeat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const loop_label = cg.loops.get(repeat.loop_inst).?; | 5509 | const loop_label = cg.loops.get(repeat.loop_inst).?; |
| 5510 | 5510 | ||
| 5511 | const idx: u32 = cg.block_depth - loop_label; | 5511 | const idx: u32 = cg.block_depth - loop_label; |
| ... | @@ -5533,7 +5533,7 @@ fn airUnreachable(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5533,7 +5533,7 @@ fn airUnreachable(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5533 | 5533 | ||
| 5534 | fn airNopCast(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5534 | fn airNopCast(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5535 | const zcu = cg.pt.zcu; | 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 | const operand_ty = cg.typeOf(ty_op.operand); | 5538 | const operand_ty = cg.typeOf(ty_op.operand); |
| 5539 | const dest_ty = cg.typeOfIndex(inst); | 5539 | const dest_ty = cg.typeOfIndex(inst); |
| ... | @@ -5548,7 +5548,7 @@ fn airNopCast(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5548,7 +5548,7 @@ fn airNopCast(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5548 | 5548 | ||
| 5549 | fn airIntFromPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5549 | fn airIntFromPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5550 | const zcu = cg.pt.zcu; | 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 | const operand_ty = cg.typeOf(ty_op.operand); | 5553 | const operand_ty = cg.typeOf(ty_op.operand); |
| 5554 | const dest_ty = cg.typeOfIndex(inst); | 5554 | const dest_ty = cg.typeOfIndex(inst); |
| ... | @@ -5566,7 +5566,7 @@ fn airIntFromPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5566,7 +5566,7 @@ fn airIntFromPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5566 | 5566 | ||
| 5567 | fn airUnionFromEnum(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5567 | fn airUnionFromEnum(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5568 | const zcu = cg.pt.zcu; | 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 | const union_ty = cg.typeOfIndex(inst); | 5571 | const union_ty = cg.typeOfIndex(inst); |
| 5572 | const enum_ty = cg.typeOf(ty_op.operand); | 5572 | const enum_ty = cg.typeOf(ty_op.operand); |
| ... | @@ -5580,7 +5580,7 @@ fn airUnionFromEnum(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -5580,7 +5580,7 @@ fn airUnionFromEnum(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5580 | } | 5580 | } |
| 5581 | 5581 | ||
| 5582 | fn airBitcast(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const operand = try cg.resolveInst(ty_op.operand); | 5584 | const operand = try cg.resolveInst(ty_op.operand); |
| 5585 | const dest_ty = cg.typeOfIndex(inst); | 5585 | const dest_ty = cg.typeOfIndex(inst); |
| 5586 | const src_ty = cg.typeOf(ty_op.operand); | 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,7 +5690,7 @@ fn bitcast(cg: *CodeGen, dest_ty: Type, src_ty: Type, operand: WValue) InnerErro |
| 5690 | 5690 | ||
| 5691 | fn airStructFieldPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5691 | fn airStructFieldPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5692 | const zcu = cg.pt.zcu; | 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 | const extra = cg.air.extraData(Air.StructField, ty_pl.payload); | 5694 | const extra = cg.air.extraData(Air.StructField, ty_pl.payload); |
| 5695 | 5695 | ||
| 5696 | const struct_ptr = try cg.resolveInst(extra.data.struct_operand); | 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,7 +5702,7 @@ fn airStructFieldPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5702 | 5702 | ||
| 5703 | fn airStructFieldPtrIndex(cg: *CodeGen, inst: Air.Inst.Index, index: u32) InnerError!void { | 5703 | fn airStructFieldPtrIndex(cg: *CodeGen, inst: Air.Inst.Index, index: u32) InnerError!void { |
| 5704 | const zcu = cg.pt.zcu; | 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 | const struct_ptr = try cg.resolveInst(ty_op.operand); | 5706 | const struct_ptr = try cg.resolveInst(ty_op.operand); |
| 5707 | const struct_ptr_ty = cg.typeOf(ty_op.operand); | 5707 | const struct_ptr_ty = cg.typeOf(ty_op.operand); |
| 5708 | const struct_ty = struct_ptr_ty.childType(zcu); | 5708 | const struct_ty = struct_ptr_ty.childType(zcu); |
| ... | @@ -5754,7 +5754,7 @@ fn structFieldPtr( | ... | @@ -5754,7 +5754,7 @@ fn structFieldPtr( |
| 5754 | fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 5754 | fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 5755 | const pt = cg.pt; | 5755 | const pt = cg.pt; |
| 5756 | const zcu = pt.zcu; | 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 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; | 5758 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 5759 | 5759 | ||
| 5760 | const struct_ty = cg.typeOf(struct_field.struct_operand); | 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,7 +5986,7 @@ fn airSwitchBr(cg: *CodeGen, inst: Air.Inst.Index, is_dispatch_loop: bool) Inner |
| 5986 | } | 5986 | } |
| 5987 | 5987 | ||
| 5988 | fn airSwitchDispatch(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const switch_loop = cg.blocks.get(br.block_inst).?; | 5990 | const switch_loop = cg.blocks.get(br.block_inst).?; |
| 5991 | 5991 | ||
| 5992 | const operand = try cg.resolveInst(br.operand); | 5992 | const operand = try cg.resolveInst(br.operand); |
| ... | @@ -6001,7 +6001,7 @@ fn airSwitchDispatch(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6001,7 +6001,7 @@ fn airSwitchDispatch(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6001 | 6001 | ||
| 6002 | fn airIsErr(cg: *CodeGen, inst: Air.Inst.Index, opcode: std.wasm.Opcode, op_kind: enum { value, ptr }) InnerError!void { | 6002 | fn airIsErr(cg: *CodeGen, inst: Air.Inst.Index, opcode: std.wasm.Opcode, op_kind: enum { value, ptr }) InnerError!void { |
| 6003 | const zcu = cg.pt.zcu; | 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 | const operand = try cg.resolveInst(un_op); | 6005 | const operand = try cg.resolveInst(un_op); |
| 6006 | const err_union_ty = switch (op_kind) { | 6006 | const err_union_ty = switch (op_kind) { |
| 6007 | .value => cg.typeOf(un_op), | 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,7 +6038,7 @@ fn airIsErr(cg: *CodeGen, inst: Air.Inst.Index, opcode: std.wasm.Opcode, op_kind |
| 6038 | /// *(E!T) -> *T op_is_prt == true | 6038 | /// *(E!T) -> *T op_is_prt == true |
| 6039 | fn airUnwrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void { | 6039 | fn airUnwrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void { |
| 6040 | const zcu = cg.pt.zcu; | 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 | const operand = try cg.resolveInst(ty_op.operand); | 6043 | const operand = try cg.resolveInst(ty_op.operand); |
| 6044 | const op_ty = cg.typeOf(ty_op.operand); | 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,7 +6070,7 @@ fn airUnwrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) |
| 6070 | /// NOTE: op_is_ptr will not change return type | 6070 | /// NOTE: op_is_ptr will not change return type |
| 6071 | fn airUnwrapErrUnionError(cg: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void { | 6071 | fn airUnwrapErrUnionError(cg: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void { |
| 6072 | const zcu = cg.pt.zcu; | 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 | const operand = try cg.resolveInst(ty_op.operand); | 6075 | const operand = try cg.resolveInst(ty_op.operand); |
| 6076 | const op_ty = cg.typeOf(ty_op.operand); | 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,7 +6095,7 @@ fn airUnwrapErrUnionError(cg: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) I |
| 6095 | 6095 | ||
| 6096 | fn airWrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6096 | fn airWrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6097 | const zcu = cg.pt.zcu; | 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 | const operand = try cg.resolveInst(ty_op.operand); | 6100 | const operand = try cg.resolveInst(ty_op.operand); |
| 6101 | const err_ty = cg.typeOfIndex(inst); | 6101 | const err_ty = cg.typeOfIndex(inst); |
| ... | @@ -6125,7 +6125,7 @@ fn airWrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6125,7 +6125,7 @@ fn airWrapErrUnionPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6125 | 6125 | ||
| 6126 | fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6126 | fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6127 | const zcu = cg.pt.zcu; | 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 | const operand = try cg.resolveInst(ty_op.operand); | 6130 | const operand = try cg.resolveInst(ty_op.operand); |
| 6131 | const err_ty = ty_op.ty.toType(); | 6131 | const err_ty = ty_op.ty.toType(); |
| ... | @@ -6153,7 +6153,7 @@ fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6153,7 +6153,7 @@ fn airWrapErrUnionErr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6153 | const OpKind = enum { value, ptr }; | 6153 | const OpKind = enum { value, ptr }; |
| 6154 | 6154 | ||
| 6155 | fn airIsNull(cg: *CodeGen, inst: Air.Inst.Index, opcode: std.wasm.Opcode, op_kind: OpKind) InnerError!void { | 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 | const operand = try cg.resolveInst(un_op); | 6157 | const operand = try cg.resolveInst(un_op); |
| 6158 | 6158 | ||
| 6159 | const op_ty = cg.typeOf(un_op); | 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,7 +6204,7 @@ fn isNull(cg: *CodeGen, operand: WValue, op_ty: Type, opcode: std.wasm.Opcode, o |
| 6204 | 6204 | ||
| 6205 | fn airOptionalPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6205 | fn airOptionalPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6206 | const zcu = cg.pt.zcu; | 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 | const opt_ty = cg.typeOf(ty_op.operand); | 6208 | const opt_ty = cg.typeOf(ty_op.operand); |
| 6209 | const payload_ty = cg.typeOfIndex(inst); | 6209 | const payload_ty = cg.typeOfIndex(inst); |
| 6210 | if (!payload_ty.hasRuntimeBits(zcu)) { | 6210 | if (!payload_ty.hasRuntimeBits(zcu)) { |
| ... | @@ -6226,7 +6226,7 @@ fn airOptionalPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6226,7 +6226,7 @@ fn airOptionalPayload(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6226 | 6226 | ||
| 6227 | fn airOptionalPayloadPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6227 | fn airOptionalPayloadPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6228 | const zcu = cg.pt.zcu; | 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 | const operand = try cg.resolveInst(ty_op.operand); | 6230 | const operand = try cg.resolveInst(ty_op.operand); |
| 6231 | const opt_ty = cg.typeOf(ty_op.operand).childType(zcu); | 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,7 +6244,7 @@ fn airOptionalPayloadPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6244 | fn airOptionalPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6244 | fn airOptionalPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6245 | const pt = cg.pt; | 6245 | const pt = cg.pt; |
| 6246 | const zcu = pt.zcu; | 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 | const operand = try cg.resolveInst(ty_op.operand); | 6248 | const operand = try cg.resolveInst(ty_op.operand); |
| 6249 | const opt_ty = cg.typeOf(ty_op.operand).childType(zcu); | 6249 | const opt_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 6250 | const payload_ty = opt_ty.optionalChild(zcu); | 6250 | const payload_ty = opt_ty.optionalChild(zcu); |
| ... | @@ -6266,7 +6266,7 @@ fn airOptionalPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void | ... | @@ -6266,7 +6266,7 @@ fn airOptionalPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void |
| 6266 | } | 6266 | } |
| 6267 | 6267 | ||
| 6268 | fn airWrapOptional(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const payload_ty = cg.typeOf(ty_op.operand); | 6270 | const payload_ty = cg.typeOf(ty_op.operand); |
| 6271 | const pt = cg.pt; | 6271 | const pt = cg.pt; |
| 6272 | const zcu = pt.zcu; | 6272 | const zcu = pt.zcu; |
| ... | @@ -6304,7 +6304,7 @@ fn airWrapOptional(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6304,7 +6304,7 @@ fn airWrapOptional(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6304 | } | 6304 | } |
| 6305 | 6305 | ||
| 6306 | fn airSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 6308 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6309 | 6309 | ||
| 6310 | const lhs = try cg.resolveInst(bin_op.lhs); | 6310 | const lhs = try cg.resolveInst(bin_op.lhs); |
| ... | @@ -6319,7 +6319,7 @@ fn airSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6319,7 +6319,7 @@ fn airSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6319 | } | 6319 | } |
| 6320 | 6320 | ||
| 6321 | fn airSliceLen(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const operand = try cg.resolveInst(ty_op.operand); | 6324 | const operand = try cg.resolveInst(ty_op.operand); |
| 6325 | return cg.finishAir(inst, try cg.sliceLen(operand), &.{ty_op.operand}); | 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,7 +6327,7 @@ fn airSliceLen(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6327 | 6327 | ||
| 6328 | fn airSliceElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6328 | fn airSliceElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6329 | const zcu = cg.pt.zcu; | 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 | const slice_ty = cg.typeOf(bin_op.lhs); | 6332 | const slice_ty = cg.typeOf(bin_op.lhs); |
| 6333 | const slice = try cg.resolveInst(bin_op.lhs); | 6333 | const slice = try cg.resolveInst(bin_op.lhs); |
| ... | @@ -6351,7 +6351,7 @@ fn airSliceElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6351,7 +6351,7 @@ fn airSliceElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6351 | 6351 | ||
| 6352 | fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6352 | fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6353 | const zcu = cg.pt.zcu; | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 6355 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6356 | 6356 | ||
| 6357 | const elem_ty = ty_pl.ty.toType().childType(zcu); | 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,7 +6372,7 @@ fn airSliceElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6372 | } | 6372 | } |
| 6373 | 6373 | ||
| 6374 | fn airSlicePtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const operand = try cg.resolveInst(ty_op.operand); | 6376 | const operand = try cg.resolveInst(ty_op.operand); |
| 6377 | return cg.finishAir(inst, try cg.slicePtr(operand), &.{ty_op.operand}); | 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,7 +6389,7 @@ fn sliceLen(cg: *CodeGen, operand: WValue) InnerError!WValue { |
| 6389 | 6389 | ||
| 6390 | fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6390 | fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6391 | const zcu = cg.pt.zcu; | 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 | const operand = try cg.resolveInst(ty_op.operand); | 6394 | const operand = try cg.resolveInst(ty_op.operand); |
| 6395 | const array_ty = cg.typeOf(ty_op.operand).childType(zcu); | 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,7 +6409,7 @@ fn airArrayToSlice(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6409 | 6409 | ||
| 6410 | fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6410 | fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6411 | const zcu = cg.pt.zcu; | 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 | const ptr_ty = cg.typeOf(bin_op.lhs); | 6414 | const ptr_ty = cg.typeOf(bin_op.lhs); |
| 6415 | const ptr = try cg.resolveInst(bin_op.lhs); | 6415 | const ptr = try cg.resolveInst(bin_op.lhs); |
| ... | @@ -6437,7 +6437,7 @@ fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6437,7 +6437,7 @@ fn airPtrElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6437 | 6437 | ||
| 6438 | fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6438 | fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6439 | const zcu = cg.pt.zcu; | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 6441 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6442 | 6442 | ||
| 6443 | const ptr_ty = cg.typeOf(bin_op.lhs); | 6443 | const ptr_ty = cg.typeOf(bin_op.lhs); |
| ... | @@ -6465,7 +6465,7 @@ fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6465,7 +6465,7 @@ fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6465 | 6465 | ||
| 6466 | fn airPtrBinOp(cg: *CodeGen, inst: Air.Inst.Index, op: enum { add, sub }) InnerError!void { | 6466 | fn airPtrBinOp(cg: *CodeGen, inst: Air.Inst.Index, op: enum { add, sub }) InnerError!void { |
| 6467 | const zcu = cg.pt.zcu; | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 6469 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 6470 | 6470 | ||
| 6471 | const ptr = try cg.resolveInst(bin_op.lhs); | 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,7 +6503,7 @@ fn airPtrBinOp(cg: *CodeGen, inst: Air.Inst.Index, op: enum { add, sub }) InnerE |
| 6503 | 6503 | ||
| 6504 | fn airMemset(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { | 6504 | fn airMemset(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void { |
| 6505 | const zcu = cg.pt.zcu; | 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 | const ptr = try cg.resolveInst(bin_op.lhs); | 6508 | const ptr = try cg.resolveInst(bin_op.lhs); |
| 6509 | const ptr_ty = cg.typeOf(bin_op.lhs); | 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,7 +6643,7 @@ fn memset(cg: *CodeGen, elem_ty: Type, ptr: WValue, len: WValue, value: WValue) |
| 6643 | 6643 | ||
| 6644 | fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6644 | fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6645 | const zcu = cg.pt.zcu; | 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 | const array_ty = cg.typeOf(bin_op.lhs); | 6648 | const array_ty = cg.typeOf(bin_op.lhs); |
| 6649 | const array = try cg.resolveInst(bin_op.lhs); | 6649 | const array = try cg.resolveInst(bin_op.lhs); |
| ... | @@ -6670,7 +6670,7 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6670,7 +6670,7 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6670 | else => unreachable, | 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 | try cg.emitWValue(array); | 6675 | try cg.emitWValue(array); |
| 6676 | 6676 | ||
| ... | @@ -6703,7 +6703,7 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6703,7 +6703,7 @@ fn airArrayElemVal(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6703 | 6703 | ||
| 6704 | fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6704 | fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6705 | const zcu = cg.pt.zcu; | 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 | const operand = try cg.resolveInst(ty_op.operand); | 6707 | const operand = try cg.resolveInst(ty_op.operand); |
| 6708 | const ty = cg.typeOfIndex(inst); | 6708 | const ty = cg.typeOfIndex(inst); |
| 6709 | const elem_ty = ty.childType(zcu); | 6709 | const elem_ty = ty.childType(zcu); |
| ... | @@ -6715,10 +6715,10 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6715,10 +6715,10 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6715 | // the scalar value onto the stack. | 6715 | // the scalar value onto the stack. |
| 6716 | .stack_offset, .nav_ref, .uav_ref => { | 6716 | .stack_offset, .nav_ref, .uav_ref => { |
| 6717 | const opcode = switch (elem_ty.bitSize(zcu)) { | 6717 | const opcode = switch (elem_ty.bitSize(zcu)) { |
| 6718 | 8 => @intFromEnum(std.wasm.SimdOpcode.v128_load8_splat), | 6718 | 8 => @backingInt(std.wasm.SimdOpcode.v128_load8_splat), |
| 6719 | 16 => @intFromEnum(std.wasm.SimdOpcode.v128_load16_splat), | 6719 | 16 => @backingInt(std.wasm.SimdOpcode.v128_load16_splat), |
| 6720 | 32 => @intFromEnum(std.wasm.SimdOpcode.v128_load32_splat), | 6720 | 32 => @backingInt(std.wasm.SimdOpcode.v128_load32_splat), |
| 6721 | 64 => @intFromEnum(std.wasm.SimdOpcode.v128_load64_splat), | 6721 | 64 => @backingInt(std.wasm.SimdOpcode.v128_load64_splat), |
| 6722 | else => break :blk, // Cannot make use of simd-instructions | 6722 | else => break :blk, // Cannot make use of simd-instructions |
| 6723 | }; | 6723 | }; |
| 6724 | try cg.emitWValue(operand); | 6724 | try cg.emitWValue(operand); |
| ... | @@ -6734,10 +6734,10 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6734,10 +6734,10 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6734 | }, | 6734 | }, |
| 6735 | .local => { | 6735 | .local => { |
| 6736 | const opcode = switch (elem_ty.bitSize(zcu)) { | 6736 | const opcode = switch (elem_ty.bitSize(zcu)) { |
| 6737 | 8 => @intFromEnum(std.wasm.SimdOpcode.i8x16_splat), | 6737 | 8 => @backingInt(std.wasm.SimdOpcode.i8x16_splat), |
| 6738 | 16 => @intFromEnum(std.wasm.SimdOpcode.i16x8_splat), | 6738 | 16 => @backingInt(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), | 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)) @intFromEnum(std.wasm.SimdOpcode.i64x2_splat) else @intFromEnum(std.wasm.SimdOpcode.f64x2_splat), | 6740 | 64 => if (elem_ty.isInt(zcu)) @backingInt(std.wasm.SimdOpcode.i64x2_splat) else @backingInt(std.wasm.SimdOpcode.f64x2_splat), |
| 6741 | else => break :blk, // Cannot make use of simd-instructions | 6741 | else => break :blk, // Cannot make use of simd-instructions |
| 6742 | }; | 6742 | }; |
| 6743 | try cg.emitWValue(operand); | 6743 | try cg.emitWValue(operand); |
| ... | @@ -6764,7 +6764,7 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6764,7 +6764,7 @@ fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6764 | } | 6764 | } |
| 6765 | 6765 | ||
| 6766 | fn airSelect(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const operand = try cg.resolveInst(pl_op.operand); | 6768 | const operand = try cg.resolveInst(pl_op.operand); |
| 6769 | 6769 | ||
| 6770 | _ = operand; | 6770 | _ = operand; |
| ... | @@ -6843,7 +6843,7 @@ fn airShuffleTwo(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6843,7 +6843,7 @@ fn airShuffleTwo(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6843 | try cg.emitWValue(operand_b); | 6843 | try cg.emitWValue(operand_b); |
| 6844 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); | 6844 | const extra_index: u32 = @intCast(cg.mir_extra.items.len); |
| 6845 | try cg.mir_extra.appendSlice(cg.gpa, &.{ | 6845 | try cg.mir_extra.appendSlice(cg.gpa, &.{ |
| 6846 | @intFromEnum(std.wasm.SimdOpcode.i8x16_shuffle), | 6846 | @backingInt(std.wasm.SimdOpcode.i8x16_shuffle), |
| 6847 | @bitCast(lane_map[0..4].*), | 6847 | @bitCast(lane_map[0..4].*), |
| 6848 | @bitCast(lane_map[4..8].*), | 6848 | @bitCast(lane_map[4..8].*), |
| 6849 | @bitCast(lane_map[8..12].*), | 6849 | @bitCast(lane_map[8..12].*), |
| ... | @@ -6873,7 +6873,7 @@ fn airShuffleTwo(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6873,7 +6873,7 @@ fn airShuffleTwo(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6873 | } | 6873 | } |
| 6874 | 6874 | ||
| 6875 | fn airReduce(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const operand = try cg.resolveInst(reduce.operand); | 6877 | const operand = try cg.resolveInst(reduce.operand); |
| 6878 | 6878 | ||
| 6879 | _ = operand; | 6879 | _ = operand; |
| ... | @@ -6883,7 +6883,7 @@ fn airReduce(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -6883,7 +6883,7 @@ fn airReduce(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6883 | fn airAggregateInit(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 6883 | fn airAggregateInit(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6884 | const pt = cg.pt; | 6884 | const pt = cg.pt; |
| 6885 | const zcu = pt.zcu; | 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 | const result_ty = cg.typeOfIndex(inst); | 6887 | const result_ty = cg.typeOfIndex(inst); |
| 6888 | const len = @as(usize, @intCast(result_ty.arrayLen(zcu))); | 6888 | const len = @as(usize, @intCast(result_ty.arrayLen(zcu))); |
| 6889 | const elements: []const Air.Inst.Ref = @ptrCast(cg.air.extra.items[ty_pl.payload..][0..len]); | 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,7 +6960,7 @@ fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 6960 | const pt = cg.pt; | 6960 | const pt = cg.pt; |
| 6961 | const zcu = pt.zcu; | 6961 | const zcu = pt.zcu; |
| 6962 | const ip = &zcu.intern_pool; | 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 | const extra = cg.air.extraData(Air.UnionInit, ty_pl.payload).data; | 6964 | const extra = cg.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 6965 | 6965 | ||
| 6966 | const result = result: { | 6966 | const result = result: { |
| ... | @@ -7019,19 +7019,19 @@ fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -7019,19 +7019,19 @@ fn airUnionInit(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7019 | } | 7019 | } |
| 7020 | 7020 | ||
| 7021 | fn airPrefetch(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | return cg.finishAir(inst, .none, &.{prefetch.ptr}); | 7023 | return cg.finishAir(inst, .none, &.{prefetch.ptr}); |
| 7024 | } | 7024 | } |
| 7025 | 7025 | ||
| 7026 | fn airWasmMemorySize(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | try cg.addLabel(.memory_size, pl_op.payload); | 7029 | try cg.addLabel(.memory_size, pl_op.payload); |
| 7030 | return cg.finishAir(inst, .stack, &.{pl_op.operand}); | 7030 | return cg.finishAir(inst, .stack, &.{pl_op.operand}); |
| 7031 | } | 7031 | } |
| 7032 | 7032 | ||
| 7033 | fn airWasmMemoryGrow(cg: *CodeGen, inst: Air.Inst.Index) !void { | 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 | const operand = try cg.resolveInst(pl_op.operand); | 7036 | const operand = try cg.resolveInst(pl_op.operand); |
| 7037 | try cg.emitWValue(operand); | 7037 | try cg.emitWValue(operand); |
| ... | @@ -7042,7 +7042,7 @@ fn airWasmMemoryGrow(cg: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -7042,7 +7042,7 @@ fn airWasmMemoryGrow(cg: *CodeGen, inst: Air.Inst.Index) !void { |
| 7042 | fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 7042 | fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7043 | const pt = cg.pt; | 7043 | const pt = cg.pt; |
| 7044 | const zcu = pt.zcu; | 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 | const un_ty = cg.typeOf(bin_op.lhs).childType(zcu); | 7046 | const un_ty = cg.typeOf(bin_op.lhs).childType(zcu); |
| 7047 | const tag_ty = cg.typeOf(bin_op.rhs); | 7047 | const tag_ty = cg.typeOf(bin_op.rhs); |
| 7048 | const layout = un_ty.unionGetLayout(zcu); | 7048 | const layout = un_ty.unionGetLayout(zcu); |
| ... | @@ -7066,7 +7066,7 @@ fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -7066,7 +7066,7 @@ fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7066 | 7066 | ||
| 7067 | fn airGetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 7067 | fn airGetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7068 | const zcu = cg.pt.zcu; | 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 | const un_ty = cg.typeOf(ty_op.operand); | 7071 | const un_ty = cg.typeOf(ty_op.operand); |
| 7072 | const tag_ty = cg.typeOfIndex(inst); | 7072 | const tag_ty = cg.typeOfIndex(inst); |
| ... | @@ -7086,7 +7086,7 @@ fn airGetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -7086,7 +7086,7 @@ fn airGetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7086 | 7086 | ||
| 7087 | fn airErrUnionPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 7087 | fn airErrUnionPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7088 | const zcu = cg.pt.zcu; | 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 | const err_set_ty = cg.typeOf(ty_op.operand).childType(zcu); | 7091 | const err_set_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 7092 | const payload_ty = err_set_ty.errorUnionPayload(zcu); | 7092 | const payload_ty = err_set_ty.errorUnionPayload(zcu); |
| ... | @@ -7113,7 +7113,7 @@ fn airErrUnionPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void | ... | @@ -7113,7 +7113,7 @@ fn airErrUnionPayloadPtrSet(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void |
| 7113 | fn airFieldParentPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 7113 | fn airFieldParentPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7114 | const pt = cg.pt; | 7114 | const pt = cg.pt; |
| 7115 | const zcu = pt.zcu; | 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 | const extra = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 7117 | const extra = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 7118 | 7118 | ||
| 7119 | const field_ptr = try cg.resolveInst(extra.field_ptr); | 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,7 +7154,7 @@ fn sliceOrArrayPtr(cg: *CodeGen, ptr: WValue, ptr_ty: Type) InnerError!WValue { |
| 7154 | 7154 | ||
| 7155 | fn airMemcpy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 7155 | fn airMemcpy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7156 | const zcu = cg.pt.zcu; | 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 | const dst = try cg.resolveInst(bin_op.lhs); | 7158 | const dst = try cg.resolveInst(bin_op.lhs); |
| 7159 | const dst_ty = cg.typeOf(bin_op.lhs); | 7159 | const dst_ty = cg.typeOf(bin_op.lhs); |
| 7160 | const ptr_elem_ty = dst_ty.childType(zcu); | 7160 | const ptr_elem_ty = dst_ty.childType(zcu); |
| ... | @@ -7185,7 +7185,7 @@ fn airMemcpy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -7185,7 +7185,7 @@ fn airMemcpy(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7185 | 7185 | ||
| 7186 | fn airMemmove(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 7186 | fn airMemmove(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7187 | const zcu = cg.pt.zcu; | 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 | const dst = try cg.resolveInst(bin_op.lhs); | 7189 | const dst = try cg.resolveInst(bin_op.lhs); |
| 7190 | const dst_ty = cg.typeOf(bin_op.lhs); | 7190 | const dst_ty = cg.typeOf(bin_op.lhs); |
| 7191 | const ptr_elem_ty = dst_ty.childType(zcu); | 7191 | const ptr_elem_ty = dst_ty.childType(zcu); |
| ... | @@ -7223,7 +7223,7 @@ fn airRetAddr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -7223,7 +7223,7 @@ fn airRetAddr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7223 | } | 7223 | } |
| 7224 | 7224 | ||
| 7225 | fn airErrorName(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const operand = try cg.resolveInst(un_op); | 7227 | const operand = try cg.resolveInst(un_op); |
| 7228 | // Each entry to this table is a slice (ptr+len). | 7228 | // Each entry to this table is a slice (ptr+len). |
| 7229 | // The operand in this instruction represents the index within this table. | 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,14 +7257,14 @@ fn airErrorName(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7257 | } | 7257 | } |
| 7258 | 7258 | ||
| 7259 | fn airPtrSliceFieldPtr(cg: *CodeGen, inst: Air.Inst.Index, offset: u32) InnerError!void { | 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 | const slice_ptr = try cg.resolveInst(ty_op.operand); | 7261 | const slice_ptr = try cg.resolveInst(ty_op.operand); |
| 7262 | const result = try cg.buildPointerOffset(slice_ptr, offset, .new); | 7262 | const result = try cg.buildPointerOffset(slice_ptr, offset, .new); |
| 7263 | return cg.finishAir(inst, result, &.{ty_op.operand}); | 7263 | return cg.finishAir(inst, result, &.{ty_op.operand}); |
| 7264 | } | 7264 | } |
| 7265 | 7265 | ||
| 7266 | fn airDbgStmt(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | try cg.addInst(.{ .tag = .dbg_line, .data = .{ | 7268 | try cg.addInst(.{ .tag = .dbg_line, .data = .{ |
| 7269 | .payload = try cg.addExtra(Mir.DbgLineColumn{ | 7269 | .payload = try cg.addExtra(Mir.DbgLineColumn{ |
| 7270 | .line = dbg_stmt.line, | 7270 | .line = dbg_stmt.line, |
| ... | @@ -7408,7 +7408,7 @@ fn callIntrinsic( | ... | @@ -7408,7 +7408,7 @@ fn callIntrinsic( |
| 7408 | } | 7408 | } |
| 7409 | 7409 | ||
| 7410 | fn airTagName(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const operand = try cg.resolveInst(un_op); | 7412 | const operand = try cg.resolveInst(un_op); |
| 7413 | const enum_ty = cg.typeOf(un_op); | 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,7 +7433,7 @@ fn airTagName(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7433 | } | 7433 | } |
| 7434 | 7434 | ||
| 7435 | fn airIsNamedEnumValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const operand = try cg.resolveInst(un_op); | 7437 | const operand = try cg.resolveInst(un_op); |
| 7438 | const enum_ty = cg.typeOf(un_op); | 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,7 +7448,7 @@ fn airIsNamedEnumValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7448 | fn airErrorSetHasValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 7448 | fn airErrorSetHasValue(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7449 | const zcu = cg.pt.zcu; | 7449 | const zcu = cg.pt.zcu; |
| 7450 | const ip = &zcu.intern_pool; | 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 | const operand = try cg.resolveInst(ty_op.operand); | 7453 | const operand = try cg.resolveInst(ty_op.operand); |
| 7454 | const error_set_ty = ty_op.ty.toType(); | 7454 | const error_set_ty = ty_op.ty.toType(); |
| ... | @@ -7534,7 +7534,7 @@ inline fn useAtomicFeature(cg: *const CodeGen) bool { | ... | @@ -7534,7 +7534,7 @@ inline fn useAtomicFeature(cg: *const CodeGen) bool { |
| 7534 | 7534 | ||
| 7535 | fn airCmpxchg(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 7535 | fn airCmpxchg(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7536 | const zcu = cg.pt.zcu; | 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 | const extra = cg.air.extraData(Air.Cmpxchg, ty_pl.payload).data; | 7538 | const extra = cg.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 7539 | 7539 | ||
| 7540 | const ptr_ty = cg.typeOf(extra.ptr); | 7540 | const ptr_ty = cg.typeOf(extra.ptr); |
| ... | @@ -7609,7 +7609,7 @@ fn airCmpxchg(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -7609,7 +7609,7 @@ fn airCmpxchg(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7609 | 7609 | ||
| 7610 | fn airAtomicLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 7610 | fn airAtomicLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7611 | const zcu = cg.pt.zcu; | 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 | const ptr = try cg.resolveInst(atomic_load.ptr); | 7613 | const ptr = try cg.resolveInst(atomic_load.ptr); |
| 7614 | const ty = cg.typeOfIndex(inst); | 7614 | const ty = cg.typeOfIndex(inst); |
| 7615 | 7615 | ||
| ... | @@ -7635,7 +7635,7 @@ fn airAtomicLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -7635,7 +7635,7 @@ fn airAtomicLoad(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7635 | 7635 | ||
| 7636 | fn airAtomicRmw(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 7636 | fn airAtomicRmw(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7637 | const zcu = cg.pt.zcu; | 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 | const extra = cg.air.extraData(Air.AtomicRmw, pl_op.payload).data; | 7639 | const extra = cg.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 7640 | 7640 | ||
| 7641 | const ptr = try cg.resolveInst(pl_op.operand); | 7641 | const ptr = try cg.resolveInst(pl_op.operand); |
| ... | @@ -7838,7 +7838,7 @@ fn airAtomicRmw(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -7838,7 +7838,7 @@ fn airAtomicRmw(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7838 | 7838 | ||
| 7839 | fn airAtomicStore(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 7839 | fn airAtomicStore(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7840 | const zcu = cg.pt.zcu; | 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 | const ptr = try cg.resolveInst(bin_op.lhs); | 7843 | const ptr = try cg.resolveInst(bin_op.lhs); |
| 7844 | const operand = try cg.resolveInst(bin_op.rhs); | 7844 | const operand = try cg.resolveInst(bin_op.rhs); |
| ... | @@ -7875,7 +7875,7 @@ fn airFrameAddress(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -7875,7 +7875,7 @@ fn airFrameAddress(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 7875 | } | 7875 | } |
| 7876 | 7876 | ||
| 7877 | fn airRuntimeNavPtr(cg: *CodeGen, inst: Air.Inst.Index) InnerError!void { | 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 | const mod = cg.pt.zcu.navFileScope(cg.owner_nav).mod.?; | 7879 | const mod = cg.pt.zcu.navFileScope(cg.owner_nav).mod.?; |
| 7880 | if (mod.single_threaded) { | 7880 | if (mod.single_threaded) { |
| 7881 | const result: WValue = .{ .nav_ref = .{ | 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,8 +42,8 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 42 | .block, .loop => { | 42 | .block, .loop => { |
| 43 | const block_type = datas[inst].block_type; | 43 | const block_type = datas[inst].block_type; |
| 44 | try code.ensureUnusedCapacity(gpa, 2); | 44 | try code.ensureUnusedCapacity(gpa, 2); |
| 45 | code.appendAssumeCapacity(@intFromEnum(tags[inst])); | 45 | code.appendAssumeCapacity(@backingInt(tags[inst])); |
| 46 | code.appendAssumeCapacity(@intFromEnum(block_type)); | 46 | code.appendAssumeCapacity(@backingInt(block_type)); |
| 47 | 47 | ||
| 48 | inst += 1; | 48 | inst += 1; |
| 49 | continue :loop tags[inst]; | 49 | continue :loop tags[inst]; |
| ... | @@ -78,14 +78,14 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -78,14 +78,14 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 78 | continue :loop tags[inst]; | 78 | continue :loop tags[inst]; |
| 79 | }, | 79 | }, |
| 80 | .func_ref => { | 80 | .func_ref => { |
| 81 | const indirect_func_idx: Wasm.ZcuIndirectFunctionSetIndex = @enumFromInt( | 81 | const indirect_func_idx: Wasm.ZcuIndirectFunctionSetIndex = @fromBackingInt(@intCast( |
| 82 | wasm.zcu_indirect_function_set.getIndex(datas[inst].nav_index).?, | 82 | wasm.zcu_indirect_function_set.getIndex(datas[inst].nav_index).?, |
| 83 | ); | 83 | )); |
| 84 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); | 84 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_const)); |
| 85 | if (is_obj) { | 85 | if (is_obj) { |
| 86 | @panic("TODO"); | 86 | @panic("TODO"); |
| 87 | } else { | 87 | } else { |
| 88 | writeSleb128(code, 1 + @intFromEnum(indirect_func_idx)); | 88 | writeSleb128(code, 1 + @backingInt(indirect_func_idx)); |
| 89 | } | 89 | } |
| 90 | inst += 1; | 90 | inst += 1; |
| 91 | continue :loop tags[inst]; | 91 | continue :loop tags[inst]; |
| ... | @@ -96,7 +96,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -96,7 +96,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 96 | }, | 96 | }, |
| 97 | .errors_len => { | 97 | .errors_len => { |
| 98 | try code.ensureUnusedCapacity(gpa, 6); | 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 | // MIR is lowered during flush, so there is indeed only one thread at this time. | 100 | // MIR is lowered during flush, so there is indeed only one thread at this time. |
| 101 | const errors_len = 1 + comp.zcu.?.intern_pool.global_error_set.getNamesFromMainThread().len; | 101 | const errors_len = 1 + comp.zcu.?.intern_pool.global_error_set.getNamesFromMainThread().len; |
| 102 | writeSleb128(code, errors_len); | 102 | writeSleb128(code, errors_len); |
| ... | @@ -108,7 +108,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -108,7 +108,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 108 | wasm.error_name_table_ref_count += 1; | 108 | wasm.error_name_table_ref_count += 1; |
| 109 | try code.ensureUnusedCapacity(gpa, 11); | 109 | try code.ensureUnusedCapacity(gpa, 11); |
| 110 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; | 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 | if (is_obj) { | 112 | if (is_obj) { |
| 113 | try wasm.out_relocs.append(gpa, .{ | 113 | try wasm.out_relocs.append(gpa, .{ |
| 114 | .offset = @intCast(code.items.len), | 114 | .offset = @intCast(code.items.len), |
| ... | @@ -130,7 +130,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -130,7 +130,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 130 | }, | 130 | }, |
| 131 | .br_if, .br, .memory_grow, .memory_size => { | 131 | .br_if, .br, .memory_grow, .memory_size => { |
| 132 | try code.ensureUnusedCapacity(gpa, 11); | 132 | try code.ensureUnusedCapacity(gpa, 11); |
| 133 | code.appendAssumeCapacity(@intFromEnum(tags[inst])); | 133 | code.appendAssumeCapacity(@backingInt(tags[inst])); |
| 134 | writeUleb128(code, datas[inst].label); | 134 | writeUleb128(code, datas[inst].label); |
| 135 | 135 | ||
| 136 | inst += 1; | 136 | inst += 1; |
| ... | @@ -139,7 +139,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -139,7 +139,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 139 | 139 | ||
| 140 | .local_get, .local_set, .local_tee => { | 140 | .local_get, .local_set, .local_tee => { |
| 141 | try code.ensureUnusedCapacity(gpa, 11); | 141 | try code.ensureUnusedCapacity(gpa, 11); |
| 142 | code.appendAssumeCapacity(@intFromEnum(tags[inst])); | 142 | code.appendAssumeCapacity(@backingInt(tags[inst])); |
| 143 | writeUleb128(code, datas[inst].local); | 143 | writeUleb128(code, datas[inst].local); |
| 144 | 144 | ||
| 145 | inst += 1; | 145 | inst += 1; |
| ... | @@ -151,7 +151,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -151,7 +151,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 151 | const extra = mir.extraData(Mir.JumpTable, extra_index); | 151 | const extra = mir.extraData(Mir.JumpTable, extra_index); |
| 152 | const labels = mir.extra[extra.end..][0..extra.data.length]; | 152 | const labels = mir.extra[extra.end..][0..extra.data.length]; |
| 153 | try code.ensureUnusedCapacity(gpa, 11 + 10 * labels.len); | 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 | // -1 because default label is not part of length/depth. | 155 | // -1 because default label is not part of length/depth. |
| 156 | writeUleb128(code, extra.data.length - 1); | 156 | writeUleb128(code, extra.data.length - 1); |
| 157 | for (labels) |label| writeUleb128(code, label); | 157 | for (labels) |label| writeUleb128(code, label); |
| ... | @@ -162,7 +162,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -162,7 +162,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 162 | 162 | ||
| 163 | .call_nav => { | 163 | .call_nav => { |
| 164 | try code.ensureUnusedCapacity(gpa, 6); | 164 | try code.ensureUnusedCapacity(gpa, 6); |
| 165 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call)); | 165 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call)); |
| 166 | if (is_obj) { | 166 | if (is_obj) { |
| 167 | try wasm.out_relocs.append(gpa, .{ | 167 | try wasm.out_relocs.append(gpa, .{ |
| 168 | .offset = @intCast(code.items.len), | 168 | .offset = @intCast(code.items.len), |
| ... | @@ -190,7 +190,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -190,7 +190,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 190 | target, | 190 | target, |
| 191 | ).?; | 191 | ).?; |
| 192 | if (is_obj) { | 192 | if (is_obj) { |
| 193 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call_indirect)); | 193 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call_indirect)); |
| 194 | try wasm.out_relocs.append(gpa, .{ | 194 | try wasm.out_relocs.append(gpa, .{ |
| 195 | .offset = @intCast(code.items.len), | 195 | .offset = @intCast(code.items.len), |
| 196 | .pointee = .{ .type_index = func_ty_index }, | 196 | .pointee = .{ .type_index = func_ty_index }, |
| ... | @@ -199,7 +199,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -199,7 +199,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 199 | }); | 199 | }); |
| 200 | code.appendNTimesAssumeCapacity(0, 5); | 200 | code.appendNTimesAssumeCapacity(0, 5); |
| 201 | } else { | 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 | // In this case we tried to call a function pointer for | 203 | // In this case we tried to call a function pointer for |
| 204 | // which the type signature does not match any function | 204 | // which the type signature does not match any function |
| 205 | // body or function import in the entire wasm executable. | 205 | // body or function import in the entire wasm executable. |
| ... | @@ -207,12 +207,12 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -207,12 +207,12 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 207 | // Since there is no way to create a reference to a | 207 | // Since there is no way to create a reference to a |
| 208 | // function without it being in the function table or | 208 | // function without it being in the function table or |
| 209 | // import table, this instruction is unreachable. | 209 | // import table, this instruction is unreachable. |
| 210 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.@"unreachable")); | 210 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.@"unreachable")); |
| 211 | inst += 1; | 211 | inst += 1; |
| 212 | continue :loop tags[inst]; | 212 | continue :loop tags[inst]; |
| 213 | }); | 213 | })); |
| 214 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call_indirect)); | 214 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call_indirect)); |
| 215 | writeUleb128(code, @intFromEnum(index)); | 215 | writeUleb128(code, @backingInt(index)); |
| 216 | } | 216 | } |
| 217 | writeUleb128(code, @as(u32, 0)); // table index | 217 | writeUleb128(code, @as(u32, 0)); // table index |
| 218 | 218 | ||
| ... | @@ -222,7 +222,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -222,7 +222,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 222 | 222 | ||
| 223 | .call_tag_index => { | 223 | .call_tag_index => { |
| 224 | try code.ensureUnusedCapacity(gpa, 6); | 224 | try code.ensureUnusedCapacity(gpa, 6); |
| 225 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call)); | 225 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call)); |
| 226 | if (is_obj) { | 226 | if (is_obj) { |
| 227 | try wasm.out_relocs.append(gpa, .{ | 227 | try wasm.out_relocs.append(gpa, .{ |
| 228 | .offset = @intCast(code.items.len), | 228 | .offset = @intCast(code.items.len), |
| ... | @@ -242,7 +242,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -242,7 +242,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 242 | .enum_tag_name_table_ref => { | 242 | .enum_tag_name_table_ref => { |
| 243 | try code.ensureUnusedCapacity(gpa, 11); | 243 | try code.ensureUnusedCapacity(gpa, 11); |
| 244 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; | 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 | if (is_obj) { | 246 | if (is_obj) { |
| 247 | @panic("TODO"); | 247 | @panic("TODO"); |
| 248 | } else { | 248 | } else { |
| ... | @@ -261,7 +261,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -261,7 +261,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 261 | const symbol_name = try wasm.internString(@tagName(datas[inst].intrinsic)); | 261 | const symbol_name = try wasm.internString(@tagName(datas[inst].intrinsic)); |
| 262 | 262 | ||
| 263 | try code.ensureUnusedCapacity(gpa, 6); | 263 | try code.ensureUnusedCapacity(gpa, 6); |
| 264 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call)); | 264 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call)); |
| 265 | if (is_obj) { | 265 | if (is_obj) { |
| 266 | try wasm.out_relocs.append(gpa, .{ | 266 | try wasm.out_relocs.append(gpa, .{ |
| 267 | .offset = @intCast(code.items.len), | 267 | .offset = @intCast(code.items.len), |
| ... | @@ -280,7 +280,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -280,7 +280,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 280 | 280 | ||
| 281 | .global_set_sp => { | 281 | .global_set_sp => { |
| 282 | try code.ensureUnusedCapacity(gpa, 6); | 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 | if (is_obj) { | 284 | if (is_obj) { |
| 285 | try wasm.out_relocs.append(gpa, .{ | 285 | try wasm.out_relocs.append(gpa, .{ |
| 286 | .offset = @intCast(code.items.len), | 286 | .offset = @intCast(code.items.len), |
| ... | @@ -291,7 +291,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -291,7 +291,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 291 | code.appendNTimesAssumeCapacity(0, 5); | 291 | code.appendNTimesAssumeCapacity(0, 5); |
| 292 | } else { | 292 | } else { |
| 293 | const sp_global: Wasm.GlobalIndex = .stack_pointer; | 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 | inst += 1; | 297 | inst += 1; |
| ... | @@ -300,7 +300,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -300,7 +300,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 300 | 300 | ||
| 301 | .f32_const => { | 301 | .f32_const => { |
| 302 | try code.ensureUnusedCapacity(gpa, 5); | 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 | std.mem.writeInt(u32, code.addManyAsArrayAssumeCapacity(4), @bitCast(datas[inst].float32), .little); | 304 | std.mem.writeInt(u32, code.addManyAsArrayAssumeCapacity(4), @bitCast(datas[inst].float32), .little); |
| 305 | 305 | ||
| 306 | inst += 1; | 306 | inst += 1; |
| ... | @@ -309,7 +309,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -309,7 +309,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 309 | 309 | ||
| 310 | .f64_const => { | 310 | .f64_const => { |
| 311 | try code.ensureUnusedCapacity(gpa, 9); | 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 | const float64 = mir.extraData(Mir.Float64, datas[inst].payload).data; | 313 | const float64 = mir.extraData(Mir.Float64, datas[inst].payload).data; |
| 314 | std.mem.writeInt(u64, code.addManyAsArrayAssumeCapacity(8), float64.toInt(), .little); | 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,7 +318,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 318 | }, | 318 | }, |
| 319 | .i32_const => { | 319 | .i32_const => { |
| 320 | try code.ensureUnusedCapacity(gpa, 6); | 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 | writeSleb128(code, datas[inst].imm32); | 322 | writeSleb128(code, datas[inst].imm32); |
| 323 | 323 | ||
| 324 | inst += 1; | 324 | inst += 1; |
| ... | @@ -326,7 +326,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -326,7 +326,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 326 | }, | 326 | }, |
| 327 | .i64_const => { | 327 | .i64_const => { |
| 328 | try code.ensureUnusedCapacity(gpa, 11); | 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 | const int64: i64 = @bitCast(mir.extraData(Mir.Imm64, datas[inst].payload).data.toInt()); | 330 | const int64: i64 = @bitCast(mir.extraData(Mir.Imm64, datas[inst].payload).data.toInt()); |
| 331 | writeSleb128(code, int64); | 331 | writeSleb128(code, int64); |
| 332 | 332 | ||
| ... | @@ -359,7 +359,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -359,7 +359,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 359 | .i64_store32, | 359 | .i64_store32, |
| 360 | => { | 360 | => { |
| 361 | try code.ensureUnusedCapacity(gpa, 1 + 20); | 361 | try code.ensureUnusedCapacity(gpa, 1 + 20); |
| 362 | code.appendAssumeCapacity(@intFromEnum(tags[inst])); | 362 | code.appendAssumeCapacity(@backingInt(tags[inst])); |
| 363 | encodeMemArg(code, mir.extraData(Mir.MemArg, datas[inst].payload).data); | 363 | encodeMemArg(code, mir.extraData(Mir.MemArg, datas[inst].payload).data); |
| 364 | inst += 1; | 364 | inst += 1; |
| 365 | continue :loop tags[inst]; | 365 | continue :loop tags[inst]; |
| ... | @@ -495,7 +495,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -495,7 +495,7 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 495 | .i64_clz, | 495 | .i64_clz, |
| 496 | .i64_ctz, | 496 | .i64_ctz, |
| 497 | => { | 497 | => { |
| 498 | try code.append(gpa, @intFromEnum(tags[inst])); | 498 | try code.append(gpa, @backingInt(tags[inst])); |
| 499 | inst += 1; | 499 | inst += 1; |
| 500 | continue :loop tags[inst]; | 500 | continue :loop tags[inst]; |
| 501 | }, | 501 | }, |
| ... | @@ -504,9 +504,9 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -504,9 +504,9 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 504 | try code.ensureUnusedCapacity(gpa, 6 + 6); | 504 | try code.ensureUnusedCapacity(gpa, 6 + 6); |
| 505 | const extra_index = datas[inst].payload; | 505 | const extra_index = datas[inst].payload; |
| 506 | const opcode = mir.extra[extra_index]; | 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 | writeUleb128(code, opcode); | 508 | writeUleb128(code, opcode); |
| 509 | switch (@as(std.wasm.MiscOpcode, @enumFromInt(opcode))) { | 509 | switch (@as(std.wasm.MiscOpcode, @fromBackingInt(@intCast(opcode)))) { |
| 510 | // bulk-memory opcodes | 510 | // bulk-memory opcodes |
| 511 | .data_drop => { | 511 | .data_drop => { |
| 512 | const segment = mir.extra[extra_index + 1]; | 512 | const segment = mir.extra[extra_index + 1]; |
| ... | @@ -566,9 +566,9 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -566,9 +566,9 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 566 | try code.ensureUnusedCapacity(gpa, 6 + 20); | 566 | try code.ensureUnusedCapacity(gpa, 6 + 20); |
| 567 | const extra_index = datas[inst].payload; | 567 | const extra_index = datas[inst].payload; |
| 568 | const opcode = mir.extra[extra_index]; | 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 | writeUleb128(code, opcode); | 570 | writeUleb128(code, opcode); |
| 571 | switch (@as(std.wasm.SimdOpcode, @enumFromInt(opcode))) { | 571 | switch (@as(std.wasm.SimdOpcode, @fromBackingInt(@intCast(opcode)))) { |
| 572 | .v128_store, | 572 | .v128_store, |
| 573 | .v128_load, | 573 | .v128_load, |
| 574 | .v128_load8_splat, | 574 | .v128_load8_splat, |
| ... | @@ -852,9 +852,9 @@ pub fn lowerToCode(emit: *Emit) Error!void { | ... | @@ -852,9 +852,9 @@ pub fn lowerToCode(emit: *Emit) Error!void { |
| 852 | 852 | ||
| 853 | const extra_index = datas[inst].payload; | 853 | const extra_index = datas[inst].payload; |
| 854 | const opcode = mir.extra[extra_index]; | 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 | writeUleb128(code, opcode); | 856 | writeUleb128(code, opcode); |
| 857 | switch (@as(std.wasm.AtomicsOpcode, @enumFromInt(opcode))) { | 857 | switch (@as(std.wasm.AtomicsOpcode, @fromBackingInt(@intCast(opcode)))) { |
| 858 | .i32_atomic_load, | 858 | .i32_atomic_load, |
| 859 | .i64_atomic_load, | 859 | .i64_atomic_load, |
| 860 | .i32_atomic_load8_u, | 860 | .i32_atomic_load8_u, |
| ... | @@ -958,7 +958,7 @@ fn uavRefObj(wasm: *Wasm, code: *ArrayList(u8), value: InternPool.Index, offset: | ... | @@ -958,7 +958,7 @@ fn uavRefObj(wasm: *Wasm, code: *ArrayList(u8), value: InternPool.Index, offset: |
| 958 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; | 958 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; |
| 959 | 959 | ||
| 960 | try code.ensureUnusedCapacity(gpa, 11); | 960 | try code.ensureUnusedCapacity(gpa, 11); |
| 961 | code.appendAssumeCapacity(@intFromEnum(opcode)); | 961 | code.appendAssumeCapacity(@backingInt(opcode)); |
| 962 | 962 | ||
| 963 | try wasm.out_relocs.append(gpa, .{ | 963 | try wasm.out_relocs.append(gpa, .{ |
| 964 | .offset = @intCast(code.items.len), | 964 | .offset = @intCast(code.items.len), |
| ... | @@ -975,7 +975,7 @@ fn uavRefExe(wasm: *Wasm, code: *ArrayList(u8), value: InternPool.Index, offset: | ... | @@ -975,7 +975,7 @@ fn uavRefExe(wasm: *Wasm, code: *ArrayList(u8), value: InternPool.Index, offset: |
| 975 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; | 975 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; |
| 976 | 976 | ||
| 977 | try code.ensureUnusedCapacity(gpa, 11); | 977 | try code.ensureUnusedCapacity(gpa, 11); |
| 978 | code.appendAssumeCapacity(@intFromEnum(opcode)); | 978 | code.appendAssumeCapacity(@backingInt(opcode)); |
| 979 | 979 | ||
| 980 | const addr = wasm.uavAddr(value); | 980 | const addr = wasm.uavAddr(value); |
| 981 | writeUleb128(code, @as(u32, @intCast(@as(i64, addr) + offset))); | 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,7 +993,7 @@ fn navRefOff(wasm: *Wasm, code: *ArrayList(u8), data: Mir.NavRefOff, is_wasm32: |
| 993 | try code.ensureUnusedCapacity(gpa, 11); | 993 | try code.ensureUnusedCapacity(gpa, 11); |
| 994 | 994 | ||
| 995 | const opcode: std.wasm.Opcode = if (is_wasm32) .i32_const else .i64_const; | 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 | if (is_obj) { | 997 | if (is_obj) { |
| 998 | try wasm.out_relocs.append(gpa, .{ | 998 | try wasm.out_relocs.append(gpa, .{ |
| 999 | .offset = @intCast(code.items.len), | 999 | .offset = @intCast(code.items.len), |
| ... | @@ -1009,7 +1009,7 @@ fn navRefOff(wasm: *Wasm, code: *ArrayList(u8), data: Mir.NavRefOff, is_wasm32: | ... | @@ -1009,7 +1009,7 @@ fn navRefOff(wasm: *Wasm, code: *ArrayList(u8), data: Mir.NavRefOff, is_wasm32: |
| 1009 | } | 1009 | } |
| 1010 | 1010 | ||
| 1011 | fn appendOutputFunctionIndex(code: *ArrayList(u8), i: Wasm.OutputFunctionIndex) void { | 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 | fn writeUleb128(code: *ArrayList(u8), arg: anytype) void { | 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,12 +618,12 @@ pub const Inst = struct { |
| 618 | 618 | ||
| 619 | /// From a given wasm opcode, returns a MIR tag. | 619 | /// From a given wasm opcode, returns a MIR tag. |
| 620 | pub fn fromOpcode(opcode: std.wasm.Opcode) Tag { | 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 | /// Returns a wasm opcode from a given MIR tag. | 624 | /// Returns a wasm opcode from a given MIR tag. |
| 625 | pub fn toOpcode(self: Tag) std.wasm.Opcode { | 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,7 +690,7 @@ pub fn lower(mir: *const Mir, wasm: *Wasm, code: *std.ArrayList(u8)) std.mem.All |
| 690 | 690 | ||
| 691 | for (mir.locals) |local| { | 691 | for (mir.locals) |local| { |
| 692 | w.writeLeb128(@as(u32, 1)) catch unreachable; | 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 | // Stack management section of function prologue. | 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,31 +698,31 @@ pub fn lower(mir: *const Mir, wasm: *Wasm, code: *std.ArrayList(u8)) std.mem.All |
| 698 | if (stack_alignment.toByteUnits()) |align_bytes| { | 698 | if (stack_alignment.toByteUnits()) |align_bytes| { |
| 699 | const sp_global: Wasm.GlobalIndex = .stack_pointer; | 699 | const sp_global: Wasm.GlobalIndex = .stack_pointer; |
| 700 | // load stack pointer | 700 | // load stack pointer |
| 701 | w.writeByte(@intFromEnum(std.wasm.Opcode.global_get)) catch unreachable; | 701 | w.writeByte(@backingInt(std.wasm.Opcode.global_get)) catch unreachable; |
| 702 | w.writeUleb128(@intFromEnum(sp_global)) catch unreachable; | 702 | w.writeUleb128(@backingInt(sp_global)) catch unreachable; |
| 703 | // store stack pointer so we can restore it when we return from the function | 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 | w.writeUleb128(mir.prologue.sp_local) catch unreachable; | 705 | w.writeUleb128(mir.prologue.sp_local) catch unreachable; |
| 706 | // get the total stack size | 706 | // get the total stack size |
| 707 | const aligned_stack: i32 = @intCast(stack_alignment.forward(mir.prologue.stack_size)); | 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 | w.writeSleb128(aligned_stack) catch unreachable; | 709 | w.writeSleb128(aligned_stack) catch unreachable; |
| 710 | // subtract it from the current stack pointer | 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 | // Get negative stack alignment | 712 | // Get negative stack alignment |
| 713 | const neg_stack_align = @as(i32, @intCast(align_bytes)) * -1; | 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 | w.writeSleb128(neg_stack_align) catch unreachable; | 715 | w.writeSleb128(neg_stack_align) catch unreachable; |
| 716 | // Bitwise-and the value to get the new stack pointer to ensure the | 716 | // Bitwise-and the value to get the new stack pointer to ensure the |
| 717 | // pointers are aligned with the abi alignment. | 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 | // The bottom will be used to calculate all stack pointer offsets. | 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 | w.writeUleb128(mir.prologue.bottom_stack_local) catch unreachable; | 721 | w.writeUleb128(mir.prologue.bottom_stack_local) catch unreachable; |
| 722 | // Store the current stack pointer value into the global stack pointer so other function calls will | 722 | // Store the current stack pointer value into the global stack pointer so other function calls will |
| 723 | // start from this value instead and not overwrite the current stack. | 723 | // start from this value instead and not overwrite the current stack. |
| 724 | w.writeByte(@intFromEnum(std.wasm.Opcode.global_set)) catch unreachable; | 724 | w.writeByte(@backingInt(std.wasm.Opcode.global_set)) catch unreachable; |
| 725 | w.writeUleb128(@intFromEnum(sp_global)) catch unreachable; | 725 | w.writeUleb128(@backingInt(sp_global)) catch unreachable; |
| 726 | } | 726 | } |
| 727 | 727 | ||
| 728 | code.items.len += w.end; | 728 | code.items.len += w.end; |
| ... | @@ -747,7 +747,7 @@ pub fn extraData(self: *const Mir, comptime T: type, index: usize) struct { data | ... | @@ -747,7 +747,7 @@ pub fn extraData(self: *const Mir, comptime T: type, index: usize) struct { data |
| 747 | Wasm.UavsExeIndex, | 747 | Wasm.UavsExeIndex, |
| 748 | InternPool.Nav.Index, | 748 | InternPool.Nav.Index, |
| 749 | InternPool.Index, | 749 | InternPool.Index, |
| 750 | => @enumFromInt(self.extra[i]), | 750 | => @fromBackingInt(@intCast(self.extra[i])), |
| 751 | else => @compileError("Unsupported field type " ++ @typeName(field_type)), | 751 | else => @compileError("Unsupported field type " ++ @typeName(field_type)), |
| 752 | }; | 752 | }; |
| 753 | i += 1; | 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,7 +85,7 @@ pub fn legalizeFeatures(_: *const std.Target) *const Air.Legalize.Features { |
| 85 | /// https://github.com/ziglang/zig/issues/22419 | 85 | /// https://github.com/ziglang/zig/issues/22419 |
| 86 | const hack_around_sema_opv_bugs = true; | 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 | gpa: Allocator, | 90 | gpa: Allocator, |
| 91 | pt: Zcu.PerThread, | 91 | pt: Zcu.PerThread, |
| ... | @@ -165,7 +165,7 @@ loop_switches: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { | ... | @@ -165,7 +165,7 @@ loop_switches: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { |
| 165 | }, | 165 | }, |
| 166 | }) = .empty, | 166 | }) = .empty, |
| 167 | 167 | ||
| 168 | next_temp_index: Temp.Index = @enumFromInt(0), | 168 | next_temp_index: Temp.Index = @fromBackingInt(@intCast(0)), |
| 169 | temp_type: [Temp.Index.max]Type = undefined, | 169 | temp_type: [Temp.Index.max]Type = undefined, |
| 170 | 170 | ||
| 171 | const MaskInfo = packed struct { | 171 | const MaskInfo = packed struct { |
| ... | @@ -616,14 +616,14 @@ pub const MCValue = union(enum) { | ... | @@ -616,14 +616,14 @@ pub const MCValue = union(enum) { |
| 616 | }), | 616 | }), |
| 617 | .load_frame => |pl| try w.print("[{f} + 0x{x}]", .{ pl.index, pl.off }), | 617 | .load_frame => |pl| try w.print("[{f} + 0x{x}]", .{ pl.index, pl.off }), |
| 618 | .lea_frame => |pl| try w.print("{f} + 0x{x}", .{ pl.index, pl.off }), | 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)}), | 619 | .load_nav => |pl| try w.print("[nav:{d}]", .{@backingInt(pl)}), |
| 620 | .lea_nav => |pl| try w.print("nav:{d}", .{@intFromEnum(pl)}), | 620 | .lea_nav => |pl| try w.print("nav:{d}", .{@backingInt(pl)}), |
| 621 | .load_uav => |pl| try w.print("[uav:{d}]", .{@intFromEnum(pl.val)}), | 621 | .load_uav => |pl| try w.print("[uav:{d}]", .{@backingInt(pl.val)}), |
| 622 | .lea_uav => |pl| try w.print("uav:{d}", .{@intFromEnum(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), @intFromEnum(pl.ty) }), | 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), @intFromEnum(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}]", .{@intFromEnum(pl)}), | 625 | .load_extern_func => |pl| try w.print("[extern:{d}]", .{@backingInt(pl)}), |
| 626 | .lea_extern_func => |pl| try w.print("extern:{d}", .{@intFromEnum(pl)}), | 626 | .lea_extern_func => |pl| try w.print("extern:{d}", .{@backingInt(pl)}), |
| 627 | .register_tee => |pl| try w.print("tee:{s}:{s}", .{ @tagName(pl[1]), @tagName(pl[0]) }), | 627 | .register_tee => |pl| try w.print("tee:{s}:{s}", .{ @tagName(pl[1]), @tagName(pl[0]) }), |
| 628 | .elementwise_gpr => |pl| try w.print("elementwise:gpr{d}:[{f} + 0x{x}]", .{ | 628 | .elementwise_gpr => |pl| try w.print("elementwise:gpr{d}:[{f} + 0x{x}]", .{ |
| 629 | pl.info.reg_index, pl.frame_index, pl.info.frame_off, | 629 | pl.info.reg_index, pl.frame_index, pl.info.frame_off, |
| ... | @@ -641,7 +641,7 @@ pub const MCValue = union(enum) { | ... | @@ -641,7 +641,7 @@ pub const MCValue = union(enum) { |
| 641 | pl.info.reg_index, pl.frame_index, pl.info.frame_off, | 641 | pl.info.reg_index, pl.frame_index, pl.info.frame_off, |
| 642 | }), | 642 | }), |
| 643 | .reserved_frame => |pl| try w.print("(dead:{f})", .{pl}), | 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,7 +1011,7 @@ pub fn generate( |
| 1011 | } | 1011 | } |
| 1012 | try function.inst_tracking.ensureTotalCapacity(gpa, Temp.Index.max); | 1012 | try function.inst_tracking.ensureTotalCapacity(gpa, Temp.Index.max); |
| 1013 | for (0..Temp.Index.max) |temp_index| { | 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 | function.inst_tracking.putAssumeCapacityNoClobber(temp.toIndex(), .init(.none)); | 1015 | function.inst_tracking.putAssumeCapacityNoClobber(temp.toIndex(), .init(.none)); |
| 1016 | } | 1016 | } |
| 1017 | 1017 | ||
| ... | @@ -1019,11 +1019,11 @@ pub fn generate( | ... | @@ -1019,11 +1019,11 @@ pub fn generate( |
| 1019 | 1019 | ||
| 1020 | try function.frame_allocs.resize(gpa, FrameIndex.named_count); | 1020 | try function.frame_allocs.resize(gpa, FrameIndex.named_count); |
| 1021 | function.frame_allocs.set( | 1021 | function.frame_allocs.set( |
| 1022 | @intFromEnum(FrameIndex.stack_frame), | 1022 | @backingInt(FrameIndex.stack_frame), |
| 1023 | .init(.{ .size = 0, .alignment = .@"1" }), | 1023 | .init(.{ .size = 0, .alignment = .@"1" }), |
| 1024 | ); | 1024 | ); |
| 1025 | function.frame_allocs.set( | 1025 | function.frame_allocs.set( |
| 1026 | @intFromEnum(FrameIndex.call_frame), | 1026 | @backingInt(FrameIndex.call_frame), |
| 1027 | .init(.{ .size = 0, .alignment = .@"1" }), | 1027 | .init(.{ .size = 0, .alignment = .@"1" }), |
| 1028 | ); | 1028 | ); |
| 1029 | 1029 | ||
| ... | @@ -1034,18 +1034,18 @@ pub fn generate( | ... | @@ -1034,18 +1034,18 @@ pub fn generate( |
| 1034 | function.args = call_info.args; | 1034 | function.args = call_info.args; |
| 1035 | function.ret_mcv = call_info.return_value; | 1035 | function.ret_mcv = call_info.return_value; |
| 1036 | function.err_ret_trace_reg = call_info.err_ret_trace_reg; | 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 | .size = Type.usize.abiSize(zcu), | 1038 | .size = Type.usize.abiSize(zcu), |
| 1039 | .alignment = Type.usize.abiAlignment(zcu).min(call_info.stack_align), | 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 | .size = Type.usize.abiSize(zcu), | 1042 | .size = Type.usize.abiSize(zcu), |
| 1043 | .alignment = call_info.stack_align.min( | 1043 | .alignment = call_info.stack_align.min( |
| 1044 | .fromNonzeroByteUnits(function.target.stackAlignment()), | 1044 | .fromNonzeroByteUnits(function.target.stackAlignment()), |
| 1045 | ), | 1045 | ), |
| 1046 | })); | 1046 | })); |
| 1047 | function.frame_allocs.set( | 1047 | function.frame_allocs.set( |
| 1048 | @intFromEnum(FrameIndex.args_frame), | 1048 | @backingInt(FrameIndex.args_frame), |
| 1049 | .init(.{ | 1049 | .init(.{ |
| 1050 | .size = call_info.stack_byte_count, | 1050 | .size = call_info.stack_byte_count, |
| 1051 | .alignment = call_info.stack_align, | 1051 | .alignment = call_info.stack_align, |
| ... | @@ -1148,7 +1148,7 @@ pub fn generateLazy( | ... | @@ -1148,7 +1148,7 @@ pub fn generateLazy( |
| 1148 | } | 1148 | } |
| 1149 | try function.inst_tracking.ensureTotalCapacity(gpa, Temp.Index.max); | 1149 | try function.inst_tracking.ensureTotalCapacity(gpa, Temp.Index.max); |
| 1150 | for (0..Temp.Index.max) |temp_index| { | 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 | function.inst_tracking.putAssumeCapacityNoClobber(temp.toIndex(), .init(.none)); | 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,7 +1313,7 @@ fn addExtraAssumeCapacity(self: *CodeGen, extra: anytype) u32 { |
| 1313 | self.mir_extra.appendAssumeCapacity(switch (field_type) { | 1313 | self.mir_extra.appendAssumeCapacity(switch (field_type) { |
| 1314 | u32 => @field(extra, field_name), | 1314 | u32 => @field(extra, field_name), |
| 1315 | i32, Mir.Memory.Info => @bitCast(@field(extra, field_name)), | 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 | else => @compileError("bad field type: " ++ field_name ++ ": " ++ @typeName(field_type)), | 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,7 +1333,7 @@ fn addString(cg: *CodeGen, string: []const u8) Allocator.Error!Mir.NullTerminate |
| 1333 | cg.mir_string_bytes.appendSliceAssumeCapacity(string); | 1333 | cg.mir_string_bytes.appendSliceAssumeCapacity(string); |
| 1334 | cg.mir_string_bytes.appendAssumeCapacity(0); | 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 | fn asmOps(self: *CodeGen, tag: Mir.Inst.FixedTag, ops: [4]Operand) !void { | 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,13 +2392,13 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 2392 | 2392 | ||
| 2393 | cg.reused_operands = .empty; | 2393 | cg.reused_operands = .empty; |
| 2394 | try cg.inst_tracking.ensureUnusedCapacity(cg.gpa, 1); | 2394 | try cg.inst_tracking.ensureUnusedCapacity(cg.gpa, 1); |
| 2395 | switch (air_tags[@intFromEnum(inst)]) { | 2395 | switch (air_tags[@backingInt(inst)]) { |
| 2396 | .select => try cg.airSelect(inst), | 2396 | .select => try cg.airSelect(inst), |
| 2397 | .shuffle_one, .shuffle_two => @panic("x86_64 TODO: shuffle_one/shuffle_two"), | 2397 | .shuffle_one, .shuffle_two => @panic("x86_64 TODO: shuffle_one/shuffle_two"), |
| 2398 | 2398 | ||
| 2399 | .arg => try cg.airArg(inst), | 2399 | .arg => try cg.airArg(inst), |
| 2400 | .add, .add_optimized, .add_wrap => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 2402 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 2403 | var res: [1]Temp = undefined; | 2403 | var res: [1]Temp = undefined; |
| 2404 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ | 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,7 +4560,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 4560 | }, | 4560 | }, |
| 4561 | .add_safe => unreachable, | 4561 | .add_safe => unreachable, |
| 4562 | .add_sat => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 4564 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 4565 | var res: [1]Temp = undefined; | 4565 | var res: [1]Temp = undefined; |
| 4566 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ | 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,7 +13124,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 13124 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 13124 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 13125 | }, | 13125 | }, |
| 13126 | .sub, .sub_optimized, .sub_wrap => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 13128 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 13129 | var res: [1]Temp = undefined; | 13129 | var res: [1]Temp = undefined; |
| 13130 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ | 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,7 +15311,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 15311 | }, | 15311 | }, |
| 15312 | .sub_safe => unreachable, | 15312 | .sub_safe => unreachable, |
| 15313 | .sub_sat => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 15315 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 15316 | var res: [1]Temp = undefined; | 15316 | var res: [1]Temp = undefined; |
| 15317 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ | 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,7 +22145,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 22145 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 22145 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 22146 | }, | 22146 | }, |
| 22147 | .mul, .mul_optimized => |air_tag| { | 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 | const ty = cg.typeOf(bin_op.lhs); | 22149 | const ty = cg.typeOf(bin_op.lhs); |
| 22150 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 22150 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 22151 | var res: [1]Temp = undefined; | 22151 | var res: [1]Temp = undefined; |
| ... | @@ -25083,7 +25083,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -25083,7 +25083,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 25083 | }, | 25083 | }, |
| 25084 | .mul_safe => unreachable, | 25084 | .mul_safe => unreachable, |
| 25085 | .mul_wrap => |air_tag| { | 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 | const ty = cg.typeOf(bin_op.lhs); | 25087 | const ty = cg.typeOf(bin_op.lhs); |
| 25088 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 25088 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 25089 | var res: [1]Temp = undefined; | 25089 | var res: [1]Temp = undefined; |
| ... | @@ -26888,7 +26888,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -26888,7 +26888,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 26888 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 26888 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 26889 | }, | 26889 | }, |
| 26890 | .mul_sat => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 26892 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 26893 | var res: [1]Temp = undefined; | 26893 | var res: [1]Temp = undefined; |
| 26894 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ | 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,7 +32105,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 32105 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 32105 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 32106 | }, | 32106 | }, |
| 32107 | .div_float, .div_float_optimized, .div_exact, .div_exact_optimized => |air_tag| { | 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 | const ty = cg.typeOf(bin_op.lhs); | 32109 | const ty = cg.typeOf(bin_op.lhs); |
| 32110 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 32110 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 32111 | var res: [1]Temp = undefined; | 32111 | var res: [1]Temp = undefined; |
| ... | @@ -33343,7 +33343,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -33343,7 +33343,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 33343 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 33343 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 33344 | }, | 33344 | }, |
| 33345 | .div_trunc => |air_tag| { | 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 | const ty = cg.typeOf(bin_op.lhs); | 33347 | const ty = cg.typeOf(bin_op.lhs); |
| 33348 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 33348 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 33349 | var res: [1]Temp = undefined; | 33349 | var res: [1]Temp = undefined; |
| ... | @@ -34800,7 +34800,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -34800,7 +34800,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 34800 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 34800 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 34801 | }, | 34801 | }, |
| 34802 | .div_trunc_optimized, .div_floor_optimized => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 34804 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 34805 | var res: [1]Temp = undefined; | 34805 | var res: [1]Temp = undefined; |
| 34806 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, switch (@as(bits.RoundMode.Direction, switch (air_tag) { | 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,7 +36361,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 36361 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 36361 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 36362 | }, | 36362 | }, |
| 36363 | .div_floor => |air_tag| { | 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 | const ty = cg.typeOf(bin_op.lhs); | 36365 | const ty = cg.typeOf(bin_op.lhs); |
| 36366 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 36366 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 36367 | var res: [1]Temp = undefined; | 36367 | var res: [1]Temp = undefined; |
| ... | @@ -38053,7 +38053,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -38053,7 +38053,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 38053 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 38053 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 38054 | }, | 38054 | }, |
| 38055 | .rem, .rem_optimized => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 38057 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 38058 | var res: [1]Temp = undefined; | 38058 | var res: [1]Temp = undefined; |
| 38059 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ | 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,7 +39835,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 39835 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 39835 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 39836 | }, | 39836 | }, |
| 39837 | .mod, .mod_optimized => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 39839 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 39840 | var res: [1]Temp = undefined; | 39840 | var res: [1]Temp = undefined; |
| 39841 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ | 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,7 +43348,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 43348 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 43348 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 43349 | }, | 43349 | }, |
| 43350 | .ptr_add => |air_tag| { | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 43352 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 43353 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 43353 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 43354 | try ops[0].toSlicePtr(cg); | 43354 | try ops[0].toSlicePtr(cg); |
| ... | @@ -43462,7 +43462,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -43462,7 +43462,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 43462 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 43462 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 43463 | }, | 43463 | }, |
| 43464 | .ptr_sub => |air_tag| { | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 43466 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 43467 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 43467 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 43468 | try ops[0].toSlicePtr(cg); | 43468 | try ops[0].toSlicePtr(cg); |
| ... | @@ -43591,7 +43591,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -43591,7 +43591,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 43591 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 43591 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 43592 | }, | 43592 | }, |
| 43593 | .max => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 43595 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 43596 | var res: [1]Temp = undefined; | 43596 | var res: [1]Temp = undefined; |
| 43597 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ | 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,7 +47900,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 47900 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 47900 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 47901 | }, | 47901 | }, |
| 47902 | .min => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 47904 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 47905 | var res: [1]Temp = undefined; | 47905 | var res: [1]Temp = undefined; |
| 47906 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ | 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,7 +52203,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 52203 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 52203 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 52204 | }, | 52204 | }, |
| 52205 | .add_with_overflow => |air_tag| { | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 52207 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 52208 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 52208 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 52209 | var res: [2]Temp = undefined; | 52209 | var res: [2]Temp = undefined; |
| ... | @@ -53053,7 +53053,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -53053,7 +53053,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 53053 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 53053 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 53054 | }, | 53054 | }, |
| 53055 | .sub_with_overflow => |air_tag| { | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 53057 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 53058 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 53058 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 53059 | var res: [2]Temp = undefined; | 53059 | var res: [2]Temp = undefined; |
| ... | @@ -53958,7 +53958,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -53958,7 +53958,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 53958 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 53958 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 53959 | }, | 53959 | }, |
| 53960 | .mul_with_overflow => |air_tag| { | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 53962 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 53963 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 53963 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 53964 | var res: [2]Temp = undefined; | 53964 | var res: [2]Temp = undefined; |
| ... | @@ -57555,7 +57555,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -57555,7 +57555,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 57555 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 57555 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 57556 | }, | 57556 | }, |
| 57557 | .shl_with_overflow => |air_tag| { | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 57559 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 57560 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 57560 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 57561 | var res: [2]Temp = undefined; | 57561 | var res: [2]Temp = undefined; |
| ... | @@ -60900,7 +60900,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -60900,7 +60900,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 60900 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 60900 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 60901 | }, | 60901 | }, |
| 60902 | .alloc => { | 60902 | .alloc => { |
| 60903 | const ty = air_datas[@intFromEnum(inst)].ty; | 60903 | const ty = air_datas[@backingInt(inst)].ty; |
| 60904 | const slot = try cg.tempInit(ty, .{ .lea_frame = .{ | 60904 | const slot = try cg.tempInit(ty, .{ .lea_frame = .{ |
| 60905 | .index = try cg.allocMemPtr(inst), | 60905 | .index = try cg.allocMemPtr(inst), |
| 60906 | } }); | 60906 | } }); |
| ... | @@ -60908,7 +60908,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -60908,7 +60908,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 60908 | }, | 60908 | }, |
| 60909 | .inferred_alloc, .inferred_alloc_comptime => unreachable, | 60909 | .inferred_alloc, .inferred_alloc_comptime => unreachable, |
| 60910 | .ret_ptr => { | 60910 | .ret_ptr => { |
| 60911 | const ty = air_datas[@intFromEnum(inst)].ty; | 60911 | const ty = air_datas[@backingInt(inst)].ty; |
| 60912 | var slot = switch (cg.ret_mcv.long) { | 60912 | var slot = switch (cg.ret_mcv.long) { |
| 60913 | else => unreachable, | 60913 | else => unreachable, |
| 60914 | .none => try cg.tempInit(ty, .{ .lea_frame = .{ | 60914 | .none => try cg.tempInit(ty, .{ .lea_frame = .{ |
| ... | @@ -60924,7 +60924,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -60924,7 +60924,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 60924 | }, | 60924 | }, |
| 60925 | .assembly => try cg.airAsm(inst), | 60925 | .assembly => try cg.airAsm(inst), |
| 60926 | .bit_and, .bit_or, .xor => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 60928 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 60929 | var res: [1]Temp = undefined; | 60929 | var res: [1]Temp = undefined; |
| 60930 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, switch (@as(Mir.Inst.Tag, switch (air_tag) { | 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,7 +61294,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 61294 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 61294 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 61295 | }, | 61295 | }, |
| 61296 | .shr, .shr_exact => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 61298 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 61299 | var res: [1]Temp = undefined; | 61299 | var res: [1]Temp = undefined; |
| 61300 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ | 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,7 +61858,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 61858 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 61858 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 61859 | }, | 61859 | }, |
| 61860 | .shl, .shl_exact => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 61862 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 61863 | var res: [1]Temp = undefined; | 61863 | var res: [1]Temp = undefined; |
| 61864 | cg.select(&res, &.{cg.typeOf(bin_op.lhs)}, &ops, comptime &.{ .{ | 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,7 +62232,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 62232 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 62232 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 62233 | }, | 62233 | }, |
| 62234 | .shl_sat => |air_tag| { | 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 | const lhs_ty = cg.typeOf(bin_op.lhs); | 62236 | const lhs_ty = cg.typeOf(bin_op.lhs); |
| 62237 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 62237 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 62238 | var res: [1]Temp = undefined; | 62238 | var res: [1]Temp = undefined; |
| ... | @@ -65655,7 +65655,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -65655,7 +65655,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 65655 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 65655 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 65656 | }, | 65656 | }, |
| 65657 | .not => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 65659 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 65660 | var res: [1]Temp = undefined; | 65660 | var res: [1]Temp = undefined; |
| 65661 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +67464,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 67464 | try cg.genBodyBlock(block.body); | 67464 | try cg.genBodyBlock(block.body); |
| 67465 | }, | 67465 | }, |
| 67466 | .repeat => { | 67466 | .repeat => { |
| 67467 | const repeat = air_datas[@intFromEnum(inst)].repeat; | 67467 | const repeat = air_datas[@backingInt(inst)].repeat; |
| 67468 | const loop = cg.loops.get(repeat.loop_inst).?; | 67468 | const loop = cg.loops.get(repeat.loop_inst).?; |
| 67469 | try cg.restoreState(loop.state, &.{}, .{ | 67469 | try cg.restoreState(loop.state, &.{}, .{ |
| 67470 | .emit_instructions = true, | 67470 | .emit_instructions = true, |
| ... | @@ -67495,7 +67495,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -67495,7 +67495,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 67495 | .call_never_tail => try cg.airCall(inst, .never_tail, .{ .safety = true }), | 67495 | .call_never_tail => try cg.airCall(inst, .never_tail, .{ .safety = true }), |
| 67496 | .call_never_inline => try cg.airCall(inst, .never_inline, .{ .safety = true }), | 67496 | .call_never_inline => try cg.airCall(inst, .never_inline, .{ .safety = true }), |
| 67497 | .clz => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 67499 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 67500 | var res: [1]Temp = undefined; | 67500 | var res: [1]Temp = undefined; |
| 67501 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +70600,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 70600 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 70600 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 70601 | }, | 70601 | }, |
| 70602 | .ctz => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 70604 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 70605 | var res: [1]Temp = undefined; | 70605 | var res: [1]Temp = undefined; |
| 70606 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +70997,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 70997 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 70997 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 70998 | }, | 70998 | }, |
| 70999 | .popcount => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 71001 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 71002 | var res: [1]Temp = undefined; | 71002 | var res: [1]Temp = undefined; |
| 71003 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +71885,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 71885 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 71885 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 71886 | }, | 71886 | }, |
| 71887 | .byte_swap => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 71889 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 71890 | var res: [1]Temp = undefined; | 71890 | var res: [1]Temp = undefined; |
| 71891 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +72534,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 72534 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 72534 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 72535 | }, | 72535 | }, |
| 72536 | .bit_reverse => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 72538 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 72539 | var res: [1]Temp = undefined; | 72539 | var res: [1]Temp = undefined; |
| 72540 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +75636,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 75636 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 75636 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 75637 | }, | 75637 | }, |
| 75638 | .sqrt => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{un_op}); | 75640 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 75641 | var res: [1]Temp = undefined; | 75641 | var res: [1]Temp = undefined; |
| 75642 | cg.select(&res, &.{cg.typeOf(un_op)}, &ops, comptime &.{ .{ | 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,7 +76698,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 76698 | try res[0].finish(inst, &.{un_op}, &ops, cg); | 76698 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 76699 | }, | 76699 | }, |
| 76700 | .sin, .cos, .tan, .exp, .exp2, .log, .log2, .log10, .round => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{un_op}); | 76702 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 76703 | var res: [1]Temp = undefined; | 76703 | var res: [1]Temp = undefined; |
| 76704 | cg.select(&res, &.{cg.typeOf(un_op)}, &ops, switch (air_tag) { | 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,7 +77548,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 77548 | try res[0].finish(inst, &.{un_op}, &ops, cg); | 77548 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 77549 | }, | 77549 | }, |
| 77550 | .abs => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 77552 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 77553 | var res: [1]Temp = undefined; | 77553 | var res: [1]Temp = undefined; |
| 77554 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +79099,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 79099 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 79099 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 79100 | }, | 79100 | }, |
| 79101 | .floor, .ceil, .trunc_float => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{un_op}); | 79103 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 79104 | var res: [1]Temp = undefined; | 79104 | var res: [1]Temp = undefined; |
| 79105 | cg.select(&res, &.{cg.typeOf(un_op)}, &ops, switch (@as(bits.RoundMode.Direction, switch (air_tag) { | 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,7 +80435,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 80435 | try res[0].finish(inst, &.{un_op}, &ops, cg); | 80435 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 80436 | }, | 80436 | }, |
| 80437 | .neg, .neg_optimized => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{un_op}); | 80439 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 80440 | var res: [1]Temp = undefined; | 80440 | var res: [1]Temp = undefined; |
| 80441 | cg.select(&res, &.{cg.typeOf(un_op)}, &ops, comptime &.{ .{ | 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,7 +80983,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 80983 | .cmp_gt, | 80983 | .cmp_gt, |
| 80984 | .cmp_gt_optimized, | 80984 | .cmp_gt_optimized, |
| 80985 | => |air_tag| { | 80985 | => |air_tag| { |
| 80986 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | 80986 | const bin_op = air_datas[@backingInt(inst)].bin_op; |
| 80987 | const cmp_op = air_tag.toCmpOp().?; | 80987 | const cmp_op = air_tag.toCmpOp().?; |
| 80988 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 80988 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 80989 | var res: [1]Temp = undefined; | 80989 | var res: [1]Temp = undefined; |
| ... | @@ -81460,7 +81460,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -81460,7 +81460,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 81460 | .cmp_neq, | 81460 | .cmp_neq, |
| 81461 | .cmp_neq_optimized, | 81461 | .cmp_neq_optimized, |
| 81462 | => |air_tag| { | 81462 | => |air_tag| { |
| 81463 | const bin_op = air_datas[@intFromEnum(inst)].bin_op; | 81463 | const bin_op = air_datas[@backingInt(inst)].bin_op; |
| 81464 | const cmp_op = air_tag.toCmpOp().?; | 81464 | const cmp_op = air_tag.toCmpOp().?; |
| 81465 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 81465 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 81466 | const ty = cg.typeOf(bin_op.lhs); | 81466 | const ty = cg.typeOf(bin_op.lhs); |
| ... | @@ -82059,7 +82059,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -82059,7 +82059,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 82059 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 82059 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 82060 | }, | 82060 | }, |
| 82061 | .cmp_vector, .cmp_vector_optimized => |air_tag| { | 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 | const vector_cmp = cg.air.extraData(Air.VectorCmp, ty_pl.payload).data; | 82063 | const vector_cmp = cg.air.extraData(Air.VectorCmp, ty_pl.payload).data; |
| 82064 | var ops = try cg.tempsFromOperands(inst, .{ vector_cmp.lhs, vector_cmp.rhs }); | 82064 | var ops = try cg.tempsFromOperands(inst, .{ vector_cmp.lhs, vector_cmp.rhs }); |
| 82065 | var res: [1]Temp = undefined; | 82065 | var res: [1]Temp = undefined; |
| ... | @@ -89128,7 +89128,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -89128,7 +89128,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89128 | .@"try", .try_cold => try cg.airTry(inst), | 89128 | .@"try", .try_cold => try cg.airTry(inst), |
| 89129 | .try_ptr, .try_ptr_cold => try cg.airTryPtr(inst), | 89129 | .try_ptr, .try_ptr_cold => try cg.airTryPtr(inst), |
| 89130 | .dbg_stmt => if (!cg.mod.strip) { | 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 | _ = try cg.addInst(.{ | 89132 | _ = try cg.addInst(.{ |
| 89133 | .tag = .pseudo, | 89133 | .tag = .pseudo, |
| 89134 | .ops = .pseudo_dbg_line_stmt_line_column, | 89134 | .ops = .pseudo_dbg_line_stmt_line_column, |
| ... | @@ -89164,8 +89164,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -89164,8 +89164,8 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89164 | }); | 89164 | }); |
| 89165 | }, | 89165 | }, |
| 89166 | .dbg_var_ptr, .dbg_var_val, .dbg_arg_inline => |air_tag| if (!cg.mod.strip) { | 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; | 89167 | const pl_op = air_datas[@backingInt(inst)].pl_op; |
| 89168 | const air_name: Air.NullTerminatedString = @enumFromInt(pl_op.payload); | 89168 | const air_name: Air.NullTerminatedString = @fromBackingInt(@intCast(pl_op.payload)); |
| 89169 | const op_ty = cg.typeOf(pl_op.operand); | 89169 | const op_ty = cg.typeOf(pl_op.operand); |
| 89170 | const local_ty = switch (air_tag) { | 89170 | const local_ty = switch (air_tag) { |
| 89171 | else => unreachable, | 89171 | else => unreachable, |
| ... | @@ -89202,7 +89202,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -89202,7 +89202,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89202 | try ops[0].die(cg); | 89202 | try ops[0].die(cg); |
| 89203 | }, | 89203 | }, |
| 89204 | .is_null => { | 89204 | .is_null => { |
| 89205 | const un_op = air_datas[@intFromEnum(inst)].un_op; | 89205 | const un_op = air_datas[@backingInt(inst)].un_op; |
| 89206 | const opt_ty = cg.typeOf(un_op); | 89206 | const opt_ty = cg.typeOf(un_op); |
| 89207 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); | 89207 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); |
| 89208 | const opt_child_ty = opt_ty.optionalChild(zcu); | 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,7 +89227,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89227 | try is_null.finish(inst, &.{un_op}, &ops, cg); | 89227 | try is_null.finish(inst, &.{un_op}, &ops, cg); |
| 89228 | }, | 89228 | }, |
| 89229 | .is_non_null => { | 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 | const opt_ty = cg.typeOf(un_op); | 89231 | const opt_ty = cg.typeOf(un_op); |
| 89232 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); | 89232 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); |
| 89233 | const opt_child_ty = opt_ty.optionalChild(zcu); | 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,7 +89252,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89252 | try is_non_null.finish(inst, &.{un_op}, &ops, cg); | 89252 | try is_non_null.finish(inst, &.{un_op}, &ops, cg); |
| 89253 | }, | 89253 | }, |
| 89254 | .is_null_ptr => { | 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 | const opt_ty = cg.typeOf(un_op).childType(zcu); | 89256 | const opt_ty = cg.typeOf(un_op).childType(zcu); |
| 89257 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); | 89257 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); |
| 89258 | const opt_child_ty = opt_ty.optionalChild(zcu); | 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,7 +89275,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89275 | try is_null.finish(inst, &.{un_op}, &ops, cg); | 89275 | try is_null.finish(inst, &.{un_op}, &ops, cg); |
| 89276 | }, | 89276 | }, |
| 89277 | .is_non_null_ptr => { | 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 | const opt_ty = cg.typeOf(un_op).childType(zcu); | 89279 | const opt_ty = cg.typeOf(un_op).childType(zcu); |
| 89280 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); | 89280 | const opt_repr_is_pl = opt_ty.optionalReprIsPayload(zcu); |
| 89281 | const opt_child_ty = opt_ty.optionalChild(zcu); | 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,7 +89298,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89298 | try is_non_null.finish(inst, &.{un_op}, &ops, cg); | 89298 | try is_non_null.finish(inst, &.{un_op}, &ops, cg); |
| 89299 | }, | 89299 | }, |
| 89300 | .is_err => { | 89300 | .is_err => { |
| 89301 | const un_op = air_datas[@intFromEnum(inst)].un_op; | 89301 | const un_op = air_datas[@backingInt(inst)].un_op; |
| 89302 | const eu_ty = cg.typeOf(un_op); | 89302 | const eu_ty = cg.typeOf(un_op); |
| 89303 | const eu_err_ty = eu_ty.errorUnionSet(zcu); | 89303 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 89304 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); | 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,7 +89314,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89314 | try is_err.finish(inst, &.{un_op}, &ops, cg); | 89314 | try is_err.finish(inst, &.{un_op}, &ops, cg); |
| 89315 | }, | 89315 | }, |
| 89316 | .is_non_err => { | 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 | const eu_ty = cg.typeOf(un_op); | 89318 | const eu_ty = cg.typeOf(un_op); |
| 89319 | const eu_err_ty = eu_ty.errorUnionSet(zcu); | 89319 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 89320 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); | 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,7 +89330,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89330 | try is_non_err.finish(inst, &.{un_op}, &ops, cg); | 89330 | try is_non_err.finish(inst, &.{un_op}, &ops, cg); |
| 89331 | }, | 89331 | }, |
| 89332 | .is_err_ptr => { | 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 | const eu_ty = cg.typeOf(un_op).childType(zcu); | 89334 | const eu_ty = cg.typeOf(un_op).childType(zcu); |
| 89335 | const eu_err_ty = eu_ty.errorUnionSet(zcu); | 89335 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 89336 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); | 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,7 +89346,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89346 | try is_err.finish(inst, &.{un_op}, &ops, cg); | 89346 | try is_err.finish(inst, &.{un_op}, &ops, cg); |
| 89347 | }, | 89347 | }, |
| 89348 | .is_non_err_ptr => { | 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 | const eu_ty = cg.typeOf(un_op).childType(zcu); | 89350 | const eu_ty = cg.typeOf(un_op).childType(zcu); |
| 89351 | const eu_err_ty = eu_ty.errorUnionSet(zcu); | 89351 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 89352 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); | 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,7 +89362,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89362 | try is_non_err.finish(inst, &.{un_op}, &ops, cg); | 89362 | try is_non_err.finish(inst, &.{un_op}, &ops, cg); |
| 89363 | }, | 89363 | }, |
| 89364 | .load => { | 89364 | .load => { |
| 89365 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | 89365 | const ty_op = air_datas[@backingInt(inst)].ty_op; |
| 89366 | const val_ty = ty_op.ty.toType(); | 89366 | const val_ty = ty_op.ty.toType(); |
| 89367 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 89367 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 89368 | var res: [1]Temp = undefined; | 89368 | var res: [1]Temp = undefined; |
| ... | @@ -89414,7 +89414,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -89414,7 +89414,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89414 | error.SelectFailed => res[0] = try ops[0].load(val_ty, .{ | 89414 | error.SelectFailed => res[0] = try ops[0].load(val_ty, .{ |
| 89415 | .disp = switch (cg.typeOf(ty_op.operand).ptrInfo(zcu).flags.vector_index) { | 89415 | .disp = switch (cg.typeOf(ty_op.operand).ptrInfo(zcu).flags.vector_index) { |
| 89416 | .none => 0, | 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 | }, cg), | 89419 | }, cg), |
| 89420 | else => |e| return e, | 89420 | else => |e| return e, |
| ... | @@ -89425,7 +89425,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -89425,7 +89425,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89425 | .ret_safe => try cg.airRet(inst, true), | 89425 | .ret_safe => try cg.airRet(inst, true), |
| 89426 | .ret_load => try cg.airRetLoad(inst), | 89426 | .ret_load => try cg.airRetLoad(inst), |
| 89427 | .store, .store_safe => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 89429 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 89430 | switch (ops[1].tracking(cg).short) { | 89430 | switch (ops[1].tracking(cg).short) { |
| 89431 | else => {}, | 89431 | else => {}, |
| ... | @@ -89675,7 +89675,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -89675,7 +89675,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89675 | error.SelectFailed => try ops[0].store(&ops[1], .{ | 89675 | error.SelectFailed => try ops[0].store(&ops[1], .{ |
| 89676 | .disp = switch (cg.typeOf(bin_op.lhs).ptrInfo(zcu).flags.vector_index) { | 89676 | .disp = switch (cg.typeOf(bin_op.lhs).ptrInfo(zcu).flags.vector_index) { |
| 89677 | .none => 0, | 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 | .safe = switch (air_tag) { | 89680 | .safe = switch (air_tag) { |
| 89681 | else => unreachable, | 89681 | else => unreachable, |
| ... | @@ -89689,7 +89689,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -89689,7 +89689,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 89689 | }, | 89689 | }, |
| 89690 | .unreach => {}, | 89690 | .unreach => {}, |
| 89691 | .fptrunc => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 89693 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 89694 | var res: [1]Temp = undefined; | 89694 | var res: [1]Temp = undefined; |
| 89695 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +91714,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 91714 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 91714 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 91715 | }, | 91715 | }, |
| 91716 | .fpext => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 91718 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 91719 | var res: [1]Temp = undefined; | 91719 | var res: [1]Temp = undefined; |
| 91720 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +93389,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 93389 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 93389 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 93390 | }, | 93390 | }, |
| 93391 | .int_cast => |air_tag| { | 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 | const dst_ty = ty_op.ty.toType(); | 93393 | const dst_ty = ty_op.ty.toType(); |
| 93394 | const src_ty = cg.typeOf(ty_op.operand); | 93394 | const src_ty = cg.typeOf(ty_op.operand); |
| 93395 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 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,7 +98148,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 98148 | }, | 98148 | }, |
| 98149 | .int_cast_safe => unreachable, | 98149 | .int_cast_safe => unreachable, |
| 98150 | .trunc => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 98152 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 98153 | var res: [1]Temp = undefined; | 98153 | var res: [1]Temp = undefined; |
| 98154 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +103813,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103813 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 103813 | try res[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103814 | }, | 103814 | }, |
| 103815 | .optional_payload => { | 103815 | .optional_payload => { |
| 103816 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | 103816 | const ty_op = air_datas[@backingInt(inst)].ty_op; |
| 103817 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 103817 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 103818 | const pl = if (!hack_around_sema_opv_bugs or ty_op.ty.toType().hasRuntimeBits(zcu)) | 103818 | const pl = if (!hack_around_sema_opv_bugs or ty_op.ty.toType().hasRuntimeBits(zcu)) |
| 103819 | try ops[0].read(ty_op.ty.toType(), .{}, cg) | 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,12 +103822,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103822 | try pl.finish(inst, &.{ty_op.operand}, &ops, cg); | 103822 | try pl.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103823 | }, | 103823 | }, |
| 103824 | .optional_payload_ptr => { | 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 | const ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 103826 | const ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 103827 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 103827 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103828 | }, | 103828 | }, |
| 103829 | .optional_payload_ptr_set => { | 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 | const opt_ty = cg.typeOf(ty_op.operand).childType(zcu); | 103831 | const opt_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 103832 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 103832 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 103833 | if (!opt_ty.optionalReprIsPayload(zcu)) { | 103833 | if (!opt_ty.optionalReprIsPayload(zcu)) { |
| ... | @@ -103842,7 +103842,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -103842,7 +103842,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103842 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 103842 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103843 | }, | 103843 | }, |
| 103844 | .wrap_optional => { | 103844 | .wrap_optional => { |
| 103845 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | 103845 | const ty_op = air_datas[@backingInt(inst)].ty_op; |
| 103846 | const opt_ty = ty_op.ty.toType(); | 103846 | const opt_ty = ty_op.ty.toType(); |
| 103847 | const opt_pl_ty = cg.typeOf(ty_op.operand); | 103847 | const opt_pl_ty = cg.typeOf(ty_op.operand); |
| 103848 | const opt_pl_abi_size: u31 = @intCast(opt_pl_ty.abiSize(zcu)); | 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,7 +103857,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103857 | try opt.finish(inst, &.{ty_op.operand}, &ops, cg); | 103857 | try opt.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103858 | }, | 103858 | }, |
| 103859 | .unwrap_errunion_payload => { | 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 | const eu_pl_ty = ty_op.ty.toType(); | 103861 | const eu_pl_ty = ty_op.ty.toType(); |
| 103862 | const eu_pl_off: i32 = @intCast(codegen.errUnionPayloadOffset(eu_pl_ty, zcu)); | 103862 | const eu_pl_off: i32 = @intCast(codegen.errUnionPayloadOffset(eu_pl_ty, zcu)); |
| 103863 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 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,7 +103868,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103868 | try pl.finish(inst, &.{ty_op.operand}, &ops, cg); | 103868 | try pl.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103869 | }, | 103869 | }, |
| 103870 | .unwrap_errunion_err => { | 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 | const eu_ty = cg.typeOf(ty_op.operand); | 103872 | const eu_ty = cg.typeOf(ty_op.operand); |
| 103873 | const eu_err_ty = ty_op.ty.toType(); | 103873 | const eu_err_ty = ty_op.ty.toType(); |
| 103874 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); | 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,7 +103878,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103878 | try err.finish(inst, &.{ty_op.operand}, &ops, cg); | 103878 | try err.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103879 | }, | 103879 | }, |
| 103880 | .unwrap_errunion_payload_ptr => { | 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 | const eu_ty = cg.typeOf(ty_op.operand).childType(zcu); | 103882 | const eu_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 103883 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); | 103883 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); |
| 103884 | const eu_pl_off: i32 = @intCast(codegen.errUnionPayloadOffset(eu_pl_ty, zcu)); | 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,7 +103887,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103887 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 103887 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103888 | }, | 103888 | }, |
| 103889 | .unwrap_errunion_err_ptr => { | 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 | const eu_ty = cg.typeOf(ty_op.operand).childType(zcu); | 103891 | const eu_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 103892 | const eu_err_ty = ty_op.ty.toType(); | 103892 | const eu_err_ty = ty_op.ty.toType(); |
| 103893 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); | 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,7 +103898,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103898 | try err.finish(inst, &.{ty_op.operand}, &ops, cg); | 103898 | try err.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103899 | }, | 103899 | }, |
| 103900 | .errunion_payload_ptr_set => { | 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 | const eu_ty = cg.typeOf(ty_op.operand).childType(zcu); | 103902 | const eu_ty = cg.typeOf(ty_op.operand).childType(zcu); |
| 103903 | const eu_err_ty = eu_ty.errorUnionSet(zcu); | 103903 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 103904 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); | 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,7 +103913,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103913 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 103913 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103914 | }, | 103914 | }, |
| 103915 | .wrap_errunion_payload => { | 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 | const eu_ty = ty_op.ty.toType(); | 103917 | const eu_ty = ty_op.ty.toType(); |
| 103918 | const eu_err_ty = eu_ty.errorUnionSet(zcu); | 103918 | const eu_err_ty = eu_ty.errorUnionSet(zcu); |
| 103919 | const eu_pl_ty = cg.typeOf(ty_op.operand); | 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,7 +103928,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103928 | try eu.finish(inst, &.{ty_op.operand}, &ops, cg); | 103928 | try eu.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103929 | }, | 103929 | }, |
| 103930 | .wrap_errunion_err => { | 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 | const eu_ty = ty_op.ty.toType(); | 103932 | const eu_ty = ty_op.ty.toType(); |
| 103933 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); | 103933 | const eu_pl_ty = eu_ty.errorUnionPayload(zcu); |
| 103934 | const eu_err_off: u31 = @intCast(codegen.errUnionErrorOffset(eu_pl_ty, zcu)); | 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,7 +103938,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103938 | try eu.finish(inst, &.{ty_op.operand}, &ops, cg); | 103938 | try eu.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103939 | }, | 103939 | }, |
| 103940 | .struct_field_ptr => { | 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 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; | 103942 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 103943 | var ops = try cg.tempsFromOperands(inst, .{struct_field.struct_operand}); | 103943 | var ops = try cg.tempsFromOperands(inst, .{struct_field.struct_operand}); |
| 103944 | try ops[0].toOffset(@intCast(codegen.fieldOffset( | 103944 | try ops[0].toOffset(@intCast(codegen.fieldOffset( |
| ... | @@ -103954,7 +103954,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -103954,7 +103954,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103954 | .struct_field_ptr_index_2, | 103954 | .struct_field_ptr_index_2, |
| 103955 | .struct_field_ptr_index_3, | 103955 | .struct_field_ptr_index_3, |
| 103956 | => |air_tag| { | 103956 | => |air_tag| { |
| 103957 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | 103957 | const ty_op = air_datas[@backingInt(inst)].ty_op; |
| 103958 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 103958 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 103959 | try ops[0].toOffset(@intCast(codegen.fieldOffset( | 103959 | try ops[0].toOffset(@intCast(codegen.fieldOffset( |
| 103960 | cg.typeOf(ty_op.operand), | 103960 | cg.typeOf(ty_op.operand), |
| ... | @@ -103971,7 +103971,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -103971,7 +103971,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103971 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 103971 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 103972 | }, | 103972 | }, |
| 103973 | .agg_field_val => { | 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 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; | 103975 | const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; |
| 103976 | const agg_ty = cg.typeOf(struct_field.struct_operand); | 103976 | const agg_ty = cg.typeOf(struct_field.struct_operand); |
| 103977 | const field_ty = ty_pl.ty.toType(); | 103977 | const field_ty = ty_pl.ty.toType(); |
| ... | @@ -103987,7 +103987,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -103987,7 +103987,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103987 | try res.finish(inst, &.{struct_field.struct_operand}, &ops, cg); | 103987 | try res.finish(inst, &.{struct_field.struct_operand}, &ops, cg); |
| 103988 | }, | 103988 | }, |
| 103989 | .set_union_tag => { | 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 | const union_ty = cg.typeOf(bin_op.lhs).childType(zcu); | 103991 | const union_ty = cg.typeOf(bin_op.lhs).childType(zcu); |
| 103992 | const union_layout = union_ty.unionGetLayout(zcu); | 103992 | const union_layout = union_ty.unionGetLayout(zcu); |
| 103993 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 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,7 +103998,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 103998 | try res.finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 103998 | try res.finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 103999 | }, | 103999 | }, |
| 104000 | .get_union_tag => { | 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 | const union_ty = cg.typeOf(ty_op.operand); | 104002 | const union_ty = cg.typeOf(ty_op.operand); |
| 104003 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 104003 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104004 | const union_layout = union_ty.unionGetLayout(zcu); | 104004 | const union_layout = union_ty.unionGetLayout(zcu); |
| ... | @@ -104009,38 +104009,38 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -104009,38 +104009,38 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 104009 | try res.finish(inst, &.{ty_op.operand}, &ops, cg); | 104009 | try res.finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104010 | }, | 104010 | }, |
| 104011 | .slice => { | 104011 | .slice => { |
| 104012 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | 104012 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; |
| 104013 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 104013 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 104014 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 104014 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 104015 | try ops[0].toPair(&ops[1], cg); | 104015 | try ops[0].toPair(&ops[1], cg); |
| 104016 | try ops[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 104016 | try ops[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 104017 | }, | 104017 | }, |
| 104018 | .slice_len => { | 104018 | .slice_len => { |
| 104019 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | 104019 | const ty_op = air_datas[@backingInt(inst)].ty_op; |
| 104020 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 104020 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104021 | try ops[0].toSliceLen(cg); | 104021 | try ops[0].toSliceLen(cg); |
| 104022 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 104022 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104023 | }, | 104023 | }, |
| 104024 | .slice_ptr => { | 104024 | .slice_ptr => { |
| 104025 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | 104025 | const ty_op = air_datas[@backingInt(inst)].ty_op; |
| 104026 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 104026 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104027 | try ops[0].toSlicePtr(cg); | 104027 | try ops[0].toSlicePtr(cg); |
| 104028 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 104028 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104029 | }, | 104029 | }, |
| 104030 | .ptr_slice_len_ptr => { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 104032 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104033 | try ops[0].toOffset(8, cg); | 104033 | try ops[0].toOffset(8, cg); |
| 104034 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 104034 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104035 | }, | 104035 | }, |
| 104036 | .ptr_slice_ptr_ptr => { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 104038 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104039 | try ops[0].toOffset(0, cg); | 104039 | try ops[0].toOffset(0, cg); |
| 104040 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 104040 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104041 | }, | 104041 | }, |
| 104042 | .array_elem_val, .legalize_vec_elem_val => { | 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 | const array_ty = cg.typeOf(bin_op.lhs); | 104044 | const array_ty = cg.typeOf(bin_op.lhs); |
| 104045 | const res_ty = array_ty.childType(zcu); | 104045 | const res_ty = array_ty.childType(zcu); |
| 104046 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 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,7 +104236,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 104236 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 104236 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 104237 | }, | 104237 | }, |
| 104238 | .slice_elem_val, .ptr_elem_val => { | 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 | const res_ty = cg.typeOf(bin_op.lhs).indexableElem(zcu); | 104240 | const res_ty = cg.typeOf(bin_op.lhs).indexableElem(zcu); |
| 104241 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 104241 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 104242 | try ops[0].toSlicePtr(cg); | 104242 | try ops[0].toSlicePtr(cg); |
| ... | @@ -104359,7 +104359,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -104359,7 +104359,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 104359 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 104359 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 104360 | }, | 104360 | }, |
| 104361 | .slice_elem_ptr, .ptr_elem_ptr => { | 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 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; | 104363 | const bin_op = cg.air.extraData(Air.Bin, ty_pl.payload).data; |
| 104364 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); | 104364 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }); |
| 104365 | try ops[0].toSlicePtr(cg); | 104365 | try ops[0].toSlicePtr(cg); |
| ... | @@ -104406,7 +104406,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -104406,7 +104406,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 104406 | try ops[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); | 104406 | try ops[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs }, &ops, cg); |
| 104407 | }, | 104407 | }, |
| 104408 | .array_to_slice => { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 104410 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104411 | var len = try cg.tempInit(.usize, .{ | 104411 | var len = try cg.tempInit(.usize, .{ |
| 104412 | .immediate = cg.typeOf(ty_op.operand).childType(zcu).arrayLen(zcu), | 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,7 +104415,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 104415 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 104415 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 104416 | }, | 104416 | }, |
| 104417 | .int_from_float, .int_from_float_optimized => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 104419 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 104420 | var res: [1]Temp = undefined; | 104420 | var res: [1]Temp = undefined; |
| 104421 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +115184,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 115184 | .int_from_float_safe => unreachable, | 115184 | .int_from_float_safe => unreachable, |
| 115185 | .int_from_float_optimized_safe => unreachable, | 115185 | .int_from_float_optimized_safe => unreachable, |
| 115186 | .float_from_int => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 115188 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 115189 | var res: [1]Temp = undefined; | 115189 | var res: [1]Temp = undefined; |
| 115190 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +127202,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 127202 | }, | 127202 | }, |
| 127203 | .reduce => |air_tag| { | 127203 | .reduce => |air_tag| { |
| 127204 | const nan = std.math.nan(f16); | 127204 | const nan = std.math.nan(f16); |
| 127205 | const reduce = air_datas[@intFromEnum(inst)].reduce; | 127205 | const reduce = air_datas[@backingInt(inst)].reduce; |
| 127206 | const res_ty = cg.typeOfIndex(inst); | 127206 | const res_ty = cg.typeOfIndex(inst); |
| 127207 | var ops = try cg.tempsFromOperands(inst, .{reduce.operand}); | 127207 | var ops = try cg.tempsFromOperands(inst, .{reduce.operand}); |
| 127208 | var res: [1]Temp = undefined; | 127208 | var res: [1]Temp = undefined; |
| ... | @@ -161404,7 +161404,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -161404,7 +161404,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 161404 | }, | 161404 | }, |
| 161405 | .reduce_optimized => |air_tag| { | 161405 | .reduce_optimized => |air_tag| { |
| 161406 | const inf = std.math.inf(f16); | 161406 | const inf = std.math.inf(f16); |
| 161407 | const reduce = air_datas[@intFromEnum(inst)].reduce; | 161407 | const reduce = air_datas[@backingInt(inst)].reduce; |
| 161408 | var ops = try cg.tempsFromOperands(inst, .{reduce.operand}); | 161408 | var ops = try cg.tempsFromOperands(inst, .{reduce.operand}); |
| 161409 | var res: [1]Temp = undefined; | 161409 | var res: [1]Temp = undefined; |
| 161410 | cg.select(&res, &.{cg.typeOfIndex(inst)}, &ops, switch (reduce.operation) { | 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,7 +169105,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 169105 | try res[0].finish(inst, &.{reduce.operand}, &ops, cg); | 169105 | try res[0].finish(inst, &.{reduce.operand}, &ops, cg); |
| 169106 | }, | 169106 | }, |
| 169107 | .splat => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 169109 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 169110 | var res: [1]Temp = undefined; | 169110 | var res: [1]Temp = undefined; |
| 169111 | cg.select(&res, &.{ty_op.ty.toType()}, &ops, comptime &.{ .{ | 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,7 +170948,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 170948 | .memset => try cg.airMemset(inst, false), | 170948 | .memset => try cg.airMemset(inst, false), |
| 170949 | .memset_safe => try cg.airMemset(inst, true), | 170949 | .memset_safe => try cg.airMemset(inst, true), |
| 170950 | .memcpy, .memmove => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }) ++ .{undefined}; | 170952 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs }) ++ .{undefined}; |
| 170953 | ops[2] = ops[0].getByteLen(cg) catch |err| switch (err) { | 170953 | ops[2] = ops[0].getByteLen(cg) catch |err| switch (err) { |
| 170954 | error.SelectFailed => return cg.fail("failed to select {s} {f} {f} {f} {f}", .{ | 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,7 +171012,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171012 | .atomic_store_seq_cst => try cg.airAtomicStore(inst, .seq_cst), | 171012 | .atomic_store_seq_cst => try cg.airAtomicStore(inst, .seq_cst), |
| 171013 | .atomic_rmw => try cg.airAtomicRmw(inst), | 171013 | .atomic_rmw => try cg.airAtomicRmw(inst), |
| 171014 | .is_named_enum_value => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{un_op}); | 171016 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 171017 | var res: [1]Temp = undefined; | 171017 | var res: [1]Temp = undefined; |
| 171018 | cg.select(&res, &.{.bool}, &ops, comptime &.{ .{ | 171018 | cg.select(&res, &.{.bool}, &ops, comptime &.{ .{ |
| ... | @@ -171183,7 +171183,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -171183,7 +171183,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171183 | try res[0].finish(inst, &.{un_op}, &ops, cg); | 171183 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 171184 | }, | 171184 | }, |
| 171185 | .tag_name => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{un_op}); | 171187 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 171188 | var res: [1]Temp = undefined; | 171188 | var res: [1]Temp = undefined; |
| 171189 | cg.select(&res, &.{.slice_const_u8_sentinel_0}, &ops, comptime &.{ .{ | 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,7 +171350,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171350 | try res[0].finish(inst, &.{un_op}, &ops, cg); | 171350 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 171351 | }, | 171351 | }, |
| 171352 | .error_name => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{un_op}); | 171354 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 171355 | var res: [2]Temp = undefined; | 171355 | var res: [2]Temp = undefined; |
| 171356 | cg.select(&res, &.{ .slice_const_u8_sentinel_0, .usize }, &ops, comptime &.{ .{ | 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,7 +171458,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171458 | try res[0].finish(inst, &.{un_op}, &ops, cg); | 171458 | try res[0].finish(inst, &.{un_op}, &ops, cg); |
| 171459 | }, | 171459 | }, |
| 171460 | .error_set_has_value => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}) ++ .{try cg.tempInit(ty_op.ty.toType(), .none)}; | 171462 | var ops = try cg.tempsFromOperands(inst, .{ty_op.operand}) ++ .{try cg.tempInit(ty_op.ty.toType(), .none)}; |
| 171463 | var res: [1]Temp = undefined; | 171463 | var res: [1]Temp = undefined; |
| 171464 | cg.select(&res, &.{.bool}, &ops, comptime &.{ .{ | 171464 | cg.select(&res, &.{.bool}, &ops, comptime &.{ .{ |
| ... | @@ -171550,7 +171550,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -171550,7 +171550,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171550 | try res[0].finish(inst, &.{ty_op.operand}, ops[0..1], cg); | 171550 | try res[0].finish(inst, &.{ty_op.operand}, ops[0..1], cg); |
| 171551 | }, | 171551 | }, |
| 171552 | .aggregate_init => |air_tag| fallback: { | 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 | const agg_ty = ty_pl.ty.toType(); | 171554 | const agg_ty = ty_pl.ty.toType(); |
| 171555 | if (agg_ty.isVector(zcu) and agg_ty.childType(zcu).toIntern() == .bool_type) { | 171555 | if (agg_ty.isVector(zcu) and agg_ty.childType(zcu).toIntern() == .bool_type) { |
| 171556 | break :fallback try cg.airAggregateInitBoolVec(inst); | 171556 | break :fallback try cg.airAggregateInitBoolVec(inst); |
| ... | @@ -171620,7 +171620,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -171620,7 +171620,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171620 | try res.finish(inst, &.{}, &.{}, cg); | 171620 | try res.finish(inst, &.{}, &.{}, cg); |
| 171621 | }, | 171621 | }, |
| 171622 | .union_init => { | 171622 | .union_init => { |
| 171623 | const ty_pl = air_datas[@intFromEnum(inst)].ty_pl; | 171623 | const ty_pl = air_datas[@backingInt(inst)].ty_pl; |
| 171624 | const union_init = cg.air.extraData(Air.UnionInit, ty_pl.payload).data; | 171624 | const union_init = cg.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| 171625 | const union_ty = ty_pl.ty.toType(); | 171625 | const union_ty = ty_pl.ty.toType(); |
| 171626 | var ops = try cg.tempsFromOperands(inst, .{union_init.init}); | 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,7 +171642,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171642 | try res.finish(inst, &.{union_init.init}, &ops, cg); | 171642 | try res.finish(inst, &.{union_init.init}, &ops, cg); |
| 171643 | }, | 171643 | }, |
| 171644 | .prefetch => { | 171644 | .prefetch => { |
| 171645 | const prefetch = air_datas[@intFromEnum(inst)].prefetch; | 171645 | const prefetch = air_datas[@backingInt(inst)].prefetch; |
| 171646 | var ops = try cg.tempsFromOperands(inst, .{prefetch.ptr}); | 171646 | var ops = try cg.tempsFromOperands(inst, .{prefetch.ptr}); |
| 171647 | switch (prefetch.cache) { | 171647 | switch (prefetch.cache) { |
| 171648 | .instruction => {}, // prefetchi requires rip-relative addressing, which is currently non-trivial to emit from an arbitrary ptr value | 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,7 +171669,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 171669 | try res.finish(inst, &.{prefetch.ptr}, &ops, cg); | 171669 | try res.finish(inst, &.{prefetch.ptr}, &ops, cg); |
| 171670 | }, | 171670 | }, |
| 171671 | .mul_add => |air_tag| { | 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 | const bin_op = cg.air.extraData(Air.Bin, pl_op.payload).data; | 171673 | const bin_op = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 171674 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs, pl_op.operand }); | 171674 | var ops = try cg.tempsFromOperands(inst, .{ bin_op.lhs, bin_op.rhs, pl_op.operand }); |
| 171675 | var res: [1]Temp = undefined; | 171675 | var res: [1]Temp = undefined; |
| ... | @@ -173070,7 +173070,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -173070,7 +173070,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173070 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs, pl_op.operand }, &ops, cg); | 173070 | try res[0].finish(inst, &.{ bin_op.lhs, bin_op.rhs, pl_op.operand }, &ops, cg); |
| 173071 | }, | 173071 | }, |
| 173072 | .field_parent_ptr => { | 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 | const field_parent_ptr = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 173074 | const field_parent_ptr = cg.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 173075 | var ops = try cg.tempsFromOperands(inst, .{field_parent_ptr.field_ptr}); | 173075 | var ops = try cg.tempsFromOperands(inst, .{field_parent_ptr.field_ptr}); |
| 173076 | try ops[0].toOffset(-@as(i32, @intCast(codegen.fieldOffset( | 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,7 +173083,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173083 | }, | 173083 | }, |
| 173084 | .wasm_memory_size, .wasm_memory_grow => unreachable, | 173084 | .wasm_memory_size, .wasm_memory_grow => unreachable, |
| 173085 | .cmp_lte_errors_len => |air_tag| { | 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 | var ops = try cg.tempsFromOperands(inst, .{un_op}); | 173087 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 173088 | var res: [1]Temp = undefined; | 173088 | var res: [1]Temp = undefined; |
| 173089 | cg.select(&res, &.{.bool}, &ops, comptime &.{ .{ | 173089 | cg.select(&res, &.{.bool}, &ops, comptime &.{ .{ |
| ... | @@ -173172,7 +173172,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -173172,7 +173172,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173172 | try ert.finish(inst, &.{}, &.{}, cg); | 173172 | try ert.finish(inst, &.{}, &.{}, cg); |
| 173173 | }, | 173173 | }, |
| 173174 | .set_err_return_trace => { | 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 | var ops = try cg.tempsFromOperands(inst, .{un_op}); | 173176 | var ops = try cg.tempsFromOperands(inst, .{un_op}); |
| 173177 | switch (ops[0].unwrap(cg)) { | 173177 | switch (ops[0].unwrap(cg)) { |
| 173178 | .ref => { | 173178 | .ref => { |
| ... | @@ -173191,12 +173191,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -173191,12 +173191,12 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173191 | } | 173191 | } |
| 173192 | }, | 173192 | }, |
| 173193 | .addrspace_cast => { | 173193 | .addrspace_cast => { |
| 173194 | const ty_op = air_datas[@intFromEnum(inst)].ty_op; | 173194 | const ty_op = air_datas[@backingInt(inst)].ty_op; |
| 173195 | const ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); | 173195 | const ops = try cg.tempsFromOperands(inst, .{ty_op.operand}); |
| 173196 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); | 173196 | try ops[0].finish(inst, &.{ty_op.operand}, &ops, cg); |
| 173197 | }, | 173197 | }, |
| 173198 | .save_err_return_trace_index => { | 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 | const agg_ty = ty_pl.ty.toType(); | 173200 | const agg_ty = ty_pl.ty.toType(); |
| 173201 | assert(agg_ty.containerLayout(zcu) != .@"packed"); | 173201 | assert(agg_ty.containerLayout(zcu) != .@"packed"); |
| 173202 | var ert: Temp = .{ .index = err_ret_trace_index }; | 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,7 +173205,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173205 | try res.finish(inst, &.{}, &.{}, cg); | 173205 | try res.finish(inst, &.{}, &.{}, cg); |
| 173206 | }, | 173206 | }, |
| 173207 | .runtime_nav_ptr => { | 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 | const nav = ip.getNav(ty_nav.nav); | 173209 | const nav = ip.getNav(ty_nav.nav); |
| 173210 | const is_threadlocal = zcu.comp.config.any_non_single_threaded and nav.resolved.?.@"threadlocal"; | 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,7 +173250,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173250 | .c_va_end => try cg.airVaEnd(inst), | 173250 | .c_va_end => try cg.airVaEnd(inst), |
| 173251 | .c_va_start => try cg.airVaStart(inst), | 173251 | .c_va_start => try cg.airVaStart(inst), |
| 173252 | .legalize_vec_store_elem => { | 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 | const bin = cg.air.extraData(Air.Bin, pl_op.payload).data; | 173254 | const bin = cg.air.extraData(Air.Bin, pl_op.payload).data; |
| 173255 | // vector_ptr, index, elem_val | 173255 | // vector_ptr, index, elem_val |
| 173256 | var ops = try cg.tempsFromOperands(inst, .{ pl_op.operand, bin.lhs, bin.rhs }); | 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,7 +173885,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 173885 | 173885 | ||
| 173886 | .work_item_id, .work_group_size, .work_group_id, .spirv_runtime_array_len => unreachable, | 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 | cg.checkInvariantsAfterAirInst(); | 173889 | cg.checkInvariantsAfterAirInst(); |
| 173890 | } | 173890 | } |
| 173891 | verbose_tracking_log.debug("{f}", .{cg.fmtTracking()}); | 173891 | verbose_tracking_log.debug("{f}", .{cg.fmtTracking()}); |
| ... | @@ -174007,7 +174007,7 @@ fn genLazy(cg: *CodeGen, lazy_sym: link.File.LazySymbol) InnerError!void { | ... | @@ -174007,7 +174007,7 @@ fn genLazy(cg: *CodeGen, lazy_sym: link.File.LazySymbol) InnerError!void { |
| 174007 | .{ @tagName(lazy_sym.kind), Type.fromInterned(lazy_sym.ty).fmt(pt) }, | 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 | cg.checkInvariantsAfterAirInst(); | 174011 | cg.checkInvariantsAfterAirInst(); |
| 174012 | } | 174012 | } |
| 174013 | 174013 | ||
| ... | @@ -174059,7 +174059,7 @@ fn processDeath(self: *CodeGen, inst: Air.Inst.Index, comptime opts: FreeOptions | ... | @@ -174059,7 +174059,7 @@ fn processDeath(self: *CodeGen, inst: Air.Inst.Index, comptime opts: FreeOptions |
| 174059 | } | 174059 | } |
| 174060 | 174060 | ||
| 174061 | fn finishAirResult(self: *CodeGen, inst: Air.Inst.Index, result: MCValue) void { | 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 | .none, .dead, .unreach => {}, | 174063 | .none, .dead, .unreach => {}, |
| 174064 | else => unreachable, // Why didn't the result die? | 174064 | else => unreachable, // Why didn't the result die? |
| 174065 | } else { | 174065 | } else { |
| ... | @@ -174100,7 +174100,7 @@ fn setFrameLoc( | ... | @@ -174100,7 +174100,7 @@ fn setFrameLoc( |
| 174100 | offset: *i32, | 174100 | offset: *i32, |
| 174101 | comptime aligned: bool, | 174101 | comptime aligned: bool, |
| 174102 | ) void { | 174102 | ) void { |
| 174103 | const frame_i = @intFromEnum(frame_index); | 174103 | const frame_i = @backingInt(frame_index); |
| 174104 | if (aligned) { | 174104 | if (aligned) { |
| 174105 | const alignment = self.frame_allocs.items(.abi_align)[frame_i]; | 174105 | const alignment = self.frame_allocs.items(.abi_align)[frame_i]; |
| 174106 | offset.* = @intCast(alignment.forward(@intCast(offset.*))); | 174106 | offset.* = @intCast(alignment.forward(@intCast(offset.*))); |
| ... | @@ -174120,21 +174120,21 @@ fn computeFrameLayout(self: *CodeGen, cc: std.lang.CallingConvention.Tag) !Frame | ... | @@ -174120,21 +174120,21 @@ fn computeFrameLayout(self: *CodeGen, cc: std.lang.CallingConvention.Tag) !Frame |
| 174120 | const frame_offset = self.frame_locs.items(.disp); | 174120 | const frame_offset = self.frame_locs.items(.disp); |
| 174121 | 174121 | ||
| 174122 | for (stack_frame_order, FrameIndex.named_count..) |*frame_order, frame_index| | 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 | const SortContext = struct { | 174125 | const SortContext = struct { |
| 174126 | frame_align: @TypeOf(frame_align), | 174126 | frame_align: @TypeOf(frame_align), |
| 174127 | pub fn lessThan(context: @This(), lhs: FrameIndex, rhs: FrameIndex) bool { | 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 | const sort_context = SortContext{ .frame_align = frame_align }; | 174131 | const sort_context = SortContext{ .frame_align = frame_align }; |
| 174132 | std.mem.sort(FrameIndex, stack_frame_order, sort_context, SortContext.lessThan); | 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)]; | 174135 | const call_frame_align = frame_align[@backingInt(FrameIndex.call_frame)]; |
| 174136 | const stack_frame_align = frame_align[@intFromEnum(FrameIndex.stack_frame)]; | 174136 | const stack_frame_align = frame_align[@backingInt(FrameIndex.stack_frame)]; |
| 174137 | const args_frame_align = frame_align[@intFromEnum(FrameIndex.args_frame)]; | 174137 | const args_frame_align = frame_align[@backingInt(FrameIndex.args_frame)]; |
| 174138 | const needed_align = call_frame_align.max(stack_frame_align); | 174138 | const needed_align = call_frame_align.max(stack_frame_align); |
| 174139 | const need_align_stack = needed_align.compare(.gt, args_frame_align); | 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,7 +174155,7 @@ fn computeFrameLayout(self: *CodeGen, cc: std.lang.CallingConvention.Tag) !Frame |
| 174155 | const stack_frame_align_offset = if (need_align_stack) | 174155 | const stack_frame_align_offset = if (need_align_stack) |
| 174156 | 0 | 174156 | 0 |
| 174157 | else | 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 | var rsp_offset: i32 = 0; | 174160 | var rsp_offset: i32 = 0; |
| 174161 | self.setFrameLoc(.call_frame, .rsp, &rsp_offset, true); | 174161 | self.setFrameLoc(.call_frame, .rsp, &rsp_offset, true); |
| ... | @@ -174164,23 +174164,23 @@ fn computeFrameLayout(self: *CodeGen, cc: std.lang.CallingConvention.Tag) !Frame | ... | @@ -174164,23 +174164,23 @@ fn computeFrameLayout(self: *CodeGen, cc: std.lang.CallingConvention.Tag) !Frame |
| 174164 | rsp_offset += stack_frame_align_offset; | 174164 | rsp_offset += stack_frame_align_offset; |
| 174165 | rsp_offset = @intCast(needed_align.forward(@intCast(rsp_offset))); | 174165 | rsp_offset = @intCast(needed_align.forward(@intCast(rsp_offset))); |
| 174166 | rsp_offset -= stack_frame_align_offset; | 174166 | rsp_offset -= stack_frame_align_offset; |
| 174167 | frame_size[@intFromEnum(FrameIndex.call_frame)] = | 174167 | frame_size[@backingInt(FrameIndex.call_frame)] = |
| 174168 | @intCast(rsp_offset - frame_offset[@intFromEnum(FrameIndex.stack_frame)]); | 174168 | @intCast(rsp_offset - frame_offset[@backingInt(FrameIndex.stack_frame)]); |
| 174169 | 174169 | ||
| 174170 | return .{ | 174170 | return .{ |
| 174171 | .stack_mask = @as(u32, std.math.maxInt(u32)) << @intCast(if (need_align_stack) @intFromEnum(needed_align) else 0), | 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[@intFromEnum(FrameIndex.call_frame)]), | 174172 | .stack_adjust = @intCast(rsp_offset - frame_offset[@backingInt(FrameIndex.call_frame)]), |
| 174173 | .save_reg_list = save_reg_list, | 174173 | .save_reg_list = save_reg_list, |
| 174174 | }; | 174174 | }; |
| 174175 | } | 174175 | } |
| 174176 | 174176 | ||
| 174177 | fn getFrameAddrAlignment(self: *CodeGen, frame_addr: bits.FrameAddr) InternPool.Alignment { | 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; | 174178 | const alloc_align = self.frame_allocs.get(@backingInt(frame_addr.index)).abi_align; |
| 174179 | return @enumFromInt(@min(@intFromEnum(alloc_align), @ctz(frame_addr.off))); | 174179 | return @fromBackingInt(@intCast(@min(@backingInt(alloc_align), @ctz(frame_addr.off)))); |
| 174180 | } | 174180 | } |
| 174181 | 174181 | ||
| 174182 | fn getFrameAddrSize(self: *CodeGen, frame_addr: bits.FrameAddr) u32 { | 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 | fn allocFrameIndex(self: *CodeGen, alloc: FrameAlloc) !FrameIndex { | 174186 | fn allocFrameIndex(self: *CodeGen, alloc: FrameAlloc) !FrameIndex { |
| ... | @@ -174188,19 +174188,19 @@ fn allocFrameIndex(self: *CodeGen, alloc: FrameAlloc) !FrameIndex { | ... | @@ -174188,19 +174188,19 @@ fn allocFrameIndex(self: *CodeGen, alloc: FrameAlloc) !FrameIndex { |
| 174188 | const frame_size = frame_allocs_slice.items(.abi_size); | 174188 | const frame_size = frame_allocs_slice.items(.abi_size); |
| 174189 | const frame_align = frame_allocs_slice.items(.abi_align); | 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 | stack_frame_align.* = stack_frame_align.max(alloc.abi_align); | 174192 | stack_frame_align.* = stack_frame_align.max(alloc.abi_align); |
| 174193 | 174193 | ||
| 174194 | for (self.free_frame_indices.keys(), 0..) |frame_index, free_i| { | 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 | if (abi_size != alloc.abi_size) continue; | 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 | abi_align.* = abi_align.max(alloc.abi_align); | 174198 | abi_align.* = abi_align.max(alloc.abi_align); |
| 174199 | 174199 | ||
| 174200 | _ = self.free_frame_indices.swapRemoveAt(free_i); | 174200 | _ = self.free_frame_indices.swapRemoveAt(free_i); |
| 174201 | return frame_index; | 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 | try self.frame_allocs.append(self.gpa, alloc); | 174204 | try self.frame_allocs.append(self.gpa, alloc); |
| 174205 | return frame_index; | 174205 | return frame_index; |
| 174206 | } | 174206 | } |
| ... | @@ -174318,7 +174318,7 @@ fn initRetroactiveState(self: *CodeGen) State { | ... | @@ -174318,7 +174318,7 @@ fn initRetroactiveState(self: *CodeGen) State { |
| 174318 | self.scope_generation = scope_generation; | 174318 | self.scope_generation = scope_generation; |
| 174319 | 174319 | ||
| 174320 | var state: State = undefined; | 174320 | var state: State = undefined; |
| 174321 | state.next_temp_index = @enumFromInt(0); | 174321 | state.next_temp_index = @fromBackingInt(@intCast(0)); |
| 174322 | state.inst_tracking_len = @intCast(self.inst_tracking.count()); | 174322 | state.inst_tracking_len = @intCast(self.inst_tracking.count()); |
| 174323 | state.scope_generation = scope_generation; | 174323 | state.scope_generation = scope_generation; |
| 174324 | return state; | 174324 | return state; |
| ... | @@ -174350,8 +174350,8 @@ fn restoreState(self: *CodeGen, state: State, deaths: []const Air.Inst.Index, co | ... | @@ -174350,8 +174350,8 @@ fn restoreState(self: *CodeGen, state: State, deaths: []const Air.Inst.Index, co |
| 174350 | }) !void { | 174350 | }) !void { |
| 174351 | if (opts.close_scope) { | 174351 | if (opts.close_scope) { |
| 174352 | for ( | 174352 | for ( |
| 174353 | self.inst_tracking.keys()[@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()[@intFromEnum(state.next_temp_index)..@intFromEnum(self.next_temp_index)], | 174354 | self.inst_tracking.values()[@backingInt(state.next_temp_index)..@backingInt(self.next_temp_index)], |
| 174355 | ) |inst, *tracking| try tracking.die(self, inst, .{ .emit_instructions = opts.emit_instructions }); | 174355 | ) |inst, *tracking| try tracking.die(self, inst, .{ .emit_instructions = opts.emit_instructions }); |
| 174356 | self.next_temp_index = state.next_temp_index; | 174356 | self.next_temp_index = state.next_temp_index; |
| 174357 | for ( | 174357 | for ( |
| ... | @@ -174363,8 +174363,8 @@ fn restoreState(self: *CodeGen, state: State, deaths: []const Air.Inst.Index, co | ... | @@ -174363,8 +174363,8 @@ fn restoreState(self: *CodeGen, state: State, deaths: []const Air.Inst.Index, co |
| 174363 | 174363 | ||
| 174364 | if (opts.resurrect) { | 174364 | if (opts.resurrect) { |
| 174365 | for ( | 174365 | for ( |
| 174366 | self.inst_tracking.keys()[0..@intFromEnum(state.next_temp_index)], | 174366 | self.inst_tracking.keys()[0..@backingInt(state.next_temp_index)], |
| 174367 | self.inst_tracking.values()[0..@intFromEnum(state.next_temp_index)], | 174367 | self.inst_tracking.values()[0..@backingInt(state.next_temp_index)], |
| 174368 | ) |inst, *tracking| try tracking.resurrect(self, inst, state.scope_generation); | 174368 | ) |inst, *tracking| try tracking.resurrect(self, inst, state.scope_generation); |
| 174369 | for ( | 174369 | for ( |
| 174370 | self.inst_tracking.keys()[Temp.Index.max..state.inst_tracking_len], | 174370 | self.inst_tracking.keys()[Temp.Index.max..state.inst_tracking_len], |
| ... | @@ -176367,10 +176367,10 @@ fn genCall(cg: *CodeGen, info: union(enum) { | ... | @@ -176367,10 +176367,10 @@ fn genCall(cg: *CodeGen, info: union(enum) { |
| 176367 | }); | 176367 | }); |
| 176368 | const frame_allocs_slice = cg.frame_allocs.slice(); | 176368 | const frame_allocs_slice = cg.frame_allocs.slice(); |
| 176369 | const stack_frame_size = | 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 | stack_frame_size.* = @max(stack_frame_size.*, needed_call_frame.abi_size); | 176371 | stack_frame_size.* = @max(stack_frame_size.*, needed_call_frame.abi_size); |
| 176372 | const stack_frame_align = | 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 | stack_frame_align.* = stack_frame_align.max(needed_call_frame.abi_align); | 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,7 +176762,7 @@ fn genCall(cg: *CodeGen, info: union(enum) { |
| 176762 | } | 176762 | } |
| 176763 | 176763 | ||
| 176764 | fn airRet(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) !void { | 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 | const ret_ty = cg.fn_type.fnReturnType(cg.pt.zcu); | 176767 | const ret_ty = cg.fn_type.fnReturnType(cg.pt.zcu); |
| 176768 | switch (cg.ret_mcv.short) { | 176768 | switch (cg.ret_mcv.short) { |
| ... | @@ -176828,7 +176828,7 @@ fn airRet(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) !void { | ... | @@ -176828,7 +176828,7 @@ fn airRet(cg: *CodeGen, inst: Air.Inst.Index, safety: bool) !void { |
| 176828 | } | 176828 | } |
| 176829 | 176829 | ||
| 176830 | fn airRetLoad(cg: *CodeGen, inst: Air.Inst.Index) !void { | 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 | switch (cg.ret_mcv.short) { | 176832 | switch (cg.ret_mcv.short) { |
| 176833 | .none => {}, | 176833 | .none => {}, |
| 176834 | .register, | 176834 | .register, |
| ... | @@ -177341,7 +177341,7 @@ fn lowerSwitchBr( | ... | @@ -177341,7 +177341,7 @@ fn lowerSwitchBr( |
| 177341 | const cc = cc_temp.tracking(cg).short.eflags; | 177341 | const cc = cc_temp.tracking(cg).short.eflags; |
| 177342 | try cc_temp.die(cg); | 177342 | try cc_temp.die(cg); |
| 177343 | try cond_temp.die(cg); | 177343 | try cond_temp.die(cg); |
| 177344 | try cg.resetTemps(@enumFromInt(0)); | 177344 | try cg.resetTemps(@fromBackingInt(@intCast(0))); |
| 177345 | break :cc cc; | 177345 | break :cc cc; |
| 177346 | }, | 177346 | }, |
| 177347 | }; | 177347 | }; |
| ... | @@ -177394,7 +177394,7 @@ fn lowerSwitchBr( | ... | @@ -177394,7 +177394,7 @@ fn lowerSwitchBr( |
| 177394 | }, | 177394 | }, |
| 177395 | }; | 177395 | }; |
| 177396 | try cond_temp.die(cg); | 177396 | try cond_temp.die(cg); |
| 177397 | try cg.resetTemps(@enumFromInt(0)); | 177397 | try cg.resetTemps(@fromBackingInt(@intCast(0))); |
| 177398 | // "Success" case is in `reloc`.... | 177398 | // "Success" case is in `reloc`.... |
| 177399 | if (lte_max) |cc| { | 177399 | if (lte_max) |cc| { |
| 177400 | reloc.* = try cg.asmJccReloc(cc, undefined); | 177400 | reloc.* = try cg.asmJccReloc(cc, undefined); |
| ... | @@ -177498,7 +177498,7 @@ fn airLoopSwitchBr(self: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -177498,7 +177498,7 @@ fn airLoopSwitchBr(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 177498 | } | 177498 | } |
| 177499 | 177499 | ||
| 177500 | fn airSwitchDispatch(self: *CodeGen, inst: Air.Inst.Index) !void { | 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 | const block_ty = self.typeOfIndex(br.block_inst); | 177503 | const block_ty = self.typeOfIndex(br.block_inst); |
| 177504 | const loop_data = self.loops.getPtr(br.block_inst).?; | 177504 | const loop_data = self.loops.getPtr(br.block_inst).?; |
| ... | @@ -177630,7 +177630,7 @@ fn performReloc(self: *CodeGen, reloc: Mir.Inst.Index) void { | ... | @@ -177630,7 +177630,7 @@ fn performReloc(self: *CodeGen, reloc: Mir.Inst.Index) void { |
| 177630 | 177630 | ||
| 177631 | fn airBr(self: *CodeGen, inst: Air.Inst.Index) !void { | 177631 | fn airBr(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 177632 | const zcu = self.pt.zcu; | 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 | const block_ty = self.typeOfIndex(br.block_inst); | 177635 | const block_ty = self.typeOfIndex(br.block_inst); |
| 177636 | const block_unused = !block_ty.hasRuntimeBits(zcu) or self.liveness.isUnused(br.block_inst); | 177636 | const block_unused = !block_ty.hasRuntimeBits(zcu) or self.liveness.isUnused(br.block_inst); |
| ... | @@ -178498,7 +178498,7 @@ const MoveStrategy = union(enum) { | ... | @@ -178498,7 +178498,7 @@ const MoveStrategy = union(enum) { |
| 178498 | .load_store_x87 => if (dst_reg != .st0 and cg.register_manager.isKnownRegFree(.st7)) { | 178498 | .load_store_x87 => if (dst_reg != .st0 and cg.register_manager.isKnownRegFree(.st7)) { |
| 178499 | try cg.asmMemory(.{ .f_, .ld }, src_mem); | 178499 | try cg.asmMemory(.{ .f_, .ld }, src_mem); |
| 178500 | switch (dst_reg) { | 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 | .st7 => try cg.asmOpOnly(.{ .f_cstp, .in }), | 178502 | .st7 => try cg.asmOpOnly(.{ .f_cstp, .in }), |
| 178503 | else => unreachable, | 178503 | else => unreachable, |
| 178504 | } | 178504 | } |
| ... | @@ -179239,11 +179239,11 @@ fn genSetReg( | ... | @@ -179239,11 +179239,11 @@ fn genSetReg( |
| 179239 | .st1, .st2, .st3, .st4, .st5, .st6 => switch (dst_reg) { | 179239 | .st1, .st2, .st3, .st4, .st5, .st6 => switch (dst_reg) { |
| 179240 | .st0 => { | 179240 | .st0 => { |
| 179241 | try cg.asmRegister(.{ .f_p, .st }, .st0); | 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 | .st2, .st3, .st4, .st5, .st6 => if (cg.register_manager.isKnownRegFree(.st7)) { | 179244 | .st2, .st3, .st4, .st5, .st6 => if (cg.register_manager.isKnownRegFree(.st7)) { |
| 179245 | try cg.asmRegister(.{ .f_, .ld }, src_reg); | 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 | } else { | 179247 | } else { |
| 179248 | try cg.asmRegister(.{ .f_, .xch }, src_reg); | 179248 | try cg.asmRegister(.{ .f_, .xch }, src_reg); |
| 179249 | try cg.asmRegister(.{ .f_, .xch }, dst_reg); | 179249 | try cg.asmRegister(.{ .f_, .xch }, dst_reg); |
| ... | @@ -179802,8 +179802,8 @@ fn genSetMem( | ... | @@ -179802,8 +179802,8 @@ fn genSetMem( |
| 179802 | const mem_size = switch (base) { | 179802 | const mem_size = switch (base) { |
| 179803 | .frame => |base_fi| mem_size: { | 179803 | .frame => |base_fi| mem_size: { |
| 179804 | assert(disp >= 0); | 179804 | assert(disp >= 0); |
| 179805 | const frame_abi_size = cg.frame_allocs.items(.abi_size)[@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)[@intFromEnum(base_fi)]; | 179806 | const frame_spill_pad = cg.frame_allocs.items(.spill_pad)[@backingInt(base_fi)]; |
| 179807 | assert(frame_abi_size - frame_spill_pad - disp >= abi_size); | 179807 | assert(frame_abi_size - frame_spill_pad - disp >= abi_size); |
| 179808 | break :mem_size if (frame_abi_size - frame_spill_pad - disp == abi_size) frame_abi_size else abi_size; | 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,7 +180097,7 @@ fn genInlineMemset( |
| 180097 | fn airBitCast(self: *CodeGen, inst: Air.Inst.Index) !void { | 180097 | fn airBitCast(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180098 | const pt = self.pt; | 180098 | const pt = self.pt; |
| 180099 | const zcu = pt.zcu; | 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 | const dst_ty = self.typeOfIndex(inst); | 180101 | const dst_ty = self.typeOfIndex(inst); |
| 180102 | const src_ty = self.typeOf(ty_op.operand); | 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,7 +180218,7 @@ fn airBitCast(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180218 | fn airCmpxchg(self: *CodeGen, inst: Air.Inst.Index) !void { | 180218 | fn airCmpxchg(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180219 | const pt = self.pt; | 180219 | const pt = self.pt; |
| 180220 | const zcu = pt.zcu; | 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 | const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data; | 180222 | const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 180223 | 180223 | ||
| 180224 | const dst_ty = self.typeOfIndex(inst); | 180224 | const dst_ty = self.typeOfIndex(inst); |
| ... | @@ -180673,7 +180673,7 @@ fn atomicOp( | ... | @@ -180673,7 +180673,7 @@ fn atomicOp( |
| 180673 | } | 180673 | } |
| 180674 | 180674 | ||
| 180675 | fn airAtomicRmw(self: *CodeGen, inst: Air.Inst.Index) !void { | 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 | const extra = self.air.extraData(Air.AtomicRmw, pl_op.payload).data; | 180677 | const extra = self.air.extraData(Air.AtomicRmw, pl_op.payload).data; |
| 180678 | 180678 | ||
| 180679 | try self.spillRegisters(&.{ .rax, .rdx, .rbx, .rcx }); | 180679 | try self.spillRegisters(&.{ .rax, .rdx, .rbx, .rcx }); |
| ... | @@ -180694,7 +180694,7 @@ fn airAtomicRmw(self: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -180694,7 +180694,7 @@ fn airAtomicRmw(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180694 | } | 180694 | } |
| 180695 | 180695 | ||
| 180696 | fn airAtomicLoad(self: *CodeGen, inst: Air.Inst.Index) !void { | 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 | const result: MCValue = result: { | 180698 | const result: MCValue = result: { |
| 180699 | const ptr_ty = self.typeOf(atomic_load.ptr); | 180699 | const ptr_ty = self.typeOf(atomic_load.ptr); |
| 180700 | const ptr_mcv = try self.resolveInst(atomic_load.ptr); | 180700 | const ptr_mcv = try self.resolveInst(atomic_load.ptr); |
| ... | @@ -180721,7 +180721,7 @@ fn airAtomicLoad(self: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -180721,7 +180721,7 @@ fn airAtomicLoad(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180721 | } | 180721 | } |
| 180722 | 180722 | ||
| 180723 | fn airAtomicStore(self: *CodeGen, inst: Air.Inst.Index, order: std.lang.AtomicOrder) !void { | 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 | const ptr_ty = self.typeOf(bin_op.lhs); | 180726 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 180727 | const ptr_mcv = try self.resolveInst(bin_op.lhs); | 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,7 +180736,7 @@ fn airAtomicStore(self: *CodeGen, inst: Air.Inst.Index, order: std.lang.AtomicOr |
| 180736 | fn airMemset(self: *CodeGen, inst: Air.Inst.Index, safety: bool) !void { | 180736 | fn airMemset(self: *CodeGen, inst: Air.Inst.Index, safety: bool) !void { |
| 180737 | const pt = self.pt; | 180737 | const pt = self.pt; |
| 180738 | const zcu = pt.zcu; | 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 | result: { | 180741 | result: { |
| 180742 | if (!safety and (try self.resolveInst(bin_op.rhs)) == .undef) break :result; | 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,7 +180879,7 @@ fn airSelect(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 180879 | const pt = self.pt; | 180879 | const pt = self.pt; |
| 180880 | const zcu = pt.zcu; | 180880 | const zcu = pt.zcu; |
| 180881 | const io = zcu.comp.io; | 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 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; | 180883 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 180884 | const ty = self.typeOfIndex(inst); | 180884 | const ty = self.typeOfIndex(inst); |
| 180885 | const vec_len = ty.vectorLen(zcu); | 180885 | const vec_len = ty.vectorLen(zcu); |
| ... | @@ -181351,7 +181351,7 @@ fn airAggregateInitBoolVec(self: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -181351,7 +181351,7 @@ fn airAggregateInitBoolVec(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181351 | const zcu = pt.zcu; | 181351 | const zcu = pt.zcu; |
| 181352 | const result_ty = self.typeOfIndex(inst); | 181352 | const result_ty = self.typeOfIndex(inst); |
| 181353 | const len: usize = @intCast(result_ty.arrayLen(zcu)); | 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 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra.items[ty_pl.payload..][0..len]); | 181355 | const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra.items[ty_pl.payload..][0..len]); |
| 181356 | 181356 | ||
| 181357 | assert(result_ty.zigTypeTag(zcu) == .vector); | 181357 | assert(result_ty.zigTypeTag(zcu) == .vector); |
| ... | @@ -181411,7 +181411,7 @@ fn airAggregateInitBoolVec(self: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -181411,7 +181411,7 @@ fn airAggregateInitBoolVec(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181411 | fn airVaStart(self: *CodeGen, inst: Air.Inst.Index) !void { | 181411 | fn airVaStart(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181412 | const pt = self.pt; | 181412 | const pt = self.pt; |
| 181413 | const zcu = pt.zcu; | 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 | const ptr_anyopaque_ty = try pt.singleMutPtrType(.anyopaque); | 181415 | const ptr_anyopaque_ty = try pt.singleMutPtrType(.anyopaque); |
| 181416 | 181416 | ||
| 181417 | const result: MCValue = switch (self.fn_type.fnCallingConvention(zcu)) { | 181417 | const result: MCValue = switch (self.fn_type.fnCallingConvention(zcu)) { |
| ... | @@ -181477,7 +181477,7 @@ fn airVaStart(self: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -181477,7 +181477,7 @@ fn airVaStart(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181477 | fn airVaArg(self: *CodeGen, inst: Air.Inst.Index) !void { | 181477 | fn airVaArg(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181478 | const pt = self.pt; | 181478 | const pt = self.pt; |
| 181479 | const zcu = pt.zcu; | 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 | const ty = self.typeOfIndex(inst); | 181481 | const ty = self.typeOfIndex(inst); |
| 181482 | const promote_ty = self.promoteVarArg(ty); | 181482 | const promote_ty = self.promoteVarArg(ty); |
| 181483 | const ptr_anyopaque_ty = try pt.singleMutPtrType(.anyopaque); | 181483 | const ptr_anyopaque_ty = try pt.singleMutPtrType(.anyopaque); |
| ... | @@ -181705,7 +181705,7 @@ fn convertFloatVarArg( | ... | @@ -181705,7 +181705,7 @@ fn convertFloatVarArg( |
| 181705 | } | 181705 | } |
| 181706 | 181706 | ||
| 181707 | fn airVaCopy(self: *CodeGen, inst: Air.Inst.Index) !void { | 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 | const ptr_va_list_ty = self.typeOf(ty_op.operand); | 181709 | const ptr_va_list_ty = self.typeOf(ty_op.operand); |
| 181710 | 181710 | ||
| 181711 | const dst_mcv = try self.allocRegOrMem(inst, true); | 181711 | const dst_mcv = try self.allocRegOrMem(inst, true); |
| ... | @@ -181714,7 +181714,7 @@ fn airVaCopy(self: *CodeGen, inst: Air.Inst.Index) !void { | ... | @@ -181714,7 +181714,7 @@ fn airVaCopy(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 181714 | } | 181714 | } |
| 181715 | 181715 | ||
| 181716 | fn airVaEnd(self: *CodeGen, inst: Air.Inst.Index) !void { | 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 | return self.finishAir(inst, .unreach, .{ un_op, .none, .none }); | 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,9 +182302,9 @@ fn fail(cg: *CodeGen, comptime format: []const u8, args: anytype) error{ OutOfMe |
| 182302 | } | 182302 | } |
| 182303 | 182303 | ||
| 182304 | fn parseRegName(name: []const u8) ?Register { | 182304 | fn parseRegName(name: []const u8) ?Register { |
| 182305 | if (std.mem.startsWith(u8, name, "db")) return @enumFromInt( | 182305 | if (std.mem.startsWith(u8, name, "db")) return @fromBackingInt(@intCast( |
| 182306 | @intFromEnum(Register.dr0) + (std.fmt.parseInt(u4, name["db".len..], 0) catch return null), | 182306 | @backingInt(Register.dr0) + (std.fmt.parseInt(u4, name["db".len..], 0) catch return null), |
| 182307 | ); | 182307 | )); |
| 182308 | return std.meta.stringToEnum(Register, name); | 182308 | return std.meta.stringToEnum(Register, name); |
| 182309 | } | 182309 | } |
| 182310 | 182310 | ||
| ... | @@ -182685,7 +182685,7 @@ const Temp = struct { | ... | @@ -182685,7 +182685,7 @@ const Temp = struct { |
| 182685 | .ref => |ref| return .{ .ref = ref }, | 182685 | .ref => |ref| return .{ .ref = ref }, |
| 182686 | .target => |target_index| { | 182686 | .target => |target_index| { |
| 182687 | if (temp.index == err_ret_trace_index) return .err_ret_trace; | 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 | assert(temp_index.isValid(cg)); | 182689 | assert(temp_index.isValid(cg)); |
| 182690 | return .{ .temp = temp_index }; | 182690 | return .{ .temp = temp_index }; |
| 182691 | }, | 182691 | }, |
| ... | @@ -182694,7 +182694,7 @@ const Temp = struct { | ... | @@ -182694,7 +182694,7 @@ const Temp = struct { |
| 182694 | 182694 | ||
| 182695 | fn typeOf(temp: Temp, cg: *CodeGen) Type { | 182695 | fn typeOf(temp: Temp, cg: *CodeGen) Type { |
| 182696 | return switch (temp.unwrap(cg)) { | 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 | .loop_switch_br => cg.typeOf(cg.air.unwrapSwitch(temp.index).operand), | 182698 | .loop_switch_br => cg.typeOf(cg.air.unwrapSwitch(temp.index).operand), |
| 182699 | else => cg.air.typeOfIndex(temp.index, &cg.pt.zcu.intern_pool), | 182699 | else => cg.air.typeOfIndex(temp.index, &cg.pt.zcu.intern_pool), |
| 182700 | }, | 182700 | }, |
| ... | @@ -182754,8 +182754,8 @@ const Temp = struct { | ... | @@ -182754,8 +182754,8 @@ const Temp = struct { |
| 182754 | 182754 | ||
| 182755 | fn getOffset(temp: Temp, off: i32, cg: *CodeGen) InnerError!Temp { | 182755 | fn getOffset(temp: Temp, off: i32, cg: *CodeGen) InnerError!Temp { |
| 182756 | const new_temp_index = cg.next_temp_index; | 182756 | const new_temp_index = cg.next_temp_index; |
| 182757 | cg.temp_type[@intFromEnum(new_temp_index)] = .usize; | 182757 | cg.temp_type[@backingInt(new_temp_index)] = .usize; |
| 182758 | cg.next_temp_index = @enumFromInt(@intFromEnum(new_temp_index) + 1); | 182758 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(new_temp_index) + 1)); |
| 182759 | const mcv = temp.tracking(cg).short; | 182759 | const mcv = temp.tracking(cg).short; |
| 182760 | switch (mcv) { | 182760 | switch (mcv) { |
| 182761 | else => std.debug.panic("{s}: {f}\n", .{ @src().fn_name, mcv }), | 182761 | else => std.debug.panic("{s}: {f}\n", .{ @src().fn_name, mcv }), |
| ... | @@ -182830,7 +182830,7 @@ const Temp = struct { | ... | @@ -182830,7 +182830,7 @@ const Temp = struct { |
| 182830 | 182830 | ||
| 182831 | fn getLimb(temp: Temp, limb_ty: Type, limb_index: u28, cg: *CodeGen) InnerError!Temp { | 182831 | fn getLimb(temp: Temp, limb_ty: Type, limb_index: u28, cg: *CodeGen) InnerError!Temp { |
| 182832 | const new_temp_index = cg.next_temp_index; | 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 | switch (temp.tracking(cg).short) { | 182834 | switch (temp.tracking(cg).short) { |
| 182835 | else => |mcv| std.debug.panic("{s}: {f}\n", .{ @src().fn_name, mcv }), | 182835 | else => |mcv| std.debug.panic("{s}: {f}\n", .{ @src().fn_name, mcv }), |
| 182836 | .immediate => |imm| { | 182836 | .immediate => |imm| { |
| ... | @@ -182941,7 +182941,7 @@ const Temp = struct { | ... | @@ -182941,7 +182941,7 @@ const Temp = struct { |
| 182941 | new_temp_index.tracking(cg).* = .init(.{ .lea_extern_func = extern_func }); | 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 | return .{ .index = new_temp_index.toIndex() }; | 182945 | return .{ .index = new_temp_index.toIndex() }; |
| 182946 | } | 182946 | } |
| 182947 | 182947 | ||
| ... | @@ -182997,7 +182997,7 @@ const Temp = struct { | ... | @@ -182997,7 +182997,7 @@ const Temp = struct { |
| 182997 | else => {}, | 182997 | else => {}, |
| 182998 | .register, .lea_frame, .lea_nav, .lea_uav, .lea_lazy_sym => { | 182998 | .register, .lea_frame, .lea_nav, .lea_uav, .lea_lazy_sym => { |
| 182999 | assert(limb_index == 0); | 182999 | assert(limb_index == 0); |
| 183000 | cg.temp_type[@intFromEnum(temp_index)] = limb_ty; | 183000 | cg.temp_type[@backingInt(temp_index)] = limb_ty; |
| 183001 | return; | 183001 | return; |
| 183002 | }, | 183002 | }, |
| 183003 | .register_pair => |regs| { | 183003 | .register_pair => |regs| { |
| ... | @@ -183009,7 +183009,7 @@ const Temp = struct { | ... | @@ -183009,7 +183009,7 @@ const Temp = struct { |
| 183009 | for (regs, 0..) |reg, reg_index| if (reg_index != limb_index) | 183009 | for (regs, 0..) |reg, reg_index| if (reg_index != limb_index) |
| 183010 | cg.register_manager.freeReg(reg); | 183010 | cg.register_manager.freeReg(reg); |
| 183011 | temp_tracking.* = .init(.{ .register = regs[limb_index] }); | 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 | return; | 183013 | return; |
| 183014 | }, | 183014 | }, |
| 183015 | .load_frame => |frame_addr| if (!frame_addr.index.isNamed()) { | 183015 | .load_frame => |frame_addr| if (!frame_addr.index.isNamed()) { |
| ... | @@ -183018,7 +183018,7 @@ const Temp = struct { | ... | @@ -183018,7 +183018,7 @@ const Temp = struct { |
| 183018 | .index = frame_addr.index, | 183018 | .index = frame_addr.index, |
| 183019 | .off = frame_addr.off + @as(u31, limb_index) * 8, | 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 | return; | 183022 | return; |
| 183023 | }, | 183023 | }, |
| 183024 | } | 183024 | } |
| ... | @@ -183051,9 +183051,9 @@ const Temp = struct { | ... | @@ -183051,9 +183051,9 @@ const Temp = struct { |
| 183051 | .err_ret_trace => .usize, | 183051 | .err_ret_trace => .usize, |
| 183052 | }; | 183052 | }; |
| 183053 | const new_temp_index = cg.next_temp_index; | 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 | try cg.register_manager.getReg(new_reg, new_temp_index.toIndex()); | 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 | new_temp_index.tracking(cg).* = .init(.{ .register = new_reg }); | 183057 | new_temp_index.tracking(cg).* = .init(.{ .register = new_reg }); |
| 183058 | while (try temp.toBase(false, cg)) {} | 183058 | while (try temp.toBase(false, cg)) {} |
| 183059 | try temp.readTo(ty, .{ .register = new_reg }, .{}, cg); | 183059 | try temp.readTo(ty, .{ .register = new_reg }, .{}, cg); |
| ... | @@ -183074,9 +183074,9 @@ const Temp = struct { | ... | @@ -183074,9 +183074,9 @@ const Temp = struct { |
| 183074 | .err_ret_trace => .usize, | 183074 | .err_ret_trace => .usize, |
| 183075 | }; | 183075 | }; |
| 183076 | const new_temp_index = cg.next_temp_index; | 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 | for (new_regs) |new_reg| try cg.register_manager.getReg(new_reg, new_temp_index.toIndex()); | 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 | new_temp_index.tracking(cg).* = .init(.{ .register_pair = new_regs }); | 183080 | new_temp_index.tracking(cg).* = .init(.{ .register_pair = new_regs }); |
| 183081 | while (try temp.toBase(false, cg)) {} | 183081 | while (try temp.toBase(false, cg)) {} |
| 183082 | for (new_regs, 0..) |new_reg, reg_index| try temp.readTo( | 183082 | for (new_regs, 0..) |new_reg, reg_index| try temp.readTo( |
| ... | @@ -183099,12 +183099,12 @@ const Temp = struct { | ... | @@ -183099,12 +183099,12 @@ const Temp = struct { |
| 183099 | }; | 183099 | }; |
| 183100 | const ty = temp.typeOf(cg); | 183100 | const ty = temp.typeOf(cg); |
| 183101 | const new_temp_index = cg.next_temp_index; | 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 | const new_reg = try cg.register_manager.allocReg(new_temp_index.toIndex(), regSetForRegClass(rc)); | 183103 | const new_reg = try cg.register_manager.allocReg(new_temp_index.toIndex(), regSetForRegClass(rc)); |
| 183104 | try cg.genSetReg(new_reg, ty, val, .{}); | 183104 | try cg.genSetReg(new_reg, ty, val, .{}); |
| 183105 | new_temp_index.tracking(cg).* = .init(.{ .register = new_reg }); | 183105 | new_temp_index.tracking(cg).* = .init(.{ .register = new_reg }); |
| 183106 | try temp.die(cg); | 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 | temp.* = .{ .index = new_temp_index.toIndex() }; | 183108 | temp.* = .{ .index = new_temp_index.toIndex() }; |
| 183109 | return true; | 183109 | return true; |
| 183110 | } | 183110 | } |
| ... | @@ -183124,8 +183124,8 @@ const Temp = struct { | ... | @@ -183124,8 +183124,8 @@ const Temp = struct { |
| 183124 | assert(cg.reuseTemp(result_temp.index, first_temp.index, first_temp_tracking)); | 183124 | assert(cg.reuseTemp(result_temp.index, first_temp.index, first_temp_tracking)); |
| 183125 | assert(cg.reuseTemp(result_temp.index, second_temp.index, second_temp_tracking)); | 183125 | assert(cg.reuseTemp(result_temp.index, second_temp.index, second_temp_tracking)); |
| 183126 | result_temp_index.tracking(cg).* = .init(result); | 183126 | result_temp_index.tracking(cg).* = .init(result); |
| 183127 | cg.temp_type[@intFromEnum(result_temp_index)] = .slice_const_u8; | 183127 | cg.temp_type[@backingInt(result_temp_index)] = .slice_const_u8; |
| 183128 | cg.next_temp_index = @enumFromInt(@intFromEnum(result_temp_index) + 1); | 183128 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(result_temp_index) + 1)); |
| 183129 | first_temp.* = result_temp; | 183129 | first_temp.* = result_temp; |
| 183130 | second_temp.* = result_temp; | 183130 | second_temp.* = result_temp; |
| 183131 | } | 183131 | } |
| ... | @@ -183142,8 +183142,8 @@ const Temp = struct { | ... | @@ -183142,8 +183142,8 @@ const Temp = struct { |
| 183142 | assert(cg.reuseTemp(result_temp.index, temp.index, temp_tracking)); | 183142 | assert(cg.reuseTemp(result_temp.index, temp.index, temp_tracking)); |
| 183143 | assert(cg.reuseTemp(result_temp.index, overflow_temp.index, overflow_temp_tracking)); | 183143 | assert(cg.reuseTemp(result_temp.index, overflow_temp.index, overflow_temp_tracking)); |
| 183144 | result_temp_index.tracking(cg).* = .init(.{ .register_overflow = .{ .reg = reg, .eflags = overflow_cc } }); | 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; | 183145 | cg.temp_type[@backingInt(result_temp_index)] = .slice_const_u8; |
| 183146 | cg.next_temp_index = @enumFromInt(@intFromEnum(result_temp_index) + 1); | 183146 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(result_temp_index) + 1)); |
| 183147 | temp.* = result_temp; | 183147 | temp.* = result_temp; |
| 183148 | overflow_temp.* = result_temp; | 183148 | overflow_temp.* = result_temp; |
| 183149 | return; | 183149 | return; |
| ... | @@ -183154,8 +183154,8 @@ const Temp = struct { | ... | @@ -183154,8 +183154,8 @@ const Temp = struct { |
| 183154 | assert(cg.reuseTemp(result_temp.index, temp.index, temp_tracking)); | 183154 | assert(cg.reuseTemp(result_temp.index, temp.index, temp_tracking)); |
| 183155 | assert(cg.reuseTemp(result_temp.index, overflow_temp.index, overflow_temp_tracking)); | 183155 | assert(cg.reuseTemp(result_temp.index, overflow_temp.index, overflow_temp_tracking)); |
| 183156 | result_temp_index.tracking(cg).* = .init(.{ .register_pair = .{ reg, overflow_reg } }); | 183156 | result_temp_index.tracking(cg).* = .init(.{ .register_pair = .{ reg, overflow_reg } }); |
| 183157 | cg.temp_type[@intFromEnum(result_temp_index)] = .slice_const_u8; | 183157 | cg.temp_type[@backingInt(result_temp_index)] = .slice_const_u8; |
| 183158 | cg.next_temp_index = @enumFromInt(@intFromEnum(result_temp_index) + 1); | 183158 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(result_temp_index) + 1)); |
| 183159 | temp.* = result_temp; | 183159 | temp.* = result_temp; |
| 183160 | overflow_temp.* = result_temp; | 183160 | overflow_temp.* = result_temp; |
| 183161 | return; | 183161 | return; |
| ... | @@ -183231,12 +183231,12 @@ const Temp = struct { | ... | @@ -183231,12 +183231,12 @@ const Temp = struct { |
| 183231 | if ((!mut or temp.isMut(cg)) and temp_tracking.short.isMemory()) return false; | 183231 | if ((!mut or temp.isMut(cg)) and temp_tracking.short.isMemory()) return false; |
| 183232 | const new_temp_index = cg.next_temp_index; | 183232 | const new_temp_index = cg.next_temp_index; |
| 183233 | const ty = temp.typeOf(cg); | 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 | const new_frame_index = try cg.allocFrameIndex(.initSpill(ty, cg.pt.zcu)); | 183235 | const new_frame_index = try cg.allocFrameIndex(.initSpill(ty, cg.pt.zcu)); |
| 183236 | try cg.genSetMem(.{ .frame = new_frame_index }, 0, ty, temp_tracking.short, .{}); | 183236 | try cg.genSetMem(.{ .frame = new_frame_index }, 0, ty, temp_tracking.short, .{}); |
| 183237 | new_temp_index.tracking(cg).* = .init(.{ .load_frame = .{ .index = new_frame_index } }); | 183237 | new_temp_index.tracking(cg).* = .init(.{ .load_frame = .{ .index = new_frame_index } }); |
| 183238 | try temp.die(cg); | 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 | temp.* = .{ .index = new_temp_index.toIndex() }; | 183240 | temp.* = .{ .index = new_temp_index.toIndex() }; |
| 183241 | return true; | 183241 | return true; |
| 183242 | } | 183242 | } |
| ... | @@ -183247,13 +183247,13 @@ const Temp = struct { | ... | @@ -183247,13 +183247,13 @@ const Temp = struct { |
| 183247 | if ((!mut or temp.isMut(cg)) and temp_tracking.short.isBase()) return false; | 183247 | if ((!mut or temp.isMut(cg)) and temp_tracking.short.isBase()) return false; |
| 183248 | if (try temp.toMemory(mut, cg)) return true; | 183248 | if (try temp.toMemory(mut, cg)) return true; |
| 183249 | const new_temp_index = cg.next_temp_index; | 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 | const new_reg = | 183251 | const new_reg = |
| 183252 | try cg.register_manager.allocReg(new_temp_index.toIndex(), abi.RegisterClass.gp); | 183252 | try cg.register_manager.allocReg(new_temp_index.toIndex(), abi.RegisterClass.gp); |
| 183253 | try cg.genSetReg(new_reg, .usize, temp_tracking.short.address(), .{}); | 183253 | try cg.genSetReg(new_reg, .usize, temp_tracking.short.address(), .{}); |
| 183254 | new_temp_index.tracking(cg).* = .init(.{ .indirect = .{ .reg = new_reg } }); | 183254 | new_temp_index.tracking(cg).* = .init(.{ .indirect = .{ .reg = new_reg } }); |
| 183255 | try temp.die(cg); | 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 | temp.* = .{ .index = new_temp_index.toIndex() }; | 183257 | temp.* = .{ .index = new_temp_index.toIndex() }; |
| 183258 | return true; | 183258 | return true; |
| 183259 | } | 183259 | } |
| ... | @@ -189703,25 +189703,25 @@ const Temp = struct { | ... | @@ -189703,25 +189703,25 @@ const Temp = struct { |
| 189703 | _, | 189703 | _, |
| 189704 | 189704 | ||
| 189705 | fn toIndex(index: Index) Air.Inst.Index { | 189705 | fn toIndex(index: Index) Air.Inst.Index { |
| 189706 | return .fromTargetIndex(@intFromEnum(index)); | 189706 | return .fromTargetIndex(@backingInt(index)); |
| 189707 | } | 189707 | } |
| 189708 | 189708 | ||
| 189709 | fn fromIndex(index: Air.Inst.Index) Index { | 189709 | fn fromIndex(index: Air.Inst.Index) Index { |
| 189710 | return @enumFromInt(index.toTargetIndex()); | 189710 | return @fromBackingInt(@intCast(index.toTargetIndex())); |
| 189711 | } | 189711 | } |
| 189712 | 189712 | ||
| 189713 | fn tracking(index: Index, cg: *CodeGen) *InstTracking { | 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 | fn isValid(index: Index, cg: *CodeGen) bool { | 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 | index.tracking(cg).short != .dead; | 189719 | index.tracking(cg).short != .dead; |
| 189720 | } | 189720 | } |
| 189721 | 189721 | ||
| 189722 | fn typeOf(index: Index, cg: *CodeGen) Type { | 189722 | fn typeOf(index: Index, cg: *CodeGen) Type { |
| 189723 | assert(index.isValid(cg)); | 189723 | assert(index.isValid(cg)); |
| 189724 | return cg.temp_type[@intFromEnum(index)]; | 189724 | return cg.temp_type[@backingInt(index)]; |
| 189725 | } | 189725 | } |
| 189726 | 189726 | ||
| 189727 | const max = std.math.maxInt(@typeInfo(Index).@"enum".tag_type); | 189727 | const max = std.math.maxInt(@typeInfo(Index).@"enum".tag_type); |
| ... | @@ -189747,8 +189747,8 @@ const Temp = struct { | ... | @@ -189747,8 +189747,8 @@ const Temp = struct { |
| 189747 | 189747 | ||
| 189748 | fn resetTemps(cg: *CodeGen, from_index: Temp.Index) InnerError!void { | 189748 | fn resetTemps(cg: *CodeGen, from_index: Temp.Index) InnerError!void { |
| 189749 | var any_valid = false; | 189749 | var any_valid = false; |
| 189750 | for (@intFromEnum(from_index)..@intFromEnum(cg.next_temp_index)) |temp_index| { | 189750 | for (@backingInt(from_index)..@backingInt(cg.next_temp_index)) |temp_index| { |
| 189751 | const temp: Temp.Index = @enumFromInt(temp_index); | 189751 | const temp: Temp.Index = @fromBackingInt(@intCast(temp_index)); |
| 189752 | if (temp.isValid(cg)) { | 189752 | if (temp.isValid(cg)) { |
| 189753 | any_valid = true; | 189753 | any_valid = true; |
| 189754 | tracking_log.err("failed to kill {f}: {f}", .{ | 189754 | tracking_log.err("failed to kill {f}: {f}", .{ |
| ... | @@ -189796,8 +189796,8 @@ fn tempAlloc(cg: *CodeGen, ty: Type) InnerError!Temp { | ... | @@ -189796,8 +189796,8 @@ fn tempAlloc(cg: *CodeGen, ty: Type) InnerError!Temp { |
| 189796 | temp_index.tracking(cg).* = .init( | 189796 | temp_index.tracking(cg).* = .init( |
| 189797 | try cg.allocRegOrMemAdvanced(ty, temp_index.toIndex(), true), | 189797 | try cg.allocRegOrMemAdvanced(ty, temp_index.toIndex(), true), |
| 189798 | ); | 189798 | ); |
| 189799 | cg.temp_type[@intFromEnum(temp_index)] = ty; | 189799 | cg.temp_type[@backingInt(temp_index)] = ty; |
| 189800 | cg.next_temp_index = @enumFromInt(@intFromEnum(temp_index) + 1); | 189800 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(temp_index) + 1)); |
| 189801 | return .{ .index = temp_index.toIndex() }; | 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,8 +189806,8 @@ fn tempAllocReg(cg: *CodeGen, ty: Type, rs: RegisterManager.RegisterBitSet) Inne |
| 189806 | temp_index.tracking(cg).* = .init( | 189806 | temp_index.tracking(cg).* = .init( |
| 189807 | .{ .register = try cg.register_manager.allocReg(temp_index.toIndex(), rs) }, | 189807 | .{ .register = try cg.register_manager.allocReg(temp_index.toIndex(), rs) }, |
| 189808 | ); | 189808 | ); |
| 189809 | cg.temp_type[@intFromEnum(temp_index)] = ty; | 189809 | cg.temp_type[@backingInt(temp_index)] = ty; |
| 189810 | cg.next_temp_index = @enumFromInt(@intFromEnum(temp_index) + 1); | 189810 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(temp_index) + 1)); |
| 189811 | return .{ .index = temp_index.toIndex() }; | 189811 | return .{ .index = temp_index.toIndex() }; |
| 189812 | } | 189812 | } |
| 189813 | 189813 | ||
| ... | @@ -189816,8 +189816,8 @@ fn tempAllocRegPair(cg: *CodeGen, ty: Type, rs: RegisterManager.RegisterBitSet) | ... | @@ -189816,8 +189816,8 @@ fn tempAllocRegPair(cg: *CodeGen, ty: Type, rs: RegisterManager.RegisterBitSet) |
| 189816 | temp_index.tracking(cg).* = .init( | 189816 | temp_index.tracking(cg).* = .init( |
| 189817 | .{ .register_pair = try cg.register_manager.allocRegs(2, @splat(temp_index.toIndex()), rs) }, | 189817 | .{ .register_pair = try cg.register_manager.allocRegs(2, @splat(temp_index.toIndex()), rs) }, |
| 189818 | ); | 189818 | ); |
| 189819 | cg.temp_type[@intFromEnum(temp_index)] = ty; | 189819 | cg.temp_type[@backingInt(temp_index)] = ty; |
| 189820 | cg.next_temp_index = @enumFromInt(@intFromEnum(temp_index) + 1); | 189820 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(temp_index) + 1)); |
| 189821 | return .{ .index = temp_index.toIndex() }; | 189821 | return .{ .index = temp_index.toIndex() }; |
| 189822 | } | 189822 | } |
| 189823 | 189823 | ||
| ... | @@ -189826,17 +189826,17 @@ fn tempAllocMem(cg: *CodeGen, ty: Type) InnerError!Temp { | ... | @@ -189826,17 +189826,17 @@ fn tempAllocMem(cg: *CodeGen, ty: Type) InnerError!Temp { |
| 189826 | temp_index.tracking(cg).* = .init( | 189826 | temp_index.tracking(cg).* = .init( |
| 189827 | try cg.allocRegOrMemAdvanced(ty, temp_index.toIndex(), false), | 189827 | try cg.allocRegOrMemAdvanced(ty, temp_index.toIndex(), false), |
| 189828 | ); | 189828 | ); |
| 189829 | cg.temp_type[@intFromEnum(temp_index)] = ty; | 189829 | cg.temp_type[@backingInt(temp_index)] = ty; |
| 189830 | cg.next_temp_index = @enumFromInt(@intFromEnum(temp_index) + 1); | 189830 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(temp_index) + 1)); |
| 189831 | return .{ .index = temp_index.toIndex() }; | 189831 | return .{ .index = temp_index.toIndex() }; |
| 189832 | } | 189832 | } |
| 189833 | 189833 | ||
| 189834 | fn tempInit(cg: *CodeGen, ty: Type, value: MCValue) InnerError!Temp { | 189834 | fn tempInit(cg: *CodeGen, ty: Type, value: MCValue) InnerError!Temp { |
| 189835 | const temp_index = cg.next_temp_index; | 189835 | const temp_index = cg.next_temp_index; |
| 189836 | temp_index.tracking(cg).* = .init(value); | 189836 | temp_index.tracking(cg).* = .init(value); |
| 189837 | cg.temp_type[@intFromEnum(temp_index)] = ty; | 189837 | cg.temp_type[@backingInt(temp_index)] = ty; |
| 189838 | try cg.getValue(value, temp_index.toIndex()); | 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 | return .{ .index = temp_index.toIndex() }; | 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,8 +189870,8 @@ fn tempFromOperand(cg: *CodeGen, op_ref: Air.Inst.Ref, op_dies: bool) InnerError |
| 189870 | const tracking = cg.getResolvedInstValue(op_inst); | 189870 | const tracking = cg.getResolvedInstValue(op_inst); |
| 189871 | temp_index.tracking(cg).* = tracking.*; | 189871 | temp_index.tracking(cg).* = tracking.*; |
| 189872 | if (!cg.reuseTemp(temp.index, op_inst, tracking)) return .{ .index = op_ref.toIndex().? }; | 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); | 189873 | cg.temp_type[@backingInt(temp_index)] = cg.typeOf(op_ref); |
| 189874 | cg.next_temp_index = @enumFromInt(@intFromEnum(temp_index) + 1); | 189874 | cg.next_temp_index = @fromBackingInt(@intCast(@backingInt(temp_index) + 1)); |
| 189875 | return temp; | 189875 | return temp; |
| 189876 | } | 189876 | } |
| 189877 | 189877 | ||
| ... | @@ -189910,9 +189910,9 @@ const Operand = union(enum) { | ... | @@ -189910,9 +189910,9 @@ const Operand = union(enum) { |
| 189910 | 189910 | ||
| 189911 | const Select = struct { | 189911 | const Select = struct { |
| 189912 | cg: *CodeGen, | 189912 | cg: *CodeGen, |
| 189913 | types: [@intFromEnum(Select.Operand.Ref.none)]Type, | 189913 | types: [@backingInt(Select.Operand.Ref.none)]Type, |
| 189914 | temps: [@intFromEnum(Select.Operand.Ref.none)]Temp, | 189914 | temps: [@backingInt(Select.Operand.Ref.none)]Temp, |
| 189915 | labels: [@intFromEnum(Label._)]struct { | 189915 | labels: [@backingInt(Label._)]struct { |
| 189916 | backward: ?Mir.Inst.Index, | 189916 | backward: ?Mir.Inst.Index, |
| 189917 | forward: [3]?Mir.Inst.Index, | 189917 | forward: [3]?Mir.Inst.Index, |
| 189918 | }, | 189918 | }, |
| ... | @@ -189921,8 +189921,8 @@ const Select = struct { | ... | @@ -189921,8 +189921,8 @@ const Select = struct { |
| 189921 | const Error = InnerError || error{SelectFailed}; | 189921 | const Error = InnerError || error{SelectFailed}; |
| 189922 | 189922 | ||
| 189923 | fn emitLabel(s: *Select, label_index: Label) void { | 189923 | fn emitLabel(s: *Select, label_index: Label) void { |
| 189924 | assert(@intFromEnum(label_index) < @intFromEnum(Label._)); | 189924 | assert(@backingInt(label_index) < @backingInt(Label._)); |
| 189925 | const label = &s.labels[@intFromEnum(label_index)]; | 189925 | const label = &s.labels[@backingInt(label_index)]; |
| 189926 | for (&label.forward) |*reloc| { | 189926 | for (&label.forward) |*reloc| { |
| 189927 | if (reloc.*) |r| s.cg.performReloc(r); | 189927 | if (reloc.*) |r| s.cg.performReloc(r); |
| 189928 | reloc.* = null; | 189928 | reloc.* = null; |
| ... | @@ -190072,19 +190072,19 @@ const Select = struct { | ... | @@ -190072,19 +190072,19 @@ const Select = struct { |
| 190072 | } | 190072 | } |
| 190073 | 190073 | ||
| 190074 | fn lowerReg(s: *const Select, reg: Register) Register { | 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 | const Case = struct { | 190078 | const Case = struct { |
| 190079 | required_abi: enum { any, gnu, msvc } = .any, | 190079 | required_abi: enum { any, gnu, msvc } = .any, |
| 190080 | required_cc_abi: enum { any, sysv64, win64 } = .any, | 190080 | required_cc_abi: enum { any, sysv64, win64 } = .any, |
| 190081 | required_features: [4]?std.Target.x86.Feature = @splat(null), | 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), | 190082 | src_constraints: [@backingInt(Select.Operand.Ref.none) - @backingInt(Select.Operand.Ref.src0)]Constraint = @splat(.any), |
| 190083 | dst_constraints: [@intFromEnum(Select.Operand.Ref.src0) - @intFromEnum(Select.Operand.Ref.dst0)]Constraint = @splat(.any), | 190083 | dst_constraints: [@backingInt(Select.Operand.Ref.src0) - @backingInt(Select.Operand.Ref.dst0)]Constraint = @splat(.any), |
| 190084 | patterns: []const Select.Pattern, | 190084 | patterns: []const Select.Pattern, |
| 190085 | call_frame: packed struct(u16) { size: u10 = 0, alignment: InternPool.Alignment } = .{ .size = 0, .alignment = .none }, | 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), | 190086 | extra_temps: [@backingInt(Select.Operand.Ref.dst0) - @backingInt(Select.Operand.Ref.tmp0)]TempSpec = @splat(.unused), |
| 190087 | dst_temps: [@intFromEnum(Select.Operand.Ref.src0) - @intFromEnum(Select.Operand.Ref.dst0)]TempSpec.Kind = @splat(.unused), | 190087 | dst_temps: [@backingInt(Select.Operand.Ref.src0) - @backingInt(Select.Operand.Ref.dst0)]TempSpec.Kind = @splat(.unused), |
| 190088 | clobbers: packed struct { | 190088 | clobbers: packed struct { |
| 190089 | eflags: bool = false, | 190089 | eflags: bool = false, |
| 190090 | caller_preserved: CallConv = .none, | 190090 | caller_preserved: CallConv = .none, |
| ... | @@ -190452,7 +190452,7 @@ const Select = struct { | ... | @@ -190452,7 +190452,7 @@ const Select = struct { |
| 190452 | }; | 190452 | }; |
| 190453 | 190453 | ||
| 190454 | const Pattern = struct { | 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 | commute: struct { u8, u8 } = .{ 0, 0 }, | 190456 | commute: struct { u8, u8 } = .{ 0, 0 }, |
| 190457 | 190457 | ||
| 190458 | const Src = union(enum) { | 190458 | const Src = union(enum) { |
| ... | @@ -191203,7 +191203,7 @@ const Select = struct { | ... | @@ -191203,7 +191203,7 @@ const Select = struct { |
| 191203 | else => {}, | 191203 | else => {}, |
| 191204 | inline .rc_mask, .mut_rc_mask, .ref_mask => |mask| temp.asMask(mask.info, cg), | 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,17 +191602,17 @@ const Select = struct { |
| 191602 | }; | 191602 | }; |
| 191603 | 191603 | ||
| 191604 | fn typeOf(ref: Ref, s: *const Select) Type { | 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 | fn tempOf(ref: Ref, s: *const Select) Temp { | 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 | fn valueOf(ref: Ref, s: *const Select) MCValue { | 191612 | fn valueOf(ref: Ref, s: *const Select) MCValue { |
| 191613 | return switch (ref) { | 191613 | return switch (ref) { |
| 191614 | .none => .none, | 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,7 +192281,7 @@ const Select = struct { |
| 192281 | Select.Operand.Ref.src1.valueOf(s).immediate), | 192281 | Select.Operand.Ref.src1.valueOf(s).immediate), |
| 192282 | .vector_index => switch (op.flags.base.ref.typeOf(s).ptrInfo(s.cg.pt.zcu).flags.vector_index) { | 192282 | .vector_index => switch (op.flags.base.ref.typeOf(s).ptrInfo(s.cg.pt.zcu).flags.vector_index) { |
| 192283 | .none => unreachable, | 192283 | .none => unreachable, |
| 192284 | else => |vector_index| @intFromEnum(vector_index), | 192284 | else => |vector_index| @backingInt(vector_index), |
| 192285 | }, | 192285 | }, |
| 192286 | .src1 => @intCast(Select.Operand.Ref.src1.valueOf(s).immediate), | 192286 | .src1 => @intCast(Select.Operand.Ref.src1.valueOf(s).immediate), |
| 192287 | .src1_sub_bit_size => @as(SignedImm, @intCast(Select.Operand.Ref.src1.valueOf(s).immediate)) - | 192287 | .src1_sub_bit_size => @as(SignedImm, @intCast(Select.Operand.Ref.src1.valueOf(s).immediate)) - |
| ... | @@ -192465,14 +192465,14 @@ fn select( | ... | @@ -192465,14 +192465,14 @@ fn select( |
| 192465 | if (case.call_frame.alignment != .none) { | 192465 | if (case.call_frame.alignment != .none) { |
| 192466 | const frame_allocs_slice = cg.frame_allocs.slice(); | 192466 | const frame_allocs_slice = cg.frame_allocs.slice(); |
| 192467 | const stack_frame_size = | 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 | stack_frame_size.* = @max(stack_frame_size.*, switch (cg.target.cCallingConvention().?) { | 192469 | stack_frame_size.* = @max(stack_frame_size.*, switch (cg.target.cCallingConvention().?) { |
| 192470 | .x86_64_sysv => case.call_frame.size, | 192470 | .x86_64_sysv => case.call_frame.size, |
| 192471 | .x86_64_win => win64_shadow_space + case.call_frame.size, | 192471 | .x86_64_win => win64_shadow_space + case.call_frame.size, |
| 192472 | else => unreachable, | 192472 | else => unreachable, |
| 192473 | }); | 192473 | }); |
| 192474 | const stack_frame_align = | 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 | stack_frame_align.* = stack_frame_align.max(case.call_frame.alignment); | 192476 | stack_frame_align.* = stack_frame_align.max(case.call_frame.alignment); |
| 192477 | } | 192477 | } |
| 192478 | 192478 | ||
| ... | @@ -192483,12 +192483,12 @@ fn select( | ... | @@ -192483,12 +192483,12 @@ fn select( |
| 192483 | .labels = @splat(.{ .forward = @splat(null), .backward = null }), | 192483 | .labels = @splat(.{ .forward = @splat(null), .backward = null }), |
| 192484 | .top = 0, | 192484 | .top = 0, |
| 192485 | }; | 192485 | }; |
| 192486 | const s_tmp_types = s.types[@intFromEnum(Select.Operand.Ref.tmp0)..@intFromEnum(Select.Operand.Ref.dst0)]; | 192486 | const s_tmp_types = s.types[@backingInt(Select.Operand.Ref.tmp0)..@backingInt(Select.Operand.Ref.dst0)]; |
| 192487 | const s_tmp_temps = s.temps[@intFromEnum(Select.Operand.Ref.tmp0)..@intFromEnum(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[@intFromEnum(Select.Operand.Ref.dst0)..@intFromEnum(Select.Operand.Ref.src0)]; | 192488 | const s_dst_types = s.types[@backingInt(Select.Operand.Ref.dst0)..@backingInt(Select.Operand.Ref.src0)]; |
| 192489 | const s_dst_temps = s.temps[@intFromEnum(Select.Operand.Ref.dst0)..@intFromEnum(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[@intFromEnum(Select.Operand.Ref.src0)..@intFromEnum(Select.Operand.Ref.none)]; | 192490 | const s_src_types = s.types[@backingInt(Select.Operand.Ref.src0)..@backingInt(Select.Operand.Ref.none)]; |
| 192491 | const s_src_temps = s.temps[@intFromEnum(Select.Operand.Ref.src0)..@intFromEnum(Select.Operand.Ref.none)]; | 192491 | const s_src_temps = s.temps[@backingInt(Select.Operand.Ref.src0)..@backingInt(Select.Operand.Ref.none)]; |
| 192492 | 192492 | ||
| 192493 | for (s_tmp_types, case.extra_temps) |*ty, spec| ty.* = spec.type; | 192493 | for (s_tmp_types, case.extra_temps) |*ty, spec| ty.* = spec.type; |
| 192494 | @memcpy(s_dst_types[0..dst_tys.len], dst_tys); | 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,7 +379,7 @@ fn parseEncoding(dis: *Disassembler, prefixes: Prefixes) !?Encoding { |
| 379 | 379 | ||
| 380 | fn parseGpRegister(low_enc: u3, is_extended: bool, rex: Rex, bit_size: u64) Register { | 380 | fn parseGpRegister(low_enc: u3, is_extended: bool, rex: Rex, bit_size: u64) Register { |
| 381 | const reg_id: u4 = @as(u4, @intCast(@intFromBool(is_extended))) << 3 | low_enc; | 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 | return switch (reg) { | 383 | return switch (reg) { |
| 384 | .spl => if (rex.present or rex.isSet()) .spl else .ah, | 384 | .spl => if (rex.present or rex.isSet()) .spl else .ah, |
| 385 | .dil => if (rex.present or rex.isSet()) .dil else .bh, | 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,33 +135,33 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 135 | } }, | 135 | } }, |
| 136 | .lazy_sym => |lazy_sym| .{ .symbol = .{ | 136 | .lazy_sym => |lazy_sym| .{ .symbol = .{ |
| 137 | .symbol = if (emit.bin_file.cast(.elf)) |elf_file| | 137 | .symbol = if (emit.bin_file.cast(.elf)) |elf_file| |
| 138 | @enumFromInt( | 138 | @fromBackingInt(@intCast( |
| 139 | elf_file.zigObjectPtr().?.getOrCreateMetadataForLazySymbol(elf_file, emit.pt, lazy_sym) catch |err| | 139 | elf_file.zigObjectPtr().?.getOrCreateMetadataForLazySymbol(elf_file, emit.pt, lazy_sym) catch |err| |
| 140 | return emit.fail("{s} creating lazy symbol", .{@errorName(err)}), | 140 | return emit.fail("{s} creating lazy symbol", .{@errorName(err)}), |
| 141 | ) | 141 | )) |
| 142 | else if (emit.bin_file.cast(.elf2)) |elf| | 142 | else if (emit.bin_file.cast(.elf2)) |elf| |
| 143 | try elf.lazySymbol(lazy_sym) | 143 | try elf.lazySymbol(lazy_sym) |
| 144 | else if (emit.bin_file.cast(.macho)) |macho_file| | 144 | else if (emit.bin_file.cast(.macho)) |macho_file| |
| 145 | @enumFromInt(macho_file.getZigObject().?.getOrCreateMetadataForLazySymbol(macho_file, emit.pt, lazy_sym) catch |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)})) | 146 | return emit.fail("{s} creating lazy symbol", .{@errorName(err)}))) |
| 147 | else if (emit.bin_file.cast(.coff2)) |coff| | 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 | else | 149 | else |
| 150 | return emit.fail("lazy symbols unimplemented for {s}", .{@tagName(emit.bin_file.tag)}), | 150 | return emit.fail("lazy symbols unimplemented for {s}", .{@tagName(emit.bin_file.tag)}), |
| 151 | .is_extern = false, | 151 | .is_extern = false, |
| 152 | } }, | 152 | } }, |
| 153 | .extern_func => |extern_func| .{ .symbol = .{ | 153 | .extern_func => |extern_func| .{ .symbol = .{ |
| 154 | .symbol = if (emit.bin_file.cast(.elf)) |elf_file| | 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 | else if (emit.bin_file.cast(.elf2)) |elf| try elf.externSymbol(.{ | 156 | else if (emit.bin_file.cast(.elf2)) |elf| try elf.externSymbol(.{ |
| 157 | .name = extern_func.toSlice(&emit.lower.mir).?, | 157 | .name = extern_func.toSlice(&emit.lower.mir).?, |
| 158 | .lib_name = null, | 158 | .lib_name = null, |
| 159 | .type = .FUNC, | 159 | .type = .FUNC, |
| 160 | }) else if (emit.bin_file.cast(.macho)) |macho_file| | 160 | }) else if (emit.bin_file.cast(.macho)) |macho_file| |
| 161 | @enumFromInt(try macho_file.getGlobalSymbol(extern_func.toSlice(&emit.lower.mir).?, null)) | 161 | @fromBackingInt(@intCast(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(.{ | 162 | else if (emit.bin_file.cast(.coff2)) |coff| @fromBackingInt(@intCast(@backingInt(try coff.globalSymbol(.{ |
| 163 | .name = extern_func.toSlice(&emit.lower.mir).?, | 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 | .is_extern = true, | 165 | .is_extern = true, |
| 166 | } }, | 166 | } }, |
| 167 | }, | 167 | }, |
| ... | @@ -309,10 +309,10 @@ pub fn emitMir(emit: *Emit) Error!void { | ... | @@ -309,10 +309,10 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 309 | }, emit.lower.target), &.{.{ | 309 | }, emit.lower.target), &.{.{ |
| 310 | .op_index = 0, | 310 | .op_index = 0, |
| 311 | .target = .{ .branch = .{ | 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 | "__tls_get_addr", | 313 | "__tls_get_addr", |
| 314 | if (comp.config.link_libc) "c" else null, | 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 | .name = "__tls_get_addr", | 316 | .name = "__tls_get_addr", |
| 317 | .lib_name = if (comp.config.link_libc) "c" else null, | 317 | .lib_name = if (comp.config.link_libc) "c" else null, |
| 318 | .type = .FUNC, | 318 | .type = .FUNC, |
| ... | @@ -391,9 +391,9 @@ pub fn emitMir(emit: *Emit) Error!void { | ... | @@ -391,9 +391,9 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 391 | }, emit.lower.target), &.{.{ | 391 | }, emit.lower.target), &.{.{ |
| 392 | .op_index = 1, | 392 | .op_index = 1, |
| 393 | .target = .{ .symbol = .{ | 393 | .target = .{ .symbol = .{ |
| 394 | .symbol = @enumFromInt(@intFromEnum( | 394 | .symbol = @fromBackingInt(@intCast(@backingInt( |
| 395 | try coff.globalSymbol(.{ .name = "__tls_index" }), | 395 | try coff.globalSymbol(.{ .name = "__tls_index" }), |
| 396 | )), | 396 | ))), |
| 397 | .is_extern = false, | 397 | .is_extern = false, |
| 398 | } }, | 398 | } }, |
| 399 | }}); | 399 | }}); |
| ... | @@ -426,9 +426,9 @@ pub fn emitMir(emit: *Emit) Error!void { | ... | @@ -426,9 +426,9 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 426 | }, emit.lower.target), &.{.{ | 426 | }, emit.lower.target), &.{.{ |
| 427 | .op_index = 1, | 427 | .op_index = 1, |
| 428 | .target = .{ .symbol = .{ | 428 | .target = .{ .symbol = .{ |
| 429 | .symbol = @enumFromInt(@intFromEnum( | 429 | .symbol = @fromBackingInt(@intCast(@backingInt( |
| 430 | try coff.globalSymbol(.{ .name = "_tls_index" }), | 430 | try coff.globalSymbol(.{ .name = "_tls_index" }), |
| 431 | )), | 431 | ))), |
| 432 | .is_extern = false, | 432 | .is_extern = false, |
| 433 | } }, | 433 | } }, |
| 434 | }}); | 434 | }}); |
| ... | @@ -680,17 +680,17 @@ pub fn emitMir(emit: *Emit) Error!void { | ... | @@ -680,17 +680,17 @@ pub fn emitMir(emit: *Emit) Error!void { |
| 680 | var table_offset = std.mem.alignForward(u32, @intCast(emit.w.end), ptr_size); | 680 | var table_offset = std.mem.alignForward(u32, @intCast(emit.w.end), ptr_size); |
| 681 | if (emit.bin_file.cast(.elf)) |elf_file| { | 681 | if (emit.bin_file.cast(.elf)) |elf_file| { |
| 682 | const zo = elf_file.zigObjectPtr().?; | 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 | for (emit.table_relocs.items) |table_reloc| try atom.addReloc(gpa, .{ | 685 | for (emit.table_relocs.items) |table_reloc| try atom.addReloc(gpa, .{ |
| 686 | .r_offset = table_reloc.source_offset, | 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 | .r_addend = @as(i64, table_offset) + table_reloc.target_offset, | 688 | .r_addend = @as(i64, table_offset) + table_reloc.target_offset, |
| 689 | }, zo); | 689 | }, zo); |
| 690 | for (emit.lower.mir.table) |entry| { | 690 | for (emit.lower.mir.table) |entry| { |
| 691 | try atom.addReloc(gpa, .{ | 691 | try atom.addReloc(gpa, .{ |
| 692 | .r_offset = table_offset, | 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 | .r_addend = emit.code_offset_mapping.items[entry], | 694 | .r_addend = emit.code_offset_mapping.items[entry], |
| 695 | }, zo); | 695 | }, zo); |
| 696 | table_offset += ptr_size; | 696 | table_offset += ptr_size; |
| ... | @@ -793,7 +793,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI | ... | @@ -793,7 +793,7 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 793 | }), | 793 | }), |
| 794 | .symbol => |target| if (emit.bin_file.cast(.elf)) |elf_file| { | 794 | .symbol => |target| if (emit.bin_file.cast(.elf)) |elf_file| { |
| 795 | const zo = elf_file.zigObjectPtr().?; | 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 | const r_type: std.elf.R_X86_64 = if (!emit.pic) | 797 | const r_type: std.elf.R_X86_64 = if (!emit.pic) |
| 798 | .@"32S" | 798 | .@"32S" |
| 799 | else if (target.is_extern and !target.force_pcrel_direct) | 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,23 +802,23 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 802 | .PC32; | 802 | .PC32; |
| 803 | try atom.addReloc(gpa, .{ | 803 | try atom.addReloc(gpa, .{ |
| 804 | .r_offset = end_offset - 4, | 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 | .r_addend = if (emit.pic) reloc.off - 4 else reloc.off, | 806 | .r_addend = if (emit.pic) reloc.off - 4 else reloc.off, |
| 807 | }, zo); | 807 | }, zo); |
| 808 | } else if (emit.bin_file.cast(.macho)) |macho_file| { | 808 | } else if (emit.bin_file.cast(.macho)) |macho_file| { |
| 809 | const zo = macho_file.getZigObject().?; | 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 | try atom.addReloc(macho_file, .{ | 811 | try atom.addReloc(macho_file, .{ |
| 812 | .tag = .@"extern", | 812 | .tag = .@"extern", |
| 813 | .offset = end_offset - 4, | 813 | .offset = end_offset - 4, |
| 814 | .target = @intFromEnum(target.symbol), | 814 | .target = @backingInt(target.symbol), |
| 815 | .addend = reloc.off, | 815 | .addend = reloc.off, |
| 816 | .type = if (target.is_extern and !target.force_pcrel_direct) .got_load else .signed, | 816 | .type = if (target.is_extern and !target.force_pcrel_direct) .got_load else .signed, |
| 817 | .meta = .{ | 817 | .meta = .{ |
| 818 | .pcrel = true, | 818 | .pcrel = true, |
| 819 | .has_subtractor = false, | 819 | .has_subtractor = false, |
| 820 | .length = 2, | 820 | .length = 2, |
| 821 | .symbolnum = @intCast(@intFromEnum(target.symbol)), | 821 | .symbolnum = @intCast(@backingInt(target.symbol)), |
| 822 | }, | 822 | }, |
| 823 | }); | 823 | }); |
| 824 | } else if (emit.bin_file.cast(.elf2)) |elf| try elf.addReloc( | 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,19 +832,19 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 832 | break :rt .PC32; | 832 | break :rt .PC32; |
| 833 | } }, | 833 | } }, |
| 834 | ) else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc( | 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 | end_offset - 4, | 836 | end_offset - 4, |
| 837 | @enumFromInt(@intFromEnum(target.symbol)), | 837 | @fromBackingInt(@intCast(@backingInt(target.symbol))), |
| 838 | .{ .known = reloc.off }, | 838 | .{ .known = reloc.off }, |
| 839 | .{ .AMD64 = .REL32 }, | 839 | .{ .AMD64 = .REL32 }, |
| 840 | ) else unreachable, | 840 | ) else unreachable, |
| 841 | .branch => |target| if (emit.bin_file.cast(.elf)) |elf_file| { | 841 | .branch => |target| if (emit.bin_file.cast(.elf)) |elf_file| { |
| 842 | const zo = elf_file.zigObjectPtr().?; | 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 | const r_type: std.elf.R_X86_64 = .PLT32; | 844 | const r_type: std.elf.R_X86_64 = .PLT32; |
| 845 | try atom.addReloc(gpa, .{ | 845 | try atom.addReloc(gpa, .{ |
| 846 | .r_offset = end_offset - 4, | 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 | .r_addend = reloc.off - 4, | 848 | .r_addend = reloc.off - 4, |
| 849 | }, zo); | 849 | }, zo); |
| 850 | } else if (emit.bin_file.cast(.elf2)) |elf| try elf.addReloc( | 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,24 +855,24 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 855 | .{ .X86_64 = .PLT32 }, | 855 | .{ .X86_64 = .PLT32 }, |
| 856 | ) else if (emit.bin_file.cast(.macho)) |macho_file| { | 856 | ) else if (emit.bin_file.cast(.macho)) |macho_file| { |
| 857 | const zo = macho_file.getZigObject().?; | 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 | try atom.addReloc(macho_file, .{ | 859 | try atom.addReloc(macho_file, .{ |
| 860 | .tag = .@"extern", | 860 | .tag = .@"extern", |
| 861 | .offset = end_offset - 4, | 861 | .offset = end_offset - 4, |
| 862 | .target = @intFromEnum(target.symbol), | 862 | .target = @backingInt(target.symbol), |
| 863 | .addend = reloc.off, | 863 | .addend = reloc.off, |
| 864 | .type = .branch, | 864 | .type = .branch, |
| 865 | .meta = .{ | 865 | .meta = .{ |
| 866 | .pcrel = true, | 866 | .pcrel = true, |
| 867 | .has_subtractor = false, | 867 | .has_subtractor = false, |
| 868 | .length = 2, | 868 | .length = 2, |
| 869 | .symbolnum = @intCast(@intFromEnum(target.symbol)), | 869 | .symbolnum = @intCast(@backingInt(target.symbol)), |
| 870 | }, | 870 | }, |
| 871 | }); | 871 | }); |
| 872 | } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc( | 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 | end_offset - 4, | 874 | end_offset - 4, |
| 875 | @enumFromInt(@intFromEnum(target.symbol)), | 875 | @fromBackingInt(@intCast(@backingInt(target.symbol))), |
| 876 | .{ .known = reloc.off }, | 876 | .{ .known = reloc.off }, |
| 877 | .{ .AMD64 = .REL32 }, | 877 | .{ .AMD64 = .REL32 }, |
| 878 | ) else return emit.fail("TODO implement {s} reloc for {s}", .{ | 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,11 +880,11 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 880 | }), | 880 | }), |
| 881 | .tls => |target_symbol| if (emit.bin_file.cast(.elf)) |elf_file| { | 881 | .tls => |target_symbol| if (emit.bin_file.cast(.elf)) |elf_file| { |
| 882 | const zo = elf_file.zigObjectPtr().?; | 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 | const r_type: std.elf.R_X86_64 = if (emit.pic) .TLSLD else unreachable; | 884 | const r_type: std.elf.R_X86_64 = if (emit.pic) .TLSLD else unreachable; |
| 885 | try atom.addReloc(gpa, .{ | 885 | try atom.addReloc(gpa, .{ |
| 886 | .r_offset = end_offset - 4, | 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 | .r_addend = reloc.off - 4, | 888 | .r_addend = reloc.off - 4, |
| 889 | }, zo); | 889 | }, zo); |
| 890 | } else if (emit.bin_file.cast(.elf2)) |elf| try elf.addReloc( | 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,11 +898,11 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 898 | }), | 898 | }), |
| 899 | .tlv => |target| if (emit.bin_file.cast(.elf)) |elf_file| { | 899 | .tlv => |target| if (emit.bin_file.cast(.elf)) |elf_file| { |
| 900 | const zo = elf_file.zigObjectPtr().?; | 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 | const r_type: std.elf.R_X86_64 = if (emit.pic) .DTPOFF32 else .TPOFF32; | 902 | const r_type: std.elf.R_X86_64 = if (emit.pic) .DTPOFF32 else .TPOFF32; |
| 903 | try atom.addReloc(gpa, .{ | 903 | try atom.addReloc(gpa, .{ |
| 904 | .r_offset = end_offset - 4, | 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 | .r_addend = reloc.off, | 906 | .r_addend = reloc.off, |
| 907 | }, zo); | 907 | }, zo); |
| 908 | } else if (emit.bin_file.cast(.elf2)) |elf| try elf.addReloc( | 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,24 +913,24 @@ fn encodeInst(emit: *Emit, lowered_inst: Instruction, reloc_info: []const RelocI |
| 913 | .{ .X86_64 = if (emit.pic) .DTPOFF32 else .TPOFF32 }, | 913 | .{ .X86_64 = if (emit.pic) .DTPOFF32 else .TPOFF32 }, |
| 914 | ) else if (emit.bin_file.cast(.macho)) |macho_file| { | 914 | ) else if (emit.bin_file.cast(.macho)) |macho_file| { |
| 915 | const zo = macho_file.getZigObject().?; | 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 | try atom.addReloc(macho_file, .{ | 917 | try atom.addReloc(macho_file, .{ |
| 918 | .tag = .@"extern", | 918 | .tag = .@"extern", |
| 919 | .offset = end_offset - 4, | 919 | .offset = end_offset - 4, |
| 920 | .target = @intFromEnum(target.symbol), | 920 | .target = @backingInt(target.symbol), |
| 921 | .addend = reloc.off, | 921 | .addend = reloc.off, |
| 922 | .type = .tlv, | 922 | .type = .tlv, |
| 923 | .meta = .{ | 923 | .meta = .{ |
| 924 | .pcrel = true, | 924 | .pcrel = true, |
| 925 | .has_subtractor = false, | 925 | .has_subtractor = false, |
| 926 | .length = 2, | 926 | .length = 2, |
| 927 | .symbolnum = @intCast(@intFromEnum(target.symbol)), | 927 | .symbolnum = @intCast(@backingInt(target.symbol)), |
| 928 | }, | 928 | }, |
| 929 | }); | 929 | }); |
| 930 | } else if (emit.bin_file.cast(.coff2)) |coff| try coff.addReloc( | 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 | end_offset - 4, | 932 | end_offset - 4, |
| 933 | @enumFromInt(@intFromEnum(target.symbol)), | 933 | @fromBackingInt(@intCast(@backingInt(target.symbol))), |
| 934 | .{ .known = reloc.off }, | 934 | .{ .known = reloc.off }, |
| 935 | .{ .AMD64 = .SECREL }, | 935 | .{ .AMD64 = .SECREL }, |
| 936 | ) else return emit.fail("TODO implement {s} reloc for {s}", .{ | 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,7 +57,7 @@ pub fn findByMnemonic( |
| 57 | 57 | ||
| 58 | var shortest_enc: ?Encoding = null; | 58 | var shortest_enc: ?Encoding = null; |
| 59 | var shortest_len: ?usize = null; | 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 | if (!switch (data.feature) { | 61 | if (!switch (data.feature) { |
| 62 | .none => true, | 62 | .none => true, |
| 63 | .@"32bit" => switch (target.cpu.arch) { | 63 | .@"32bit" => switch (target.cpu.arch) { |
| ... | @@ -122,7 +122,7 @@ pub fn findByOpcode(opc: []const u8, prefixes: struct { | ... | @@ -122,7 +122,7 @@ pub fn findByOpcode(opc: []const u8, prefixes: struct { |
| 122 | rex: Rex, | 122 | rex: Rex, |
| 123 | }, modrm_ext: ?u3) ?Encoding { | 123 | }, modrm_ext: ?u3) ?Encoding { |
| 124 | for (mnemonic_to_encodings_map, 0..) |encs, mnemonic_int| for (encs) |data| { | 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 | if (modrm_ext) |ext| if (ext != data.modrm_ext) continue; | 126 | if (modrm_ext) |ext| if (ext != data.modrm_ext) continue; |
| 127 | if (!std.mem.eql(u8, opc, enc.opcode())) continue; | 127 | if (!std.mem.eql(u8, opc, enc.opcode())) continue; |
| 128 | if (prefixes.rex.w) { | 128 | if (prefixes.rex.w) { |
| ... | @@ -1030,7 +1030,7 @@ const mnemonic_to_encodings_map = init: { | ... | @@ -1030,7 +1030,7 @@ const mnemonic_to_encodings_map = init: { |
| 1030 | 1030 | ||
| 1031 | const mnemonic_count = @typeInfo(Mnemonic).@"enum".field_names.len; | 1031 | const mnemonic_count = @typeInfo(Mnemonic).@"enum".field_names.len; |
| 1032 | var mnemonic_map: [mnemonic_count][]Data = @splat(&.{}); | 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 | var data_storage: [encodings.len]Data = undefined; | 1034 | var data_storage: [encodings.len]Data = undefined; |
| 1035 | var storage_index: usize = 0; | 1035 | var storage_index: usize = 0; |
| 1036 | for (&mnemonic_map) |*value| { | 1036 | for (&mnemonic_map) |*value| { |
| ... | @@ -1041,8 +1041,8 @@ const mnemonic_to_encodings_map = init: { | ... | @@ -1041,8 +1041,8 @@ const mnemonic_to_encodings_map = init: { |
| 1041 | const ops_len = @typeInfo(@FieldType(Data, "ops")).array.len; | 1041 | const ops_len = @typeInfo(@FieldType(Data, "ops")).array.len; |
| 1042 | const opc_len = @typeInfo(@FieldType(Data, "opc")).array.len; | 1042 | const opc_len = @typeInfo(@FieldType(Data, "opc")).array.len; |
| 1043 | for (encodings) |entry| { | 1043 | for (encodings) |entry| { |
| 1044 | const index = &mnemonic_index[@intFromEnum(entry[0])]; | 1044 | const index = &mnemonic_index[@backingInt(entry[0])]; |
| 1045 | mnemonic_map[@intFromEnum(entry[0])][index.*] = .{ | 1045 | mnemonic_map[@backingInt(entry[0])][index.*] = .{ |
| 1046 | .op_en = entry[1], | 1046 | .op_en = entry[1], |
| 1047 | .ops = ops: { | 1047 | .ops = ops: { |
| 1048 | var ops: [ops_len]Op = @splat(.none); | 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,7 +433,7 @@ const mnemonic_table: [inst_tags_len * inst_fixes_len]?Mnemonic = table: { |
| 433 | @setEvalBranchQuota(80_000); | 433 | @setEvalBranchQuota(80_000); |
| 434 | var table: [inst_tags_len * inst_fixes_len]?Mnemonic = undefined; | 434 | var table: [inst_tags_len * inst_fixes_len]?Mnemonic = undefined; |
| 435 | for (0..inst_fixes_len) |fixes_i| { | 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 | const prefix, const suffix = affix: { | 437 | const prefix, const suffix = affix: { |
| 438 | const pattern = if (std.mem.indexOfScalar(u8, @tagName(fixes), ' ')) |i| | 438 | const pattern = if (std.mem.indexOfScalar(u8, @tagName(fixes), ' ')) |i| |
| 439 | @tagName(fixes)[i + 1 ..] | 439 | @tagName(fixes)[i + 1 ..] |
| ... | @@ -443,7 +443,7 @@ const mnemonic_table: [inst_tags_len * inst_fixes_len]?Mnemonic = table: { | ... | @@ -443,7 +443,7 @@ const mnemonic_table: [inst_tags_len * inst_fixes_len]?Mnemonic = table: { |
| 443 | break :affix .{ pattern[0..wildcard_idx], pattern[wildcard_idx + 1 ..] }; | 443 | break :affix .{ pattern[0..wildcard_idx], pattern[wildcard_idx + 1 ..] }; |
| 444 | }; | 444 | }; |
| 445 | for (0..inst_tags_len) |inst_tag_i| { | 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 | const name = prefix ++ @tagName(inst_tag) ++ suffix; | 447 | const name = prefix ++ @tagName(inst_tag) ++ suffix; |
| 448 | const idx = inst_tag_i * inst_fixes_len + fixes_i; | 448 | const idx = inst_tag_i * inst_fixes_len + fixes_i; |
| 449 | table[idx] = if (@hasField(Mnemonic, name)) @field(Mnemonic, name) else null; | 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,7 +482,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void { |
| 482 | else | 482 | else |
| 483 | .none, | 483 | .none, |
| 484 | }, mnemonic: { | 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 | break :mnemonic mnemonic; | 486 | break :mnemonic mnemonic; |
| 487 | } | 487 | } |
| 488 | // This combination is invalid; make the theoretical mnemonic name and emit an error with it. | 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,7 +1822,7 @@ pub const NullTerminatedString = enum(u32) { |
| 1822 | 1822 | ||
| 1823 | pub fn toSlice(nts: NullTerminatedString, mir: *const Mir) ?[:0]const u8 { | 1823 | pub fn toSlice(nts: NullTerminatedString, mir: *const Mir) ?[:0]const u8 { |
| 1824 | if (nts == .none) return null; | 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 | return string_bytes[0..std.mem.indexOfScalar(u8, string_bytes, 0).? :0]; | 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,13 +1890,13 @@ pub const Memory = struct { |
| 1890 | }, | 1890 | }, |
| 1891 | .base = switch (mem.base) { | 1891 | .base = switch (mem.base) { |
| 1892 | .none, .table => undefined, | 1892 | .none, .table => undefined, |
| 1893 | .reg => |reg| @intFromEnum(reg), | 1893 | .reg => |reg| @backingInt(reg), |
| 1894 | .frame => |frame_index| @intFromEnum(frame_index), | 1894 | .frame => |frame_index| @backingInt(frame_index), |
| 1895 | .rip_inst => |inst_index| inst_index, | 1895 | .rip_inst => |inst_index| inst_index, |
| 1896 | .nav => |nav| @intFromEnum(nav), | 1896 | .nav => |nav| @backingInt(nav), |
| 1897 | .uav => |uav| @intFromEnum(uav.val), | 1897 | .uav => |uav| @backingInt(uav.val), |
| 1898 | .lazy_sym => |lazy_sym| @intFromEnum(lazy_sym.ty), | 1898 | .lazy_sym => |lazy_sym| @backingInt(lazy_sym.ty), |
| 1899 | .extern_func => |extern_func| @intFromEnum(extern_func), | 1899 | .extern_func => |extern_func| @backingInt(extern_func), |
| 1900 | }, | 1900 | }, |
| 1901 | .off = switch (mem.mod) { | 1901 | .off = switch (mem.mod) { |
| 1902 | .rm => |rm| @bitCast(rm.disp), | 1902 | .rm => |rm| @bitCast(rm.disp), |
| ... | @@ -1905,8 +1905,8 @@ pub const Memory = struct { | ... | @@ -1905,8 +1905,8 @@ pub const Memory = struct { |
| 1905 | .extra = switch (mem.mod) { | 1905 | .extra = switch (mem.mod) { |
| 1906 | .rm => switch (mem.base) { | 1906 | .rm => switch (mem.base) { |
| 1907 | else => undefined, | 1907 | else => undefined, |
| 1908 | .uav => |uav| @intFromEnum(uav.orig_ty), | 1908 | .uav => |uav| @backingInt(uav.orig_ty), |
| 1909 | .lazy_sym => |lazy_sym| @intFromEnum(lazy_sym.kind), | 1909 | .lazy_sym => |lazy_sym| @backingInt(lazy_sym.kind), |
| 1910 | }, | 1910 | }, |
| 1911 | .off => switch (mem.base) { | 1911 | .off => switch (mem.base) { |
| 1912 | .reg => @intCast(mem.mod.off >> 32), | 1912 | .reg => @intCast(mem.mod.off >> 32), |
| ... | @@ -1919,7 +1919,7 @@ pub const Memory = struct { | ... | @@ -1919,7 +1919,7 @@ pub const Memory = struct { |
| 1919 | pub fn decode(mem: Memory) encoder.Instruction.Memory { | 1919 | pub fn decode(mem: Memory) encoder.Instruction.Memory { |
| 1920 | switch (mem.info.mod) { | 1920 | switch (mem.info.mod) { |
| 1921 | .rm => { | 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 | assert(mem.info.index == .none and mem.info.scale == .@"1"); | 1923 | assert(mem.info.index == .none and mem.info.scale == .@"1"); |
| 1924 | return encoder.Instruction.Memory.initRip(mem.info.size, @bitCast(mem.off)); | 1924 | return encoder.Instruction.Memory.initRip(mem.info.size, @bitCast(mem.off)); |
| 1925 | } | 1925 | } |
| ... | @@ -1927,14 +1927,14 @@ pub const Memory = struct { | ... | @@ -1927,14 +1927,14 @@ pub const Memory = struct { |
| 1927 | .disp = @bitCast(mem.off), | 1927 | .disp = @bitCast(mem.off), |
| 1928 | .base = switch (mem.info.base) { | 1928 | .base = switch (mem.info.base) { |
| 1929 | .none => .none, | 1929 | .none => .none, |
| 1930 | .reg => .{ .reg = @enumFromInt(mem.base) }, | 1930 | .reg => .{ .reg = @fromBackingInt(@intCast(mem.base)) }, |
| 1931 | .frame => .{ .frame = @enumFromInt(mem.base) }, | 1931 | .frame => .{ .frame = @fromBackingInt(@intCast(mem.base)) }, |
| 1932 | .table => .table, | 1932 | .table => .table, |
| 1933 | .rip_inst => .{ .rip_inst = mem.base }, | 1933 | .rip_inst => .{ .rip_inst = mem.base }, |
| 1934 | .nav => .{ .nav = @enumFromInt(mem.base) }, | 1934 | .nav => .{ .nav = @fromBackingInt(@intCast(mem.base)) }, |
| 1935 | .uav => .{ .uav = .{ .val = @enumFromInt(mem.base), .orig_ty = @enumFromInt(mem.extra) } }, | 1935 | .uav => .{ .uav = .{ .val = @fromBackingInt(@intCast(mem.base)), .orig_ty = @fromBackingInt(@intCast(mem.extra)) } }, |
| 1936 | .lazy_sym => .{ .lazy_sym = .{ .kind = @enumFromInt(mem.extra), .ty = @enumFromInt(mem.base) } }, | 1936 | .lazy_sym => .{ .lazy_sym = .{ .kind = @fromBackingInt(@intCast(mem.extra)), .ty = @fromBackingInt(@intCast(mem.base)) } }, |
| 1937 | .extern_func => .{ .extern_func = @enumFromInt(mem.base) }, | 1937 | .extern_func => .{ .extern_func = @fromBackingInt(@intCast(mem.base)) }, |
| 1938 | }, | 1938 | }, |
| 1939 | .scale_index = switch (mem.info.index) { | 1939 | .scale_index = switch (mem.info.index) { |
| 1940 | .none => null, | 1940 | .none => null, |
| ... | @@ -1951,7 +1951,7 @@ pub const Memory = struct { | ... | @@ -1951,7 +1951,7 @@ pub const Memory = struct { |
| 1951 | .off => { | 1951 | .off => { |
| 1952 | assert(mem.info.base == .reg); | 1952 | assert(mem.info.base == .reg); |
| 1953 | return encoder.Instruction.Memory.initMoffs( | 1953 | return encoder.Instruction.Memory.initMoffs( |
| 1954 | @enumFromInt(mem.base), | 1954 | @fromBackingInt(@intCast(mem.base)), |
| 1955 | @as(u64, mem.extra) << 32 | mem.off, | 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,7 +2074,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: u32) struct { data: T, end: |
| 2074 | @field(result, field_name) = switch (field_type) { | 2074 | @field(result, field_name) = switch (field_type) { |
| 2075 | u32 => mir.extra[i], | 2075 | u32 => mir.extra[i], |
| 2076 | i32, Memory.Info => @bitCast(mir.extra[i]), | 2076 | i32, Memory.Info => @bitCast(mir.extra[i]), |
| 2077 | bits.FrameIndex => @enumFromInt(mir.extra[i]), | 2077 | bits.FrameIndex => @fromBackingInt(@intCast(mir.extra[i])), |
| 2078 | else => @compileError("bad field type: " ++ field_name ++ ": " ++ @typeName(field_type)), | 2078 | else => @compileError("bad field type: " ++ field_name ++ ": " ++ @typeName(field_type)), |
| 2079 | }; | 2079 | }; |
| 2080 | i += 1; | 2080 | i += 1; |
| ... | @@ -2091,7 +2091,7 @@ pub const FrameLoc = struct { | ... | @@ -2091,7 +2091,7 @@ pub const FrameLoc = struct { |
| 2091 | }; | 2091 | }; |
| 2092 | 2092 | ||
| 2093 | pub fn resolveFrameAddr(mir: Mir, frame_addr: bits.FrameAddr) bits.RegisterOffset { | 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 | return .{ .reg = frame_loc.base, .off = frame_loc.disp + frame_addr.off }; | 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,7 +2107,7 @@ pub fn resolveMemoryExtra(mir: Mir, payload: u32) Memory { |
| 2107 | .index = mem.info.index, | 2107 | .index = mem.info.index, |
| 2108 | .scale = mem.info.scale, | 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 | .off = @bitCast(mir.frame_locs.items(.disp)[mem.base] + @as(i32, @bitCast(mem.off))), | 2111 | .off = @bitCast(mir.frame_locs.items(.disp)[mem.base] + @as(i32, @bitCast(mem.off))), |
| 2112 | .extra = mem.extra, | 2112 | .extra = mem.extra, |
| 2113 | } else mem, | 2113 | } else mem, |
src/codegen/x86_64/bits.zig+30-30| ... | @@ -241,7 +241,7 @@ pub const SseFloatPredicate = enum(u3) { | ... | @@ -241,7 +241,7 @@ pub const SseFloatPredicate = enum(u3) { |
| 241 | pub const ord_q: SseFloatPredicate = .ord; | 241 | pub const ord_q: SseFloatPredicate = .ord; |
| 242 | 242 | ||
| 243 | pub fn imm(pred: SseFloatPredicate) Immediate { | 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,7 +342,7 @@ pub const VexFloatPredicate = enum(u5) { |
| 342 | pub const @"true": VexFloatPredicate = .true_uq; | 342 | pub const @"true": VexFloatPredicate = .true_uq; |
| 343 | 343 | ||
| 344 | pub fn imm(pred: VexFloatPredicate) Immediate { | 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,7 +407,7 @@ pub const Register = enum(u8) { |
| 407 | }; | 407 | }; |
| 408 | 408 | ||
| 409 | pub fn class(reg: Register) Class { | 409 | pub fn class(reg: Register) Class { |
| 410 | return switch (@intFromEnum(reg)) { | 410 | return switch (@backingInt(reg)) { |
| 411 | // zig fmt: off | 411 | // zig fmt: off |
| 412 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => .general_purpose, | 412 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => .general_purpose, |
| 413 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => .general_purpose, | 413 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => .general_purpose, |
| ... | @@ -442,7 +442,7 @@ pub const Register = enum(u8) { | ... | @@ -442,7 +442,7 @@ pub const Register = enum(u8) { |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | pub fn id(reg: Register) u7 { | 444 | pub fn id(reg: Register) u7 { |
| 445 | const base = switch (@intFromEnum(reg)) { | 445 | const base = switch (@backingInt(reg)) { |
| 446 | // zig fmt: off | 446 | // zig fmt: off |
| 447 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), | 447 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), |
| 448 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), | 448 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), |
| ... | @@ -462,11 +462,11 @@ pub const Register = enum(u8) { | ... | @@ -462,11 +462,11 @@ pub const Register = enum(u8) { |
| 462 | else => unreachable, | 462 | else => unreachable, |
| 463 | // zig fmt: on | 463 | // zig fmt: on |
| 464 | }; | 464 | }; |
| 465 | return @intCast(@intFromEnum(reg) - base); | 465 | return @intCast(@backingInt(reg) - base); |
| 466 | } | 466 | } |
| 467 | 467 | ||
| 468 | pub fn size(reg: Register) Memory.Size { | 468 | pub fn size(reg: Register) Memory.Size { |
| 469 | return switch (@intFromEnum(reg)) { | 469 | return switch (@backingInt(reg)) { |
| 470 | // zig fmt: off | 470 | // zig fmt: off |
| 471 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => .qword, | 471 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => .qword, |
| 472 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => .dword, | 472 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => .dword, |
| ... | @@ -491,7 +491,7 @@ pub const Register = enum(u8) { | ... | @@ -491,7 +491,7 @@ pub const Register = enum(u8) { |
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | pub fn isExtended(reg: Register) bool { | 493 | pub fn isExtended(reg: Register) bool { |
| 494 | return switch (@intFromEnum(reg)) { | 494 | return switch (@backingInt(reg)) { |
| 495 | // zig fmt: off | 495 | // zig fmt: off |
| 496 | @intFromEnum(Register.r8) ... @intFromEnum(Register.r15) => true, | 496 | @intFromEnum(Register.r8) ... @intFromEnum(Register.r15) => true, |
| 497 | @intFromEnum(Register.r8d) ... @intFromEnum(Register.r15d) => true, | 497 | @intFromEnum(Register.r8d) ... @intFromEnum(Register.r15d) => true, |
| ... | @@ -511,7 +511,7 @@ pub const Register = enum(u8) { | ... | @@ -511,7 +511,7 @@ pub const Register = enum(u8) { |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | pub fn enc(reg: Register) u5 { | 513 | pub fn enc(reg: Register) u5 { |
| 514 | const base = switch (@intFromEnum(reg)) { | 514 | const base = switch (@backingInt(reg)) { |
| 515 | // zig fmt: off | 515 | // zig fmt: off |
| 516 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), | 516 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), |
| 517 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), | 517 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), |
| ... | @@ -532,7 +532,7 @@ pub const Register = enum(u8) { | ... | @@ -532,7 +532,7 @@ pub const Register = enum(u8) { |
| 532 | else => unreachable, | 532 | else => unreachable, |
| 533 | // zig fmt: on | 533 | // zig fmt: on |
| 534 | }; | 534 | }; |
| 535 | return @truncate(@intFromEnum(reg) - base); | 535 | return @truncate(@backingInt(reg) - base); |
| 536 | } | 536 | } |
| 537 | 537 | ||
| 538 | pub fn toBitSize(reg: Register, bit_size: u64) Register { | 538 | pub fn toBitSize(reg: Register, bit_size: u64) Register { |
| ... | @@ -572,7 +572,7 @@ pub const Register = enum(u8) { | ... | @@ -572,7 +572,7 @@ pub const Register = enum(u8) { |
| 572 | } | 572 | } |
| 573 | 573 | ||
| 574 | fn gpBase(reg: Register) u7 { | 574 | fn gpBase(reg: Register) u7 { |
| 575 | return switch (@intFromEnum(reg)) { | 575 | return switch (@backingInt(reg)) { |
| 576 | // zig fmt: off | 576 | // zig fmt: off |
| 577 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), | 577 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), |
| 578 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), | 578 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), |
| ... | @@ -586,7 +586,7 @@ pub const Register = enum(u8) { | ... | @@ -586,7 +586,7 @@ pub const Register = enum(u8) { |
| 586 | 586 | ||
| 587 | pub fn to64(reg: Register) Register { | 587 | pub fn to64(reg: Register) Register { |
| 588 | return switch (reg.class()) { | 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 | .segment => unreachable, | 590 | .segment => unreachable, |
| 591 | .x87, .mmx, .cr, .dr => reg, | 591 | .x87, .mmx, .cr, .dr => reg, |
| 592 | .sse => reg.to128(), | 592 | .sse => reg.to128(), |
| ... | @@ -596,7 +596,7 @@ pub const Register = enum(u8) { | ... | @@ -596,7 +596,7 @@ pub const Register = enum(u8) { |
| 596 | 596 | ||
| 597 | pub fn to32(reg: Register) Register { | 597 | pub fn to32(reg: Register) Register { |
| 598 | return switch (reg.class()) { | 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 | .segment => unreachable, | 600 | .segment => unreachable, |
| 601 | .x87, .mmx, .cr, .dr => reg, | 601 | .x87, .mmx, .cr, .dr => reg, |
| 602 | .sse => reg.to128(), | 602 | .sse => reg.to128(), |
| ... | @@ -606,7 +606,7 @@ pub const Register = enum(u8) { | ... | @@ -606,7 +606,7 @@ pub const Register = enum(u8) { |
| 606 | 606 | ||
| 607 | pub fn to16(reg: Register) Register { | 607 | pub fn to16(reg: Register) Register { |
| 608 | return switch (reg.class()) { | 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 | .segment, .x87, .mmx, .cr, .dr => reg, | 610 | .segment, .x87, .mmx, .cr, .dr => reg, |
| 611 | .sse => reg.to128(), | 611 | .sse => reg.to128(), |
| 612 | .ip => .ip, | 612 | .ip => .ip, |
| ... | @@ -623,12 +623,12 @@ pub const Register = enum(u8) { | ... | @@ -623,12 +623,12 @@ pub const Register = enum(u8) { |
| 623 | } | 623 | } |
| 624 | 624 | ||
| 625 | pub fn toLo8(reg: Register) Register { | 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 | pub fn toHi8(reg: Register) Register { | 629 | pub fn toHi8(reg: Register) Register { |
| 630 | assert(reg.isClass(.gphi)); | 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 | pub fn to80(reg: Register) Register { | 634 | pub fn to80(reg: Register) Register { |
| ... | @@ -638,24 +638,24 @@ pub const Register = enum(u8) { | ... | @@ -638,24 +638,24 @@ pub const Register = enum(u8) { |
| 638 | 638 | ||
| 639 | fn sseBase(reg: Register) u8 { | 639 | fn sseBase(reg: Register) u8 { |
| 640 | assert(reg.isClass(.sse)); | 640 | assert(reg.isClass(.sse)); |
| 641 | return switch (@intFromEnum(reg)) { | 641 | return switch (@backingInt(reg)) { |
| 642 | @intFromEnum(Register.zmm0)...@intFromEnum(Register.zmm31) => @intFromEnum(Register.zmm0), | 642 | @backingInt(Register.zmm0)...@backingInt(Register.zmm31) => @backingInt(Register.zmm0), |
| 643 | @intFromEnum(Register.ymm0)...@intFromEnum(Register.ymm31) => @intFromEnum(Register.ymm0), | 643 | @backingInt(Register.ymm0)...@backingInt(Register.ymm31) => @backingInt(Register.ymm0), |
| 644 | @intFromEnum(Register.xmm0)...@intFromEnum(Register.xmm31) => @intFromEnum(Register.xmm0), | 644 | @backingInt(Register.xmm0)...@backingInt(Register.xmm31) => @backingInt(Register.xmm0), |
| 645 | else => unreachable, | 645 | else => unreachable, |
| 646 | }; | 646 | }; |
| 647 | } | 647 | } |
| 648 | 648 | ||
| 649 | pub fn to512(reg: Register) Register { | 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 | pub fn to256(reg: Register) Register { | 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 | pub fn to128(reg: Register) Register { | 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 | /// DWARF register encoding | 661 | /// DWARF register encoding |
| ... | @@ -725,14 +725,14 @@ pub const FrameIndex = enum(u32) { | ... | @@ -725,14 +725,14 @@ pub const FrameIndex = enum(u32) { |
| 725 | pub const named_count = @typeInfo(FrameIndex).@"enum".field_names.len; | 725 | pub const named_count = @typeInfo(FrameIndex).@"enum".field_names.len; |
| 726 | 726 | ||
| 727 | pub fn isNamed(fi: FrameIndex) bool { | 727 | pub fn isNamed(fi: FrameIndex) bool { |
| 728 | return @intFromEnum(fi) < named_count; | 728 | return @backingInt(fi) < named_count; |
| 729 | } | 729 | } |
| 730 | 730 | ||
| 731 | pub fn format(fi: FrameIndex, writer: *std.Io.Writer) std.Io.Writer.Error!void { | 731 | pub fn format(fi: FrameIndex, writer: *std.Io.Writer) std.Io.Writer.Error!void { |
| 732 | if (fi.isNamed()) { | 732 | if (fi.isNamed()) { |
| 733 | try writer.print("FrameIndex.{t}", .{fi}); | 733 | try writer.print("FrameIndex.{t}", .{fi}); |
| 734 | } else { | 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,11 +875,11 @@ pub const Memory = struct { |
| 875 | } | 875 | } |
| 876 | 876 | ||
| 877 | pub fn fromLog2(log2: u2) Scale { | 877 | pub fn fromLog2(log2: u2) Scale { |
| 878 | return @enumFromInt(log2); | 878 | return @fromBackingInt(@intCast(log2)); |
| 879 | } | 879 | } |
| 880 | 880 | ||
| 881 | pub fn toLog2(scale: Scale) u2 { | 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,10 +903,10 @@ pub const Immediate = union(enum) { |
| 903 | pub fn format(imm: Immediate, writer: *std.Io.Writer) std.Io.Writer.Error!void { | 903 | pub fn format(imm: Immediate, writer: *std.Io.Writer) std.Io.Writer.Error!void { |
| 904 | switch (imm) { | 904 | switch (imm) { |
| 905 | inline else => |int| try writer.print("{d}", .{int}), | 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 }), | 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})", .{@intFromEnum(uav.val)}), | 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), @intFromEnum(lazy_sym.ty) }), | 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})", .{@intFromEnum(extern_func)}), | 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,13 +250,13 @@ pub const Instruction = struct { |
| 250 | .frame => |frame_index| try w.print("{f}", .{frame_index}), | 250 | .frame => |frame_index| try w.print("{f}", .{frame_index}), |
| 251 | .table => try w.print("Table", .{}), | 251 | .table => try w.print("Table", .{}), |
| 252 | .rip_inst => |inst_index| try w.print("RipInst({d})", .{inst_index}), | 252 | .rip_inst => |inst_index| try w.print("RipInst({d})", .{inst_index}), |
| 253 | .nav => |nav| try w.print("Nav({d})", .{@intFromEnum(nav)}), | 253 | .nav => |nav| try w.print("Nav({d})", .{@backingInt(nav)}), |
| 254 | .uav => |uav| try w.print("Uav({d})", .{@intFromEnum(uav.val)}), | 254 | .uav => |uav| try w.print("Uav({d})", .{@backingInt(uav.val)}), |
| 255 | .lazy_sym => |lazy_sym| try w.print("LazySym({s}, {d})", .{ | 255 | .lazy_sym => |lazy_sym| try w.print("LazySym({s}, {d})", .{ |
| 256 | @tagName(lazy_sym.kind), | 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 | if (mem.scaleIndex()) |si| { | 261 | if (mem.scaleIndex()) |si| { |
| 262 | if (any) try w.writeAll(" + "); | 262 | if (any) try w.writeAll(" + "); |
| ... | @@ -845,14 +845,14 @@ fn Encoder(comptime opts: Options) type { | ... | @@ -845,14 +845,14 @@ fn Encoder(comptime opts: Options) type { |
| 845 | @as(u8, ~@intFromBool(fields.r)) << 7 | | 845 | @as(u8, ~@intFromBool(fields.r)) << 7 | |
| 846 | @as(u8, ~@intFromBool(fields.x)) << 6 | | 846 | @as(u8, ~@intFromBool(fields.x)) << 6 | |
| 847 | @as(u8, ~@intFromBool(fields.b)) << 5 | | 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 | try self.w.writeByte( | 851 | try self.w.writeByte( |
| 852 | @as(u8, @intFromBool(fields.w)) << 7 | | 852 | @as(u8, @intFromBool(fields.w)) << 7 | |
| 853 | @as(u8, ~@as(u4, @intCast(fields.v.enc()))) << 3 | | 853 | @as(u8, ~@as(u4, @intCast(fields.v.enc()))) << 3 | |
| 854 | @as(u8, @intFromBool(fields.l)) << 2 | | 854 | @as(u8, @intFromBool(fields.l)) << 2 | |
| 855 | @as(u8, @intFromEnum(fields.p)) << 0, | 855 | @as(u8, @backingInt(fields.p)) << 0, |
| 856 | ); | 856 | ); |
| 857 | } else { | 857 | } else { |
| 858 | try self.w.writeByte(0b1100_0101); | 858 | try self.w.writeByte(0b1100_0101); |
| ... | @@ -860,7 +860,7 @@ fn Encoder(comptime opts: Options) type { | ... | @@ -860,7 +860,7 @@ fn Encoder(comptime opts: Options) type { |
| 860 | @as(u8, ~@intFromBool(fields.r)) << 7 | | 860 | @as(u8, ~@intFromBool(fields.r)) << 7 | |
| 861 | @as(u8, ~@as(u4, @intCast(fields.v.enc()))) << 3 | | 861 | @as(u8, ~@as(u4, @intCast(fields.v.enc()))) << 3 | |
| 862 | @as(u8, @intFromBool(fields.l)) << 2 | | 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,11 +63,11 @@ const IfContext = struct { |
| 63 | level: u8, | 63 | level: u8, |
| 64 | 64 | ||
| 65 | fn get(self: *const IfContext) Nesting { | 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 | fn set(self: *IfContext, context: Nesting) void { | 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 | fn increment(self: *IfContext) void { | 73 | fn increment(self: *IfContext) void { |
src/libs/mingw/implib.zig+17-17| ... | @@ -505,7 +505,7 @@ fn getImportDescriptor( | ... | @@ -505,7 +505,7 @@ fn getImportDescriptor( |
| 505 | writeSymbol(&writer, .{ | 505 | writeSymbol(&writer, .{ |
| 506 | .name = first_string_table_entry, | 506 | .name = first_string_table_entry, |
| 507 | .value = 0, | 507 | .value = 0, |
| 508 | .section_number = @enumFromInt(1), | 508 | .section_number = @fromBackingInt(@intCast(1)), |
| 509 | .type = .{ | 509 | .type = .{ |
| 510 | .base_type = .NULL, | 510 | .base_type = .NULL, |
| 511 | .complex_type = .NULL, | 511 | .complex_type = .NULL, |
| ... | @@ -517,7 +517,7 @@ fn getImportDescriptor( | ... | @@ -517,7 +517,7 @@ fn getImportDescriptor( |
| 517 | writeSymbol(&writer, .{ | 517 | writeSymbol(&writer, .{ |
| 518 | .name = ".idata$2".*, | 518 | .name = ".idata$2".*, |
| 519 | .value = 0, | 519 | .value = 0, |
| 520 | .section_number = @enumFromInt(1), | 520 | .section_number = @fromBackingInt(@intCast(1)), |
| 521 | .type = .{ | 521 | .type = .{ |
| 522 | .base_type = .NULL, | 522 | .base_type = .NULL, |
| 523 | .complex_type = .NULL, | 523 | .complex_type = .NULL, |
| ... | @@ -528,7 +528,7 @@ fn getImportDescriptor( | ... | @@ -528,7 +528,7 @@ fn getImportDescriptor( |
| 528 | writeSymbol(&writer, .{ | 528 | writeSymbol(&writer, .{ |
| 529 | .name = ".idata$6".*, | 529 | .name = ".idata$6".*, |
| 530 | .value = 0, | 530 | .value = 0, |
| 531 | .section_number = @enumFromInt(2), | 531 | .section_number = @fromBackingInt(@intCast(2)), |
| 532 | .type = .{ | 532 | .type = .{ |
| 533 | .base_type = .NULL, | 533 | .base_type = .NULL, |
| 534 | .complex_type = .NULL, | 534 | .complex_type = .NULL, |
| ... | @@ -668,7 +668,7 @@ fn getNullImportDescriptor( | ... | @@ -668,7 +668,7 @@ fn getNullImportDescriptor( |
| 668 | writeSymbol(&writer, .{ | 668 | writeSymbol(&writer, .{ |
| 669 | .name = first_string_table_entry, | 669 | .name = first_string_table_entry, |
| 670 | .value = 0, | 670 | .value = 0, |
| 671 | .section_number = @enumFromInt(1), | 671 | .section_number = @fromBackingInt(@intCast(1)), |
| 672 | .type = .{ | 672 | .type = .{ |
| 673 | .base_type = .NULL, | 673 | .base_type = .NULL, |
| 674 | .complex_type = .NULL, | 674 | .complex_type = .NULL, |
| ... | @@ -781,7 +781,7 @@ fn getNullThunk( | ... | @@ -781,7 +781,7 @@ fn getNullThunk( |
| 781 | writeSymbol(&writer, .{ | 781 | writeSymbol(&writer, .{ |
| 782 | .name = first_string_table_entry, | 782 | .name = first_string_table_entry, |
| 783 | .value = 0, | 783 | .value = 0, |
| 784 | .section_number = @enumFromInt(1), | 784 | .section_number = @fromBackingInt(@intCast(1)), |
| 785 | .type = .{ | 785 | .type = .{ |
| 786 | .base_type = .NULL, | 786 | .base_type = .NULL, |
| 787 | .complex_type = .NULL, | 787 | .complex_type = .NULL, |
| ... | @@ -903,7 +903,7 @@ fn getWeakExternal( | ... | @@ -903,7 +903,7 @@ fn getWeakExternal( |
| 903 | writeSymbol(&writer, .{ | 903 | writeSymbol(&writer, .{ |
| 904 | .name = first_string_table_entry, | 904 | .name = first_string_table_entry, |
| 905 | .value = 0, | 905 | .value = 0, |
| 906 | .section_number = @enumFromInt(0), | 906 | .section_number = @fromBackingInt(@intCast(0)), |
| 907 | .type = .{ | 907 | .type = .{ |
| 908 | .base_type = .NULL, | 908 | .base_type = .NULL, |
| 909 | .complex_type = .NULL, | 909 | .complex_type = .NULL, |
| ... | @@ -915,7 +915,7 @@ fn getWeakExternal( | ... | @@ -915,7 +915,7 @@ fn getWeakExternal( |
| 915 | writeSymbol(&writer, .{ | 915 | writeSymbol(&writer, .{ |
| 916 | .name = getNameBytesForStringTableOffset(@intCast(string_table_offset)), | 916 | .name = getNameBytesForStringTableOffset(@intCast(string_table_offset)), |
| 917 | .value = 0, | 917 | .value = 0, |
| 918 | .section_number = @enumFromInt(0), | 918 | .section_number = @fromBackingInt(@intCast(0)), |
| 919 | .type = .{ | 919 | .type = .{ |
| 920 | .base_type = .NULL, | 920 | .base_type = .NULL, |
| 921 | .complex_type = .NULL, | 921 | .complex_type = .NULL, |
| ... | @@ -1012,16 +1012,16 @@ fn getShortImport( | ... | @@ -1012,16 +1012,16 @@ fn getShortImport( |
| 1012 | fn writeSymbol(writer: *std.Io.Writer, symbol: std.coff.Symbol) !void { | 1012 | fn writeSymbol(writer: *std.Io.Writer, symbol: std.coff.Symbol) !void { |
| 1013 | try writer.writeAll(&symbol.name); | 1013 | try writer.writeAll(&symbol.name); |
| 1014 | try writer.writeInt(u32, symbol.value, .little); | 1014 | try writer.writeInt(u32, symbol.value, .little); |
| 1015 | try writer.writeInt(i16, @intFromEnum(symbol.section_number), .little); | 1015 | try writer.writeInt(i16, @backingInt(symbol.section_number), .little); |
| 1016 | try writer.writeInt(u8, @intFromEnum(symbol.type.base_type), .little); | 1016 | try writer.writeInt(u8, @backingInt(symbol.type.base_type), .little); |
| 1017 | try writer.writeInt(u8, @intFromEnum(symbol.type.complex_type), .little); | 1017 | try writer.writeInt(u8, @backingInt(symbol.type.complex_type), .little); |
| 1018 | try writer.writeInt(u8, @intFromEnum(symbol.storage_class), .little); | 1018 | try writer.writeInt(u8, @backingInt(symbol.storage_class), .little); |
| 1019 | try writer.writeInt(u8, symbol.number_of_aux_symbols, .little); | 1019 | try writer.writeInt(u8, symbol.number_of_aux_symbols, .little); |
| 1020 | } | 1020 | } |
| 1021 | 1021 | ||
| 1022 | fn writeWeakExternalDefinition(writer: *std.Io.Writer, weak_external: std.coff.WeakExternalDefinition) !void { | 1022 | fn writeWeakExternalDefinition(writer: *std.Io.Writer, weak_external: std.coff.WeakExternalDefinition) !void { |
| 1023 | try writer.writeInt(u32, weak_external.tag_index, .little); | 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 | try writer.writeAll(&weak_external.unused); | 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,11 +1034,11 @@ fn writeRelocation(writer: *std.Io.Writer, relocation: std.coff.Relocation) !voi |
| 1034 | // https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#type-indicators | 1034 | // https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#type-indicators |
| 1035 | pub fn rvaRelocationTypeIndicator(target: std.coff.IMAGE.FILE.MACHINE) ?u16 { | 1035 | pub fn rvaRelocationTypeIndicator(target: std.coff.IMAGE.FILE.MACHINE) ?u16 { |
| 1036 | return switch (target) { | 1036 | return switch (target) { |
| 1037 | .AMD64 => @intFromEnum(std.coff.IMAGE.REL.AMD64.ADDR32NB), | 1037 | .AMD64 => @backingInt(std.coff.IMAGE.REL.AMD64.ADDR32NB), |
| 1038 | .I386 => @intFromEnum(std.coff.IMAGE.REL.I386.DIR32NB), | 1038 | .I386 => @backingInt(std.coff.IMAGE.REL.I386.DIR32NB), |
| 1039 | .ARMNT => @intFromEnum(std.coff.IMAGE.REL.ARM.ADDR32NB), | 1039 | .ARMNT => @backingInt(std.coff.IMAGE.REL.ARM.ADDR32NB), |
| 1040 | .ARM64, .ARM64EC, .ARM64X => @intFromEnum(std.coff.IMAGE.REL.ARM64.ADDR32NB), | 1040 | .ARM64, .ARM64EC, .ARM64X => @backingInt(std.coff.IMAGE.REL.ARM64.ADDR32NB), |
| 1041 | .IA64 => @intFromEnum(std.coff.IMAGE.REL.IA64.DIR32NB), | 1041 | .IA64 => @backingInt(std.coff.IMAGE.REL.IA64.DIR32NB), |
| 1042 | else => null, | 1042 | else => null, |
| 1043 | }; | 1043 | }; |
| 1044 | } | 1044 | } |
src/link.zig+2-2| ... | @@ -386,7 +386,7 @@ pub const Diags = struct { | ... | @@ -386,7 +386,7 @@ pub const Diags = struct { |
| 386 | }); | 386 | }); |
| 387 | const notes_start = try bundle.reserveNotes(@intCast(link_err.notes.len)); | 387 | const notes_start = try bundle.reserveNotes(@intCast(link_err.notes.len)); |
| 388 | for (link_err.notes, 0..) |note, i| { | 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 | .msg = try note.string(bundle, base), | 390 | .msg = try note.string(bundle, base), |
| 391 | })); | 391 | })); |
| 392 | } | 392 | } |
| ... | @@ -860,7 +860,7 @@ pub const File = struct { | ... | @@ -860,7 +860,7 @@ pub const File = struct { |
| 860 | { | 860 | { |
| 861 | const ti = ti_id.resolveFull(&pt.zcu.intern_pool).?; | 861 | const ti = ti_id.resolveFull(&pt.zcu.intern_pool).?; |
| 862 | const file = pt.zcu.fileByIndex(ti.file); | 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 | assert(inst.tag == .declaration); | 864 | assert(inst.tag == .declaration); |
| 865 | } | 865 | } |
| 866 | 866 |
src/link/C.zig+14-14| ... | @@ -211,7 +211,7 @@ pub fn addConst( | ... | @@ -211,7 +211,7 @@ pub fn addConst( |
| 211 | const zcu = pt.zcu; | 211 | const zcu = pt.zcu; |
| 212 | const gpa = zcu.comp.gpa; | 212 | const gpa = zcu.comp.gpa; |
| 213 | assert(zcu.intern_pool.typeOf(val) == .type_type); | 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 | const ty: Type = .fromInterned(val); | 216 | const ty: Type = .fromInterned(val); |
| 217 | 217 | ||
| ... | @@ -262,7 +262,7 @@ pub fn addConst( | ... | @@ -262,7 +262,7 @@ pub fn addConst( |
| 262 | _ = try codegen.CType.lower(ty, &deps, arena.allocator(), zcu); | 262 | _ = try codegen.CType.lower(ty, &deps, arena.allocator(), zcu); |
| 263 | // This call may add more items to `c.types`. | 263 | // This call may add more items to `c.types`. |
| 264 | const type_deps = try c.addCTypeDependencies(pt, &deps); | 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,7 +279,7 @@ pub fn updateConstIncomplete( |
| 279 | assert(zcu.intern_pool.typeOf(val) == .type_type); | 279 | assert(zcu.intern_pool.typeOf(val) == .type_type); |
| 280 | const ty: Type = .fromInterned(val); | 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 | rendered.errunion_definition = .empty; | 284 | rendered.errunion_definition = .empty; |
| 285 | rendered.definition_deps = .empty; | 285 | rendered.definition_deps = .empty; |
| ... | @@ -315,7 +315,7 @@ pub fn updateConst( | ... | @@ -315,7 +315,7 @@ pub fn updateConst( |
| 315 | assert(zcu.intern_pool.typeOf(val) == .type_type); | 315 | assert(zcu.intern_pool.typeOf(val) == .type_type); |
| 316 | const ty: Type = .fromInterned(val); | 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 | var arena: std.heap.ArenaAllocator = .init(gpa); | 320 | var arena: std.heap.ArenaAllocator = .init(gpa); |
| 321 | defer arena.deinit(); | 321 | defer arena.deinit(); |
| ... | @@ -371,7 +371,7 @@ pub fn updateConst( | ... | @@ -371,7 +371,7 @@ pub fn updateConst( |
| 371 | { | 371 | { |
| 372 | // This call invalidates `rendered`. | 372 | // This call invalidates `rendered`. |
| 373 | const definition_deps = try c.addCTypeDependencies(pt, &deps); | 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,7 +858,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog |
| 858 | while (true) { | 858 | while (true) { |
| 859 | if (index < need_types.count()) { | 859 | if (index < need_types.count()) { |
| 860 | const pool_index = need_types.keys()[index]; | 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 | try mergeNeededCTypes( | 862 | try mergeNeededCTypes( |
| 863 | c, | 863 | c, |
| 864 | &need_types, | 864 | &need_types, |
| ... | @@ -872,7 +872,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog | ... | @@ -872,7 +872,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog |
| 872 | 872 | ||
| 873 | if (errunion_index < need_errunion_types.count()) { | 873 | if (errunion_index < need_errunion_types.count()) { |
| 874 | const payload_pool_index = need_errunion_types.keys()[errunion_index]; | 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 | try mergeNeededCTypes( | 876 | try mergeNeededCTypes( |
| 877 | c, | 877 | c, |
| 878 | &need_types, | 878 | &need_types, |
| ... | @@ -886,7 +886,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog | ... | @@ -886,7 +886,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog |
| 886 | 886 | ||
| 887 | if (aligned_index < need_aligned_types.count()) { | 887 | if (aligned_index < need_aligned_types.count()) { |
| 888 | const pool_index = need_aligned_types.keys()[aligned_index]; | 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 | try mergeNeededCTypes( | 890 | try mergeNeededCTypes( |
| 891 | c, | 891 | c, |
| 892 | &need_types, | 892 | &need_types, |
| ... | @@ -916,7 +916,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog | ... | @@ -916,7 +916,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog |
| 916 | aligned_type_strings, | 916 | aligned_type_strings, |
| 917 | ) |pool_index, align_mask, *str_out| { | 917 | ) |pool_index, align_mask, *str_out| { |
| 918 | const ty: Type = .fromInterned(pool_index.val(&c.type_pool)); | 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 | for (0..@bitSizeOf(@TypeOf(align_mask))) |bit_index| { | 920 | for (0..@bitSizeOf(@TypeOf(align_mask))) |bit_index| { |
| 921 | switch (@as(u1, @truncate(align_mask >> @intCast(bit_index)))) { | 921 | switch (@as(u1, @truncate(align_mask >> @intCast(bit_index)))) { |
| 922 | 0 => continue, | 922 | 0 => continue, |
| ... | @@ -1450,7 +1450,7 @@ const FlushTypes = struct { | ... | @@ -1450,7 +1450,7 @@ const FlushTypes = struct { |
| 1450 | const c = ft.c; | 1450 | const c = ft.c; |
| 1451 | if (ft.aligned_status.contains(pool_index)) return; | 1451 | if (ft.aligned_status.contains(pool_index)) return; |
| 1452 | if (ft.aligned_types.getIndex(pool_index)) |i| { | 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 | ft.processDepsAsFwd(&rendered.deps); | 1454 | ft.processDepsAsFwd(&rendered.deps); |
| 1455 | ft.f.appendBufAssumeCapacity(ft.aligned_type_strings[i]); | 1455 | ft.f.appendBufAssumeCapacity(ft.aligned_type_strings[i]); |
| 1456 | } | 1456 | } |
| ... | @@ -1459,7 +1459,7 @@ const FlushTypes = struct { | ... | @@ -1459,7 +1459,7 @@ const FlushTypes = struct { |
| 1459 | fn doTypeFwd(ft: *FlushTypes, pool_index: link.ConstPool.Index) void { | 1459 | fn doTypeFwd(ft: *FlushTypes, pool_index: link.ConstPool.Index) void { |
| 1460 | const c = ft.c; | 1460 | const c = ft.c; |
| 1461 | if (ft.status.contains(pool_index)) return; | 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 | if (rendered.fwd_decl.len > 0) { | 1463 | if (rendered.fwd_decl.len > 0) { |
| 1464 | ft.f.appendBufAssumeCapacity(rendered.fwd_decl.get(c)); | 1464 | ft.f.appendBufAssumeCapacity(rendered.fwd_decl.get(c)); |
| 1465 | ft.status.putAssumeCapacityNoClobber(pool_index, false); | 1465 | ft.status.putAssumeCapacityNoClobber(pool_index, false); |
| ... | @@ -1477,7 +1477,7 @@ const FlushTypes = struct { | ... | @@ -1477,7 +1477,7 @@ const FlushTypes = struct { |
| 1477 | if (ft.status.get(pool_index)) |completed| { | 1477 | if (ft.status.get(pool_index)) |completed| { |
| 1478 | if (completed) return; | 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 | ft.processDeps(&rendered.definition_deps); | 1481 | ft.processDeps(&rendered.definition_deps); |
| 1482 | if (rendered.fwd_decl.len == 0 and ft.status.contains(pool_index)) { | 1482 | if (rendered.fwd_decl.len == 0 and ft.status.contains(pool_index)) { |
| 1483 | // `doTypeFwd` already rendered the defintion, we just had to complete the type by | 1483 | // `doTypeFwd` already rendered the defintion, we just had to complete the type by |
| ... | @@ -1495,7 +1495,7 @@ const FlushTypes = struct { | ... | @@ -1495,7 +1495,7 @@ const FlushTypes = struct { |
| 1495 | const c = ft.c; | 1495 | const c = ft.c; |
| 1496 | const gop = ft.errunion_status.getOrPutAssumeCapacity(pool_index); | 1496 | const gop = ft.errunion_status.getOrPutAssumeCapacity(pool_index); |
| 1497 | if (gop.found_existing) return; | 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 | ft.f.appendBufAssumeCapacity(rendered.errunion_fwd_decl.get(c)); | 1499 | ft.f.appendBufAssumeCapacity(rendered.errunion_fwd_decl.get(c)); |
| 1500 | gop.value_ptr.* = false; | 1500 | gop.value_ptr.* = false; |
| 1501 | } | 1501 | } |
| ... | @@ -1504,7 +1504,7 @@ const FlushTypes = struct { | ... | @@ -1504,7 +1504,7 @@ const FlushTypes = struct { |
| 1504 | if (ft.errunion_status.get(pool_index)) |completed| { | 1504 | if (ft.errunion_status.get(pool_index)) |completed| { |
| 1505 | if (completed) return; | 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 | ft.processDeps(&rendered.deps); | 1508 | ft.processDeps(&rendered.deps); |
| 1509 | if (rendered.errunion_definition.len > 0) { | 1509 | if (rendered.errunion_definition.len > 0) { |
| 1510 | ft.f.appendBufAssumeCapacity(rendered.errunion_definition.get(c)); | 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,11 +234,11 @@ pub const Node = union(enum) { |
| 234 | _, | 234 | _, |
| 235 | 235 | ||
| 236 | pub fn name(psmi: PseudoSectionMapIndex, coff: *const Coff) String { | 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 | pub fn symbol(psmi: PseudoSectionMapIndex, coff: *const Coff) Symbol.Index { | 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,11 +246,11 @@ pub const Node = union(enum) { |
| 246 | _, | 246 | _, |
| 247 | 247 | ||
| 248 | pub fn name(osmi: ObjectSectionMapIndex, coff: *const Coff) String { | 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 | pub fn symbol(osmi: ObjectSectionMapIndex, coff: *const Coff) Symbol.Index { | 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,13 +259,13 @@ pub const Node = union(enum) { |
| 259 | _, | 259 | _, |
| 260 | 260 | ||
| 261 | pub fn wrap(i: ?u32) GlobalMapIndex { | 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 | pub fn unwrap(gmi: GlobalMapIndex) ?u32 { | 265 | pub fn unwrap(gmi: GlobalMapIndex) ?u32 { |
| 266 | return switch (gmi) { | 266 | return switch (gmi) { |
| 267 | .none => null, | 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,11 +286,11 @@ pub const Node = union(enum) { |
| 286 | _, | 286 | _, |
| 287 | 287 | ||
| 288 | pub fn navIndex(nmi: NavMapIndex, coff: *const Coff) InternPool.Nav.Index { | 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 | pub fn symbol(nmi: NavMapIndex, coff: *const Coff) Symbol.Index { | 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,11 +298,11 @@ pub const Node = union(enum) { |
| 298 | _, | 298 | _, |
| 299 | 299 | ||
| 300 | pub fn uavValue(umi: UavMapIndex, coff: *const Coff) InternPool.Index { | 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 | pub fn symbol(umi: UavMapIndex, coff: *const Coff) Symbol.Index { | 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,23 +318,23 @@ pub const Node = union(enum) { |
| 318 | _, | 318 | _, |
| 319 | 319 | ||
| 320 | pub fn inputSection(isi: Index, coff: *const Coff) *InputSection { | 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 | pub fn input(isi: Index, coff: *const Coff) InputObject.Index { | 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 | pub fn fileLocation(isi: Index, coff: *const Coff) MappedFile.Node.FileLocation { | 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 | pub fn symbol(isi: Index, coff: *const Coff) Symbol.Index { | 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 | pub fn firstSymbol(isi: Index, coff: *const Coff) LocalIndex { | 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,7 +342,7 @@ pub const Node = union(enum) { |
| 342 | _, | 342 | _, |
| 343 | 343 | ||
| 344 | pub fn name(isli: LocalIndex, coff: *const Coff) String { | 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,7 +356,7 @@ pub const Node = union(enum) { |
| 356 | _, | 356 | _, |
| 357 | 357 | ||
| 358 | pub fn ref(lmi: @This()) LazyMapRef { | 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 | pub fn lazySymbol(lmi: @This(), coff: *const Coff) link.File.LazySymbol { | 362 | pub fn lazySymbol(lmi: @This(), coff: *const Coff) link.File.LazySymbol { |
| ... | @@ -402,7 +402,7 @@ pub const Node = union(enum) { | ... | @@ -402,7 +402,7 @@ pub const Node = union(enum) { |
| 402 | var mut_known: std.enums.EnumFieldStruct(Known, MappedFile.Node.Index, null) = undefined; | 402 | var mut_known: std.enums.EnumFieldStruct(Known, MappedFile.Node.Index, null) = undefined; |
| 403 | const info = @typeInfo(Known).@"enum"; | 403 | const info = @typeInfo(Known).@"enum"; |
| 404 | for (info.field_names, info.field_values) |field_name, field_value| | 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 | break :known mut_known; | 406 | break :known mut_known; |
| 407 | }; | 407 | }; |
| 408 | 408 | ||
| ... | @@ -418,7 +418,7 @@ pub const InputArchive = struct { | ... | @@ -418,7 +418,7 @@ pub const InputArchive = struct { |
| 418 | _, | 418 | _, |
| 419 | 419 | ||
| 420 | pub fn path(iai: InputArchive.Index, coff: *Coff) std.Build.Cache.Path { | 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,7 +446,7 @@ pub const InputArchive = struct { |
| 446 | _, | 446 | _, |
| 447 | 447 | ||
| 448 | pub fn member(iami: InputArchive.Member.Index, coff: *Coff) *InputArchive.Member { | 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,11 +476,11 @@ pub const InputObject = struct { |
| 476 | _, | 476 | _, |
| 477 | 477 | ||
| 478 | pub fn path(ioi: Index, coff: *const Coff) std.Build.Cache.Path { | 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 | pub fn memberName(ioi: Index, coff: *const Coff) ?[]const u8 { | 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,7 +503,7 @@ pub const Member = struct { |
| 503 | const known_count = @typeInfo(Index).@"enum".field_names.len; | 503 | const known_count = @typeInfo(Index).@"enum".field_names.len; |
| 504 | 504 | ||
| 505 | pub fn get(member_index: Member.Index, coff: *Coff) *Member { | 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,7 +657,7 @@ pub const SymbolTable = struct { |
| 657 | }, | 657 | }, |
| 658 | .long => |l| { | 658 | .long => |l| { |
| 659 | @memset(field[0..4], 0); | 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,13 +671,13 @@ pub const SymbolTable = struct { |
| 671 | _, | 671 | _, |
| 672 | 672 | ||
| 673 | pub fn wrap(i: u32) Index { | 673 | pub fn wrap(i: u32) Index { |
| 674 | return @enumFromInt(i + 1); | 674 | return @fromBackingInt(@intCast(i + 1)); |
| 675 | } | 675 | } |
| 676 | 676 | ||
| 677 | pub fn unwrap(sti: Index) ?u32 { | 677 | pub fn unwrap(sti: Index) ?u32 { |
| 678 | return switch (sti) { | 678 | return switch (sti) { |
| 679 | .none => null, | 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,7 +720,7 @@ pub const ExportTable = struct { |
| 720 | _, | 720 | _, |
| 721 | 721 | ||
| 722 | pub fn get(export_index: ExportTable.Ordinal, coff: *Coff) *Entry { | 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,7 +768,7 @@ pub const ImportTable = struct { |
| 768 | _, | 768 | _, |
| 769 | 769 | ||
| 770 | pub fn get(import_index: ImportTable.Index, coff: *Coff) *Entry { | 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,26 +791,26 @@ pub const String = enum(u32) { |
| 791 | _, | 791 | _, |
| 792 | 792 | ||
| 793 | pub const Optional = enum(u32) { | 793 | pub const Optional = enum(u32) { |
| 794 | @".data" = @intFromEnum(String.@".data"), | 794 | @".data" = @backingInt(String.@".data"), |
| 795 | @".idata" = @intFromEnum(String.@".idata"), | 795 | @".idata" = @backingInt(String.@".idata"), |
| 796 | @".rdata" = @intFromEnum(String.@".rdata"), | 796 | @".rdata" = @backingInt(String.@".rdata"), |
| 797 | @".text" = @intFromEnum(String.@".text"), | 797 | @".text" = @backingInt(String.@".text"), |
| 798 | @".tls$" = @intFromEnum(String.@".tls$"), | 798 | @".tls$" = @backingInt(String.@".tls$"), |
| 799 | @".edata" = @intFromEnum(String.@".edata"), | 799 | @".edata" = @backingInt(String.@".edata"), |
| 800 | @".ctors" = @intFromEnum(String.@".ctors"), | 800 | @".ctors" = @backingInt(String.@".ctors"), |
| 801 | @".ctors$ZZZ" = @intFromEnum(String.@".ctors$ZZZ"), | 801 | @".ctors$ZZZ" = @backingInt(String.@".ctors$ZZZ"), |
| 802 | @".dtors" = @intFromEnum(String.@".dtors"), | 802 | @".dtors" = @backingInt(String.@".dtors"), |
| 803 | @".dtors$ZZZ" = @intFromEnum(String.@".dtors$ZZZ"), | 803 | @".dtors$ZZZ" = @backingInt(String.@".dtors$ZZZ"), |
| 804 | @".bss" = @intFromEnum(String.@".bss"), | 804 | @".bss" = @backingInt(String.@".bss"), |
| 805 | @".fptable" = @intFromEnum(String.@".fptable"), | 805 | @".fptable" = @backingInt(String.@".fptable"), |
| 806 | @".tls" = @intFromEnum(String.@".tls"), | 806 | @".tls" = @backingInt(String.@".tls"), |
| 807 | @".thunks" = @intFromEnum(String.@".thunks"), | 807 | @".thunks" = @backingInt(String.@".thunks"), |
| 808 | none = std.math.maxInt(u32), | 808 | none = std.math.maxInt(u32), |
| 809 | _, | 809 | _, |
| 810 | 810 | ||
| 811 | pub fn unwrap(os: String.Optional) ?String { | 811 | pub fn unwrap(os: String.Optional) ?String { |
| 812 | return switch (os) { | 812 | return switch (os) { |
| 813 | else => |s| @enumFromInt(@intFromEnum(s)), | 813 | else => |s| @fromBackingInt(@intCast(@backingInt(s))), |
| 814 | .none => null, | 814 | .none => null, |
| 815 | }; | 815 | }; |
| 816 | } | 816 | } |
| ... | @@ -821,12 +821,12 @@ pub const String = enum(u32) { | ... | @@ -821,12 +821,12 @@ pub const String = enum(u32) { |
| 821 | }; | 821 | }; |
| 822 | 822 | ||
| 823 | pub fn toSlice(s: String, coff: *Coff) [:0]const u8 { | 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 | return slice[0..std.mem.indexOfScalar(u8, slice, 0).? :0]; | 825 | return slice[0..std.mem.indexOfScalar(u8, slice, 0).? :0]; |
| 826 | } | 826 | } |
| 827 | 827 | ||
| 828 | pub fn toOptional(s: String) String.Optional { | 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,13 +839,13 @@ pub const Section = struct { |
| 839 | _, | 839 | _, |
| 840 | 840 | ||
| 841 | pub fn wrap(i: ?u16) RelocationIndex { | 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 | pub fn unwrap(sri: RelocationIndex) ?u16 { | 845 | pub fn unwrap(sri: RelocationIndex) ?u16 { |
| 846 | return switch (sri) { | 846 | return switch (sri) { |
| 847 | .none => null, | 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,11 +1008,11 @@ pub const Symbol = struct { |
| 1008 | _, | 1008 | _, |
| 1009 | 1009 | ||
| 1010 | fn toIndex(sn: SectionNumber) u15 { | 1010 | fn toIndex(sn: SectionNumber) u15 { |
| 1011 | return @intCast(@intFromEnum(sn) - 1); | 1011 | return @intCast(@backingInt(sn) - 1); |
| 1012 | } | 1012 | } |
| 1013 | 1013 | ||
| 1014 | fn hasIndex(sn: SectionNumber) bool { | 1014 | fn hasIndex(sn: SectionNumber) bool { |
| 1015 | return @intFromEnum(sn) > 0; | 1015 | return @backingInt(sn) > 0; |
| 1016 | } | 1016 | } |
| 1017 | 1017 | ||
| 1018 | pub fn symbol(sn: SectionNumber, coff: *const Coff) Symbol.Index { | 1018 | pub fn symbol(sn: SectionNumber, coff: *const Coff) Symbol.Index { |
| ... | @@ -1043,7 +1043,7 @@ pub const Symbol = struct { | ... | @@ -1043,7 +1043,7 @@ pub const Symbol = struct { |
| 1043 | const known_count = @typeInfo(Index).@"enum".field_names.len; | 1043 | const known_count = @typeInfo(Index).@"enum".field_names.len; |
| 1044 | 1044 | ||
| 1045 | pub fn get(si: Symbol.Index, coff: *Coff) *Symbol { | 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 | pub fn unwrap(si: Symbol.Index) ?Symbol.Index { | 1049 | pub fn unwrap(si: Symbol.Index) ?Symbol.Index { |
| ... | @@ -1063,7 +1063,7 @@ pub const Symbol = struct { | ... | @@ -1063,7 +1063,7 @@ pub const Symbol = struct { |
| 1063 | } | 1063 | } |
| 1064 | 1064 | ||
| 1065 | pub fn next(si: Symbol.Index) Symbol.Index { | 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 | pub fn knownString(si: Symbol.Index) String.Optional { | 1069 | pub fn knownString(si: Symbol.Index) String.Optional { |
| ... | @@ -1107,7 +1107,7 @@ pub const Symbol = struct { | ... | @@ -1107,7 +1107,7 @@ pub const Symbol = struct { |
| 1107 | switch (sym.loc_relocs) { | 1107 | switch (sym.loc_relocs) { |
| 1108 | .none => {}, | 1108 | .none => {}, |
| 1109 | else => |loc_relocs| { | 1109 | else => |loc_relocs| { |
| 1110 | for (coff.relocs.items[@intFromEnum(loc_relocs)..]) |*reloc| { | 1110 | for (coff.relocs.items[@backingInt(loc_relocs)..]) |*reloc| { |
| 1111 | if (reloc.loc != si) break; | 1111 | if (reloc.loc != si) break; |
| 1112 | if (reloc.sri.entry(coff, sym.section_number)) |entry| coff.targetStore( | 1112 | if (reloc.sri.entry(coff, sym.section_number)) |entry| coff.targetStore( |
| 1113 | &entry.virtual_address, | 1113 | &entry.virtual_address, |
| ... | @@ -1136,7 +1136,7 @@ pub const Symbol = struct { | ... | @@ -1136,7 +1136,7 @@ pub const Symbol = struct { |
| 1136 | switch (sym.loc_relocs) { | 1136 | switch (sym.loc_relocs) { |
| 1137 | .none => {}, | 1137 | .none => {}, |
| 1138 | else => |loc_relocs| { | 1138 | else => |loc_relocs| { |
| 1139 | for (coff.relocs.items[@intFromEnum(loc_relocs)..]) |*reloc| { | 1139 | for (coff.relocs.items[@backingInt(loc_relocs)..]) |*reloc| { |
| 1140 | if (reloc.loc != si) break; | 1140 | if (reloc.loc != si) break; |
| 1141 | reloc.delete(coff); | 1141 | reloc.delete(coff); |
| 1142 | } | 1142 | } |
| ... | @@ -1189,11 +1189,11 @@ pub const Reloc = extern struct { | ... | @@ -1189,11 +1189,11 @@ pub const Reloc = extern struct { |
| 1189 | _, | 1189 | _, |
| 1190 | 1190 | ||
| 1191 | pub fn wrap(i: ?u32) Reloc.Index { | 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 | pub fn get(ri: Reloc.Index, coff: *Coff) *Reloc { | 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,13 +1574,13 @@ fn create( |
| 1574 | else => return error.UnsupportedCOFFArchitecture, | 1574 | else => return error.UnsupportedCOFFArchitecture, |
| 1575 | }; | 1575 | }; |
| 1576 | const section_align: std.mem.Alignment = switch (machine) { | 1576 | const section_align: std.mem.Alignment = switch (machine) { |
| 1577 | .AMD64, .I386 => @enumFromInt(12), | 1577 | .AMD64, .I386 => @fromBackingInt(@intCast(12)), |
| 1578 | .SH3, .SH3DSP, .SH4, .SH5 => @enumFromInt(12), | 1578 | .SH3, .SH3DSP, .SH4, .SH5 => @fromBackingInt(@intCast(12)), |
| 1579 | .MIPS16, .MIPSFPU, .MIPSFPU16, .WCEMIPSV2 => @enumFromInt(12), | 1579 | .MIPS16, .MIPSFPU, .MIPSFPU16, .WCEMIPSV2 => @fromBackingInt(@intCast(12)), |
| 1580 | .POWERPC, .POWERPCFP => @enumFromInt(12), | 1580 | .POWERPC, .POWERPCFP => @fromBackingInt(@intCast(12)), |
| 1581 | .ALPHA, .ALPHA64 => @enumFromInt(13), | 1581 | .ALPHA, .ALPHA64 => @fromBackingInt(@intCast(13)), |
| 1582 | .IA64 => @enumFromInt(13), | 1582 | .IA64 => @fromBackingInt(@intCast(13)), |
| 1583 | .ARM => @enumFromInt(12), | 1583 | .ARM => @fromBackingInt(@intCast(12)), |
| 1584 | else => return error.UnsupportedCOFFArchitecture, | 1584 | else => return error.UnsupportedCOFFArchitecture, |
| 1585 | }; | 1585 | }; |
| 1586 | 1586 | ||
| ... | @@ -2193,7 +2193,7 @@ fn initHeaders( | ... | @@ -2193,7 +2193,7 @@ fn initHeaders( |
| 2193 | const export_address_table_sym = coff.export_table.export_address_table_si.get(coff); | 2193 | const export_address_table_sym = coff.export_table.export_address_table_si.get(coff); |
| 2194 | export_address_table_sym.ni = export_address_table_ni; | 2194 | export_address_table_sym.ni = export_address_table_ni; |
| 2195 | assert(export_address_table_sym.loc_relocs == .none); | 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 | export_address_table_sym.section_number = | 2197 | export_address_table_sym.section_number = |
| 2198 | coff.getNode(coff.export_table.ni).pseudo_section.symbol(coff).get(coff).section_number; | 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,7 +2383,7 @@ pub fn endProgress(coff: *Coff) void { |
| 2383 | } | 2383 | } |
| 2384 | 2384 | ||
| 2385 | fn getNode(coff: *const Coff, ni: MappedFile.Node.Index) Node { | 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 | fn computeNodeRva(coff: *Coff, ni: MappedFile.Node.Index) u32 { | 2388 | fn computeNodeRva(coff: *Coff, ni: MappedFile.Node.Index) u32 { |
| 2389 | const parent_rva = parent_rva: { | 2389 | const parent_rva = parent_rva: { |
| ... | @@ -2499,7 +2499,7 @@ fn targetLoad(coff: *const Coff, ptr: anytype) @typeInfo(@TypeOf(ptr)).pointer.c | ... | @@ -2499,7 +2499,7 @@ fn targetLoad(coff: *const Coff, ptr: anytype) @typeInfo(@TypeOf(ptr)).pointer.c |
| 2499 | return switch (@typeInfo(Child)) { | 2499 | return switch (@typeInfo(Child)) { |
| 2500 | else => @compileError(@typeName(Child)), | 2500 | else => @compileError(@typeName(Child)), |
| 2501 | .int => std.mem.toNative(Child, ptr.*, coff.targetEndian()), | 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 | .@"struct" => |@"struct"| @bitCast( | 2503 | .@"struct" => |@"struct"| @bitCast( |
| 2504 | coff.targetLoad(@as(*@"struct".backing_integer.?, @ptrCast(ptr))), | 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,7 +2512,7 @@ fn targetStore(coff: *const Coff, ptr: anytype, val: @typeInfo(@TypeOf(ptr)).poi |
| 2512 | .int => ptr.* = std.mem.nativeTo(Child, val, coff.targetEndian()), | 2512 | .int => ptr.* = std.mem.nativeTo(Child, val, coff.targetEndian()), |
| 2513 | .@"enum" => |@"enum"| coff.targetStore( | 2513 | .@"enum" => |@"enum"| coff.targetStore( |
| 2514 | @as(*@"enum".tag_type, @ptrCast(ptr)), | 2514 | @as(*@"enum".tag_type, @ptrCast(ptr)), |
| 2515 | @intFromEnum(val), | 2515 | @backingInt(val), |
| 2516 | ), | 2516 | ), |
| 2517 | .@"struct" => |@"struct"| coff.targetStore( | 2517 | .@"struct" => |@"struct"| coff.targetStore( |
| 2518 | @as(*@"struct".backing_integer.?, @ptrCast(ptr)), | 2518 | @as(*@"struct".backing_integer.?, @ptrCast(ptr)), |
| ... | @@ -2613,7 +2613,7 @@ pub fn dataDirectoryPtr( | ... | @@ -2613,7 +2613,7 @@ pub fn dataDirectoryPtr( |
| 2613 | coff: *Coff, | 2613 | coff: *Coff, |
| 2614 | entry: std.coff.IMAGE.DIRECTORY_ENTRY, | 2614 | entry: std.coff.IMAGE.DIRECTORY_ENTRY, |
| 2615 | ) *std.coff.ImageDataDirectory { | 2615 | ) *std.coff.ImageDataDirectory { |
| 2616 | return &coff.dataDirectorySlice()[@intFromEnum(entry)]; | 2616 | return &coff.dataDirectorySlice()[@backingInt(entry)]; |
| 2617 | } | 2617 | } |
| 2618 | 2618 | ||
| 2619 | pub fn sectionTableSlice(coff: *Coff) []std.coff.SectionHeader { | 2619 | pub fn sectionTableSlice(coff: *Coff) []std.coff.SectionHeader { |
| ... | @@ -2665,7 +2665,7 @@ pub fn importDirectoryEntryPtr( | ... | @@ -2665,7 +2665,7 @@ pub fn importDirectoryEntryPtr( |
| 2665 | coff: *Coff, | 2665 | coff: *Coff, |
| 2666 | import_index: ImportTable.Index, | 2666 | import_index: ImportTable.Index, |
| 2667 | ) *std.coff.ImportDirectoryEntry { | 2667 | ) *std.coff.ImportDirectoryEntry { |
| 2668 | return &coff.importDirectoryTableSlice()[@intFromEnum(import_index)]; | 2668 | return &coff.importDirectoryTableSlice()[@backingInt(import_index)]; |
| 2669 | } | 2669 | } |
| 2670 | 2670 | ||
| 2671 | pub fn exportDirectoryTable(coff: *Coff) *std.coff.ExportDirectoryTable { | 2671 | pub fn exportDirectoryTable(coff: *Coff) *std.coff.ExportDirectoryTable { |
| ... | @@ -2701,7 +2701,7 @@ fn addSymbolAssumeCapacity(coff: *Coff) Symbol.Index { | ... | @@ -2701,7 +2701,7 @@ fn addSymbolAssumeCapacity(coff: *Coff) Symbol.Index { |
| 2701 | .section_number = .UNDEFINED, | 2701 | .section_number = .UNDEFINED, |
| 2702 | .gmi = .none, | 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 | fn initSymbolAssumeCapacity(coff: *Coff) !Symbol.Index { | 2707 | fn initSymbolAssumeCapacity(coff: *Coff) !Symbol.Index { |
| ... | @@ -2721,7 +2721,7 @@ fn getString(coff: *Coff, string: []const u8) String.Optional { | ... | @@ -2721,7 +2721,7 @@ fn getString(coff: *Coff, string: []const u8) String.Optional { |
| 2721 | string, | 2721 | string, |
| 2722 | std.hash_map.StringIndexAdapter{ .bytes = &coff.string_bytes }, | 2722 | std.hash_map.StringIndexAdapter{ .bytes = &coff.string_bytes }, |
| 2723 | )) |key| | 2723 | )) |key| |
| 2724 | return @as(String, @enumFromInt(key)).toOptional() | 2724 | return @as(String, @fromBackingInt(@intCast(key))).toOptional() |
| 2725 | else | 2725 | else |
| 2726 | return .none; | 2726 | return .none; |
| 2727 | } | 2727 | } |
| ... | @@ -2739,7 +2739,7 @@ fn getOrPutSymbolName(coff: *Coff, name: []const u8, opt_string: ?String) !Symbo | ... | @@ -2739,7 +2739,7 @@ fn getOrPutSymbolName(coff: *Coff, name: []const u8, opt_string: ?String) !Symbo |
| 2739 | const string_gop = try coff.symbol_table.strings.getOrPut(gpa, string); | 2739 | const string_gop = try coff.symbol_table.strings.getOrPut(gpa, string); |
| 2740 | if (!string_gop.found_existing) { | 2740 | if (!string_gop.found_existing) { |
| 2741 | const string_index = coff.symbol_table.strings_ni.location(&coff.mf).resolve(&coff.mf)[1]; | 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 | try coff.symbol_table.strings_ni.resize(&coff.mf, gpa, string_index + name.len + 1); | 2744 | try coff.symbol_table.strings_ni.resize(&coff.mf, gpa, string_index + name.len + 1); |
| 2745 | const slice = coff.symbol_table.strings_ni.slice(&coff.mf); | 2745 | const slice = coff.symbol_table.strings_ni.slice(&coff.mf); |
| ... | @@ -2776,7 +2776,7 @@ fn getOrPutStringAssumeCapacity(coff: *Coff, string: []const u8) String { | ... | @@ -2776,7 +2776,7 @@ fn getOrPutStringAssumeCapacity(coff: *Coff, string: []const u8) String { |
| 2776 | coff.string_bytes.appendSliceAssumeCapacity(string); | 2776 | coff.string_bytes.appendSliceAssumeCapacity(string); |
| 2777 | coff.string_bytes.appendAssumeCapacity(0); | 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 | const GlobalOptions = struct { | 2782 | const GlobalOptions = struct { |
| ... | @@ -2887,7 +2887,7 @@ fn navMapIndex(coff: *Coff, zcu: *Zcu, nav_index: InternPool.Nav.Index) !Node.Na | ... | @@ -2887,7 +2887,7 @@ fn navMapIndex(coff: *Coff, zcu: *Zcu, nav_index: InternPool.Nav.Index) !Node.Na |
| 2887 | try coff.symbols.ensureUnusedCapacity(gpa, 1); | 2887 | try coff.symbols.ensureUnusedCapacity(gpa, 1); |
| 2888 | const sym_gop = try coff.navs.getOrPut(gpa, nav_index); | 2888 | const sym_gop = try coff.navs.getOrPut(gpa, nav_index); |
| 2889 | if (!sym_gop.found_existing) sym_gop.value_ptr.* = coff.addSymbolAssumeCapacity(); | 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 | pub fn navSymbol(coff: *Coff, zcu: *Zcu, nav_index: InternPool.Nav.Index) !Symbol.Index { | 2892 | pub fn navSymbol(coff: *Coff, zcu: *Zcu, nav_index: InternPool.Nav.Index) !Symbol.Index { |
| 2893 | const ip = &zcu.intern_pool; | 2893 | const ip = &zcu.intern_pool; |
| ... | @@ -2908,7 +2908,7 @@ fn uavMapIndex(coff: *Coff, uav_val: InternPool.Index) !Node.UavMapIndex { | ... | @@ -2908,7 +2908,7 @@ fn uavMapIndex(coff: *Coff, uav_val: InternPool.Index) !Node.UavMapIndex { |
| 2908 | try coff.symbols.ensureUnusedCapacity(gpa, 1); | 2908 | try coff.symbols.ensureUnusedCapacity(gpa, 1); |
| 2909 | const sym_gop = try coff.uavs.getOrPut(gpa, uav_val); | 2909 | const sym_gop = try coff.uavs.getOrPut(gpa, uav_val); |
| 2910 | if (!sym_gop.found_existing) sym_gop.value_ptr.* = coff.addSymbolAssumeCapacity(); | 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 | pub fn uavSymbol(coff: *Coff, uav_val: InternPool.Index) !Symbol.Index { | 2913 | pub fn uavSymbol(coff: *Coff, uav_val: InternPool.Index) !Symbol.Index { |
| 2914 | const umi = try coff.uavMapIndex(uav_val); | 2914 | const umi = try coff.uavMapIndex(uav_val); |
| ... | @@ -2945,7 +2945,7 @@ pub fn getUavVAddr( | ... | @@ -2945,7 +2945,7 @@ pub fn getUavVAddr( |
| 2945 | 2945 | ||
| 2946 | pub fn getVAddr(coff: *Coff, reloc_info: link.File.RelocInfo, target_si: Symbol.Index) link.Error!u64 { | 2946 | pub fn getVAddr(coff: *Coff, reloc_info: link.File.RelocInfo, target_si: Symbol.Index) link.Error!u64 { |
| 2947 | try coff.addReloc( | 2947 | try coff.addReloc( |
| 2948 | @enumFromInt(@intFromEnum(reloc_info.parent.atom_index)), | 2948 | @fromBackingInt(@intCast(@backingInt(reloc_info.parent.atom_index))), |
| 2949 | reloc_info.offset, | 2949 | reloc_info.offset, |
| 2950 | target_si, | 2950 | target_si, |
| 2951 | .{ .known = reloc_info.addend }, | 2951 | .{ .known = reloc_info.addend }, |
| ... | @@ -2986,7 +2986,7 @@ fn addMemberAssumeCapacity(coff: *Coff, kind: std.coff.ArchiveMemberHeader.Kind, | ... | @@ -2986,7 +2986,7 @@ fn addMemberAssumeCapacity(coff: *Coff, kind: std.coff.ArchiveMemberHeader.Kind, |
| 2986 | .fixed = true, | 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 | coff.members.appendAssumeCapacity(.{ | 2990 | coff.members.appendAssumeCapacity(.{ |
| 2991 | .kind = kind, | 2991 | .kind = kind, |
| 2992 | .header_ni = header_ni, | 2992 | .header_ni = header_ni, |
| ... | @@ -3065,7 +3065,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { | ... | @@ -3065,7 +3065,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { |
| 3065 | const num_symbols_ptr = coff.firstLinkerMemberNumSymbolsPtr(); | 3065 | const num_symbols_ptr = coff.firstLinkerMemberNumSymbolsPtr(); |
| 3066 | const num_symbols = std.mem.toNative(u32, num_symbols_ptr.*, .big); | 3066 | const num_symbols = std.mem.toNative(u32, num_symbols_ptr.*, .big); |
| 3067 | num_symbols_ptr.* = std.mem.nativeTo(u32, num_symbols + 1, .big); | 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 | gop.value_ptr.* = mfli; | 3071 | gop.value_ptr.* = mfli; |
| ... | @@ -3078,7 +3078,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { | ... | @@ -3078,7 +3078,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { |
| 3078 | defer coff.lib_string_len = new_string_table_size; | 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 | const new_header_size: usize = @intCast(old_header_size + @sizeOf(u32)); | 3082 | const new_header_size: usize = @intCast(old_header_size + @sizeOf(u32)); |
| 3083 | try Node.known.first_linker_member.resize(&coff.mf, gpa, new_header_size + new_string_table_size); | 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,7 +3092,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { |
| 3092 | 3092 | ||
| 3093 | { | 3093 | { |
| 3094 | const num_members = coff.targetLoad(coff.secondLinkerMemberNumMembersPtr()); | 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 | const new_header_size = old_header_size + @sizeOf(u16); | 3096 | const new_header_size = old_header_size + @sizeOf(u16); |
| 3097 | try Node.known.second_linker_member.resize(&coff.mf, gpa, new_header_size + new_string_table_size); | 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,7 +3109,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { |
| 3109 | try coff.lib_string_table.append(gpa, name); | 3109 | try coff.lib_string_table.append(gpa, name); |
| 3110 | 3110 | ||
| 3111 | const slice = Node.known.second_linker_member.slice(&coff.mf); | 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 | if (!needs_sort) { | 3113 | if (!needs_sort) { |
| 3114 | @memmove(slice[new_header_size..][0..coff.lib_string_len], slice[old_header_size..][0..coff.lib_string_len]); | 3114 | @memmove(slice[new_header_size..][0..coff.lib_string_len], slice[old_header_size..][0..coff.lib_string_len]); |
| 3115 | @memcpy(slice[new_header_size + coff.lib_string_len ..][0..name_slice.len], name_slice[0..name_slice.len]); | 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,7 +3121,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { |
| 3121 | 3121 | ||
| 3122 | // Indices in this table are 1-based | 3122 | // Indices in this table are 1-based |
| 3123 | const index_ptr: *u16 = @ptrCast(@alignCast(slice[old_header_size..])); | 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 | coff.pending_members.putAssumeCapacity(mi, {}); | 3127 | coff.pending_members.putAssumeCapacity(mi, {}); |
| ... | @@ -3209,7 +3209,7 @@ fn flushSymbolTableEntry(coff: *Coff, index: u32, pt: Zcu.PerThread) !void { | ... | @@ -3209,7 +3209,7 @@ fn flushSymbolTableEntry(coff: *Coff, index: u32, pt: Zcu.PerThread) !void { |
| 3209 | const entry = coff.symbolTableEntryPtr(sti.*).?; | 3209 | const entry = coff.symbolTableEntryPtr(sti.*).?; |
| 3210 | symbol_name.store(coff, &entry.name); | 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 | entry.type = .{ | 3213 | entry.type = .{ |
| 3214 | .complex_type = complex_type, | 3214 | .complex_type = complex_type, |
| 3215 | .base_type = .NULL, | 3215 | .base_type = .NULL, |
| ... | @@ -3399,7 +3399,7 @@ fn addSection(coff: *Coff, name: String, flags: std.coff.SectionHeader.Flags) !S | ... | @@ -3399,7 +3399,7 @@ fn addSection(coff: *Coff, name: String, flags: std.coff.SectionHeader.Flags) !S |
| 3399 | const sym = si.get(coff); | 3399 | const sym = si.get(coff); |
| 3400 | sym.ni = ni; | 3400 | sym.ni = ni; |
| 3401 | sym.rva = rva; | 3401 | sym.rva = rva; |
| 3402 | sym.section_number = @enumFromInt(section_table_len); | 3402 | sym.section_number = @fromBackingInt(@intCast(section_table_len)); |
| 3403 | } | 3403 | } |
| 3404 | const section = &section_table[section_index]; | 3404 | const section = &section_table[section_index]; |
| 3405 | section.* = .{ | 3405 | section.* = .{ |
| ... | @@ -3486,7 +3486,7 @@ fn pseudoSectionMapIndex( | ... | @@ -3486,7 +3486,7 @@ fn pseudoSectionMapIndex( |
| 3486 | ) !Node.PseudoSectionMapIndex { | 3486 | ) !Node.PseudoSectionMapIndex { |
| 3487 | const gpa = coff.base.comp.gpa; | 3487 | const gpa = coff.base.comp.gpa; |
| 3488 | const pseudo_section_gop = try coff.pseudo_section_table.getOrPut(gpa, name); | 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 | const parent_sn = if (!pseudo_section_gop.found_existing) sn: { | 3490 | const parent_sn = if (!pseudo_section_gop.found_existing) sn: { |
| 3491 | const effective_name = coff.section_merges.get(name) orelse name; | 3491 | const effective_name = coff.section_merges.get(name) orelse name; |
| 3492 | const parent = if (coff.section_table.get(effective_name)) |existing_sec| | 3492 | const parent = if (coff.section_table.get(effective_name)) |existing_sec| |
| ... | @@ -3514,7 +3514,7 @@ fn pseudoSectionMapIndex( | ... | @@ -3514,7 +3514,7 @@ fn pseudoSectionMapIndex( |
| 3514 | sym.rva = coff.computeNodeRva(ni); | 3514 | sym.rva = coff.computeNodeRva(ni); |
| 3515 | sym.section_number = parent.get(coff).section_number; | 3515 | sym.section_number = parent.get(coff).section_number; |
| 3516 | assert(sym.loc_relocs == .none); | 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 | coff.nodes.appendAssumeCapacity(.{ .pseudo_section = psmi }); | 3518 | coff.nodes.appendAssumeCapacity(.{ .pseudo_section = psmi }); |
| 3519 | break :sn sym.section_number; | 3519 | break :sn sym.section_number; |
| 3520 | } else pseudo_section_gop.value_ptr.get(coff).section_number; | 3520 | } else pseudo_section_gop.value_ptr.get(coff).section_number; |
| ... | @@ -3557,7 +3557,7 @@ fn objectSectionMapIndex( | ... | @@ -3557,7 +3557,7 @@ fn objectSectionMapIndex( |
| 3557 | } else attributes; | 3557 | } else attributes; |
| 3558 | 3558 | ||
| 3559 | const object_section_gop = try coff.object_section_table.getOrPut(gpa, name); | 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 | const sym = if (!object_section_gop.found_existing) sym: { | 3561 | const sym = if (!object_section_gop.found_existing) sym: { |
| 3562 | try coff.ensureUnusedStringCapacity(name_slice.len); | 3562 | try coff.ensureUnusedStringCapacity(name_slice.len); |
| 3563 | const parent_name = coff.getOrPutStringAssumeCapacity(coff.objectSectionParentName(name_slice)); | 3563 | const parent_name = coff.getOrPutStringAssumeCapacity(coff.objectSectionParentName(name_slice)); |
| ... | @@ -3593,7 +3593,7 @@ fn objectSectionMapIndex( | ... | @@ -3593,7 +3593,7 @@ fn objectSectionMapIndex( |
| 3593 | sym.rva = coff.computeNodeRva(ni); | 3593 | sym.rva = coff.computeNodeRva(ni); |
| 3594 | sym.section_number = parent.get(coff).section_number; | 3594 | sym.section_number = parent.get(coff).section_number; |
| 3595 | assert(sym.loc_relocs == .none); | 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 | coff.nodes.appendAssumeCapacity(.{ .object_section = osmi }); | 3597 | coff.nodes.appendAssumeCapacity(.{ .object_section = osmi }); |
| 3598 | break :sym sym; | 3598 | break :sym sym; |
| 3599 | } else object_section_gop.value_ptr.get(coff); | 3599 | } else object_section_gop.value_ptr.get(coff); |
| ... | @@ -3723,7 +3723,7 @@ fn addRelocAssumeCapacity( | ... | @@ -3723,7 +3723,7 @@ fn addRelocAssumeCapacity( |
| 3723 | const gpa = coff.base.comp.gpa; | 3723 | const gpa = coff.base.comp.gpa; |
| 3724 | const target = target_si.get(coff); | 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 | log.debug("addReloc({d}@{d}+0x{x} -> {d}@{d}+0x{x}{s}) = {d}", .{ | 3727 | log.debug("addReloc({d}@{d}+0x{x} -> {d}@{d}+0x{x}{s}) = {d}", .{ |
| 3728 | loc_si, | 3728 | loc_si, |
| 3729 | loc_si.get(coff).section_number, | 3729 | loc_si.get(coff).section_number, |
| ... | @@ -3984,7 +3984,7 @@ fn loadObject( | ... | @@ -3984,7 +3984,7 @@ fn loadObject( |
| 3984 | symbol_table_end + string_table_len > fl.size) | 3984 | symbol_table_end + string_table_len > fl.size) |
| 3985 | return diags.failParse(path, "bad string table length: 0x{x}", .{string_table_len}); | 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 | try coff.input_objects.ensureUnusedCapacity(gpa, 1); | 3988 | try coff.input_objects.ensureUnusedCapacity(gpa, 1); |
| 3989 | const input = coff.input_objects.addOneAssumeCapacity(); | 3989 | const input = coff.input_objects.addOneAssumeCapacity(); |
| 3990 | input.* = .{ | 3990 | input.* = .{ |
| ... | @@ -4013,13 +4013,13 @@ fn loadObject( | ... | @@ -4013,13 +4013,13 @@ fn loadObject( |
| 4013 | _, | 4013 | _, |
| 4014 | 4014 | ||
| 4015 | pub fn wrap(i: ?u32) @This() { | 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 | pub fn unwrap(i: @This()) ?u32 { | 4019 | pub fn unwrap(i: @This()) ?u32 { |
| 4020 | return switch (i) { | 4020 | return switch (i) { |
| 4021 | .none => null, | 4021 | .none => null, |
| 4022 | _ => @intFromEnum(i) - 1, | 4022 | _ => @backingInt(i) - 1, |
| 4023 | }; | 4023 | }; |
| 4024 | } | 4024 | } |
| 4025 | }; | 4025 | }; |
| ... | @@ -4208,12 +4208,12 @@ fn loadObject( | ... | @@ -4208,12 +4208,12 @@ fn loadObject( |
| 4208 | 4208 | ||
| 4209 | switch (symbol.section_number) { | 4209 | switch (symbol.section_number) { |
| 4210 | .UNDEFINED, .DEBUG, .ABSOLUTE => {}, | 4210 | .UNDEFINED, .DEBUG, .ABSOLUTE => {}, |
| 4211 | else => |sn| if (@intFromEnum(sn) > sections.len) | 4211 | else => |sn| if (@backingInt(sn) > sections.len) |
| 4212 | return diags.failParse(path, "out-of-bounds section number {d} in symbol 0x{x}", .{ sn, symbol_i }), | 4212 | return diags.failParse(path, "out-of-bounds section number {d} in symbol 0x{x}", .{ sn, symbol_i }), |
| 4213 | } | 4213 | } |
| 4214 | 4214 | ||
| 4215 | const psi: PendingSymbolIndex = .wrap(@intCast(pending_symbols.count())); | 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 | const values: []const @FieldType(PendingSymbol, "value") = pending_symbols: switch (symbol.storage_class) { | 4218 | const values: []const @FieldType(PendingSymbol, "value") = pending_symbols: switch (symbol.storage_class) { |
| 4219 | .STATIC, .LABEL => |storage_class| switch (section_number) { | 4219 | .STATIC, .LABEL => |storage_class| switch (section_number) { |
| ... | @@ -4270,7 +4270,7 @@ fn loadObject( | ... | @@ -4270,7 +4270,7 @@ fn loadObject( |
| 4270 | .{ symbol_i + 1, name, section_def.number }, | 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 | section.comdat = section_def.selection; | 4276 | section.comdat = section_def.selection; |
| ... | @@ -4684,7 +4684,7 @@ fn loadObject( | ... | @@ -4684,7 +4684,7 @@ fn loadObject( |
| 4684 | .alignment = section.header.flags.ALIGN.alignment() orelse .@"1", | 4684 | .alignment = section.header.flags.ALIGN.alignment() orelse .@"1", |
| 4685 | .moved = true, | 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 | section.si = coff.addSymbolAssumeCapacity(); | 4689 | section.si = coff.addSymbolAssumeCapacity(); |
| 4690 | if (section.psi.unwrap()) |psi| | 4690 | if (section.psi.unwrap()) |psi| |
| ... | @@ -4701,7 +4701,7 @@ fn loadObject( | ... | @@ -4701,7 +4701,7 @@ fn loadObject( |
| 4701 | .offset = fl.offset + section.header.pointer_to_raw_data, | 4701 | .offset = fl.offset + section.header.pointer_to_raw_data, |
| 4702 | .size = section.header.size_of_raw_data, | 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 | .crc = section.comdat_crc, | 4705 | .crc = section.comdat_crc, |
| 4706 | .comdat_si = if (section.comdat_psi.unwrap()) |psi| | 4706 | .comdat_si = if (section.comdat_psi.unwrap()) |psi| |
| 4707 | pending_symbols.values()[psi].si | 4707 | pending_symbols.values()[psi].si |
| ... | @@ -4888,7 +4888,7 @@ fn loadObject( | ... | @@ -4888,7 +4888,7 @@ fn loadObject( |
| 4888 | 4888 | ||
| 4889 | const loc_sym = section.si.get(coff); | 4889 | const loc_sym = section.si.get(coff); |
| 4890 | assert(loc_sym.loc_relocs == .none); | 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 | if (section.header.number_of_relocations == 0) continue; | 4893 | if (section.header.number_of_relocations == 0) continue; |
| 4894 | 4894 | ||
| ... | @@ -4947,8 +4947,8 @@ fn loadObject( | ... | @@ -4947,8 +4947,8 @@ fn loadObject( |
| 4947 | const lhs = &ctx.v[a_index]; | 4947 | const lhs = &ctx.v[a_index]; |
| 4948 | const rhs = &ctx.v[b_index]; | 4948 | const rhs = &ctx.v[b_index]; |
| 4949 | if (lhs.section_number == rhs.section_number) | 4949 | if (lhs.section_number == rhs.section_number) |
| 4950 | return @intFromEnum(lhs.si) < @intFromEnum(rhs.si); | 4950 | return @backingInt(lhs.si) < @backingInt(rhs.si); |
| 4951 | return @intFromEnum(lhs.section_number) < @intFromEnum(rhs.section_number); | 4951 | return @backingInt(lhs.section_number) < @backingInt(rhs.section_number); |
| 4952 | } | 4952 | } |
| 4953 | }; | 4953 | }; |
| 4954 | 4954 | ||
| ... | @@ -4968,14 +4968,14 @@ fn loadObject( | ... | @@ -4968,14 +4968,14 @@ fn loadObject( |
| 4968 | include_section = section.comdat_result == .include; | 4968 | include_section = section.comdat_result == .include; |
| 4969 | if (include_section) { | 4969 | if (include_section) { |
| 4970 | const isi = coff.getNode(section.si.get(coff).ni).input_section; | 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 | if (include_section) { | 4976 | if (include_section) { |
| 4977 | assert(coff.getNode(symbol.si.get(coff).ni) == .input_section); | 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 | coff.input_symbols.addOneAssumeCapacity().* = .{ | 4979 | coff.input_symbols.addOneAssumeCapacity().* = .{ |
| 4980 | .si = symbol.si, | 4980 | .si = symbol.si, |
| 4981 | .name = symbol.name, | 4981 | .name = symbol.name, |
| ... | @@ -5092,7 +5092,7 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa | ... | @@ -5092,7 +5092,7 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa |
| 5092 | }) = .empty; | 5092 | }) = .empty; |
| 5093 | var symbol_member_indices: std.ArrayList(u32) = .empty; | 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 | (try coff.input_archives.addOne(gpa)).* = .{ | 5096 | (try coff.input_archives.addOne(gpa)).* = .{ |
| 5097 | .path = path, | 5097 | .path = path, |
| 5098 | }; | 5098 | }; |
| ... | @@ -5103,13 +5103,13 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa | ... | @@ -5103,13 +5103,13 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa |
| 5103 | 5103 | ||
| 5104 | errdefer { | 5104 | errdefer { |
| 5105 | for (coff.input_archive_symbol_indices.values()) |*v| { | 5105 | for (coff.input_archive_symbol_indices.values()) |*v| { |
| 5106 | if (@intFromEnum(v.last) < first_iamsi) continue; | 5106 | if (@backingInt(v.last) < first_iamsi) continue; |
| 5107 | if (@intFromEnum(v.first) >= first_iamsi) continue; | 5107 | if (@backingInt(v.first) >= first_iamsi) continue; |
| 5108 | 5108 | ||
| 5109 | var iter = v.first; | 5109 | var iter = v.first; |
| 5110 | v.last = while (iter != v.last) { | 5110 | v.last = while (iter != v.last) { |
| 5111 | const sym = &coff.input_archive_symbols.items[@intFromEnum(iter)]; | 5111 | const sym = &coff.input_archive_symbols.items[@backingInt(iter)]; |
| 5112 | if (@intFromEnum(sym.next) >= first_iamsi) { | 5112 | if (@backingInt(sym.next) >= first_iamsi) { |
| 5113 | sym.next = iter; | 5113 | sym.next = iter; |
| 5114 | break iter; | 5114 | break iter; |
| 5115 | } | 5115 | } |
| ... | @@ -5189,7 +5189,7 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa | ... | @@ -5189,7 +5189,7 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa |
| 5189 | }) |n| n else return diags.failParse(path, "unterminated string found in second linker member", .{}); | 5189 | }) |n| n else return diags.failParse(path, "unterminated string found in second linker member", .{}); |
| 5190 | 5190 | ||
| 5191 | const string = coff.getOrPutStringAssumeCapacity(name); | 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 | const symbol_gop = coff.input_archive_symbol_indices.getOrPutAssumeCapacity(string); | 5193 | const symbol_gop = coff.input_archive_symbol_indices.getOrPutAssumeCapacity(string); |
| 5194 | if (!symbol_gop.found_existing) { | 5194 | if (!symbol_gop.found_existing) { |
| 5195 | symbol_gop.value_ptr.* = .{ | 5195 | symbol_gop.value_ptr.* = .{ |
| ... | @@ -5197,12 +5197,12 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa | ... | @@ -5197,12 +5197,12 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa |
| 5197 | .last = iamsi, | 5197 | .last = iamsi, |
| 5198 | }; | 5198 | }; |
| 5199 | } else { | 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 | symbol_gop.value_ptr.last = iamsi; | 5201 | symbol_gop.value_ptr.last = iamsi; |
| 5202 | } | 5202 | } |
| 5203 | 5203 | ||
| 5204 | const iami = members.items[symbol_member_indices.items[symbol_i]].iami orelse iami: { | 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 | const member_offset = members.items[symbol_member_indices.items[symbol_i]].offset; | 5206 | const member_offset = members.items[symbol_member_indices.items[symbol_i]].offset; |
| 5207 | coff.input_archive_members.addOneAssumeCapacity().* = .{ | 5207 | coff.input_archive_members.addOneAssumeCapacity().* = .{ |
| 5208 | .iai = iai, | 5208 | .iai = iai, |
| ... | @@ -5271,7 +5271,7 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa | ... | @@ -5271,7 +5271,7 @@ fn loadArchive(coff: *Coff, path: std.Build.Cache.Path, fr: *Io.File.Reader) Loa |
| 5271 | 5271 | ||
| 5272 | const member_sig = try r.peek(4); | 5272 | const member_sig = try r.peek(4); |
| 5273 | const machine: std.coff.IMAGE.FILE.MACHINE = | 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 | const sig = std.mem.readInt(u16, member_sig[2..4], target_endian); | 5275 | const sig = std.mem.readInt(u16, member_sig[2..4], target_endian); |
| 5276 | 5276 | ||
| 5277 | log.debug("verifyArchiveMember({s}) = 0x{x}+{x}", .{ | 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,7 +5484,7 @@ fn updateNavInner(coff: *Coff, pt: Zcu.PerThread, nav_index: InternPool.Nav.Inde |
| 5484 | } | 5484 | } |
| 5485 | const sym = si.get(coff); | 5485 | const sym = si.get(coff); |
| 5486 | assert(sym.loc_relocs == .none); | 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 | if (!isImage(coff) and sym.target_relocs != .none) | 5488 | if (!isImage(coff) and sym.target_relocs != .none) |
| 5489 | try coff.pendingSymbolTableEntry(si); | 5489 | try coff.pendingSymbolTableEntry(si); |
| 5490 | 5490 | ||
| ... | @@ -5500,7 +5500,7 @@ fn updateNavInner(coff: *Coff, pt: Zcu.PerThread, nav_index: InternPool.Nav.Inde | ... | @@ -5500,7 +5500,7 @@ fn updateNavInner(coff: *Coff, pt: Zcu.PerThread, nav_index: InternPool.Nav.Inde |
| 5500 | pt, | 5500 | pt, |
| 5501 | .fromInterned(nav.resolved.?.value), | 5501 | .fromInterned(nav.resolved.?.value), |
| 5502 | &nw.interface, | 5502 | &nw.interface, |
| 5503 | .{ .atom_index = @enumFromInt(@intFromEnum(si)) }, | 5503 | .{ .atom_index = @fromBackingInt(@intCast(@backingInt(si))) }, |
| 5504 | ) catch |err| switch (err) { | 5504 | ) catch |err| switch (err) { |
| 5505 | error.WriteFailed => return nw.err.?, | 5505 | error.WriteFailed => return nw.err.?, |
| 5506 | else => |e| return e, | 5506 | else => |e| return e, |
| ... | @@ -5554,7 +5554,7 @@ pub fn lowerUav( | ... | @@ -5554,7 +5554,7 @@ pub fn lowerUav( |
| 5554 | coff.const_prog_node.increaseEstimatedTotalItems(1); | 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 | pub fn updateFunc( | 5560 | pub fn updateFunc( |
| ... | @@ -5617,7 +5617,7 @@ fn updateFuncInner( | ... | @@ -5617,7 +5617,7 @@ fn updateFuncInner( |
| 5617 | } | 5617 | } |
| 5618 | const sym = si.get(coff); | 5618 | const sym = si.get(coff); |
| 5619 | assert(sym.loc_relocs == .none); | 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 | if (!isImage(coff) and sym.target_relocs != .none) | 5621 | if (!isImage(coff) and sym.target_relocs != .none) |
| 5622 | try coff.pendingSymbolTableEntry(si); | 5622 | try coff.pendingSymbolTableEntry(si); |
| 5623 | break :ni sym.ni; | 5623 | break :ni sym.ni; |
| ... | @@ -5630,7 +5630,7 @@ fn updateFuncInner( | ... | @@ -5630,7 +5630,7 @@ fn updateFuncInner( |
| 5630 | &coff.base, | 5630 | &coff.base, |
| 5631 | pt, | 5631 | pt, |
| 5632 | func_index, | 5632 | func_index, |
| 5633 | @enumFromInt(@intFromEnum(si)), | 5633 | @fromBackingInt(@intCast(@backingInt(si))), |
| 5634 | mir, | 5634 | mir, |
| 5635 | &nw.interface, | 5635 | &nw.interface, |
| 5636 | .none, | 5636 | .none, |
| ... | @@ -5756,9 +5756,9 @@ fn reportUndefs(coff: *Coff, tid: Zcu.PerThread.Id) !void { | ... | @@ -5756,9 +5756,9 @@ fn reportUndefs(coff: *Coff, tid: Zcu.PerThread.Id) !void { |
| 5756 | const reloc_l = &ctx.relocs.items[lhs]; | 5756 | const reloc_l = &ctx.relocs.items[lhs]; |
| 5757 | const reloc_r = &ctx.relocs.items[rhs]; | 5757 | const reloc_r = &ctx.relocs.items[rhs]; |
| 5758 | if (reloc_l.target == reloc_r.target) | 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 | else | 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 | }.lessThan; | 5763 | }.lessThan; |
| 5764 | 5764 | ||
| ... | @@ -5798,7 +5798,7 @@ fn reportUndefs(coff: *Coff, tid: Zcu.PerThread.Id) !void { | ... | @@ -5798,7 +5798,7 @@ fn reportUndefs(coff: *Coff, tid: Zcu.PerThread.Id) !void { |
| 5798 | switch (coff.getNode(loc_sym.ni)) { | 5798 | switch (coff.getNode(loc_sym.ni)) { |
| 5799 | .data_directories => { | 5799 | .data_directories => { |
| 5800 | const dir: std.coff.IMAGE.DIRECTORY_ENTRY = | 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 | err.addNote("referenced by data directory entry: {t}", .{dir}); | 5802 | err.addNote("referenced by data directory entry: {t}", .{dir}); |
| 5803 | }, | 5803 | }, |
| 5804 | .optional_header => err.addNote("referenced by optional header field", .{}), | 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,7 +6095,7 @@ pub fn idle(coff: *Coff, tid: Zcu.PerThread.Id) !bool { |
| 6095 | task: { | 6095 | task: { |
| 6096 | // TODO: Idle task for flushing obj into lib | 6096 | // TODO: Idle task for flushing obj into lib |
| 6097 | if (coff.input_section_pending_index < coff.input_sections.items.len) { | 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 | coff.input_section_pending_index += 1; | 6099 | coff.input_section_pending_index += 1; |
| 6100 | const sub_prog_node = coff.idleProgNode(tid, coff.input_prog_node, coff.getNode(isi.symbol(coff).node(coff))); | 6100 | const sub_prog_node = coff.idleProgNode(tid, coff.input_prog_node, coff.getNode(isi.symbol(coff).node(coff))); |
| 6101 | defer sub_prog_node.end(); | 6101 | defer sub_prog_node.end(); |
| ... | @@ -6229,7 +6229,7 @@ fn flushUav( | ... | @@ -6229,7 +6229,7 @@ fn flushUav( |
| 6229 | } | 6229 | } |
| 6230 | const sym = si.get(coff); | 6230 | const sym = si.get(coff); |
| 6231 | assert(sym.loc_relocs == .none); | 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 | if (!isImage(coff) and sym.target_relocs != .none) | 6233 | if (!isImage(coff) and sym.target_relocs != .none) |
| 6234 | try coff.pendingSymbolTableEntry(si); | 6234 | try coff.pendingSymbolTableEntry(si); |
| 6235 | 6235 | ||
| ... | @@ -6244,7 +6244,7 @@ fn flushUav( | ... | @@ -6244,7 +6244,7 @@ fn flushUav( |
| 6244 | pt, | 6244 | pt, |
| 6245 | .fromInterned(uav_val), | 6245 | .fromInterned(uav_val), |
| 6246 | &nw.interface, | 6246 | &nw.interface, |
| 6247 | .{ .atom_index = @enumFromInt(@intFromEnum(si)) }, | 6247 | .{ .atom_index = @fromBackingInt(@intCast(@backingInt(si))) }, |
| 6248 | ) catch |err| switch (err) { | 6248 | ) catch |err| switch (err) { |
| 6249 | error.WriteFailed => return nw.err.?, | 6249 | error.WriteFailed => return nw.err.?, |
| 6250 | else => |e| return e, | 6250 | else => |e| return e, |
| ... | @@ -6375,8 +6375,8 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { | ... | @@ -6375,8 +6375,8 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { |
| 6375 | const indices_list = opt_indices_list orelse continue; | 6375 | const indices_list = opt_indices_list orelse continue; |
| 6376 | var iter: InputArchive.Member.Symbol.Index = indices_list.first; | 6376 | var iter: InputArchive.Member.Symbol.Index = indices_list.first; |
| 6377 | while (true) { | 6377 | while (true) { |
| 6378 | const archive_sym = &coff.input_archive_symbols.items[@intFromEnum(iter)]; | 6378 | const archive_sym = &coff.input_archive_symbols.items[@backingInt(iter)]; |
| 6379 | const member = &coff.input_archive_members.items[@intFromEnum(archive_sym.iami)]; | 6379 | const member = &coff.input_archive_members.items[@backingInt(archive_sym.iami)]; |
| 6380 | member: switch (member.content) { | 6380 | member: switch (member.content) { |
| 6381 | .object => if (!member.flags.is_loaded) { | 6381 | .object => if (!member.flags.is_loaded) { |
| 6382 | if (gmi.libName(coff).unwrap()) |lib_name| | 6382 | if (gmi.libName(coff).unwrap()) |lib_name| |
| ... | @@ -6523,7 +6523,7 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { | ... | @@ -6523,7 +6523,7 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { |
| 6523 | const import_address_table_sym = import_address_table_si.get(coff); | 6523 | const import_address_table_sym = import_address_table_si.get(coff); |
| 6524 | import_address_table_sym.ni = import_address_table_ni; | 6524 | import_address_table_sym.ni = import_address_table_ni; |
| 6525 | assert(import_address_table_sym.loc_relocs == .none); | 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 | import_address_table_sym.section_number = | 6527 | import_address_table_sym.section_number = |
| 6528 | coff.getNode(idata_section_ni).object_section.symbol(coff).get(coff).section_number; | 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,9 +6544,9 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { |
| 6544 | @memcpy(import_hint_name_slice[0..lib_name.len], lib_name); | 6544 | @memcpy(import_hint_name_slice[0..lib_name.len], lib_name); |
| 6545 | @memcpy(import_hint_name_slice[lib_name.len..][0..".dll".len], ".dll"); | 6545 | @memcpy(import_hint_name_slice[lib_name.len..][0..".dll".len], ".dll"); |
| 6546 | @memset(import_hint_name_slice[lib_name.len + ".dll".len ..], 0); | 6546 | @memset(import_hint_name_slice[lib_name.len + ".dll".len ..], 0); |
| 6547 | coff.nodes.appendAssumeCapacity(.{ .import_lookup_table = @enumFromInt(gop.index) }); | 6547 | coff.nodes.appendAssumeCapacity(.{ .import_lookup_table = @fromBackingInt(@intCast(gop.index)) }); |
| 6548 | coff.nodes.appendAssumeCapacity(.{ .import_address_table = @enumFromInt(gop.index) }); | 6548 | coff.nodes.appendAssumeCapacity(.{ .import_address_table = @fromBackingInt(@intCast(gop.index)) }); |
| 6549 | coff.nodes.appendAssumeCapacity(.{ .import_hint_name_table = @enumFromInt(gop.index) }); | 6549 | coff.nodes.appendAssumeCapacity(.{ .import_hint_name_table = @fromBackingInt(@intCast(gop.index)) }); |
| 6550 | 6550 | ||
| 6551 | const import_directory_entries = coff.importDirectoryTableSlice()[gop.index..][0..2]; | 6551 | const import_directory_entries = coff.importDirectoryTableSlice()[gop.index..][0..2]; |
| 6552 | import_directory_entries.* = .{ .{ | 6552 | import_directory_entries.* = .{ .{ |
| ... | @@ -6572,7 +6572,7 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { | ... | @@ -6572,7 +6572,7 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { |
| 6572 | ); | 6572 | ); |
| 6573 | 6573 | ||
| 6574 | const iat_symbol_gop = try coff.import_table.iat_symbol_indices.getOrPut(gpa, .{ | 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 | .name = import.name, | 6576 | .name = import.name, |
| 6577 | .ordinal_hint = import.ordinal_hint, | 6577 | .ordinal_hint = import.ordinal_hint, |
| 6578 | }); | 6578 | }); |
| ... | @@ -6645,7 +6645,7 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { | ... | @@ -6645,7 +6645,7 @@ fn flushGlobal(coff: *Coff, gmi: Node.GlobalMapIndex) !bool { |
| 6645 | (try gop.value_ptr.import_address_table_symbols.addOne(gpa)).* = si; | 6645 | (try gop.value_ptr.import_address_table_symbols.addOne(gpa)).* = si; |
| 6646 | }, | 6646 | }, |
| 6647 | .thunk => { | 6647 | .thunk => { |
| 6648 | sym.loc_relocs = @enumFromInt(coff.relocs.items.len); | 6648 | sym.loc_relocs = @fromBackingInt(@intCast(coff.relocs.items.len)); |
| 6649 | 6649 | ||
| 6650 | const target = &comp.root_mod.resolved_target.result; | 6650 | const target = &comp.root_mod.resolved_target.result; |
| 6651 | const alignment = switch (comp.root_mod.optimize_mode) { | 6651 | const alignment = switch (comp.root_mod.optimize_mode) { |
| ... | @@ -6738,7 +6738,7 @@ fn flushSpecialSymbol(coff: *Coff, pending: SpecialSymbol) !SpecialSymbol { | ... | @@ -6738,7 +6738,7 @@ fn flushSpecialSymbol(coff: *Coff, pending: SpecialSymbol) !SpecialSymbol { |
| 6738 | const optional_hdr_sym = optional_hdr_si.get(coff); | 6738 | const optional_hdr_sym = optional_hdr_si.get(coff); |
| 6739 | optional_hdr_sym.ni = Node.known.optional_header; | 6739 | optional_hdr_sym.ni = Node.known.optional_header; |
| 6740 | assert(optional_hdr_sym.loc_relocs == .none); | 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 | const optional_hdr = coff.optionalHeaderStandardPtr(); | 6743 | const optional_hdr = coff.optionalHeaderStandardPtr(); |
| 6744 | optional_hdr.address_of_entry_point = std.mem.nativeTo( | 6744 | optional_hdr.address_of_entry_point = std.mem.nativeTo( |
| ... | @@ -6785,7 +6785,7 @@ fn flushSpecialSymbol(coff: *Coff, pending: SpecialSymbol) !SpecialSymbol { | ... | @@ -6785,7 +6785,7 @@ fn flushSpecialSymbol(coff: *Coff, pending: SpecialSymbol) !SpecialSymbol { |
| 6785 | const data_dir_sym = data_dir_si.get(coff); | 6785 | const data_dir_sym = data_dir_si.get(coff); |
| 6786 | data_dir_sym.ni = Node.known.data_directories; | 6786 | data_dir_sym.ni = Node.known.data_directories; |
| 6787 | assert(data_dir_sym.loc_relocs == .none); | 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 | try coff.addReloc( | 6790 | try coff.addReloc( |
| 6791 | data_dir_si, | 6791 | data_dir_si, |
| ... | @@ -6823,8 +6823,8 @@ fn flushLazy(coff: *Coff, pt: Zcu.PerThread, lmr: Node.LazyMapRef) !void { | ... | @@ -6823,8 +6823,8 @@ fn flushLazy(coff: *Coff, pt: Zcu.PerThread, lmr: Node.LazyMapRef) !void { |
| 6823 | }; | 6823 | }; |
| 6824 | const ni = try coff.mf.addLastChildNode(gpa, sec_si.node(coff), .{ .moved = true }); | 6824 | const ni = try coff.mf.addLastChildNode(gpa, sec_si.node(coff), .{ .moved = true }); |
| 6825 | coff.nodes.appendAssumeCapacity(switch (lazy.kind) { | 6825 | coff.nodes.appendAssumeCapacity(switch (lazy.kind) { |
| 6826 | .code => .{ .lazy_code = @enumFromInt(lmr.index) }, | 6826 | .code => .{ .lazy_code = @fromBackingInt(@intCast(lmr.index)) }, |
| 6827 | .const_data => .{ .lazy_const_data = @enumFromInt(lmr.index) }, | 6827 | .const_data => .{ .lazy_const_data = @fromBackingInt(@intCast(lmr.index)) }, |
| 6828 | }); | 6828 | }); |
| 6829 | sym.ni = ni; | 6829 | sym.ni = ni; |
| 6830 | sym.section_number = sec_si.get(coff).section_number; | 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,7 +6832,7 @@ fn flushLazy(coff: *Coff, pt: Zcu.PerThread, lmr: Node.LazyMapRef) !void { |
| 6832 | else => si.deleteLocationRelocs(coff), | 6832 | else => si.deleteLocationRelocs(coff), |
| 6833 | } | 6833 | } |
| 6834 | assert(sym.loc_relocs == .none); | 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 | if (!isImage(coff) and sym.target_relocs != .none) | 6836 | if (!isImage(coff) and sym.target_relocs != .none) |
| 6837 | try coff.pendingSymbolTableEntry(si); | 6837 | try coff.pendingSymbolTableEntry(si); |
| 6838 | 6838 | ||
| ... | @@ -6850,7 +6850,7 @@ fn flushLazy(coff: *Coff, pt: Zcu.PerThread, lmr: Node.LazyMapRef) !void { | ... | @@ -6850,7 +6850,7 @@ fn flushLazy(coff: *Coff, pt: Zcu.PerThread, lmr: Node.LazyMapRef) !void { |
| 6850 | &required_alignment, | 6850 | &required_alignment, |
| 6851 | &nw.interface, | 6851 | &nw.interface, |
| 6852 | .none, | 6852 | .none, |
| 6853 | .{ .atom_index = @enumFromInt(@intFromEnum(si)) }, | 6853 | .{ .atom_index = @fromBackingInt(@intCast(@backingInt(si))) }, |
| 6854 | ) catch |err| switch (err) { | 6854 | ) catch |err| switch (err) { |
| 6855 | error.WriteFailed => return nw.err.?, | 6855 | error.WriteFailed => return nw.err.?, |
| 6856 | else => |e| return e, | 6856 | else => |e| return e, |
| ... | @@ -6899,7 +6899,7 @@ fn flushMoved(coff: *Coff, ni: MappedFile.Node.Index) !void { | ... | @@ -6899,7 +6899,7 @@ fn flushMoved(coff: *Coff, ni: MappedFile.Node.Index) !void { |
| 6899 | switch (member.kind) { | 6899 | switch (member.kind) { |
| 6900 | .first_linker, .second_linker, .longnames => {}, | 6900 | .first_linker, .second_linker, .longnames => {}, |
| 6901 | else => coff.targetStore( | 6901 | else => coff.targetStore( |
| 6902 | &coff.secondLinkerMemberOffsetsSlice()[@intFromEnum(mi) - Member.Index.known_count], | 6902 | &coff.secondLinkerMemberOffsetsSlice()[@backingInt(mi) - Member.Index.known_count], |
| 6903 | @intCast(ni.fileLocation(&coff.mf, false).offset), | 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,7 +6926,7 @@ fn flushMoved(coff: *Coff, ni: MappedFile.Node.Index) !void { |
| 6926 | }, | 6926 | }, |
| 6927 | .input_section => |isi| { | 6927 | .input_section => |isi| { |
| 6928 | try isi.symbol(coff).flushMoved(coff); | 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 | if (input_symbol.si.get(coff).ni != ni) break; | 6930 | if (input_symbol.si.get(coff).ni != ni) break; |
| 6931 | try input_symbol.si.flushMoved(coff); | 6931 | try input_symbol.si.flushMoved(coff); |
| 6932 | } | 6932 | } |
| ... | @@ -7032,7 +7032,7 @@ fn flushMoved(coff: *Coff, ni: MappedFile.Node.Index) !void { | ... | @@ -7032,7 +7032,7 @@ fn flushMoved(coff: *Coff, ni: MappedFile.Node.Index) !void { |
| 7032 | coff.exportNamePointerTableSlice(), | 7032 | coff.exportNamePointerTableSlice(), |
| 7033 | coff.exportOrdinalTableSlice(), | 7033 | coff.exportOrdinalTableSlice(), |
| 7034 | ) |*np, target_ord| { | 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 | const entry = ord.get(coff); | 7036 | const entry = ord.get(coff); |
| 7037 | coff.targetStore( | 7037 | coff.targetStore( |
| 7038 | &np.name_rva, | 7038 | &np.name_rva, |
| ... | @@ -7243,7 +7243,7 @@ fn flushMember(coff: *Coff, mi: Member.Index) !void { | ... | @@ -7243,7 +7243,7 @@ fn flushMember(coff: *Coff, mi: Member.Index) !void { |
| 7243 | const file_offset: u32 = @intCast(member.header_ni.fileLocation(&coff.mf, false).offset); | 7243 | const file_offset: u32 = @intCast(member.header_ni.fileLocation(&coff.mf, false).offset); |
| 7244 | const first_linker_offsets = coff.firstLinkerMemberOffsetsSlice(); | 7244 | const first_linker_offsets = coff.firstLinkerMemberOffsetsSlice(); |
| 7245 | for (member.first_linker_indices.values()) |mfli| | 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,7 +7323,7 @@ fn flushSectionMerge(coff: *Coff, index: u32) !void { |
| 7323 | @memcpy(from_name[0..to_slice.len], to_slice); | 7323 | @memcpy(from_name[0..to_slice.len], to_slice); |
| 7324 | @memset(from_name[to_slice.len..], 0); | 7324 | @memset(from_name[to_slice.len..], 0); |
| 7325 | } else if (coff.pseudo_section_table.getIndex(from)) |from_index| { | 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 | const from_sym = from_psmi.symbol(coff).get(coff); | 7327 | const from_sym = from_psmi.symbol(coff).get(coff); |
| 7328 | if (opt_to_sec) |to_sec| { | 7328 | if (opt_to_sec) |to_sec| { |
| 7329 | const to_sym = to_sec.si.get(coff); | 7329 | const to_sym = to_sec.si.get(coff); |
| ... | @@ -7395,11 +7395,11 @@ fn updateExportsInner( | ... | @@ -7395,11 +7395,11 @@ fn updateExportsInner( |
| 7395 | try coff.symbols.ensureUnusedCapacity(gpa, export_indices.len); | 7395 | try coff.symbols.ensureUnusedCapacity(gpa, export_indices.len); |
| 7396 | const exported_si: Symbol.Index = switch (exported) { | 7396 | const exported_si: Symbol.Index = switch (exported) { |
| 7397 | .nav => |nav| try coff.navSymbol(zcu, nav), | 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 | pt, | 7399 | pt, |
| 7400 | uav, | 7400 | uav, |
| 7401 | Type.fromInterned(ip.typeOf(uav)).abiAlignment(zcu), | 7401 | Type.fromInterned(ip.typeOf(uav)).abiAlignment(zcu), |
| 7402 | ))), | 7402 | )))), |
| 7403 | }; | 7403 | }; |
| 7404 | switch (exported) { | 7404 | switch (exported) { |
| 7405 | .nav => |nav| log.debug("updateExports({f}) = {d}", .{ ip.getNav(nav).fqn.fmt(ip), exported_si }), | 7405 | .nav => |nav| log.debug("updateExports({f}) = {d}", .{ ip.getNav(nav).fqn.fmt(ip), exported_si }), |
| ... | @@ -7479,7 +7479,7 @@ fn updateExportsInner( | ... | @@ -7479,7 +7479,7 @@ fn updateExportsInner( |
| 7479 | const ordinal_table_slice = coff.exportOrdinalTableSlice(); | 7479 | const ordinal_table_slice = coff.exportOrdinalTableSlice(); |
| 7480 | if (ordinal_table_slice.len > 0 and !coff.export_table.pending_sort) { | 7480 | if (ordinal_table_slice.len > 0 and !coff.export_table.pending_sort) { |
| 7481 | const tail_index: ExportTable.Ordinal = | 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 | const tail_entry = tail_index.get(coff); | 7483 | const tail_entry = tail_index.get(coff); |
| 7484 | const tail_name = name_table_slice[tail_entry.name_index..][0..tail_entry.name_len]; | 7484 | const tail_name = name_table_slice[tail_entry.name_index..][0..tail_entry.name_len]; |
| 7485 | coff.export_table.pending_sort = std.mem.lessThan(u8, name, tail_name); | 7485 | coff.export_table.pending_sort = std.mem.lessThan(u8, name, tail_name); |
| ... | @@ -7523,7 +7523,7 @@ fn updateExportsInner( | ... | @@ -7523,7 +7523,7 @@ fn updateExportsInner( |
| 7523 | .si = export_si, | 7523 | .si = export_si, |
| 7524 | .name_index = @intCast(name_index), | 7524 | .name_index = @intCast(name_index), |
| 7525 | .name_len = @intCast(name.len), | 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 | try coff.addReloc( | 7529 | try coff.addReloc( |
| ... | @@ -7583,7 +7583,7 @@ pub fn dump(coff: *Coff, w: *Io.Writer, tid: Zcu.PerThread.Id) !link.File.DumpRe | ... | @@ -7583,7 +7583,7 @@ pub fn dump(coff: *Coff, w: *Io.Writer, tid: Zcu.PerThread.Id) !link.File.DumpRe |
| 7583 | try coff.printSection(w, name, sec.si); | 7583 | try coff.printSection(w, name, sec.si); |
| 7584 | try w.writeAll("Symbol table:\n"); | 7584 | try w.writeAll("Symbol table:\n"); |
| 7585 | for (1..coff.symbols.items.len) |si| | 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 | return .enabled; | 7588 | return .enabled; |
| 7589 | } | 7589 | } |
| ... | @@ -7688,7 +7688,7 @@ fn printNodeName( | ... | @@ -7688,7 +7688,7 @@ fn printNodeName( |
| 7688 | const comdat_name = if (comdat_sym.gmi != .none) | 7688 | const comdat_name = if (comdat_sym.gmi != .none) |
| 7689 | comdat_sym.gmi.name(coff).toSlice(coff) | 7689 | comdat_sym.gmi.name(coff).toSlice(coff) |
| 7690 | else | 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 | try w.print("={s}", .{comdat_name}); | 7693 | try w.print("={s}", .{comdat_name}); |
| 7694 | } | 7694 | } |
| ... | @@ -7755,10 +7755,10 @@ pub fn printNode( | ... | @@ -7755,10 +7755,10 @@ pub fn printNode( |
| 7755 | try w.writeAll(@tagName(node)); | 7755 | try w.writeAll(@tagName(node)); |
| 7756 | try coff.printNodeName(w, tid, node); | 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 | const off, const size = mf_node.location().resolve(&coff.mf); | 7759 | const off, const size = mf_node.location().resolve(&coff.mf); |
| 7760 | try w.print(" index={d} offset=0x{x} size=0x{x} align=0x{x}{s}{s}{s}{s}\n", .{ | 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 | off, | 7762 | off, |
| 7763 | size, | 7763 | size, |
| 7764 | mf_node.flags.alignment.toByteUnits(), | 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,7 +40,7 @@ pub fn deinit(pool: *ConstPool, gpa: Allocator) void { |
| 40 | pub const Index = enum(u32) { | 40 | pub const Index = enum(u32) { |
| 41 | _, | 41 | _, |
| 42 | pub fn val(i: Index, pool: *const ConstPool) InternPool.Index { | 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,15 +107,15 @@ const ContainerDepEntry = extern struct { |
| 107 | fn unwrap(o: Optional) ?ContainerDepEntry.Index { | 107 | fn unwrap(o: Optional) ?ContainerDepEntry.Index { |
| 108 | return switch (o) { | 108 | return switch (o) { |
| 109 | .none => null, | 109 | .none => null, |
| 110 | else => @enumFromInt(@intFromEnum(o)), | 110 | else => @fromBackingInt(@intCast(@backingInt(o))), |
| 111 | }; | 111 | }; |
| 112 | } | 112 | } |
| 113 | }; | 113 | }; |
| 114 | fn toOptional(i: ContainerDepEntry.Index) Optional { | 114 | fn toOptional(i: ContainerDepEntry.Index) Optional { |
| 115 | return @enumFromInt(@intFromEnum(i)); | 115 | return @fromBackingInt(@intCast(@backingInt(i))); |
| 116 | } | 116 | } |
| 117 | fn ptr(i: ContainerDepEntry.Index, pool: *ConstPool) *ContainerDepEntry { | 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,7 +148,7 @@ pub fn get(pool: *ConstPool, pt: Zcu.PerThread, user: User, val: InternPool.Inde |
| 148 | const ip = &zcu.intern_pool; | 148 | const ip = &zcu.intern_pool; |
| 149 | const gpa = zcu.comp.gpa; | 149 | const gpa = zcu.comp.gpa; |
| 150 | const gop = try pool.values.getOrPut(gpa, val); | 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 | if (!gop.found_existing) { | 152 | if (!gop.found_existing) { |
| 153 | const ty: Type = switch (ip.typeOf(val)) { | 153 | const ty: Type = switch (ip.typeOf(val)) { |
| 154 | .type_type => if (ip.isUndef(val)) .type else .fromInterned(val), | 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,7 +272,7 @@ fn registerTypeDeps(pool: *ConstPool, root: Index, ty: Type, zcu: *const Zcu) Al |
| 272 | errdefer comptime unreachable; | 272 | errdefer comptime unreachable; |
| 273 | 273 | ||
| 274 | const gop = pool.container_deps.getOrPutAssumeCapacity(ty.toIntern()); | 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 | pool.container_dep_entries.appendAssumeCapacity(.{ | 276 | pool.container_dep_entries.appendAssumeCapacity(.{ |
| 277 | .next = if (gop.found_existing) gop.value_ptr.toOptional() else .none, | 277 | .next = if (gop.found_existing) gop.value_ptr.toOptional() else .none, |
| 278 | .depender = root, | 278 | .depender = root, |
src/link/Dwarf.zig+129-129| ... | @@ -81,11 +81,11 @@ const ModInfo = struct { | ... | @@ -81,11 +81,11 @@ const ModInfo = struct { |
| 81 | 81 | ||
| 82 | const DebugAbbrev = struct { | 82 | const DebugAbbrev = struct { |
| 83 | section: Section, | 83 | section: Section, |
| 84 | const unit: Unit.Index = @enumFromInt(0); | 84 | const unit: Unit.Index = @fromBackingInt(@intCast(0)); |
| 85 | 85 | ||
| 86 | const header_bytes = 0; | 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 | const DebugAranges = struct { | 91 | const DebugAranges = struct { |
| ... | @@ -96,7 +96,7 @@ const DebugAranges = struct { | ... | @@ -96,7 +96,7 @@ const DebugAranges = struct { |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | fn trailerBytes(dwarf: *Dwarf) u32 { | 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,8 +146,8 @@ const DebugInfo = struct { |
| 146 | 146 | ||
| 147 | fn headerBytes(dwarf: *Dwarf) u32 { | 147 | fn headerBytes(dwarf: *Dwarf) u32 { |
| 148 | return dwarf.unitLengthBytes() + 2 + 1 + 1 + dwarf.sectionOffsetBytes() + | 148 | return dwarf.unitLengthBytes() + 2 + 1 + 1 + dwarf.sectionOffsetBytes() + |
| 149 | uleb128Bytes(@intFromEnum(AbbrevCode.compile_unit)) + 1 + dwarf.sectionOffsetBytes() * 6 + uleb128Bytes(0) + | 149 | uleb128Bytes(@backingInt(AbbrevCode.compile_unit)) + 1 + dwarf.sectionOffsetBytes() * 6 + uleb128Bytes(0) + |
| 150 | uleb128Bytes(@intFromEnum(AbbrevCode.module)) + dwarf.sectionOffsetBytes() + uleb128Bytes(0); | 150 | uleb128Bytes(@backingInt(AbbrevCode.module)) + dwarf.sectionOffsetBytes() + uleb128Bytes(0); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | fn declEntryLineOff(dwarf: *Dwarf) u32 { | 153 | fn declEntryLineOff(dwarf: *Dwarf) u32 { |
| ... | @@ -168,9 +168,9 @@ const DebugInfo = struct { | ... | @@ -168,9 +168,9 @@ const DebugInfo = struct { |
| 168 | debug_info.section.off(dwarf) + unit_ptr.off + unit_ptr.header_len + entry_ptr.off, | 168 | debug_info.section.off(dwarf) + unit_ptr.off + unit_ptr.header_len + entry_ptr.off, |
| 169 | ) != abbrev_code_buf.len) return error.InputOutput; | 169 | ) != abbrev_code_buf.len) return error.InputOutput; |
| 170 | var abbrev_code_reader: std.Io.Reader = .fixed(&abbrev_code_buf); | 170 | var abbrev_code_reader: std.Io.Reader = .fixed(&abbrev_code_buf); |
| 171 | return @enumFromInt( | 171 | return @fromBackingInt(@intCast( |
| 172 | abbrev_code_reader.takeLeb128(@typeInfo(AbbrevCode).@"enum".tag_type) catch unreachable, | 172 | abbrev_code_reader.takeLeb128(@typeInfo(AbbrevCode).@"enum".tag_type) catch unreachable, |
| 173 | ); | 173 | )); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | const trailer_bytes = 1 + 1; | 176 | const trailer_bytes = 1 + 1; |
| ... | @@ -202,7 +202,7 @@ const DebugLine = struct { | ... | @@ -202,7 +202,7 @@ const DebugLine = struct { |
| 202 | const dir_index_info = dirIndexInfo(dir_count); | 202 | const dir_index_info = dirIndexInfo(dir_count); |
| 203 | return dwarf.unitLengthBytes() + 2 + 1 + 1 + dwarf.sectionOffsetBytes() + 1 + 1 + 1 + 1 + 1 + 1 + 1 * (dwarf.debug_line.header.opcode_base - 1) + | 203 | return dwarf.unitLengthBytes() + 2 + 1 + 1 + dwarf.sectionOffsetBytes() + 1 + 1 + 1 + 1 + 1 + 1 + 1 * (dwarf.debug_line.header.opcode_base - 1) + |
| 204 | 1 + uleb128Bytes(DW.LNCT.path) + uleb128Bytes(DW.FORM.line_strp) + uleb128Bytes(dir_count) + (dwarf.sectionOffsetBytes()) * dir_count + | 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 | const trailer_bytes = 1 + uleb128Bytes(1) + 1; | 208 | const trailer_bytes = 1 + uleb128Bytes(1) + 1; |
| ... | @@ -239,7 +239,7 @@ const StringSection = struct { | ... | @@ -239,7 +239,7 @@ const StringSection = struct { |
| 239 | map: std.array_hash_map.Auto(void, void), | 239 | map: std.array_hash_map.Auto(void, void), |
| 240 | section: Section, | 240 | section: Section, |
| 241 | 241 | ||
| 242 | const unit: Unit.Index = @enumFromInt(0); | 242 | const unit: Unit.Index = @fromBackingInt(@intCast(0)); |
| 243 | 243 | ||
| 244 | const init: StringSection = .{ | 244 | const init: StringSection = .{ |
| 245 | .contents = .empty, | 245 | .contents = .empty, |
| ... | @@ -255,7 +255,7 @@ const StringSection = struct { | ... | @@ -255,7 +255,7 @@ const StringSection = struct { |
| 255 | 255 | ||
| 256 | fn addString(str_sec: *StringSection, dwarf: *Dwarf, str: []const u8) UpdateError!Entry.Index { | 256 | fn addString(str_sec: *StringSection, dwarf: *Dwarf, str: []const u8) UpdateError!Entry.Index { |
| 257 | const gop = try str_sec.map.getOrPutAdapted(dwarf.gpa, str, Adapter{ .str_sec = str_sec }); | 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 | if (!gop.found_existing) { | 259 | if (!gop.found_existing) { |
| 260 | errdefer _ = str_sec.map.pop(); | 260 | errdefer _ = str_sec.map.pop(); |
| 261 | const unit_ptr = str_sec.section.getUnit(unit); | 261 | const unit_ptr = str_sec.section.getUnit(unit); |
| ... | @@ -284,7 +284,7 @@ const StringSection = struct { | ... | @@ -284,7 +284,7 @@ const StringSection = struct { |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | pub fn eql(adapter: Adapter, key: []const u8, _: void, rhs_index: usize) bool { | 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 | return std.mem.eql(u8, key, adapter.str_sec.contents.items[entry.off..][0 .. entry.len - 1 :0]); | 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,7 +345,7 @@ pub const Section = struct { |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | fn addUnit(sec: *Section, header_len: u32, trailer_len: u32, dwarf: *Dwarf) UpdateError!Unit.Index { | 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 | const unit_ptr = try sec.units.addOne(dwarf.gpa); | 349 | const unit_ptr = try sec.units.addOne(dwarf.gpa); |
| 350 | errdefer sec.popUnit(dwarf.gpa); | 350 | errdefer sec.popUnit(dwarf.gpa); |
| 351 | const aligned_header_len: u32 = @intCast(sec.alignment.forward(header_len)); | 351 | const aligned_header_len: u32 = @intCast(sec.alignment.forward(header_len)); |
| ... | @@ -385,14 +385,14 @@ pub const Section = struct { | ... | @@ -385,14 +385,14 @@ pub const Section = struct { |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | fn popUnit(sec: *Section, gpa: Allocator) void { | 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 | sec.unlinkUnit(unit_index); | 389 | sec.unlinkUnit(unit_index); |
| 390 | var unit = sec.units.pop().?; | 390 | var unit = sec.units.pop().?; |
| 391 | unit.deinit(gpa); | 391 | unit.deinit(gpa); |
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | pub fn getUnit(sec: *Section, unit: Unit.Index) *Unit { | 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 | fn resizeEntry( | 398 | fn resizeEntry( |
| ... | @@ -548,12 +548,12 @@ const Unit = struct { | ... | @@ -548,12 +548,12 @@ const Unit = struct { |
| 548 | _, | 548 | _, |
| 549 | 549 | ||
| 550 | pub fn unwrap(uio: Optional) ?Index { | 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 | fn toOptional(ui: Index) Optional { | 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,7 +577,7 @@ const Unit = struct { |
| 577 | entry_ptr.next = .none; | 577 | entry_ptr.next = .none; |
| 578 | return entry; | 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 | const entry_ptr = try unit.entries.addOne(gpa); | 581 | const entry_ptr = try unit.entries.addOne(gpa); |
| 582 | entry_ptr.* = .{ | 582 | entry_ptr.* = .{ |
| 583 | .prev = .none, | 583 | .prev = .none, |
| ... | @@ -593,7 +593,7 @@ const Unit = struct { | ... | @@ -593,7 +593,7 @@ const Unit = struct { |
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | pub fn getEntry(unit: *Unit, entry: Entry.Index) *Entry { | 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 | fn resize(unit_ptr: *Unit, sec: *Section, dwarf: *Dwarf, extra_header_len: u32, len: u32) UpdateError!void { | 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,11 +719,11 @@ const Unit = struct { |
| 719 | defer trailer_aw.deinit(); | 719 | defer trailer_aw.deinit(); |
| 720 | const tw = &trailer_aw.writer; | 720 | const tw = &trailer_aw.writer; |
| 721 | const fill_byte: u8 = if (sec == &dwarf.debug_abbrev.section) fill: { | 721 | const fill_byte: u8 = if (sec == &dwarf.debug_abbrev.section) fill: { |
| 722 | tw.writeUleb128(@intFromEnum(AbbrevCode.null)) catch unreachable; | 722 | tw.writeUleb128(@backingInt(AbbrevCode.null)) catch unreachable; |
| 723 | assert(uleb128Bytes(@intFromEnum(AbbrevCode.null)) == 1); | 723 | assert(uleb128Bytes(@backingInt(AbbrevCode.null)) == 1); |
| 724 | break :fill @intFromEnum(AbbrevCode.null); | 724 | break :fill @backingInt(AbbrevCode.null); |
| 725 | } else if (sec == &dwarf.debug_aranges.section) fill: { | 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 | break :fill 0; | 727 | break :fill 0; |
| 728 | } else if (sec == &dwarf.debug_frame.section) fill: { | 728 | } else if (sec == &dwarf.debug_frame.section) fill: { |
| 729 | switch (dwarf.debug_frame.header.format) { | 729 | switch (dwarf.debug_frame.header.format) { |
| ... | @@ -746,7 +746,7 @@ const Unit = struct { | ... | @@ -746,7 +746,7 @@ const Unit = struct { |
| 746 | } | 746 | } |
| 747 | tw.writeByte(4) catch unreachable; | 747 | tw.writeByte(4) catch unreachable; |
| 748 | tw.writeAll("\x00") catch unreachable; | 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 | tw.writeByte(0) catch unreachable; | 750 | tw.writeByte(0) catch unreachable; |
| 751 | }, | 751 | }, |
| 752 | .eh_frame => { | 752 | .eh_frame => { |
| ... | @@ -763,9 +763,9 @@ const Unit = struct { | ... | @@ -763,9 +763,9 @@ const Unit = struct { |
| 763 | tw.splatByteAll(DW.CFA.nop, unit.trailer_len - tw.end) catch unreachable; | 763 | tw.splatByteAll(DW.CFA.nop, unit.trailer_len - tw.end) catch unreachable; |
| 764 | break :fill DW.CFA.nop; | 764 | break :fill DW.CFA.nop; |
| 765 | } else if (sec == &dwarf.debug_info.section) fill: { | 765 | } else if (sec == &dwarf.debug_info.section) fill: { |
| 766 | for (0..2) |_| tw.writeUleb128(@intFromEnum(AbbrevCode.null)) catch unreachable; | 766 | for (0..2) |_| tw.writeUleb128(@backingInt(AbbrevCode.null)) catch unreachable; |
| 767 | assert(uleb128Bytes(@intFromEnum(AbbrevCode.null)) == 1); | 767 | assert(uleb128Bytes(@backingInt(AbbrevCode.null)) == 1); |
| 768 | break :fill @intFromEnum(AbbrevCode.null); | 768 | break :fill @backingInt(AbbrevCode.null); |
| 769 | } else if (sec == &dwarf.debug_rnglists.section) fill: { | 769 | } else if (sec == &dwarf.debug_rnglists.section) fill: { |
| 770 | tw.writeByte(DW.RLE.end_of_list) catch unreachable; | 770 | tw.writeByte(DW.RLE.end_of_list) catch unreachable; |
| 771 | break :fill DW.RLE.end_of_list; | 771 | break :fill DW.RLE.end_of_list; |
| ... | @@ -843,12 +843,12 @@ const Entry = struct { | ... | @@ -843,12 +843,12 @@ const Entry = struct { |
| 843 | _, | 843 | _, |
| 844 | 844 | ||
| 845 | pub fn unwrap(eio: Optional) ?Index { | 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 | fn toOptional(ei: Index) Optional { | 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,8 +880,8 @@ const Entry = struct { |
| 880 | const len = unit.getEntry(entry.next.unwrap() orelse return).off - start; | 880 | const len = unit.getEntry(entry.next.unwrap() orelse return).off - start; |
| 881 | var buf: [ | 881 | var buf: [ |
| 882 | @max( | 882 | @max( |
| 883 | uleb128Bytes(@intFromEnum(AbbrevCode.pad_1)), | 883 | uleb128Bytes(@backingInt(AbbrevCode.pad_1)), |
| 884 | uleb128Bytes(@intFromEnum(AbbrevCode.pad_n)) + uleb128Bytes(std.math.maxInt(u32)), | 884 | uleb128Bytes(@backingInt(AbbrevCode.pad_n)) + uleb128Bytes(std.math.maxInt(u32)), |
| 885 | 1 + uleb128Bytes(std.math.maxInt(u32)) + 1, | 885 | 1 + uleb128Bytes(std.math.maxInt(u32)) + 1, |
| 886 | ) | 886 | ) |
| 887 | ]u8 = undefined; | 887 | ]u8 = undefined; |
| ... | @@ -984,17 +984,17 @@ const Entry = struct { | ... | @@ -984,17 +984,17 @@ const Entry = struct { |
| 984 | defer dwarf.gpa.free(buf); | 984 | defer dwarf.gpa.free(buf); |
| 985 | _ = try dwarf.getFile().?.readPositionalAll(io, buf, sec.off(dwarf)); | 985 | _ = try dwarf.getFile().?.readPositionalAll(io, buf, sec.off(dwarf)); |
| 986 | log.info("Section{{ .first = {}, .last = {}, .off = 0x{x}, .len = 0x{x} }}", .{ | 986 | log.info("Section{{ .first = {}, .last = {}, .off = 0x{x}, .len = 0x{x} }}", .{ |
| 987 | @intFromEnum(sec.first), | 987 | @backingInt(sec.first), |
| 988 | @intFromEnum(sec.last), | 988 | @backingInt(sec.last), |
| 989 | sec.off(dwarf), | 989 | sec.off(dwarf), |
| 990 | sec.len, | 990 | sec.len, |
| 991 | }); | 991 | }); |
| 992 | for (sec.units.items) |*unit_ptr| { | 992 | for (sec.units.items) |*unit_ptr| { |
| 993 | log.info(" Unit{{ .prev = {}, .next = {}, .first = {}, .last = {}, .off = 0x{x}, .header_len = 0x{x}, .trailer_len = 0x{x}, .len = 0x{x} }}", .{ | 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), | 994 | @backingInt(unit_ptr.prev), |
| 995 | @intFromEnum(unit_ptr.next), | 995 | @backingInt(unit_ptr.next), |
| 996 | @intFromEnum(unit_ptr.first), | 996 | @backingInt(unit_ptr.first), |
| 997 | @intFromEnum(unit_ptr.last), | 997 | @backingInt(unit_ptr.last), |
| 998 | unit_ptr.off, | 998 | unit_ptr.off, |
| 999 | unit_ptr.header_len, | 999 | unit_ptr.header_len, |
| 1000 | unit_ptr.trailer_len, | 1000 | unit_ptr.trailer_len, |
| ... | @@ -1002,8 +1002,8 @@ const Entry = struct { | ... | @@ -1002,8 +1002,8 @@ const Entry = struct { |
| 1002 | }); | 1002 | }); |
| 1003 | for (unit_ptr.entries.items) |*entry| { | 1003 | for (unit_ptr.entries.items) |*entry| { |
| 1004 | log.info(" Entry{{ .prev = {}, .next = {}, .off = 0x{x}, .len = 0x{x} }}", .{ | 1004 | log.info(" Entry{{ .prev = {}, .next = {}, .off = 0x{x}, .len = 0x{x} }}", .{ |
| 1005 | @intFromEnum(entry.prev), | 1005 | @backingInt(entry.prev), |
| 1006 | @intFromEnum(entry.next), | 1006 | @backingInt(entry.next), |
| 1007 | entry.off, | 1007 | entry.off, |
| 1008 | entry.len, | 1008 | entry.len, |
| 1009 | }); | 1009 | }); |
| ... | @@ -1017,7 +1017,7 @@ const Entry = struct { | ... | @@ -1017,7 +1017,7 @@ const Entry = struct { |
| 1017 | if (entry.len > 0) return entry; | 1017 | if (entry.len > 0) return entry; |
| 1018 | if (std.debug.runtime_safety) { | 1018 | if (std.debug.runtime_safety) { |
| 1019 | log.err("missing {} from {s}", .{ | 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 | std.mem.sliceTo(if (dwarf.bin_file.cast(.elf)) |elf_file| | 1021 | std.mem.sliceTo(if (dwarf.bin_file.cast(.elf)) |elf_file| |
| 1022 | elf_file.zigObjectPtr().?.symbol(sec.index).name(elf_file) | 1022 | elf_file.zigObjectPtr().?.symbol(sec.index).name(elf_file) |
| 1023 | else if (dwarf.bin_file.cast(.macho)) |macho_file| | 1023 | else if (dwarf.bin_file.cast(.macho)) |macho_file| |
| ... | @@ -1031,19 +1031,19 @@ const Entry = struct { | ... | @@ -1031,19 +1031,19 @@ const Entry = struct { |
| 1031 | const zcu = dwarf.bin_file.comp.zcu.?; | 1031 | const zcu = dwarf.bin_file.comp.zcu.?; |
| 1032 | const ip = &zcu.intern_pool; | 1032 | const ip = &zcu.intern_pool; |
| 1033 | for (0.., dwarf.values.items) |raw_index, unit_and_entry| { | 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 | const val = index.val(&dwarf.const_pool); | 1035 | const val = index.val(&dwarf.const_pool); |
| 1036 | const val_unit, const val_entry = unit_and_entry; | 1036 | const val_unit, const val_entry = unit_and_entry; |
| 1037 | if (sec.getUnit(val_unit) == unit and unit.getEntry(val_entry) == entry) | 1037 | if (sec.getUnit(val_unit) == unit and unit.getEntry(val_entry) == entry) |
| 1038 | log.err("missing Value({f}({d}))", .{ | 1038 | log.err("missing Value({f}({d}))", .{ |
| 1039 | Value.fromInterned(val).fmtValue(.{ .tid = .main, .zcu = zcu }), | 1039 | Value.fromInterned(val).fmtValue(.{ .tid = .main, .zcu = zcu }), |
| 1040 | @intFromEnum(val), | 1040 | @backingInt(val), |
| 1041 | }); | 1041 | }); |
| 1042 | } | 1042 | } |
| 1043 | for (dwarf.navs.keys(), dwarf.navs.values()) |nav, other_entry| { | 1043 | for (dwarf.navs.keys(), dwarf.navs.values()) |nav, other_entry| { |
| 1044 | const nav_unit = dwarf.getUnit(zcu.fileByIndex(ip.getNav(nav).srcInst(ip).resolveFile(ip)).mod.?) catch unreachable; | 1044 | const nav_unit = dwarf.getUnit(zcu.fileByIndex(ip.getNav(nav).srcInst(ip).resolveFile(ip)).mod.?) catch unreachable; |
| 1045 | if (sec.getUnit(nav_unit) == unit and unit.getEntry(other_entry) == entry) | 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 | @panic("missing dwarf relocation target"); | 1049 | @panic("missing dwarf relocation target"); |
| ... | @@ -1108,7 +1108,7 @@ const Entry = struct { | ... | @@ -1108,7 +1108,7 @@ const Entry = struct { |
| 1108 | entry_off + reloc.source_off, | 1108 | entry_off + reloc.source_off, |
| 1109 | @bitCast(symbol.address(.{}, elf_file) + @as(i64, @intCast(reloc.target_off)) - | 1109 | @bitCast(symbol.address(.{}, elf_file) + @as(i64, @intCast(reloc.target_off)) - |
| 1110 | if (symbol.flags.is_tls) elf_file.dtpAddress() else 0), | 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 | } else if (dwarf.bin_file.cast(.macho)) |macho_file| { | 1114 | } else if (dwarf.bin_file.cast(.macho)) |macho_file| { |
| ... | @@ -1118,7 +1118,7 @@ const Entry = struct { | ... | @@ -1118,7 +1118,7 @@ const Entry = struct { |
| 1118 | try dwarf.resolveReloc( | 1118 | try dwarf.resolveReloc( |
| 1119 | entry_off + reloc.source_off, | 1119 | entry_off + reloc.source_off, |
| 1120 | ref.getSymbol(macho_file).?.getAddress(.{}, macho_file) + @as(i64, @intCast(reloc.target_off)), | 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,10 +1735,10 @@ pub const WipNav = struct { |
| 1735 | }; | 1735 | }; |
| 1736 | } | 1736 | } |
| 1737 | fn leaveBlockWriterError(wip_nav: *WipNav, code_off: u64) (UpdateError || Writer.Error)!void { | 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 | const block = wip_nav.blocks.pop().?; | 1739 | const block = wip_nav.blocks.pop().?; |
| 1740 | if (wip_nav.any_children) | 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 | else | 1742 | else |
| 1743 | std.leb.writeUnsignedFixed( | 1743 | std.leb.writeUnsignedFixed( |
| 1744 | block_bytes, | 1744 | block_bytes, |
| ... | @@ -1797,10 +1797,10 @@ pub const WipNav = struct { | ... | @@ -1797,10 +1797,10 @@ pub const WipNav = struct { |
| 1797 | func: InternPool.Index, | 1797 | func: InternPool.Index, |
| 1798 | code_off: u64, | 1798 | code_off: u64, |
| 1799 | ) (UpdateError || Writer.Error)!void { | 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 | const block = wip_nav.blocks.pop().?; | 1801 | const block = wip_nav.blocks.pop().?; |
| 1802 | if (wip_nav.any_children) | 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 | else | 1804 | else |
| 1805 | std.leb.writeUnsignedFixed( | 1805 | std.leb.writeUnsignedFixed( |
| 1806 | inlined_func_bytes, | 1806 | inlined_func_bytes, |
| ... | @@ -1959,7 +1959,7 @@ pub const WipNav = struct { | ... | @@ -1959,7 +1959,7 @@ pub const WipNav = struct { |
| 1959 | return @import("builtin").cpu.arch.endian(); | 1959 | return @import("builtin").cpu.arch.endian(); |
| 1960 | } | 1960 | } |
| 1961 | fn addrSym(counter: *ExprLocCounter, _: link.File.SymbolId) Writer.Error!void { | 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 | fn infoEntry(counter: *ExprLocCounter, _: Unit.Index, _: Entry.Index) Writer.Error!void { | 1964 | fn infoEntry(counter: *ExprLocCounter, _: Unit.Index, _: Entry.Index) Writer.Error!void { |
| 1965 | try counter.dw.writer.splatByteAll(undefined, counter.section_offset_bytes); | 1965 | try counter.dw.writer.splatByteAll(undefined, counter.section_offset_bytes); |
| ... | @@ -2005,7 +2005,7 @@ pub const WipNav = struct { | ... | @@ -2005,7 +2005,7 @@ pub const WipNav = struct { |
| 2005 | .target_sym = sym_index, | 2005 | .target_sym = sym_index, |
| 2006 | .target_off = sym_off, | 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 | fn frameExprLoc(wip_nav: *WipNav, loc: Loc) (UpdateError || Writer.Error)!void { | 2011 | fn frameExprLoc(wip_nav: *WipNav, loc: Loc) (UpdateError || Writer.Error)!void { |
| ... | @@ -2047,7 +2047,7 @@ pub const WipNav = struct { | ... | @@ -2047,7 +2047,7 @@ pub const WipNav = struct { |
| 2047 | .target_sym = sym_index, | 2047 | .target_sym = sym_index, |
| 2048 | .target_off = sym_off, | 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 | fn refNav( | 2053 | fn refNav( |
| ... | @@ -2073,7 +2073,7 @@ pub const WipNav = struct { | ... | @@ -2073,7 +2073,7 @@ pub const WipNav = struct { |
| 2073 | } | 2073 | } |
| 2074 | const dwarf = wip_nav.dwarf; | 2074 | const dwarf = wip_nav.dwarf; |
| 2075 | const index = try dwarf.const_pool.get(wip_nav.pt, .{ .dwarf = dwarf }, value.toIntern()); | 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 | fn refForward(wip_nav: *WipNav) (Allocator.Error || Writer.Error)!u32 { | 2079 | fn refForward(wip_nav: *WipNav) (Allocator.Error || Writer.Error)!u32 { |
| ... | @@ -2438,14 +2438,14 @@ pub fn initMetadata(dwarf: *Dwarf) UpdateError!void { | ... | @@ -2438,14 +2438,14 @@ pub fn initMetadata(dwarf: *Dwarf) UpdateError!void { |
| 2438 | assert(try dwarf.debug_abbrev.section.addUnit(DebugAbbrev.header_bytes, DebugAbbrev.trailer_bytes, dwarf) == DebugAbbrev.unit); | 2438 | assert(try dwarf.debug_abbrev.section.addUnit(DebugAbbrev.header_bytes, DebugAbbrev.trailer_bytes, dwarf) == DebugAbbrev.unit); |
| 2439 | errdefer dwarf.debug_abbrev.section.popUnit(dwarf.gpa); | 2439 | errdefer dwarf.debug_abbrev.section.popUnit(dwarf.gpa); |
| 2440 | for (std.enums.values(AbbrevCode)) |abbrev_code| | 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 | dwarf.debug_aranges.section.pad_entries_to_ideal = false; | 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 | dwarf.debug_frame.section.alignment = switch (dwarf.debug_frame.header.format) { | 2446 | dwarf.debug_frame.section.alignment = switch (dwarf.debug_frame.header.format) { |
| 2447 | .none => .@"1", | 2447 | .none => .@"1", |
| 2448 | .debug_frame => InternPool.Alignment.fromNonzeroByteUnits(@intFromEnum(dwarf.address_size)), | 2448 | .debug_frame => InternPool.Alignment.fromNonzeroByteUnits(@backingInt(dwarf.address_size)), |
| 2449 | .eh_frame => .@"4", | 2449 | .eh_frame => .@"4", |
| 2450 | }; | 2450 | }; |
| 2451 | 2451 | ||
| ... | @@ -2499,7 +2499,7 @@ fn getNavEntry( | ... | @@ -2499,7 +2499,7 @@ fn getNavEntry( |
| 2499 | 2499 | ||
| 2500 | fn getUnit(dwarf: *Dwarf, mod: *Module) !Unit.Index { | 2500 | fn getUnit(dwarf: *Dwarf, mod: *Module) !Unit.Index { |
| 2501 | const mod_gop = try dwarf.mods.getOrPut(dwarf.gpa, mod); | 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 | if (!mod_gop.found_existing) { | 2503 | if (!mod_gop.found_existing) { |
| 2504 | errdefer _ = dwarf.mods.pop(); | 2504 | errdefer _ = dwarf.mods.pop(); |
| 2505 | mod_gop.value_ptr.* = .{ | 2505 | mod_gop.value_ptr.* = .{ |
| ... | @@ -2550,15 +2550,15 @@ fn getUnit(dwarf: *Dwarf, mod: *Module) !Unit.Index { | ... | @@ -2550,15 +2550,15 @@ fn getUnit(dwarf: *Dwarf, mod: *Module) !Unit.Index { |
| 2550 | } | 2550 | } |
| 2551 | 2551 | ||
| 2552 | fn getUnitIfExists(dwarf: *const Dwarf, mod: *Module) ?Unit.Index { | 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 | fn getModInfo(dwarf: *Dwarf, unit: Unit.Index) *ModInfo { | 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 | fn getUnitModule(dwarf: *Dwarf, unit: Unit.Index) *Module { | 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 | pub fn initWipNav( | 2564 | pub fn initWipNav( |
| ... | @@ -2590,7 +2590,7 @@ fn initWipNavInner( | ... | @@ -2590,7 +2590,7 @@ fn initWipNavInner( |
| 2590 | file.sub_file_path, | 2590 | file.sub_file_path, |
| 2591 | decl.src_line + 1, | 2591 | decl.src_line + 1, |
| 2592 | decl.src_column + 1, | 2592 | decl.src_column + 1, |
| 2593 | @intFromEnum(inst_info.inst), | 2593 | @backingInt(inst_info.inst), |
| 2594 | nav.fqn.fmt(ip), | 2594 | nav.fqn.fmt(ip), |
| 2595 | }); | 2595 | }); |
| 2596 | 2596 | ||
| ... | @@ -2650,7 +2650,7 @@ fn initWipNavInner( | ... | @@ -2650,7 +2650,7 @@ fn initWipNavInner( |
| 2650 | try wip_nav.refType(.fromInterned(param_type)); | 2650 | try wip_nav.refType(.fromInterned(param_type)); |
| 2651 | } | 2651 | } |
| 2652 | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); | 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 | } else try wip_nav.infoExprLoc(.{ .addr_reloc = sym_index }); | 2655 | } else try wip_nav.infoExprLoc(.{ .addr_reloc = sym_index }); |
| 2656 | }, | 2656 | }, |
| ... | @@ -2678,7 +2678,7 @@ fn initWipNavInner( | ... | @@ -2678,7 +2678,7 @@ fn initWipNavInner( |
| 2678 | try wip_nav.refType(.fromInterned(param_type)); | 2678 | try wip_nav.refType(.fromInterned(param_type)); |
| 2679 | } | 2679 | } |
| 2680 | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); | 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,7 +2720,7 @@ fn initWipNavInner( |
| 2720 | }); | 2720 | }); |
| 2721 | try dfw.splatByteAll(0, dwarf.sectionOffsetBytes()); | 2721 | try dfw.splatByteAll(0, dwarf.sectionOffsetBytes()); |
| 2722 | try wip_nav.frameAddrSym(sym_index, 0); | 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 | .eh_frame => { | 2725 | .eh_frame => { |
| 2726 | try dfw.writeInt(u32, undefined, dwarf.endian); | 2726 | try dfw.writeInt(u32, undefined, dwarf.endian); |
| ... | @@ -2776,13 +2776,13 @@ fn initWipNavInner( | ... | @@ -2776,13 +2776,13 @@ fn initWipNavInner( |
| 2776 | 2776 | ||
| 2777 | try wip_nav.advancePCAndLine(func.lbrace_line, 0); | 2777 | try wip_nav.advancePCAndLine(func.lbrace_line, 0); |
| 2778 | } else { | 2778 | } else { |
| 2779 | try dlw.writeUleb128(1 + @intFromEnum(dwarf.address_size)); | 2779 | try dlw.writeUleb128(1 + @backingInt(dwarf.address_size)); |
| 2780 | try dlw.writeByte(DW.LNE.set_address); | 2780 | try dlw.writeByte(DW.LNE.set_address); |
| 2781 | try dwarf.debug_line.section.getUnit(wip_nav.unit).getEntry(wip_nav.entry).external_relocs.append(dwarf.gpa, .{ | 2781 | try dwarf.debug_line.section.getUnit(wip_nav.unit).getEntry(wip_nav.entry).external_relocs.append(dwarf.gpa, .{ |
| 2782 | .source_off = @intCast(dlw.end), | 2782 | .source_off = @intCast(dlw.end), |
| 2783 | .target_sym = sym_index, | 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 | const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, inst_info.file); | 2787 | const file_gop = try dwarf.getModInfo(unit).files.getOrPut(dwarf.gpa, inst_info.file); |
| 2788 | try dlw.writeByte(DW.LNS.set_file); | 2788 | try dlw.writeByte(DW.LNS.set_file); |
| ... | @@ -2872,13 +2872,13 @@ fn finishWipNavFuncWriterError( | ... | @@ -2872,13 +2872,13 @@ fn finishWipNavFuncWriterError( |
| 2872 | const external_relocs = &dwarf.debug_aranges.section.getUnit(wip_nav.unit).getEntry(wip_nav.entry).external_relocs; | 2872 | const external_relocs = &dwarf.debug_aranges.section.getUnit(wip_nav.unit).getEntry(wip_nav.entry).external_relocs; |
| 2873 | try external_relocs.append(dwarf.gpa, .{ .target_sym = wip_nav.func_sym_index }); | 2873 | try external_relocs.append(dwarf.gpa, .{ .target_sym = wip_nav.func_sym_index }); |
| 2874 | var entry: [8 + 8]u8 = undefined; | 2874 | var entry: [8 + 8]u8 = undefined; |
| 2875 | @memset(entry[0..@intFromEnum(dwarf.address_size)], 0); | 2875 | @memset(entry[0..@backingInt(dwarf.address_size)], 0); |
| 2876 | dwarf.writeInt(entry[@intFromEnum(dwarf.address_size)..][0..@intFromEnum(dwarf.address_size)], code_size); | 2876 | dwarf.writeInt(entry[@backingInt(dwarf.address_size)..][0..@backingInt(dwarf.address_size)], code_size); |
| 2877 | try dwarf.debug_aranges.section.replaceEntry( | 2877 | try dwarf.debug_aranges.section.replaceEntry( |
| 2878 | wip_nav.unit, | 2878 | wip_nav.unit, |
| 2879 | wip_nav.entry, | 2879 | wip_nav.entry, |
| 2880 | dwarf, | 2880 | dwarf, |
| 2881 | entry[0 .. @intFromEnum(dwarf.address_size) * 2], | 2881 | entry[0 .. @backingInt(dwarf.address_size) * 2], |
| 2882 | ); | 2882 | ); |
| 2883 | } | 2883 | } |
| 2884 | switch (dwarf.debug_frame.header.format) { | 2884 | switch (dwarf.debug_frame.header.format) { |
| ... | @@ -2901,7 +2901,7 @@ fn finishWipNavFuncWriterError( | ... | @@ -2901,7 +2901,7 @@ fn finishWipNavFuncWriterError( |
| 2901 | switch (format) { | 2901 | switch (format) { |
| 2902 | .none => unreachable, | 2902 | .none => unreachable, |
| 2903 | .debug_frame => dwarf.writeInt(contents[dwarf.unitLengthBytes() + dwarf.sectionOffsetBytes() + | 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 | .eh_frame => { | 2905 | .eh_frame => { |
| 2906 | std.mem.writeInt( | 2906 | std.mem.writeInt( |
| 2907 | u32, | 2907 | u32, |
| ... | @@ -2919,13 +2919,13 @@ fn finishWipNavFuncWriterError( | ... | @@ -2919,13 +2919,13 @@ fn finishWipNavFuncWriterError( |
| 2919 | std.mem.writeInt(u32, wip_nav.debug_info.written()[wip_nav.func_high_pc..][0..4], @intCast(code_size), dwarf.endian); | 2919 | std.mem.writeInt(u32, wip_nav.debug_info.written()[wip_nav.func_high_pc..][0..4], @intCast(code_size), dwarf.endian); |
| 2920 | if (wip_nav.any_children) { | 2920 | if (wip_nav.any_children) { |
| 2921 | const diw = &wip_nav.debug_info.writer; | 2921 | const diw = &wip_nav.debug_info.writer; |
| 2922 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | 2922 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); |
| 2923 | } else { | 2923 | } else { |
| 2924 | const abbrev_code_buf = wip_nav.debug_info.written()[0..AbbrevCode.decl_bytes]; | 2924 | const abbrev_code_buf = wip_nav.debug_info.written()[0..AbbrevCode.decl_bytes]; |
| 2925 | var abbrev_code_fr: std.Io.Reader = .fixed(abbrev_code_buf); | 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 | abbrev_code_fr.takeLeb128(@typeInfo(AbbrevCode).@"enum".tag_type) catch unreachable, | 2927 | abbrev_code_fr.takeLeb128(@typeInfo(AbbrevCode).@"enum".tag_type) catch unreachable, |
| 2928 | ); | 2928 | )); |
| 2929 | std.leb.writeUnsignedFixed( | 2929 | std.leb.writeUnsignedFixed( |
| 2930 | AbbrevCode.decl_bytes, | 2930 | AbbrevCode.decl_bytes, |
| 2931 | abbrev_code_buf, | 2931 | abbrev_code_buf, |
| ... | @@ -2944,7 +2944,7 @@ fn finishWipNavFuncWriterError( | ... | @@ -2944,7 +2944,7 @@ fn finishWipNavFuncWriterError( |
| 2944 | .target_sym = wip_nav.func_sym_index, | 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 | .target_sym = wip_nav.func_sym_index, | 2948 | .target_sym = wip_nav.func_sym_index, |
| 2949 | .target_off = code_size, | 2949 | .target_off = code_size, |
| 2950 | }, | 2950 | }, |
| ... | @@ -2953,7 +2953,7 @@ fn finishWipNavFuncWriterError( | ... | @@ -2953,7 +2953,7 @@ fn finishWipNavFuncWriterError( |
| 2953 | wip_nav.unit, | 2953 | wip_nav.unit, |
| 2954 | wip_nav.entry, | 2954 | wip_nav.entry, |
| 2955 | dwarf, | 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,7 +3015,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo |
| 3015 | file.sub_file_path, | 3015 | file.sub_file_path, |
| 3016 | decl.src_line + 1, | 3016 | decl.src_line + 1, |
| 3017 | decl.src_column + 1, | 3017 | decl.src_column + 1, |
| 3018 | @intFromEnum(inst_info.inst), | 3018 | @backingInt(inst_info.inst), |
| 3019 | nav.fqn.fmt(ip), | 3019 | nav.fqn.fmt(ip), |
| 3020 | }); | 3020 | }); |
| 3021 | 3021 | ||
| ... | @@ -3248,7 +3248,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo | ... | @@ -3248,7 +3248,7 @@ fn updateComptimeNavInner(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPoo |
| 3248 | try wip_nav.refType(.fromInterned(func_type.param_types.get(ip)[param_index])); | 3248 | try wip_nav.refType(.fromInterned(func_type.param_types.get(ip)[param_index])); |
| 3249 | } | 3249 | } |
| 3250 | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); | 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 | .func_alias => |owner_nav| { | 3254 | .func_alias => |owner_nav| { |
| ... | @@ -3305,7 +3305,7 @@ fn addConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, index: link.ConstPool.Index, | ... | @@ -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 | try dwarf.values.append(dwarf.gpa, .{ unit, entry }); | 3309 | try dwarf.values.append(dwarf.gpa, .{ unit, entry }); |
| 3310 | } | 3310 | } |
| 3311 | /// Should only be called by the `link.ConstPool` implementation. | 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,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 | for ([_]*Section{ | 3337 | for ([_]*Section{ |
| 3338 | &dwarf.debug_aranges.section, | 3338 | &dwarf.debug_aranges.section, |
| ... | @@ -3501,7 +3501,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -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 | for ([_]*Section{ | 3506 | for ([_]*Section{ |
| 3507 | &dwarf.debug_aranges.section, | 3507 | &dwarf.debug_aranges.section, |
| ... | @@ -3556,7 +3556,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -3556,7 +3556,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3556 | try wip_nav.strpFmt("{f}", .{val.toType().fmt(pt)}); | 3556 | try wip_nav.strpFmt("{f}", .{val.toType().fmt(pt)}); |
| 3557 | if (ptr_type.sentinel != .none) try wip_nav.blockValue(.fromInterned(ptr_type.sentinel)); | 3557 | if (ptr_type.sentinel != .none) try wip_nav.blockValue(.fromInterned(ptr_type.sentinel)); |
| 3558 | if (ptr_type.flags.alignment.toByteUnits()) |a| try diw.writeUleb128(a); | 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 | if (ptr_type.flags.is_const or ptr_type.flags.is_volatile) try wip_nav.infoSectionOffset( | 3560 | if (ptr_type.flags.is_const or ptr_type.flags.is_volatile) try wip_nav.infoSectionOffset( |
| 3561 | .debug_info, | 3561 | .debug_info, |
| 3562 | wip_nav.unit, | 3562 | wip_nav.unit, |
| ... | @@ -3592,7 +3592,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -3592,7 +3592,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3592 | const len_field_type: Type = .usize; | 3592 | const len_field_type: Type = .usize; |
| 3593 | try wip_nav.refType(len_field_type); | 3593 | try wip_nav.refType(len_field_type); |
| 3594 | try diw.writeUleb128(len_field_type.abiAlignment(zcu).forward(ptr_field_type.abiSize(zcu))); | 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 | .array_type => |array_type| { | 3598 | .array_type => |array_type| { |
| ... | @@ -3604,7 +3604,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -3604,7 +3604,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3604 | try wip_nav.abbrevCode(.array_len); | 3604 | try wip_nav.abbrevCode(.array_len); |
| 3605 | try wip_nav.refType(.usize); | 3605 | try wip_nav.refType(.usize); |
| 3606 | try diw.writeUleb128(array_type.len); | 3606 | try diw.writeUleb128(array_type.len); |
| 3607 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | 3607 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); |
| 3608 | }, | 3608 | }, |
| 3609 | .vector_type => |vector_type| { | 3609 | .vector_type => |vector_type| { |
| 3610 | try wip_nav.abbrevCode(.vector_type); | 3610 | try wip_nav.abbrevCode(.vector_type); |
| ... | @@ -3613,7 +3613,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -3613,7 +3613,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3613 | try wip_nav.abbrevCode(.array_len); | 3613 | try wip_nav.abbrevCode(.array_len); |
| 3614 | try wip_nav.refType(.usize); | 3614 | try wip_nav.refType(.usize); |
| 3615 | try diw.writeUleb128(vector_type.len); | 3615 | try diw.writeUleb128(vector_type.len); |
| 3616 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | 3616 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); |
| 3617 | }, | 3617 | }, |
| 3618 | .opt_type => |opt_child_type_index| { | 3618 | .opt_type => |opt_child_type_index| { |
| 3619 | const opt_child_type: Type = .fromInterned(opt_child_type_index); | 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,7 +3671,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3671 | try wip_nav.refType(.null); | 3671 | try wip_nav.refType(.null); |
| 3672 | try diw.writeUleb128(0); | 3672 | try diw.writeUleb128(0); |
| 3673 | } | 3673 | } |
| 3674 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | 3674 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); |
| 3675 | 3675 | ||
| 3676 | try wip_nav.abbrevCode(.tagged_union_default_field); | 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,12 +3680,12 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3680 | try wip_nav.refType(opt_child_type); | 3680 | try wip_nav.refType(opt_child_type); |
| 3681 | try diw.writeUleb128(0); | 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 | .anyframe_type => unreachable, | 3690 | .anyframe_type => unreachable, |
| 3691 | .error_union_type => |error_union_type| { | 3691 | .error_union_type => |error_union_type| { |
| ... | @@ -3736,7 +3736,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -3736,7 +3736,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3736 | try wip_nav.refType(error_union_payload_type); | 3736 | try wip_nav.refType(error_union_payload_type); |
| 3737 | try diw.writeUleb128(error_union_payload_offset); | 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 | try wip_nav.abbrevCode(.tagged_union_default_field); | 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,11 +3745,11 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3745 | try wip_nav.refType(error_union_error_set_type); | 3745 | try wip_nav.refType(error_union_error_set_type); |
| 3746 | try diw.writeUleb128(error_union_error_set_offset); | 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 | .simple_type => |simple_type| switch (simple_type) { | 3754 | .simple_type => |simple_type| switch (simple_type) { |
| 3755 | .f16, | 3755 | .f16, |
| ... | @@ -3850,7 +3850,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -3850,7 +3850,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3850 | else if (has_runtime_bits) | 3850 | else if (has_runtime_bits) |
| 3851 | try wip_nav.blockValue(.fromInterned(comptime_value)); | 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 | .struct_type => { | 3855 | .struct_type => { |
| 3856 | const loaded_struct = ip.loadStructType(value_index); | 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,7 +3937,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3937 | else if (has_runtime_bits) | 3937 | else if (has_runtime_bits) |
| 3938 | try wip_nav.blockValue(.fromInterned(field_init)); | 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 | .@"packed" => { | 3943 | .@"packed" => { |
| ... | @@ -3968,7 +3968,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -3968,7 +3968,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3968 | try diw.writeUleb128(field_bit_offset); | 3968 | try diw.writeUleb128(field_bit_offset); |
| 3969 | field_bit_offset += @intCast(field_type.bitSize(zcu)); | 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,10 +4024,10 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4024 | try diw.writeUleb128(loaded_union.field_aligns.getOrNone(ip, field_index).toByteUnits() orelse | 4024 | try diw.writeUleb128(loaded_union.field_aligns.getOrNone(ip, field_index).toByteUnits() orelse |
| 4025 | if (field_type.isNoReturn(zcu)) 1 else field_type.abiAlignment(zcu).toByteUnits().?); | 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 | } else for (0..loaded_union.field_types.len) |field_index| { | 4031 | } else for (0..loaded_union.field_types.len) |field_index| { |
| 4032 | try wip_nav.abbrevCode(.field); | 4032 | try wip_nav.abbrevCode(.field); |
| 4033 | try wip_nav.strp(loaded_tag.field_names.get(ip)[field_index].toSlice(ip)); | 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,7 +4037,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4037 | try diw.writeUleb128(loaded_union.field_aligns.getOrNone(ip, field_index).toByteUnits() orelse | 4037 | try diw.writeUleb128(loaded_union.field_aligns.getOrNone(ip, field_index).toByteUnits() orelse |
| 4038 | if (field_type.isNoReturn(zcu)) 1 else field_type.abiAlignment(zcu).toByteUnits().?); | 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 | .@"packed" => { | 4042 | .@"packed" => { |
| 4043 | const need_terminator: bool = if (loaded_union.name_nav.unwrap()) |nav_index| t: { | 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,7 +4064,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4064 | try wip_nav.refType(.fromInterned(loaded_union.field_types.get(ip)[field_index])); | 4064 | try wip_nav.refType(.fromInterned(loaded_union.field_types.get(ip)[field_index])); |
| 4065 | try diw.writeUleb128(0); | 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,7 +4098,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4098 | try wip_nav.enumConstValue(loaded_enum, field_index); | 4098 | try wip_nav.enumConstValue(loaded_enum, field_index); |
| 4099 | try wip_nav.strp(loaded_enum.field_names.get(ip)[field_index].toSlice(ip)); | 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 | } else { | 4102 | } else { |
| 4103 | assert(loaded_enum.owner_union != .none); | 4103 | assert(loaded_enum.owner_union != .none); |
| 4104 | try wip_nav.abbrevCode(if (loaded_enum.field_names.len == 0) .generated_empty_enum_type else .generated_enum_type); | 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,7 +4109,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4109 | try wip_nav.enumConstValue(loaded_enum, field_index); | 4109 | try wip_nav.enumConstValue(loaded_enum, field_index); |
| 4110 | try wip_nav.strp(loaded_enum.field_names.get(ip)[field_index].toSlice(ip)); | 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 | .opaque_type => { | 4115 | .opaque_type => { |
| ... | @@ -4204,7 +4204,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -4204,7 +4204,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4204 | else => .nocall, | 4204 | else => .nocall, |
| 4205 | }; | 4205 | }; |
| 4206 | }; | 4206 | }; |
| 4207 | try diw.writeByte(@intFromEnum(cc)); | 4207 | try diw.writeByte(@backingInt(cc)); |
| 4208 | try wip_nav.refType(.fromInterned(func_type.return_type)); | 4208 | try wip_nav.refType(.fromInterned(func_type.return_type)); |
| 4209 | if (!is_nullary) { | 4209 | if (!is_nullary) { |
| 4210 | for (0..func_type.param_types.len) |param_index| { | 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,7 +4212,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4212 | try wip_nav.refType(.fromInterned(func_type.param_types.get(ip)[param_index])); | 4212 | try wip_nav.refType(.fromInterned(func_type.param_types.get(ip)[param_index])); |
| 4213 | } | 4213 | } |
| 4214 | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); | 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 | .error_set_type => |error_set_type| { | 4218 | .error_set_type => |error_set_type| { |
| ... | @@ -4229,7 +4229,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -4229,7 +4229,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4229 | try diw.writeUleb128(ip.getErrorValueIfExists(field_name).?); | 4229 | try diw.writeUleb128(ip.getErrorValueIfExists(field_name).?); |
| 4230 | try wip_nav.strp(field_name.toSlice(ip)); | 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 | .inferred_error_set_type => |func| { | 4234 | .inferred_error_set_type => |func| { |
| 4235 | try wip_nav.abbrevCode(.inferred_error_set_type); | 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,7 +4311,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4311 | try diw.writeUleb128(err_bytes.len); | 4311 | try diw.writeUleb128(err_bytes.len); |
| 4312 | try diw.writeAll(err_bytes); | 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 | .enum_literal => |enum_literal| { | 4316 | .enum_literal => |enum_literal| { |
| 4317 | try wip_nav.abbrevCode(.comptime_value); | 4317 | try wip_nav.abbrevCode(.comptime_value); |
| ... | @@ -4459,7 +4459,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -4459,7 +4459,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4459 | try wip_nav.strp(field_name); | 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 | .slice => |slice| { | 4465 | .slice => |slice| { |
| ... | @@ -4475,7 +4475,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co | ... | @@ -4475,7 +4475,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4475 | try wip_nav.strp("len"); | 4475 | try wip_nav.strp("len"); |
| 4476 | try wip_nav.blockValue(.fromInterned(slice.len)); | 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 | .opt => |opt| { | 4480 | .opt => |opt| { |
| 4481 | const opt_child_type: Type = .fromInterned(ip.indexToKey(opt.ty).opt_type); | 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,7 +4505,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4505 | else | 4505 | else |
| 4506 | try wip_nav.blockValue(.fromInterned(opt.val)); | 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 | .aggregate => |aggregate| { | 4510 | .aggregate => |aggregate| { |
| 4511 | try wip_nav.abbrevCode(.aggregate_undefined_comptime_value); | 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,7 +4586,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4586 | }, | 4586 | }, |
| 4587 | else => unreachable, | 4587 | else => unreachable, |
| 4588 | } | 4588 | } |
| 4589 | try diw.writeUleb128(@intFromEnum(AbbrevCode.null)); | 4589 | try diw.writeUleb128(@backingInt(AbbrevCode.null)); |
| 4590 | }, | 4590 | }, |
| 4591 | .un => |un| { | 4591 | .un => |un| { |
| 4592 | try wip_nav.abbrevCode(.aggregate_undefined_comptime_value); | 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,7 +4611,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4611 | else if (has_runtime_bits) | 4611 | else if (has_runtime_bits) |
| 4612 | try wip_nav.blockValue(.fromInterned(un.val)); | 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 | .memoized_call => unreachable, // not a value | 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,7 +4644,7 @@ pub fn updateLineNumber(dwarf: *Dwarf, zcu: *Zcu, zir_index: InternPool.TrackedI |
| 4644 | file.sub_file_path, | 4644 | file.sub_file_path, |
| 4645 | decl.src_line + 1, | 4645 | decl.src_line + 1, |
| 4646 | decl.src_column + 1, | 4646 | decl.src_column + 1, |
| 4647 | @intFromEnum(inst_info.inst), | 4647 | @backingInt(inst_info.inst), |
| 4648 | file.zir.?.nullTerminatedString(decl.name), | 4648 | file.zir.?.nullTerminatedString(decl.name), |
| 4649 | }); | 4649 | }); |
| 4650 | 4650 | ||
| ... | @@ -4666,19 +4666,19 @@ fn refAbbrevCode( | ... | @@ -4666,19 +4666,19 @@ fn refAbbrevCode( |
| 4666 | abbrev_code: AbbrevCode, | 4666 | abbrev_code: AbbrevCode, |
| 4667 | ) (UpdateError || Writer.Error)!@typeInfo(AbbrevCode).@"enum".tag_type { | 4667 | ) (UpdateError || Writer.Error)!@typeInfo(AbbrevCode).@"enum".tag_type { |
| 4668 | assert(abbrev_code != .null); | 4668 | assert(abbrev_code != .null); |
| 4669 | const entry: Entry.Index = @enumFromInt(@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 @intFromEnum(abbrev_code); | 4670 | if (dwarf.debug_abbrev.section.getUnit(DebugAbbrev.unit).getEntry(entry).len > 0) return @backingInt(abbrev_code); |
| 4671 | var debug_abbrev_aw: Writer.Allocating = .init(dwarf.gpa); | 4671 | var debug_abbrev_aw: Writer.Allocating = .init(dwarf.gpa); |
| 4672 | defer debug_abbrev_aw.deinit(); | 4672 | defer debug_abbrev_aw.deinit(); |
| 4673 | const daw = &debug_abbrev_aw.writer; | 4673 | const daw = &debug_abbrev_aw.writer; |
| 4674 | const abbrev = AbbrevCode.abbrevs.get(abbrev_code); | 4674 | const abbrev = AbbrevCode.abbrevs.get(abbrev_code); |
| 4675 | try daw.writeUleb128(@intFromEnum(abbrev_code)); | 4675 | try daw.writeUleb128(@backingInt(abbrev_code)); |
| 4676 | try daw.writeUleb128(@intFromEnum(abbrev.tag)); | 4676 | try daw.writeUleb128(@backingInt(abbrev.tag)); |
| 4677 | try daw.writeByte(if (abbrev.children) DW.CHILDREN.yes else DW.CHILDREN.no); | 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 | for (0..2) |_| try daw.writeUleb128(0); | 4679 | for (0..2) |_| try daw.writeUleb128(0); |
| 4680 | try dwarf.debug_abbrev.section.replaceEntry(DebugAbbrev.unit, entry, dwarf, debug_abbrev_aw.written()); | 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 | pub fn flush(dwarf: *Dwarf, pt: Zcu.PerThread) UpdateError!void { | 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,7 +4696,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4696 | // Update `anyerror` based on the finished global error set. | 4696 | // Update `anyerror` based on the finished global error set. |
| 4697 | { | 4697 | { |
| 4698 | const index = try dwarf.const_pool.get(pt, .{ .dwarf = dwarf }, .anyerror_type); | 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 | var wip_nav: WipNav = .{ | 4700 | var wip_nav: WipNav = .{ |
| 4701 | .dwarf = dwarf, | 4701 | .dwarf = dwarf, |
| 4702 | .pt = pt, | 4702 | .pt = pt, |
| ... | @@ -4728,7 +4728,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err | ... | @@ -4728,7 +4728,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4728 | try diw.writeUleb128(value); | 4728 | try diw.writeUleb128(value); |
| 4729 | try wip_nav.strp(name.toSlice(ip)); | 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 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); | 4732 | try dwarf.debug_info.section.replaceEntry(wip_nav.unit, wip_nav.entry, dwarf, wip_nav.debug_info.written()); |
| 4733 | try dwarf.const_pool.flushPending(pt, .{ .dwarf = dwarf }); | 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,7 +4744,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4744 | const hw = &header_aw.writer; | 4744 | const hw = &header_aw.writer; |
| 4745 | if (dwarf.debug_aranges.section.dirty) { | 4745 | if (dwarf.debug_aranges.section.dirty) { |
| 4746 | for (dwarf.debug_aranges.section.units.items, 0..) |*unit_ptr, unit_index| { | 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 | unit_ptr.clear(); | 4748 | unit_ptr.clear(); |
| 4749 | try unit_ptr.cross_section_relocs.ensureTotalCapacity(dwarf.gpa, 1); | 4749 | try unit_ptr.cross_section_relocs.ensureTotalCapacity(dwarf.gpa, 1); |
| 4750 | header_aw.clearRetainingCapacity(); | 4750 | header_aw.clearRetainingCapacity(); |
| ... | @@ -4767,7 +4767,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err | ... | @@ -4767,7 +4767,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4767 | .target_unit = unit, | 4767 | .target_unit = unit, |
| 4768 | }); | 4768 | }); |
| 4769 | hw.splatByteAll(0, dwarf.sectionOffsetBytes()) catch unreachable; | 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 | hw.writeByte(0) catch unreachable; | 4771 | hw.writeByte(0) catch unreachable; |
| 4772 | hw.splatByteAll(0, unit_ptr.header_len - hw.end) catch unreachable; | 4772 | hw.splatByteAll(0, unit_ptr.header_len - hw.end) catch unreachable; |
| 4773 | try unit_ptr.replaceHeader(&dwarf.debug_aranges.section, dwarf, header_aw.written()); | 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,7 +4820,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4820 | } | 4820 | } |
| 4821 | if (dwarf.debug_info.section.dirty) { | 4821 | if (dwarf.debug_info.section.dirty) { |
| 4822 | for (dwarf.mods.keys(), dwarf.mods.values(), dwarf.debug_info.section.units.items, 0..) |mod, mod_info, *unit_ptr, unit_index| { | 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 | unit_ptr.clear(); | 4824 | unit_ptr.clear(); |
| 4825 | try unit_ptr.cross_unit_relocs.ensureTotalCapacity(dwarf.gpa, 1); | 4825 | try unit_ptr.cross_unit_relocs.ensureTotalCapacity(dwarf.gpa, 1); |
| 4826 | try unit_ptr.cross_section_relocs.ensureTotalCapacity(dwarf.gpa, 7); | 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,7 +4839,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4839 | } | 4839 | } |
| 4840 | hw.writeInt(u16, 5, dwarf.endian) catch unreachable; | 4840 | hw.writeInt(u16, 5, dwarf.endian) catch unreachable; |
| 4841 | hw.writeByte(DW.UT.compile) catch unreachable; | 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 | unit_ptr.cross_section_relocs.appendAssumeCapacity(.{ | 4843 | unit_ptr.cross_section_relocs.appendAssumeCapacity(.{ |
| 4844 | .source_off = @intCast(hw.end), | 4844 | .source_off = @intCast(hw.end), |
| 4845 | .target_sec = .debug_abbrev, | 4845 | .target_sec = .debug_abbrev, |
| ... | @@ -4938,7 +4938,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err | ... | @@ -4938,7 +4938,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4938 | }, | 4938 | }, |
| 4939 | } | 4939 | } |
| 4940 | hw.writeInt(u16, 5, dwarf.endian) catch unreachable; | 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 | hw.writeByte(0) catch unreachable; | 4942 | hw.writeByte(0) catch unreachable; |
| 4943 | switch (dwarf.format) { | 4943 | switch (dwarf.format) { |
| 4944 | .@"32" => hw.writeInt(u32, @intCast(unit.header_len - hw.end - 4), dwarf.endian) catch unreachable, | 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,7 +4986,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 4986 | hw.writeUleb128(DW.LNCT.path) catch unreachable; | 4986 | hw.writeUleb128(DW.LNCT.path) catch unreachable; |
| 4987 | hw.writeUleb128(DW.FORM.line_strp) catch unreachable; | 4987 | hw.writeUleb128(DW.FORM.line_strp) catch unreachable; |
| 4988 | hw.writeUleb128(DW.LNCT.directory_index) catch unreachable; | 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 | hw.writeUleb128(DW.LNCT.LLVM_source) catch unreachable; | 4990 | hw.writeUleb128(DW.LNCT.LLVM_source) catch unreachable; |
| 4991 | hw.writeUleb128(DW.FORM.line_strp) catch unreachable; | 4991 | hw.writeUleb128(DW.FORM.line_strp) catch unreachable; |
| 4992 | hw.writeUleb128(mod_info.files.count()) catch unreachable; | 4992 | hw.writeUleb128(mod_info.files.count()) catch unreachable; |
| ... | @@ -5046,7 +5046,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err | ... | @@ -5046,7 +5046,7 @@ fn flushWriterError(dwarf: *Dwarf, pt: Zcu.PerThread) (UpdateError || Writer.Err |
| 5046 | }, | 5046 | }, |
| 5047 | } | 5047 | } |
| 5048 | hw.writeInt(u16, 5, dwarf.endian) catch unreachable; | 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 | hw.writeByte(0) catch unreachable; | 5050 | hw.writeByte(0) catch unreachable; |
| 5051 | hw.writeInt(u32, 1, dwarf.endian) catch unreachable; | 5051 | hw.writeInt(u32, 1, dwarf.endian) catch unreachable; |
| 5052 | switch (dwarf.format) { | 5052 | switch (dwarf.format) { |
| ... | @@ -5238,11 +5238,11 @@ const AbbrevCode = enum { | ... | @@ -5238,11 +5238,11 @@ const AbbrevCode = enum { |
| 5238 | comptime_value_elem_runtime_bits, | 5238 | comptime_value_elem_runtime_bits, |
| 5239 | comptime_value_elem_comptime_state, | 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 | comptime { | 5242 | comptime { |
| 5243 | assert(uleb128Bytes(@intFromEnum(AbbrevCode.pad_1)) == 1); | 5243 | assert(uleb128Bytes(@backingInt(AbbrevCode.pad_1)) == 1); |
| 5244 | assert(uleb128Bytes(@intFromEnum(AbbrevCode.pad_n)) == 1); | 5244 | assert(uleb128Bytes(@backingInt(AbbrevCode.pad_n)) == 1); |
| 5245 | assert(uleb128Bytes(@intFromEnum(AbbrevCode.decl_alias)) == decl_bytes); | 5245 | assert(uleb128Bytes(@backingInt(AbbrevCode.decl_alias)) == decl_bytes); |
| 5246 | } | 5246 | } |
| 5247 | 5247 | ||
| 5248 | const Attr = struct { | 5248 | const Attr = struct { |
src/link/Elf.zig+12-12| ... | @@ -135,12 +135,12 @@ const OptionalProgramHeaderIndex = enum(u16) { | ... | @@ -135,12 +135,12 @@ const OptionalProgramHeaderIndex = enum(u16) { |
| 135 | 135 | ||
| 136 | fn unwrap(i: OptionalProgramHeaderIndex) ?ProgramHeaderIndex { | 136 | fn unwrap(i: OptionalProgramHeaderIndex) ?ProgramHeaderIndex { |
| 137 | if (i == .none) return null; | 137 | if (i == .none) return null; |
| 138 | return @enumFromInt(@intFromEnum(i)); | 138 | return @fromBackingInt(@intCast(@backingInt(i))); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | fn int(i: OptionalProgramHeaderIndex) ?u16 { | 141 | fn int(i: OptionalProgramHeaderIndex) ?u16 { |
| 142 | if (i == .none) return null; | 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,13 +148,13 @@ const ProgramHeaderIndex = enum(u16) { |
| 148 | _, | 148 | _, |
| 149 | 149 | ||
| 150 | fn toOptional(i: ProgramHeaderIndex) OptionalProgramHeaderIndex { | 150 | fn toOptional(i: ProgramHeaderIndex) OptionalProgramHeaderIndex { |
| 151 | const result: OptionalProgramHeaderIndex = @enumFromInt(@intFromEnum(i)); | 151 | const result: OptionalProgramHeaderIndex = @fromBackingInt(@intCast(@backingInt(i))); |
| 152 | assert(result != .none); | 152 | assert(result != .none); |
| 153 | return result; | 153 | return result; |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | fn int(i: ProgramHeaderIndex) u16 { | 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,7 +1531,7 @@ pub fn writeElfHeader(self: *Elf) !void { |
| 1531 | hdr_buf[index] = 1; // ELF version | 1531 | hdr_buf[index] = 1; // ELF version |
| 1532 | index += 1; | 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 | .amdgcn => switch (target.os.tag) { | 1535 | .amdgcn => switch (target.os.tag) { |
| 1536 | .amdhsa => .AMDGPU_HSA, | 1536 | .amdhsa => .AMDGPU_HSA, |
| 1537 | .amdpal => .AMDGPU_PAL, | 1537 | .amdpal => .AMDGPU_PAL, |
| ... | @@ -1566,11 +1566,11 @@ pub fn writeElfHeader(self: *Elf) !void { | ... | @@ -1566,11 +1566,11 @@ pub fn writeElfHeader(self: *Elf) !void { |
| 1566 | .dynamic => .DYN, | 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 | index += 2; | 1570 | index += 2; |
| 1571 | 1571 | ||
| 1572 | const machine = target.toElfMachine(); | 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 | index += 2; | 1574 | index += 2; |
| 1575 | 1575 | ||
| 1576 | // ELF Version, again | 1576 | // ELF Version, again |
| ... | @@ -2314,13 +2314,13 @@ fn sortPhdrs( | ... | @@ -2314,13 +2314,13 @@ fn sortPhdrs( |
| 2314 | 2314 | ||
| 2315 | inline for (@typeInfo(ProgramHeaderIndexes).@"struct".field_names) |field_name| { | 2315 | inline for (@typeInfo(ProgramHeaderIndexes).@"struct".field_names) |field_name| { |
| 2316 | if (@field(special_indexes, field_name).int()) |special_index| { | 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 | for (section_indexes) |*opt_phndx| { | 2321 | for (section_indexes) |*opt_phndx| { |
| 2322 | if (opt_phndx.int()) |index| { | 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,7 +3398,7 @@ fn getPhdr(self: *Elf, opts: struct { |
| 3398 | if (phndx == index) continue; | 3398 | if (phndx == index) continue; |
| 3399 | } | 3399 | } |
| 3400 | if (phdr.p_type == opts.type and phdr.p_flags == opts.flags) | 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 | return .none; | 3403 | return .none; |
| 3404 | } | 3404 | } |
| ... | @@ -3413,7 +3413,7 @@ fn addPhdr(self: *Elf, opts: struct { | ... | @@ -3413,7 +3413,7 @@ fn addPhdr(self: *Elf, opts: struct { |
| 3413 | memsz: u64 = 0, | 3413 | memsz: u64 = 0, |
| 3414 | }) error{OutOfMemory}!ProgramHeaderIndex { | 3414 | }) error{OutOfMemory}!ProgramHeaderIndex { |
| 3415 | const gpa = self.base.comp.gpa; | 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 | try self.phdrs.append(gpa, .{ | 3417 | try self.phdrs.append(gpa, .{ |
| 3418 | .p_type = opts.type, | 3418 | .p_type = opts.type, |
| 3419 | .p_flags = opts.flags, | 3419 | .p_flags = opts.flags, |
| ... | @@ -4345,7 +4345,7 @@ fn createThunks(elf_file: *Elf, atom_list: *AtomList) !void { | ... | @@ -4345,7 +4345,7 @@ fn createThunks(elf_file: *Elf, atom_list: *AtomList) !void { |
| 4345 | for (atom_ptr.relocs(elf_file)) |rel| { | 4345 | for (atom_ptr.relocs(elf_file)) |rel| { |
| 4346 | const is_reachable = switch (cpu_arch) { | 4346 | const is_reachable = switch (cpu_arch) { |
| 4347 | .aarch64, .aarch64_be => r: { | 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 | if (r_type != .CALL26 and r_type != .JUMP26) break :r true; | 4349 | if (r_type != .CALL26 and r_type != .JUMP26) break :r true; |
| 4350 | const target_ref = file_ptr.resolveSymbol(rel.r_sym(), elf_file); | 4350 | const target_ref = file_ptr.resolveSymbol(rel.r_sym(), elf_file); |
| 4351 | const target = elf_file.symbol(target_ref).?; | 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,7 +288,7 @@ pub fn scanRelocsRequiresCode(self: Atom, elf_file: *Elf) bool { |
| 288 | for (self.relocs(elf_file)) |rel| { | 288 | for (self.relocs(elf_file)) |rel| { |
| 289 | switch (cpu_arch) { | 289 | switch (cpu_arch) { |
| 290 | .x86_64 => { | 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 | if (r_type == .GOTTPOFF) return true; | 292 | if (r_type == .GOTTPOFF) return true; |
| 293 | }, | 293 | }, |
| 294 | else => {}, | 294 | else => {}, |
| ... | @@ -950,7 +950,7 @@ const x86_64 = struct { | ... | @@ -950,7 +950,7 @@ const x86_64 = struct { |
| 950 | const is_static = elf_file.base.isStatic(); | 950 | const is_static = elf_file.base.isStatic(); |
| 951 | const is_dyn_lib = elf_file.isEffectivelyDynLib(); | 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 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; | 954 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; |
| 955 | 955 | ||
| 956 | switch (r_type) { | 956 | switch (r_type) { |
| ... | @@ -1062,7 +1062,7 @@ const x86_64 = struct { | ... | @@ -1062,7 +1062,7 @@ const x86_64 = struct { |
| 1062 | dev.check(.x86_64_backend); | 1062 | dev.check(.x86_64_backend); |
| 1063 | const t = &elf_file.base.comp.root_mod.resolved_target.result; | 1063 | const t = &elf_file.base.comp.root_mod.resolved_target.result; |
| 1064 | const diags = &elf_file.base.comp.link_diags; | 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 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; | 1066 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; |
| 1067 | 1067 | ||
| 1068 | const P, const A, const S, const GOT, const G, const TP, const DTP = args; | 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,7 +1201,7 @@ const x86_64 = struct { |
| 1201 | code: []u8, | 1201 | code: []u8, |
| 1202 | ) !void { | 1202 | ) !void { |
| 1203 | dev.check(.x86_64_backend); | 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 | _, const A, const S, const GOT, _, _, const DTP = args; | 1206 | _, const A, const S, const GOT, _, _, const DTP = args; |
| 1207 | 1207 | ||
| ... | @@ -1282,7 +1282,7 @@ const x86_64 = struct { | ... | @@ -1282,7 +1282,7 @@ const x86_64 = struct { |
| 1282 | dev.check(.x86_64_backend); | 1282 | dev.check(.x86_64_backend); |
| 1283 | assert(rels.len == 2); | 1283 | assert(rels.len == 2); |
| 1284 | const diags = &elf_file.base.comp.link_diags; | 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 | switch (rel) { | 1286 | switch (rel) { |
| 1287 | .PC32, | 1287 | .PC32, |
| 1288 | .PLT32, | 1288 | .PLT32, |
| ... | @@ -1322,7 +1322,7 @@ const x86_64 = struct { | ... | @@ -1322,7 +1322,7 @@ const x86_64 = struct { |
| 1322 | dev.check(.x86_64_backend); | 1322 | dev.check(.x86_64_backend); |
| 1323 | assert(rels.len == 2); | 1323 | assert(rels.len == 2); |
| 1324 | const diags = &elf_file.base.comp.link_diags; | 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 | switch (rel) { | 1326 | switch (rel) { |
| 1327 | .PC32, | 1327 | .PC32, |
| 1328 | .PLT32, | 1328 | .PLT32, |
| ... | @@ -1428,7 +1428,7 @@ const x86_64 = struct { | ... | @@ -1428,7 +1428,7 @@ const x86_64 = struct { |
| 1428 | dev.check(.x86_64_backend); | 1428 | dev.check(.x86_64_backend); |
| 1429 | assert(rels.len == 2); | 1429 | assert(rels.len == 2); |
| 1430 | const diags = &elf_file.base.comp.link_diags; | 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 | switch (rel) { | 1432 | switch (rel) { |
| 1433 | .PC32, | 1433 | .PC32, |
| 1434 | .PLT32, | 1434 | .PLT32, |
| ... | @@ -1493,7 +1493,7 @@ const aarch64 = struct { | ... | @@ -1493,7 +1493,7 @@ const aarch64 = struct { |
| 1493 | _ = code; | 1493 | _ = code; |
| 1494 | _ = it; | 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 | const is_dyn_lib = elf_file.isEffectivelyDynLib(); | 1497 | const is_dyn_lib = elf_file.isEffectivelyDynLib(); |
| 1498 | 1498 | ||
| 1499 | switch (r_type) { | 1499 | switch (r_type) { |
| ... | @@ -1571,7 +1571,7 @@ const aarch64 = struct { | ... | @@ -1571,7 +1571,7 @@ const aarch64 = struct { |
| 1571 | _ = it; | 1571 | _ = it; |
| 1572 | 1572 | ||
| 1573 | const diags = &elf_file.base.comp.link_diags; | 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 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; | 1575 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; |
| 1576 | const code = code_buffer[r_offset..][0..4]; | 1576 | const code = code_buffer[r_offset..][0..4]; |
| 1577 | const file_ptr = atom.file(elf_file).?; | 1577 | const file_ptr = atom.file(elf_file).?; |
| ... | @@ -1742,7 +1742,7 @@ const aarch64 = struct { | ... | @@ -1742,7 +1742,7 @@ const aarch64 = struct { |
| 1742 | args: ResolveArgs, | 1742 | args: ResolveArgs, |
| 1743 | code: []u8, | 1743 | code: []u8, |
| 1744 | ) !void { | 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 | _, const A, const S, _, _, _, _ = args; | 1747 | _, const A, const S, _, _, _, _ = args; |
| 1748 | 1748 | ||
| ... | @@ -1773,7 +1773,7 @@ const riscv = struct { | ... | @@ -1773,7 +1773,7 @@ const riscv = struct { |
| 1773 | _ = code; | 1773 | _ = code; |
| 1774 | _ = it; | 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 | switch (r_type) { | 1778 | switch (r_type) { |
| 1779 | .@"32" => try atom.scanReloc(symbol, rel, absRelocAction(symbol, elf_file), elf_file), | 1779 | .@"32" => try atom.scanReloc(symbol, rel, absRelocAction(symbol, elf_file), elf_file), |
| ... | @@ -1816,7 +1816,7 @@ const riscv = struct { | ... | @@ -1816,7 +1816,7 @@ const riscv = struct { |
| 1816 | code: []u8, | 1816 | code: []u8, |
| 1817 | ) !void { | 1817 | ) !void { |
| 1818 | const diags = &elf_file.base.comp.link_diags; | 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 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; | 1820 | const r_offset = std.math.cast(usize, rel.r_offset) orelse return error.Overflow; |
| 1821 | 1821 | ||
| 1822 | const P, const A, const S, const GOT, const G, const TP, const DTP = args; | 1822 | const P, const A, const S, const GOT, const G, const TP, const DTP = args; |
| ... | @@ -1893,7 +1893,7 @@ const riscv = struct { | ... | @@ -1893,7 +1893,7 @@ const riscv = struct { |
| 1893 | const A_ = pair.r_addend; | 1893 | const A_ = pair.r_addend; |
| 1894 | const P_ = atom_addr + @as(i64, @intCast(pair.r_offset)); | 1894 | const P_ = atom_addr + @as(i64, @intCast(pair.r_offset)); |
| 1895 | const G_ = target_.gotAddress(elf_file) - GOT; | 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 | .PCREL_HI20 => math.cast(i32, S_ + A_ - P_) orelse return error.Overflow, | 1897 | .PCREL_HI20 => math.cast(i32, S_ + A_ - P_) orelse return error.Overflow, |
| 1898 | .GOT_HI20 => math.cast(i32, G_ + GOT + A_ - P_) orelse return error.Overflow, | 1898 | .GOT_HI20 => math.cast(i32, G_ + GOT + A_ - P_) orelse return error.Overflow, |
| 1899 | else => unreachable, | 1899 | else => unreachable, |
| ... | @@ -1951,7 +1951,7 @@ const riscv = struct { | ... | @@ -1951,7 +1951,7 @@ const riscv = struct { |
| 1951 | args: ResolveArgs, | 1951 | args: ResolveArgs, |
| 1952 | code: []u8, | 1952 | code: []u8, |
| 1953 | ) !void { | 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 | _, const A, const S, const GOT, _, _, const DTP = args; | 1956 | _, const A, const S, const GOT, _, _, const DTP = args; |
| 1957 | _ = GOT; | 1957 | _ = GOT; |
src/link/Elf/LinkerDefined.zig+1-1| ... | @@ -48,7 +48,7 @@ fn newSymbolAssumeCapacity(self: *LinkerDefined, name_off: u32, elf_file: *Elf) | ... | @@ -48,7 +48,7 @@ fn newSymbolAssumeCapacity(self: *LinkerDefined, name_off: u32, elf_file: *Elf) |
| 48 | esym.* = .{ | 48 | esym.* = .{ |
| 49 | .st_name = name_off, | 49 | .st_name = name_off, |
| 50 | .st_info = @as(u8, elf.STB_WEAK) << 4, | 50 | .st_info = @as(u8, elf.STB_WEAK) << 4, |
| 51 | .st_other = @intFromEnum(elf.STV.HIDDEN), | 51 | .st_other = @backingInt(elf.STV.HIDDEN), |
| 52 | .st_shndx = elf.SHN_ABS, | 52 | .st_shndx = elf.SHN_ABS, |
| 53 | .st_value = 0, | 53 | .st_value = 0, |
| 54 | .st_size = 0, | 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,7 +665,7 @@ pub fn claimUnresolved(self: *Object, elf_file: *Elf) void { |
| 665 | 665 | ||
| 666 | const is_import = blk: { | 666 | const is_import = blk: { |
| 667 | if (!elf_file.isEffectivelyDynLib()) break :blk false; | 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 | if (vis == .HIDDEN) break :blk false; | 669 | if (vis == .HIDDEN) break :blk false; |
| 670 | break :blk true; | 670 | break :blk true; |
| 671 | }; | 671 | }; |
| ... | @@ -737,7 +737,7 @@ pub fn markImportsExports(self: *Object, elf_file: *Elf) void { | ... | @@ -737,7 +737,7 @@ pub fn markImportsExports(self: *Object, elf_file: *Elf) void { |
| 737 | const sym = elf_file.symbol(ref) orelse continue; | 737 | const sym = elf_file.symbol(ref) orelse continue; |
| 738 | const file = sym.file(elf_file).?; | 738 | const file = sym.file(elf_file).?; |
| 739 | if (sym.version_index == elf.Versym.LOCAL) continue; | 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 | if (vis == .HIDDEN) continue; | 741 | if (vis == .HIDDEN) continue; |
| 742 | if (file == .shared_object and !sym.isAbs(elf_file)) { | 742 | if (file == .shared_object and !sym.isAbs(elf_file)) { |
| 743 | sym.flags.import = true; | 743 | sym.flags.import = true; |
src/link/Elf/SharedObject.zig+4-4| ... | @@ -238,11 +238,11 @@ pub fn parse( | ... | @@ -238,11 +238,11 @@ pub fn parse( |
| 238 | const verdef = mem.bytesAsValue(elf.Verdef, verdefs[offset..][0..@sizeOf(elf.Verdef)]); | 238 | const verdef = mem.bytesAsValue(elf.Verdef, verdefs[offset..][0..@sizeOf(elf.Verdef)]); |
| 239 | if (verdef.ndx == .UNSPECIFIED) return error.VerDefSymbolTooLarge; | 239 | if (verdef.ndx == .UNSPECIFIED) return error.VerDefSymbolTooLarge; |
| 240 | 240 | ||
| 241 | if (verstrings.items.len <= @intFromEnum(verdef.ndx)) | 241 | if (verstrings.items.len <= @backingInt(verdef.ndx)) |
| 242 | try verstrings.appendNTimes(gpa, 0, @intFromEnum(verdef.ndx) + 1 - verstrings.items.len); | 242 | try verstrings.appendNTimes(gpa, 0, @backingInt(verdef.ndx) + 1 - verstrings.items.len); |
| 243 | 243 | ||
| 244 | const aux = mem.bytesAsValue(elf.Verdaux, verdefs[offset + verdef.aux ..][0..@sizeOf(elf.Verdaux)]); | 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 | if (verdef.next == 0) break; | 247 | if (verdef.next == 0) break; |
| 248 | offset += verdef.next; | 248 | offset += verdef.next; |
| ... | @@ -380,7 +380,7 @@ pub fn markImportExports(self: *SharedObject, elf_file: *Elf) void { | ... | @@ -380,7 +380,7 @@ pub fn markImportExports(self: *SharedObject, elf_file: *Elf) void { |
| 380 | const ref = self.resolveSymbol(@intCast(i), elf_file); | 380 | const ref = self.resolveSymbol(@intCast(i), elf_file); |
| 381 | const ref_sym = elf_file.symbol(ref) orelse continue; | 381 | const ref_sym = elf_file.symbol(ref) orelse continue; |
| 382 | const ref_file = ref_sym.file(elf_file).?; | 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 | if (ref_file != .shared_object and vis != .HIDDEN) ref_sym.flags.@"export" = true; | 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,7 +310,7 @@ pub fn setOutputSym(symbol: Symbol, elf_file: *Elf, out: *elf.Elf64_Sym) void { |
| 310 | break :blk symbol.address(.{ .plt = false, .trampoline = false }, elf_file); | 310 | break :blk symbol.address(.{ .plt = false, .trampoline = false }, elf_file); |
| 311 | }; | 311 | }; |
| 312 | const st_other = blk: { | 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 | if (file_ptr != .shared_object or vis != elf.STV.PROTECTED) break :blk esym.st_other; | 314 | if (file_ptr != .shared_object or vis != elf.STV.PROTECTED) break :blk esym.st_other; |
| 315 | // Reset protected visibility to default for symbols originating in shared objects | 315 | // Reset protected visibility to default for symbols originating in shared objects |
| 316 | break :blk esym.st_other & 0b11111000; | 316 | break :blk esym.st_other & 0b11111000; |
| ... | @@ -332,7 +332,7 @@ const Format = struct { | ... | @@ -332,7 +332,7 @@ const Format = struct { |
| 332 | const symbol = f.symbol; | 332 | const symbol = f.symbol; |
| 333 | try writer.writeAll(symbol.name(elf_file)); | 333 | try writer.writeAll(symbol.name(elf_file)); |
| 334 | switch (symbol.version_index.VERSION) { | 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 | else => { | 336 | else => { |
| 337 | const file_ptr = symbol.file(elf_file).?; | 337 | const file_ptr = symbol.file(elf_file).?; |
| 338 | assert(file_ptr == .shared_object); | 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,14 +458,14 @@ pub fn flush(self: *ZigObject, elf_file: *Elf, tid: Zcu.PerThread.Id) !void { |
| 458 | }, self); | 458 | }, self); |
| 459 | } | 459 | } |
| 460 | for (entry.external_relocs.items) |reloc| { | 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 | const r_offset = entry_off + reloc.source_off; | 462 | const r_offset = entry_off + reloc.source_off; |
| 463 | const r_addend: i64 = @intCast(reloc.target_off); | 463 | const r_addend: i64 = @intCast(reloc.target_off); |
| 464 | const r_type = relocation.dwarf.externalRelocType(target_sym.*, sect_index, dwarf.address_size, cpu_arch); | 464 | const r_type = relocation.dwarf.externalRelocType(target_sym.*, sect_index, dwarf.address_size, cpu_arch); |
| 465 | atom_ptr.addRelocAssumeCapacity(.{ | 465 | atom_ptr.addRelocAssumeCapacity(.{ |
| 466 | .r_offset = r_offset, | 466 | .r_offset = r_offset, |
| 467 | .r_addend = r_addend, | 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 | }, self); | 469 | }, self); |
| 470 | } | 470 | } |
| 471 | } | 471 | } |
| ... | @@ -614,7 +614,7 @@ pub fn claimUnresolved(self: *ZigObject, elf_file: *Elf) void { | ... | @@ -614,7 +614,7 @@ pub fn claimUnresolved(self: *ZigObject, elf_file: *Elf) void { |
| 614 | 614 | ||
| 615 | const is_import = blk: { | 615 | const is_import = blk: { |
| 616 | if (!elf_file.isEffectivelyDynLib()) break :blk false; | 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 | if (vis == .HIDDEN) break :blk false; | 618 | if (vis == .HIDDEN) break :blk false; |
| 619 | break :blk true; | 619 | break :blk true; |
| 620 | }; | 620 | }; |
| ... | @@ -691,7 +691,7 @@ pub fn markImportsExports(self: *ZigObject, elf_file: *Elf) void { | ... | @@ -691,7 +691,7 @@ pub fn markImportsExports(self: *ZigObject, elf_file: *Elf) void { |
| 691 | const sym = elf_file.symbol(ref) orelse continue; | 691 | const sym = elf_file.symbol(ref) orelse continue; |
| 692 | const file = sym.file(elf_file).?; | 692 | const file = sym.file(elf_file).?; |
| 693 | if (sym.version_index == elf.Versym.LOCAL) continue; | 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 | if (vis == .HIDDEN) continue; | 695 | if (vis == .HIDDEN) continue; |
| 696 | if (file == .shared_object and !sym.isAbs(elf_file)) { | 696 | if (file == .shared_object and !sym.isAbs(elf_file)) { |
| 697 | sym.flags.import = true; | 697 | sym.flags.import = true; |
| ... | @@ -938,7 +938,7 @@ pub fn getNavVAddr( | ... | @@ -938,7 +938,7 @@ pub fn getNavVAddr( |
| 938 | switch (reloc_info.parent) { | 938 | switch (reloc_info.parent) { |
| 939 | .none => unreachable, | 939 | .none => unreachable, |
| 940 | .atom_index => |atom_index| { | 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 | const r_type = relocation.encode(.abs, elf_file.getTarget().cpu.arch); | 942 | const r_type = relocation.encode(.abs, elf_file.getTarget().cpu.arch); |
| 943 | try parent_atom.addReloc(elf_file.base.comp.gpa, .{ | 943 | try parent_atom.addReloc(elf_file.base.comp.gpa, .{ |
| 944 | .r_offset = reloc_info.offset, | 944 | .r_offset = reloc_info.offset, |
| ... | @@ -949,7 +949,7 @@ pub fn getNavVAddr( | ... | @@ -949,7 +949,7 @@ pub fn getNavVAddr( |
| 949 | .debug_output => |debug_output| switch (debug_output) { | 949 | .debug_output => |debug_output| switch (debug_output) { |
| 950 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ | 950 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ |
| 951 | .source_off = @intCast(reloc_info.offset), | 951 | .source_off = @intCast(reloc_info.offset), |
| 952 | .target_sym = @enumFromInt(this_sym_index), | 952 | .target_sym = @fromBackingInt(@intCast(this_sym_index)), |
| 953 | .target_off = reloc_info.addend, | 953 | .target_off = reloc_info.addend, |
| 954 | }), | 954 | }), |
| 955 | .none => unreachable, | 955 | .none => unreachable, |
| ... | @@ -970,7 +970,7 @@ pub fn getUavVAddr( | ... | @@ -970,7 +970,7 @@ pub fn getUavVAddr( |
| 970 | switch (reloc_info.parent) { | 970 | switch (reloc_info.parent) { |
| 971 | .none => unreachable, | 971 | .none => unreachable, |
| 972 | .atom_index => |atom_index| { | 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 | const r_type = relocation.encode(.abs, elf_file.getTarget().cpu.arch); | 974 | const r_type = relocation.encode(.abs, elf_file.getTarget().cpu.arch); |
| 975 | try parent_atom.addReloc(elf_file.base.comp.gpa, .{ | 975 | try parent_atom.addReloc(elf_file.base.comp.gpa, .{ |
| 976 | .r_offset = reloc_info.offset, | 976 | .r_offset = reloc_info.offset, |
| ... | @@ -981,7 +981,7 @@ pub fn getUavVAddr( | ... | @@ -981,7 +981,7 @@ pub fn getUavVAddr( |
| 981 | .debug_output => |debug_output| switch (debug_output) { | 981 | .debug_output => |debug_output| switch (debug_output) { |
| 982 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ | 982 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ |
| 983 | .source_off = @intCast(reloc_info.offset), | 983 | .source_off = @intCast(reloc_info.offset), |
| 984 | .target_sym = @enumFromInt(sym_index), | 984 | .target_sym = @fromBackingInt(@intCast(sym_index)), |
| 985 | .target_off = reloc_info.addend, | 985 | .target_off = reloc_info.addend, |
| 986 | }), | 986 | }), |
| 987 | .none => unreachable, | 987 | .none => unreachable, |
| ... | @@ -1009,7 +1009,7 @@ pub fn lowerUav( | ... | @@ -1009,7 +1009,7 @@ pub fn lowerUav( |
| 1009 | const sym = self.symbol(metadata.symbol_index); | 1009 | const sym = self.symbol(metadata.symbol_index); |
| 1010 | const existing_alignment = sym.atom(elf_file).?.alignment; | 1010 | const existing_alignment = sym.atom(elf_file).?.alignment; |
| 1011 | if (uav_alignment.order(existing_alignment).compare(.lte)) | 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 | const osec = if (self.data_relro_index) |sym_index| | 1015 | const osec = if (self.data_relro_index) |sym_index| |
| ... | @@ -1027,7 +1027,7 @@ pub fn lowerUav( | ... | @@ -1027,7 +1027,7 @@ pub fn lowerUav( |
| 1027 | 1027 | ||
| 1028 | var name_buf: [32]u8 = undefined; | 1028 | var name_buf: [32]u8 = undefined; |
| 1029 | const name = std.fmt.bufPrint(&name_buf, "__anon_{d}", .{ | 1029 | const name = std.fmt.bufPrint(&name_buf, "__anon_{d}", .{ |
| 1030 | @intFromEnum(uav), | 1030 | @backingInt(uav), |
| 1031 | }) catch unreachable; | 1031 | }) catch unreachable; |
| 1032 | const sym_index = self.lowerConst( | 1032 | const sym_index = self.lowerConst( |
| 1033 | elf_file, | 1033 | elf_file, |
| ... | @@ -1044,7 +1044,7 @@ pub fn lowerUav( | ... | @@ -1044,7 +1044,7 @@ pub fn lowerUav( |
| 1044 | ), | 1044 | ), |
| 1045 | }; | 1045 | }; |
| 1046 | try self.uavs.put(gpa, uav, .{ | 1046 | try self.uavs.put(gpa, uav, .{ |
| 1047 | .symbol_index = @intFromEnum(sym_index), | 1047 | .symbol_index = @backingInt(sym_index), |
| 1048 | .allocated = true, | 1048 | .allocated = true, |
| 1049 | }); | 1049 | }); |
| 1050 | return sym_index; | 1050 | return sym_index; |
| ... | @@ -1541,7 +1541,7 @@ pub fn updateFunc( | ... | @@ -1541,7 +1541,7 @@ pub fn updateFunc( |
| 1541 | var debug_wip_nav = if (self.dwarf) |*dwarf| try dwarf.initWipNav( | 1541 | var debug_wip_nav = if (self.dwarf) |*dwarf| try dwarf.initWipNav( |
| 1542 | pt, | 1542 | pt, |
| 1543 | func.owner_nav, | 1543 | func.owner_nav, |
| 1544 | @enumFromInt(sym_index), | 1544 | @fromBackingInt(@intCast(sym_index)), |
| 1545 | ) else null; | 1545 | ) else null; |
| 1546 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); | 1546 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); |
| 1547 | 1547 | ||
| ... | @@ -1549,7 +1549,7 @@ pub fn updateFunc( | ... | @@ -1549,7 +1549,7 @@ pub fn updateFunc( |
| 1549 | &elf_file.base, | 1549 | &elf_file.base, |
| 1550 | pt, | 1550 | pt, |
| 1551 | func_index, | 1551 | func_index, |
| 1552 | @enumFromInt(sym_index), | 1552 | @fromBackingInt(@intCast(sym_index)), |
| 1553 | mir, | 1553 | mir, |
| 1554 | &aw.writer, | 1554 | &aw.writer, |
| 1555 | if (debug_wip_nav) |*dn| .{ .dwarf = dn } else .none, | 1555 | if (debug_wip_nav) |*dn| .{ .dwarf = dn } else .none, |
| ... | @@ -1656,7 +1656,7 @@ pub fn updateNav( | ... | @@ -1656,7 +1656,7 @@ pub fn updateNav( |
| 1656 | self.symbol(sym_index).flags.is_tls = true; | 1656 | self.symbol(sym_index).flags.is_tls = true; |
| 1657 | } | 1657 | } |
| 1658 | if (self.dwarf) |*dwarf| { | 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 | defer debug_wip_nav.deinit(); | 1660 | defer debug_wip_nav.deinit(); |
| 1661 | dwarf.finishWipNav(pt, nav_index, &debug_wip_nav) catch |err| switch (err) { | 1661 | dwarf.finishWipNav(pt, nav_index, &debug_wip_nav) catch |err| switch (err) { |
| 1662 | error.OutOfMemory, error.Canceled, error.AlreadyReported => |e| return e, | 1662 | error.OutOfMemory, error.Canceled, error.AlreadyReported => |e| return e, |
| ... | @@ -1674,7 +1674,7 @@ pub fn updateNav( | ... | @@ -1674,7 +1674,7 @@ pub fn updateNav( |
| 1674 | var aw: std.Io.Writer.Allocating = .init(zcu.gpa); | 1674 | var aw: std.Io.Writer.Allocating = .init(zcu.gpa); |
| 1675 | defer aw.deinit(); | 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 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); | 1678 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); |
| 1679 | 1679 | ||
| 1680 | codegen.generateSymbol( | 1680 | codegen.generateSymbol( |
| ... | @@ -1682,7 +1682,7 @@ pub fn updateNav( | ... | @@ -1682,7 +1682,7 @@ pub fn updateNav( |
| 1682 | pt, | 1682 | pt, |
| 1683 | .fromInterned(nav.resolved.?.value), | 1683 | .fromInterned(nav.resolved.?.value), |
| 1684 | &aw.writer, | 1684 | &aw.writer, |
| 1685 | .{ .atom_index = @enumFromInt(sym_index) }, | 1685 | .{ .atom_index = @fromBackingInt(@intCast(sym_index)) }, |
| 1686 | ) catch |err| switch (err) { | 1686 | ) catch |err| switch (err) { |
| 1687 | error.WriteFailed => return error.OutOfMemory, | 1687 | error.WriteFailed => return error.OutOfMemory, |
| 1688 | else => |e| return e, | 1688 | else => |e| return e, |
| ... | @@ -1751,7 +1751,7 @@ fn updateLazySymbol( | ... | @@ -1751,7 +1751,7 @@ fn updateLazySymbol( |
| 1751 | &required_alignment, | 1751 | &required_alignment, |
| 1752 | &aw.writer, | 1752 | &aw.writer, |
| 1753 | .none, | 1753 | .none, |
| 1754 | .{ .atom_index = @enumFromInt(symbol_index) }, | 1754 | .{ .atom_index = @fromBackingInt(@intCast(symbol_index)) }, |
| 1755 | ) catch |err| switch (err) { | 1755 | ) catch |err| switch (err) { |
| 1756 | error.WriteFailed => return error.OutOfMemory, | 1756 | error.WriteFailed => return error.OutOfMemory, |
| 1757 | else => |e| return e, | 1757 | else => |e| return e, |
| ... | @@ -1828,7 +1828,7 @@ fn lowerConst( | ... | @@ -1828,7 +1828,7 @@ fn lowerConst( |
| 1828 | pt, | 1828 | pt, |
| 1829 | val, | 1829 | val, |
| 1830 | &aw.writer, | 1830 | &aw.writer, |
| 1831 | .{ .atom_index = @enumFromInt(sym_index) }, | 1831 | .{ .atom_index = @fromBackingInt(@intCast(sym_index)) }, |
| 1832 | ) catch |err| switch (err) { | 1832 | ) catch |err| switch (err) { |
| 1833 | error.WriteFailed => return error.OutOfMemory, | 1833 | error.WriteFailed => return error.OutOfMemory, |
| 1834 | else => |e| return e, | 1834 | else => |e| return e, |
| ... | @@ -1850,7 +1850,7 @@ fn lowerConst( | ... | @@ -1850,7 +1850,7 @@ fn lowerConst( |
| 1850 | 1850 | ||
| 1851 | try elf_file.pwriteAll(code, atom_ptr.offset(elf_file)); | 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 | pub fn updateExports( | 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,7 +535,7 @@ pub fn writeEhFrameHdr(elf_file: *Elf, writer: anytype) !void { |
| 535 | 535 | ||
| 536 | const x86_64 = struct { | 536 | const x86_64 = struct { |
| 537 | fn resolveReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela, source: i64, target: i64, data: []u8) !void { | 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 | switch (r_type) { | 539 | switch (r_type) { |
| 540 | .NONE => {}, | 540 | .NONE => {}, |
| 541 | .@"32" => std.mem.writeInt(i32, data[0..4], @as(i32, @truncate(target)), .little), | 541 | .@"32" => std.mem.writeInt(i32, data[0..4], @as(i32, @truncate(target)), .little), |
| ... | @@ -549,7 +549,7 @@ const x86_64 = struct { | ... | @@ -549,7 +549,7 @@ const x86_64 = struct { |
| 549 | 549 | ||
| 550 | const aarch64 = struct { | 550 | const aarch64 = struct { |
| 551 | fn resolveReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela, source: i64, target: i64, data: []u8) !void { | 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 | switch (r_type) { | 553 | switch (r_type) { |
| 554 | .NONE => {}, | 554 | .NONE => {}, |
| 555 | .ABS64 => std.mem.writeInt(i64, data[0..8], target, .little), | 555 | .ABS64 => std.mem.writeInt(i64, data[0..8], target, .little), |
| ... | @@ -562,7 +562,7 @@ const aarch64 = struct { | ... | @@ -562,7 +562,7 @@ const aarch64 = struct { |
| 562 | 562 | ||
| 563 | const riscv = struct { | 563 | const riscv = struct { |
| 564 | fn resolveReloc(rec: anytype, elf_file: *Elf, rel: elf.Elf64_Rela, source: i64, target: i64, data: []u8) !void { | 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 | switch (r_type) { | 566 | switch (r_type) { |
| 567 | .NONE => {}, | 567 | .NONE => {}, |
| 568 | .@"32_PCREL" => std.mem.writeInt(i32, data[0..4], @as(i32, @intCast(target - source)), .little), | 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,14 +17,14 @@ fn Table(comptime len: comptime_int, comptime RelType: type, comptime mapping: [ |
| 17 | return struct { | 17 | return struct { |
| 18 | fn decode(r_type: u32) Kind { | 18 | fn decode(r_type: u32) Kind { |
| 19 | inline for (mapping) |entry| { | 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 | return .other; | 22 | return .other; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | fn encode(comptime kind: Kind) u32 { | 25 | fn encode(comptime kind: Kind) u32 { |
| 26 | inline for (mapping) |entry| { | 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 | @panic("encoding .other is ambiguous"); | 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,15 +94,15 @@ pub fn encode(comptime kind: Kind, cpu_arch: std.Target.Cpu.Arch) u32 { |
| 94 | pub const dwarf = struct { | 94 | pub const dwarf = struct { |
| 95 | pub fn crossSectionRelocType(format: DW.Format, cpu_arch: std.Target.Cpu.Arch) u32 { | 95 | pub fn crossSectionRelocType(format: DW.Format, cpu_arch: std.Target.Cpu.Arch) u32 { |
| 96 | return switch (cpu_arch) { | 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 | .@"32" => .@"32", | 98 | .@"32" => .@"32", |
| 99 | .@"64" => .@"64", | 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 | .@"32" => .ABS32, | 102 | .@"32" => .ABS32, |
| 103 | .@"64" => .ABS64, | 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 | .@"32" => .@"32", | 106 | .@"32" => .@"32", |
| 107 | .@"64" => .@"64", | 107 | .@"64" => .@"64", |
| 108 | })), | 108 | })), |
| ... | @@ -117,7 +117,7 @@ pub const dwarf = struct { | ... | @@ -117,7 +117,7 @@ pub const dwarf = struct { |
| 117 | cpu_arch: std.Target.Cpu.Arch, | 117 | cpu_arch: std.Target.Cpu.Arch, |
| 118 | ) u32 { | 118 | ) u32 { |
| 119 | return switch (cpu_arch) { | 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 | else => switch (address_size) { | 121 | else => switch (address_size) { |
| 122 | .@"32" => if (target.flags.is_tls) .DTPOFF32 else .@"32", | 122 | .@"32" => if (target.flags.is_tls) .DTPOFF32 else .@"32", |
| 123 | .@"64" => if (target.flags.is_tls) .DTPOFF64 else .@"64", | 123 | .@"64" => if (target.flags.is_tls) .DTPOFF64 else .@"64", |
| ... | @@ -125,7 +125,7 @@ pub const dwarf = struct { | ... | @@ -125,7 +125,7 @@ pub const dwarf = struct { |
| 125 | }, | 125 | }, |
| 126 | .debug_frame => .PC32, | 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 | else => switch (address_size) { | 129 | else => switch (address_size) { |
| 130 | .@"32" => .ABS32, | 130 | .@"32" => .ABS32, |
| 131 | .@"64" => .ABS64, | 131 | .@"64" => .ABS64, |
| ... | @@ -133,7 +133,7 @@ pub const dwarf = struct { | ... | @@ -133,7 +133,7 @@ pub const dwarf = struct { |
| 133 | }, | 133 | }, |
| 134 | .debug_frame => .PREL32, | 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 | else => switch (address_size) { | 137 | else => switch (address_size) { |
| 138 | .@"32" => .@"32", | 138 | .@"32" => .@"32", |
| 139 | .@"64" => .@"64", | 139 | .@"64" => .@"64", |
| ... | @@ -163,9 +163,9 @@ pub fn fmtRelocType(r_type: u32, cpu_arch: std.Target.Cpu.Arch) std.fmt.Alt(Form | ... | @@ -163,9 +163,9 @@ pub fn fmtRelocType(r_type: u32, cpu_arch: std.Target.Cpu.Arch) std.fmt.Alt(Form |
| 163 | fn formatRelocType(ctx: FormatRelocTypeCtx, writer: *std.Io.Writer) std.Io.Writer.Error!void { | 163 | fn formatRelocType(ctx: FormatRelocTypeCtx, writer: *std.Io.Writer) std.Io.Writer.Error!void { |
| 164 | const r_type = ctx.r_type; | 164 | const r_type = ctx.r_type; |
| 165 | switch (ctx.cpu_arch) { | 165 | switch (ctx.cpu_arch) { |
| 166 | .x86_64 => try writer.print("R_X86_64_{s}", .{@tagName(@as(elf.R_X86_64, @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, @enumFromInt(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, @enumFromInt(r_type)))}), | 168 | .riscv64, .riscv64be => try writer.print("R_RISCV_{s}", .{@tagName(@as(elf.R_RISCV, @fromBackingInt(@intCast(r_type))))}), |
| 169 | else => unreachable, | 169 | else => unreachable, |
| 170 | } | 170 | } |
| 171 | } | 171 | } |
src/link/Elf2.zig+172-172| ... | @@ -212,26 +212,26 @@ const Node = union(enum) { | ... | @@ -212,26 +212,26 @@ const Node = union(enum) { |
| 212 | _, | 212 | _, |
| 213 | 213 | ||
| 214 | pub fn path(ii: InputIndex, elf: *const Elf) std.Build.Cache.Path { | 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 | pub fn member(ii: InputIndex, elf: *const Elf) ?[]const u8 { | 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 | pub fn fileSymbol(ii: InputIndex, elf: *const Elf) Symbol.LocalIndex { | 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 | pub fn localSymbolRange(ii: InputIndex, elf: *Elf) [2]Symbol.LocalIndex { | 226 | pub fn localSymbolRange(ii: InputIndex, elf: *Elf) [2]Symbol.LocalIndex { |
| 227 | if (@intFromEnum(ii) + 1 < elf.inputs.items.len) { | 227 | if (@backingInt(ii) + 1 < elf.inputs.items.len) { |
| 228 | const next_ii: InputIndex = @enumFromInt(@intFromEnum(ii) + 1); | 228 | const next_ii: InputIndex = @fromBackingInt(@intCast(@backingInt(ii) + 1)); |
| 229 | return .{ ii.fileSymbol(elf), next_ii.fileSymbol(elf) }; | 229 | return .{ ii.fileSymbol(elf), next_ii.fileSymbol(elf) }; |
| 230 | } else { | 230 | } else { |
| 231 | const local_symbols_len = switch (elf.shdrPtr(.symtab)) { | 231 | const local_symbols_len = switch (elf.shdrPtr(.symtab)) { |
| 232 | inline else => |shdr| elf.targetLoad(&shdr.info), | 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,18 +240,18 @@ const Node = union(enum) { |
| 240 | _, | 240 | _, |
| 241 | 241 | ||
| 242 | pub fn navIndex(nmi: NavMapIndex, elf: *const Elf) InternPool.Nav.Index { | 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 | pub fn symbol(nmi: NavMapIndex, elf: *const Elf) Symbol.LocalIndex { | 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 | fn firstSymbolReloc(nmi: NavMapIndex, elf: *const Elf) SymbolReloc.Index { | 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 | fn firstGotReloc(nmi: NavMapIndex, elf: *const Elf) GotReloc.Index { | 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,15 +259,15 @@ const Node = union(enum) { |
| 259 | _, | 259 | _, |
| 260 | 260 | ||
| 261 | pub fn uavValue(umi: UavMapIndex, elf: *const Elf) InternPool.Index { | 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 | pub fn symbol(umi: UavMapIndex, elf: *const Elf) Symbol.LocalIndex { | 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 | fn firstSymbolReloc(umi: UavMapIndex, elf: *const Elf) SymbolReloc.Index { | 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 | fn firstGotReloc(umi: UavMapIndex, elf: *const Elf) GotReloc.Index { | 272 | fn firstGotReloc(umi: UavMapIndex, elf: *const Elf) GotReloc.Index { |
| 273 | _ = umi; | 273 | _ = umi; |
| ... | @@ -285,7 +285,7 @@ const Node = union(enum) { | ... | @@ -285,7 +285,7 @@ const Node = union(enum) { |
| 285 | _, | 285 | _, |
| 286 | 286 | ||
| 287 | pub fn ref(lmi: @This()) LazyMapRef { | 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 | pub fn lazySymbol(lmi: @This(), elf: *const Elf) link.File.LazySymbol { | 291 | pub fn lazySymbol(lmi: @This(), elf: *const Elf) link.File.LazySymbol { |
| ... | @@ -297,10 +297,10 @@ const Node = union(enum) { | ... | @@ -297,10 +297,10 @@ const Node = union(enum) { |
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | fn firstSymbolReloc(lmi: @This(), elf: *const Elf) SymbolReloc.Index { | 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 | fn firstGotReloc(lmi: @This(), elf: *const Elf) GotReloc.Index { | 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,13 +316,13 @@ const Node = union(enum) { |
| 316 | 316 | ||
| 317 | pub const Known = struct { | 317 | pub const Known = struct { |
| 318 | comptime file: MappedFile.Node.Index = .root, | 318 | comptime file: MappedFile.Node.Index = .root, |
| 319 | comptime ehdr: MappedFile.Node.Index = @enumFromInt(1), | 319 | comptime ehdr: MappedFile.Node.Index = @fromBackingInt(@intCast(1)), |
| 320 | comptime shdr: MappedFile.Node.Index = @enumFromInt(2), | 320 | comptime shdr: MappedFile.Node.Index = @fromBackingInt(@intCast(2)), |
| 321 | comptime rodata: MappedFile.Node.Index = @enumFromInt(3), | 321 | comptime rodata: MappedFile.Node.Index = @fromBackingInt(@intCast(3)), |
| 322 | comptime phdr: MappedFile.Node.Index = @enumFromInt(4), | 322 | comptime phdr: MappedFile.Node.Index = @fromBackingInt(@intCast(4)), |
| 323 | comptime text: MappedFile.Node.Index = @enumFromInt(5), | 323 | comptime text: MappedFile.Node.Index = @fromBackingInt(@intCast(5)), |
| 324 | comptime data: MappedFile.Node.Index = @enumFromInt(6), | 324 | comptime data: MappedFile.Node.Index = @fromBackingInt(@intCast(6)), |
| 325 | comptime data_rel_ro: MappedFile.Node.Index = @enumFromInt(7), | 325 | comptime data_rel_ro: MappedFile.Node.Index = @fromBackingInt(@intCast(7)), |
| 326 | 326 | ||
| 327 | tls: MappedFile.Node.Index, | 327 | tls: MappedFile.Node.Index, |
| 328 | }; | 328 | }; |
| ... | @@ -333,11 +333,11 @@ const Node = union(enum) { | ... | @@ -333,11 +333,11 @@ const Node = union(enum) { |
| 333 | 333 | ||
| 334 | /// In this linker implementation, `link.File.AtomId` is a type-erased `MappedFile.Node.Index`. | 334 | /// In this linker implementation, `link.File.AtomId` is a type-erased `MappedFile.Node.Index`. |
| 335 | fn toAtom(ni: MappedFile.Node.Index) link.File.AtomId { | 335 | fn toAtom(ni: MappedFile.Node.Index) link.File.AtomId { |
| 336 | return @enumFromInt(@intFromEnum(ni)); | 336 | return @fromBackingInt(@intCast(@backingInt(ni))); |
| 337 | } | 337 | } |
| 338 | /// In this linker implementation, `link.File.AtomId` is a type-erased `MappedFile.Node.Index`. | 338 | /// In this linker implementation, `link.File.AtomId` is a type-erased `MappedFile.Node.Index`. |
| 339 | fn fromAtom(atom: link.File.AtomId) MappedFile.Node.Index { | 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,11 +356,11 @@ const InputSection = struct { |
| 356 | _, | 356 | _, |
| 357 | 357 | ||
| 358 | fn ptr(isi: InputSection.Index, elf: *Elf) *InputSection { | 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 | fn ptrConst(isi: InputSection.Index, elf: *const Elf) *const InputSection { | 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 | fn input(isi: InputSection.Index, elf: *const Elf) Node.InputIndex { | 366 | fn input(isi: InputSection.Index, elf: *const Elf) Node.InputIndex { |
| ... | @@ -424,13 +424,13 @@ const Section = struct { | ... | @@ -424,13 +424,13 @@ const Section = struct { |
| 424 | fn unwrap(opt: RelaIndex.Optional) ?RelaIndex { | 424 | fn unwrap(opt: RelaIndex.Optional) ?RelaIndex { |
| 425 | return switch (opt) { | 425 | return switch (opt) { |
| 426 | .none => null, | 426 | .none => null, |
| 427 | _ => @enumFromInt(@intFromEnum(opt)), | 427 | _ => @fromBackingInt(@intCast(@backingInt(opt))), |
| 428 | }; | 428 | }; |
| 429 | } | 429 | } |
| 430 | }; | 430 | }; |
| 431 | 431 | ||
| 432 | fn toOptional(i: RelaIndex) RelaIndex.Optional { | 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,7 +455,7 @@ const Section = struct { |
| 455 | pub const LORESERVE: Index = .fromSection(std.elf.SHN_LORESERVE); | 455 | pub const LORESERVE: Index = .fromSection(std.elf.SHN_LORESERVE); |
| 456 | pub const HIRESERVE: Index = .fromSection(std.elf.SHN_HIRESERVE); | 456 | pub const HIRESERVE: Index = .fromSection(std.elf.SHN_HIRESERVE); |
| 457 | comptime { | 457 | comptime { |
| 458 | assert(@intFromEnum(HIRESERVE) == std.math.maxInt(Tag)); | 458 | assert(@backingInt(HIRESERVE) == std.math.maxInt(Tag)); |
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | fn reserve(sec: std.elf.Section) Tag { | 461 | fn reserve(sec: std.elf.Section) Tag { |
| ... | @@ -465,12 +465,12 @@ const Section = struct { | ... | @@ -465,12 +465,12 @@ const Section = struct { |
| 465 | 465 | ||
| 466 | pub fn fromSection(sec: std.elf.Section) Index { | 466 | pub fn fromSection(sec: std.elf.Section) Index { |
| 467 | return switch (sec) { | 467 | return switch (sec) { |
| 468 | std.elf.SHN_UNDEF...std.elf.SHN_LORESERVE - 1 => @enumFromInt(sec), | 468 | std.elf.SHN_UNDEF...std.elf.SHN_LORESERVE - 1 => @fromBackingInt(@intCast(sec)), |
| 469 | std.elf.SHN_LORESERVE...std.elf.SHN_HIRESERVE => @enumFromInt(reserve(sec)), | 469 | std.elf.SHN_LORESERVE...std.elf.SHN_HIRESERVE => @fromBackingInt(@intCast(reserve(sec))), |
| 470 | }; | 470 | }; |
| 471 | } | 471 | } |
| 472 | pub fn toSection(s: Index) ?std.elf.Section { | 472 | pub fn toSection(s: Index) ?std.elf.Section { |
| 473 | return switch (@intFromEnum(s)) { | 473 | return switch (@backingInt(s)) { |
| 474 | std.elf.SHN_UNDEF...std.elf.SHN_LORESERVE - 1 => |sec| @intCast(sec), | 474 | std.elf.SHN_UNDEF...std.elf.SHN_LORESERVE - 1 => |sec| @intCast(sec), |
| 475 | std.elf.SHN_LORESERVE...reserve(std.elf.SHN_LORESERVE) - 1 => null, | 475 | std.elf.SHN_LORESERVE...reserve(std.elf.SHN_LORESERVE) - 1 => null, |
| 476 | reserve(std.elf.SHN_LORESERVE)...reserve(std.elf.SHN_HIRESERVE) => |sec| @intCast( | 476 | reserve(std.elf.SHN_LORESERVE)...reserve(std.elf.SHN_HIRESERVE) => |sec| @intCast( |
| ... | @@ -480,12 +480,12 @@ const Section = struct { | ... | @@ -480,12 +480,12 @@ const Section = struct { |
| 480 | } | 480 | } |
| 481 | 481 | ||
| 482 | fn get(s: Index, elf: *Elf) *Section { | 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 | fn name(s: Index, elf: *Elf) String(.shstrtab) { | 486 | fn name(s: Index, elf: *Elf) String(.shstrtab) { |
| 487 | return switch (elf.shdrPtr(s)) { | 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,7 +510,7 @@ const Section = struct { |
| 510 | fn rename(shndx: Index, elf: *Elf, new_name: []const u8) Error!void { | 510 | fn rename(shndx: Index, elf: *Elf, new_name: []const u8) Error!void { |
| 511 | const shstrtab_entry = try elf.string(.shstrtab, new_name); | 511 | const shstrtab_entry = try elf.string(.shstrtab, new_name); |
| 512 | switch (elf.shdrPtr(shndx)) { | 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,7 +530,7 @@ const Section = struct { |
| 530 | const relas: []const class.ElfN().Rela = @ptrCast(@alignCast( | 530 | const relas: []const class.ElfN().Rela = @ptrCast(@alignCast( |
| 531 | node.slice(&elf.mf)[0..@intCast(cur_size)], | 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 | assert(free_len > 0); | 534 | assert(free_len > 0); |
| 535 | break :free_len @intCast(free_len); | 535 | break :free_len @intCast(free_len); |
| 536 | }; | 536 | }; |
| ... | @@ -555,17 +555,17 @@ const Section = struct { | ... | @@ -555,17 +555,17 @@ const Section = struct { |
| 555 | const opt_free_head = rela_shndx.get(elf).rela.free_head; | 555 | const opt_free_head = rela_shndx.get(elf).rela.free_head; |
| 556 | const old_free_len: u32 = free_len: { | 556 | const old_free_len: u32 = free_len: { |
| 557 | const free_head = opt_free_head.unwrap() orelse break :free_len 0; | 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 | assert(free_len > 0); | 559 | assert(free_len > 0); |
| 560 | break :free_len @intCast(free_len); | 560 | break :free_len @intCast(free_len); |
| 561 | }; | 561 | }; |
| 562 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); | 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 | assert(old_type != none_reloc_type); // bug: `index` is already in the free-list | 565 | assert(old_type != none_reloc_type); // bug: `index` is already in the free-list |
| 566 | } | 566 | } |
| 567 | relas[@intFromEnum(index)] = .{ | 567 | relas[@backingInt(index)] = .{ |
| 568 | .offset = @intFromEnum(opt_free_head), // next | 568 | .offset = @backingInt(opt_free_head), // next |
| 569 | .info = .{ | 569 | .info = .{ |
| 570 | .type = @intCast(none_reloc_type), | 570 | .type = @intCast(none_reloc_type), |
| 571 | .sym = 0, | 571 | .sym = 0, |
| ... | @@ -573,7 +573,7 @@ const Section = struct { | ... | @@ -573,7 +573,7 @@ const Section = struct { |
| 573 | .addend = @intCast(old_free_len + 1), // list length | 573 | .addend = @intCast(old_free_len + 1), // list length |
| 574 | }; | 574 | }; |
| 575 | if (elf.targetEndian() != native_endian) { | 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,16 +600,16 @@ const Section = struct { |
| 600 | const relas: []class.ElfN().Rela = @ptrCast(@alignCast( | 600 | const relas: []class.ElfN().Rela = @ptrCast(@alignCast( |
| 601 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], | 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( | 603 | const next: RelaIndex.Optional = @fromBackingInt(@intCast(elf.targetLoad( |
| 604 | &relas[@intFromEnum(free_head)].offset, | 604 | &relas[@backingInt(free_head)].offset, |
| 605 | )); | 605 | ))); |
| 606 | rela_shndx.get(elf).rela.free_head = next; | 606 | rela_shndx.get(elf).rela.free_head = next; |
| 607 | 607 | ||
| 608 | const old_free_len: u32 = @intCast( | 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 | const new_free_len: u32 = if (next.unwrap()) |i| @intCast( | 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 | ) else 0; | 613 | ) else 0; |
| 614 | assert(new_free_len == old_free_len - 1); | 614 | assert(new_free_len == old_free_len - 1); |
| 615 | 615 | ||
| ... | @@ -623,12 +623,12 @@ const Section = struct { | ... | @@ -623,12 +623,12 @@ const Section = struct { |
| 623 | } else if (rela_shndx == elf.shndx.rela_plt) { | 623 | } else if (rela_shndx == elf.shndx.rela_plt) { |
| 624 | elf.updateDynamicEntry(std.elf.DT_PLTRELSZ, new_size); | 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 | const relas: []class.ElfN().Rela = @ptrCast(@alignCast( | 628 | const relas: []class.ElfN().Rela = @ptrCast(@alignCast( |
| 629 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], | 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 | .offset = @intCast(opts.offset), | 632 | .offset = @intCast(opts.offset), |
| 633 | .info = .{ | 633 | .info = .{ |
| 634 | .type = @intCast(opts.type.unwrap(elf)), | 634 | .type = @intCast(opts.type.unwrap(elf)), |
| ... | @@ -637,7 +637,7 @@ const Section = struct { | ... | @@ -637,7 +637,7 @@ const Section = struct { |
| 637 | .addend = @intCast(opts.addend), | 637 | .addend = @intCast(opts.addend), |
| 638 | }; | 638 | }; |
| 639 | if (elf.targetEndian() != native_endian) { | 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 | return new_index; | 642 | return new_index; |
| 643 | }, | 643 | }, |
| ... | @@ -656,12 +656,12 @@ const Section = struct { | ... | @@ -656,12 +656,12 @@ const Section = struct { |
| 656 | const relas: []class.ElfN().Rela = @ptrCast(@alignCast( | 656 | const relas: []class.ElfN().Rela = @ptrCast(@alignCast( |
| 657 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], | 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 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); | 661 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); |
| 662 | assert(rela_info.type != none_reloc_type); // bug: `index` is in the free-list | 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 | .type = rela_info.type, | 665 | .type = rela_info.type, |
| 666 | .sym = @intCast(raw_sym_index), | 666 | .sym = @intCast(raw_sym_index), |
| 667 | }); | 667 | }); |
| ... | @@ -681,11 +681,11 @@ const Section = struct { | ... | @@ -681,11 +681,11 @@ const Section = struct { |
| 681 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], | 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 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); | 685 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); |
| 686 | assert(rela_info.type != none_reloc_type); // bug: `index` is in the free-list | 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,12 +702,12 @@ const Section = struct { |
| 702 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], | 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 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); | 706 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); |
| 707 | assert(rela_info.type != none_reloc_type); // bug: `index` is in the free-list | 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); | 709 | const old_offset = elf.targetLoad(&relas[@backingInt(index)].offset); |
| 710 | elf.targetStore(&relas[@intFromEnum(index)].offset, @intCast( | 710 | elf.targetStore(&relas[@backingInt(index)].offset, @intCast( |
| 711 | old_offset - old_base + new_base, | 711 | old_offset - old_base + new_base, |
| 712 | )); | 712 | )); |
| 713 | }, | 713 | }, |
| ... | @@ -726,12 +726,12 @@ const Section = struct { | ... | @@ -726,12 +726,12 @@ const Section = struct { |
| 726 | rela_shndx.get(elf).ni.slice(&elf.mf)[0..@intCast(elf.targetLoad(&shdr.size))], | 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 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); | 730 | const none_reloc_type = MachineRelocType.none(elf).unwrap(elf); |
| 731 | assert(rela_info.type != none_reloc_type); // bug: `index` is in the free-list | 731 | assert(rela_info.type != none_reloc_type); // bug: `index` is in the free-list |
| 732 | } | 732 | } |
| 733 | const unsigned: class.ElfN().Addr = @intCast(new_addend); | 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,7 +896,7 @@ const GotReloc = struct { |
| 896 | _, | 896 | _, |
| 897 | 897 | ||
| 898 | fn get(index: GotReloc.Index, elf: *Elf) *GotReloc { | 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,22 +1131,22 @@ pub const MachineRelocType = union { |
| 1131 | 1131 | ||
| 1132 | pub fn wrap(int: u32, elf: *const Elf) MachineRelocType { | 1132 | pub fn wrap(int: u32, elf: *const Elf) MachineRelocType { |
| 1133 | return switch (elf.ehdrMachine()) { | 1133 | return switch (elf.ehdrMachine()) { |
| 1134 | .AARCH64 => .{ .AARCH64 = @enumFromInt(int) }, | 1134 | .AARCH64 => .{ .AARCH64 = @fromBackingInt(@intCast(int)) }, |
| 1135 | .LOONGARCH => .{ .LARCH = @enumFromInt(int) }, | 1135 | .LOONGARCH => .{ .LARCH = @fromBackingInt(@intCast(int)) }, |
| 1136 | .PPC64 => .{ .PPC64 = @enumFromInt(int) }, | 1136 | .PPC64 => .{ .PPC64 = @fromBackingInt(@intCast(int)) }, |
| 1137 | .RISCV => .{ .RISCV = @enumFromInt(int) }, | 1137 | .RISCV => .{ .RISCV = @fromBackingInt(@intCast(int)) }, |
| 1138 | .SPARCV9 => .{ .SPARC = @enumFromInt(int) }, | 1138 | .SPARCV9 => .{ .SPARC = @fromBackingInt(@intCast(int)) }, |
| 1139 | .X86_64 => .{ .X86_64 = @enumFromInt(int) }, | 1139 | .X86_64 => .{ .X86_64 = @fromBackingInt(@intCast(int)) }, |
| 1140 | }; | 1140 | }; |
| 1141 | } | 1141 | } |
| 1142 | pub fn unwrap(rt: MachineRelocType, elf: *const Elf) u32 { | 1142 | pub fn unwrap(rt: MachineRelocType, elf: *const Elf) u32 { |
| 1143 | return switch (elf.ehdrMachine()) { | 1143 | return switch (elf.ehdrMachine()) { |
| 1144 | .AARCH64 => @intFromEnum(rt.AARCH64), | 1144 | .AARCH64 => @backingInt(rt.AARCH64), |
| 1145 | .LOONGARCH => @intFromEnum(rt.LARCH), | 1145 | .LOONGARCH => @backingInt(rt.LARCH), |
| 1146 | .PPC64 => @intFromEnum(rt.PPC64), | 1146 | .PPC64 => @backingInt(rt.PPC64), |
| 1147 | .RISCV => @intFromEnum(rt.RISCV), | 1147 | .RISCV => @backingInt(rt.RISCV), |
| 1148 | .SPARCV9 => @intFromEnum(rt.SPARC), | 1148 | .SPARCV9 => @backingInt(rt.SPARC), |
| 1149 | .X86_64 => @intFromEnum(rt.X86_64), | 1149 | .X86_64 => @backingInt(rt.X86_64), |
| 1150 | }; | 1150 | }; |
| 1151 | } | 1151 | } |
| 1152 | }; | 1152 | }; |
| ... | @@ -1209,7 +1209,7 @@ const SymbolReloc = struct { | ... | @@ -1209,7 +1209,7 @@ const SymbolReloc = struct { |
| 1209 | _, | 1209 | _, |
| 1210 | 1210 | ||
| 1211 | fn get(index: SymbolReloc.Index, elf: *Elf) *SymbolReloc { | 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,17 +1875,17 @@ fn addLocalSymbolAssumeCapacity(elf: *Elf, opts: AddLocalSymbolOptions) Symbol.L |
| 1875 | 1875 | ||
| 1876 | // `shdr.info` stores the index of the first global symbol. We will replace it with our | 1876 | // `shdr.info` stores the index of the first global symbol. We will replace it with our |
| 1877 | // new local symbol, and move the global symbol to a new index at the end of the symtab. | 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 | const old_size = elf.targetLoad(&shdr.size); | 1880 | const old_size = elf.targetLoad(&shdr.size); |
| 1881 | const new_size = old_size + ent_size; | 1881 | const new_size = old_size + ent_size; |
| 1882 | 1882 | ||
| 1883 | assert(elf.symtab.items.len == @divExact(old_size, ent_size)); | 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 | elf.targetStore(&shdr.size, new_size); | 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 | elf.symtab.appendAssumeCapacity(undefined); | 1889 | elf.symtab.appendAssumeCapacity(undefined); |
| 1890 | 1890 | ||
| 1891 | const target_sym = @field(elf.symPtr(target_index), @tagName(class)); | 1891 | const target_sym = @field(elf.symPtr(target_index), @tagName(class)); |
| ... | @@ -1897,7 +1897,7 @@ fn addLocalSymbolAssumeCapacity(elf: *Elf, opts: AddLocalSymbolOptions) Symbol.L | ... | @@ -1897,7 +1897,7 @@ fn addLocalSymbolAssumeCapacity(elf: *Elf, opts: AddLocalSymbolOptions) Symbol.L |
| 1897 | // ...then the `elf.symtab` metadata... | 1897 | // ...then the `elf.symtab` metadata... |
| 1898 | new_index.ptr(elf).* = target_index.ptr(elf).*; | 1898 | new_index.ptr(elf).* = target_index.ptr(elf).*; |
| 1899 | // ...then update the `elf.globals` tracking. | 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 | elf.globalByName(global_name).?.symtab_index = new_index; | 1901 | elf.globalByName(global_name).?.symtab_index = new_index; |
| 1902 | 1902 | ||
| 1903 | if (elf.ehdrType() == .REL and target_index.ptr(elf).first_target_reloc != .none) { | 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,7 +1912,7 @@ fn addLocalSymbolAssumeCapacity(elf: *Elf, opts: AddLocalSymbolOptions) Symbol.L |
| 1912 | }; | 1912 | }; |
| 1913 | 1913 | ||
| 1914 | target_sym.* = .{ | 1914 | target_sym.* = .{ |
| 1915 | .name = @intFromEnum(opts.name), | 1915 | .name = @backingInt(opts.name), |
| 1916 | .value = @intCast(opts.value), | 1916 | .value = @intCast(opts.value), |
| 1917 | .size = @intCast(opts.size), | 1917 | .size = @intCast(opts.size), |
| 1918 | .info = .{ .type = opts.type, .bind = .LOCAL }, | 1918 | .info = .{ .type = opts.type, .bind = .LOCAL }, |
| ... | @@ -1923,7 +1923,7 @@ fn addLocalSymbolAssumeCapacity(elf: *Elf, opts: AddLocalSymbolOptions) Symbol.L | ... | @@ -1923,7 +1923,7 @@ fn addLocalSymbolAssumeCapacity(elf: *Elf, opts: AddLocalSymbolOptions) Symbol.L |
| 1923 | std.mem.byteSwapAllFields(class.ElfN().Sym, target_sym); | 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,7 +2082,7 @@ fn addGlobalSymbolAssumeCapacity(elf: *Elf, opts: AddGlobalSymbolOptions) error{ |
| 2082 | else => |t| t, | 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 | elf.symtab.appendAssumeCapacity(.{ | 2086 | elf.symtab.appendAssumeCapacity(.{ |
| 2087 | .node = opts.node, | 2087 | .node = opts.node, |
| 2088 | .first_target_reloc = .none, | 2088 | .first_target_reloc = .none, |
| ... | @@ -2092,12 +2092,12 @@ fn addGlobalSymbolAssumeCapacity(elf: *Elf, opts: AddGlobalSymbolOptions) error{ | ... | @@ -2092,12 +2092,12 @@ fn addGlobalSymbolAssumeCapacity(elf: *Elf, opts: AddGlobalSymbolOptions) error{ |
| 2092 | const Sym = class.ElfN().Sym; | 2092 | const Sym = class.ElfN().Sym; |
| 2093 | // Increase the symtab size... | 2093 | // Increase the symtab size... |
| 2094 | const old_size = elf.targetLoad(&shdr.size); | 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 | elf.targetStore(&shdr.size, old_size + @sizeOf(Sym)); | 2096 | elf.targetStore(&shdr.size, old_size + @sizeOf(Sym)); |
| 2097 | // ...then populate the newly-valid symbol pointer | 2097 | // ...then populate the newly-valid symbol pointer |
| 2098 | const sym = @field(elf.symPtr(sym_index), @tagName(class)); | 2098 | const sym = @field(elf.symPtr(sym_index), @tagName(class)); |
| 2099 | sym.* = .{ | 2099 | sym.* = .{ |
| 2100 | .name = @intFromEnum(opts.name.strtab), | 2100 | .name = @backingInt(opts.name.strtab), |
| 2101 | .value = @intCast(opts.value), | 2101 | .value = @intCast(opts.value), |
| 2102 | .size = @intCast(opts.size), | 2102 | .size = @intCast(opts.size), |
| 2103 | .info = .{ .type = @"type", .bind = bind }, | 2103 | .info = .{ .type = @"type", .bind = bind }, |
| ... | @@ -2133,7 +2133,7 @@ fn addGlobalSymbolAssumeCapacity(elf: *Elf, opts: AddGlobalSymbolOptions) error{ | ... | @@ -2133,7 +2133,7 @@ fn addGlobalSymbolAssumeCapacity(elf: *Elf, opts: AddGlobalSymbolOptions) error{ |
| 2133 | // ...then populate the newly-valid symbol pointer | 2133 | // ...then populate the newly-valid symbol pointer |
| 2134 | const sym = @field(elf.dynsymPtr(dynsym_index), @tagName(class)); | 2134 | const sym = @field(elf.dynsymPtr(dynsym_index), @tagName(class)); |
| 2135 | sym.* = .{ | 2135 | sym.* = .{ |
| 2136 | .name = @intFromEnum(opts.name.dynstr), | 2136 | .name = @backingInt(opts.name.dynstr), |
| 2137 | .value = @intCast(opts.value), | 2137 | .value = @intCast(opts.value), |
| 2138 | .size = @intCast(opts.size), | 2138 | .size = @intCast(opts.size), |
| 2139 | .info = .{ .type = @"type", .bind = bind }, | 2139 | .info = .{ .type = @"type", .bind = bind }, |
| ... | @@ -2285,7 +2285,7 @@ fn setGlobalSymbolValue( | ... | @@ -2285,7 +2285,7 @@ fn setGlobalSymbolValue( |
| 2285 | if (!elf.pltEntryIsDead(plt_index) and | 2285 | if (!elf.pltEntryIsDead(plt_index) and |
| 2286 | elf.classifySymbolValue(.global(global_name)) != .dynamic) | 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 | assert(elf.pltEntryIsDead(plt_index)); | 2289 | assert(elf.pltEntryIsDead(plt_index)); |
| 2290 | } | 2290 | } |
| 2291 | } | 2291 | } |
| ... | @@ -2371,14 +2371,14 @@ fn moveDemotedGlobal(elf: *Elf, global_ptr: *Symbol.Global) void { | ... | @@ -2371,14 +2371,14 @@ fn moveDemotedGlobal(elf: *Elf, global_ptr: *Symbol.Global) void { |
| 2371 | inline else => |shdr, class| { | 2371 | inline else => |shdr, class| { |
| 2372 | // `shdr.info` stores the index of the first global symbol. We are going to swap the | 2372 | // `shdr.info` stores the index of the first global symbol. We are going to swap the |
| 2373 | // demoted symbol with that first global symbol, then increment that start index. | 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 | const src_index = global_ptr.symtab_index; | 2375 | const src_index = global_ptr.symtab_index; |
| 2376 | 2376 | ||
| 2377 | // This global should currently be in the "global symbols" part of the symtab, since our | 2377 | // This global should currently be in the "global symbols" part of the symtab, since our |
| 2378 | // job is to move it *out* of that part: | 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 | if (src_index != dest_index) { | 2383 | if (src_index != dest_index) { |
| 2384 | // The demoted global was not the first global in the symtab, so we need to swap it | 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,10 +2387,10 @@ fn moveDemotedGlobal(elf: *Elf, global_ptr: *Symbol.Global) void { |
| 2387 | const src_sym_ptr = @field(elf.symPtr(src_index), @tagName(class)); | 2387 | const src_sym_ptr = @field(elf.symPtr(src_index), @tagName(class)); |
| 2388 | const dest_sym_ptr = @field(elf.symPtr(dest_index), @tagName(class)); | 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 | assert(elf.globalByName(this_name).? == global_ptr); | 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 | const other_global_ptr = elf.globalByName(other_name).?; | 2394 | const other_global_ptr = elf.globalByName(other_name).?; |
| 2395 | assert(other_global_ptr.symtab_index == dest_index); | 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,7 +2426,7 @@ fn moveDemotedGlobal(elf: *Elf, global_ptr: *Symbol.Global) void { |
| 2426 | const src_dynsym_ptr = @field(elf.dynsymPtr(remove_dynsym_index), @tagName(class)); | 2426 | const src_dynsym_ptr = @field(elf.dynsymPtr(remove_dynsym_index), @tagName(class)); |
| 2427 | const dest_dynsym_ptr = @field(elf.dynsymPtr(free_dynsym_index), @tagName(class)); | 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 | const moved_name = elf.stringExisting(.strtab, moved_name_dynstr.slice(elf)); | 2430 | const moved_name = elf.stringExisting(.strtab, moved_name_dynstr.slice(elf)); |
| 2431 | const moved_global_ptr = elf.globalByName(moved_name).?; | 2431 | const moved_global_ptr = elf.globalByName(moved_name).?; |
| 2432 | 2432 | ||
| ... | @@ -2486,7 +2486,7 @@ const Symbol = struct { | ... | @@ -2486,7 +2486,7 @@ const Symbol = struct { |
| 2486 | _, | 2486 | _, |
| 2487 | 2487 | ||
| 2488 | fn ptr(si: Symbol.Index, elf: *Elf) *Symbol { | 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,7 +2505,7 @@ const Symbol = struct { |
| 2505 | _, | 2505 | _, |
| 2506 | 2506 | ||
| 2507 | fn index(li: LocalIndex) Index { | 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,26 +2517,26 @@ const Symbol = struct { |
| 2517 | const @"null": Symbol.Id = .local(.null); | 2517 | const @"null": Symbol.Id = .local(.null); |
| 2518 | 2518 | ||
| 2519 | fn local(lsi: Symbol.LocalIndex) Symbol.Id { | 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 | fn global(name: String(.strtab)) Symbol.Id { | 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 | fn unwrap(s: Symbol.Id) union(enum) { | 2525 | fn unwrap(s: Symbol.Id) union(enum) { |
| 2526 | local: Symbol.LocalIndex, | 2526 | local: Symbol.LocalIndex, |
| 2527 | global: String(.strtab), | 2527 | global: String(.strtab), |
| 2528 | } { | 2528 | } { |
| 2529 | return switch (s.kind) { | 2529 | return switch (s.kind) { |
| 2530 | .local => .{ .local = @enumFromInt(s.raw) }, | 2530 | .local => .{ .local = @fromBackingInt(@intCast(s.raw)) }, |
| 2531 | .global => .{ .global = @enumFromInt(s.raw) }, | 2531 | .global => .{ .global = @fromBackingInt(@intCast(s.raw)) }, |
| 2532 | }; | 2532 | }; |
| 2533 | } | 2533 | } |
| 2534 | 2534 | ||
| 2535 | fn toTypeErased(s: Symbol.Id) link.File.SymbolId { | 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 | fn fromTypeErased(s: link.File.SymbolId) Symbol.Id { | 2538 | fn fromTypeErased(s: link.File.SymbolId) Symbol.Id { |
| 2539 | return @bitCast(@intFromEnum(s)); | 2539 | return @bitCast(@backingInt(s)); |
| 2540 | } | 2540 | } |
| 2541 | 2541 | ||
| 2542 | fn index(s: Symbol.Id, elf: *const Elf) Symbol.Index { | 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,7 +2814,7 @@ fn lazySymbolInner(elf: *Elf, lazy: link.File.LazySymbol) Error!link.File.Symbol |
| 2814 | const name = std.fmt.bufPrint( | 2814 | const name = std.fmt.bufPrint( |
| 2815 | &name_buf, | 2815 | &name_buf, |
| 2816 | "__lazy_{t}_{d}", | 2816 | "__lazy_{t}_{d}", |
| 2817 | .{ lazy.kind, @intFromEnum(lazy.ty) }, | 2817 | .{ lazy.kind, @backingInt(lazy.ty) }, |
| 2818 | ) catch unreachable; | 2818 | ) catch unreachable; |
| 2819 | gop.value_ptr.* = .{ | 2819 | gop.value_ptr.* = .{ |
| 2820 | .lsi = elf.addLocalSymbolAssumeCapacity(.{ | 2820 | .lsi = elf.addLocalSymbolAssumeCapacity(.{ |
| ... | @@ -2829,8 +2829,8 @@ fn lazySymbolInner(elf: *Elf, lazy: link.File.LazySymbol) Error!link.File.Symbol | ... | @@ -2829,8 +2829,8 @@ fn lazySymbolInner(elf: *Elf, lazy: link.File.LazySymbol) Error!link.File.Symbol |
| 2829 | .first_got_reloc = .none, | 2829 | .first_got_reloc = .none, |
| 2830 | }; | 2830 | }; |
| 2831 | elf.nodes.appendAssumeCapacity(switch (lazy.kind) { | 2831 | elf.nodes.appendAssumeCapacity(switch (lazy.kind) { |
| 2832 | .code => .{ .lazy_code = @enumFromInt(gop.index) }, | 2832 | .code => .{ .lazy_code = @fromBackingInt(@intCast(gop.index)) }, |
| 2833 | .const_data => .{ .lazy_const_data = @enumFromInt(gop.index) }, | 2833 | .const_data => .{ .lazy_const_data = @fromBackingInt(@intCast(gop.index)) }, |
| 2834 | }); | 2834 | }); |
| 2835 | elf.synth_prog_node.increaseEstimatedTotalItems(1); | 2835 | elf.synth_prog_node.increaseEstimatedTotalItems(1); |
| 2836 | } | 2836 | } |
| ... | @@ -2994,19 +2994,19 @@ fn String(section: StringSection) type { | ... | @@ -2994,19 +2994,19 @@ fn String(section: StringSection) type { |
| 2994 | 2994 | ||
| 2995 | fn slice(str: @This(), elf: *Elf) [:0]const u8 { | 2995 | fn slice(str: @This(), elf: *Elf) [:0]const u8 { |
| 2996 | const section_node = section.shndx(elf).get(elf).ni; | 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 | return overlong[0..std.mem.findScalar(u8, overlong, 0).? :0]; | 2998 | return overlong[0..std.mem.findScalar(u8, overlong, 0).? :0]; |
| 2999 | } | 2999 | } |
| 3000 | }; | 3000 | }; |
| 3001 | } | 3001 | } |
| 3002 | fn string(elf: *Elf, comptime section: StringSection, key: []const u8) Error!String(section) { | 3002 | fn string(elf: *Elf, comptime section: StringSection, key: []const u8) Error!String(section) { |
| 3003 | const st: *StringTable = &@field(elf, @tagName(section)); | 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 | /// Like `string`, but asserts that the string is already in `section`. | 3006 | /// Like `string`, but asserts that the string is already in `section`. |
| 3007 | fn stringExisting(elf: *Elf, comptime section: StringSection, key: []const u8) String(section) { | 3007 | fn stringExisting(elf: *Elf, comptime section: StringSection, key: []const u8) String(section) { |
| 3008 | const st: *StringTable = &@field(elf, @tagName(section)); | 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 | const StringTable = struct { | 3012 | const StringTable = struct { |
| ... | @@ -3688,7 +3688,7 @@ fn initHeaders( | ... | @@ -3688,7 +3688,7 @@ fn initHeaders( |
| 3688 | 3688 | ||
| 3689 | const sh_undef: *ElfN.Shdr = @ptrCast(@alignCast(elf.ni.shdr.slice(&elf.mf))); | 3689 | const sh_undef: *ElfN.Shdr = @ptrCast(@alignCast(elf.ni.shdr.slice(&elf.mf))); |
| 3690 | sh_undef.* = .{ | 3690 | sh_undef.* = .{ |
| 3691 | .name = @intFromEnum(String(.shstrtab).empty), | 3691 | .name = @backingInt(String(.shstrtab).empty), |
| 3692 | .type = .NULL, | 3692 | .type = .NULL, |
| 3693 | .flags = .{ .shf = .{} }, | 3693 | .flags = .{ .shf = .{} }, |
| 3694 | .addr = 0, | 3694 | .addr = 0, |
| ... | @@ -3716,7 +3716,7 @@ fn initHeaders( | ... | @@ -3716,7 +3716,7 @@ fn initHeaders( |
| 3716 | })); | 3716 | })); |
| 3717 | const symtab_null = @field(elf.symPtr(.null), @tagName(ct_class)); | 3717 | const symtab_null = @field(elf.symPtr(.null), @tagName(ct_class)); |
| 3718 | symtab_null.* = .{ | 3718 | symtab_null.* = .{ |
| 3719 | .name = @intFromEnum(String(.strtab).empty), | 3719 | .name = @backingInt(String(.strtab).empty), |
| 3720 | .value = 0, | 3720 | .value = 0, |
| 3721 | .size = 0, | 3721 | .size = 0, |
| 3722 | .info = .{ .type = .NOTYPE, .bind = .LOCAL }, | 3722 | .info = .{ .type = .NOTYPE, .bind = .LOCAL }, |
| ... | @@ -3749,7 +3749,7 @@ fn initHeaders( | ... | @@ -3749,7 +3749,7 @@ fn initHeaders( |
| 3749 | })); | 3749 | })); |
| 3750 | Section.Index.get(.strtab, elf).ni.slice(&elf.mf)[0] = 0; | 3750 | Section.Index.get(.strtab, elf).ni.slice(&elf.mf)[0] = 0; |
| 3751 | switch (elf.shdrPtr(.symtab)) { | 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 | assert(.rodata == try elf.addSection(elf.ni.rodata, .{ | 3755 | assert(.rodata == try elf.addSection(elf.ni.rodata, .{ |
| ... | @@ -3872,7 +3872,7 @@ fn initHeaders( | ... | @@ -3872,7 +3872,7 @@ fn initHeaders( |
| 3872 | }); | 3872 | }); |
| 3873 | const dynsym_null = @field(elf.dynsymPtr(0), @tagName(ct_class)); | 3873 | const dynsym_null = @field(elf.dynsymPtr(0), @tagName(ct_class)); |
| 3874 | dynsym_null.* = .{ | 3874 | dynsym_null.* = .{ |
| 3875 | .name = @intFromEnum(String(.dynstr).empty), | 3875 | .name = @backingInt(String(.dynstr).empty), |
| 3876 | .value = 0, | 3876 | .value = 0, |
| 3877 | .size = 0, | 3877 | .size = 0, |
| 3878 | .info = .{ .type = .NOTYPE, .bind = .LOCAL }, | 3878 | .info = .{ .type = .NOTYPE, .bind = .LOCAL }, |
| ... | @@ -3926,7 +3926,7 @@ fn initHeaders( | ... | @@ -3926,7 +3926,7 @@ fn initHeaders( |
| 3926 | 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp *0x0(%rip) | 3926 | 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp *0x0(%rip) |
| 3927 | 0x0f, 0x1f, 0x40, 0x00, // nopl 0x0(%rax) | 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 | try elf.ensureUnusedRelocCapacity(plt_ni, 2); | 3930 | try elf.ensureUnusedRelocCapacity(plt_ni, 2); |
| 3931 | try elf.addSymbolRelocAssumeCapacity( | 3931 | try elf.addSymbolRelocAssumeCapacity( |
| 3932 | plt_ni, | 3932 | plt_ni, |
| ... | @@ -3969,7 +3969,7 @@ fn initHeaders( | ... | @@ -3969,7 +3969,7 @@ fn initHeaders( |
| 3969 | 0x4c, 0x00, 0x01, 0xe0, // jr $t3 | 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 | try elf.ensureUnusedRelocCapacity(plt_ni, 3); | 3973 | try elf.ensureUnusedRelocCapacity(plt_ni, 3); |
| 3974 | elf.addRelocAssumeCapacity(plt_ni, 0, got_plt_sym, 0, .{ .LARCH = .PCALA_HI20 }) catch |err| switch (err) { | 3974 | elf.addRelocAssumeCapacity(plt_ni, 0, got_plt_sym, 0, .{ .LARCH = .PCALA_HI20 }) catch |err| switch (err) { |
| 3975 | error.UnknownRelocation => unreachable, | 3975 | error.UnknownRelocation => unreachable, |
| ... | @@ -4184,7 +4184,7 @@ fn initHeaders( | ... | @@ -4184,7 +4184,7 @@ fn initHeaders( |
| 4184 | assert(elf.shdrs.items.len == shnum); | 4184 | assert(elf.shdrs.items.len == shnum); |
| 4185 | 4185 | ||
| 4186 | for (0..shnum) |shndx_raw| { | 4186 | for (0..shnum) |shndx_raw| { |
| 4187 | const shndx: Section.Index = @enumFromInt(shndx_raw); | 4187 | const shndx: Section.Index = @fromBackingInt(@intCast(shndx_raw)); |
| 4188 | elf.section_by_name.putAssumeCapacityNoClobber(shndx.name(elf), {}); | 4188 | elf.section_by_name.putAssumeCapacityNoClobber(shndx.name(elf), {}); |
| 4189 | } | 4189 | } |
| 4190 | 4190 | ||
| ... | @@ -4239,7 +4239,7 @@ pub fn endProgress(elf: *Elf) void { | ... | @@ -4239,7 +4239,7 @@ pub fn endProgress(elf: *Elf) void { |
| 4239 | } | 4239 | } |
| 4240 | 4240 | ||
| 4241 | fn getNode(elf: *const Elf, ni: MappedFile.Node.Index) Node { | 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 | /// Asserts that `ni` is a section, input section, copied global, NAV, UAV, or lazy code/data. | 4244 | /// Asserts that `ni` is a section, input section, copied global, NAV, UAV, or lazy code/data. |
| 4245 | fn getNodeShndx(elf: *const Elf, ni: MappedFile.Node.Index) Section.Index { | 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,15 +4290,15 @@ fn resetNodeRelocs(elf: *Elf, ni: MappedFile.Node.Index) void { |
| 4290 | .section => unreachable, // cannot contain relocs (.plt and .dynamic unsupported) | 4290 | .section => unreachable, // cannot contain relocs (.plt and .dynamic unsupported) |
| 4291 | .copied_global => unreachable, // cannot contain relocs | 4291 | .copied_global => unreachable, // cannot contain relocs |
| 4292 | .input_section => |isi| .{ | 4292 | .input_section => |isi| .{ |
| 4293 | &elf.input_sections.items[@intFromEnum(isi)].first_symbol_reloc, | 4293 | &elf.input_sections.items[@backingInt(isi)].first_symbol_reloc, |
| 4294 | &elf.input_sections.items[@intFromEnum(isi)].first_got_reloc, | 4294 | &elf.input_sections.items[@backingInt(isi)].first_got_reloc, |
| 4295 | }, | 4295 | }, |
| 4296 | .nav => |nmi| .{ | 4296 | .nav => |nmi| .{ |
| 4297 | &elf.navs.values()[@intFromEnum(nmi)].first_symbol_reloc, | 4297 | &elf.navs.values()[@backingInt(nmi)].first_symbol_reloc, |
| 4298 | &elf.navs.values()[@intFromEnum(nmi)].first_got_reloc, | 4298 | &elf.navs.values()[@backingInt(nmi)].first_got_reloc, |
| 4299 | }, | 4299 | }, |
| 4300 | .uav => |umi| .{ | 4300 | .uav => |umi| .{ |
| 4301 | &elf.uavs.values()[@intFromEnum(umi)].first_symbol_reloc, | 4301 | &elf.uavs.values()[@backingInt(umi)].first_symbol_reloc, |
| 4302 | null, | 4302 | null, |
| 4303 | }, | 4303 | }, |
| 4304 | inline .lazy_code, .lazy_const_data => |lmi| .{ | 4304 | inline .lazy_code, .lazy_const_data => |lmi| .{ |
| ... | @@ -4309,23 +4309,23 @@ fn resetNodeRelocs(elf: *Elf, ni: MappedFile.Node.Index) void { | ... | @@ -4309,23 +4309,23 @@ fn resetNodeRelocs(elf: *Elf, ni: MappedFile.Node.Index) void { |
| 4309 | 4309 | ||
| 4310 | if (symbol_relocs.* != .none) { | 4310 | if (symbol_relocs.* != .none) { |
| 4311 | for ( | 4311 | for ( |
| 4312 | elf.symbol_relocs.items[@intFromEnum(symbol_relocs.*)..], | 4312 | elf.symbol_relocs.items[@backingInt(symbol_relocs.*)..], |
| 4313 | @intFromEnum(symbol_relocs.*).., | 4313 | @backingInt(symbol_relocs.*).., |
| 4314 | ) |*reloc, index| { | 4314 | ) |*reloc, index| { |
| 4315 | if (reloc.node != ni) break; | 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 | if (got_relocs) |ptr| { | 4321 | if (got_relocs) |ptr| { |
| 4322 | if (ptr.* != .none) { | 4322 | if (ptr.* != .none) { |
| 4323 | for (elf.got_relocs.items[@intFromEnum(ptr.*)..]) |*reloc| { | 4323 | for (elf.got_relocs.items[@backingInt(ptr.*)..]) |*reloc| { |
| 4324 | if (reloc.node != ni) break; | 4324 | if (reloc.node != ni) break; |
| 4325 | reloc.delete(elf); | 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,7 +4339,7 @@ fn flushMovedNodeRelocs( |
| 4339 | first_got_reloc: GotReloc.Index, | 4339 | first_got_reloc: GotReloc.Index, |
| 4340 | ) void { | 4340 | ) void { |
| 4341 | if (first_symbol_reloc != .none) { | 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 | if (reloc.node != node) break; | 4343 | if (reloc.node != node) break; |
| 4344 | if (reloc.rela_index.unwrap()) |rela_index| { | 4344 | if (reloc.rela_index.unwrap()) |rela_index| { |
| 4345 | // The node has moved, so the offset of the relocation within the section might have | 4345 | // The node has moved, so the offset of the relocation within the section might have |
| ... | @@ -4351,7 +4351,7 @@ fn flushMovedNodeRelocs( | ... | @@ -4351,7 +4351,7 @@ fn flushMovedNodeRelocs( |
| 4351 | } | 4351 | } |
| 4352 | 4352 | ||
| 4353 | if (first_got_reloc != .none) { | 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 | if (reloc.node != node) break; | 4355 | if (reloc.node != node) break; |
| 4356 | reloc.apply(elf); | 4356 | reloc.apply(elf); |
| 4357 | } | 4357 | } |
| ... | @@ -4359,33 +4359,33 @@ fn flushMovedNodeRelocs( | ... | @@ -4359,33 +4359,33 @@ fn flushMovedNodeRelocs( |
| 4359 | } | 4359 | } |
| 4360 | 4360 | ||
| 4361 | fn identClass(elf: *const Elf) std.elf.CLASS { | 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 | /// Like `std.elf.ET`, but only includes the ELF machine architectures we support, so that we can | 4365 | /// Like `std.elf.ET`, but only includes the ELF machine architectures we support, so that we can |
| 4366 | /// use exhaustive `switch` statements in the linker implementation. | 4366 | /// use exhaustive `switch` statements in the linker implementation. |
| 4367 | const EhdrMachine = enum(u16) { | 4367 | const EhdrMachine = enum(u16) { |
| 4368 | AARCH64 = @intFromEnum(std.elf.EM.AARCH64), | 4368 | AARCH64 = @backingInt(std.elf.EM.AARCH64), |
| 4369 | LOONGARCH = @intFromEnum(std.elf.EM.LOONGARCH), | 4369 | LOONGARCH = @backingInt(std.elf.EM.LOONGARCH), |
| 4370 | PPC64 = @intFromEnum(std.elf.EM.PPC64), | 4370 | PPC64 = @backingInt(std.elf.EM.PPC64), |
| 4371 | RISCV = @intFromEnum(std.elf.EM.RISCV), | 4371 | RISCV = @backingInt(std.elf.EM.RISCV), |
| 4372 | SPARCV9 = @intFromEnum(std.elf.EM.SPARCV9), | 4372 | SPARCV9 = @backingInt(std.elf.EM.SPARCV9), |
| 4373 | X86_64 = @intFromEnum(std.elf.EM.X86_64), | 4373 | X86_64 = @backingInt(std.elf.EM.X86_64), |
| 4374 | 4374 | ||
| 4375 | fn toElf(m: EhdrMachine) std.elf.EM { | 4375 | fn toElf(m: EhdrMachine) std.elf.EM { |
| 4376 | return @bitCast(m); | 4376 | return @bitCast(m); |
| 4377 | } | 4377 | } |
| 4378 | /// Returns `null` if `m` is not a supported ELF machine architecture. | 4378 | /// Returns `null` if `m` is not a supported ELF machine architecture. |
| 4379 | fn fromElf(m: std.elf.EM) ?EhdrMachine { | 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 | /// Like `std.elf.ET`, but only includes the types of ELF file we can produce, so that we can use | 4383 | /// Like `std.elf.ET`, but only includes the types of ELF file we can produce, so that we can use |
| 4384 | /// exhaustive `switch` statements in the linker implementation. | 4384 | /// exhaustive `switch` statements in the linker implementation. |
| 4385 | const EhdrType = enum(u16) { | 4385 | const EhdrType = enum(u16) { |
| 4386 | REL = @intFromEnum(std.elf.ET.REL), | 4386 | REL = @backingInt(std.elf.ET.REL), |
| 4387 | EXEC = @intFromEnum(std.elf.ET.EXEC), | 4387 | EXEC = @backingInt(std.elf.ET.EXEC), |
| 4388 | DYN = @intFromEnum(std.elf.ET.DYN), | 4388 | DYN = @backingInt(std.elf.ET.DYN), |
| 4389 | fn toElf(t: EhdrType) std.elf.ET { | 4389 | fn toElf(t: EhdrType) std.elf.ET { |
| 4390 | return @bitCast(t); | 4390 | return @bitCast(t); |
| 4391 | } | 4391 | } |
| ... | @@ -4415,7 +4415,7 @@ fn targetPtrSize(elf: *const Elf) u8 { | ... | @@ -4415,7 +4415,7 @@ fn targetPtrSize(elf: *const Elf) u8 { |
| 4415 | return elf.identClass().size(); | 4415 | return elf.identClass().size(); |
| 4416 | } | 4416 | } |
| 4417 | fn targetEndian(elf: *const Elf) std.lang.Endian { | 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 | return ident_data.endian(); | 4419 | return ident_data.endian(); |
| 4420 | } | 4420 | } |
| 4421 | fn targetTlsVariant(elf: *const Elf) union(enum) { | 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,7 +4487,7 @@ fn targetLoad(elf: *const Elf, ptr: anytype) @typeInfo(@TypeOf(ptr)).pointer.chi |
| 4487 | return switch (@typeInfo(Child)) { | 4487 | return switch (@typeInfo(Child)) { |
| 4488 | else => @compileError(@typeName(Child)), | 4488 | else => @compileError(@typeName(Child)), |
| 4489 | .int => std.mem.toNative(Child, ptr.*, elf.targetEndian()), | 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 | .@"struct" => |@"struct"| @bitCast( | 4491 | .@"struct" => |@"struct"| @bitCast( |
| 4492 | elf.targetLoad(@as(*align(alignment) @"struct".backing_integer.?, @ptrCast(ptr))), | 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,7 +4502,7 @@ fn targetStore(elf: *const Elf, ptr: anytype, val: @typeInfo(@TypeOf(ptr)).point |
| 4502 | .int => ptr.* = std.mem.nativeTo(Child, val, elf.targetEndian()), | 4502 | .int => ptr.* = std.mem.nativeTo(Child, val, elf.targetEndian()), |
| 4503 | .@"enum" => |@"enum"| elf.targetStore( | 4503 | .@"enum" => |@"enum"| elf.targetStore( |
| 4504 | @as(*align(alignment) @"enum".tag_type, @ptrCast(ptr)), | 4504 | @as(*align(alignment) @"enum".tag_type, @ptrCast(ptr)), |
| 4505 | @intFromEnum(val), | 4505 | @backingInt(val), |
| 4506 | ), | 4506 | ), |
| 4507 | .@"struct" => |@"struct"| elf.targetStore( | 4507 | .@"struct" => |@"struct"| elf.targetStore( |
| 4508 | @as(*align(alignment) @"struct".backing_integer.?, @ptrCast(ptr)), | 4508 | @as(*align(alignment) @"struct".backing_integer.?, @ptrCast(ptr)), |
| ... | @@ -4557,7 +4557,7 @@ fn shdrPtr(elf: *Elf, shndx: Section.Index) ShdrPtr { | ... | @@ -4557,7 +4557,7 @@ fn shdrPtr(elf: *Elf, shndx: Section.Index) ShdrPtr { |
| 4557 | .NONE, _ => unreachable, | 4557 | .NONE, _ => unreachable, |
| 4558 | inline else => |class| { | 4558 | inline else => |class| { |
| 4559 | const shdr_slice: []class.ElfN().Shdr = @ptrCast(@alignCast(raw_slice)); | 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 | return @unionInit(ShdrPtr, @tagName(class), shdr_ptr); | 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,7 +4574,7 @@ fn symPtr(elf: *Elf, index: Symbol.Index) SymPtr { |
| 4574 | inline else => |shdr, class| { | 4574 | inline else => |shdr, class| { |
| 4575 | const size = elf.targetLoad(&shdr.size); | 4575 | const size = elf.targetLoad(&shdr.size); |
| 4576 | const slice: []class.ElfN().Sym = @ptrCast(@alignCast(raw_slice[0..@intCast(size)])); | 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,7 +4653,7 @@ fn mapInputSection(elf: *Elf, opts: struct { |
| 4653 | const name_shstrtab = try elf.string(.shstrtab, name); | 4653 | const name_shstrtab = try elf.string(.shstrtab, name); |
| 4654 | const gop = try elf.section_by_name.getOrPut(gpa, name_shstrtab); | 4654 | const gop = try elf.section_by_name.getOrPut(gpa, name_shstrtab); |
| 4655 | if (gop.found_existing) { | 4655 | if (gop.found_existing) { |
| 4656 | break :existing @enumFromInt(gop.index); | 4656 | break :existing @fromBackingInt(@intCast(gop.index)); |
| 4657 | } | 4657 | } |
| 4658 | errdefer assert(elf.section_by_name.pop().?.key == name_shstrtab); | 4658 | errdefer assert(elf.section_by_name.pop().?.key == name_shstrtab); |
| 4659 | const parent_node: MappedFile.Node.Index = parent: { | 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,7 +4736,7 @@ fn navMapIndex(elf: *Elf, zcu: *Zcu, nav_index: InternPool.Nav.Index) Error!Node |
| 4736 | try elf.navs.ensureUnusedCapacity(gpa, 1); | 4736 | try elf.navs.ensureUnusedCapacity(gpa, 1); |
| 4737 | 4737 | ||
| 4738 | const nav_gop = elf.navs.getOrPutAssumeCapacity(nav_index); | 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 | if (!nav_gop.found_existing) { | 4740 | if (!nav_gop.found_existing) { |
| 4741 | const shndx: Section.Index = section: { | 4741 | const shndx: Section.Index = section: { |
| 4742 | if (nav.resolved.?.@"linksection".toSlice(ip)) |@"linksection"| { | 4742 | if (nav.resolved.?.@"linksection".toSlice(ip)) |@"linksection"| { |
| ... | @@ -4835,7 +4835,7 @@ fn uavMapIndex( | ... | @@ -4835,7 +4835,7 @@ fn uavMapIndex( |
| 4835 | }; | 4835 | }; |
| 4836 | 4836 | ||
| 4837 | const uav_gop = elf.uavs.getOrPutAssumeCapacity(uav_val); | 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 | if (!uav_gop.found_existing) { | 4839 | if (!uav_gop.found_existing) { |
| 4840 | const shndx: Section.Index = .data_rel_ro; // TODO: it would be better to use `.rodata` if the UAV value doesn't have relocs | 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 | const node = try elf.mf.addLastChildNode(gpa, shndx.get(elf).ni, .{ | 4841 | const node = try elf.mf.addLastChildNode(gpa, shndx.get(elf).ni, .{ |
| ... | @@ -4846,7 +4846,7 @@ fn uavMapIndex( | ... | @@ -4846,7 +4846,7 @@ fn uavMapIndex( |
| 4846 | const name = std.fmt.bufPrint( | 4846 | const name = std.fmt.bufPrint( |
| 4847 | &name_buf, | 4847 | &name_buf, |
| 4848 | "__anon_{d}", | 4848 | "__anon_{d}", |
| 4849 | .{@intFromEnum(uav_val)}, | 4849 | .{@backingInt(uav_val)}, |
| 4850 | ) catch unreachable; | 4850 | ) catch unreachable; |
| 4851 | uav_gop.value_ptr.* = .{ | 4851 | uav_gop.value_ptr.* = .{ |
| 4852 | .lsi = elf.addLocalSymbolAssumeCapacity(.{ | 4852 | .lsi = elf.addLocalSymbolAssumeCapacity(.{ |
| ... | @@ -5061,7 +5061,7 @@ fn loadObject( | ... | @@ -5061,7 +5061,7 @@ fn loadObject( |
| 5061 | const diags = &comp.link_diags; | 5061 | const diags = &comp.link_diags; |
| 5062 | const r = &fr.interface; | 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 | log.debug("loadObject({f}{f})", .{ path.fmtEscapeString(), fmtMemberString(member) }); | 5065 | log.debug("loadObject({f}{f})", .{ path.fmtEscapeString(), fmtMemberString(member) }); |
| 5066 | elf.checkInputIdent(path, r) catch |err| switch (err) { | 5066 | elf.checkInputIdent(path, r) catch |err| switch (err) { |
| 5067 | else => |e| return e, | 5067 | else => |e| return e, |
| ... | @@ -5251,9 +5251,9 @@ fn loadObject( | ... | @@ -5251,9 +5251,9 @@ fn loadObject( |
| 5251 | .fixed = opts.node_fixed, | 5251 | .fixed = opts.node_fixed, |
| 5252 | }); | 5252 | }); |
| 5253 | elf.nodes.appendAssumeCapacity(.{ | 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 | elf.input_sections.addOneAssumeCapacity().* = .{ | 5257 | elf.input_sections.addOneAssumeCapacity().* = .{ |
| 5258 | .input = input_index, | 5258 | .input = input_index, |
| 5259 | .file_location = .{ | 5259 | .file_location = .{ |
| ... | @@ -5598,7 +5598,7 @@ fn loadDso(elf: *Elf, path: std.Build.Cache.Path, fr: *Io.File.Reader) (LoadPars | ... | @@ -5598,7 +5598,7 @@ fn loadDso(elf: *Elf, path: std.Build.Cache.Path, fr: *Io.File.Reader) (LoadPars |
| 5598 | // insane---refer to the doc comment on `alignment` in `Elf.dso_globals`. | 5598 | // insane---refer to the doc comment on `alignment` in `Elf.dso_globals`. |
| 5599 | const sym_align: std.mem.Alignment = switch (sym.value) { | 5599 | const sym_align: std.mem.Alignment = switch (sym.value) { |
| 5600 | 0 => section_aligns[sym.shndx], | 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 | const name = try elf.string(.strtab, std.mem.sliceTo(dynstr[sym.name..], 0)); | 5604 | const name = try elf.string(.strtab, std.mem.sliceTo(dynstr[sym.name..], 0)); |
| ... | @@ -5900,16 +5900,16 @@ fn flushDynamic(elf: *Elf) void { | ... | @@ -5900,16 +5900,16 @@ fn flushDynamic(elf: *Elf) void { |
| 5900 | dynamic_entries[dynamic_index..][0..elf.needed.count()], | 5900 | dynamic_entries[dynamic_index..][0..elf.needed.count()], |
| 5901 | elf.needed.keys(), | 5901 | elf.needed.keys(), |
| 5902 | ) |*dynamic_entry, needed| { | 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 | dynamic_index += elf.needed.count(); | 5905 | dynamic_index += elf.needed.count(); |
| 5906 | 5906 | ||
| 5907 | if (elf.dynamic.soname != .empty) { | 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 | dynamic_index += 1; | 5909 | dynamic_index += 1; |
| 5910 | } | 5910 | } |
| 5911 | if (elf.dynamic.rpath != .empty) { | 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 | dynamic_index += 1; | 5913 | dynamic_index += 1; |
| 5914 | } | 5914 | } |
| 5915 | if (elf.dynamic.flags != 0) { | 5915 | if (elf.dynamic.flags != 0) { |
| ... | @@ -6033,8 +6033,8 @@ fn addSection(elf: *Elf, segment_ni: MappedFile.Node.Index, opts: struct { | ... | @@ -6033,8 +6033,8 @@ fn addSection(elf: *Elf, segment_ni: MappedFile.Node.Index, opts: struct { |
| 6033 | break :alloc_shndx .{ shndx, shnum }; | 6033 | break :alloc_shndx .{ shndx, shnum }; |
| 6034 | }, | 6034 | }, |
| 6035 | }; | 6035 | }; |
| 6036 | assert(shndx < @intFromEnum(Section.Index.LORESERVE)); | 6036 | assert(shndx < @backingInt(Section.Index.LORESERVE)); |
| 6037 | break :shndx .{ @enumFromInt(shndx), @as(u64, elf.targetLoad(&ehdr.shentsize)) * @as(u64, shnum) }; | 6037 | break :shndx .{ @fromBackingInt(@intCast(shndx)), @as(u64, elf.targetLoad(&ehdr.shentsize)) * @as(u64, shnum) }; |
| 6038 | }, | 6038 | }, |
| 6039 | }; | 6039 | }; |
| 6040 | try elf.ensureNodeSize(elf.ni.shdr, new_shdr_size); | 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,7 +6066,7 @@ fn addSection(elf: *Elf, segment_ni: MappedFile.Node.Index, opts: struct { |
| 6066 | switch (elf.shdrPtr(shndx)) { | 6066 | switch (elf.shdrPtr(shndx)) { |
| 6067 | inline else => |shdr, class| { | 6067 | inline else => |shdr, class| { |
| 6068 | shdr.* = .{ | 6068 | shdr.* = .{ |
| 6069 | .name = @intFromEnum(shstrtab_entry), | 6069 | .name = @backingInt(shstrtab_entry), |
| 6070 | .type = opts.type, | 6070 | .type = opts.type, |
| 6071 | .flags = .{ .shf = opts.flags }, | 6071 | .flags = .{ .shf = opts.flags }, |
| 6072 | .addr = @intCast(addr), | 6072 | .addr = @intCast(addr), |
| ... | @@ -6105,7 +6105,7 @@ fn ensureUnusedRelocCapacity(elf: *Elf, node: MappedFile.Node.Index, len: usize) | ... | @@ -6105,7 +6105,7 @@ fn ensureUnusedRelocCapacity(elf: *Elf, node: MappedFile.Node.Index, len: usize) |
| 6105 | const rela_shndx = try elf.addSection(.none, .{ | 6105 | const rela_shndx = try elf.addSection(.none, .{ |
| 6106 | .name = rela_name, | 6106 | .name = rela_name, |
| 6107 | .type = .RELA, | 6107 | .type = .RELA, |
| 6108 | .link = @intFromEnum(Section.Index.symtab), | 6108 | .link = @backingInt(Section.Index.symtab), |
| 6109 | .info = shndx.toSection().?, | 6109 | .info = shndx.toSection().?, |
| 6110 | .addralign = switch (class) { | 6110 | .addralign = switch (class) { |
| 6111 | .NONE, _ => unreachable, | 6111 | .NONE, _ => unreachable, |
| ... | @@ -6160,10 +6160,10 @@ fn addRelocAssumeCapacity( | ... | @@ -6160,10 +6160,10 @@ fn addRelocAssumeCapacity( |
| 6160 | // the section offset now, but there's no point, because `flushMovedNodeRelocs` will | 6160 | // the section offset now, but there's no point, because `flushMovedNodeRelocs` will |
| 6161 | // eventually do it for us anyway, so just init to 0. | 6161 | // eventually do it for us anyway, so just init to 0. |
| 6162 | .offset = 0, | 6162 | .offset = 0, |
| 6163 | .raw_sym_index = @intFromEnum(target.index(elf)), | 6163 | .raw_sym_index = @backingInt(target.index(elf)), |
| 6164 | .addend = addend, | 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 | const next: SymbolReloc.Index = next: { | 6167 | const next: SymbolReloc.Index = next: { |
| 6168 | const target_ptr = target.index(elf).ptr(elf); | 6168 | const target_ptr = target.index(elf).ptr(elf); |
| 6169 | const next = target_ptr.first_target_reloc; | 6169 | const next = target_ptr.first_target_reloc; |
| ... | @@ -6621,7 +6621,7 @@ fn addSymbolRelocAssumeCapacity( | ... | @@ -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 | const target_ptr = target.index(elf).ptr(elf); | 6625 | const target_ptr = target.index(elf).ptr(elf); |
| 6626 | const next = target_ptr.first_target_reloc; | 6626 | const next = target_ptr.first_target_reloc; |
| 6627 | target_ptr.first_target_reloc = ri; | 6627 | target_ptr.first_target_reloc = ri; |
| ... | @@ -7125,7 +7125,7 @@ pub fn idle(elf: *Elf, tid: Zcu.PerThread.Id) link.Error!bool { | ... | @@ -7125,7 +7125,7 @@ pub fn idle(elf: *Elf, tid: Zcu.PerThread.Id) link.Error!bool { |
| 7125 | 7125 | ||
| 7126 | task: { | 7126 | task: { |
| 7127 | if (elf.input_section_pending_index < elf.input_sections.items.len) { | 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 | elf.input_section_pending_index += 1; | 7129 | elf.input_section_pending_index += 1; |
| 7130 | const sub_prog_node = elf.idleProgNode(tid, elf.input_prog_node, elf.getNode(isi.node(elf))); | 7130 | const sub_prog_node = elf.idleProgNode(tid, elf.input_prog_node, elf.getNode(isi.node(elf))); |
| 7131 | defer sub_prog_node.end(); | 7131 | defer sub_prog_node.end(); |
| ... | @@ -7148,7 +7148,7 @@ pub fn idle(elf: *Elf, tid: Zcu.PerThread.Id) link.Error!bool { | ... | @@ -7148,7 +7148,7 @@ pub fn idle(elf: *Elf, tid: Zcu.PerThread.Id) link.Error!bool { |
| 7148 | .REL => { | 7148 | .REL => { |
| 7149 | // Index in `.symtab` has changed. Relocatables are easy, we just need to update | 7149 | // Index in `.symtab` has changed. Relocatables are easy, we just need to update |
| 7150 | // all of the output relocations. | 7150 | // all of the output relocations. |
| 7151 | const symtab_index = @intFromEnum(global.symtab_index); | 7151 | const symtab_index = @backingInt(global.symtab_index); |
| 7152 | var ri = sym.first_target_reloc; | 7152 | var ri = sym.first_target_reloc; |
| 7153 | while (ri != .none) { | 7153 | while (ri != .none) { |
| 7154 | const reloc = ri.get(elf); | 7154 | const reloc = ri.get(elf); |
| ... | @@ -7190,7 +7190,7 @@ pub fn idle(elf: *Elf, tid: Zcu.PerThread.Id) link.Error!bool { | ... | @@ -7190,7 +7190,7 @@ pub fn idle(elf: *Elf, tid: Zcu.PerThread.Id) link.Error!bool { |
| 7190 | // Update the PLT entry's reloc if there is one: | 7190 | // Update the PLT entry's reloc if there is one: |
| 7191 | if (elf.plt.getIndex(global_name)) |plt_index| { | 7191 | if (elf.plt.getIndex(global_name)) |plt_index| { |
| 7192 | // PLT indices exactly match `.rela.plt` relocation indices. | 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 | // Update relocs for any relevant GOT entries: | 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,7 +7526,7 @@ fn flushMoved(elf: *Elf, ni: MappedFile.Node.Index) std.mem.Allocator.Error!void |
| 7526 | // Update local symbols | 7526 | // Update local symbols |
| 7527 | const ii = isi.input(elf); | 7527 | const ii = isi.input(elf); |
| 7528 | var lsi, const end_lsi = ii.localSymbolRange(elf); | 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 | if (lsi.index().ptr(elf).node != ni) continue; | 7530 | if (lsi.index().ptr(elf).node != ni) continue; |
| 7531 | const visibility: std.elf.STV = switch (elf.symPtr(lsi.index())) { | 7531 | const visibility: std.elf.STV = switch (elf.symPtr(lsi.index())) { |
| 7532 | inline else => |sym| elf.targetLoad(&sym.other).visibility, | 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,7 +7672,7 @@ fn flushResized(elf: *Elf, ni: MappedFile.Node.Index) std.mem.Allocator.Error!vo |
| 7672 | std.mem.swap(@TypeOf(ph.*), &phdr[new_phndx], next_ph); | 7672 | std.mem.swap(@TypeOf(ph.*), &phdr[new_phndx], next_ph); |
| 7673 | const next_ni = elf.phdrs.items[next_phndx]; | 7673 | const next_ni = elf.phdrs.items[next_phndx]; |
| 7674 | elf.phdrs.items[new_phndx] = next_ni; | 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 | new_phndx = @intCast(next_phndx); | 7676 | new_phndx = @intCast(next_phndx); |
| 7677 | } | 7677 | } |
| 7678 | if (new_phndx != phndx) { | 7678 | if (new_phndx != phndx) { |
| ... | @@ -7680,7 +7680,7 @@ fn flushResized(elf: *Elf, ni: MappedFile.Node.Index) std.mem.Allocator.Error!vo | ... | @@ -7680,7 +7680,7 @@ fn flushResized(elf: *Elf, ni: MappedFile.Node.Index) std.mem.Allocator.Error!vo |
| 7680 | elf.targetStore(&new_ph.vaddr, vaddr); | 7680 | elf.targetStore(&new_ph.vaddr, vaddr); |
| 7681 | new_ph.paddr = new_ph.vaddr; | 7681 | new_ph.paddr = new_ph.vaddr; |
| 7682 | elf.phdrs.items[new_phndx] = ni; | 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 | try ni.childrenMoved(elf.base.comp.gpa, &elf.mf); | 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,7 +7736,7 @@ fn addPltEntry(elf: *Elf, global_name: String(.strtab), dynsym_index: u32) void |
| 7736 | 7736 | ||
| 7737 | // We use the existing free-list tracking of the `.rela.plt` section to also behave as a | 7737 | // We use the existing free-list tracking of the `.rela.plt` section to also behave as a |
| 7738 | // free-list for the PLT itself---see `pltEntryIsDead` for details. | 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 | .type = .jumpSlot(elf), | 7740 | .type = .jumpSlot(elf), |
| 7741 | .offset = 0, // populated later | 7741 | .offset = 0, // populated later |
| 7742 | .raw_sym_index = dynsym_index, | 7742 | .raw_sym_index = dynsym_index, |
| ... | @@ -7756,7 +7756,7 @@ fn addPltEntry(elf: *Elf, global_name: String(.strtab), dynsym_index: u32) void | ... | @@ -7756,7 +7756,7 @@ fn addPltEntry(elf: *Elf, global_name: String(.strtab), dynsym_index: u32) void |
| 7756 | }; | 7756 | }; |
| 7757 | 7757 | ||
| 7758 | // Now that we know the index, we can set the relocation's offset. | 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 | if (plt_index < elf.plt.count()) { | 7761 | if (plt_index < elf.plt.count()) { |
| 7762 | // We reused a free entry, so we're already done! | 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,7 +7951,7 @@ fn flushMovedPltSection(elf: *Elf, which: enum { plt, plt_sec, got_plt }, old_ad |
| 7951 | const rela_plt_shndx = elf.shndx.rela_plt; | 7951 | const rela_plt_shndx = elf.shndx.rela_plt; |
| 7952 | for (0..elf.plt.count()) |plt_index| { | 7952 | for (0..elf.plt.count()) |plt_index| { |
| 7953 | if (elf.pltEntryIsDead(plt_index)) continue; | 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 | // We also need to update all of the references from `.plt.sec` to `.got.plt`. | 7956 | // We also need to update all of the references from `.plt.sec` to `.got.plt`. |
| 7957 | // However, if there's also a flush pending for `.plt.sec`, don't bother doing | 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,7 +8002,7 @@ fn flushMovedPltSection(elf: *Elf, which: enum { plt, plt_sec, got_plt }, old_ad |
| 8002 | const rela_plt_shndx = elf.shndx.rela_plt; | 8002 | const rela_plt_shndx = elf.shndx.rela_plt; |
| 8003 | for (0..elf.plt.count()) |plt_index| { | 8003 | for (0..elf.plt.count()) |plt_index| { |
| 8004 | if (elf.pltEntryIsDead(plt_index)) continue; | 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 | // We also need to update all of the references from `.plt` to `.got.plt`. | 8007 | // We also need to update all of the references from `.plt` to `.got.plt`. |
| 8008 | // However, if there's also a flush pending for `.plt`, don't bother doing | 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,7 +8052,7 @@ fn flushMovedPltSection(elf: *Elf, which: enum { plt, plt_sec, got_plt }, old_ad |
| 8052 | const rela_plt_shndx = elf.shndx.rela_plt; | 8052 | const rela_plt_shndx = elf.shndx.rela_plt; |
| 8053 | for (0..elf.plt.count()) |plt_index| { | 8053 | for (0..elf.plt.count()) |plt_index| { |
| 8054 | if (elf.pltEntryIsDead(plt_index)) continue; | 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 | .plt_sec, .got_plt => unreachable, | 8058 | .plt_sec, .got_plt => unreachable, |
| ... | @@ -8225,10 +8225,10 @@ pub fn printNode( | ... | @@ -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 | const off, const size = mf_node.location().resolve(&elf.mf); | 8229 | const off, const size = mf_node.location().resolve(&elf.mf); |
| 8230 | try w.print(" index={d} offset=0x{x} size=0x{x} align=0x{x}{s}{s}{s}{s}\n", .{ | 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 | off, | 8232 | off, |
| 8233 | size, | 8233 | size, |
| 8234 | mf_node.flags.alignment.toByteUnits(), | 8234 | mf_node.flags.alignment.toByteUnits(), |
src/link/MachO.zig+4-4| ... | @@ -4676,7 +4676,7 @@ pub const MachTask = extern struct { | ... | @@ -4676,7 +4676,7 @@ pub const MachTask = extern struct { |
| 4676 | var out_port: std.c.mach_port_name_t = undefined; | 4676 | var out_port: std.c.mach_port_name_t = undefined; |
| 4677 | switch (getKernError(std.c.mach_port_allocate( | 4677 | switch (getKernError(std.c.mach_port_allocate( |
| 4678 | self.port, | 4678 | self.port, |
| 4679 | @intFromEnum(right), | 4679 | @backingInt(right), |
| 4680 | &out_port, | 4680 | &out_port, |
| 4681 | ))) { | 4681 | ))) { |
| 4682 | .SUCCESS => return .{ .port = out_port }, | 4682 | .SUCCESS => return .{ .port = out_port }, |
| ... | @@ -4694,7 +4694,7 @@ pub const MachTask = extern struct { | ... | @@ -4694,7 +4694,7 @@ pub const MachTask = extern struct { |
| 4694 | self.port, | 4694 | self.port, |
| 4695 | port.port, | 4695 | port.port, |
| 4696 | port.port, | 4696 | port.port, |
| 4697 | @intFromEnum(msg), | 4697 | @backingInt(msg), |
| 4698 | ))) { | 4698 | ))) { |
| 4699 | .SUCCESS => return, | 4699 | .SUCCESS => return, |
| 4700 | .FAILURE => return error.PermissionDenied, | 4700 | .FAILURE => return error.PermissionDenied, |
| ... | @@ -5119,12 +5119,12 @@ pub fn machTaskForSelf() MachTask { | ... | @@ -5119,12 +5119,12 @@ pub fn machTaskForSelf() MachTask { |
| 5119 | } | 5119 | } |
| 5120 | 5120 | ||
| 5121 | pub fn getKernError(err: std.c.kern_return_t) KernE { | 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 | pub fn unexpectedKernError(err: KernE) std.posix.UnexpectedError { | 5125 | pub fn unexpectedKernError(err: KernE) std.posix.UnexpectedError { |
| 5126 | if (std.options.unexpected_error_tracing) { | 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 | std.debug.dumpCurrentStackTrace(.{}); | 5128 | std.debug.dumpCurrentStackTrace(.{}); |
| 5129 | } | 5129 | } |
| 5130 | return error.Unexpected; | 5130 | return error.Unexpected; |
src/link/MachO/Atom.zig+5-5| ... | @@ -797,8 +797,8 @@ fn resolveRelocInner( | ... | @@ -797,8 +797,8 @@ fn resolveRelocInner( |
| 797 | .data_processing_immediate => aarch64.writeAddImmInst(@truncate(target), inst_code), | 797 | .data_processing_immediate => aarch64.writeAddImmInst(@truncate(target), inst_code), |
| 798 | .load_store => |load_store| { | 798 | .load_store => |load_store| { |
| 799 | inst.load_store.register_unsigned_immediate.group.imm12 = switch (load_store.register_unsigned_immediate.decode()) { | 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), | 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) << @intFromEnum(vector.group.opc1.decode(vector.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 | try writer.writeInt(u32, @bitCast(inst), .little); | 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,7 +990,7 @@ pub fn writeRelocs(self: Atom, macho_file: *MachO, code: []u8, buffer: []macho.r |
| 990 | .r_pcrel = 0, | 990 | .r_pcrel = 0, |
| 991 | .r_length = 2, | 991 | .r_length = 2, |
| 992 | .r_extern = 0, | 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 | i += 1; | 995 | i += 1; |
| 996 | } | 996 | } |
| ... | @@ -1021,7 +1021,7 @@ pub fn writeRelocs(self: Atom, macho_file: *MachO, code: []u8, buffer: []macho.r | ... | @@ -1021,7 +1021,7 @@ pub fn writeRelocs(self: Atom, macho_file: *MachO, code: []u8, buffer: []macho.r |
| 1021 | .r_pcrel = @intFromBool(rel.meta.pcrel), | 1021 | .r_pcrel = @intFromBool(rel.meta.pcrel), |
| 1022 | .r_extern = @intFromBool(r_extern), | 1022 | .r_extern = @intFromBool(r_extern), |
| 1023 | .r_length = rel.meta.length, | 1023 | .r_length = rel.meta.length, |
| 1024 | .r_type = @intFromEnum(r_type), | 1024 | .r_type = @backingInt(r_type), |
| 1025 | }; | 1025 | }; |
| 1026 | }, | 1026 | }, |
| 1027 | .x86_64 => { | 1027 | .x86_64 => { |
| ... | @@ -1064,7 +1064,7 @@ pub fn writeRelocs(self: Atom, macho_file: *MachO, code: []u8, buffer: []macho.r | ... | @@ -1064,7 +1064,7 @@ pub fn writeRelocs(self: Atom, macho_file: *MachO, code: []u8, buffer: []macho.r |
| 1064 | .r_pcrel = @intFromBool(rel.meta.pcrel), | 1064 | .r_pcrel = @intFromBool(rel.meta.pcrel), |
| 1065 | .r_extern = @intFromBool(r_extern), | 1065 | .r_extern = @intFromBool(r_extern), |
| 1066 | .r_length = rel.meta.length, | 1066 | .r_length = rel.meta.length, |
| 1067 | .r_type = @intFromEnum(r_type), | 1067 | .r_type = @backingInt(r_type), |
| 1068 | }; | 1068 | }; |
| 1069 | }, | 1069 | }, |
| 1070 | else => unreachable, | 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,7 +979,7 @@ fn initSymbolStabs(self: *Object, allocator: Allocator, nlists: anytype, macho_f |
| 979 | const open = syms[i]; | 979 | const open = syms[i]; |
| 980 | if (open.n_type.stab != .so) { | 980 | if (open.n_type.stab != .so) { |
| 981 | try macho_file.reportParseError2(self.index, "unexpected symbol stab type 0x{x} as the first entry", .{ | 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 | return error.MalformedObject; | 984 | return error.MalformedObject; |
| 985 | } | 985 | } |
| ... | @@ -1009,7 +1009,7 @@ fn initSymbolStabs(self: *Object, allocator: Allocator, nlists: anytype, macho_f | ... | @@ -1009,7 +1009,7 @@ fn initSymbolStabs(self: *Object, allocator: Allocator, nlists: anytype, macho_f |
| 1009 | stab.index = sym_lookup.find(nlist.n_value); | 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 | return error.MalformedObject; | 1013 | return error.MalformedObject; |
| 1014 | }, | 1014 | }, |
| 1015 | else => { | 1015 | else => { |
| ... | @@ -2032,8 +2032,8 @@ fn addReloc(offset: u32, arch: std.Target.Cpu.Arch) !macho.relocation_info { | ... | @@ -2032,8 +2032,8 @@ fn addReloc(offset: u32, arch: std.Target.Cpu.Arch) !macho.relocation_info { |
| 2032 | .r_length = 3, | 2032 | .r_length = 3, |
| 2033 | .r_extern = 0, | 2033 | .r_extern = 0, |
| 2034 | .r_type = switch (arch) { | 2034 | .r_type = switch (arch) { |
| 2035 | .aarch64 => @intFromEnum(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED), | 2035 | .aarch64 => @backingInt(macho.reloc_type_arm64.ARM64_RELOC_UNSIGNED), |
| 2036 | .x86_64 => @intFromEnum(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED), | 2036 | .x86_64 => @backingInt(macho.reloc_type_x86_64.X86_64_RELOC_UNSIGNED), |
| 2037 | else => unreachable, | 2037 | else => unreachable, |
| 2038 | }, | 2038 | }, |
| 2039 | }; | 2039 | }; |
| ... | @@ -2844,7 +2844,7 @@ const x86_64 = struct { | ... | @@ -2844,7 +2844,7 @@ const x86_64 = struct { |
| 2844 | var i: usize = 0; | 2844 | var i: usize = 0; |
| 2845 | while (i < relocs.len) : (i += 1) { | 2845 | while (i < relocs.len) : (i += 1) { |
| 2846 | const rel = relocs[i]; | 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 | const rel_offset = @as(u32, @intCast(rel.r_address)); | 2848 | const rel_offset = @as(u32, @intCast(rel.r_address)); |
| 2849 | 2849 | ||
| 2850 | var addend = switch (rel.r_length) { | 2850 | var addend = switch (rel.r_length) { |
| ... | @@ -2853,7 +2853,7 @@ const x86_64 = struct { | ... | @@ -2853,7 +2853,7 @@ const x86_64 = struct { |
| 2853 | 2 => mem.readInt(i32, code[rel_offset..][0..4], .little), | 2853 | 2 => mem.readInt(i32, code[rel_offset..][0..4], .little), |
| 2854 | 3 => mem.readInt(i64, code[rel_offset..][0..8], .little), | 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 | .X86_64_RELOC_SIGNED_1 => 1, | 2857 | .X86_64_RELOC_SIGNED_1 => 1, |
| 2858 | .X86_64_RELOC_SIGNED_2 => 2, | 2858 | .X86_64_RELOC_SIGNED_2 => 2, |
| 2859 | .X86_64_RELOC_SIGNED_4 => 4, | 2859 | .X86_64_RELOC_SIGNED_4 => 4, |
| ... | @@ -2884,7 +2884,7 @@ const x86_64 = struct { | ... | @@ -2884,7 +2884,7 @@ const x86_64 = struct { |
| 2884 | } else rel.r_symbolnum; | 2884 | } else rel.r_symbolnum; |
| 2885 | 2885 | ||
| 2886 | const has_subtractor = if (i > 0 and | 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 | blk: { | 2888 | blk: { |
| 2889 | if (rel_type != .X86_64_RELOC_UNSIGNED) { | 2889 | if (rel_type != .X86_64_RELOC_UNSIGNED) { |
| 2890 | try macho_file.reportParseError2(self.index, "{s},{s}: 0x{x}: X86_64_RELOC_SUBTRACTOR followed by {s}", .{ | 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,7 +3017,7 @@ const aarch64 = struct { |
| 3017 | 3017 | ||
| 3018 | var addend: i64 = 0; | 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 | .ARM64_RELOC_ADDEND => { | 3021 | .ARM64_RELOC_ADDEND => { |
| 3022 | addend = rel.r_symbolnum; | 3022 | addend = rel.r_symbolnum; |
| 3023 | i += 1; | 3023 | i += 1; |
| ... | @@ -3028,7 +3028,7 @@ const aarch64 = struct { | ... | @@ -3028,7 +3028,7 @@ const aarch64 = struct { |
| 3028 | return error.MalformedObject; | 3028 | return error.MalformedObject; |
| 3029 | } | 3029 | } |
| 3030 | rel = relocs[i]; | 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 | .ARM64_RELOC_PAGE21, .ARM64_RELOC_PAGEOFF12 => {}, | 3032 | .ARM64_RELOC_PAGE21, .ARM64_RELOC_PAGEOFF12 => {}, |
| 3033 | else => |x| { | 3033 | else => |x| { |
| 3034 | try macho_file.reportParseError2( | 3034 | try macho_file.reportParseError2( |
| ... | @@ -3051,7 +3051,7 @@ const aarch64 = struct { | ... | @@ -3051,7 +3051,7 @@ const aarch64 = struct { |
| 3051 | else => {}, | 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 | var is_extern = rel.r_extern == 1; | 3055 | var is_extern = rel.r_extern == 1; |
| 3056 | 3056 | ||
| 3057 | const target = if (!is_extern) blk: { | 3057 | const target = if (!is_extern) blk: { |
| ... | @@ -3077,7 +3077,7 @@ const aarch64 = struct { | ... | @@ -3077,7 +3077,7 @@ const aarch64 = struct { |
| 3077 | } else rel.r_symbolnum; | 3077 | } else rel.r_symbolnum; |
| 3078 | 3078 | ||
| 3079 | const has_subtractor = if (i > 0 and | 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 | blk: { | 3081 | blk: { |
| 3082 | if (rel_type != .ARM64_RELOC_UNSIGNED) { | 3082 | if (rel_type != .ARM64_RELOC_UNSIGNED) { |
| 3083 | try macho_file.reportParseError2(self.index, "{s},{s}: 0x{x}: ARM64_RELOC_SUBTRACTOR followed by {s}", .{ | 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,8 +30,8 @@ fn canFold(macho_file: *MachO, lhs_ref: Record.Ref, rhs_ref: Record.Ref) bool { |
| 30 | const lhs = lhs_ref.getUnwindRecord(macho_file); | 30 | const lhs = lhs_ref.getUnwindRecord(macho_file); |
| 31 | const rhs = rhs_ref.getUnwindRecord(macho_file); | 31 | const rhs = rhs_ref.getUnwindRecord(macho_file); |
| 32 | if (cpu_arch == .x86_64) { | 32 | if (cpu_arch == .x86_64) { |
| 33 | if (lhs.enc.getMode() == @intFromEnum(macho.UNWIND_X86_64_MODE.STACK_IND) or | 33 | if (lhs.enc.getMode() == @backingInt(macho.UNWIND_X86_64_MODE.STACK_IND) or |
| 34 | rhs.enc.getMode() == @intFromEnum(macho.UNWIND_X86_64_MODE.STACK_IND)) return false; | 34 | rhs.enc.getMode() == @backingInt(macho.UNWIND_X86_64_MODE.STACK_IND)) return false; |
| 35 | } | 35 | } |
| 36 | const lhs_per = lhs.personality orelse 0; | 36 | const lhs_per = lhs.personality orelse 0; |
| 37 | const rhs_per = rhs.personality orelse 0; | 37 | const rhs_per = rhs.personality orelse 0; |
| ... | @@ -412,8 +412,8 @@ pub const Encoding = extern struct { | ... | @@ -412,8 +412,8 @@ pub const Encoding = extern struct { |
| 412 | pub fn isDwarf(enc: Encoding, macho_file: *MachO) bool { | 412 | pub fn isDwarf(enc: Encoding, macho_file: *MachO) bool { |
| 413 | const mode = enc.getMode(); | 413 | const mode = enc.getMode(); |
| 414 | return switch (macho_file.getTarget().cpu.arch) { | 414 | return switch (macho_file.getTarget().cpu.arch) { |
| 415 | .aarch64 => @as(macho.UNWIND_ARM64_MODE, @enumFromInt(mode)) == .DWARF, | 415 | .aarch64 => @as(macho.UNWIND_ARM64_MODE, @fromBackingInt(@intCast(mode))) == .DWARF, |
| 416 | .x86_64 => @as(macho.UNWIND_X86_64_MODE, @enumFromInt(mode)) == .DWARF, | 416 | .x86_64 => @as(macho.UNWIND_X86_64_MODE, @fromBackingInt(@intCast(mode))) == .DWARF, |
| 417 | else => unreachable, | 417 | else => unreachable, |
| 418 | }; | 418 | }; |
| 419 | } | 419 | } |
| ... | @@ -421,7 +421,7 @@ pub const Encoding = extern struct { | ... | @@ -421,7 +421,7 @@ pub const Encoding = extern struct { |
| 421 | pub fn setMode(enc: *Encoding, mode: anytype) void { | 421 | pub fn setMode(enc: *Encoding, mode: anytype) void { |
| 422 | comptime assert(macho.UNWIND_ARM64_MODE_MASK == macho.UNWIND_X86_64_MODE_MASK); | 422 | comptime assert(macho.UNWIND_ARM64_MODE_MASK == macho.UNWIND_X86_64_MODE_MASK); |
| 423 | const shift = comptime @ctz(macho.UNWIND_ARM64_MODE_MASK); | 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 | pub fn hasLsda(enc: Encoding) bool { | 427 | pub fn hasLsda(enc: Encoding) bool { |
src/link/MachO/ZigObject.zig+15-15| ... | @@ -632,7 +632,7 @@ pub fn getNavVAddr( | ... | @@ -632,7 +632,7 @@ pub fn getNavVAddr( |
| 632 | switch (reloc_info.parent) { | 632 | switch (reloc_info.parent) { |
| 633 | .none => unreachable, | 633 | .none => unreachable, |
| 634 | .atom_index => |atom_index| { | 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 | try parent_atom.addReloc(macho_file, .{ | 636 | try parent_atom.addReloc(macho_file, .{ |
| 637 | .tag = .@"extern", | 637 | .tag = .@"extern", |
| 638 | .offset = @intCast(reloc_info.offset), | 638 | .offset = @intCast(reloc_info.offset), |
| ... | @@ -650,7 +650,7 @@ pub fn getNavVAddr( | ... | @@ -650,7 +650,7 @@ pub fn getNavVAddr( |
| 650 | .debug_output => |debug_output| switch (debug_output) { | 650 | .debug_output => |debug_output| switch (debug_output) { |
| 651 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ | 651 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ |
| 652 | .source_off = @intCast(reloc_info.offset), | 652 | .source_off = @intCast(reloc_info.offset), |
| 653 | .target_sym = @enumFromInt(sym_index), | 653 | .target_sym = @fromBackingInt(@intCast(sym_index)), |
| 654 | .target_off = reloc_info.addend, | 654 | .target_off = reloc_info.addend, |
| 655 | }), | 655 | }), |
| 656 | .none => unreachable, | 656 | .none => unreachable, |
| ... | @@ -671,7 +671,7 @@ pub fn getUavVAddr( | ... | @@ -671,7 +671,7 @@ pub fn getUavVAddr( |
| 671 | switch (reloc_info.parent) { | 671 | switch (reloc_info.parent) { |
| 672 | .none => unreachable, | 672 | .none => unreachable, |
| 673 | .atom_index => |atom_index| { | 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 | try parent_atom.addReloc(macho_file, .{ | 675 | try parent_atom.addReloc(macho_file, .{ |
| 676 | .tag = .@"extern", | 676 | .tag = .@"extern", |
| 677 | .offset = @intCast(reloc_info.offset), | 677 | .offset = @intCast(reloc_info.offset), |
| ... | @@ -689,7 +689,7 @@ pub fn getUavVAddr( | ... | @@ -689,7 +689,7 @@ pub fn getUavVAddr( |
| 689 | .debug_output => |debug_output| switch (debug_output) { | 689 | .debug_output => |debug_output| switch (debug_output) { |
| 690 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ | 690 | .dwarf => |wip_nav| try wip_nav.infoExternalReloc(.{ |
| 691 | .source_off = @intCast(reloc_info.offset), | 691 | .source_off = @intCast(reloc_info.offset), |
| 692 | .target_sym = @enumFromInt(sym_index), | 692 | .target_sym = @fromBackingInt(@intCast(sym_index)), |
| 693 | .target_off = reloc_info.addend, | 693 | .target_off = reloc_info.addend, |
| 694 | }), | 694 | }), |
| 695 | .none => unreachable, | 695 | .none => unreachable, |
| ... | @@ -716,12 +716,12 @@ pub fn lowerUav( | ... | @@ -716,12 +716,12 @@ pub fn lowerUav( |
| 716 | const sym = self.symbols.items[metadata.symbol_index]; | 716 | const sym = self.symbols.items[metadata.symbol_index]; |
| 717 | const existing_alignment = sym.getAtom(macho_file).?.alignment; | 717 | const existing_alignment = sym.getAtom(macho_file).?.alignment; |
| 718 | if (uav_alignment.order(existing_alignment).compare(.lte)) | 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 | var name_buf: [32]u8 = undefined; | 722 | var name_buf: [32]u8 = undefined; |
| 723 | const name = std.fmt.bufPrint(&name_buf, "__anon_{d}", .{ | 723 | const name = std.fmt.bufPrint(&name_buf, "__anon_{d}", .{ |
| 724 | @intFromEnum(uav), | 724 | @backingInt(uav), |
| 725 | }) catch unreachable; | 725 | }) catch unreachable; |
| 726 | const sym_index = self.lowerConst( | 726 | const sym_index = self.lowerConst( |
| 727 | macho_file, | 727 | macho_file, |
| ... | @@ -737,7 +737,7 @@ pub fn lowerUav( | ... | @@ -737,7 +737,7 @@ pub fn lowerUav( |
| 737 | .{e}, | 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 | return sym_index; | 741 | return sym_index; |
| 742 | } | 742 | } |
| 743 | 743 | ||
| ... | @@ -783,14 +783,14 @@ pub fn updateFunc( | ... | @@ -783,14 +783,14 @@ pub fn updateFunc( |
| 783 | var aw: std.Io.Writer.Allocating = .init(gpa); | 783 | var aw: std.Io.Writer.Allocating = .init(gpa); |
| 784 | defer aw.deinit(); | 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 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); | 787 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); |
| 788 | 788 | ||
| 789 | codegen.emitFunction( | 789 | codegen.emitFunction( |
| 790 | &macho_file.base, | 790 | &macho_file.base, |
| 791 | pt, | 791 | pt, |
| 792 | func_index, | 792 | func_index, |
| 793 | @enumFromInt(sym_index), | 793 | @fromBackingInt(@intCast(sym_index)), |
| 794 | mir, | 794 | mir, |
| 795 | &aw.writer, | 795 | &aw.writer, |
| 796 | if (debug_wip_nav) |*wip_nav| .{ .dwarf = wip_nav } else .none, | 796 | if (debug_wip_nav) |*wip_nav| .{ .dwarf = wip_nav } else .none, |
| ... | @@ -876,7 +876,7 @@ pub fn updateNav( | ... | @@ -876,7 +876,7 @@ pub fn updateNav( |
| 876 | const sym_index = try self.getGlobalSymbol(macho_file, name, lib_name); | 876 | const sym_index = try self.getGlobalSymbol(macho_file, name, lib_name); |
| 877 | if (nav.resolved.?.@"threadlocal" and macho_file.base.comp.config.any_non_single_threaded) self.symbols.items[sym_index].flags.tlv = true; | 877 | if (nav.resolved.?.@"threadlocal" and macho_file.base.comp.config.any_non_single_threaded) self.symbols.items[sym_index].flags.tlv = true; |
| 878 | if (self.dwarf) |*dwarf| { | 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 | defer debug_wip_nav.deinit(); | 880 | defer debug_wip_nav.deinit(); |
| 881 | dwarf.finishWipNav(pt, nav_index, &debug_wip_nav) catch |err| switch (err) { | 881 | dwarf.finishWipNav(pt, nav_index, &debug_wip_nav) catch |err| switch (err) { |
| 882 | error.OutOfMemory, error.Canceled, error.AlreadyReported => |e| return e, | 882 | error.OutOfMemory, error.Canceled, error.AlreadyReported => |e| return e, |
| ... | @@ -894,7 +894,7 @@ pub fn updateNav( | ... | @@ -894,7 +894,7 @@ pub fn updateNav( |
| 894 | var aw: std.Io.Writer.Allocating = .init(zcu.gpa); | 894 | var aw: std.Io.Writer.Allocating = .init(zcu.gpa); |
| 895 | defer aw.deinit(); | 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 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); | 898 | defer if (debug_wip_nav) |*wip_nav| wip_nav.deinit(); |
| 899 | 899 | ||
| 900 | codegen.generateSymbol( | 900 | codegen.generateSymbol( |
| ... | @@ -902,7 +902,7 @@ pub fn updateNav( | ... | @@ -902,7 +902,7 @@ pub fn updateNav( |
| 902 | pt, | 902 | pt, |
| 903 | .fromInterned(nav.resolved.?.value), | 903 | .fromInterned(nav.resolved.?.value), |
| 904 | &aw.writer, | 904 | &aw.writer, |
| 905 | .{ .atom_index = @enumFromInt(sym_index) }, | 905 | .{ .atom_index = @fromBackingInt(@intCast(sym_index)) }, |
| 906 | ) catch |err| switch (err) { | 906 | ) catch |err| switch (err) { |
| 907 | error.WriteFailed => return error.OutOfMemory, | 907 | error.WriteFailed => return error.OutOfMemory, |
| 908 | else => |e| return e, | 908 | else => |e| return e, |
| ... | @@ -1203,7 +1203,7 @@ fn lowerConst( | ... | @@ -1203,7 +1203,7 @@ fn lowerConst( |
| 1203 | pt, | 1203 | pt, |
| 1204 | val, | 1204 | val, |
| 1205 | &aw.writer, | 1205 | &aw.writer, |
| 1206 | .{ .atom_index = @enumFromInt(sym_index) }, | 1206 | .{ .atom_index = @fromBackingInt(@intCast(sym_index)) }, |
| 1207 | ) catch |err| switch (err) { | 1207 | ) catch |err| switch (err) { |
| 1208 | error.WriteFailed => return error.OutOfMemory, | 1208 | error.WriteFailed => return error.OutOfMemory, |
| 1209 | else => |e| return e, | 1209 | else => |e| return e, |
| ... | @@ -1231,7 +1231,7 @@ fn lowerConst( | ... | @@ -1231,7 +1231,7 @@ fn lowerConst( |
| 1231 | const file_offset = sect.offset + atom.value; | 1231 | const file_offset = sect.offset + atom.value; |
| 1232 | try macho_file.pwriteAll(code, file_offset); | 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 | pub fn updateExports( | 1237 | pub fn updateExports( |
| ... | @@ -1353,7 +1353,7 @@ fn updateLazySymbol( | ... | @@ -1353,7 +1353,7 @@ fn updateLazySymbol( |
| 1353 | &required_alignment, | 1353 | &required_alignment, |
| 1354 | &aw.writer, | 1354 | &aw.writer, |
| 1355 | .none, | 1355 | .none, |
| 1356 | .{ .atom_index = @enumFromInt(symbol_index) }, | 1356 | .{ .atom_index = @fromBackingInt(@intCast(symbol_index)) }, |
| 1357 | ); | 1357 | ); |
| 1358 | const code = aw.written(); | 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,8 +464,8 @@ pub fn writeRelocs(macho_file: *MachO, code: []u8, relocs: []macho.relocation_in |
| 464 | .r_extern = 1, | 464 | .r_extern = 1, |
| 465 | .r_pcrel = 1, | 465 | .r_pcrel = 1, |
| 466 | .r_type = switch (cpu_arch) { | 466 | .r_type = switch (cpu_arch) { |
| 467 | .aarch64 => @intFromEnum(macho.reloc_type_arm64.ARM64_RELOC_POINTER_TO_GOT), | 467 | .aarch64 => @backingInt(macho.reloc_type_arm64.ARM64_RELOC_POINTER_TO_GOT), |
| 468 | .x86_64 => @intFromEnum(macho.reloc_type_x86_64.X86_64_RELOC_GOT), | 468 | .x86_64 => @backingInt(macho.reloc_type_x86_64.X86_64_RELOC_GOT), |
| 469 | else => unreachable, | 469 | else => unreachable, |
| 470 | }, | 470 | }, |
| 471 | }; | 471 | }; |
src/link/MappedFile.zig+2-2| ... | @@ -181,7 +181,7 @@ pub const Node = extern struct { | ... | @@ -181,7 +181,7 @@ pub const Node = extern struct { |
| 181 | pub const root: Node.Index = .none; | 181 | pub const root: Node.Index = .none; |
| 182 | 182 | ||
| 183 | fn get(ni: Node.Index, mf: *const MappedFile) *Node { | 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 | pub fn parent(ni: Node.Index, mf: *const MappedFile) Node.Index { | 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,7 +561,7 @@ fn addNode(mf: *MappedFile, gpa: std.mem.Allocator, opts: struct { |
| 561 | break :location .{ .large, .{ .large = .{ .index = mf.large.items.len } } }; | 561 | break :location .{ .large, .{ .large = .{ .index = mf.large.items.len } } }; |
| 562 | }; | 562 | }; |
| 563 | const free_ni: Node.Index, const free_node = free: switch (mf.free_ni) { | 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 | else => |free_ni| { | 565 | else => |free_ni| { |
| 566 | const free_node = free_ni.get(mf); | 566 | const free_node = free_ni.get(mf); |
| 567 | mf.free_ni = free_node.next; | 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,7 +153,7 @@ pub fn loadInput(linker: *Linker, input: link.Input) !void { |
| 153 | var it: BinaryModule.Instruction.Iterator = .init(instructions, 0); | 153 | var it: BinaryModule.Instruction.Iterator = .init(instructions, 0); |
| 154 | const has_linkage = while (it.next()) |inst| switch (inst.opcode) { | 154 | const has_linkage = while (it.next()) |inst| switch (inst.opcode) { |
| 155 | .OpCapability => { | 155 | .OpCapability => { |
| 156 | const cap: spec.Capability = @enumFromInt(inst.operands[0]); | 156 | const cap: spec.Capability = @fromBackingInt(@intCast(inst.operands[0])); |
| 157 | if (cap == .linkage) break true; | 157 | if (cap == .linkage) break true; |
| 158 | }, | 158 | }, |
| 159 | else => break false, | 159 | else => break false, |
| ... | @@ -343,7 +343,7 @@ fn mergeFragments(linker: *Linker, gpa: Allocator, arena: Allocator) error{OutOf | ... | @@ -343,7 +343,7 @@ fn mergeFragments(linker: *Linker, gpa: Allocator, arena: Allocator) error{OutOf |
| 343 | const id_offset = next_id - 1; | 343 | const id_offset = next_id - 1; |
| 344 | frag_infos.appendAssumeCapacity(.{ .id_offset = id_offset }); | 344 | frag_infos.appendAssumeCapacity(.{ .id_offset = id_offset }); |
| 345 | if (mir.decl_result_id != .none) { | 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 | next_id += mir.id_bound - 1; | 348 | next_id += mir.id_bound - 1; |
| 349 | } | 349 | } |
| ... | @@ -351,13 +351,13 @@ fn mergeFragments(linker: *Linker, gpa: Allocator, arena: Allocator) error{OutOf | ... | @@ -351,13 +351,13 @@ fn mergeFragments(linker: *Linker, gpa: Allocator, arena: Allocator) error{OutOf |
| 351 | for (linker.fragments.values(), frag_infos.items) |*mir, frag_info| { | 351 | for (linker.fragments.values(), frag_infos.items) |*mir, frag_info| { |
| 352 | for (mir.nav_refs) |ref| { | 352 | for (mir.nav_refs) |ref| { |
| 353 | if (!nav_final_ids.contains(ref.nav)) { | 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 | for (mir.uav_refs) |ref| { | 357 | for (mir.uav_refs) |ref| { |
| 358 | const key = .{ ref.val, ref.storage_class }; | 358 | const key = .{ ref.val, ref.storage_class }; |
| 359 | if (!uav_final_ids.contains(key)) { | 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,10 +391,10 @@ fn mergeFragments(linker: *Linker, gpa: Allocator, arena: Allocator) error{OutOf |
| 391 | while (it.next()) |inst| { | 391 | while (it.next()) |inst| { |
| 392 | const ld = LinkageDecoration.parse(inst) orelse continue; | 392 | const ld = LinkageDecoration.parse(inst) orelse continue; |
| 393 | if (ld.linkage_type != .@"export") continue; | 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 | if (extern_name_map.get(ld.name)) |nav_index| { | 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 | nav_final_ids.getPtr(nav_index).?.* = remapped_id; | 398 | nav_final_ids.getPtr(nav_index).?.* = remapped_id; |
| 399 | _ = extern_name_map.swapRemove(ld.name); | 399 | _ = extern_name_map.swapRemove(ld.name); |
| 400 | try resolved_ids.put(gpa, remapped_id, {}); | 400 | try resolved_ids.put(gpa, remapped_id, {}); |
| ... | @@ -579,7 +579,7 @@ fn remapFilteredInsts( | ... | @@ -579,7 +579,7 @@ fn remapFilteredInsts( |
| 579 | switch (mode) { | 579 | switch (mode) { |
| 580 | .skip_functions => { | 580 | .skip_functions => { |
| 581 | if (inst.opcode == .OpFunction) { | 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 | if (skip_function) { | 584 | if (skip_function) { |
| 585 | if (inst.opcode == .OpFunctionEnd) skip_function = false; | 585 | if (inst.opcode == .OpFunctionEnd) skip_function = false; |
| ... | @@ -593,7 +593,7 @@ fn remapFilteredInsts( | ... | @@ -593,7 +593,7 @@ fn remapFilteredInsts( |
| 593 | }, | 593 | }, |
| 594 | .skip_names => { | 594 | .skip_names => { |
| 595 | if (inst.opcode == .OpName and inst.operands.len >= 1) { | 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,11 +817,11 @@ const LinkageDecoration = struct { |
| 817 | fn parse(inst: BinaryModule.Instruction) ?LinkageDecoration { | 817 | fn parse(inst: BinaryModule.Instruction) ?LinkageDecoration { |
| 818 | if (inst.opcode != .OpDecorate) return null; | 818 | if (inst.opcode != .OpDecorate) return null; |
| 819 | if (inst.operands.len < 3) return null; | 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 | return .{ | 821 | return .{ |
| 822 | .target_id = @enumFromInt(inst.operands[0]), | 822 | .target_id = @fromBackingInt(@intCast(inst.operands[0])), |
| 823 | .name = std.mem.sliceTo(std.mem.sliceAsBytes(inst.operands[2 .. inst.operands.len - 1]), 0), | 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,7 +897,7 @@ fn appendExternalObjects( |
| 897 | while (it.next()) |inst| { | 897 | while (it.next()) |inst| { |
| 898 | const ld = LinkageDecoration.parse(inst) orelse continue; | 898 | const ld = LinkageDecoration.parse(inst) orelse continue; |
| 899 | if (ld.linkage_type != .@"export") continue; | 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,14 +920,14 @@ fn appendExternalObjects( |
| 920 | while (it.next()) |inst| { | 920 | while (it.next()) |inst| { |
| 921 | const ld = LinkageDecoration.parse(inst) orelse continue; | 921 | const ld = LinkageDecoration.parse(inst) orelse continue; |
| 922 | if (ld.linkage_type != .import) continue; | 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 | if (export_map.get(ld.name)) |export_id| { | 925 | if (export_map.get(ld.name)) |export_id| { |
| 926 | try per_obj_remaps[obj_idx].put(gpa, ld.target_id, export_id); | 926 | try per_obj_remaps[obj_idx].put(gpa, ld.target_id, export_id); |
| 927 | try resolved_linkage_ids.put(gpa, remapped_import, {}); | 927 | try resolved_linkage_ids.put(gpa, remapped_import, {}); |
| 928 | try resolved_linkage_ids.put(gpa, export_id, {}); | 928 | try resolved_linkage_ids.put(gpa, export_id, {}); |
| 929 | log.debug("cross-object resolve: '{s}' import={d} -> export={d}", .{ | 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 | } else { | 932 | } else { |
| 933 | has_linkage.* = true; | 933 | has_linkage.* = true; |
| ... | @@ -968,7 +968,7 @@ fn appendExternalObjects( | ... | @@ -968,7 +968,7 @@ fn appendExternalObjects( |
| 968 | } | 968 | } |
| 969 | 969 | ||
| 970 | if (LinkageDecoration.parse(inst)) |ld| { | 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 | if (resolved_linkage_ids.contains(remapped)) { | 972 | if (resolved_linkage_ids.contains(remapped)) { |
| 973 | if (ld.linkage_type == .@"export" and is_obj) { | 973 | if (ld.linkage_type == .@"export" and is_obj) { |
| 974 | has_linkage.* = true; | 974 | has_linkage.* = true; |
| ... | @@ -979,7 +979,7 @@ fn appendExternalObjects( | ... | @@ -979,7 +979,7 @@ fn appendExternalObjects( |
| 979 | } | 979 | } |
| 980 | 980 | ||
| 981 | if (inst.opcode == .OpName and inst.operands.len >= 1) { | 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 | const dest = sections.getSection(Sections.classifyPreambleInst(inst.opcode)); | 985 | const dest = sections.getSection(Sections.classifyPreambleInst(inst.opcode)); |
| ... | @@ -990,7 +990,7 @@ fn appendExternalObjects( | ... | @@ -990,7 +990,7 @@ fn appendExternalObjects( |
| 990 | var skip_function = false; | 990 | var skip_function = false; |
| 991 | while (fn_it.next()) |inst| { | 991 | while (fn_it.next()) |inst| { |
| 992 | if (inst.opcode == .OpFunction) { | 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 | if (!skip_function) { | 995 | if (!skip_function) { |
| 996 | try remapAndAppendInst(gpa, &sections.functions, ext_obj.instructions, inst, id_offset, id_remap, parser); | 996 | try remapAndAppendInst(gpa, &sections.functions, ext_obj.instructions, inst, id_offset, id_remap, parser); |
| ... | @@ -1034,7 +1034,7 @@ fn collectEntryPointInterface( | ... | @@ -1034,7 +1034,7 @@ fn collectEntryPointInterface( |
| 1034 | } | 1034 | } |
| 1035 | 1035 | ||
| 1036 | for (mir.internal_globals) |local_id| { | 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 | try interface.append(gpa, global_id); | 1038 | try interface.append(gpa, global_id); |
| 1039 | } | 1039 | } |
| 1040 | 1040 | ||
| ... | @@ -1206,11 +1206,11 @@ fn operandLiteralWordCount(kind: spec.OperandKind, inst: BinaryModule.Instructio | ... | @@ -1206,11 +1206,11 @@ fn operandLiteralWordCount(kind: spec.OperandKind, inst: BinaryModule.Instructio |
| 1206 | } | 1206 | } |
| 1207 | 1207 | ||
| 1208 | fn remapSingleId(word: *Word, id_offset: Word, id_remap: *const std.AutoHashMapUnmanaged(Id, Id)) void { | 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 | if (id == .none) return; | 1210 | if (id == .none) return; |
| 1211 | if (id_remap.get(id)) |final_id| { | 1211 | if (id_remap.get(id)) |final_id| { |
| 1212 | word.* = @intFromEnum(final_id); | 1212 | word.* = @backingInt(final_id); |
| 1213 | } else { | 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,7 +58,7 @@ pub const Instruction = struct { |
| 58 | assert(it.offset < it.words.len); | 58 | assert(it.offset < it.words.len); |
| 59 | 59 | ||
| 60 | return Instruction{ | 60 | return Instruction{ |
| 61 | .opcode = @enumFromInt(it.words[it.offset] & 0xFFFF), | 61 | .opcode = @fromBackingInt(@intCast(it.words[it.offset] & 0xFFFF)), |
| 62 | .offset = it.offset, | 62 | .offset = it.offset, |
| 63 | .operands = it.words[it.offset..][1..instruction_len], | 63 | .operands = it.words[it.offset..][1..instruction_len], |
| 64 | }; | 64 | }; |
| ... | @@ -97,11 +97,11 @@ pub const Parser = struct { | ... | @@ -97,11 +97,11 @@ pub const Parser = struct { |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | fn mapSetAndOpcode(set: InstructionSet, opcode: u16) u32 { | 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 | pub fn getInstSpec(parser: Parser, opcode: Opcode) ?spec.Instruction { | 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 | return InstructionSet.core.instructions()[index]; | 105 | return InstructionSet.core.instructions()[index]; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| ... | @@ -127,10 +127,10 @@ pub const Parser = struct { | ... | @@ -127,10 +127,10 @@ pub const Parser = struct { |
| 127 | const set_name = std.mem.sliceTo(std.mem.sliceAsBytes(operands[1..]), 0); | 127 | const set_name = std.mem.sliceTo(std.mem.sliceAsBytes(operands[1..]), 0); |
| 128 | const set = std.meta.stringToEnum(InstructionSet, set_name) orelse continue; | 128 | const set = std.meta.stringToEnum(InstructionSet, set_name) orelse continue; |
| 129 | if (set == .core) continue; | 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 | .OpTypeInt, .OpTypeFloat => { | 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 | .OpFunction => if (maybe_function_section == null) { | 135 | .OpFunction => if (maybe_function_section == null) { |
| 136 | maybe_function_section = inst.offset; | 136 | maybe_function_section = inst.offset; |
| ... | @@ -145,8 +145,8 @@ pub const Parser = struct { | ... | @@ -145,8 +145,8 @@ pub const Parser = struct { |
| 145 | spec_operands[1].kind == .id_result) | 145 | spec_operands[1].kind == .id_result) |
| 146 | { | 146 | { |
| 147 | if (operands.len >= 2) { | 147 | if (operands.len >= 2) { |
| 148 | if (binary.arith_type_width.get(@enumFromInt(operands[0]))) |width| { | 148 | if (binary.arith_type_width.get(@fromBackingInt(@intCast(operands[0])))) |width| { |
| 149 | try binary.arith_type_width.put(parser.gpa, @enumFromInt(operands[1]), 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,7 +165,7 @@ pub const Parser = struct { |
| 165 | inst: Instruction, | 165 | inst: Instruction, |
| 166 | offsets: *std.ArrayList(u16), | 166 | offsets: *std.ArrayList(u16), |
| 167 | ) !void { | 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 | const operands = InstructionSet.core.instructions()[index].operands; | 169 | const operands = InstructionSet.core.instructions()[index].operands; |
| 170 | 170 | ||
| 171 | var offset: usize = 0; | 171 | var offset: usize = 0; |
| ... | @@ -190,10 +190,10 @@ pub const Parser = struct { | ... | @@ -190,10 +190,10 @@ pub const Parser = struct { |
| 190 | offset = try parser.parseOperandsResultIds(binary, inst, operands[0..2], offset, offsets); | 190 | offset = try parser.parseOperandsResultIds(binary, inst, operands[0..2], offset, offsets); |
| 191 | 191 | ||
| 192 | if (offset + 1 >= inst.operands.len) return error.InvalidPhysicalFormat; | 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 | try offsets.append(parser.gpa, @intCast(offset)); | 194 | try offsets.append(parser.gpa, @intCast(offset)); |
| 195 | const set = binary.ext_inst_map.get(set_id) orelse { | 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 | return error.InvalidId; | 197 | return error.InvalidId; |
| 198 | }; | 198 | }; |
| 199 | const ext_opcode = std.math.cast(u16, inst.operands[offset + 1]) orelse return error.InvalidPhysicalFormat; | 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,7 +304,7 @@ pub const Parser = struct { |
| 304 | }, | 304 | }, |
| 305 | .literal_context_dependent_number => { | 305 | .literal_context_dependent_number => { |
| 306 | assert(inst.opcode == .OpConstant or inst.opcode == .OpSpecConstant); | 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 | log.err("invalid LiteralContextDependentNumber type {}", .{inst.operands[0]}); | 308 | log.err("invalid LiteralContextDependentNumber type {}", .{inst.operands[0]}); |
| 309 | return error.InvalidId; | 309 | return error.InvalidId; |
| 310 | }; | 310 | }; |
| ... | @@ -318,7 +318,7 @@ pub const Parser = struct { | ... | @@ -318,7 +318,7 @@ pub const Parser = struct { |
| 318 | .literal_spec_constant_op_integer => unreachable, | 318 | .literal_spec_constant_op_integer => unreachable, |
| 319 | .pair_literal_integer_id_ref => { | 319 | .pair_literal_integer_id_ref => { |
| 320 | assert(inst.opcode == .OpSwitch); | 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 | log.err("invalid OpSwitch type {}", .{inst.operands[0]}); | 322 | log.err("invalid OpSwitch type {}", .{inst.operands[0]}); |
| 323 | return error.InvalidId; | 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,7 +35,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 35 | }, | 35 | }, |
| 36 | } | 36 | } |
| 37 | if (inst.operands.len == 0) continue; | 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 | const gop = try decorations_by_id.getOrPut(gpa, target_id); | 40 | const gop = try decorations_by_id.getOrPut(gpa, target_id); |
| 41 | if (!gop.found_existing) gop.value_ptr.* = .empty; | 41 | if (!gop.found_existing) gop.value_ptr.* = .empty; |
| ... | @@ -75,10 +75,10 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { | ... | @@ -75,10 +75,10 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 75 | else => continue, | 75 | else => continue, |
| 76 | }; | 76 | }; |
| 77 | if (result_id_index >= inst.operands.len) continue; | 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 | key_words.items.len = 0; | 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 | id_offsets.items.len = 0; | 83 | id_offsets.items.len = 0; |
| 84 | parser.parseInstructionResultIds(binary.*, inst, &id_offsets) catch continue; | 84 | parser.parseInstructionResultIds(binary.*, inst, &id_offsets) catch continue; |
| ... | @@ -86,8 +86,8 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { | ... | @@ -86,8 +86,8 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 86 | for (inst.operands, 0..) |word, i| { | 86 | for (inst.operands, 0..) |word, i| { |
| 87 | if (i == result_id_index) continue; | 87 | if (i == result_id_index) continue; |
| 88 | if (std.mem.indexOfScalar(u16, id_offsets.items, @intCast(i)) != null) { | 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)); | 89 | const canonical = id_remap.get(@fromBackingInt(@intCast(word))) orelse @as(Id, @fromBackingInt(@intCast(word))); |
| 90 | try key_words.append(gpa, @intFromEnum(canonical)); | 90 | try key_words.append(gpa, @backingInt(canonical)); |
| 91 | } else { | 91 | } else { |
| 92 | try key_words.append(gpa, word); | 92 | try key_words.append(gpa, word); |
| 93 | } | 93 | } |
| ... | @@ -100,7 +100,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { | ... | @@ -100,7 +100,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 100 | var hasher = std.hash.Wyhash.init(0); | 100 | var hasher = std.hash.Wyhash.init(0); |
| 101 | hasher.update(std.mem.asBytes(&dec_words[0])); | 101 | hasher.update(std.mem.asBytes(&dec_words[0])); |
| 102 | for (dec_words[2..]) |w| { | 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 | hasher.update(std.mem.asBytes(&w_val)); | 104 | hasher.update(std.mem.asBytes(&w_val)); |
| 105 | } | 105 | } |
| 106 | try dec_hashes.append(gpa, hasher.final()); | 106 | try dec_hashes.append(gpa, hasher.final()); |
| ... | @@ -151,7 +151,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { | ... | @@ -151,7 +151,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 151 | else => unreachable, | 151 | else => unreachable, |
| 152 | }; | 152 | }; |
| 153 | if (result_id_index < inst.operands.len) { | 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 | if (id_remap.contains(result_id)) continue; | 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,7 +159,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 159 | switch (inst.opcode.class()) { | 159 | switch (inst.opcode.class()) { |
| 160 | .annotation, .debug => { | 160 | .annotation, .debug => { |
| 161 | if (inst.operands.len > 0) { | 161 | if (inst.operands.len > 0) { |
| 162 | const target: Id = @enumFromInt(inst.operands[0]); | 162 | const target: Id = @fromBackingInt(@intCast(inst.operands[0])); |
| 163 | if (id_remap.contains(target)) continue; | 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,8 +186,8 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 186 | max_id = @max(max_id, word.*); | 186 | max_id = @max(max_id, word.*); |
| 187 | if (maybe_result_id_index != null and i == maybe_result_id_index.?) continue; | 187 | if (maybe_result_id_index != null and i == maybe_result_id_index.?) continue; |
| 188 | 188 | ||
| 189 | if (id_remap.get(@enumFromInt(word.*))) |canonical| { | 189 | if (id_remap.get(@fromBackingInt(@intCast(word.*)))) |canonical| { |
| 190 | word.* = @intFromEnum(canonical); | 190 | word.* = @backingInt(canonical); |
| 191 | max_id = @max(max_id, word.*); | 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,7 +94,7 @@ const ModuleInfo = struct { |
| 94 | 94 | ||
| 95 | switch (inst.opcode) { | 95 | switch (inst.opcode) { |
| 96 | .OpEntryPoint => { | 96 | .OpEntryPoint => { |
| 97 | const entry_point: ResultId = @enumFromInt(inst.operands[1]); | 97 | const entry_point: ResultId = @fromBackingInt(@intCast(inst.operands[1])); |
| 98 | const entry = try entry_points.getOrPut(arena, entry_point); | 98 | const entry = try entry_points.getOrPut(arena, entry_point); |
| 99 | if (entry.found_existing) { | 99 | if (entry.found_existing) { |
| 100 | log.err("Entry point type {f} has duplicate definition", .{entry_point}); | 100 | log.err("Entry point type {f} has duplicate definition", .{entry_point}); |
| ... | @@ -102,8 +102,8 @@ const ModuleInfo = struct { | ... | @@ -102,8 +102,8 @@ const ModuleInfo = struct { |
| 102 | } | 102 | } |
| 103 | }, | 103 | }, |
| 104 | .OpTypeFunction => { | 104 | .OpTypeFunction => { |
| 105 | const fn_type: ResultId = @enumFromInt(inst.operands[0]); | 105 | const fn_type: ResultId = @fromBackingInt(@intCast(inst.operands[0])); |
| 106 | const return_type: ResultId = @enumFromInt(inst.operands[1]); | 106 | const return_type: ResultId = @fromBackingInt(@intCast(inst.operands[1])); |
| 107 | const param_types: []const ResultId = @ptrCast(inst.operands[2..]); | 107 | const param_types: []const ResultId = @ptrCast(inst.operands[2..]); |
| 108 | 108 | ||
| 109 | const entry = try fn_types.getOrPut(fn_type); | 109 | const entry = try fn_types.getOrPut(fn_type); |
| ... | @@ -119,15 +119,15 @@ const ModuleInfo = struct { | ... | @@ -119,15 +119,15 @@ const ModuleInfo = struct { |
| 119 | }, | 119 | }, |
| 120 | .OpExtInst => { | 120 | .OpExtInst => { |
| 121 | // Note: format and set are already verified by parseInstructionResultIds(). | 121 | // Note: format and set are already verified by parseInstructionResultIds(). |
| 122 | const global_type: ResultId = @enumFromInt(inst.operands[0]); | 122 | const global_type: ResultId = @fromBackingInt(@intCast(inst.operands[0])); |
| 123 | const result_id: ResultId = @enumFromInt(inst.operands[1]); | 123 | const result_id: ResultId = @fromBackingInt(@intCast(inst.operands[1])); |
| 124 | const set_id: ResultId = @enumFromInt(inst.operands[2]); | 124 | const set_id: ResultId = @fromBackingInt(@intCast(inst.operands[2])); |
| 125 | const set_inst = inst.operands[3]; | 125 | const set_inst = inst.operands[3]; |
| 126 | 126 | ||
| 127 | const set = binary.ext_inst_map.get(set_id).?; | 127 | const set = binary.ext_inst_map.get(set_id).?; |
| 128 | if (set == .zig and set_inst == 0) { | 128 | if (set == .zig and set_inst == 0) { |
| 129 | const initializer: ResultId = if (inst.operands.len >= 5) | 129 | const initializer: ResultId = if (inst.operands.len >= 5) |
| 130 | @enumFromInt(inst.operands[4]) | 130 | @fromBackingInt(@intCast(inst.operands[4])) |
| 131 | else | 131 | else |
| 132 | .none; | 132 | .none; |
| 133 | 133 | ||
| ... | @@ -144,12 +144,12 @@ const ModuleInfo = struct { | ... | @@ -144,12 +144,12 @@ const ModuleInfo = struct { |
| 144 | return error.InvalidPhysicalFormat; | 144 | return error.InvalidPhysicalFormat; |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | maybe_current_function = @enumFromInt(inst.operands[1]); | 147 | maybe_current_function = @fromBackingInt(@intCast(inst.operands[1])); |
| 148 | fn_ty_id = @enumFromInt(inst.operands[3]); | 148 | fn_ty_id = @fromBackingInt(@intCast(inst.operands[3])); |
| 149 | function_invocation_globals.clearRetainingCapacity(); | 149 | function_invocation_globals.clearRetainingCapacity(); |
| 150 | }, | 150 | }, |
| 151 | .OpFunctionCall => { | 151 | .OpFunctionCall => { |
| 152 | const callee: ResultId = @enumFromInt(inst.operands[2]); | 152 | const callee: ResultId = @fromBackingInt(@intCast(inst.operands[2])); |
| 153 | try calls.put(arena, callee, {}); | 153 | try calls.put(arena, callee, {}); |
| 154 | }, | 154 | }, |
| 155 | .OpFunctionEnd => { | 155 | .OpFunctionEnd => { |
| ... | @@ -184,7 +184,7 @@ const ModuleInfo = struct { | ... | @@ -184,7 +184,7 @@ const ModuleInfo = struct { |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | for (result_id_offsets.items) |off| { | 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 | if (invocation_globals.contains(result_id)) { | 188 | if (invocation_globals.contains(result_id)) { |
| 189 | try function_invocation_globals.put(arena, result_id, {}); | 189 | try function_invocation_globals.put(arena, result_id, {}); |
| 190 | } | 190 | } |
| ... | @@ -355,7 +355,7 @@ const ModuleBuilder = struct { | ... | @@ -355,7 +355,7 @@ const ModuleBuilder = struct { |
| 355 | global_id_base: u32, | 355 | global_id_base: u32, |
| 356 | 356 | ||
| 357 | fn invocationGlobalId(self: FunctionNewInfo, index: usize) ResultId { | 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,7 +384,7 @@ const ModuleBuilder = struct { |
| 384 | .entry_point_new_id_base = undefined, | 384 | .entry_point_new_id_base = undefined, |
| 385 | .new_functions_section = null, | 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 | return self; | 388 | return self; |
| 389 | } | 389 | } |
| 390 | 390 | ||
| ... | @@ -394,7 +394,7 @@ const ModuleBuilder = struct { | ... | @@ -394,7 +394,7 @@ const ModuleBuilder = struct { |
| 394 | 394 | ||
| 395 | fn allocIds(self: *ModuleBuilder, n: u32) ResultId { | 395 | fn allocIds(self: *ModuleBuilder, n: u32) ResultId { |
| 396 | defer self.id_bound += n; | 396 | defer self.id_bound += n; |
| 397 | return @enumFromInt(self.id_bound); | 397 | return @fromBackingInt(@intCast(self.id_bound)); |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | fn finalize(self: *ModuleBuilder, arena: Allocator, binary: *BinaryModule) !void { | 400 | fn finalize(self: *ModuleBuilder, arena: Allocator, binary: *BinaryModule) !void { |
| ... | @@ -435,7 +435,7 @@ const ModuleBuilder = struct { | ... | @@ -435,7 +435,7 @@ const ModuleBuilder = struct { |
| 435 | 435 | ||
| 436 | switch (inst.opcode) { | 436 | switch (inst.opcode) { |
| 437 | .OpName => { | 437 | .OpName => { |
| 438 | const id: ResultId = @enumFromInt(inst.operands[0]); | 438 | const id: ResultId = @fromBackingInt(@intCast(inst.operands[0])); |
| 439 | if (info.invocation_globals.contains(id)) { | 439 | if (info.invocation_globals.contains(id)) { |
| 440 | try self.global_names.put(self.arena, id, inst.operands[1..]); | 440 | try self.global_names.put(self.arena, id, inst.operands[1..]); |
| 441 | continue; | 441 | continue; |
| ... | @@ -443,12 +443,12 @@ const ModuleBuilder = struct { | ... | @@ -443,12 +443,12 @@ const ModuleBuilder = struct { |
| 443 | if (info.dead_initializers.contains(id)) continue; | 443 | if (info.dead_initializers.contains(id)) continue; |
| 444 | }, | 444 | }, |
| 445 | .OpExtInstImport => { | 445 | .OpExtInstImport => { |
| 446 | const set_id: ResultId = @enumFromInt(inst.operands[0]); | 446 | const set_id: ResultId = @fromBackingInt(@intCast(inst.operands[0])); |
| 447 | const set = binary.ext_inst_map.get(set_id).?; | 447 | const set = binary.ext_inst_map.get(set_id).?; |
| 448 | if (set == .zig) continue; | 448 | if (set == .zig) continue; |
| 449 | }, | 449 | }, |
| 450 | .OpExtInst => { | 450 | .OpExtInst => { |
| 451 | const set_id: ResultId = @enumFromInt(inst.operands[2]); | 451 | const set_id: ResultId = @fromBackingInt(@intCast(inst.operands[2])); |
| 452 | const set_inst = inst.operands[3]; | 452 | const set_inst = inst.operands[3]; |
| 453 | const set = binary.ext_inst_map.get(set_id).?; | 453 | const set = binary.ext_inst_map.get(set_id).?; |
| 454 | if (set == .zig and set_inst == 0) { | 454 | if (set == .zig and set_inst == 0) { |
| ... | @@ -456,11 +456,11 @@ const ModuleBuilder = struct { | ... | @@ -456,11 +456,11 @@ const ModuleBuilder = struct { |
| 456 | } | 456 | } |
| 457 | }, | 457 | }, |
| 458 | .OpEntryPoint => { | 458 | .OpEntryPoint => { |
| 459 | const original_id: ResultId = @enumFromInt(inst.operands[1]); | 459 | const original_id: ResultId = @fromBackingInt(@intCast(inst.operands[1])); |
| 460 | const fn_info = info.functions.get(original_id).?; | 460 | const fn_info = info.functions.get(original_id).?; |
| 461 | if (fn_info.invocation_globals.count() > 0) { | 461 | if (fn_info.invocation_globals.count() > 0) { |
| 462 | const new_id_index = info.entry_points.getIndex(original_id).?; | 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 | try self.section.emitRaw(self.arena, .OpEntryPoint, inst.operands.len); | 464 | try self.section.emitRaw(self.arena, .OpEntryPoint, inst.operands.len); |
| 465 | self.section.writeWord(inst.operands[0]); | 465 | self.section.writeWord(inst.operands[0]); |
| 466 | self.section.writeOperand(ResultId, new_id); | 466 | self.section.writeOperand(ResultId, new_id); |
| ... | @@ -471,11 +471,11 @@ const ModuleBuilder = struct { | ... | @@ -471,11 +471,11 @@ const ModuleBuilder = struct { |
| 471 | continue; | 471 | continue; |
| 472 | }, | 472 | }, |
| 473 | .OpExecutionMode, .OpExecutionModeId => { | 473 | .OpExecutionMode, .OpExecutionModeId => { |
| 474 | const original_id: ResultId = @enumFromInt(inst.operands[0]); | 474 | const original_id: ResultId = @fromBackingInt(@intCast(inst.operands[0])); |
| 475 | const fn_info = info.functions.get(original_id).?; | 475 | const fn_info = info.functions.get(original_id).?; |
| 476 | if (fn_info.invocation_globals.count() > 0) { | 476 | if (fn_info.invocation_globals.count() > 0) { |
| 477 | const new_id_index = info.entry_points.getIndex(original_id).?; | 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 | try self.section.emitRaw(self.arena, inst.opcode, inst.operands.len); | 479 | try self.section.emitRaw(self.arena, inst.opcode, inst.operands.len); |
| 480 | self.section.writeOperand(ResultId, new_id); | 480 | self.section.writeOperand(ResultId, new_id); |
| 481 | self.section.writeWords(inst.operands[1..]); | 481 | self.section.writeWords(inst.operands[1..]); |
| ... | @@ -512,7 +512,7 @@ const ModuleBuilder = struct { | ... | @@ -512,7 +512,7 @@ const ModuleBuilder = struct { |
| 512 | const new_type = try self.internFunctionType(fn_info.return_type, new_param_types); | 512 | const new_type = try self.internFunctionType(fn_info.return_type, new_param_types); |
| 513 | try self.function_new_info.put(self.arena, func, .{ | 513 | try self.function_new_info.put(self.arena, func, .{ |
| 514 | .new_function_type = new_type, | 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,20 +583,20 @@ const ModuleBuilder = struct { |
| 583 | 583 | ||
| 584 | // Replace the result-ids with the global's new result-id if required. | 584 | // Replace the result-ids with the global's new result-id if required. |
| 585 | for (result_id_offsets.items) |off| { | 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 | if (info.invocation_globals.contains(result_id)) { | 587 | if (info.invocation_globals.contains(result_id)) { |
| 588 | const func = maybe_current_function.?; | 588 | const func = maybe_current_function.?; |
| 589 | const new_info = self.function_new_info.get(func).?; | 589 | const new_info = self.function_new_info.get(func).?; |
| 590 | const fn_info = info.functions.get(func).?; | 590 | const fn_info = info.functions.get(func).?; |
| 591 | const index = fn_info.invocation_globals.getIndex(result_id).?; | 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 | switch (inst.opcode) { | 596 | switch (inst.opcode) { |
| 597 | .OpFunction => { | 597 | .OpFunction => { |
| 598 | // Re-declare the function with the new parameters. | 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 | if (info.dead_initializers.contains(func)) { | 600 | if (info.dead_initializers.contains(func)) { |
| 601 | skip_until_end = true; | 601 | skip_until_end = true; |
| 602 | continue; | 602 | continue; |
| ... | @@ -628,7 +628,7 @@ const ModuleBuilder = struct { | ... | @@ -628,7 +628,7 @@ const ModuleBuilder = struct { |
| 628 | .OpFunctionCall => { | 628 | .OpFunctionCall => { |
| 629 | // Add the required invocation globals to the function's new parameter list. | 629 | // Add the required invocation globals to the function's new parameter list. |
| 630 | const caller = maybe_current_function.?; | 630 | const caller = maybe_current_function.?; |
| 631 | const callee: ResultId = @enumFromInt(operands.items[2]); | 631 | const callee: ResultId = @fromBackingInt(@intCast(operands.items[2])); |
| 632 | const caller_info = info.functions.get(caller).?; | 632 | const caller_info = info.functions.get(caller).?; |
| 633 | const callee_info = info.functions.get(callee).?; | 633 | const callee_info = info.functions.get(callee).?; |
| 634 | const caller_new_info = self.function_new_info.get(caller).?; | 634 | const caller_new_info = self.function_new_info.get(caller).?; |
| ... | @@ -663,7 +663,7 @@ const ModuleBuilder = struct { | ... | @@ -663,7 +663,7 @@ const ModuleBuilder = struct { |
| 663 | for (info.entry_points.keys(), 0..) |func, entry_point_index| { | 663 | for (info.entry_points.keys(), 0..) |func, entry_point_index| { |
| 664 | const fn_info = info.functions.get(func).?; | 664 | const fn_info = info.functions.get(func).?; |
| 665 | if (fn_info.invocation_globals.count() == 0) continue; | 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 | const fn_type = self.function_types.get(.{ | 667 | const fn_type = self.function_types.get(.{ |
| 668 | .return_type = fn_info.return_type, | 668 | .return_type = fn_info.return_type, |
| 669 | .param_types = fn_info.param_types, | 669 | .param_types = fn_info.param_types, |
| ... | @@ -677,9 +677,9 @@ const ModuleBuilder = struct { | ... | @@ -677,9 +677,9 @@ const ModuleBuilder = struct { |
| 677 | }); | 677 | }); |
| 678 | 678 | ||
| 679 | // Emit OpFunctionParameter instructions for the original kernel's parameters. | 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 | for (fn_info.param_types, 0..) |param_type, i| { | 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 | try self.section.emit(arena, .OpFunctionParameter, .{ | 683 | try self.section.emit(arena, .OpFunctionParameter, .{ |
| 684 | .id_result_type = param_type, | 684 | .id_result_type = param_type, |
| 685 | .id_result = id, | 685 | .id_result = id, |
| ... | @@ -703,11 +703,11 @@ const ModuleBuilder = struct { | ... | @@ -703,11 +703,11 @@ const ModuleBuilder = struct { |
| 703 | } | 703 | } |
| 704 | 704 | ||
| 705 | // Declare the IDs of the invocation globals. | 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 | for (all_function_invocation_globals.keys(), 0..) |global, i| { | 707 | for (all_function_invocation_globals.keys(), 0..) |global, i| { |
| 708 | const global_info = info.invocation_globals.get(global).?; | 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 | try self.section.emit(arena, .OpVariable, .{ | 711 | try self.section.emit(arena, .OpVariable, .{ |
| 712 | .id_result_type = global_info.ty, | 712 | .id_result_type = global_info.ty, |
| 713 | .id_result = id, | 713 | .id_result = id, |
| ... | @@ -764,13 +764,13 @@ const ModuleBuilder = struct { | ... | @@ -764,13 +764,13 @@ const ModuleBuilder = struct { |
| 764 | // Add the invocation globals | 764 | // Add the invocation globals |
| 765 | for (callee_info.invocation_globals.keys()) |global| { | 765 | for (callee_info.invocation_globals.keys()) |global| { |
| 766 | const index = all_globals.getIndex(global).?; | 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 | self.section.writeOperand(ResultId, id); | 768 | self.section.writeOperand(ResultId, id); |
| 769 | } | 769 | } |
| 770 | 770 | ||
| 771 | // Add the arguments | 771 | // Add the arguments |
| 772 | for (0..callee_info.param_types.len) |index| { | 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 | self.section.writeOperand(ResultId, id); | 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,11 +59,11 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 59 | while (it.next()) |inst| { | 59 | while (it.next()) |inst| { |
| 60 | if (inst.offset >= binary.functions_start) break; | 60 | if (inst.offset >= binary.functions_start) break; |
| 61 | if (inst.opcode == .OpDecorate and inst.operands.len >= 2 and | 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 | // Last word after the string is the linkage type; Export = 0. | 64 | // Last word after the string is the linkage type; Export = 0. |
| 65 | if (inst.operands[inst.operands.len - 1] == @intFromEnum(spec.LinkageType.@"export")) { | 65 | if (inst.operands[inst.operands.len - 1] == @backingInt(spec.LinkageType.@"export")) { |
| 66 | const target: ResultId = @enumFromInt(inst.operands[0]); | 66 | const target: ResultId = @fromBackingInt(@intCast(inst.operands[0])); |
| 67 | if (id_to_index.get(target)) |index| { | 67 | if (id_to_index.get(target)) |index| { |
| 68 | alive.set(index); | 68 | alive.set(index); |
| 69 | } | 69 | } |
| ... | @@ -133,7 +133,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { | ... | @@ -133,7 +133,7 @@ pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { |
| 133 | } else { | 133 | } else { |
| 134 | // annotation-style: emit only if the target id is alive | 134 | // annotation-style: emit only if the target id is alive |
| 135 | if (inst.operands.len > 0) { | 135 | if (inst.operands.len > 0) { |
| 136 | const target: ResultId = @enumFromInt(inst.operands[0]); | 136 | const target: ResultId = @fromBackingInt(@intCast(inst.operands[0])); |
| 137 | if (id_to_index.get(target)) |idx| { | 137 | if (id_to_index.get(target)) |idx| { |
| 138 | if (!alive.isSet(idx)) continue; | 138 | if (!alive.isSet(idx)) continue; |
| 139 | } else continue; | 139 | } else continue; |
| ... | @@ -199,14 +199,14 @@ fn markAlive( | ... | @@ -199,14 +199,14 @@ fn markAlive( |
| 199 | var i = start; | 199 | var i = start; |
| 200 | while (i < end) : (i += 1) { | 200 | while (i < end) : (i += 1) { |
| 201 | const off = id_offset_buf.items[i]; | 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 | const index = id_to_index.get(id) orelse continue; | 203 | const index = id_to_index.get(id) orelse continue; |
| 204 | if (alive.isSet(index)) continue; | 204 | if (alive.isSet(index)) continue; |
| 205 | alive.set(index); | 205 | alive.set(index); |
| 206 | 206 | ||
| 207 | const offset = code_offsets.items[index]; | 207 | const offset = code_offsets.items[index]; |
| 208 | const ref_inst = BinaryModule.Instruction{ | 208 | const ref_inst = BinaryModule.Instruction{ |
| 209 | .opcode = @enumFromInt(binary.instructions[offset] & 0xFFFF), | 209 | .opcode = @fromBackingInt(@intCast(binary.instructions[offset] & 0xFFFF)), |
| 210 | .offset = offset, | 210 | .offset = offset, |
| 211 | .operands = blk: { | 211 | .operands = blk: { |
| 212 | const l = binary.instructions[offset] >> 16; | 212 | const l = binary.instructions[offset] >> 16; |
| ... | @@ -231,7 +231,7 @@ fn markAlive( | ... | @@ -231,7 +231,7 @@ fn markAlive( |
| 231 | fn getResultId(inst: BinaryModule.Instruction, inst_spec: spec.Instruction) ?ResultId { | 231 | fn getResultId(inst: BinaryModule.Instruction, inst_spec: spec.Instruction) ?ResultId { |
| 232 | for (0..@min(2, inst_spec.operands.len)) |i| { | 232 | for (0..@min(2, inst_spec.operands.len)) |i| { |
| 233 | if (inst_spec.operands[i].kind == .id_result) { | 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 | return null; | 237 | return null; |
src/link/Wasm.zig+161-161| ... | @@ -332,7 +332,7 @@ pub const ObjectIndex = enum(u32) { | ... | @@ -332,7 +332,7 @@ pub const ObjectIndex = enum(u32) { |
| 332 | _, | 332 | _, |
| 333 | 333 | ||
| 334 | pub fn ptr(index: ObjectIndex, wasm: *const Wasm) *Object { | 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,7 +341,7 @@ pub const FunctionIndex = enum(u32) { |
| 341 | _, | 341 | _, |
| 342 | 342 | ||
| 343 | pub fn ptr(index: FunctionIndex, wasm: *const Wasm) *FunctionImport.Resolution { | 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 | pub fn fromIpNav(wasm: *const Wasm, nav_index: InternPool.Nav.Index) ?FunctionIndex { | 347 | pub fn fromIpNav(wasm: *const Wasm, nav_index: InternPool.Nav.Index) ?FunctionIndex { |
| ... | @@ -349,7 +349,7 @@ pub const FunctionIndex = enum(u32) { | ... | @@ -349,7 +349,7 @@ pub const FunctionIndex = enum(u32) { |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | pub fn fromTagIndexType(wasm: *const Wasm, tag_type: InternPool.Index) ?FunctionIndex { | 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 | return fromResolution(wasm, .pack(wasm, .{ .zcu_func = zcu_func })); | 353 | return fromResolution(wasm, .pack(wasm, .{ .zcu_func = zcu_func })); |
| 354 | } | 354 | } |
| 355 | 355 | ||
| ... | @@ -364,7 +364,7 @@ pub const FunctionIndex = enum(u32) { | ... | @@ -364,7 +364,7 @@ pub const FunctionIndex = enum(u32) { |
| 364 | 364 | ||
| 365 | pub fn fromResolution(wasm: *const Wasm, resolution: FunctionImport.Resolution) ?FunctionIndex { | 365 | pub fn fromResolution(wasm: *const Wasm, resolution: FunctionImport.Resolution) ?FunctionIndex { |
| 366 | const i = wasm.functions.getIndex(resolution) orelse return null; | 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,7 +386,7 @@ pub const OutputFunctionIndex = enum(u32) { |
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | pub fn fromFunctionIndex(wasm: *const Wasm, index: FunctionIndex) OutputFunctionIndex { | 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 | pub fn fromObjectFunction(wasm: *const Wasm, index: ObjectFunctionIndex) OutputFunctionIndex { | 392 | pub fn fromObjectFunction(wasm: *const Wasm, index: ObjectFunctionIndex) OutputFunctionIndex { |
| ... | @@ -428,7 +428,7 @@ pub const OutputFunctionIndex = enum(u32) { | ... | @@ -428,7 +428,7 @@ pub const OutputFunctionIndex = enum(u32) { |
| 428 | } | 428 | } |
| 429 | 429 | ||
| 430 | pub fn fromSymbolName(wasm: *const Wasm, name: String) OutputFunctionIndex { | 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 | return fromFunctionIndex(wasm, FunctionIndex.fromSymbolName(wasm, name) orelse { | 432 | return fromFunctionIndex(wasm, FunctionIndex.fromSymbolName(wasm, name) orelse { |
| 433 | if (std.debug.runtime_safety) { | 433 | if (std.debug.runtime_safety) { |
| 434 | std.debug.panic("function index for symbol not found: {s}", .{name.slice(wasm)}); | 434 | std.debug.panic("function index for symbol not found: {s}", .{name.slice(wasm)}); |
| ... | @@ -442,7 +442,7 @@ pub const GlobalIndex = enum(u32) { | ... | @@ -442,7 +442,7 @@ pub const GlobalIndex = enum(u32) { |
| 442 | _, | 442 | _, |
| 443 | 443 | ||
| 444 | /// This is only accurate when not emitting an object and there is a Zcu. | 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 | /// Same as `stack_pointer` but with a safety assertion. | 447 | /// Same as `stack_pointer` but with a safety assertion. |
| 448 | pub fn stackPointer(wasm: *const Wasm) ObjectGlobal.Index { | 448 | pub fn stackPointer(wasm: *const Wasm) ObjectGlobal.Index { |
| ... | @@ -453,16 +453,16 @@ pub const GlobalIndex = enum(u32) { | ... | @@ -453,16 +453,16 @@ pub const GlobalIndex = enum(u32) { |
| 453 | } | 453 | } |
| 454 | 454 | ||
| 455 | pub fn ptr(index: GlobalIndex, f: *const Flush) *Wasm.GlobalImport.Resolution { | 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 | pub fn fromIpNav(wasm: *const Wasm, nav_index: InternPool.Nav.Index) ?GlobalIndex { | 459 | pub fn fromIpNav(wasm: *const Wasm, nav_index: InternPool.Nav.Index) ?GlobalIndex { |
| 460 | const i = wasm.globals.getIndex(.fromIpNav(wasm, nav_index)) orelse return null; | 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 | pub fn fromObjectGlobal(wasm: *const Wasm, i: ObjectGlobalIndex) GlobalIndex { | 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 | pub fn fromObjectGlobalHandlingWeak(wasm: *const Wasm, index: ObjectGlobalIndex) GlobalIndex { | 468 | pub fn fromObjectGlobalHandlingWeak(wasm: *const Wasm, index: ObjectGlobalIndex) GlobalIndex { |
| ... | @@ -475,7 +475,7 @@ pub const GlobalIndex = enum(u32) { | ... | @@ -475,7 +475,7 @@ pub const GlobalIndex = enum(u32) { |
| 475 | 475 | ||
| 476 | pub fn fromSymbolName(wasm: *const Wasm, name: String) GlobalIndex { | 476 | pub fn fromSymbolName(wasm: *const Wasm, name: String) GlobalIndex { |
| 477 | const import = wasm.object_global_imports.getPtr(name).?; | 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,16 +484,16 @@ pub const TableIndex = enum(u32) { |
| 484 | _, | 484 | _, |
| 485 | 485 | ||
| 486 | pub fn ptr(index: TableIndex, f: *const Flush) *Wasm.TableImport.Resolution { | 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 | pub fn fromObjectTable(wasm: *const Wasm, i: ObjectTableIndex) TableIndex { | 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 | pub fn fromSymbolName(wasm: *const Wasm, name: String) TableIndex { | 494 | pub fn fromSymbolName(wasm: *const Wasm, name: String) TableIndex { |
| 495 | const import = wasm.object_table_imports.getPtr(name).?; | 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,7 +524,7 @@ pub const SourceLocation = enum(u32) { |
| 524 | return switch (unpacked) { | 524 | return switch (unpacked) { |
| 525 | .zig_object_nofile => .zig_object_nofile, | 525 | .zig_object_nofile => .zig_object_nofile, |
| 526 | .none => .none, | 526 | .none => .none, |
| 527 | .object_index => |object_index| @enumFromInt(@intFromEnum(object_index)), | 527 | .object_index => |object_index| @fromBackingInt(@intCast(@backingInt(object_index))), |
| 528 | .source_location_index => @panic("TODO"), | 528 | .source_location_index => @panic("TODO"), |
| 529 | }; | 529 | }; |
| 530 | } | 530 | } |
| ... | @@ -534,8 +534,8 @@ pub const SourceLocation = enum(u32) { | ... | @@ -534,8 +534,8 @@ pub const SourceLocation = enum(u32) { |
| 534 | .zig_object_nofile => .zig_object_nofile, | 534 | .zig_object_nofile => .zig_object_nofile, |
| 535 | .none => .none, | 535 | .none => .none, |
| 536 | _ => { | 536 | _ => { |
| 537 | const i = @intFromEnum(sl); | 537 | const i = @backingInt(sl); |
| 538 | if (i < wasm.objects.items.len) return .{ .object_index = @enumFromInt(i) }; | 538 | if (i < wasm.objects.items.len) return .{ .object_index = @fromBackingInt(@intCast(i)) }; |
| 539 | const sl_index = i - wasm.objects.items.len; | 539 | const sl_index = i - wasm.objects.items.len; |
| 540 | _ = sl_index; | 540 | _ = sl_index; |
| 541 | @panic("TODO"); | 541 | @panic("TODO"); |
| ... | @@ -748,11 +748,11 @@ pub const NavsObjIndex = enum(u32) { | ... | @@ -748,11 +748,11 @@ pub const NavsObjIndex = enum(u32) { |
| 748 | _, | 748 | _, |
| 749 | 749 | ||
| 750 | pub fn key(i: @This(), wasm: *const Wasm) *InternPool.Nav.Index { | 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 | pub fn value(i: @This(), wasm: *const Wasm) *ZcuDataObj { | 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 | pub fn name(i: @This(), wasm: *const Wasm) [:0]const u8 { | 758 | pub fn name(i: @This(), wasm: *const Wasm) [:0]const u8 { |
| ... | @@ -768,11 +768,11 @@ pub const NavsExeIndex = enum(u32) { | ... | @@ -768,11 +768,11 @@ pub const NavsExeIndex = enum(u32) { |
| 768 | _, | 768 | _, |
| 769 | 769 | ||
| 770 | pub fn key(i: @This(), wasm: *const Wasm) *InternPool.Nav.Index { | 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 | pub fn value(i: @This(), wasm: *const Wasm) *ZcuDataExe { | 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 | pub fn name(i: @This(), wasm: *const Wasm) [:0]const u8 { | 778 | pub fn name(i: @This(), wasm: *const Wasm) [:0]const u8 { |
| ... | @@ -788,11 +788,11 @@ pub const UavsObjIndex = enum(u32) { | ... | @@ -788,11 +788,11 @@ pub const UavsObjIndex = enum(u32) { |
| 788 | _, | 788 | _, |
| 789 | 789 | ||
| 790 | pub fn key(i: @This(), wasm: *const Wasm) *InternPool.Index { | 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 | pub fn value(i: @This(), wasm: *const Wasm) *ZcuDataObj { | 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,11 +801,11 @@ pub const UavsExeIndex = enum(u32) { |
| 801 | _, | 801 | _, |
| 802 | 802 | ||
| 803 | pub fn key(i: @This(), wasm: *const Wasm) *InternPool.Index { | 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 | pub fn value(i: @This(), wasm: *const Wasm) *ZcuDataExe { | 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,11 +899,11 @@ pub const ZcuFunc = union { |
| 899 | _, | 899 | _, |
| 900 | 900 | ||
| 901 | pub fn key(i: @This(), wasm: *const Wasm) *InternPool.Index { | 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 | pub fn value(i: @This(), wasm: *const Wasm) *ZcuFunc { | 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 | pub fn name(i: @This(), wasm: *const Wasm) [:0]const u8 { | 909 | pub fn name(i: @This(), wasm: *const Wasm) [:0]const u8 { |
| ... | @@ -972,7 +972,7 @@ pub const FunctionImport = extern struct { | ... | @@ -972,7 +972,7 @@ pub const FunctionImport = extern struct { |
| 972 | // Next, index into `zcu_funcs`. | 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 | pub const Unpacked = union(enum) { | 977 | pub const Unpacked = union(enum) { |
| 978 | unresolved, | 978 | unresolved, |
| ... | @@ -992,14 +992,14 @@ pub const FunctionImport = extern struct { | ... | @@ -992,14 +992,14 @@ pub const FunctionImport = extern struct { |
| 992 | .__wasm_init_memory => .__wasm_init_memory, | 992 | .__wasm_init_memory => .__wasm_init_memory, |
| 993 | .__wasm_init_tls => .__wasm_init_tls, | 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 | const zcu_func_index = if (object_function_index < wasm.object_functions.items.len) | 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 | else | 999 | else |
| 1000 | object_function_index - wasm.object_functions.items.len; | 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,8 +1011,8 @@ pub const FunctionImport = extern struct { |
| 1011 | .__wasm_call_ctors => .__wasm_call_ctors, | 1011 | .__wasm_call_ctors => .__wasm_call_ctors, |
| 1012 | .__wasm_init_memory => .__wasm_init_memory, | 1012 | .__wasm_init_memory => .__wasm_init_memory, |
| 1013 | .__wasm_init_tls => .__wasm_init_tls, | 1013 | .__wasm_init_tls => .__wasm_init_tls, |
| 1014 | .object_function => |i| @enumFromInt(first_object_function + @intFromEnum(i)), | 1014 | .object_function => |i| @fromBackingInt(@intCast(first_object_function + @backingInt(i))), |
| 1015 | .zcu_func => |i| @enumFromInt(first_object_function + wasm.object_functions.items.len + @intFromEnum(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,7 +1027,7 @@ pub const FunctionImport = extern struct { |
| 1027 | } | 1027 | } |
| 1028 | 1028 | ||
| 1029 | pub fn fromIpIndex(wasm: *const Wasm, ip_index: InternPool.Index) Resolution { | 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 | pub fn fromObjectFunction(wasm: *const Wasm, object_function: ObjectFunctionIndex) Resolution { | 1033 | pub fn fromObjectFunction(wasm: *const Wasm, object_function: ObjectFunctionIndex) Resolution { |
| ... | @@ -1072,11 +1072,11 @@ pub const FunctionImport = extern struct { | ... | @@ -1072,11 +1072,11 @@ pub const FunctionImport = extern struct { |
| 1072 | _, | 1072 | _, |
| 1073 | 1073 | ||
| 1074 | pub fn key(index: Index, wasm: *const Wasm) *String { | 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 | pub fn value(index: Index, wasm: *const Wasm) *FunctionImport { | 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 | pub fn symbolName(index: Index, wasm: *const Wasm) String { | 1082 | pub fn symbolName(index: Index, wasm: *const Wasm) String { |
| ... | @@ -1139,7 +1139,7 @@ pub const GlobalImport = extern struct { | ... | @@ -1139,7 +1139,7 @@ pub const GlobalImport = extern struct { |
| 1139 | // Next, index into `navs_obj` or `navs_exe` depending on whether emitting an object. | 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 | pub const Unpacked = union(enum) { | 1144 | pub const Unpacked = union(enum) { |
| 1145 | unresolved, | 1145 | unresolved, |
| ... | @@ -1164,17 +1164,17 @@ pub const GlobalImport = extern struct { | ... | @@ -1164,17 +1164,17 @@ pub const GlobalImport = extern struct { |
| 1164 | .__tls_base => .__tls_base, | 1164 | .__tls_base => .__tls_base, |
| 1165 | .__tls_size => .__tls_size, | 1165 | .__tls_size => .__tls_size, |
| 1166 | _ => { | 1166 | _ => { |
| 1167 | const i: u32 = @intFromEnum(r); | 1167 | const i: u32 = @backingInt(r); |
| 1168 | const object_global_index = i - first_object_global; | 1168 | const object_global_index = i - first_object_global; |
| 1169 | if (object_global_index < wasm.object_globals.items.len) | 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 | const comp = wasm.base.comp; | 1171 | const comp = wasm.base.comp; |
| 1172 | const is_obj = comp.config.output_mode == .Obj; | 1172 | const is_obj = comp.config.output_mode == .Obj; |
| 1173 | const nav_index = object_global_index - wasm.object_globals.items.len; | 1173 | const nav_index = object_global_index - wasm.object_globals.items.len; |
| 1174 | return if (is_obj) .{ | 1174 | return if (is_obj) .{ |
| 1175 | .nav_obj = @enumFromInt(nav_index), | 1175 | .nav_obj = @fromBackingInt(@intCast(nav_index)), |
| 1176 | } else .{ | 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,9 +1189,9 @@ pub const GlobalImport = extern struct { |
| 1189 | .__tls_align => .__tls_align, | 1189 | .__tls_align => .__tls_align, |
| 1190 | .__tls_base => .__tls_base, | 1190 | .__tls_base => .__tls_base, |
| 1191 | .__tls_size => .__tls_size, | 1191 | .__tls_size => .__tls_size, |
| 1192 | .object_global => |i| @enumFromInt(first_object_global + @intFromEnum(i)), | 1192 | .object_global => |i| @fromBackingInt(@intCast(first_object_global + @backingInt(i))), |
| 1193 | .nav_obj => |i| @enumFromInt(first_object_global + wasm.object_globals.items.len + @intFromEnum(i)), | 1193 | .nav_obj => |i| @fromBackingInt(@intCast(first_object_global + wasm.object_globals.items.len + @backingInt(i))), |
| 1194 | .nav_exe => |i| @enumFromInt(first_object_global + wasm.object_globals.items.len + @intFromEnum(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,9 +1199,9 @@ pub const GlobalImport = extern struct { |
| 1199 | const comp = wasm.base.comp; | 1199 | const comp = wasm.base.comp; |
| 1200 | const is_obj = comp.config.output_mode == .Obj; | 1200 | const is_obj = comp.config.output_mode == .Obj; |
| 1201 | return pack(wasm, if (is_obj) .{ | 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 | } else .{ | 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,11 +1230,11 @@ pub const GlobalImport = extern struct { |
| 1230 | _, | 1230 | _, |
| 1231 | 1231 | ||
| 1232 | pub fn key(index: Index, wasm: *const Wasm) *String { | 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 | pub fn value(index: Index, wasm: *const Wasm) *GlobalImport { | 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 | pub fn symbolName(index: Index, wasm: *const Wasm) String { | 1240 | pub fn symbolName(index: Index, wasm: *const Wasm) String { |
| ... | @@ -1321,7 +1321,7 @@ pub const TableImport = extern struct { | ... | @@ -1321,7 +1321,7 @@ pub const TableImport = extern struct { |
| 1321 | // Next, index into `object_tables`. | 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 | pub const Unpacked = union(enum) { | 1326 | pub const Unpacked = union(enum) { |
| 1327 | unresolved, | 1327 | unresolved, |
| ... | @@ -1333,7 +1333,7 @@ pub const TableImport = extern struct { | ... | @@ -1333,7 +1333,7 @@ pub const TableImport = extern struct { |
| 1333 | return switch (r) { | 1333 | return switch (r) { |
| 1334 | .unresolved => .unresolved, | 1334 | .unresolved => .unresolved, |
| 1335 | .__indirect_function_table => .__indirect_function_table, | 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,7 +1341,7 @@ pub const TableImport = extern struct { |
| 1341 | return switch (unpacked) { | 1341 | return switch (unpacked) { |
| 1342 | .unresolved => .unresolved, | 1342 | .unresolved => .unresolved, |
| 1343 | .__indirect_function_table => .__indirect_function_table, | 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,11 +1375,11 @@ pub const TableImport = extern struct { |
| 1375 | _, | 1375 | _, |
| 1376 | 1376 | ||
| 1377 | pub fn key(index: Index, wasm: *const Wasm) *String { | 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 | pub fn value(index: Index, wasm: *const Wasm) *TableImport { | 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 | pub fn name(index: Index, wasm: *const Wasm) String { | 1385 | pub fn name(index: Index, wasm: *const Wasm) String { |
| ... | @@ -1434,7 +1434,7 @@ pub const ObjectTableIndex = enum(u32) { | ... | @@ -1434,7 +1434,7 @@ pub const ObjectTableIndex = enum(u32) { |
| 1434 | _, | 1434 | _, |
| 1435 | 1435 | ||
| 1436 | pub fn ptr(index: ObjectTableIndex, wasm: *const Wasm) *Table { | 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 | pub fn chaseWeak(i: ObjectTableIndex, wasm: *const Wasm) ObjectTableIndex { | 1440 | pub fn chaseWeak(i: ObjectTableIndex, wasm: *const Wasm) ObjectTableIndex { |
| ... | @@ -1452,7 +1452,7 @@ pub const ObjectGlobalIndex = enum(u32) { | ... | @@ -1452,7 +1452,7 @@ pub const ObjectGlobalIndex = enum(u32) { |
| 1452 | _, | 1452 | _, |
| 1453 | 1453 | ||
| 1454 | pub fn ptr(index: ObjectGlobalIndex, wasm: *const Wasm) *ObjectGlobal { | 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 | pub fn name(index: ObjectGlobalIndex, wasm: *const Wasm) OptionalString { | 1458 | pub fn name(index: ObjectGlobalIndex, wasm: *const Wasm) OptionalString { |
| ... | @@ -1480,7 +1480,7 @@ pub const ObjectMemory = extern struct { | ... | @@ -1480,7 +1480,7 @@ pub const ObjectMemory = extern struct { |
| 1480 | _, | 1480 | _, |
| 1481 | 1481 | ||
| 1482 | pub fn ptr(index: Index, wasm: *const Wasm) *ObjectMemory { | 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,11 +1501,11 @@ pub const ObjectFunctionIndex = enum(u32) { |
| 1501 | _, | 1501 | _, |
| 1502 | 1502 | ||
| 1503 | pub fn ptr(index: ObjectFunctionIndex, wasm: *const Wasm) *ObjectFunction { | 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 | pub fn toOptional(i: ObjectFunctionIndex) OptionalObjectFunctionIndex { | 1507 | pub fn toOptional(i: ObjectFunctionIndex) OptionalObjectFunctionIndex { |
| 1508 | const result: OptionalObjectFunctionIndex = @enumFromInt(@intFromEnum(i)); | 1508 | const result: OptionalObjectFunctionIndex = @fromBackingInt(@intCast(@backingInt(i))); |
| 1509 | assert(result != .none); | 1509 | assert(result != .none); |
| 1510 | return result; | 1510 | return result; |
| 1511 | } | 1511 | } |
| ... | @@ -1527,7 +1527,7 @@ pub const OptionalObjectFunctionIndex = enum(u32) { | ... | @@ -1527,7 +1527,7 @@ pub const OptionalObjectFunctionIndex = enum(u32) { |
| 1527 | 1527 | ||
| 1528 | pub fn unwrap(i: OptionalObjectFunctionIndex) ?ObjectFunctionIndex { | 1528 | pub fn unwrap(i: OptionalObjectFunctionIndex) ?ObjectFunctionIndex { |
| 1529 | if (i == .none) return null; | 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,7 +1562,7 @@ pub const ObjectDataSegment = extern struct { |
| 1562 | _, | 1562 | _, |
| 1563 | 1563 | ||
| 1564 | pub fn ptr(i: Index, wasm: *const Wasm) *ObjectDataSegment { | 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,7 +1588,7 @@ pub const ObjectData = extern struct { |
| 1588 | _, | 1588 | _, |
| 1589 | 1589 | ||
| 1590 | pub fn ptr(i: Index, wasm: *const Wasm) *ObjectData { | 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,7 +1609,7 @@ pub const ObjectDataImport = extern struct { |
| 1609 | /// Next, index into `navs_obj` or `navs_exe` depending on whether emitting an object. | 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 | pub const Unpacked = union(enum) { | 1614 | pub const Unpacked = union(enum) { |
| 1615 | unresolved, | 1615 | unresolved, |
| ... | @@ -1632,10 +1632,10 @@ pub const ObjectDataImport = extern struct { | ... | @@ -1632,10 +1632,10 @@ pub const ObjectDataImport = extern struct { |
| 1632 | .__heap_base => .__heap_base, | 1632 | .__heap_base => .__heap_base, |
| 1633 | .__heap_end => .__heap_end, | 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 | const uav_index = if (object_index < wasm.object_datas.items.len) | 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 | else | 1639 | else |
| 1640 | object_index - wasm.object_datas.items.len; | 1640 | object_index - wasm.object_datas.items.len; |
| 1641 | 1641 | ||
| ... | @@ -1643,18 +1643,18 @@ pub const ObjectDataImport = extern struct { | ... | @@ -1643,18 +1643,18 @@ pub const ObjectDataImport = extern struct { |
| 1643 | const is_obj = comp.config.output_mode == .Obj; | 1643 | const is_obj = comp.config.output_mode == .Obj; |
| 1644 | if (is_obj) { | 1644 | if (is_obj) { |
| 1645 | const nav_index = if (uav_index < wasm.uavs_obj.entries.len) | 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 | else | 1647 | else |
| 1648 | uav_index - wasm.uavs_obj.entries.len; | 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 | } else { | 1651 | } else { |
| 1652 | const nav_index = if (uav_index < wasm.uavs_exe.entries.len) | 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 | else | 1654 | else |
| 1655 | uav_index - wasm.uavs_exe.entries.len; | 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,10 +1667,10 @@ pub const ObjectDataImport = extern struct { |
| 1667 | .__zig_error_name_table => .__zig_error_name_table, | 1667 | .__zig_error_name_table => .__zig_error_name_table, |
| 1668 | .__heap_base => .__heap_base, | 1668 | .__heap_base => .__heap_base, |
| 1669 | .__heap_end => .__heap_end, | 1669 | .__heap_end => .__heap_end, |
| 1670 | .object => |i| @enumFromInt(first_object + @intFromEnum(i)), | 1670 | .object => |i| @fromBackingInt(@intCast(first_object + @backingInt(i))), |
| 1671 | inline .uav_exe, .uav_obj => |i| @enumFromInt(first_object + wasm.object_datas.items.len + @intFromEnum(i)), | 1671 | inline .uav_exe, .uav_obj => |i| @fromBackingInt(@intCast(first_object + wasm.object_datas.items.len + @backingInt(i))), |
| 1672 | .nav_exe => |i| @enumFromInt(first_object + wasm.object_datas.items.len + wasm.uavs_exe.entries.len + @intFromEnum(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| @enumFromInt(first_object + wasm.object_datas.items.len + wasm.uavs_obj.entries.len + @intFromEnum(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,11 +1721,11 @@ pub const ObjectDataImport = extern struct { |
| 1721 | _, | 1721 | _, |
| 1722 | 1722 | ||
| 1723 | pub fn value(i: @This(), wasm: *const Wasm) *ObjectDataImport { | 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 | pub fn fromSymbolName(wasm: *const Wasm, name: String) ?Index { | 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,7 +1742,7 @@ pub const DataPayload = extern struct { |
| 1742 | _, | 1742 | _, |
| 1743 | 1743 | ||
| 1744 | pub fn unwrap(off: Off) ?u32 { | 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,7 +1769,7 @@ pub const DataSegmentId = enum(u32) { |
| 1769 | /// Next, index into `navs_obj` or `navs_exe` depending on whether emitting an object. | 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 | pub const Category = enum { | 1774 | pub const Category = enum { |
| 1775 | /// Thread-local variables. | 1775 | /// Thread-local variables. |
| ... | @@ -1803,10 +1803,10 @@ pub const DataSegmentId = enum(u32) { | ... | @@ -1803,10 +1803,10 @@ pub const DataSegmentId = enum(u32) { |
| 1803 | .__zig_tag_name_table => .__zig_tag_name_table, | 1803 | .__zig_tag_name_table => .__zig_tag_name_table, |
| 1804 | .__heap_base => .__heap_base, | 1804 | .__heap_base => .__heap_base, |
| 1805 | .__heap_end => .__heap_end, | 1805 | .__heap_end => .__heap_end, |
| 1806 | .object => |i| @enumFromInt(first_object + @intFromEnum(i)), | 1806 | .object => |i| @fromBackingInt(@intCast(first_object + @backingInt(i))), |
| 1807 | inline .uav_exe, .uav_obj => |i| @enumFromInt(first_object + wasm.object_data_segments.items.len + @intFromEnum(i)), | 1807 | inline .uav_exe, .uav_obj => |i| @fromBackingInt(@intCast(first_object + wasm.object_data_segments.items.len + @backingInt(i))), |
| 1808 | .nav_exe => |i| @enumFromInt(first_object + wasm.object_data_segments.items.len + wasm.uavs_exe.entries.len + @intFromEnum(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| @enumFromInt(first_object + wasm.object_data_segments.items.len + wasm.uavs_obj.entries.len + @intFromEnum(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,10 +1819,10 @@ pub const DataSegmentId = enum(u32) { |
| 1819 | .__heap_base => .__heap_base, | 1819 | .__heap_base => .__heap_base, |
| 1820 | .__heap_end => .__heap_end, | 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 | const uav_index = if (object_index < wasm.object_data_segments.items.len) | 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 | else | 1826 | else |
| 1827 | object_index - wasm.object_data_segments.items.len; | 1827 | object_index - wasm.object_data_segments.items.len; |
| 1828 | 1828 | ||
| ... | @@ -1830,18 +1830,18 @@ pub const DataSegmentId = enum(u32) { | ... | @@ -1830,18 +1830,18 @@ pub const DataSegmentId = enum(u32) { |
| 1830 | const is_obj = comp.config.output_mode == .Obj; | 1830 | const is_obj = comp.config.output_mode == .Obj; |
| 1831 | if (is_obj) { | 1831 | if (is_obj) { |
| 1832 | const nav_index = if (uav_index < wasm.uavs_obj.entries.len) | 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 | else | 1834 | else |
| 1835 | uav_index - wasm.uavs_obj.entries.len; | 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 | } else { | 1838 | } else { |
| 1839 | const nav_index = if (uav_index < wasm.uavs_exe.entries.len) | 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 | else | 1841 | else |
| 1842 | uav_index - wasm.uavs_exe.entries.len; | 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,9 +1851,9 @@ pub const DataSegmentId = enum(u32) { |
| 1851 | const comp = wasm.base.comp; | 1851 | const comp = wasm.base.comp; |
| 1852 | const is_obj = comp.config.output_mode == .Obj; | 1852 | const is_obj = comp.config.output_mode == .Obj; |
| 1853 | return pack(wasm, if (is_obj) .{ | 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 | } else .{ | 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,10 +2086,10 @@ pub const CustomSegment = extern struct { |
| 2086 | pub const Expr = enum(u32) { | 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 | pub fn slice(index: Expr, wasm: *const Wasm) [:end]const u8 { | 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 | const end_pos = Object.exprEndPos(start_slice, 0) catch |err| switch (err) { | 2093 | const end_pos = Object.exprEndPos(start_slice, 0) catch |err| switch (err) { |
| 2094 | error.InvalidInitOpcode => unreachable, | 2094 | error.InvalidInitOpcode => unreachable, |
| 2095 | }; | 2095 | }; |
| ... | @@ -2106,7 +2106,7 @@ pub const FunctionType = extern struct { | ... | @@ -2106,7 +2106,7 @@ pub const FunctionType = extern struct { |
| 2106 | _, | 2106 | _, |
| 2107 | 2107 | ||
| 2108 | pub fn ptr(i: Index, wasm: *const Wasm) *FunctionType { | 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 | pub fn fmt(i: Index, wasm: *const Wasm) Formatter { | 2112 | pub fn fmt(i: Index, wasm: *const Wasm) Formatter { |
| ... | @@ -2197,7 +2197,7 @@ pub const String = enum(u32) { | ... | @@ -2197,7 +2197,7 @@ pub const String = enum(u32) { |
| 2197 | } | 2197 | } |
| 2198 | 2198 | ||
| 2199 | pub fn hash(ctx: @This(), key: String) u64 { | 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,7 +2205,7 @@ pub const String = enum(u32) { |
| 2205 | bytes: []const u8, | 2205 | bytes: []const u8, |
| 2206 | 2206 | ||
| 2207 | pub fn eql(ctx: @This(), a: []const u8, b: String) bool { | 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 | pub fn hash(_: @This(), adapted_key: []const u8) u64 { | 2211 | pub fn hash(_: @This(), adapted_key: []const u8) u64 { |
| ... | @@ -2215,12 +2215,12 @@ pub const String = enum(u32) { | ... | @@ -2215,12 +2215,12 @@ pub const String = enum(u32) { |
| 2215 | }; | 2215 | }; |
| 2216 | 2216 | ||
| 2217 | pub fn slice(index: String, wasm: *const Wasm) [:0]const u8 { | 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 | return start_slice[0..mem.indexOfScalar(u8, start_slice, 0).? :0]; | 2219 | return start_slice[0..mem.indexOfScalar(u8, start_slice, 0).? :0]; |
| 2220 | } | 2220 | } |
| 2221 | 2221 | ||
| 2222 | pub fn toOptional(i: String) OptionalString { | 2222 | pub fn toOptional(i: String) OptionalString { |
| 2223 | const result: OptionalString = @enumFromInt(@intFromEnum(i)); | 2223 | const result: OptionalString = @fromBackingInt(@intCast(@backingInt(i))); |
| 2224 | assert(result != .none); | 2224 | assert(result != .none); |
| 2225 | return result; | 2225 | return result; |
| 2226 | } | 2226 | } |
| ... | @@ -2232,7 +2232,7 @@ pub const OptionalString = enum(u32) { | ... | @@ -2232,7 +2232,7 @@ pub const OptionalString = enum(u32) { |
| 2232 | 2232 | ||
| 2233 | pub fn unwrap(i: OptionalString) ?String { | 2233 | pub fn unwrap(i: OptionalString) ?String { |
| 2234 | if (i == .none) return null; | 2234 | if (i == .none) return null; |
| 2235 | return @enumFromInt(@intFromEnum(i)); | 2235 | return @fromBackingInt(@intCast(@backingInt(i))); |
| 2236 | } | 2236 | } |
| 2237 | 2237 | ||
| 2238 | pub fn slice(index: OptionalString, wasm: *const Wasm) ?[:0]const u8 { | 2238 | pub fn slice(index: OptionalString, wasm: *const Wasm) ?[:0]const u8 { |
| ... | @@ -2246,11 +2246,11 @@ pub const ValtypeList = enum(u32) { | ... | @@ -2246,11 +2246,11 @@ pub const ValtypeList = enum(u32) { |
| 2246 | _, | 2246 | _, |
| 2247 | 2247 | ||
| 2248 | pub fn fromString(s: String) ValtypeList { | 2248 | pub fn fromString(s: String) ValtypeList { |
| 2249 | return @enumFromInt(@intFromEnum(s)); | 2249 | return @fromBackingInt(@intCast(@backingInt(s))); |
| 2250 | } | 2250 | } |
| 2251 | 2251 | ||
| 2252 | pub fn slice(index: ValtypeList, wasm: *const Wasm) []const std.wasm.Valtype { | 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,7 +2259,7 @@ pub const ZcuImportIndex = enum(u32) { |
| 2259 | _, | 2259 | _, |
| 2260 | 2260 | ||
| 2261 | pub fn ptr(index: ZcuImportIndex, wasm: *const Wasm) *InternPool.Nav.Index { | 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 | pub fn importName(index: ZcuImportIndex, wasm: *const Wasm) String { | 2265 | pub fn importName(index: ZcuImportIndex, wasm: *const Wasm) String { |
| ... | @@ -2310,16 +2310,16 @@ pub const FunctionImportId = enum(u32) { | ... | @@ -2310,16 +2310,16 @@ pub const FunctionImportId = enum(u32) { |
| 2310 | 2310 | ||
| 2311 | pub fn pack(unpacked: Unpacked, wasm: *const Wasm) FunctionImportId { | 2311 | pub fn pack(unpacked: Unpacked, wasm: *const Wasm) FunctionImportId { |
| 2312 | return switch (unpacked) { | 2312 | return switch (unpacked) { |
| 2313 | .object_function_import => |i| @enumFromInt(@intFromEnum(i)), | 2313 | .object_function_import => |i| @fromBackingInt(@intCast(@backingInt(i))), |
| 2314 | .zcu_import => |i| @enumFromInt(@intFromEnum(i) + wasm.object_function_imports.entries.len), | 2314 | .zcu_import => |i| @fromBackingInt(@intCast(@backingInt(i) + wasm.object_function_imports.entries.len)), |
| 2315 | }; | 2315 | }; |
| 2316 | } | 2316 | } |
| 2317 | 2317 | ||
| 2318 | pub fn unpack(id: FunctionImportId, wasm: *const Wasm) Unpacked { | 2318 | pub fn unpack(id: FunctionImportId, wasm: *const Wasm) Unpacked { |
| 2319 | const i = @intFromEnum(id); | 2319 | const i = @backingInt(id); |
| 2320 | if (i < wasm.object_function_imports.entries.len) return .{ .object_function_import = @enumFromInt(i) }; | 2320 | if (i < wasm.object_function_imports.entries.len) return .{ .object_function_import = @fromBackingInt(@intCast(i)) }; |
| 2321 | const zcu_import_i = i - wasm.object_function_imports.entries.len; | 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 | pub fn fromObject(function_import_index: FunctionImport.Index, wasm: *const Wasm) FunctionImportId { | 2325 | pub fn fromObject(function_import_index: FunctionImport.Index, wasm: *const Wasm) FunctionImportId { |
| ... | @@ -2337,10 +2337,10 @@ pub const FunctionImportId = enum(u32) { | ... | @@ -2337,10 +2337,10 @@ pub const FunctionImportId = enum(u32) { |
| 2337 | .object_function_import => |obj_func_index| { | 2337 | .object_function_import => |obj_func_index| { |
| 2338 | // TODO binary search | 2338 | // TODO binary search |
| 2339 | for (wasm.objects.items, 0..) |o, i| { | 2339 | for (wasm.objects.items, 0..) |o, i| { |
| 2340 | if (o.function_imports.off <= @intFromEnum(obj_func_index) and | 2340 | if (o.function_imports.off <= @backingInt(obj_func_index) and |
| 2341 | o.function_imports.off + o.function_imports.len > @intFromEnum(obj_func_index)) | 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 | } else unreachable; | 2345 | } else unreachable; |
| 2346 | }, | 2346 | }, |
| ... | @@ -2397,16 +2397,16 @@ pub const GlobalImportId = enum(u32) { | ... | @@ -2397,16 +2397,16 @@ pub const GlobalImportId = enum(u32) { |
| 2397 | 2397 | ||
| 2398 | pub fn pack(unpacked: Unpacked, wasm: *const Wasm) GlobalImportId { | 2398 | pub fn pack(unpacked: Unpacked, wasm: *const Wasm) GlobalImportId { |
| 2399 | return switch (unpacked) { | 2399 | return switch (unpacked) { |
| 2400 | .object_global_import => |i| @enumFromInt(@intFromEnum(i)), | 2400 | .object_global_import => |i| @fromBackingInt(@intCast(@backingInt(i))), |
| 2401 | .zcu_import => |i| @enumFromInt(@intFromEnum(i) + wasm.object_global_imports.entries.len), | 2401 | .zcu_import => |i| @fromBackingInt(@intCast(@backingInt(i) + wasm.object_global_imports.entries.len)), |
| 2402 | }; | 2402 | }; |
| 2403 | } | 2403 | } |
| 2404 | 2404 | ||
| 2405 | pub fn unpack(id: GlobalImportId, wasm: *const Wasm) Unpacked { | 2405 | pub fn unpack(id: GlobalImportId, wasm: *const Wasm) Unpacked { |
| 2406 | const i = @intFromEnum(id); | 2406 | const i = @backingInt(id); |
| 2407 | if (i < wasm.object_global_imports.entries.len) return .{ .object_global_import = @enumFromInt(i) }; | 2407 | if (i < wasm.object_global_imports.entries.len) return .{ .object_global_import = @fromBackingInt(@intCast(i)) }; |
| 2408 | const zcu_import_i = i - wasm.object_global_imports.entries.len; | 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 | pub fn fromObject(object_global_import: GlobalImport.Index, wasm: *const Wasm) GlobalImportId { | 2412 | pub fn fromObject(object_global_import: GlobalImport.Index, wasm: *const Wasm) GlobalImportId { |
| ... | @@ -2420,10 +2420,10 @@ pub const GlobalImportId = enum(u32) { | ... | @@ -2420,10 +2420,10 @@ pub const GlobalImportId = enum(u32) { |
| 2420 | .object_global_import => |obj_global_index| { | 2420 | .object_global_import => |obj_global_index| { |
| 2421 | // TODO binary search | 2421 | // TODO binary search |
| 2422 | for (wasm.objects.items, 0..) |o, i| { | 2422 | for (wasm.objects.items, 0..) |o, i| { |
| 2423 | if (o.global_imports.off <= @intFromEnum(obj_global_index) and | 2423 | if (o.global_imports.off <= @backingInt(obj_global_index) and |
| 2424 | o.global_imports.off + o.global_imports.len > @intFromEnum(obj_global_index)) | 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 | } else unreachable; | 2428 | } else unreachable; |
| 2429 | }, | 2429 | }, |
| ... | @@ -2462,16 +2462,16 @@ pub const DataImportId = enum(u32) { | ... | @@ -2462,16 +2462,16 @@ pub const DataImportId = enum(u32) { |
| 2462 | 2462 | ||
| 2463 | pub fn pack(unpacked: Unpacked, wasm: *const Wasm) DataImportId { | 2463 | pub fn pack(unpacked: Unpacked, wasm: *const Wasm) DataImportId { |
| 2464 | return switch (unpacked) { | 2464 | return switch (unpacked) { |
| 2465 | .object_data_import => |i| @enumFromInt(@intFromEnum(i)), | 2465 | .object_data_import => |i| @fromBackingInt(@intCast(@backingInt(i))), |
| 2466 | .zcu_import => |i| @enumFromInt(@intFromEnum(i) + wasm.object_data_imports.entries.len), | 2466 | .zcu_import => |i| @fromBackingInt(@intCast(@backingInt(i) + wasm.object_data_imports.entries.len)), |
| 2467 | }; | 2467 | }; |
| 2468 | } | 2468 | } |
| 2469 | 2469 | ||
| 2470 | pub fn unpack(id: DataImportId, wasm: *const Wasm) Unpacked { | 2470 | pub fn unpack(id: DataImportId, wasm: *const Wasm) Unpacked { |
| 2471 | const i = @intFromEnum(id); | 2471 | const i = @backingInt(id); |
| 2472 | if (i < wasm.object_data_imports.entries.len) return .{ .object_data_import = @enumFromInt(i) }; | 2472 | if (i < wasm.object_data_imports.entries.len) return .{ .object_data_import = @fromBackingInt(@intCast(i)) }; |
| 2473 | const zcu_import_i = i - wasm.object_data_imports.entries.len; | 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 | pub fn fromZcuImport(zcu_import: ZcuImportIndex, wasm: *const Wasm) DataImportId { | 2477 | pub fn fromZcuImport(zcu_import: ZcuImportIndex, wasm: *const Wasm) DataImportId { |
| ... | @@ -2487,10 +2487,10 @@ pub const DataImportId = enum(u32) { | ... | @@ -2487,10 +2487,10 @@ pub const DataImportId = enum(u32) { |
| 2487 | .object_data_import => |obj_data_index| { | 2487 | .object_data_import => |obj_data_index| { |
| 2488 | // TODO binary search | 2488 | // TODO binary search |
| 2489 | for (wasm.objects.items, 0..) |o, i| { | 2489 | for (wasm.objects.items, 0..) |o, i| { |
| 2490 | if (o.data_imports.off <= @intFromEnum(obj_data_index) and | 2490 | if (o.data_imports.off <= @backingInt(obj_data_index) and |
| 2491 | o.data_imports.off + o.data_imports.len > @intFromEnum(obj_data_index)) | 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 | } else unreachable; | 2495 | } else unreachable; |
| 2496 | }, | 2496 | }, |
| ... | @@ -2504,7 +2504,7 @@ pub const SymbolTableIndex = enum(u32) { | ... | @@ -2504,7 +2504,7 @@ pub const SymbolTableIndex = enum(u32) { |
| 2504 | _, | 2504 | _, |
| 2505 | 2505 | ||
| 2506 | pub fn key(i: @This(), wasm: *const Wasm) *String { | 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,7 +2755,7 @@ pub const InitFunc = extern struct { |
| 2755 | pub fn lessThan(ctx: void, lhs: InitFunc, rhs: InitFunc) bool { | 2755 | pub fn lessThan(ctx: void, lhs: InitFunc, rhs: InitFunc) bool { |
| 2756 | _ = ctx; | 2756 | _ = ctx; |
| 2757 | if (lhs.priority == rhs.priority) { | 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 | } else { | 2759 | } else { |
| 2760 | return lhs.priority < rhs.priority; | 2760 | return lhs.priority < rhs.priority; |
| 2761 | } | 2761 | } |
| ... | @@ -2805,11 +2805,11 @@ pub const Feature = packed struct(u8) { | ... | @@ -2805,11 +2805,11 @@ pub const Feature = packed struct(u8) { |
| 2805 | _, | 2805 | _, |
| 2806 | 2806 | ||
| 2807 | pub fn fromString(s: String) Set { | 2807 | pub fn fromString(s: String) Set { |
| 2808 | return @enumFromInt(@intFromEnum(s)); | 2808 | return @fromBackingInt(@intCast(@backingInt(s))); |
| 2809 | } | 2809 | } |
| 2810 | 2810 | ||
| 2811 | pub fn string(s: Set) String { | 2811 | pub fn string(s: Set) String { |
| 2812 | return @enumFromInt(@intFromEnum(s)); | 2812 | return @fromBackingInt(@intCast(@backingInt(s))); |
| 2813 | } | 2813 | } |
| 2814 | 2814 | ||
| 2815 | pub fn slice(s: Set, wasm: *const Wasm) [:sentinel]const Feature { | 2815 | pub fn slice(s: Set, wasm: *const Wasm) [:sentinel]const Feature { |
| ... | @@ -3246,7 +3246,7 @@ pub fn updateFunc( | ... | @@ -3246,7 +3246,7 @@ pub fn updateFunc( |
| 3246 | .locals_len = @intCast(mir.locals.len), | 3246 | .locals_len = @intCast(mir.locals.len), |
| 3247 | .prologue = mir.prologue, | 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 | // Generate code for the "Nav", storing it in memory to be later written to | 3252 | // Generate code for the "Nav", storing it in memory to be later written to |
| ... | @@ -3335,7 +3335,7 @@ pub fn deleteExport( | ... | @@ -3335,7 +3335,7 @@ pub fn deleteExport( |
| 3335 | const export_name = wasm.getExistingString(name_slice).?; | 3335 | const export_name = wasm.getExistingString(name_slice).?; |
| 3336 | switch (exported) { | 3336 | switch (exported) { |
| 3337 | .nav => |nav_index| { | 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 | assert(wasm.nav_exports.swapRemove(.{ .nav_index = nav_index, .name = export_name })); | 3339 | assert(wasm.nav_exports.swapRemove(.{ .nav_index = nav_index, .name = export_name })); |
| 3340 | }, | 3340 | }, |
| 3341 | .uav => |uav_index| assert(wasm.uav_exports.swapRemove(.{ .uav_index = uav_index, .name = export_name })), | 3341 | .uav => |uav_index| assert(wasm.uav_exports.swapRemove(.{ .uav_index = uav_index, .name = export_name })), |
| ... | @@ -3357,7 +3357,7 @@ pub fn updateExports( | ... | @@ -3357,7 +3357,7 @@ pub fn updateExports( |
| 3357 | const name = try wasm.internString(name_slice); | 3357 | const name = try wasm.internString(name_slice); |
| 3358 | switch (exported) { | 3358 | switch (exported) { |
| 3359 | .nav => |nav_index| { | 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 | try wasm.nav_exports.put(gpa, .{ .nav_index = nav_index, .name = name }, export_idx); | 3361 | try wasm.nav_exports.put(gpa, .{ .nav_index = nav_index, .name = name }, export_idx); |
| 3362 | }, | 3362 | }, |
| 3363 | .uav => |uav_index| try wasm.uav_exports.put(gpa, .{ .uav_index = uav_index, .name = name }, export_idx), | 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,7 +3446,7 @@ pub fn prelink(wasm: *Wasm, prog_node: std.Progress.Node) link.Error!void { |
| 3446 | @panic("TODO"); | 3446 | @panic("TODO"); |
| 3447 | } else { | 3447 | } else { |
| 3448 | try wasm.globals.put(gpa, .__stack_pointer, {}); | 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,7 +3454,7 @@ pub fn prelink(wasm: *Wasm, prog_node: std.Progress.Node) link.Error!void { |
| 3454 | // At the end, output functions and globals will be populated. | 3454 | // At the end, output functions and globals will be populated. |
| 3455 | for (wasm.object_function_imports.keys(), wasm.object_function_imports.values(), 0..) |name, *import, i| { | 3455 | for (wasm.object_function_imports.keys(), wasm.object_function_imports.values(), 0..) |name, *import, i| { |
| 3456 | if (import.flags.isIncluded(rdynamic)) { | 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 | // Also treat init functions as roots. | 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,7 +3468,7 @@ pub fn prelink(wasm: *Wasm, prog_node: std.Progress.Node) link.Error!void { |
| 3468 | 3468 | ||
| 3469 | for (wasm.object_global_imports.keys(), wasm.object_global_imports.values(), 0..) |name, *import, i| { | 3469 | for (wasm.object_global_imports.keys(), wasm.object_global_imports.values(), 0..) |name, *import, i| { |
| 3470 | if (import.flags.isIncluded(rdynamic)) { | 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 | wasm.globals_end_prelink = @intCast(wasm.globals.entries.len); | 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,13 +3476,13 @@ pub fn prelink(wasm: *Wasm, prog_node: std.Progress.Node) link.Error!void { |
| 3476 | 3476 | ||
| 3477 | for (wasm.object_table_imports.keys(), wasm.object_table_imports.values(), 0..) |name, *import, i| { | 3477 | for (wasm.object_table_imports.keys(), wasm.object_table_imports.values(), 0..) |name, *import, i| { |
| 3478 | if (import.flags.isIncluded(rdynamic)) { | 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 | for (wasm.object_data_imports.keys(), wasm.object_data_imports.values(), 0..) |name, *import, i| { | 3483 | for (wasm.object_data_imports.keys(), wasm.object_data_imports.values(), 0..) |name, *import, i| { |
| 3484 | if (import.flags.isIncluded(rdynamic)) { | 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,9 +3548,9 @@ fn markFunction(wasm: *Wasm, i: ObjectFunctionIndex, override_export: bool) link |
| 3548 | if (!is_obj and (override_export or function.flags.isExported(rdynamic))) { | 3548 | if (!is_obj and (override_export or function.flags.isExported(rdynamic))) { |
| 3549 | const symbol_name = function.name.unwrap().?; | 3549 | const symbol_name = function.name.unwrap().?; |
| 3550 | if (!override_export and function.flags.visibility_hidden) { | 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 | } else { | 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,7 +3619,7 @@ fn markGlobal(wasm: *Wasm, i: ObjectGlobalIndex, override_export: bool) link.Err |
| 3619 | 3619 | ||
| 3620 | if (!is_obj and (override_export or global.flags.isExported(rdynamic))) try wasm.global_exports.append(gpa, .{ | 3620 | if (!is_obj and (override_export or global.flags.isExported(rdynamic))) try wasm.global_exports.append(gpa, .{ |
| 3621 | .name = global.name.unwrap().?, | 3621 | .name = global.name.unwrap().?, |
| 3622 | .global_index = @enumFromInt(gop.index), | 3622 | .global_index = @fromBackingInt(@intCast(gop.index)), |
| 3623 | }); | 3623 | }); |
| 3624 | 3624 | ||
| 3625 | try wasm.markRelocations(global.relocations(wasm)); | 3625 | try wasm.markRelocations(global.relocations(wasm)); |
| ... | @@ -3703,7 +3703,7 @@ fn markRelocations(wasm: *Wasm, relocs: ObjectRelocation.IterableSlice) link.Err | ... | @@ -3703,7 +3703,7 @@ fn markRelocations(wasm: *Wasm, relocs: ObjectRelocation.IterableSlice) link.Err |
| 3703 | .function_import_offset_i64, | 3703 | .function_import_offset_i64, |
| 3704 | => { | 3704 | => { |
| 3705 | const name = pointee.symbol_name; | 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 | try markFunctionImport(wasm, name, i.value(wasm), i); | 3707 | try markFunctionImport(wasm, name, i.value(wasm), i); |
| 3708 | }, | 3708 | }, |
| 3709 | .table_import_index_sleb, | 3709 | .table_import_index_sleb, |
| ... | @@ -3715,17 +3715,17 @@ fn markRelocations(wasm: *Wasm, relocs: ObjectRelocation.IterableSlice) link.Err | ... | @@ -3715,17 +3715,17 @@ fn markRelocations(wasm: *Wasm, relocs: ObjectRelocation.IterableSlice) link.Err |
| 3715 | => { | 3715 | => { |
| 3716 | const name = pointee.symbol_name; | 3716 | const name = pointee.symbol_name; |
| 3717 | try wasm.object_indirect_function_import_set.put(gpa, name, {}); | 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 | try markFunctionImport(wasm, name, i.value(wasm), i); | 3719 | try markFunctionImport(wasm, name, i.value(wasm), i); |
| 3720 | }, | 3720 | }, |
| 3721 | .global_import_index_leb, .global_import_index_i32 => { | 3721 | .global_import_index_leb, .global_import_index_i32 => { |
| 3722 | const name = pointee.symbol_name; | 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 | try markGlobalImport(wasm, name, i.value(wasm), i); | 3724 | try markGlobalImport(wasm, name, i.value(wasm), i); |
| 3725 | }, | 3725 | }, |
| 3726 | .table_import_number_leb => { | 3726 | .table_import_number_leb => { |
| 3727 | const name = pointee.symbol_name; | 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 | try markTableImport(wasm, name, i.value(wasm), i); | 3729 | try markTableImport(wasm, name, i.value(wasm), i); |
| 3730 | }, | 3730 | }, |
| 3731 | .memory_addr_import_leb, | 3731 | .memory_addr_import_leb, |
| ... | @@ -3871,7 +3871,7 @@ pub fn internString(wasm: *Wasm, bytes: []const u8) Allocator.Error!String { | ... | @@ -3871,7 +3871,7 @@ pub fn internString(wasm: *Wasm, bytes: []const u8) Allocator.Error!String { |
| 3871 | if (gop.found_existing) return gop.key_ptr.*; | 3871 | if (gop.found_existing) return gop.key_ptr.*; |
| 3872 | 3872 | ||
| 3873 | try wasm.string_bytes.ensureUnusedCapacity(gpa, bytes.len + 1); | 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 | wasm.string_bytes.appendSliceAssumeCapacity(bytes); | 3876 | wasm.string_bytes.appendSliceAssumeCapacity(bytes); |
| 3877 | wasm.string_bytes.appendAssumeCapacity(0); | 3877 | wasm.string_bytes.appendAssumeCapacity(0); |
| ... | @@ -3906,12 +3906,12 @@ pub fn getExistingValtypeList(wasm: *const Wasm, valtype_list: []const std.wasm. | ... | @@ -3906,12 +3906,12 @@ pub fn getExistingValtypeList(wasm: *const Wasm, valtype_list: []const std.wasm. |
| 3906 | pub fn addFuncType(wasm: *Wasm, ft: FunctionType) Allocator.Error!FunctionType.Index { | 3906 | pub fn addFuncType(wasm: *Wasm, ft: FunctionType) Allocator.Error!FunctionType.Index { |
| 3907 | const gpa = wasm.base.comp.gpa; | 3907 | const gpa = wasm.base.comp.gpa; |
| 3908 | const gop = try wasm.func_types.getOrPut(gpa, ft); | 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 | pub fn getExistingFuncType(wasm: *const Wasm, ft: FunctionType) ?FunctionType.Index { | 3912 | pub fn getExistingFuncType(wasm: *const Wasm, ft: FunctionType) ?FunctionType.Index { |
| 3913 | const index = wasm.func_types.getIndex(ft) orelse return null; | 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 | pub fn getExistingFuncType2(wasm: *const Wasm, params: []const std.wasm.Valtype, returns: []const std.wasm.Valtype) FunctionType.Index { | 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,14 +3960,14 @@ pub fn addExpr(wasm: *Wasm, bytes: []const u8) Allocator.Error!Expr { |
| 3960 | // it is likely for globals to share initialization values. Then again | 3960 | // it is likely for globals to share initialization values. Then again |
| 3961 | // there may not be very many globals in total. | 3961 | // there may not be very many globals in total. |
| 3962 | try wasm.string_bytes.appendSlice(gpa, bytes); | 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 | pub fn addRelocatableDataPayload(wasm: *Wasm, bytes: []const u8) Allocator.Error!DataPayload { | 3966 | pub fn addRelocatableDataPayload(wasm: *Wasm, bytes: []const u8) Allocator.Error!DataPayload { |
| 3967 | const gpa = wasm.base.comp.gpa; | 3967 | const gpa = wasm.base.comp.gpa; |
| 3968 | try wasm.string_bytes.appendSlice(gpa, bytes); | 3968 | try wasm.string_bytes.appendSlice(gpa, bytes); |
| 3969 | return .{ | 3969 | return .{ |
| 3970 | .off = @enumFromInt(wasm.string_bytes.items.len - bytes.len), | 3970 | .off = @fromBackingInt(@intCast(wasm.string_bytes.items.len - bytes.len)), |
| 3971 | .len = @intCast(bytes.len), | 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,10 +3976,10 @@ pub fn uavSymbolIndex(wasm: *Wasm, ip_index: InternPool.Index) Allocator.Error!S |
| 3976 | const comp = wasm.base.comp; | 3976 | const comp = wasm.base.comp; |
| 3977 | assert(comp.config.output_mode == .Obj); | 3977 | assert(comp.config.output_mode == .Obj); |
| 3978 | const gpa = comp.gpa; | 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 | const gop = try wasm.symbol_table.getOrPut(gpa, name); | 3980 | const gop = try wasm.symbol_table.getOrPut(gpa, name); |
| 3981 | gop.value_ptr.* = {}; | 3981 | gop.value_ptr.* = {}; |
| 3982 | return @enumFromInt(gop.index); | 3982 | return @fromBackingInt(@intCast(gop.index)); |
| 3983 | } | 3983 | } |
| 3984 | 3984 | ||
| 3985 | pub fn navSymbolIndex(wasm: *Wasm, nav_index: InternPool.Nav.Index) Allocator.Error!SymbolTableIndex { | 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,7 +3992,7 @@ pub fn navSymbolIndex(wasm: *Wasm, nav_index: InternPool.Nav.Index) Allocator.Er |
| 3992 | const name = try wasm.internString(nav.fqn.toSlice(ip)); | 3992 | const name = try wasm.internString(nav.fqn.toSlice(ip)); |
| 3993 | const gop = try wasm.symbol_table.getOrPut(gpa, name); | 3993 | const gop = try wasm.symbol_table.getOrPut(gpa, name); |
| 3994 | gop.value_ptr.* = {}; | 3994 | gop.value_ptr.* = {}; |
| 3995 | return @enumFromInt(gop.index); | 3995 | return @fromBackingInt(@intCast(gop.index)); |
| 3996 | } | 3996 | } |
| 3997 | 3997 | ||
| 3998 | pub fn errorNameTableSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { | 3998 | pub fn errorNameTableSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { |
| ... | @@ -4001,7 +4001,7 @@ pub fn errorNameTableSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { | ... | @@ -4001,7 +4001,7 @@ pub fn errorNameTableSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { |
| 4001 | const gpa = comp.gpa; | 4001 | const gpa = comp.gpa; |
| 4002 | const gop = try wasm.symbol_table.getOrPut(gpa, wasm.preloaded_strings.__zig_error_name_table); | 4002 | const gop = try wasm.symbol_table.getOrPut(gpa, wasm.preloaded_strings.__zig_error_name_table); |
| 4003 | gop.value_ptr.* = {}; | 4003 | gop.value_ptr.* = {}; |
| 4004 | return @enumFromInt(gop.index); | 4004 | return @fromBackingInt(@intCast(gop.index)); |
| 4005 | } | 4005 | } |
| 4006 | 4006 | ||
| 4007 | pub fn stackPointerSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { | 4007 | pub fn stackPointerSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { |
| ... | @@ -4010,7 +4010,7 @@ pub fn stackPointerSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { | ... | @@ -4010,7 +4010,7 @@ pub fn stackPointerSymbolIndex(wasm: *Wasm) Allocator.Error!SymbolTableIndex { |
| 4010 | const gpa = comp.gpa; | 4010 | const gpa = comp.gpa; |
| 4011 | const gop = try wasm.symbol_table.getOrPut(gpa, wasm.preloaded_strings.__stack_pointer); | 4011 | const gop = try wasm.symbol_table.getOrPut(gpa, wasm.preloaded_strings.__stack_pointer); |
| 4012 | gop.value_ptr.* = {}; | 4012 | gop.value_ptr.* = {}; |
| 4013 | return @enumFromInt(gop.index); | 4013 | return @fromBackingInt(@intCast(gop.index)); |
| 4014 | } | 4014 | } |
| 4015 | 4015 | ||
| 4016 | pub fn tagTableIndexSymbolIndex(wasm: *Wasm, ip_index: InternPool.Index) Allocator.Error!SymbolTableIndex { | 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,7 +4020,7 @@ pub fn tagTableIndexSymbolIndex(wasm: *Wasm, ip_index: InternPool.Index) Allocat |
| 4020 | const name = try wasm.internStringFmt("__zig_tag_name_{d}", .{ip_index}); | 4020 | const name = try wasm.internStringFmt("__zig_tag_name_{d}", .{ip_index}); |
| 4021 | const gop = try wasm.symbol_table.getOrPut(gpa, name); | 4021 | const gop = try wasm.symbol_table.getOrPut(gpa, name); |
| 4022 | gop.value_ptr.* = {}; | 4022 | gop.value_ptr.* = {}; |
| 4023 | return @enumFromInt(gop.index); | 4023 | return @fromBackingInt(@intCast(gop.index)); |
| 4024 | } | 4024 | } |
| 4025 | 4025 | ||
| 4026 | pub fn symbolNameIndex(wasm: *Wasm, name: String) Allocator.Error!SymbolTableIndex { | 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,7 +4029,7 @@ pub fn symbolNameIndex(wasm: *Wasm, name: String) Allocator.Error!SymbolTableInd |
| 4029 | const gpa = comp.gpa; | 4029 | const gpa = comp.gpa; |
| 4030 | const gop = try wasm.symbol_table.getOrPut(gpa, name); | 4030 | const gop = try wasm.symbol_table.getOrPut(gpa, name); |
| 4031 | gop.value_ptr.* = {}; | 4031 | gop.value_ptr.* = {}; |
| 4032 | return @enumFromInt(gop.index); | 4032 | return @fromBackingInt(@intCast(gop.index)); |
| 4033 | } | 4033 | } |
| 4034 | 4034 | ||
| 4035 | pub fn addUavReloc( | 4035 | pub fn addUavReloc( |
| ... | @@ -4075,7 +4075,7 @@ pub fn addUavReloc( | ... | @@ -4075,7 +4075,7 @@ pub fn addUavReloc( |
| 4075 | }; | 4075 | }; |
| 4076 | gop.value_ptr.count += 1; | 4076 | gop.value_ptr.count += 1; |
| 4077 | try wasm.uav_fixups.append(gpa, .{ | 4077 | try wasm.uav_fixups.append(gpa, .{ |
| 4078 | .uavs_exe_index = @enumFromInt(gop.index), | 4078 | .uavs_exe_index = @fromBackingInt(@intCast(gop.index)), |
| 4079 | .offset = @intCast(reloc_offset), | 4079 | .offset = @intCast(reloc_offset), |
| 4080 | .addend = addend, | 4080 | .addend = addend, |
| 4081 | }); | 4081 | }); |
| ... | @@ -4092,7 +4092,7 @@ pub fn refNavObj(wasm: *Wasm, nav_index: InternPool.Nav.Index) !NavsObjIndex { | ... | @@ -4092,7 +4092,7 @@ pub fn refNavObj(wasm: *Wasm, nav_index: InternPool.Nav.Index) !NavsObjIndex { |
| 4092 | .code = undefined, | 4092 | .code = undefined, |
| 4093 | .relocs = undefined, | 4093 | .relocs = undefined, |
| 4094 | }; | 4094 | }; |
| 4095 | return @enumFromInt(gop.index); | 4095 | return @fromBackingInt(@intCast(gop.index)); |
| 4096 | } | 4096 | } |
| 4097 | 4097 | ||
| 4098 | pub fn refNavExe(wasm: *Wasm, nav_index: InternPool.Nav.Index) !NavsExeIndex { | 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,7 +4109,7 @@ pub fn refNavExe(wasm: *Wasm, nav_index: InternPool.Nav.Index) !NavsExeIndex { |
| 4109 | .count = 0, | 4109 | .count = 0, |
| 4110 | }; | 4110 | }; |
| 4111 | } | 4111 | } |
| 4112 | return @enumFromInt(gop.index); | 4112 | return @fromBackingInt(@intCast(gop.index)); |
| 4113 | } | 4113 | } |
| 4114 | 4114 | ||
| 4115 | /// Asserts it is called after `Flush.data_segments` is fully populated and sorted. | 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,7 +4117,7 @@ pub fn uavAddr(wasm: *Wasm, ip_index: InternPool.Index) u32 { |
| 4117 | assert(wasm.flush_buffer.memory_layout_finished); | 4117 | assert(wasm.flush_buffer.memory_layout_finished); |
| 4118 | const comp = wasm.base.comp; | 4118 | const comp = wasm.base.comp; |
| 4119 | assert(comp.config.output_mode != .Obj); | 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 | const ds_id: DataSegmentId = .pack(wasm, .{ .uav_exe = uav_index }); | 4121 | const ds_id: DataSegmentId = .pack(wasm, .{ .uav_exe = uav_index }); |
| 4122 | return wasm.flush_buffer.data_segments.get(ds_id).?; | 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,7 +4128,7 @@ pub fn navAddr(wasm: *Wasm, nav_index: InternPool.Nav.Index) u32 { |
| 4128 | const comp = wasm.base.comp; | 4128 | const comp = wasm.base.comp; |
| 4129 | assert(comp.config.output_mode != .Obj); | 4129 | assert(comp.config.output_mode != .Obj); |
| 4130 | if (wasm.navs_exe.getIndex(nav_index)) |i| { | 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 | log.debug("navAddr {s} {}", .{ navs_exe_index.name(wasm), nav_index }); | 4132 | log.debug("navAddr {s} {}", .{ navs_exe_index.name(wasm), nav_index }); |
| 4133 | const ds_id: DataSegmentId = .pack(wasm, .{ .nav_exe = navs_exe_index }); | 4133 | const ds_id: DataSegmentId = .pack(wasm, .{ .nav_exe = navs_exe_index }); |
| 4134 | return wasm.flush_buffer.data_segments.get(ds_id).?; | 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,7 +4279,7 @@ fn lowerZcuData(wasm: *Wasm, pt: Zcu.PerThread, ip_index: InternPool.Index) !Zcu |
| 4279 | wasm.string_bytes_lock.unlock(); | 4279 | wasm.string_bytes_lock.unlock(); |
| 4280 | 4280 | ||
| 4281 | const naive_code: DataPayload = .{ | 4281 | const naive_code: DataPayload = .{ |
| 4282 | .off = @enumFromInt(code_start), | 4282 | .off = @fromBackingInt(@intCast(code_start)), |
| 4283 | .len = code_len, | 4283 | .len = code_len, |
| 4284 | }; | 4284 | }; |
| 4285 | 4285 | ||
| ... | @@ -4329,7 +4329,7 @@ fn pointerSize(wasm: *const Wasm) u32 { | ... | @@ -4329,7 +4329,7 @@ fn pointerSize(wasm: *const Wasm) u32 { |
| 4329 | fn addZcuImportReserved(wasm: *Wasm, nav_index: InternPool.Nav.Index) ZcuImportIndex { | 4329 | fn addZcuImportReserved(wasm: *Wasm, nav_index: InternPool.Nav.Index) ZcuImportIndex { |
| 4330 | const gop = wasm.imports.getOrPutAssumeCapacity(nav_index); | 4330 | const gop = wasm.imports.getOrPutAssumeCapacity(nav_index); |
| 4331 | gop.value_ptr.* = {}; | 4331 | gop.value_ptr.* = {}; |
| 4332 | return @enumFromInt(gop.index); | 4332 | return @fromBackingInt(@intCast(gop.index)); |
| 4333 | } | 4333 | } |
| 4334 | 4334 | ||
| 4335 | fn resolveFunctionSynthetic( | 4335 | fn resolveFunctionSynthetic( |
src/link/Wasm/Flush.zig+131-131| ... | @@ -51,7 +51,7 @@ pub const FuncTypeIndex = enum(u32) { | ... | @@ -51,7 +51,7 @@ pub const FuncTypeIndex = enum(u32) { |
| 51 | _, | 51 | _, |
| 52 | 52 | ||
| 53 | pub fn fromTypeIndex(i: Wasm.FunctionType.Index, f: *const Flush) FuncTypeIndex { | 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,16 +68,16 @@ const IndirectFunctionTableIndex = enum(u32) { |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | fn fromOutputFunctionIndex(f: *const Flush, i: Wasm.OutputFunctionIndex) IndirectFunctionTableIndex { | 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 | fn fromZcuIndirectFunctionSetIndex(i: Wasm.ZcuIndirectFunctionSetIndex) IndirectFunctionTableIndex { | 74 | fn fromZcuIndirectFunctionSetIndex(i: Wasm.ZcuIndirectFunctionSetIndex) IndirectFunctionTableIndex { |
| 75 | // These are the same since those are added to the table first. | 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 | fn toAbi(i: IndirectFunctionTableIndex) u32 { | 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,11 +139,11 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 139 | for (wasm.mir_instructions.items(.tag), wasm.mir_instructions.items(.data)) |tag, *data| switch (tag) { | 139 | for (wasm.mir_instructions.items(.tag), wasm.mir_instructions.items(.data)) |tag, *data| switch (tag) { |
| 140 | .call_intrinsic => { | 140 | .call_intrinsic => { |
| 141 | const symbol_name = try wasm.internString(@tagName(data.intrinsic)); | 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 | return diags.fail("missing compiler runtime intrinsic '{t}' (undefined linker symbol)", .{ | 143 | return diags.fail("missing compiler runtime intrinsic '{t}' (undefined linker symbol)", .{ |
| 144 | data.intrinsic, | 144 | data.intrinsic, |
| 145 | }); | 145 | }); |
| 146 | }); | 146 | })); |
| 147 | try wasm.markFunctionImport(symbol_name, i.value(wasm), i); | 147 | try wasm.markFunctionImport(symbol_name, i.value(wasm), i); |
| 148 | log.debug("markFunctionImport intrinsic {d}={t}", .{ i, data.intrinsic }); | 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,7 +157,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 157 | .type_index = try wasm.internFunctionType(.auto, &.{int_tag_ty.ip_index}, .u32, false, target), | 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 | .enum_tag_name_table_ref => { | 162 | .enum_tag_name_table_ref => { |
| 163 | assert(ip.indexToKey(data.ip_index) == .enum_type); | 163 | assert(ip.indexToKey(data.ip_index) == .enum_type); |
| ... | @@ -181,7 +181,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -181,7 +181,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 181 | while (i < f.function_imports.entries.len) { | 181 | while (i < f.function_imports.entries.len) { |
| 182 | const symbol_name = f.function_imports.keys()[i]; | 182 | const symbol_name = f.function_imports.keys()[i]; |
| 183 | if (wasm.object_function_imports.getIndex(symbol_name)) |import_index_usize| { | 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 | try wasm.markFunctionImport(symbol_name, import_index.value(wasm), import_index); | 185 | try wasm.markFunctionImport(symbol_name, import_index.value(wasm), import_index); |
| 186 | f.function_imports.swapRemoveAt(i); | 186 | f.function_imports.swapRemoveAt(i); |
| 187 | continue; | 187 | continue; |
| ... | @@ -195,7 +195,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -195,7 +195,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 195 | while (i < f.data_imports.entries.len) { | 195 | while (i < f.data_imports.entries.len) { |
| 196 | const symbol_name = f.data_imports.keys()[i]; | 196 | const symbol_name = f.data_imports.keys()[i]; |
| 197 | if (wasm.object_data_imports.getIndex(symbol_name)) |import_index_usize| { | 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 | try wasm.markDataImport(symbol_name, import_index.value(wasm), import_index); | 199 | try wasm.markDataImport(symbol_name, import_index.value(wasm), import_index); |
| 200 | f.data_imports.swapRemoveAt(i); | 200 | f.data_imports.swapRemoveAt(i); |
| 201 | continue; | 201 | continue; |
| ... | @@ -313,16 +313,16 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -313,16 +313,16 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 313 | if (!is_obj) assert(wasm.uavs_obj.entries.len == 0); | 313 | if (!is_obj) assert(wasm.uavs_obj.entries.len == 0); |
| 314 | if (!is_obj) assert(wasm.navs_obj.entries.len == 0); | 314 | if (!is_obj) assert(wasm.navs_obj.entries.len == 0); |
| 315 | for (0..wasm.uavs_obj.entries.len) |uavs_index| f.data_segments.putAssumeCapacityNoClobber(.pack(wasm, .{ | 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 | }), @as(u32, undefined)); | 317 | }), @as(u32, undefined)); |
| 318 | for (0..wasm.navs_obj.entries.len) |navs_index| f.data_segments.putAssumeCapacityNoClobber(.pack(wasm, .{ | 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 | }), @as(u32, undefined)); | 320 | }), @as(u32, undefined)); |
| 321 | for (0..wasm.uavs_exe.entries.len) |uavs_index| f.data_segments.putAssumeCapacityNoClobber(.pack(wasm, .{ | 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 | }), @as(u32, undefined)); | 323 | }), @as(u32, undefined)); |
| 324 | for (0..wasm.navs_exe.entries.len) |navs_index| f.data_segments.putAssumeCapacityNoClobber(.pack(wasm, .{ | 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 | }), @as(u32, undefined)); | 326 | }), @as(u32, undefined)); |
| 327 | if (wasm.error_name_table_ref_count > 0) { | 327 | if (wasm.error_name_table_ref_count > 0) { |
| 328 | f.data_segments.putAssumeCapacity(.__zig_error_names, @as(u32, undefined)); | 328 | f.data_segments.putAssumeCapacity(.__zig_error_names, @as(u32, undefined)); |
| ... | @@ -371,8 +371,8 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -371,8 +371,8 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 371 | pub fn lessThan(ctx: @This(), lhs: usize, rhs: usize) bool { | 371 | pub fn lessThan(ctx: @This(), lhs: usize, rhs: usize) bool { |
| 372 | const lhs_segment = ctx.segments[lhs]; | 372 | const lhs_segment = ctx.segments[lhs]; |
| 373 | const rhs_segment = ctx.segments[rhs]; | 373 | const rhs_segment = ctx.segments[rhs]; |
| 374 | const lhs_category = @intFromEnum(lhs_segment.category(ctx.wasm)); | 374 | const lhs_category = @backingInt(lhs_segment.category(ctx.wasm)); |
| 375 | const rhs_category = @intFromEnum(rhs_segment.category(ctx.wasm)); | 375 | const rhs_category = @backingInt(rhs_segment.category(ctx.wasm)); |
| 376 | switch (std.math.order(lhs_category, rhs_category)) { | 376 | switch (std.math.order(lhs_category, rhs_category)) { |
| 377 | .lt => return true, | 377 | .lt => return true, |
| 378 | .gt => return false, | 378 | .gt => return false, |
| ... | @@ -404,7 +404,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -404,7 +404,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 404 | .gt => return false, | 404 | .gt => return false, |
| 405 | .eq => {}, | 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 | f.data_segments.sortUnstable(@as(Sort, .{ | 410 | f.data_segments.sortUnstable(@as(Sort, .{ |
| ... | @@ -486,7 +486,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -486,7 +486,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 486 | 486 | ||
| 487 | const size = segment_id.size(wasm); | 487 | const size = segment_id.size(wasm); |
| 488 | segment_vaddr.* = @intCast(start_addr); | 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 | memory_ptr = start_addr + size; | 490 | memory_ptr = start_addr + size; |
| 491 | } | 491 | } |
| 492 | if (category != .zero) try f.data_segment_groups.append(gpa, .{ | 492 | if (category != .zero) try f.data_segment_groups.append(gpa, .{ |
| ... | @@ -593,12 +593,12 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -593,12 +593,12 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 593 | const params = func_type.params.slice(wasm); | 593 | const params = func_type.params.slice(wasm); |
| 594 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(params.len))); | 594 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(params.len))); |
| 595 | for (params) |param_ty| { | 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 | const returns = func_type.returns.slice(wasm); | 598 | const returns = func_type.returns.slice(wasm); |
| 599 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(returns.len))); | 599 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(returns.len))); |
| 600 | for (returns) |ret_ty| { | 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 | replaceVecSectionHeader(binary_bytes, header_offset, .type, @intCast(f.func_types.entries.len)); | 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,9 +625,9 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 625 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); | 625 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 626 | try binary_bytes.appendSlice(gpa, name); | 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 | const type_index: FuncTypeIndex = .fromTypeIndex(id.functionType(wasm), f); | 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 | total_imports += f.function_imports.entries.len; | 632 | total_imports += f.function_imports.entries.len; |
| 633 | 633 | ||
| ... | @@ -641,8 +641,8 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -641,8 +641,8 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 641 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); | 641 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 642 | try binary_bytes.appendSlice(gpa, name); | 642 | try binary_bytes.appendSlice(gpa, name); |
| 643 | 643 | ||
| 644 | try binary_bytes.append(gpa, @intFromEnum(std.wasm.ExternalKind.table)); | 644 | try binary_bytes.append(gpa, @backingInt(std.wasm.ExternalKind.table)); |
| 645 | try appendLeb128(gpa, binary_bytes, @intFromEnum(@as(std.wasm.RefType, table_import.flags.ref_type.to()))); | 645 | try appendLeb128(gpa, binary_bytes, @backingInt(@as(std.wasm.RefType, table_import.flags.ref_type.to()))); |
| 646 | try emitLimits(gpa, binary_bytes, table_import.limits()); | 646 | try emitLimits(gpa, binary_bytes, table_import.limits()); |
| 647 | } | 647 | } |
| 648 | total_imports += wasm.table_imports.entries.len; | 648 | total_imports += wasm.table_imports.entries.len; |
| ... | @@ -670,9 +670,9 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -670,9 +670,9 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 670 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); | 670 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 671 | try binary_bytes.appendSlice(gpa, name); | 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 | const global_type = id.globalType(wasm); | 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 | try binary_bytes.append(gpa, @intFromBool(global_type.mutable)); | 676 | try binary_bytes.append(gpa, @intFromBool(global_type.mutable)); |
| 677 | } | 677 | } |
| 678 | total_imports += f.global_imports.entries.len; | 678 | total_imports += f.global_imports.entries.len; |
| ... | @@ -690,7 +690,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -690,7 +690,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 690 | const header_offset = try reserveVecSectionHeader(gpa, binary_bytes); | 690 | const header_offset = try reserveVecSectionHeader(gpa, binary_bytes); |
| 691 | for (wasm.functions.keys()) |function| { | 691 | for (wasm.functions.keys()) |function| { |
| 692 | const index: FuncTypeIndex = .fromTypeIndex(function.typeIndex(wasm), f); | 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 | replaceVecSectionHeader(binary_bytes, header_offset, .function, @intCast(wasm.functions.count())); | 696 | replaceVecSectionHeader(binary_bytes, header_offset, .function, @intCast(wasm.functions.count())); |
| ... | @@ -702,7 +702,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -702,7 +702,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 702 | const header_offset = try reserveVecSectionHeader(gpa, binary_bytes); | 702 | const header_offset = try reserveVecSectionHeader(gpa, binary_bytes); |
| 703 | 703 | ||
| 704 | for (wasm.tables.keys()) |table| { | 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 | try emitLimits(gpa, binary_bytes, table.limits(wasm)); | 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,7 +735,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 735 | .object_global => |i| { | 735 | .object_global => |i| { |
| 736 | const global = i.ptr(wasm); | 736 | const global = i.ptr(wasm); |
| 737 | try binary_bytes.appendSlice(gpa, &.{ | 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 | @intFromBool(global.flags.global_type.mutable), | 739 | @intFromBool(global.flags.global_type.mutable), |
| 740 | }); | 740 | }); |
| 741 | try emitExpr(wasm, binary_bytes, global.expr); | 741 | try emitExpr(wasm, binary_bytes, global.expr); |
| ... | @@ -758,9 +758,9 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -758,9 +758,9 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 758 | const name = exp_name.slice(wasm); | 758 | const name = exp_name.slice(wasm); |
| 759 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); | 759 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 760 | try binary_bytes.appendSlice(gpa, name); | 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 | const func_index = Wasm.OutputFunctionIndex.fromFunctionIndex(wasm, function_index); | 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 | exports_len += wasm.function_exports.entries.len; | 765 | exports_len += wasm.function_exports.entries.len; |
| 766 | 766 | ||
| ... | @@ -769,7 +769,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -769,7 +769,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 769 | const index: u32 = @intCast(wasm.tables.getIndex(.__indirect_function_table).?); | 769 | const index: u32 = @intCast(wasm.tables.getIndex(.__indirect_function_table).?); |
| 770 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); | 770 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 771 | try binary_bytes.appendSlice(gpa, name); | 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 | try appendLeb128(gpa, binary_bytes, index); | 773 | try appendLeb128(gpa, binary_bytes, index); |
| 774 | exports_len += 1; | 774 | exports_len += 1; |
| 775 | } | 775 | } |
| ... | @@ -778,7 +778,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -778,7 +778,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 778 | const name = "memory"; | 778 | const name = "memory"; |
| 779 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); | 779 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 780 | try binary_bytes.appendSlice(gpa, name); | 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 | try appendLeb128(gpa, binary_bytes, @as(u32, 0)); | 782 | try appendLeb128(gpa, binary_bytes, @as(u32, 0)); |
| 783 | exports_len += 1; | 783 | exports_len += 1; |
| 784 | } | 784 | } |
| ... | @@ -787,8 +787,8 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -787,8 +787,8 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 787 | const name = exp.name.slice(wasm); | 787 | const name = exp.name.slice(wasm); |
| 788 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); | 788 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 789 | try binary_bytes.appendSlice(gpa, name); | 789 | try binary_bytes.appendSlice(gpa, name); |
| 790 | try binary_bytes.append(gpa, @intFromEnum(std.wasm.ExternalKind.global)); | 790 | try binary_bytes.append(gpa, @backingInt(std.wasm.ExternalKind.global)); |
| 791 | try appendLeb128(gpa, binary_bytes, @intFromEnum(exp.global_index)); | 791 | try appendLeb128(gpa, binary_bytes, @backingInt(exp.global_index)); |
| 792 | } | 792 | } |
| 793 | exports_len += wasm.global_exports.items.len; | 793 | exports_len += wasm.global_exports.items.len; |
| 794 | 794 | ||
| ... | @@ -802,7 +802,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -802,7 +802,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 802 | 802 | ||
| 803 | // start section | 803 | // start section |
| 804 | if (wasm.functions.getIndex(.__wasm_init_memory)) |func_index| { | 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 | } else if (Wasm.OutputFunctionIndex.fromResolution(wasm, wasm.entry_resolution)) |func_index| { | 806 | } else if (Wasm.OutputFunctionIndex.fromResolution(wasm, wasm.entry_resolution)) |func_index| { |
| 807 | try emitStartSection(gpa, binary_bytes, func_index); | 807 | try emitStartSection(gpa, binary_bytes, func_index); |
| 808 | } | 808 | } |
| ... | @@ -830,7 +830,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -830,7 +830,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 830 | } | 830 | } |
| 831 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(f.indirect_function_table.entries.len))); | 831 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(f.indirect_function_table.entries.len))); |
| 832 | for (f.indirect_function_table.keys()) |func_index| { | 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 | replaceVecSectionHeader(binary_bytes, header_offset, .element, 1); | 836 | replaceVecSectionHeader(binary_bytes, header_offset, .element, 1); |
| ... | @@ -966,7 +966,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -966,7 +966,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 966 | const group_size = group_end_addr - group_start_addr; | 966 | const group_size = group_end_addr - group_start_addr; |
| 967 | log.debug("emit data section group, {d} bytes", .{group_size}); | 967 | log.debug("emit data section group, {d} bytes", .{group_size}); |
| 968 | const flags: Object.DataSegmentFlags = if (segment_id.isPassive(wasm)) .passive else .active; | 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 | // Passive segments are initialized at runtime. | 970 | // Passive segments are initialized at runtime. |
| 971 | if (flags != .passive) { | 971 | if (flags != .passive) { |
| 972 | var aw: std.Io.Writer.Allocating = .fromArrayList(gpa, binary_bytes); | 972 | var aw: std.Io.Writer.Allocating = .fromArrayList(gpa, binary_bytes); |
| ... | @@ -1119,7 +1119,7 @@ fn emitNameSection( | ... | @@ -1119,7 +1119,7 @@ fn emitNameSection( |
| 1119 | 1119 | ||
| 1120 | { | 1120 | { |
| 1121 | const sub_offset = try reserveCustomSectionHeader(gpa, binary_bytes); | 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 | const total_functions: u32 = @intCast(f.function_imports.entries.len + wasm.functions.entries.len); | 1124 | const total_functions: u32 = @intCast(f.function_imports.entries.len + wasm.functions.entries.len); |
| 1125 | try appendLeb128(gpa, binary_bytes, total_functions); | 1125 | try appendLeb128(gpa, binary_bytes, total_functions); |
| ... | @@ -1140,7 +1140,7 @@ fn emitNameSection( | ... | @@ -1140,7 +1140,7 @@ fn emitNameSection( |
| 1140 | 1140 | ||
| 1141 | { | 1141 | { |
| 1142 | const sub_offset = try reserveCustomSectionHeader(gpa, binary_bytes); | 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 | const total_globals: u32 = @intCast(f.global_imports.entries.len + wasm.globals.entries.len); | 1145 | const total_globals: u32 = @intCast(f.global_imports.entries.len + wasm.globals.entries.len); |
| 1146 | try appendLeb128(gpa, binary_bytes, total_globals); | 1146 | try appendLeb128(gpa, binary_bytes, total_globals); |
| ... | @@ -1161,7 +1161,7 @@ fn emitNameSection( | ... | @@ -1161,7 +1161,7 @@ fn emitNameSection( |
| 1161 | 1161 | ||
| 1162 | { | 1162 | { |
| 1163 | const sub_offset = try reserveCustomSectionHeader(gpa, binary_bytes); | 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 | const total_data_segments: u32 = @intCast(data_segment_groups.len); | 1166 | const total_data_segments: u32 = @intCast(data_segment_groups.len); |
| 1167 | try appendLeb128(gpa, binary_bytes, total_data_segments); | 1167 | try appendLeb128(gpa, binary_bytes, total_data_segments); |
| ... | @@ -1194,7 +1194,7 @@ fn emitFeaturesSection( | ... | @@ -1194,7 +1194,7 @@ fn emitFeaturesSection( |
| 1194 | 1194 | ||
| 1195 | var safety_count = feature_count; | 1195 | var safety_count = feature_count; |
| 1196 | for (target.cpu.arch.allFeaturesList(), 0..) |*feature, i| { | 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 | safety_count -= 1; | 1198 | safety_count -= 1; |
| 1199 | 1199 | ||
| 1200 | try appendLeb128(gpa, binary_bytes, @as(u32, '+')); | 1200 | try appendLeb128(gpa, binary_bytes, @as(u32, '+')); |
| ... | @@ -1318,7 +1318,7 @@ fn replaceVecSectionHeader( | ... | @@ -1318,7 +1318,7 @@ fn replaceVecSectionHeader( |
| 1318 | const size: u32 = @intCast(bytes.items.len - offset - section_header_reserve_size + uleb128size(n_items)); | 1318 | const size: u32 = @intCast(bytes.items.len - offset - section_header_reserve_size + uleb128size(n_items)); |
| 1319 | var buf: [section_header_reserve_size]u8 = undefined; | 1319 | var buf: [section_header_reserve_size]u8 = undefined; |
| 1320 | var w: std.Io.Writer = .fixed(&buf); | 1320 | var w: std.Io.Writer = .fixed(&buf); |
| 1321 | w.writeByte(@intFromEnum(section)) catch unreachable; | 1321 | w.writeByte(@backingInt(section)) catch unreachable; |
| 1322 | w.writeUleb128(size) catch unreachable; | 1322 | w.writeUleb128(size) catch unreachable; |
| 1323 | w.writeUleb128(n_items) catch unreachable; | 1323 | w.writeUleb128(n_items) catch unreachable; |
| 1324 | bytes.replaceRangeAssumeCapacity(offset, section_header_reserve_size, w.buffered()); | 1324 | bytes.replaceRangeAssumeCapacity(offset, section_header_reserve_size, w.buffered()); |
| ... | @@ -1382,34 +1382,34 @@ fn emitMemoryImport( | ... | @@ -1382,34 +1382,34 @@ fn emitMemoryImport( |
| 1382 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); | 1382 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(name.len))); |
| 1383 | try binary_bytes.appendSlice(gpa, name); | 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 | try emitLimits(gpa, binary_bytes, memory_import.limits()); | 1386 | try emitLimits(gpa, binary_bytes, memory_import.limits()); |
| 1387 | } | 1387 | } |
| 1388 | 1388 | ||
| 1389 | fn emitInit(writer: *std.Io.Writer, init_expr: std.wasm.InitExpression) !void { | 1389 | fn emitInit(writer: *std.Io.Writer, init_expr: std.wasm.InitExpression) !void { |
| 1390 | switch (init_expr) { | 1390 | switch (init_expr) { |
| 1391 | .i32_const => |val| { | 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 | try writer.writeSleb128(val); | 1393 | try writer.writeSleb128(val); |
| 1394 | }, | 1394 | }, |
| 1395 | .i64_const => |val| { | 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 | try writer.writeSleb128(val); | 1397 | try writer.writeSleb128(val); |
| 1398 | }, | 1398 | }, |
| 1399 | .f32_const => |val| { | 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 | try writer.writeInt(u32, @bitCast(val), .little); | 1401 | try writer.writeInt(u32, @bitCast(val), .little); |
| 1402 | }, | 1402 | }, |
| 1403 | .f64_const => |val| { | 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 | try writer.writeInt(u64, @bitCast(val), .little); | 1405 | try writer.writeInt(u64, @bitCast(val), .little); |
| 1406 | }, | 1406 | }, |
| 1407 | .global_get => |val| { | 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 | try writer.writeUleb128(val); | 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 | pub fn emitExpr(wasm: *const Wasm, binary_bytes: *ArrayList(u8), expr: Wasm.Expr) Allocator.Error!void { | 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,7 +1420,7 @@ pub fn emitExpr(wasm: *const Wasm, binary_bytes: *ArrayList(u8), expr: Wasm.Expr |
| 1420 | 1420 | ||
| 1421 | fn emitSegmentInfo(wasm: *Wasm, binary_bytes: *std.array_list.Managed(u8)) !void { | 1421 | fn emitSegmentInfo(wasm: *Wasm, binary_bytes: *std.array_list.Managed(u8)) !void { |
| 1422 | const gpa = wasm.base.comp.gpa; | 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 | const segment_offset = binary_bytes.items.len; | 1424 | const segment_offset = binary_bytes.items.len; |
| 1425 | 1425 | ||
| 1426 | try appendLeb128(gpa, binary_bytes, @as(u32, @intCast(wasm.segment_info.count()))); | 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,19 +1554,19 @@ fn reloc_sleb64_table_index(code: []u8, i: IndirectFunctionTableIndex) void { |
| 1554 | } | 1554 | } |
| 1555 | 1555 | ||
| 1556 | fn reloc_u32_function(code: []u8, function: Wasm.OutputFunctionIndex) void { | 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 | fn reloc_leb_function(code: []u8, function: Wasm.OutputFunctionIndex) void { | 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 | fn reloc_u32_global(code: []u8, global: Wasm.GlobalIndex) void { | 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 | fn reloc_leb_global(code: []u8, global: Wasm.GlobalIndex) void { | 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 | const RelocAddr = struct { | 1572 | const RelocAddr = struct { |
| ... | @@ -1618,11 +1618,11 @@ fn reloc_sleb64_addr(code: []u8, ra: RelocAddr) void { | ... | @@ -1618,11 +1618,11 @@ fn reloc_sleb64_addr(code: []u8, ra: RelocAddr) void { |
| 1618 | } | 1618 | } |
| 1619 | 1619 | ||
| 1620 | fn reloc_leb_table(code: []u8, table: Wasm.TableIndex) void { | 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 | fn reloc_leb_type(code: []u8, index: FuncTypeIndex) void { | 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 | fn emitCallCtorsFunction(wasm: *const Wasm, binary_bytes: *ArrayList(u8)) Allocator.Error!void { | 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,14 +1640,14 @@ fn emitCallCtorsFunction(wasm: *const Wasm, binary_bytes: *ArrayList(u8)) Alloca |
| 1640 | // Call function by its function index | 1640 | // Call function by its function index |
| 1641 | try binary_bytes.ensureUnusedCapacity(gpa, 1 + 5 + n_returns + 1); | 1641 | try binary_bytes.ensureUnusedCapacity(gpa, 1 + 5 + n_returns + 1); |
| 1642 | const call_index: Wasm.OutputFunctionIndex = .fromObjectFunction(wasm, init_func.function_index); | 1642 | const call_index: Wasm.OutputFunctionIndex = .fromObjectFunction(wasm, init_func.function_index); |
| 1643 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call)); | 1643 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call)); |
| 1644 | appendReservedUleb32(binary_bytes, @intFromEnum(call_index)); | 1644 | appendReservedUleb32(binary_bytes, @backingInt(call_index)); |
| 1645 | 1645 | ||
| 1646 | // drop all returned values from the stack as __wasm_call_ctors has no return value | 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 | fn emitInitMemoryFunction( | 1653 | fn emitInitMemoryFunction( |
| ... | @@ -1674,31 +1674,31 @@ fn emitInitMemoryFunction( | ... | @@ -1674,31 +1674,31 @@ fn emitInitMemoryFunction( |
| 1674 | try binary_bytes.ensureUnusedCapacity(gpa, 2 * 3 + 6 * 3 + 1 + 6 * 3 + 1 + 5 * 4 + 1 + 1); | 1674 | try binary_bytes.ensureUnusedCapacity(gpa, 2 * 3 + 6 * 3 + 1 + 6 * 3 + 1 + 5 * 4 + 1 + 1); |
| 1675 | // destination blocks | 1675 | // destination blocks |
| 1676 | // based on values we jump to corresponding label | 1676 | // based on values we jump to corresponding label |
| 1677 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.block)); // $drop | 1677 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.block)); // $drop |
| 1678 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.BlockType.empty)); | 1678 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.BlockType.empty)); |
| 1679 | 1679 | ||
| 1680 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.block)); // $wait | 1680 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.block)); // $wait |
| 1681 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.BlockType.empty)); | 1681 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.BlockType.empty)); |
| 1682 | 1682 | ||
| 1683 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.block)); // $init | 1683 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.block)); // $init |
| 1684 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.BlockType.empty)); | 1684 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.BlockType.empty)); |
| 1685 | 1685 | ||
| 1686 | // atomically check | 1686 | // atomically check |
| 1687 | appendReservedI32Const(binary_bytes, flag_address); | 1687 | appendReservedI32Const(binary_bytes, flag_address); |
| 1688 | appendReservedI32Const(binary_bytes, 0); | 1688 | appendReservedI32Const(binary_bytes, 0); |
| 1689 | appendReservedI32Const(binary_bytes, 1); | 1689 | appendReservedI32Const(binary_bytes, 1); |
| 1690 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.atomics_prefix)); | 1690 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.atomics_prefix)); |
| 1691 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.AtomicsOpcode.i32_atomic_rmw_cmpxchg)); | 1691 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.AtomicsOpcode.i32_atomic_rmw_cmpxchg)); |
| 1692 | appendReservedUleb32(binary_bytes, 2); // alignment | 1692 | appendReservedUleb32(binary_bytes, 2); // alignment |
| 1693 | appendReservedUleb32(binary_bytes, 0); // offset | 1693 | appendReservedUleb32(binary_bytes, 0); // offset |
| 1694 | 1694 | ||
| 1695 | // based on the value from the atomic check, jump to the label. | 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 | appendReservedUleb32(binary_bytes, 2); // length of the table (we have 3 blocks but because of the mandatory default the length is 2). | 1697 | appendReservedUleb32(binary_bytes, 2); // length of the table (we have 3 blocks but because of the mandatory default the length is 2). |
| 1698 | appendReservedUleb32(binary_bytes, 0); // $init | 1698 | appendReservedUleb32(binary_bytes, 0); // $init |
| 1699 | appendReservedUleb32(binary_bytes, 1); // $wait | 1699 | appendReservedUleb32(binary_bytes, 1); // $wait |
| 1700 | appendReservedUleb32(binary_bytes, 2); // $drop | 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 | const segment_groups = wasm.flush_buffer.data_segment_groups.items; | 1704 | const segment_groups = wasm.flush_buffer.data_segment_groups.items; |
| ... | @@ -1723,19 +1723,19 @@ fn emitInitMemoryFunction( | ... | @@ -1723,19 +1723,19 @@ fn emitInitMemoryFunction( |
| 1723 | // global. This allows the runtime to use this static copy of the | 1723 | // global. This allows the runtime to use this static copy of the |
| 1724 | // TLS data for the first/main thread. | 1724 | // TLS data for the first/main thread. |
| 1725 | appendReservedI32Const(binary_bytes, start_addr); | 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 | appendReservedUleb32(binary_bytes, virtual_addrs.tls_base.?); | 1727 | appendReservedUleb32(binary_bytes, virtual_addrs.tls_base.?); |
| 1728 | } | 1728 | } |
| 1729 | 1729 | ||
| 1730 | appendReservedI32Const(binary_bytes, 0); | 1730 | appendReservedI32Const(binary_bytes, 0); |
| 1731 | appendReservedI32Const(binary_bytes, segment_size); | 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 | if (segment.isBss(wasm)) { | 1733 | if (segment.isBss(wasm)) { |
| 1734 | // fill bss segment with zeroes | 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 | } else { | 1736 | } else { |
| 1737 | // initialize the segment | 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 | appendReservedUleb32(binary_bytes, @intCast(segment_index)); | 1739 | appendReservedUleb32(binary_bytes, @intCast(segment_index)); |
| 1740 | } | 1740 | } |
| 1741 | binary_bytes.appendAssumeCapacity(0); // memory index immediate | 1741 | binary_bytes.appendAssumeCapacity(0); // memory index immediate |
| ... | @@ -1747,38 +1747,38 @@ fn emitInitMemoryFunction( | ... | @@ -1747,38 +1747,38 @@ fn emitInitMemoryFunction( |
| 1747 | // we set the init memory flag to value '2' | 1747 | // we set the init memory flag to value '2' |
| 1748 | appendReservedI32Const(binary_bytes, flag_address); | 1748 | appendReservedI32Const(binary_bytes, flag_address); |
| 1749 | appendReservedI32Const(binary_bytes, 2); | 1749 | appendReservedI32Const(binary_bytes, 2); |
| 1750 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.atomics_prefix)); | 1750 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.atomics_prefix)); |
| 1751 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.AtomicsOpcode.i32_atomic_store)); | 1751 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.AtomicsOpcode.i32_atomic_store)); |
| 1752 | appendReservedUleb32(binary_bytes, @as(u32, 2)); // alignment | 1752 | appendReservedUleb32(binary_bytes, @as(u32, 2)); // alignment |
| 1753 | appendReservedUleb32(binary_bytes, @as(u32, 0)); // offset | 1753 | appendReservedUleb32(binary_bytes, @as(u32, 0)); // offset |
| 1754 | 1754 | ||
| 1755 | // notify any waiters for segment initialization completion | 1755 | // notify any waiters for segment initialization completion |
| 1756 | appendReservedI32Const(binary_bytes, flag_address); | 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 | appendReservedLeb128(binary_bytes, @as(i32, -1)); // number of waiters | 1758 | appendReservedLeb128(binary_bytes, @as(i32, -1)); // number of waiters |
| 1759 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.atomics_prefix)); | 1759 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.atomics_prefix)); |
| 1760 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.AtomicsOpcode.memory_atomic_notify)); | 1760 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.AtomicsOpcode.memory_atomic_notify)); |
| 1761 | appendReservedUleb32(binary_bytes, @as(u32, 2)); // alignment | 1761 | appendReservedUleb32(binary_bytes, @as(u32, 2)); // alignment |
| 1762 | appendReservedUleb32(binary_bytes, @as(u32, 0)); // offset | 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 | // branch and drop segments | 1765 | // branch and drop segments |
| 1766 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.br)); | 1766 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.br)); |
| 1767 | appendReservedUleb32(binary_bytes, @as(u32, 1)); | 1767 | appendReservedUleb32(binary_bytes, @as(u32, 1)); |
| 1768 | 1768 | ||
| 1769 | // wait for thread to initialize memory segments | 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 | appendReservedI32Const(binary_bytes, flag_address); | 1771 | appendReservedI32Const(binary_bytes, flag_address); |
| 1772 | appendReservedI32Const(binary_bytes, 1); // expected flag value | 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 | appendReservedLeb128(binary_bytes, @as(i64, -1)); // timeout | 1774 | appendReservedLeb128(binary_bytes, @as(i64, -1)); // timeout |
| 1775 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.atomics_prefix)); | 1775 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.atomics_prefix)); |
| 1776 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.AtomicsOpcode.memory_atomic_wait32)); | 1776 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.AtomicsOpcode.memory_atomic_wait32)); |
| 1777 | appendReservedUleb32(binary_bytes, @as(u32, 2)); // alignment | 1777 | appendReservedUleb32(binary_bytes, @as(u32, 2)); // alignment |
| 1778 | appendReservedUleb32(binary_bytes, @as(u32, 0)); // offset | 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 | for (segment_groups, 0..) |group, segment_index| { | 1784 | for (segment_groups, 0..) |group, segment_index| { |
| ... | @@ -1791,13 +1791,13 @@ fn emitInitMemoryFunction( | ... | @@ -1791,13 +1791,13 @@ fn emitInitMemoryFunction( |
| 1791 | 1791 | ||
| 1792 | try binary_bytes.ensureUnusedCapacity(gpa, 1 + 5 + 5 + 1); | 1792 | try binary_bytes.ensureUnusedCapacity(gpa, 1 + 5 + 5 + 1); |
| 1793 | 1793 | ||
| 1794 | binary_bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.misc_prefix)); | 1794 | binary_bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.misc_prefix)); |
| 1795 | appendReservedUleb32(binary_bytes, @intFromEnum(std.wasm.MiscOpcode.data_drop)); | 1795 | appendReservedUleb32(binary_bytes, @backingInt(std.wasm.MiscOpcode.data_drop)); |
| 1796 | appendReservedUleb32(binary_bytes, @intCast(segment_index)); | 1796 | appendReservedUleb32(binary_bytes, @intCast(segment_index)); |
| 1797 | } | 1797 | } |
| 1798 | 1798 | ||
| 1799 | // End of the function body | 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 | fn emitInitTlsFunction(wasm: *const Wasm, bytes: *ArrayList(u8)) Allocator.Error!void { | 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,28 +1821,28 @@ fn emitInitTlsFunction(wasm: *const Wasm, bytes: *ArrayList(u8)) Allocator.Error |
| 1821 | 1821 | ||
| 1822 | const param_local: u32 = 0; | 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 | appendReservedUleb32(bytes, param_local); | 1825 | appendReservedUleb32(bytes, param_local); |
| 1826 | 1826 | ||
| 1827 | const tls_base_global_index: Wasm.GlobalIndex = @enumFromInt(wasm.globals.getIndex(.__tls_base).?); | 1827 | const tls_base_global_index: Wasm.GlobalIndex = @fromBackingInt(@intCast(wasm.globals.getIndex(.__tls_base).?)); |
| 1828 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.global_set)); | 1828 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.global_set)); |
| 1829 | appendReservedUleb32(bytes, @intFromEnum(tls_base_global_index)); | 1829 | appendReservedUleb32(bytes, @backingInt(tls_base_global_index)); |
| 1830 | 1830 | ||
| 1831 | // load stack values for the bulk-memory operation | 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 | appendReservedUleb32(bytes, param_local); | 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 | appendReservedUleb32(bytes, 0); //segment offset | 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 | appendReservedUleb32(bytes, group_size); //segment offset | 1840 | appendReservedUleb32(bytes, group_size); //segment offset |
| 1841 | } | 1841 | } |
| 1842 | 1842 | ||
| 1843 | // perform the bulk-memory operation to initialize the data segment | 1843 | // perform the bulk-memory operation to initialize the data segment |
| 1844 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.misc_prefix)); | 1844 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.misc_prefix)); |
| 1845 | appendReservedUleb32(bytes, @intFromEnum(std.wasm.MiscOpcode.memory_init)); | 1845 | appendReservedUleb32(bytes, @backingInt(std.wasm.MiscOpcode.memory_init)); |
| 1846 | // segment immediate | 1846 | // segment immediate |
| 1847 | appendReservedUleb32(bytes, data_segment_index); | 1847 | appendReservedUleb32(bytes, data_segment_index); |
| 1848 | // memory index immediate (always 0) | 1848 | // memory index immediate (always 0) |
| ... | @@ -1853,17 +1853,17 @@ fn emitInitTlsFunction(wasm: *const Wasm, bytes: *ArrayList(u8)) Allocator.Error | ... | @@ -1853,17 +1853,17 @@ fn emitInitTlsFunction(wasm: *const Wasm, bytes: *ArrayList(u8)) Allocator.Error |
| 1853 | // which performs all runtime TLS relocations. This is a synthetic function, | 1853 | // which performs all runtime TLS relocations. This is a synthetic function, |
| 1854 | // generated by the linker. | 1854 | // generated by the linker. |
| 1855 | if (wasm.functions.getIndex(.__wasm_apply_global_tls_relocs)) |function_index| { | 1855 | if (wasm.functions.getIndex(.__wasm_apply_global_tls_relocs)) |function_index| { |
| 1856 | const output_function_index: Wasm.OutputFunctionIndex = .fromFunctionIndex(wasm, @enumFromInt(function_index)); | 1856 | const output_function_index: Wasm.OutputFunctionIndex = .fromFunctionIndex(wasm, @fromBackingInt(@intCast(function_index))); |
| 1857 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.call)); | 1857 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.call)); |
| 1858 | appendReservedUleb32(bytes, @intFromEnum(output_function_index)); | 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 | fn emitStartSection(gpa: Allocator, bytes: *ArrayList(u8), i: Wasm.OutputFunctionIndex) !void { | 1864 | fn emitStartSection(gpa: Allocator, bytes: *ArrayList(u8), i: Wasm.OutputFunctionIndex) !void { |
| 1865 | const header_offset = try reserveVecSectionHeader(gpa, bytes); | 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 | fn emitTagIndexFunction( | 1869 | fn emitTagIndexFunction( |
| ... | @@ -1887,31 +1887,31 @@ fn emitTagIndexFunction( | ... | @@ -1887,31 +1887,31 @@ fn emitTagIndexFunction( |
| 1887 | 1887 | ||
| 1888 | appendReservedUleb32(code, 0); // no locals | 1888 | appendReservedUleb32(code, 0); // no locals |
| 1889 | 1889 | ||
| 1890 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.block)); | 1890 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.block)); |
| 1891 | code.appendAssumeCapacity(@intFromEnum(std.wasm.BlockType.empty)); | 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 | appendReservedUleb32(code, 0); | 1894 | appendReservedUleb32(code, 0); |
| 1895 | 1895 | ||
| 1896 | appendReservedI32Const(code, len); | 1896 | appendReservedI32Const(code, len); |
| 1897 | 1897 | ||
| 1898 | // if < len -> break out of block | 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 | appendReservedUleb32(code, 0); | 1902 | appendReservedUleb32(code, 0); |
| 1903 | 1903 | ||
| 1904 | // invalid -> return -1 | 1904 | // invalid -> return -1 |
| 1905 | appendReservedI32Const(code, ~@as(u32, 0)); | 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 | // valid -> return input | 1910 | // valid -> return input |
| 1911 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_get)); | 1911 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.local_get)); |
| 1912 | appendReservedUleb32(code, 0); | 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 | return; | 1916 | return; |
| 1917 | } | 1917 | } |
| ... | @@ -1931,8 +1931,8 @@ fn emitTagIndexFunction( | ... | @@ -1931,8 +1931,8 @@ fn emitTagIndexFunction( |
| 1931 | 1931 | ||
| 1932 | for (tag_values, 0..) |tag_value, tag_index| { | 1932 | for (tag_values, 0..) |tag_value, tag_index| { |
| 1933 | // block for this if case | 1933 | // block for this if case |
| 1934 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.block)); | 1934 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.block)); |
| 1935 | code.appendAssumeCapacity(@intFromEnum(std.wasm.BlockType.empty)); | 1935 | code.appendAssumeCapacity(@backingInt(std.wasm.BlockType.empty)); |
| 1936 | 1936 | ||
| 1937 | const val: Zcu.Value = .fromInterned(tag_value); | 1937 | const val: Zcu.Value = .fromInterned(tag_value); |
| 1938 | if (is_big_int) { | 1938 | if (is_big_int) { |
| ... | @@ -1947,21 +1947,21 @@ fn emitTagIndexFunction( | ... | @@ -1947,21 +1947,21 @@ fn emitTagIndexFunction( |
| 1947 | try code.ensureUnusedCapacity(gpa, 35 * num_limbs); | 1947 | try code.ensureUnusedCapacity(gpa, 35 * num_limbs); |
| 1948 | 1948 | ||
| 1949 | for (0..num_limbs) |limb_index| { | 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 | appendReservedUleb32(code, 0); | 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 | appendReservedUleb32(code, @ctz(@as(u32, 8))); | 1954 | appendReservedUleb32(code, @ctz(@as(u32, 8))); |
| 1955 | appendReservedUleb32(code, @intCast(limb_index * 8)); | 1955 | appendReservedUleb32(code, @intCast(limb_index * 8)); |
| 1956 | 1956 | ||
| 1957 | appendReservedI64Const(code, limbs[limb_index]); | 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 | appendReservedUleb32(code, 0); | 1961 | appendReservedUleb32(code, 0); |
| 1962 | } | 1962 | } |
| 1963 | } else { | 1963 | } else { |
| 1964 | code.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.local_get)); | 1964 | code.appendAssumeCapacity(@backingInt(std.wasm.Opcode.local_get)); |
| 1965 | appendReservedUleb32(code, 0); | 1965 | appendReservedUleb32(code, 0); |
| 1966 | 1966 | ||
| 1967 | switch (int_info.bits) { | 1967 | switch (int_info.bits) { |
| ... | @@ -1971,7 +1971,7 @@ fn emitTagIndexFunction( | ... | @@ -1971,7 +1971,7 @@ fn emitTagIndexFunction( |
| 1971 | .unsigned => @intCast(val.toUnsignedInt(zcu)), | 1971 | .unsigned => @intCast(val.toUnsignedInt(zcu)), |
| 1972 | }; | 1972 | }; |
| 1973 | appendReservedI32Const(code, x); | 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 | 33...64 => { | 1976 | 33...64 => { |
| 1977 | const x: u64 = switch (int_info.signedness) { | 1977 | const x: u64 = switch (int_info.signedness) { |
| ... | @@ -1979,30 +1979,30 @@ fn emitTagIndexFunction( | ... | @@ -1979,30 +1979,30 @@ fn emitTagIndexFunction( |
| 1979 | .unsigned => val.toUnsignedInt(zcu), | 1979 | .unsigned => val.toUnsignedInt(zcu), |
| 1980 | }; | 1980 | }; |
| 1981 | appendReservedI64Const(code, x); | 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 | else => unreachable, | 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 | appendReservedUleb32(code, 0); | 1988 | appendReservedUleb32(code, 0); |
| 1989 | } | 1989 | } |
| 1990 | 1990 | ||
| 1991 | appendReservedI32Const(code, @intCast(tag_index)); | 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 | // end the block for this case | 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 | appendReservedI32Const(code, ~@as(u32, 0)); | 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 | /// Writes an unsigned 32-bit integer as a LEB128-encoded 'i32.const' value. | 2003 | /// Writes an unsigned 32-bit integer as a LEB128-encoded 'i32.const' value. |
| 2004 | fn appendReservedI32Const(bytes: *ArrayList(u8), val: u32) void { | 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 | var w: std.Io.Writer = .fromArrayList(bytes); | 2006 | var w: std.Io.Writer = .fromArrayList(bytes); |
| 2007 | defer bytes.* = w.toArrayList(); | 2007 | defer bytes.* = w.toArrayList(); |
| 2008 | return w.writeSleb128(@as(i32, @bitCast(val))) catch |err| switch (err) { | 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,7 +2012,7 @@ fn appendReservedI32Const(bytes: *ArrayList(u8), val: u32) void { |
| 2012 | 2012 | ||
| 2013 | /// Writes an unsigned 64-bit integer as a LEB128-encoded 'i64.const' value. | 2013 | /// Writes an unsigned 64-bit integer as a LEB128-encoded 'i64.const' value. |
| 2014 | fn appendReservedI64Const(bytes: *ArrayList(u8), val: u64) void { | 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 | var w: std.Io.Writer = .fromArrayList(bytes); | 2016 | var w: std.Io.Writer = .fromArrayList(bytes); |
| 2017 | defer bytes.* = w.toArrayList(); | 2017 | defer bytes.* = w.toArrayList(); |
| 2018 | return w.writeSleb128(@as(i64, @bitCast(val))) catch |err| switch (err) { | 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,11 +2030,11 @@ fn appendReservedUleb32(bytes: *ArrayList(u8), val: u32) void { |
| 2030 | 2030 | ||
| 2031 | fn appendGlobal(gpa: Allocator, bytes: *ArrayList(u8), mutable: u8, val: u32) Allocator.Error!void { | 2031 | fn appendGlobal(gpa: Allocator, bytes: *ArrayList(u8), mutable: u8, val: u32) Allocator.Error!void { |
| 2032 | try bytes.ensureUnusedCapacity(gpa, 9); | 2032 | try bytes.ensureUnusedCapacity(gpa, 9); |
| 2033 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Valtype.i32)); | 2033 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Valtype.i32)); |
| 2034 | bytes.appendAssumeCapacity(mutable); | 2034 | bytes.appendAssumeCapacity(mutable); |
| 2035 | bytes.appendAssumeCapacity(@intFromEnum(std.wasm.Opcode.i32_const)); | 2035 | bytes.appendAssumeCapacity(@backingInt(std.wasm.Opcode.i32_const)); |
| 2036 | appendReservedUleb32(bytes, val); | 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 | fn appendLeb128(gpa: Allocator, bytes: *ArrayList(u8), value: anytype) Allocator.Error!void { | 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,7 +195,7 @@ pub const ScratchSpace = struct { |
| 195 | _, | 195 | _, |
| 196 | 196 | ||
| 197 | fn ptr(index: FuncImportIndex, ss: *const ScratchSpace) *FunctionImport { | 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,7 +204,7 @@ pub const ScratchSpace = struct { |
| 204 | _, | 204 | _, |
| 205 | 205 | ||
| 206 | fn ptr(index: GlobalImportIndex, ss: *const ScratchSpace) *GlobalImport { | 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,7 +213,7 @@ pub const ScratchSpace = struct { |
| 213 | _, | 213 | _, |
| 214 | 214 | ||
| 215 | fn ptr(index: TableImportIndex, ss: *const ScratchSpace) *TableImport { | 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,7 +222,7 @@ pub const ScratchSpace = struct { |
| 222 | _, | 222 | _, |
| 223 | 223 | ||
| 224 | fn ptr(index: FuncTypeIndex, ss: *const ScratchSpace) *Wasm.FunctionType.Index { | 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,7 +285,7 @@ pub fn parse( |
| 285 | const table_imports_start: u32 = @intCast(wasm.object_table_imports.entries.len); | 285 | const table_imports_start: u32 = @intCast(wasm.object_table_imports.entries.len); |
| 286 | const data_imports_start: u32 = @intCast(wasm.object_data_imports.entries.len); | 286 | const data_imports_start: u32 = @intCast(wasm.object_data_imports.entries.len); |
| 287 | const local_section_index_base = wasm.object_total_sections; | 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 | const source_location: Wasm.SourceLocation = .fromObject(object_index, wasm); | 289 | const source_location: Wasm.SourceLocation = .fromObject(object_index, wasm); |
| 290 | 290 | ||
| 291 | ss.clear(); | 291 | ss.clear(); |
| ... | @@ -299,9 +299,9 @@ pub fn parse( | ... | @@ -299,9 +299,9 @@ pub fn parse( |
| 299 | var global_section_index: ?Wasm.ObjectSectionIndex = null; | 299 | var global_section_index: ?Wasm.ObjectSectionIndex = null; |
| 300 | var data_section_index: ?Wasm.ObjectSectionIndex = null; | 300 | var data_section_index: ?Wasm.ObjectSectionIndex = null; |
| 301 | while (pos < bytes.len) : (wasm.object_total_sections += 1) { | 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 | pos += 1; | 305 | pos += 1; |
| 306 | 306 | ||
| 307 | const len, pos = readLeb(u32, bytes, pos); | 307 | const len, pos = readLeb(u32, bytes, pos); |
| ... | @@ -316,13 +316,13 @@ pub fn parse( | ... | @@ -316,13 +316,13 @@ pub fn parse( |
| 316 | if (section_version != 2) return error.UnsupportedVersion; | 316 | if (section_version != 2) return error.UnsupportedVersion; |
| 317 | while (pos < section_end) { | 317 | while (pos < section_end) { |
| 318 | const sub_type, pos = readLeb(u8, bytes, pos); | 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 | const payload_len, pos = readLeb(u32, bytes, pos); | 320 | const payload_len, pos = readLeb(u32, bytes, pos); |
| 321 | if (payload_len == 0) break; | 321 | if (payload_len == 0) break; |
| 322 | 322 | ||
| 323 | const count, pos = readLeb(u32, bytes, pos); | 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 | .segment_info => { | 326 | .segment_info => { |
| 327 | for (try ss.segment_info.addManyAsSlice(gpa, count)) |*segment| { | 327 | for (try ss.segment_info.addManyAsSlice(gpa, count)) |*segment| { |
| 328 | const name, pos = readBytes(bytes, pos); | 328 | const name, pos = readBytes(bytes, pos); |
| ... | @@ -340,7 +340,7 @@ pub fn parse( | ... | @@ -340,7 +340,7 @@ pub fn parse( |
| 340 | .flags = .{ | 340 | .flags = .{ |
| 341 | .strings = flags.strings, | 341 | .strings = flags.strings, |
| 342 | .tls = tls, | 342 | .tls = tls, |
| 343 | .alignment = @enumFromInt(alignment), | 343 | .alignment = @fromBackingInt(@intCast(alignment)), |
| 344 | .retain = flags.retain, | 344 | .retain = flags.retain, |
| 345 | }, | 345 | }, |
| 346 | }; | 346 | }; |
| ... | @@ -418,27 +418,27 @@ pub fn parse( | ... | @@ -418,27 +418,27 @@ pub fn parse( |
| 418 | const segment_offset, pos = readLeb(u32, bytes, pos); | 418 | const segment_offset, pos = readLeb(u32, bytes, pos); |
| 419 | const size, pos = readLeb(u32, bytes, pos); | 419 | const size, pos = readLeb(u32, bytes, pos); |
| 420 | try wasm.object_datas.append(gpa, .{ | 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 | .offset = segment_offset, | 422 | .offset = segment_offset, |
| 423 | .size = size, | 423 | .size = size, |
| 424 | .name = interned_name, | 424 | .name = interned_name, |
| 425 | .flags = symbol.flags, | 425 | .flags = symbol.flags, |
| 426 | }); | 426 | }); |
| 427 | symbol.pointee = .{ | 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 | .section => { | 432 | .section => { |
| 433 | const local_section, pos = readLeb(u32, bytes, pos); | 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 | symbol.pointee = .{ .section = section }; | 435 | symbol.pointee = .{ .section = section }; |
| 436 | }, | 436 | }, |
| 437 | 437 | ||
| 438 | .function => { | 438 | .function => { |
| 439 | const local_index, pos = readLeb(u32, bytes, pos); | 439 | const local_index, pos = readLeb(u32, bytes, pos); |
| 440 | if (symbol.flags.undefined) { | 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 | symbol.pointee = .{ .function_import = function_import }; | 442 | symbol.pointee = .{ .function_import = function_import }; |
| 443 | if (symbol.flags.explicit_name) { | 443 | if (symbol.flags.explicit_name) { |
| 444 | const name, pos = readBytes(bytes, pos); | 444 | const name, pos = readBytes(bytes, pos); |
| ... | @@ -447,7 +447,7 @@ pub fn parse( | ... | @@ -447,7 +447,7 @@ pub fn parse( |
| 447 | symbol.name = function_import.ptr(ss).name.toOptional(); | 447 | symbol.name = function_import.ptr(ss).name.toOptional(); |
| 448 | } | 448 | } |
| 449 | } else { | 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 | const name, pos = readBytes(bytes, pos); | 451 | const name, pos = readBytes(bytes, pos); |
| 452 | symbol.name = (try wasm.internString(name)).toOptional(); | 452 | symbol.name = (try wasm.internString(name)).toOptional(); |
| 453 | } | 453 | } |
| ... | @@ -455,7 +455,7 @@ pub fn parse( | ... | @@ -455,7 +455,7 @@ pub fn parse( |
| 455 | .global => { | 455 | .global => { |
| 456 | const local_index, pos = readLeb(u32, bytes, pos); | 456 | const local_index, pos = readLeb(u32, bytes, pos); |
| 457 | if (symbol.flags.undefined) { | 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 | symbol.pointee = .{ .global_import = global_import }; | 459 | symbol.pointee = .{ .global_import = global_import }; |
| 460 | if (symbol.flags.explicit_name) { | 460 | if (symbol.flags.explicit_name) { |
| 461 | const name, pos = readBytes(bytes, pos); | 461 | const name, pos = readBytes(bytes, pos); |
| ... | @@ -464,7 +464,7 @@ pub fn parse( | ... | @@ -464,7 +464,7 @@ pub fn parse( |
| 464 | symbol.name = global_import.ptr(ss).name.toOptional(); | 464 | symbol.name = global_import.ptr(ss).name.toOptional(); |
| 465 | } | 465 | } |
| 466 | } else { | 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 | const name, pos = readBytes(bytes, pos); | 468 | const name, pos = readBytes(bytes, pos); |
| 469 | symbol.name = (try wasm.internString(name)).toOptional(); | 469 | symbol.name = (try wasm.internString(name)).toOptional(); |
| 470 | } | 470 | } |
| ... | @@ -473,7 +473,7 @@ pub fn parse( | ... | @@ -473,7 +473,7 @@ pub fn parse( |
| 473 | const local_index, pos = readLeb(u32, bytes, pos); | 473 | const local_index, pos = readLeb(u32, bytes, pos); |
| 474 | if (symbol.flags.undefined) { | 474 | if (symbol.flags.undefined) { |
| 475 | table_import_symbol_count += 1; | 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 | symbol.pointee = .{ .table_import = table_import }; | 477 | symbol.pointee = .{ .table_import = table_import }; |
| 478 | if (symbol.flags.explicit_name) { | 478 | if (symbol.flags.explicit_name) { |
| 479 | const name, pos = readBytes(bytes, pos); | 479 | const name, pos = readBytes(bytes, pos); |
| ... | @@ -482,13 +482,13 @@ pub fn parse( | ... | @@ -482,13 +482,13 @@ pub fn parse( |
| 482 | symbol.name = table_import.ptr(ss).name.toOptional(); | 482 | symbol.name = table_import.ptr(ss).name.toOptional(); |
| 483 | } | 483 | } |
| 484 | } else { | 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 | const name, pos = readBytes(bytes, pos); | 486 | const name, pos = readBytes(bytes, pos); |
| 487 | symbol.name = (try wasm.internString(name)).toOptional(); | 487 | symbol.name = (try wasm.internString(name)).toOptional(); |
| 488 | } | 488 | } |
| 489 | }, | 489 | }, |
| 490 | else => { | 490 | else => { |
| 491 | log.debug("unrecognized symbol type tag: {x}", .{@intFromEnum(tag)}); | 491 | log.debug("unrecognized symbol type tag: {x}", .{@backingInt(tag)}); |
| 492 | return error.UnrecognizedSymbolType; | 492 | return error.UnrecognizedSymbolType; |
| 493 | }, | 493 | }, |
| 494 | } | 494 | } |
| ... | @@ -506,14 +506,14 @@ pub fn parse( | ... | @@ -506,14 +506,14 @@ pub fn parse( |
| 506 | // "Relocation sections can only target code, data and custom sections." | 506 | // "Relocation sections can only target code, data and custom sections." |
| 507 | const local_section, pos = readLeb(u32, bytes, pos); | 507 | const local_section, pos = readLeb(u32, bytes, pos); |
| 508 | const count, pos = readLeb(u32, bytes, pos); | 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 | log.debug("found {d} relocations for section={d}", .{ count, section }); | 511 | log.debug("found {d} relocations for section={d}", .{ count, section }); |
| 512 | 512 | ||
| 513 | var prev_offset: u32 = 0; | 513 | var prev_offset: u32 = 0; |
| 514 | try wasm.object_relocations.ensureUnusedCapacity(gpa, count); | 514 | try wasm.object_relocations.ensureUnusedCapacity(gpa, count); |
| 515 | for (0..count) |_| { | 515 | for (0..count) |_| { |
| 516 | const tag: RelocationType = @enumFromInt(bytes[pos]); | 516 | const tag: RelocationType = @fromBackingInt(@intCast(bytes[pos])); |
| 517 | pos += 1; | 517 | pos += 1; |
| 518 | const offset, pos = readLeb(u32, bytes, pos); | 518 | const offset, pos = readLeb(u32, bytes, pos); |
| 519 | const index, pos = readLeb(u32, bytes, pos); | 519 | const index, pos = readLeb(u32, bytes, pos); |
| ... | @@ -668,7 +668,7 @@ pub fn parse( | ... | @@ -668,7 +668,7 @@ pub fn parse( |
| 668 | 668 | ||
| 669 | try wasm.object_custom_segments.put(gpa, section_index, .{ | 669 | try wasm.object_custom_segments.put(gpa, section_index, .{ |
| 670 | .payload = .{ | 670 | .payload = .{ |
| 671 | .off = @enumFromInt(data_off), | 671 | .off = @fromBackingInt(@intCast(data_off)), |
| 672 | .len = @intCast(debug_content.len), | 672 | .len = @intCast(debug_content.len), |
| 673 | }, | 673 | }, |
| 674 | .flags = .{}, | 674 | .flags = .{}, |
| ... | @@ -706,7 +706,7 @@ pub fn parse( | ... | @@ -706,7 +706,7 @@ pub fn parse( |
| 706 | try ss.func_imports.append(gpa, .{ | 706 | try ss.func_imports.append(gpa, .{ |
| 707 | .module_name = interned_module_name, | 707 | .module_name = interned_module_name, |
| 708 | .name = interned_name, | 708 | .name = interned_name, |
| 709 | .function_index = @enumFromInt(function), | 709 | .function_index = @fromBackingInt(@intCast(function)), |
| 710 | }); | 710 | }); |
| 711 | }, | 711 | }, |
| 712 | .memory => { | 712 | .memory => { |
| ... | @@ -766,7 +766,7 @@ pub fn parse( | ... | @@ -766,7 +766,7 @@ pub fn parse( |
| 766 | const functions_len, pos = readLeb(u32, bytes, pos); | 766 | const functions_len, pos = readLeb(u32, bytes, pos); |
| 767 | for (try ss.func_type_indexes.addManyAsSlice(gpa, functions_len)) |*func_type_index| { | 767 | for (try ss.func_type_indexes.addManyAsSlice(gpa, functions_len)) |*func_type_index| { |
| 768 | const i, pos = readLeb(u32, bytes, pos); | 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 | .table => { | 772 | .table => { |
| ... | @@ -837,23 +837,23 @@ pub fn parse( | ... | @@ -837,23 +837,23 @@ pub fn parse( |
| 837 | // existing symbol table data if the name matches. | 837 | // existing symbol table data if the name matches. |
| 838 | for (try ss.exports.addManyAsSlice(gpa, exports_len)) |*exp| { | 838 | for (try ss.exports.addManyAsSlice(gpa, exports_len)) |*exp| { |
| 839 | const name, pos = readBytes(bytes, pos); | 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 | pos += 1; | 841 | pos += 1; |
| 842 | const index, pos = readLeb(u32, bytes, pos); | 842 | const index, pos = readLeb(u32, bytes, pos); |
| 843 | exp.* = .{ | 843 | exp.* = .{ |
| 844 | .name = try wasm.internString(name), | 844 | .name = try wasm.internString(name), |
| 845 | .pointee = switch (kind) { | 845 | .pointee = switch (kind) { |
| 846 | .function => .{ .function = @enumFromInt(functions_start + (index - ss.func_imports.items.len)) }, | 846 | .function => .{ .function = @fromBackingInt(@intCast(functions_start + (index - ss.func_imports.items.len))) }, |
| 847 | .table => .{ .table = @enumFromInt(tables_start + (index - ss.table_imports.items.len)) }, | 847 | .table => .{ .table = @fromBackingInt(@intCast(tables_start + (index - ss.table_imports.items.len))) }, |
| 848 | .memory => .{ .memory = @enumFromInt(memories_start + index) }, | 848 | .memory => .{ .memory = @fromBackingInt(@intCast(memories_start + index)) }, |
| 849 | .global => .{ .global = @enumFromInt(globals_start + (index - ss.global_imports.items.len)) }, | 849 | .global => .{ .global = @fromBackingInt(@intCast(globals_start + (index - ss.global_imports.items.len))) }, |
| 850 | }, | 850 | }, |
| 851 | }; | 851 | }; |
| 852 | } | 852 | } |
| 853 | }, | 853 | }, |
| 854 | .start => { | 854 | .start => { |
| 855 | const index, pos = readLeb(u32, bytes, pos); | 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 | .element => { | 858 | .element => { |
| 859 | log.warn("unimplemented: element section in {f} {?s}", .{ path, archive_member_name }); | 859 | log.warn("unimplemented: element section in {f} {?s}", .{ path, archive_member_name }); |
| ... | @@ -1000,7 +1000,7 @@ pub fn parse( | ... | @@ -1000,7 +1000,7 @@ pub fn parse( |
| 1000 | .no_strip = true, | 1000 | .no_strip = true, |
| 1001 | }, | 1001 | }, |
| 1002 | .name = table_import_name.toOptional(), | 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,7 +1482,7 @@ fn readBytes(bytes: []const u8, start_pos: usize) struct { []const u8, usize } { |
| 1482 | fn readEnum(comptime T: type, bytes: []const u8, pos: usize) struct { T, usize } { | 1482 | fn readEnum(comptime T: type, bytes: []const u8, pos: usize) struct { T, usize } { |
| 1483 | const Tag = @typeInfo(T).@"enum".tag_type; | 1483 | const Tag = @typeInfo(T).@"enum".tag_type; |
| 1484 | const int, const new_pos = readLeb(Tag, bytes, pos); | 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 | fn readLimits(bytes: []const u8, start_pos: usize) struct { std.wasm.Limits, usize } { | 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,7 +1503,7 @@ fn readInit(wasm: *Wasm, bytes: []const u8, pos: usize) !struct { Wasm.Expr, usi |
| 1503 | 1503 | ||
| 1504 | pub fn exprEndPos(bytes: []const u8, pos: usize) error{InvalidInitOpcode}!usize { | 1504 | pub fn exprEndPos(bytes: []const u8, pos: usize) error{InvalidInitOpcode}!usize { |
| 1505 | const opcode = bytes[pos]; | 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 | .i32_const => readLeb(i32, bytes, pos + 1)[1], | 1507 | .i32_const => readLeb(i32, bytes, pos + 1)[1], |
| 1508 | .i64_const => readLeb(i64, bytes, pos + 1)[1], | 1508 | .i64_const => readLeb(i64, bytes, pos + 1)[1], |
| 1509 | .f32_const => pos + 5, | 1509 | .f32_const => pos + 5, |
src/main.zig+5-5| ... | @@ -140,8 +140,8 @@ pub fn log( | ... | @@ -140,8 +140,8 @@ pub fn log( |
| 140 | // Hide debug messages unless: | 140 | // Hide debug messages unless: |
| 141 | // * logging enabled with `-Dlog`. | 141 | // * logging enabled with `-Dlog`. |
| 142 | // * the --debug-log arg for the scope has been provided | 142 | // * the --debug-log arg for the scope has been provided |
| 143 | if (@intFromEnum(level) > @intFromEnum(std.options.log_level) or | 143 | if (@backingInt(level) > @backingInt(std.options.log_level) or |
| 144 | @intFromEnum(level) > @intFromEnum(std.log.Level.info)) | 144 | @backingInt(level) > @backingInt(std.log.Level.info)) |
| 145 | { | 145 | { |
| 146 | if (!build_options.enable_logging) return; | 146 | if (!build_options.enable_logging) return; |
| 147 | 147 | ||
| ... | @@ -4420,7 +4420,7 @@ fn serve( | ... | @@ -4420,7 +4420,7 @@ fn serve( |
| 4420 | } | 4420 | } |
| 4421 | }, | 4421 | }, |
| 4422 | else => { | 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,8 +5732,8 @@ fn cmdChangelist(arena: Allocator, io: Io, args: []const []const u8, environ_map |
| 5732 | var it = inst_map.iterator(); | 5732 | var it = inst_map.iterator(); |
| 5733 | while (it.next()) |entry| { | 5733 | while (it.next()) |entry| { |
| 5734 | try stdout_bw.print(" %{d} => %{d}\n", .{ | 5734 | try stdout_bw.print(" %{d} => %{d}\n", .{ |
| 5735 | @intFromEnum(entry.key_ptr.*), | 5735 | @backingInt(entry.key_ptr.*), |
| 5736 | @intFromEnum(entry.value_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,10 +26,10 @@ pub fn renderAsText(gpa: Allocator, tree: ?Ast, zir: Zir, bw: *std.Io.Writer) !v |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | const main_struct_inst: Zir.Inst.Index = .main_struct_inst; | 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 | try writer.writeInstToStream(bw, main_struct_inst); | 30 | try writer.writeInstToStream(bw, main_struct_inst); |
| 31 | try bw.writeAll("\n"); | 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 | if (imports_index != 0) { | 33 | if (imports_index != 0) { |
| 34 | try bw.writeAll("Imports:\n"); | 34 | try bw.writeAll("Imports:\n"); |
| 35 | 35 | ||
| ... | @@ -75,7 +75,7 @@ pub fn renderInstructionContext( | ... | @@ -75,7 +75,7 @@ pub fn renderInstructionContext( |
| 75 | 75 | ||
| 76 | try writer.writeBody(bw, block[0..block_index]); | 76 | try writer.writeBody(bw, block[0..block_index]); |
| 77 | try bw.splatByteAll(' ', writer.indent - 2); | 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 | try writer.writeInstToStream(bw, block[block_index]); | 79 | try writer.writeInstToStream(bw, block[block_index]); |
| 80 | try bw.writeByte('\n'); | 80 | try bw.writeByte('\n'); |
| 81 | if (block_index + 1 < block.len) { | 81 | if (block_index + 1 < block.len) { |
| ... | @@ -105,7 +105,7 @@ pub fn renderSingleInstruction( | ... | @@ -105,7 +105,7 @@ pub fn renderSingleInstruction( |
| 105 | .recurse_blocks = false, | 105 | .recurse_blocks = false, |
| 106 | }; | 106 | }; |
| 107 | 107 | ||
| 108 | try bw.print("%{d} ", .{@intFromEnum(inst)}); | 108 | try bw.print("%{d} ", .{@backingInt(inst)}); |
| 109 | try writer.writeInstToStream(bw, inst); | 109 | try writer.writeInstToStream(bw, inst); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| ... | @@ -184,8 +184,8 @@ const Writer = struct { | ... | @@ -184,8 +184,8 @@ const Writer = struct { |
| 184 | inst: Zir.Inst.Index, | 184 | inst: Zir.Inst.Index, |
| 185 | ) Error!void { | 185 | ) Error!void { |
| 186 | const tags = self.code.instructions.items(.tag); | 186 | const tags = self.code.instructions.items(.tag); |
| 187 | const tag = tags[@intFromEnum(inst)]; | 187 | const tag = tags[@backingInt(inst)]; |
| 188 | try stream.print("= {s}(", .{@tagName(tags[@intFromEnum(inst)])}); | 188 | try stream.print("= {s}(", .{@tagName(tags[@backingInt(inst)])}); |
| 189 | switch (tag) { | 189 | switch (tag) { |
| 190 | .alloc, | 190 | .alloc, |
| 191 | .alloc_mut, | 191 | .alloc_mut, |
| ... | @@ -510,7 +510,7 @@ const Writer = struct { | ... | @@ -510,7 +510,7 @@ const Writer = struct { |
| 510 | } | 510 | } |
| 511 | 511 | ||
| 512 | fn writeExtended(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | try stream.print("{s}(", .{@tagName(extended.opcode)}); | 514 | try stream.print("{s}(", .{@tagName(extended.opcode)}); |
| 515 | switch (extended.opcode) { | 515 | switch (extended.opcode) { |
| 516 | .this, | 516 | .this, |
| ... | @@ -593,7 +593,7 @@ const Writer = struct { | ... | @@ -593,7 +593,7 @@ const Writer = struct { |
| 593 | }, | 593 | }, |
| 594 | 594 | ||
| 595 | .round_op => { | 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 | const inst_data = self.code.extraData(Zir.Inst.BinNode, extended.operand).data; | 597 | const inst_data = self.code.extraData(Zir.Inst.BinNode, extended.operand).data; |
| 598 | try stream.print("{s}, ", .{@tagName(round_op)}); | 598 | try stream.print("{s}, ", .{@tagName(round_op)}); |
| 599 | try self.writeInstRef(stream, inst_data.lhs); | 599 | try self.writeInstRef(stream, inst_data.lhs); |
| ... | @@ -604,7 +604,7 @@ const Writer = struct { | ... | @@ -604,7 +604,7 @@ const Writer = struct { |
| 604 | }, | 604 | }, |
| 605 | 605 | ||
| 606 | .reify_slice_arg_ty => { | 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 | const extra = self.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 608 | const extra = self.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 609 | try stream.print("{t}, ", .{reify_slice_arg_info}); | 609 | try stream.print("{t}, ", .{reify_slice_arg_info}); |
| 610 | try self.writeInstRef(stream, extra.operand); | 610 | try self.writeInstRef(stream, extra.operand); |
| ... | @@ -638,7 +638,7 @@ const Writer = struct { | ... | @@ -638,7 +638,7 @@ const Writer = struct { |
| 638 | }, | 638 | }, |
| 639 | .reify_struct => { | 639 | .reify_struct => { |
| 640 | const extra = self.code.extraData(Zir.Inst.ReifyStruct, extended.operand).data; | 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 | try stream.print("line({d}), {t}, ", .{ extra.src_line, name_strat }); | 642 | try stream.print("line({d}), {t}, ", .{ extra.src_line, name_strat }); |
| 643 | try self.writeInstRef(stream, extra.layout); | 643 | try self.writeInstRef(stream, extra.layout); |
| 644 | try stream.writeAll(", "); | 644 | try stream.writeAll(", "); |
| ... | @@ -657,7 +657,7 @@ const Writer = struct { | ... | @@ -657,7 +657,7 @@ const Writer = struct { |
| 657 | }, | 657 | }, |
| 658 | .reify_union => { | 658 | .reify_union => { |
| 659 | const extra = self.code.extraData(Zir.Inst.ReifyUnion, extended.operand).data; | 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 | try stream.print("line({d}), {t}, ", .{ extra.src_line, name_strat }); | 661 | try stream.print("line({d}), {t}, ", .{ extra.src_line, name_strat }); |
| 662 | try self.writeInstRef(stream, extra.layout); | 662 | try self.writeInstRef(stream, extra.layout); |
| 663 | try stream.writeAll(", "); | 663 | try stream.writeAll(", "); |
| ... | @@ -676,7 +676,7 @@ const Writer = struct { | ... | @@ -676,7 +676,7 @@ const Writer = struct { |
| 676 | }, | 676 | }, |
| 677 | .reify_enum => { | 677 | .reify_enum => { |
| 678 | const extra = self.code.extraData(Zir.Inst.ReifyEnum, extended.operand).data; | 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 | try stream.print("line({d}), {t}, ", .{ extra.src_line, name_strat }); | 680 | try stream.print("line({d}), {t}, ", .{ extra.src_line, name_strat }); |
| 681 | try self.writeInstRef(stream, extra.tag_ty); | 681 | try self.writeInstRef(stream, extra.tag_ty); |
| 682 | try stream.writeAll(", "); | 682 | try stream.writeAll(", "); |
| ... | @@ -719,14 +719,14 @@ const Writer = struct { | ... | @@ -719,14 +719,14 @@ const Writer = struct { |
| 719 | 719 | ||
| 720 | fn writeExtNode(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { | 720 | fn writeExtNode(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 721 | try stream.writeAll(")) "); | 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 | try self.writeSrcNode(stream, src_node); | 723 | try self.writeSrcNode(stream, src_node); |
| 724 | } | 724 | } |
| 725 | 725 | ||
| 726 | fn writeArrayInitElemType(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | try self.writeInstRef(stream, inst_data.lhs); | 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 | fn writeUnNode( | 732 | fn writeUnNode( |
| ... | @@ -734,7 +734,7 @@ const Writer = struct { | ... | @@ -734,7 +734,7 @@ const Writer = struct { |
| 734 | stream: *std.Io.Writer, | 734 | stream: *std.Io.Writer, |
| 735 | inst: Zir.Inst.Index, | 735 | inst: Zir.Inst.Index, |
| 736 | ) Error!void { | 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 | try self.writeInstRef(stream, inst_data.operand); | 738 | try self.writeInstRef(stream, inst_data.operand); |
| 739 | try stream.writeAll(") "); | 739 | try stream.writeAll(") "); |
| 740 | try self.writeSrcNode(stream, inst_data.src_node); | 740 | try self.writeSrcNode(stream, inst_data.src_node); |
| ... | @@ -745,7 +745,7 @@ const Writer = struct { | ... | @@ -745,7 +745,7 @@ const Writer = struct { |
| 745 | stream: *std.Io.Writer, | 745 | stream: *std.Io.Writer, |
| 746 | inst: Zir.Inst.Index, | 746 | inst: Zir.Inst.Index, |
| 747 | ) Error!void { | 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 | try self.writeInstRef(stream, inst_data.operand); | 749 | try self.writeInstRef(stream, inst_data.operand); |
| 750 | try stream.writeAll(") "); | 750 | try stream.writeAll(") "); |
| 751 | try self.writeSrcTok(stream, inst_data.src_tok); | 751 | try self.writeSrcTok(stream, inst_data.src_tok); |
| ... | @@ -756,7 +756,7 @@ const Writer = struct { | ... | @@ -756,7 +756,7 @@ const Writer = struct { |
| 756 | stream: *std.Io.Writer, | 756 | stream: *std.Io.Writer, |
| 757 | inst: Zir.Inst.Index, | 757 | inst: Zir.Inst.Index, |
| 758 | ) Error!void { | 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 | const extra = self.code.extraData(Zir.Inst.ValidateDestructure, inst_data.payload_index).data; | 760 | const extra = self.code.extraData(Zir.Inst.ValidateDestructure, inst_data.payload_index).data; |
| 761 | try self.writeInstRef(stream, extra.operand); | 761 | try self.writeInstRef(stream, extra.operand); |
| 762 | try stream.print(", {d}) (destructure=", .{extra.expect_len}); | 762 | try stream.print(", {d}) (destructure=", .{extra.expect_len}); |
| ... | @@ -770,7 +770,7 @@ const Writer = struct { | ... | @@ -770,7 +770,7 @@ const Writer = struct { |
| 770 | stream: *std.Io.Writer, | 770 | stream: *std.Io.Writer, |
| 771 | inst: Zir.Inst.Index, | 771 | inst: Zir.Inst.Index, |
| 772 | ) Error!void { | 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 | const extra = self.code.extraData(Zir.Inst.ArrayInit, inst_data.payload_index).data; | 774 | const extra = self.code.extraData(Zir.Inst.ArrayInit, inst_data.payload_index).data; |
| 775 | try self.writeInstRef(stream, extra.ty); | 775 | try self.writeInstRef(stream, extra.ty); |
| 776 | try stream.print(", {d}) ", .{extra.init_count}); | 776 | try stream.print(", {d}) ", .{extra.init_count}); |
| ... | @@ -782,7 +782,7 @@ const Writer = struct { | ... | @@ -782,7 +782,7 @@ const Writer = struct { |
| 782 | stream: *std.Io.Writer, | 782 | stream: *std.Io.Writer, |
| 783 | inst: Zir.Inst.Index, | 783 | inst: Zir.Inst.Index, |
| 784 | ) Error!void { | 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 | const extra = self.code.extraData(Zir.Inst.ArrayTypeSentinel, inst_data.payload_index).data; | 786 | const extra = self.code.extraData(Zir.Inst.ArrayTypeSentinel, inst_data.payload_index).data; |
| 787 | try self.writeInstRef(stream, extra.len); | 787 | try self.writeInstRef(stream, extra.len); |
| 788 | try stream.writeAll(", "); | 788 | try stream.writeAll(", "); |
| ... | @@ -798,7 +798,7 @@ const Writer = struct { | ... | @@ -798,7 +798,7 @@ const Writer = struct { |
| 798 | stream: *std.Io.Writer, | 798 | stream: *std.Io.Writer, |
| 799 | inst: Zir.Inst.Index, | 799 | inst: Zir.Inst.Index, |
| 800 | ) Error!void { | 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 | const str_allowzero = if (inst_data.flags.is_allowzero) "allowzero, " else ""; | 802 | const str_allowzero = if (inst_data.flags.is_allowzero) "allowzero, " else ""; |
| 803 | const str_const = if (!inst_data.flags.is_mutable) "const, " else ""; | 803 | const str_const = if (!inst_data.flags.is_mutable) "const, " else ""; |
| 804 | const str_volatile = if (inst_data.flags.is_volatile) "volatile, " else ""; | 804 | const str_volatile = if (inst_data.flags.is_volatile) "volatile, " else ""; |
| ... | @@ -813,25 +813,25 @@ const Writer = struct { | ... | @@ -813,25 +813,25 @@ const Writer = struct { |
| 813 | var extra_index = extra.end; | 813 | var extra_index = extra.end; |
| 814 | if (inst_data.flags.has_sentinel) { | 814 | if (inst_data.flags.has_sentinel) { |
| 815 | try stream.writeAll(", "); | 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 | extra_index += 1; | 817 | extra_index += 1; |
| 818 | } | 818 | } |
| 819 | if (inst_data.flags.has_align) { | 819 | if (inst_data.flags.has_align) { |
| 820 | try stream.writeAll(", align("); | 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 | extra_index += 1; | 822 | extra_index += 1; |
| 823 | if (inst_data.flags.has_bit_range) { | 823 | if (inst_data.flags.has_bit_range) { |
| 824 | const bit_start = extra_index + @intFromBool(inst_data.flags.has_addrspace); | 824 | const bit_start = extra_index + @intFromBool(inst_data.flags.has_addrspace); |
| 825 | try stream.writeAll(":"); | 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 | try stream.writeAll(":"); | 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 | try stream.writeAll(")"); | 830 | try stream.writeAll(")"); |
| 831 | } | 831 | } |
| 832 | if (inst_data.flags.has_addrspace) { | 832 | if (inst_data.flags.has_addrspace) { |
| 833 | try stream.writeAll(", addrspace("); | 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 | try stream.writeAll(")"); | 835 | try stream.writeAll(")"); |
| 836 | } | 836 | } |
| 837 | try stream.writeAll(") "); | 837 | try stream.writeAll(") "); |
| ... | @@ -839,14 +839,14 @@ const Writer = struct { | ... | @@ -839,14 +839,14 @@ const Writer = struct { |
| 839 | } | 839 | } |
| 840 | 840 | ||
| 841 | fn writeInt(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | try stream.print("{d})", .{inst_data}); | 843 | try stream.print("{d})", .{inst_data}); |
| 844 | } | 844 | } |
| 845 | 845 | ||
| 846 | fn writeIntBig(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const byte_count = inst_data.len * @sizeOf(std.math.big.Limb); | 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 | // limb_bytes is not aligned properly; we must allocate and copy the bytes | 850 | // limb_bytes is not aligned properly; we must allocate and copy the bytes |
| 851 | // in order to accomplish this. | 851 | // in order to accomplish this. |
| 852 | const limbs = try self.gpa.alloc(std.math.big.Limb, inst_data.len); | 852 | const limbs = try self.gpa.alloc(std.math.big.Limb, inst_data.len); |
| ... | @@ -863,12 +863,12 @@ const Writer = struct { | ... | @@ -863,12 +863,12 @@ const Writer = struct { |
| 863 | } | 863 | } |
| 864 | 864 | ||
| 865 | fn writeFloat(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | try stream.print("{d})", .{number}); | 867 | try stream.print("{d})", .{number}); |
| 868 | } | 868 | } |
| 869 | 869 | ||
| 870 | fn writeFloat128(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.Float128, inst_data.payload_index).data; | 872 | const extra = self.code.extraData(Zir.Inst.Float128, inst_data.payload_index).data; |
| 873 | const number = extra.get(); | 873 | const number = extra.get(); |
| 874 | // TODO improve std.format to be able to print f128 values | 874 | // TODO improve std.format to be able to print f128 values |
| ... | @@ -881,13 +881,13 @@ const Writer = struct { | ... | @@ -881,13 +881,13 @@ const Writer = struct { |
| 881 | stream: *std.Io.Writer, | 881 | stream: *std.Io.Writer, |
| 882 | inst: Zir.Inst.Index, | 882 | inst: Zir.Inst.Index, |
| 883 | ) Error!void { | 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 | const str = inst_data.get(self.code); | 885 | const str = inst_data.get(self.code); |
| 886 | try stream.print("\"{f}\")", .{std.zig.fmtString(str)}); | 886 | try stream.print("\"{f}\")", .{std.zig.fmtString(str)}); |
| 887 | } | 887 | } |
| 888 | 888 | ||
| 889 | fn writeSliceStart(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.SliceStart, inst_data.payload_index).data; | 891 | const extra = self.code.extraData(Zir.Inst.SliceStart, inst_data.payload_index).data; |
| 892 | try self.writeInstRef(stream, extra.lhs); | 892 | try self.writeInstRef(stream, extra.lhs); |
| 893 | try stream.writeAll(", "); | 893 | try stream.writeAll(", "); |
| ... | @@ -897,7 +897,7 @@ const Writer = struct { | ... | @@ -897,7 +897,7 @@ const Writer = struct { |
| 897 | } | 897 | } |
| 898 | 898 | ||
| 899 | fn writeSliceEnd(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.SliceEnd, inst_data.payload_index).data; | 901 | const extra = self.code.extraData(Zir.Inst.SliceEnd, inst_data.payload_index).data; |
| 902 | try self.writeInstRef(stream, extra.lhs); | 902 | try self.writeInstRef(stream, extra.lhs); |
| 903 | try stream.writeAll(", "); | 903 | try stream.writeAll(", "); |
| ... | @@ -909,7 +909,7 @@ const Writer = struct { | ... | @@ -909,7 +909,7 @@ const Writer = struct { |
| 909 | } | 909 | } |
| 910 | 910 | ||
| 911 | fn writeSliceSentinel(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.SliceSentinel, inst_data.payload_index).data; | 913 | const extra = self.code.extraData(Zir.Inst.SliceSentinel, inst_data.payload_index).data; |
| 914 | try self.writeInstRef(stream, extra.lhs); | 914 | try self.writeInstRef(stream, extra.lhs); |
| 915 | try stream.writeAll(", "); | 915 | try stream.writeAll(", "); |
| ... | @@ -923,7 +923,7 @@ const Writer = struct { | ... | @@ -923,7 +923,7 @@ const Writer = struct { |
| 923 | } | 923 | } |
| 924 | 924 | ||
| 925 | fn writeSliceLength(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.SliceLength, inst_data.payload_index).data; | 927 | const extra = self.code.extraData(Zir.Inst.SliceLength, inst_data.payload_index).data; |
| 928 | try self.writeInstRef(stream, extra.lhs); | 928 | try self.writeInstRef(stream, extra.lhs); |
| 929 | try stream.writeAll(", "); | 929 | try stream.writeAll(", "); |
| ... | @@ -939,7 +939,7 @@ const Writer = struct { | ... | @@ -939,7 +939,7 @@ const Writer = struct { |
| 939 | } | 939 | } |
| 940 | 940 | ||
| 941 | fn writeUnionInit(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.UnionInit, inst_data.payload_index).data; | 943 | const extra = self.code.extraData(Zir.Inst.UnionInit, inst_data.payload_index).data; |
| 944 | try self.writeInstRef(stream, extra.union_type); | 944 | try self.writeInstRef(stream, extra.union_type); |
| 945 | try stream.writeAll(", "); | 945 | try stream.writeAll(", "); |
| ... | @@ -951,7 +951,7 @@ const Writer = struct { | ... | @@ -951,7 +951,7 @@ const Writer = struct { |
| 951 | } | 951 | } |
| 952 | 952 | ||
| 953 | fn writeShuffle(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.Shuffle, inst_data.payload_index).data; | 955 | const extra = self.code.extraData(Zir.Inst.Shuffle, inst_data.payload_index).data; |
| 956 | try self.writeInstRef(stream, extra.elem_type); | 956 | try self.writeInstRef(stream, extra.elem_type); |
| 957 | try stream.writeAll(", "); | 957 | try stream.writeAll(", "); |
| ... | @@ -978,7 +978,7 @@ const Writer = struct { | ... | @@ -978,7 +978,7 @@ const Writer = struct { |
| 978 | } | 978 | } |
| 979 | 979 | ||
| 980 | fn writeMulAdd(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.MulAdd, inst_data.payload_index).data; | 982 | const extra = self.code.extraData(Zir.Inst.MulAdd, inst_data.payload_index).data; |
| 983 | try self.writeInstRef(stream, extra.mulend1); | 983 | try self.writeInstRef(stream, extra.mulend1); |
| 984 | try stream.writeAll(", "); | 984 | try stream.writeAll(", "); |
| ... | @@ -990,7 +990,7 @@ const Writer = struct { | ... | @@ -990,7 +990,7 @@ const Writer = struct { |
| 990 | } | 990 | } |
| 991 | 991 | ||
| 992 | fn writeFromBackingInt(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.FromBackingInt, inst_data.payload_index); | 994 | const extra = self.code.extraData(Zir.Inst.FromBackingInt, inst_data.payload_index); |
| 995 | try self.writeInstRef(stream, extra.data.result_type); | 995 | try self.writeInstRef(stream, extra.data.result_type); |
| 996 | try stream.writeAll(", "); | 996 | try stream.writeAll(", "); |
| ... | @@ -1000,7 +1000,7 @@ const Writer = struct { | ... | @@ -1000,7 +1000,7 @@ const Writer = struct { |
| 1000 | } | 1000 | } |
| 1001 | 1001 | ||
| 1002 | fn writeBuiltinCall(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.BuiltinCall, inst_data.payload_index).data; | 1004 | const extra = self.code.extraData(Zir.Inst.BuiltinCall, inst_data.payload_index).data; |
| 1005 | 1005 | ||
| 1006 | try self.writeFlag(stream, "nodiscard ", extra.flags.ensure_result_used); | 1006 | try self.writeFlag(stream, "nodiscard ", extra.flags.ensure_result_used); |
| ... | @@ -1033,7 +1033,7 @@ const Writer = struct { | ... | @@ -1033,7 +1033,7 @@ const Writer = struct { |
| 1033 | } | 1033 | } |
| 1034 | 1034 | ||
| 1035 | fn writeParam(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.Param, inst_data.payload_index); | 1037 | const extra = self.code.extraData(Zir.Inst.Param, inst_data.payload_index); |
| 1038 | const body = self.code.bodySlice(extra.end, extra.data.type.body_len); | 1038 | const body = self.code.bodySlice(extra.end, extra.data.type.body_len); |
| 1039 | try stream.print("\"{f}\", ", .{ | 1039 | try stream.print("\"{f}\", ", .{ |
| ... | @@ -1048,7 +1048,7 @@ const Writer = struct { | ... | @@ -1048,7 +1048,7 @@ const Writer = struct { |
| 1048 | } | 1048 | } |
| 1049 | 1049 | ||
| 1050 | fn writePlNodeBin(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 1052 | const extra = self.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 1053 | try self.writeInstRef(stream, extra.lhs); | 1053 | try self.writeInstRef(stream, extra.lhs); |
| 1054 | try stream.writeAll(", "); | 1054 | try stream.writeAll(", "); |
| ... | @@ -1058,7 +1058,7 @@ const Writer = struct { | ... | @@ -1058,7 +1058,7 @@ const Writer = struct { |
| 1058 | } | 1058 | } |
| 1059 | 1059 | ||
| 1060 | fn writePlNodeMultiOp(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); | 1062 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 1063 | const args = self.code.refSlice(extra.end, extra.data.operands_len); | 1063 | const args = self.code.refSlice(extra.end, extra.data.operands_len); |
| 1064 | try stream.writeAll("{"); | 1064 | try stream.writeAll("{"); |
| ... | @@ -1071,13 +1071,13 @@ const Writer = struct { | ... | @@ -1071,13 +1071,13 @@ const Writer = struct { |
| 1071 | } | 1071 | } |
| 1072 | 1072 | ||
| 1073 | fn writeElemValImm(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | try self.writeInstRef(stream, inst_data.operand); | 1075 | try self.writeInstRef(stream, inst_data.operand); |
| 1076 | try stream.print(", {d})", .{inst_data.idx}); | 1076 | try stream.print(", {d})", .{inst_data.idx}); |
| 1077 | } | 1077 | } |
| 1078 | 1078 | ||
| 1079 | fn writeArrayInitElemPtr(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.ElemPtrImm, inst_data.payload_index).data; | 1081 | const extra = self.code.extraData(Zir.Inst.ElemPtrImm, inst_data.payload_index).data; |
| 1082 | 1082 | ||
| 1083 | try self.writeInstRef(stream, extra.ptr); | 1083 | try self.writeInstRef(stream, extra.ptr); |
| ... | @@ -1086,7 +1086,7 @@ const Writer = struct { | ... | @@ -1086,7 +1086,7 @@ const Writer = struct { |
| 1086 | } | 1086 | } |
| 1087 | 1087 | ||
| 1088 | fn writePlNodeExport(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.Export, inst_data.payload_index).data; | 1090 | const extra = self.code.extraData(Zir.Inst.Export, inst_data.payload_index).data; |
| 1091 | 1091 | ||
| 1092 | try self.writeInstRef(stream, extra.exported); | 1092 | try self.writeInstRef(stream, extra.exported); |
| ... | @@ -1097,7 +1097,7 @@ const Writer = struct { | ... | @@ -1097,7 +1097,7 @@ const Writer = struct { |
| 1097 | } | 1097 | } |
| 1098 | 1098 | ||
| 1099 | fn writeValidateArrayInitRefTy(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.ArrayInitRefTy, inst_data.payload_index).data; | 1101 | const extra = self.code.extraData(Zir.Inst.ArrayInitRefTy, inst_data.payload_index).data; |
| 1102 | 1102 | ||
| 1103 | try self.writeInstRef(stream, extra.ptr_ty); | 1103 | try self.writeInstRef(stream, extra.ptr_ty); |
| ... | @@ -1107,7 +1107,7 @@ const Writer = struct { | ... | @@ -1107,7 +1107,7 @@ const Writer = struct { |
| 1107 | } | 1107 | } |
| 1108 | 1108 | ||
| 1109 | fn writeStructInit(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.StructInit, inst_data.payload_index); | 1111 | const extra = self.code.extraData(Zir.Inst.StructInit, inst_data.payload_index); |
| 1112 | var field_i: u32 = 0; | 1112 | var field_i: u32 = 0; |
| 1113 | var extra_index = extra.end; | 1113 | var extra_index = extra.end; |
| ... | @@ -1174,7 +1174,7 @@ const Writer = struct { | ... | @@ -1174,7 +1174,7 @@ const Writer = struct { |
| 1174 | } | 1174 | } |
| 1175 | 1175 | ||
| 1176 | fn writeAtomicLoad(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.AtomicLoad, inst_data.payload_index).data; | 1178 | const extra = self.code.extraData(Zir.Inst.AtomicLoad, inst_data.payload_index).data; |
| 1179 | 1179 | ||
| 1180 | try self.writeInstRef(stream, extra.elem_type); | 1180 | try self.writeInstRef(stream, extra.elem_type); |
| ... | @@ -1187,7 +1187,7 @@ const Writer = struct { | ... | @@ -1187,7 +1187,7 @@ const Writer = struct { |
| 1187 | } | 1187 | } |
| 1188 | 1188 | ||
| 1189 | fn writeAtomicStore(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.AtomicStore, inst_data.payload_index).data; | 1191 | const extra = self.code.extraData(Zir.Inst.AtomicStore, inst_data.payload_index).data; |
| 1192 | 1192 | ||
| 1193 | try self.writeInstRef(stream, extra.ptr); | 1193 | try self.writeInstRef(stream, extra.ptr); |
| ... | @@ -1200,7 +1200,7 @@ const Writer = struct { | ... | @@ -1200,7 +1200,7 @@ const Writer = struct { |
| 1200 | } | 1200 | } |
| 1201 | 1201 | ||
| 1202 | fn writeAtomicRmw(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.AtomicRmw, inst_data.payload_index).data; | 1204 | const extra = self.code.extraData(Zir.Inst.AtomicRmw, inst_data.payload_index).data; |
| 1205 | 1205 | ||
| 1206 | try self.writeInstRef(stream, extra.ptr); | 1206 | try self.writeInstRef(stream, extra.ptr); |
| ... | @@ -1215,7 +1215,7 @@ const Writer = struct { | ... | @@ -1215,7 +1215,7 @@ const Writer = struct { |
| 1215 | } | 1215 | } |
| 1216 | 1216 | ||
| 1217 | fn writeStructInitAnon(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.StructInitAnon, inst_data.payload_index); | 1219 | const extra = self.code.extraData(Zir.Inst.StructInitAnon, inst_data.payload_index); |
| 1220 | var field_i: u32 = 0; | 1220 | var field_i: u32 = 0; |
| 1221 | var extra_index = extra.end; | 1221 | var extra_index = extra.end; |
| ... | @@ -1236,7 +1236,7 @@ const Writer = struct { | ... | @@ -1236,7 +1236,7 @@ const Writer = struct { |
| 1236 | } | 1236 | } |
| 1237 | 1237 | ||
| 1238 | fn writeStructInitFieldType(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data; | 1240 | const extra = self.code.extraData(Zir.Inst.FieldType, inst_data.payload_index).data; |
| 1241 | try self.writeInstRef(stream, extra.container_type); | 1241 | try self.writeInstRef(stream, extra.container_type); |
| 1242 | const field_name = self.code.nullTerminatedString(extra.name_start); | 1242 | const field_name = self.code.nullTerminatedString(extra.name_start); |
| ... | @@ -1245,7 +1245,7 @@ const Writer = struct { | ... | @@ -1245,7 +1245,7 @@ const Writer = struct { |
| 1245 | } | 1245 | } |
| 1246 | 1246 | ||
| 1247 | fn writeFieldTypeRef(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.FieldTypeRef, inst_data.payload_index).data; | 1249 | const extra = self.code.extraData(Zir.Inst.FieldTypeRef, inst_data.payload_index).data; |
| 1250 | try self.writeInstRef(stream, extra.container_type); | 1250 | try self.writeInstRef(stream, extra.container_type); |
| 1251 | try stream.writeAll(", "); | 1251 | try stream.writeAll(", "); |
| ... | @@ -1271,7 +1271,7 @@ const Writer = struct { | ... | @@ -1271,7 +1271,7 @@ const Writer = struct { |
| 1271 | stream: *std.Io.Writer, | 1271 | stream: *std.Io.Writer, |
| 1272 | inst: Zir.Inst.Index, | 1272 | inst: Zir.Inst.Index, |
| 1273 | ) Error!void { | 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 | try self.writeInstIndex(stream, inst_data.inst); | 1275 | try self.writeInstIndex(stream, inst_data.inst); |
| 1276 | try stream.writeAll(") "); | 1276 | try stream.writeAll(") "); |
| 1277 | try self.writeSrcNode(stream, inst_data.src_node); | 1277 | try self.writeSrcNode(stream, inst_data.src_node); |
| ... | @@ -1288,7 +1288,7 @@ const Writer = struct { | ... | @@ -1288,7 +1288,7 @@ const Writer = struct { |
| 1288 | 1288 | ||
| 1289 | try self.writeFlag(stream, "volatile, ", small.is_volatile); | 1289 | try self.writeFlag(stream, "volatile, ", small.is_volatile); |
| 1290 | if (tmpl_is_expr) { | 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 | } else { | 1292 | } else { |
| 1293 | const asm_source = self.code.nullTerminatedString(extra.data.asm_source); | 1293 | const asm_source = self.code.nullTerminatedString(extra.data.asm_source); |
| 1294 | try stream.print("\"{f}\"", .{std.zig.fmtString(asm_source)}); | 1294 | try stream.print("\"{f}\"", .{std.zig.fmtString(asm_source)}); |
| ... | @@ -1354,7 +1354,7 @@ const Writer = struct { | ... | @@ -1354,7 +1354,7 @@ const Writer = struct { |
| 1354 | inst: Zir.Inst.Index, | 1354 | inst: Zir.Inst.Index, |
| 1355 | comptime kind: enum { direct, field }, | 1355 | comptime kind: enum { direct, field }, |
| 1356 | ) !void { | 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 | const ExtraType = switch (kind) { | 1358 | const ExtraType = switch (kind) { |
| 1359 | .direct => Zir.Inst.Call, | 1359 | .direct => Zir.Inst.Call, |
| 1360 | .field => Zir.Inst.FieldCall, | 1360 | .field => Zir.Inst.FieldCall, |
| ... | @@ -1366,7 +1366,7 @@ const Writer = struct { | ... | @@ -1366,7 +1366,7 @@ const Writer = struct { |
| 1366 | if (extra.data.flags.ensure_result_used) { | 1366 | if (extra.data.flags.ensure_result_used) { |
| 1367 | try stream.writeAll("nodiscard "); | 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 | switch (kind) { | 1370 | switch (kind) { |
| 1371 | .direct => try self.writeInstRef(stream, extra.data.callee), | 1371 | .direct => try self.writeInstRef(stream, extra.data.callee), |
| 1372 | .field => { | 1372 | .field => { |
| ... | @@ -1402,7 +1402,7 @@ const Writer = struct { | ... | @@ -1402,7 +1402,7 @@ const Writer = struct { |
| 1402 | } | 1402 | } |
| 1403 | 1403 | ||
| 1404 | fn writeBlock(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.Block, inst_data.payload_index); | 1406 | const extra = self.code.extraData(Zir.Inst.Block, inst_data.payload_index); |
| 1407 | const body = self.code.bodySlice(extra.end, extra.data.body_len); | 1407 | const body = self.code.bodySlice(extra.end, extra.data.body_len); |
| 1408 | try self.writeBracedBody(stream, body); | 1408 | try self.writeBracedBody(stream, body); |
| ... | @@ -1411,7 +1411,7 @@ const Writer = struct { | ... | @@ -1411,7 +1411,7 @@ const Writer = struct { |
| 1411 | } | 1411 | } |
| 1412 | 1412 | ||
| 1413 | fn writeBlockComptime(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.BlockComptime, inst_data.payload_index); | 1415 | const extra = self.code.extraData(Zir.Inst.BlockComptime, inst_data.payload_index); |
| 1416 | const body = self.code.bodySlice(extra.end, extra.data.body_len); | 1416 | const body = self.code.bodySlice(extra.end, extra.data.body_len); |
| 1417 | try stream.print("reason={s}, ", .{@tagName(extra.data.reason)}); | 1417 | try stream.print("reason={s}, ", .{@tagName(extra.data.reason)}); |
| ... | @@ -1421,7 +1421,7 @@ const Writer = struct { | ... | @@ -1421,7 +1421,7 @@ const Writer = struct { |
| 1421 | } | 1421 | } |
| 1422 | 1422 | ||
| 1423 | fn writeCondBr(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); | 1425 | const extra = self.code.extraData(Zir.Inst.CondBr, inst_data.payload_index); |
| 1426 | const then_body = self.code.bodySlice(extra.end, extra.data.then_body_len); | 1426 | const then_body = self.code.bodySlice(extra.end, extra.data.then_body_len); |
| 1427 | const else_body = self.code.bodySlice(extra.end + then_body.len, extra.data.else_body_len); | 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,7 +1435,7 @@ const Writer = struct { |
| 1435 | } | 1435 | } |
| 1436 | 1436 | ||
| 1437 | fn writeTry(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.Try, inst_data.payload_index); | 1439 | const extra = self.code.extraData(Zir.Inst.Try, inst_data.payload_index); |
| 1440 | const body = self.code.bodySlice(extra.end, extra.data.body_len); | 1440 | const body = self.code.bodySlice(extra.end, extra.data.body_len); |
| 1441 | try self.writeInstRef(stream, extra.data.operand); | 1441 | try self.writeInstRef(stream, extra.data.operand); |
| ... | @@ -1661,9 +1661,9 @@ const Writer = struct { | ... | @@ -1661,9 +1661,9 @@ const Writer = struct { |
| 1661 | extra_index += 2; | 1661 | extra_index += 2; |
| 1662 | 1662 | ||
| 1663 | try stream.print("@\"{d}\": ", .{field_idx}); | 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 | try stream.writeAll(" = "); | 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 | try stream.writeAll(" }) "); | 1669 | try stream.writeAll(" }) "); |
| ... | @@ -1676,7 +1676,7 @@ const Writer = struct { | ... | @@ -1676,7 +1676,7 @@ const Writer = struct { |
| 1676 | stream: *std.Io.Writer, | 1676 | stream: *std.Io.Writer, |
| 1677 | inst: Zir.Inst.Index, | 1677 | inst: Zir.Inst.Index, |
| 1678 | ) !void { | 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 | const extra = self.code.extraData(Zir.Inst.ErrorSetDecl, inst_data.payload_index); | 1680 | const extra = self.code.extraData(Zir.Inst.ErrorSetDecl, inst_data.payload_index); |
| 1681 | 1681 | ||
| 1682 | try stream.writeAll("{\n"); | 1682 | try stream.writeAll("{\n"); |
| ... | @@ -1685,7 +1685,7 @@ const Writer = struct { | ... | @@ -1685,7 +1685,7 @@ const Writer = struct { |
| 1685 | var extra_index = @as(u32, @intCast(extra.end)); | 1685 | var extra_index = @as(u32, @intCast(extra.end)); |
| 1686 | const extra_index_end = extra_index + extra.data.fields_len; | 1686 | const extra_index_end = extra_index + extra.data.fields_len; |
| 1687 | while (extra_index < extra_index_end) : (extra_index += 1) { | 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 | const name = self.code.nullTerminatedString(name_index); | 1689 | const name = self.code.nullTerminatedString(name_index); |
| 1690 | try stream.splatByteAll(' ', self.indent); | 1690 | try stream.splatByteAll(' ', self.indent); |
| 1691 | try stream.print("{f},\n", .{std.zig.fmtIdP(name)}); | 1691 | try stream.print("{f},\n", .{std.zig.fmtIdP(name)}); |
| ... | @@ -1835,7 +1835,7 @@ const Writer = struct { | ... | @@ -1835,7 +1835,7 @@ const Writer = struct { |
| 1835 | } | 1835 | } |
| 1836 | 1836 | ||
| 1837 | fn writePlNodeField(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; | 1839 | const extra = self.code.extraData(Zir.Inst.Field, inst_data.payload_index).data; |
| 1840 | const name = self.code.nullTerminatedString(extra.field_name_start); | 1840 | const name = self.code.nullTerminatedString(extra.field_name_start); |
| 1841 | try self.writeInstRef(stream, extra.lhs); | 1841 | try self.writeInstRef(stream, extra.lhs); |
| ... | @@ -1844,7 +1844,7 @@ const Writer = struct { | ... | @@ -1844,7 +1844,7 @@ const Writer = struct { |
| 1844 | } | 1844 | } |
| 1845 | 1845 | ||
| 1846 | fn writePlNodeFieldNamed(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data; | 1848 | const extra = self.code.extraData(Zir.Inst.FieldNamed, inst_data.payload_index).data; |
| 1849 | try self.writeInstRef(stream, extra.lhs); | 1849 | try self.writeInstRef(stream, extra.lhs); |
| 1850 | try stream.writeAll(", "); | 1850 | try stream.writeAll(", "); |
| ... | @@ -1854,7 +1854,7 @@ const Writer = struct { | ... | @@ -1854,7 +1854,7 @@ const Writer = struct { |
| 1854 | } | 1854 | } |
| 1855 | 1855 | ||
| 1856 | fn writeAs(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.As, inst_data.payload_index).data; | 1858 | const extra = self.code.extraData(Zir.Inst.As, inst_data.payload_index).data; |
| 1859 | try self.writeInstRef(stream, extra.dest_type); | 1859 | try self.writeInstRef(stream, extra.dest_type); |
| 1860 | try stream.writeAll(", "); | 1860 | try stream.writeAll(", "); |
| ... | @@ -1868,7 +1868,7 @@ const Writer = struct { | ... | @@ -1868,7 +1868,7 @@ const Writer = struct { |
| 1868 | stream: *std.Io.Writer, | 1868 | stream: *std.Io.Writer, |
| 1869 | inst: Zir.Inst.Index, | 1869 | inst: Zir.Inst.Index, |
| 1870 | ) Error!void { | 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 | try stream.writeAll(") "); | 1872 | try stream.writeAll(") "); |
| 1873 | try self.writeSrcNode(stream, src_node); | 1873 | try self.writeSrcNode(stream, src_node); |
| 1874 | } | 1874 | } |
| ... | @@ -1878,14 +1878,14 @@ const Writer = struct { | ... | @@ -1878,14 +1878,14 @@ const Writer = struct { |
| 1878 | stream: *std.Io.Writer, | 1878 | stream: *std.Io.Writer, |
| 1879 | inst: Zir.Inst.Index, | 1879 | inst: Zir.Inst.Index, |
| 1880 | ) Error!void { | 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 | const str = inst_data.get(self.code); | 1882 | const str = inst_data.get(self.code); |
| 1883 | try stream.print("\"{f}\") ", .{std.zig.fmtString(str)}); | 1883 | try stream.print("\"{f}\") ", .{std.zig.fmtString(str)}); |
| 1884 | try self.writeSrcTok(stream, inst_data.src_tok); | 1884 | try self.writeSrcTok(stream, inst_data.src_tok); |
| 1885 | } | 1885 | } |
| 1886 | 1886 | ||
| 1887 | fn writeStrOp(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const str = inst_data.getStr(self.code); | 1889 | const str = inst_data.getStr(self.code); |
| 1890 | try self.writeInstRef(stream, inst_data.operand); | 1890 | try self.writeInstRef(stream, inst_data.operand); |
| 1891 | try stream.print(", \"{f}\")", .{std.zig.fmtString(str)}); | 1891 | try stream.print(", \"{f}\")", .{std.zig.fmtString(str)}); |
| ... | @@ -1897,7 +1897,7 @@ const Writer = struct { | ... | @@ -1897,7 +1897,7 @@ const Writer = struct { |
| 1897 | inst: Zir.Inst.Index, | 1897 | inst: Zir.Inst.Index, |
| 1898 | inferred_error_set: bool, | 1898 | inferred_error_set: bool, |
| 1899 | ) !void { | 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 | const extra = self.code.extraData(Zir.Inst.Func, inst_data.payload_index); | 1901 | const extra = self.code.extraData(Zir.Inst.Func, inst_data.payload_index); |
| 1902 | 1902 | ||
| 1903 | var extra_index = extra.end; | 1903 | var extra_index = extra.end; |
| ... | @@ -1909,7 +1909,7 @@ const Writer = struct { | ... | @@ -1909,7 +1909,7 @@ const Writer = struct { |
| 1909 | ret_ty_ref = .void_type; | 1909 | ret_ty_ref = .void_type; |
| 1910 | }, | 1910 | }, |
| 1911 | 1 => { | 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 | extra_index += 1; | 1913 | extra_index += 1; |
| 1914 | }, | 1914 | }, |
| 1915 | else => { | 1915 | else => { |
| ... | @@ -1945,7 +1945,7 @@ const Writer = struct { | ... | @@ -1945,7 +1945,7 @@ const Writer = struct { |
| 1945 | } | 1945 | } |
| 1946 | 1946 | ||
| 1947 | fn writeFuncFancy(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.FuncFancy, inst_data.payload_index); | 1949 | const extra = self.code.extraData(Zir.Inst.FuncFancy, inst_data.payload_index); |
| 1950 | 1950 | ||
| 1951 | var extra_index: usize = extra.end; | 1951 | var extra_index: usize = extra.end; |
| ... | @@ -1960,7 +1960,7 @@ const Writer = struct { | ... | @@ -1960,7 +1960,7 @@ const Writer = struct { |
| 1960 | cc_body = self.code.bodySlice(extra_index, body_len); | 1960 | cc_body = self.code.bodySlice(extra_index, body_len); |
| 1961 | extra_index += cc_body.len; | 1961 | extra_index += cc_body.len; |
| 1962 | } else if (extra.data.bits.has_cc_ref) { | 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 | extra_index += 1; | 1964 | extra_index += 1; |
| 1965 | } | 1965 | } |
| 1966 | if (extra.data.bits.has_ret_ty_body) { | 1966 | if (extra.data.bits.has_ret_ty_body) { |
| ... | @@ -1969,7 +1969,7 @@ const Writer = struct { | ... | @@ -1969,7 +1969,7 @@ const Writer = struct { |
| 1969 | ret_ty_body = self.code.bodySlice(extra_index, body_len); | 1969 | ret_ty_body = self.code.bodySlice(extra_index, body_len); |
| 1970 | extra_index += ret_ty_body.len; | 1970 | extra_index += ret_ty_body.len; |
| 1971 | } else if (extra.data.bits.has_ret_ty_ref) { | 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 | extra_index += 1; | 1973 | extra_index += 1; |
| 1974 | } | 1974 | } |
| 1975 | 1975 | ||
| ... | @@ -2009,12 +2009,12 @@ const Writer = struct { | ... | @@ -2009,12 +2009,12 @@ const Writer = struct { |
| 2009 | 2009 | ||
| 2010 | var extra_index: usize = extra.end; | 2010 | var extra_index: usize = extra.end; |
| 2011 | const type_inst: Zir.Inst.Ref = if (!small.has_type) .none else blk: { | 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 | extra_index += 1; | 2013 | extra_index += 1; |
| 2014 | break :blk type_inst; | 2014 | break :blk type_inst; |
| 2015 | }; | 2015 | }; |
| 2016 | const align_inst: Zir.Inst.Ref = if (!small.has_align) .none else blk: { | 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 | extra_index += 1; | 2018 | extra_index += 1; |
| 2019 | break :blk align_inst; | 2019 | break :blk align_inst; |
| 2020 | }; | 2020 | }; |
| ... | @@ -2040,7 +2040,7 @@ const Writer = struct { | ... | @@ -2040,7 +2040,7 @@ const Writer = struct { |
| 2040 | } | 2040 | } |
| 2041 | 2041 | ||
| 2042 | fn writeBoolBr(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.BoolBr, inst_data.payload_index); | 2044 | const extra = self.code.extraData(Zir.Inst.BoolBr, inst_data.payload_index); |
| 2045 | const body = self.code.bodySlice(extra.end, extra.data.body_len); | 2045 | const body = self.code.bodySlice(extra.end, extra.data.body_len); |
| 2046 | try self.writeInstRef(stream, extra.data.lhs); | 2046 | try self.writeInstRef(stream, extra.data.lhs); |
| ... | @@ -2051,7 +2051,7 @@ const Writer = struct { | ... | @@ -2051,7 +2051,7 @@ const Writer = struct { |
| 2051 | } | 2051 | } |
| 2052 | 2052 | ||
| 2053 | fn writeIntType(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const prefix: u8 = switch (int_type.signedness) { | 2055 | const prefix: u8 = switch (int_type.signedness) { |
| 2056 | .signed => 'i', | 2056 | .signed => 'i', |
| 2057 | .unsigned => 'u', | 2057 | .unsigned => 'u', |
| ... | @@ -2061,7 +2061,7 @@ const Writer = struct { | ... | @@ -2061,7 +2061,7 @@ const Writer = struct { |
| 2061 | } | 2061 | } |
| 2062 | 2062 | ||
| 2063 | fn writeSaveErrRetIndex(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | try self.writeInstRef(stream, inst_data.operand); | 2066 | try self.writeInstRef(stream, inst_data.operand); |
| 2067 | 2067 | ||
| ... | @@ -2079,7 +2079,7 @@ const Writer = struct { | ... | @@ -2079,7 +2079,7 @@ const Writer = struct { |
| 2079 | } | 2079 | } |
| 2080 | 2080 | ||
| 2081 | fn writeBreak(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.Break, inst_data.payload_index).data; | 2083 | const extra = self.code.extraData(Zir.Inst.Break, inst_data.payload_index).data; |
| 2084 | 2084 | ||
| 2085 | try self.writeInstIndex(stream, extra.block_inst); | 2085 | try self.writeInstIndex(stream, extra.block_inst); |
| ... | @@ -2089,7 +2089,7 @@ const Writer = struct { | ... | @@ -2089,7 +2089,7 @@ const Writer = struct { |
| 2089 | } | 2089 | } |
| 2090 | 2090 | ||
| 2091 | fn writeArrayInit(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); | 2094 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 2095 | const args = self.code.refSlice(extra.end, extra.data.operands_len); | 2095 | const args = self.code.refSlice(extra.end, extra.data.operands_len); |
| ... | @@ -2105,7 +2105,7 @@ const Writer = struct { | ... | @@ -2105,7 +2105,7 @@ const Writer = struct { |
| 2105 | } | 2105 | } |
| 2106 | 2106 | ||
| 2107 | fn writeArrayInitAnon(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); | 2110 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 2111 | const args = self.code.refSlice(extra.end, extra.data.operands_len); | 2111 | const args = self.code.refSlice(extra.end, extra.data.operands_len); |
| ... | @@ -2120,7 +2120,7 @@ const Writer = struct { | ... | @@ -2120,7 +2120,7 @@ const Writer = struct { |
| 2120 | } | 2120 | } |
| 2121 | 2121 | ||
| 2122 | fn writeArrayInitSent(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); | 2125 | const extra = self.code.extraData(Zir.Inst.MultiOp, inst_data.payload_index); |
| 2126 | const args = self.code.refSlice(extra.end, extra.data.operands_len); | 2126 | const args = self.code.refSlice(extra.end, extra.data.operands_len); |
| ... | @@ -2140,7 +2140,7 @@ const Writer = struct { | ... | @@ -2140,7 +2140,7 @@ const Writer = struct { |
| 2140 | } | 2140 | } |
| 2141 | 2141 | ||
| 2142 | fn writeUnreachable(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | try stream.writeAll(") "); | 2144 | try stream.writeAll(") "); |
| 2145 | try self.writeSrcNode(stream, inst_data.src_node); | 2145 | try self.writeSrcNode(stream, inst_data.src_node); |
| 2146 | } | 2146 | } |
| ... | @@ -2185,12 +2185,12 @@ const Writer = struct { | ... | @@ -2185,12 +2185,12 @@ const Writer = struct { |
| 2185 | } | 2185 | } |
| 2186 | 2186 | ||
| 2187 | fn writeDbgStmt(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | try stream.print("{d}, {d})", .{ inst_data.line + 1, inst_data.column + 1 }); | 2189 | try stream.print("{d}, {d})", .{ inst_data.line + 1, inst_data.column + 1 }); |
| 2190 | } | 2190 | } |
| 2191 | 2191 | ||
| 2192 | fn writeDefer(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const body = self.code.bodySlice(inst_data.index, inst_data.len); | 2194 | const body = self.code.bodySlice(inst_data.index, inst_data.len); |
| 2195 | try self.writeBracedBody(stream, body); | 2195 | try self.writeBracedBody(stream, body); |
| 2196 | try stream.writeByte(')'); | 2196 | try stream.writeByte(')'); |
| ... | @@ -2254,20 +2254,20 @@ const Writer = struct { | ... | @@ -2254,20 +2254,20 @@ const Writer = struct { |
| 2254 | 2254 | ||
| 2255 | fn writeClosureGet(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { | 2255 | fn writeClosureGet(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 2256 | try stream.print("{d})) ", .{extended.small}); | 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 | try self.writeSrcNode(stream, src_node); | 2258 | try self.writeSrcNode(stream, src_node); |
| 2259 | } | 2259 | } |
| 2260 | 2260 | ||
| 2261 | fn writeStdLangValue(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { | 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 | try stream.print("{s})) ", .{@tagName(val)}); | 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 | try self.writeSrcNode(stream, src_node); | 2265 | try self.writeSrcNode(stream, src_node); |
| 2266 | } | 2266 | } |
| 2267 | 2267 | ||
| 2268 | fn writeInplaceArithResultTy(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { | 2268 | fn writeInplaceArithResultTy(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { |
| 2269 | const op: Zir.Inst.InplaceOp = @enumFromInt(extended.small); | 2269 | const op: Zir.Inst.InplaceOp = @fromBackingInt(@intCast(extended.small)); |
| 2270 | try self.writeInstRef(stream, @enumFromInt(extended.operand)); | 2270 | try self.writeInstRef(stream, @fromBackingInt(@intCast(extended.operand))); |
| 2271 | try stream.print(", {s}))", .{@tagName(op)}); | 2271 | try stream.print(", {s}))", .{@tagName(op)}); |
| 2272 | } | 2272 | } |
| 2273 | 2273 | ||
| ... | @@ -2277,14 +2277,14 @@ const Writer = struct { | ... | @@ -2277,14 +2277,14 @@ const Writer = struct { |
| 2277 | } else if (ref.toIndex()) |i| { | 2277 | } else if (ref.toIndex()) |i| { |
| 2278 | return self.writeInstIndex(stream, i); | 2278 | return self.writeInstIndex(stream, i); |
| 2279 | } else { | 2279 | } else { |
| 2280 | const val: InternPool.Index = @enumFromInt(@intFromEnum(ref)); | 2280 | const val: InternPool.Index = @fromBackingInt(@intCast(@backingInt(ref))); |
| 2281 | return stream.print("@{s}", .{@tagName(val)}); | 2281 | return stream.print("@{s}", .{@tagName(val)}); |
| 2282 | } | 2282 | } |
| 2283 | } | 2283 | } |
| 2284 | 2284 | ||
| 2285 | fn writeInstIndex(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 2285 | fn writeInstIndex(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { |
| 2286 | _ = self; | 2286 | _ = self; |
| 2287 | return stream.print("%{d}", .{@intFromEnum(inst)}); | 2287 | return stream.print("%{d}", .{@backingInt(inst)}); |
| 2288 | } | 2288 | } |
| 2289 | 2289 | ||
| 2290 | fn writeCaptures(self: *Writer, stream: *std.Io.Writer, captures: []const Zir.Inst.Capture, capture_names: []const Zir.NullTerminatedString) !void { | 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,14 +2436,14 @@ const Writer = struct { |
| 2436 | fn writeBody(self: *Writer, stream: *std.Io.Writer, body: []const Zir.Inst.Index) !void { | 2436 | fn writeBody(self: *Writer, stream: *std.Io.Writer, body: []const Zir.Inst.Index) !void { |
| 2437 | for (body) |inst| { | 2437 | for (body) |inst| { |
| 2438 | try stream.splatByteAll(' ', self.indent); | 2438 | try stream.splatByteAll(' ', self.indent); |
| 2439 | try stream.print("%{d} ", .{@intFromEnum(inst)}); | 2439 | try stream.print("%{d} ", .{@backingInt(inst)}); |
| 2440 | try self.writeInstToStream(stream, inst); | 2440 | try self.writeInstToStream(stream, inst); |
| 2441 | try stream.writeByte('\n'); | 2441 | try stream.writeByte('\n'); |
| 2442 | } | 2442 | } |
| 2443 | } | 2443 | } |
| 2444 | 2444 | ||
| 2445 | fn writeImport(self: *Writer, stream: *std.Io.Writer, inst: Zir.Inst.Index) !void { | 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 | const extra = self.code.extraData(Zir.Inst.Import, inst_data.payload_index).data; | 2447 | const extra = self.code.extraData(Zir.Inst.Import, inst_data.payload_index).data; |
| 2448 | try self.writeInstRef(stream, extra.res_ty); | 2448 | try self.writeInstRef(stream, extra.res_ty); |
| 2449 | const import_path = self.code.nullTerminatedString(extra.path); | 2449 | const import_path = self.code.nullTerminatedString(extra.path); |
src/print_zoir.zig+1-1| ... | @@ -55,7 +55,7 @@ const PrintZon = struct { | ... | @@ -55,7 +55,7 @@ const PrintZon = struct { |
| 55 | 55 | ||
| 56 | fn renderNode(pz: *PrintZon, node: Zoir.Node.Index) Error!void { | 56 | fn renderNode(pz: *PrintZon, node: Zoir.Node.Index) Error!void { |
| 57 | const zoir = pz.zoir; | 57 | const zoir = pz.zoir; |
| 58 | try pz.w.print("%{d} = ", .{@intFromEnum(node)}); | 58 | try pz.w.print("%{d} = ", .{@backingInt(node)}); |
| 59 | switch (node.get(zoir)) { | 59 | switch (node.get(zoir)) { |
| 60 | .true => try pz.w.writeAll("true"), | 60 | .true => try pz.w.writeAll("true"), |
| 61 | .false => try pz.w.writeAll("false"), | 61 | .false => try pz.w.writeAll("false"), |
src/register_manager.zig+6-6| ... | @@ -381,7 +381,7 @@ const MockRegister1 = enum(u2) { | ... | @@ -381,7 +381,7 @@ const MockRegister1 = enum(u2) { |
| 381 | r3, | 381 | r3, |
| 382 | 382 | ||
| 383 | pub fn id(reg: MockRegister1) u2 { | 383 | pub fn id(reg: MockRegister1) u2 { |
| 384 | return @intFromEnum(reg); | 384 | return @backingInt(reg); |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | const allocatable_registers = [_]MockRegister1{ .r2, .r3 }; | 387 | const allocatable_registers = [_]MockRegister1{ .r2, .r3 }; |
| ... | @@ -409,7 +409,7 @@ const MockRegister2 = enum(u2) { | ... | @@ -409,7 +409,7 @@ const MockRegister2 = enum(u2) { |
| 409 | r3, | 409 | r3, |
| 410 | 410 | ||
| 411 | pub fn id(reg: MockRegister2) u2 { | 411 | pub fn id(reg: MockRegister2) u2 { |
| 412 | return @intFromEnum(reg); | 412 | return @backingInt(reg); |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | const allocatable_registers = [_]MockRegister2{ .r0, .r1, .r2, .r3 }; | 415 | const allocatable_registers = [_]MockRegister2{ .r0, .r1, .r2, .r3 }; |
| ... | @@ -441,14 +441,14 @@ const MockRegister3 = enum(u3) { | ... | @@ -441,14 +441,14 @@ const MockRegister3 = enum(u3) { |
| 441 | x3, | 441 | x3, |
| 442 | 442 | ||
| 443 | pub fn id(reg: MockRegister3) u3 { | 443 | pub fn id(reg: MockRegister3) u3 { |
| 444 | return switch (@intFromEnum(reg)) { | 444 | return switch (@backingInt(reg)) { |
| 445 | 0...3 => @as(u3, @as(u2, @truncate(@intFromEnum(reg)))), | 445 | 0...3 => @as(u3, @as(u2, @truncate(@backingInt(reg)))), |
| 446 | 4...7 => @intFromEnum(reg), | 446 | 4...7 => @backingInt(reg), |
| 447 | }; | 447 | }; |
| 448 | } | 448 | } |
| 449 | 449 | ||
| 450 | pub fn enc(reg: MockRegister3) u2 { | 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 | const gp_regs = [_]MockRegister3{ .r0, .r1, .r2, .r3 }; | 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,8 +636,8 @@ pub fn shouldBlockPointerOps(target: *const std.Target, as: AddressSpace) bool { |
| 636 | // Physical pointers always support operations | 636 | // Physical pointers always support operations |
| 637 | .global, .physical_storage_buffer => false, | 637 | .global, .physical_storage_buffer => false, |
| 638 | // Logical pointers that support operations with VariablePointers capability | 638 | // Logical pointers that support operations with VariablePointers capability |
| 639 | .shared => !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(@intFromEnum(std.Target.spirv.Feature.variable_pointers)), | 640 | .storage_buffer => !target.cpu.features.isEnabled(@backingInt(std.Target.spirv.Feature.variable_pointers)), |
| 641 | // Logical pointers that never support operations | 641 | // Logical pointers that never support operations |
| 642 | .constant, | 642 | .constant, |
| 643 | .local, | 643 | .local, |
| ... | @@ -678,7 +678,7 @@ pub fn isDynamicAMDGCNFeature(target: *const std.Target, feature: std.Target.Cpu | ... | @@ -678,7 +678,7 @@ pub fn isDynamicAMDGCNFeature(target: *const std.Target, feature: std.Target.Cpu |
| 678 | &std.Target.amdgcn.cpu.gfx1200, | 678 | &std.Target.amdgcn.cpu.gfx1200, |
| 679 | &std.Target.amdgcn.cpu.gfx1201, | 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 | if (feature_tag == .sramecc) { | 683 | if (feature_tag == .sramecc) { |
| 684 | if (std.mem.indexOfScalar( | 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,11 +372,11 @@ test "Enum constructed by @Enum passed as generic argument" { |
| 372 | alive: bool, | 372 | alive: bool, |
| 373 | }); | 373 | }); |
| 374 | fn foo(comptime a: E, b: u32) !void { | 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 | inline for (@typeInfo(S.E).@"enum".field_names, 0..) |_, i| { | 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,7 +440,7 @@ test "*usize to *void" { |
| 440 | 440 | ||
| 441 | test "@enumFromInt passed a comptime_int to an enum with one item" { | 441 | test "@enumFromInt passed a comptime_int to an enum with one item" { |
| 442 | const E = enum { A }; | 442 | const E = enum { A }; |
| 443 | const x = @as(E, @enumFromInt(0)); | 443 | const x = @as(E, @fromBackingInt(@intCast(0))); |
| 444 | try expect(x == E.A); | 444 | try expect(x == E.A); |
| 445 | } | 445 | } |
| 446 | 446 | ||
| ... | @@ -2709,7 +2709,7 @@ test "cast builtins can wrap result in optional" { | ... | @@ -2709,7 +2709,7 @@ test "cast builtins can wrap result in optional" { |
| 2709 | const S = struct { | 2709 | const S = struct { |
| 2710 | const MyEnum = enum(u32) { _ }; | 2710 | const MyEnum = enum(u32) { _ }; |
| 2711 | fn a() ?MyEnum { | 2711 | fn a() ?MyEnum { |
| 2712 | return @enumFromInt(123); | 2712 | return @fromBackingInt(@intCast(123)); |
| 2713 | } | 2713 | } |
| 2714 | fn b() ?u32 { | 2714 | fn b() ?u32 { |
| 2715 | return @intFromFloat(42.50); | 2715 | return @intFromFloat(42.50); |
| ... | @@ -2728,7 +2728,7 @@ test "cast builtins can wrap result in optional" { | ... | @@ -2728,7 +2728,7 @@ test "cast builtins can wrap result in optional" { |
| 2728 | comptime assert(@TypeOf(rb) == u32); | 2728 | comptime assert(@TypeOf(rb) == u32); |
| 2729 | comptime assert(@TypeOf(rc) == *const f32); | 2729 | comptime assert(@TypeOf(rc) == *const f32); |
| 2730 | 2730 | ||
| 2731 | try expect(@intFromEnum(ra) == 123); | 2731 | try expect(@backingInt(ra) == 123); |
| 2732 | try expect(rb == 42); | 2732 | try expect(rb == 42); |
| 2733 | try expect(@as(*const u32, @ptrCast(rc)).* == 1); | 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,7 +2747,7 @@ test "cast builtins can wrap result in error union" { |
| 2747 | const MyEnum = enum(u32) { _ }; | 2747 | const MyEnum = enum(u32) { _ }; |
| 2748 | const E = error{ImpossibleError}; | 2748 | const E = error{ImpossibleError}; |
| 2749 | fn a() E!MyEnum { | 2749 | fn a() E!MyEnum { |
| 2750 | return @enumFromInt(123); | 2750 | return @fromBackingInt(@intCast(123)); |
| 2751 | } | 2751 | } |
| 2752 | fn b() E!u32 { | 2752 | fn b() E!u32 { |
| 2753 | return @intFromFloat(42.50); | 2753 | return @intFromFloat(42.50); |
| ... | @@ -2766,7 +2766,7 @@ test "cast builtins can wrap result in error union" { | ... | @@ -2766,7 +2766,7 @@ test "cast builtins can wrap result in error union" { |
| 2766 | comptime assert(@TypeOf(rb) == u32); | 2766 | comptime assert(@TypeOf(rb) == u32); |
| 2767 | comptime assert(@TypeOf(rc) == *const f32); | 2767 | comptime assert(@TypeOf(rc) == *const f32); |
| 2768 | 2768 | ||
| 2769 | try expect(@intFromEnum(ra) == 123); | 2769 | try expect(@backingInt(ra) == 123); |
| 2770 | try expect(rb == 42); | 2770 | try expect(rb == 42); |
| 2771 | try expect(@as(*const u32, @ptrCast(rc)).* == 1); | 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,7 +2785,7 @@ test "cast builtins can wrap result in error union and optional" { |
| 2785 | const MyEnum = enum(u32) { _ }; | 2785 | const MyEnum = enum(u32) { _ }; |
| 2786 | const E = error{ImpossibleError}; | 2786 | const E = error{ImpossibleError}; |
| 2787 | fn a() E!?MyEnum { | 2787 | fn a() E!?MyEnum { |
| 2788 | return @enumFromInt(123); | 2788 | return @fromBackingInt(@intCast(123)); |
| 2789 | } | 2789 | } |
| 2790 | fn b() E!?u32 { | 2790 | fn b() E!?u32 { |
| 2791 | return @intFromFloat(42.50); | 2791 | return @intFromFloat(42.50); |
| ... | @@ -2804,7 +2804,7 @@ test "cast builtins can wrap result in error union and optional" { | ... | @@ -2804,7 +2804,7 @@ test "cast builtins can wrap result in error union and optional" { |
| 2804 | comptime assert(@TypeOf(rb) == u32); | 2804 | comptime assert(@TypeOf(rb) == u32); |
| 2805 | comptime assert(@TypeOf(rc) == *const f32); | 2805 | comptime assert(@TypeOf(rc) == *const f32); |
| 2806 | 2806 | ||
| 2807 | try expect(@intFromEnum(ra) == 123); | 2807 | try expect(@backingInt(ra) == 123); |
| 2808 | try expect(rb == 42); | 2808 | try expect(rb == 42); |
| 2809 | try expect(@as(*const u32, @ptrCast(rc)).* == 1); | 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,7 +8,7 @@ const Tag = std.meta.Tag; |
| 8 | const Number = enum { Zero, One, Two, Three, Four }; | 8 | const Number = enum { Zero, One, Two, Three, Four }; |
| 9 | 9 | ||
| 10 | fn shouldEqual(n: Number, expected: u3) !void { | 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 | test "enum to int" { | 14 | test "enum to int" { |
| ... | @@ -20,7 +20,7 @@ test "enum to int" { | ... | @@ -20,7 +20,7 @@ test "enum to int" { |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | fn testEnumFromIntEval(x: i32) !void { | 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 | const EnumFromIntNumber = enum { Zero, One, Two, Three, Four }; | 25 | const EnumFromIntNumber = enum { Zero, One, Two, Three, Four }; |
| 26 | 26 | ||
| ... | @@ -597,7 +597,7 @@ const MultipleChoice = enum(u32) { | ... | @@ -597,7 +597,7 @@ const MultipleChoice = enum(u32) { |
| 597 | }; | 597 | }; |
| 598 | 598 | ||
| 599 | fn testEnumWithSpecifiedTagValues(x: MultipleChoice) !void { | 599 | fn testEnumWithSpecifiedTagValues(x: MultipleChoice) !void { |
| 600 | try expect(@intFromEnum(x) == 60); | 600 | try expect(@backingInt(x) == 60); |
| 601 | try expect(1234 == switch (x) { | 601 | try expect(1234 == switch (x) { |
| 602 | MultipleChoice.A => 1, | 602 | MultipleChoice.A => 1, |
| 603 | MultipleChoice.B => 2, | 603 | MultipleChoice.B => 2, |
| ... | @@ -626,7 +626,7 @@ test "non-exhaustive enum" { | ... | @@ -626,7 +626,7 @@ test "non-exhaustive enum" { |
| 626 | .b => true, | 626 | .b => true, |
| 627 | _ => false, | 627 | _ => false, |
| 628 | }); | 628 | }); |
| 629 | e = @as(E, @enumFromInt(12)); | 629 | e = @as(E, @fromBackingInt(@intCast(12))); |
| 630 | try expect(switch (e) { | 630 | try expect(switch (e) { |
| 631 | .a => false, | 631 | .a => false, |
| 632 | .b => false, | 632 | .b => false, |
| ... | @@ -645,10 +645,10 @@ test "non-exhaustive enum" { | ... | @@ -645,10 +645,10 @@ test "non-exhaustive enum" { |
| 645 | }); | 645 | }); |
| 646 | 646 | ||
| 647 | try expect(@typeInfo(E).@"enum".field_names.len == 2); | 647 | try expect(@typeInfo(E).@"enum".field_names.len == 2); |
| 648 | e = @as(E, @enumFromInt(12)); | 648 | e = @as(E, @fromBackingInt(@intCast(12))); |
| 649 | try expect(@intFromEnum(e) == 12); | 649 | try expect(@backingInt(e) == 12); |
| 650 | e = @as(E, @enumFromInt(y)); | 650 | e = @as(E, @fromBackingInt(@intCast(y))); |
| 651 | try expect(@intFromEnum(e) == 52); | 651 | try expect(@backingInt(e) == 52); |
| 652 | try expect(@typeInfo(E).@"enum".mode == .nonexhaustive); | 652 | try expect(@typeInfo(E).@"enum".mode == .nonexhaustive); |
| 653 | } | 653 | } |
| 654 | }; | 654 | }; |
| ... | @@ -661,12 +661,12 @@ test "empty non-exhaustive enum" { | ... | @@ -661,12 +661,12 @@ test "empty non-exhaustive enum" { |
| 661 | const E = enum(u8) { _ }; | 661 | const E = enum(u8) { _ }; |
| 662 | 662 | ||
| 663 | fn doTheTest(y: u8) !void { | 663 | fn doTheTest(y: u8) !void { |
| 664 | var e: E = @enumFromInt(y); | 664 | var e: E = @fromBackingInt(@intCast(y)); |
| 665 | _ = &e; | 665 | _ = &e; |
| 666 | try expect(switch (e) { | 666 | try expect(switch (e) { |
| 667 | _ => true, | 667 | _ => true, |
| 668 | }); | 668 | }); |
| 669 | try expect(@intFromEnum(e) == y); | 669 | try expect(@backingInt(e) == y); |
| 670 | 670 | ||
| 671 | try expect(@typeInfo(E).@"enum".field_names.len == 0); | 671 | try expect(@typeInfo(E).@"enum".field_names.len == 0); |
| 672 | try expect(@typeInfo(E).@"enum".field_values.len == 0); | 672 | try expect(@typeInfo(E).@"enum".field_values.len == 0); |
| ... | @@ -688,7 +688,7 @@ test "single field non-exhaustive enum" { | ... | @@ -688,7 +688,7 @@ test "single field non-exhaustive enum" { |
| 688 | .a => true, | 688 | .a => true, |
| 689 | _ => false, | 689 | _ => false, |
| 690 | }); | 690 | }); |
| 691 | e = @as(E, @enumFromInt(12)); | 691 | e = @as(E, @fromBackingInt(@intCast(12))); |
| 692 | try expect(switch (e) { | 692 | try expect(switch (e) { |
| 693 | .a => false, | 693 | .a => false, |
| 694 | _ => true, | 694 | _ => true, |
| ... | @@ -704,7 +704,7 @@ test "single field non-exhaustive enum" { | ... | @@ -704,7 +704,7 @@ test "single field non-exhaustive enum" { |
| 704 | else => false, | 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 | try expect(@typeInfo(E).@"enum".field_names.len == 1); | 708 | try expect(@typeInfo(E).@"enum".field_names.len == 1); |
| 709 | try expect(@typeInfo(E).@"enum".field_values.len == 1); | 709 | try expect(@typeInfo(E).@"enum".field_values.len == 1); |
| 710 | try expect(@typeInfo(E).@"enum".mode == .nonexhaustive); | 710 | try expect(@typeInfo(E).@"enum".mode == .nonexhaustive); |
| ... | @@ -721,7 +721,7 @@ const EnumWithTagValues = enum(u4) { | ... | @@ -721,7 +721,7 @@ const EnumWithTagValues = enum(u4) { |
| 721 | D = 1 << 3, | 721 | D = 1 << 3, |
| 722 | }; | 722 | }; |
| 723 | test "enum with tag values don't require parens" { | 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 | const MultipleChoice2 = enum(u32) { | 727 | const MultipleChoice2 = enum(u32) { |
| ... | @@ -737,8 +737,8 @@ const MultipleChoice2 = enum(u32) { | ... | @@ -737,8 +737,8 @@ const MultipleChoice2 = enum(u32) { |
| 737 | }; | 737 | }; |
| 738 | 738 | ||
| 739 | test "cast integer literal to enum" { | 739 | test "cast integer literal to enum" { |
| 740 | try expect(@as(MultipleChoice2, @enumFromInt(0)) == MultipleChoice2.Unspecified1); | 740 | try expect(@as(MultipleChoice2, @fromBackingInt(@intCast(0))) == MultipleChoice2.Unspecified1); |
| 741 | try expect(@as(MultipleChoice2, @enumFromInt(40)) == MultipleChoice2.B); | 741 | try expect(@as(MultipleChoice2, @fromBackingInt(@intCast(40))) == MultipleChoice2.B); |
| 742 | } | 742 | } |
| 743 | 743 | ||
| 744 | test "enum with specified and unspecified tag values" { | 744 | test "enum with specified and unspecified tag values" { |
| ... | @@ -749,7 +749,7 @@ 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 | fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { | 751 | fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { |
| 752 | try expect(@intFromEnum(x) == 1000); | 752 | try expect(@backingInt(x) == 1000); |
| 753 | try expect(1234 == switch (x) { | 753 | try expect(1234 == switch (x) { |
| 754 | MultipleChoice2.A => 1, | 754 | MultipleChoice2.A => 1, |
| 755 | MultipleChoice2.B => 2, | 755 | MultipleChoice2.B => 2, |
| ... | @@ -785,7 +785,7 @@ test "casting enum to its tag type" { | ... | @@ -785,7 +785,7 @@ test "casting enum to its tag type" { |
| 785 | } | 785 | } |
| 786 | 786 | ||
| 787 | fn testCastEnumTag(value: Small2) !void { | 787 | fn testCastEnumTag(value: Small2) !void { |
| 788 | try expect(@intFromEnum(value) == 1); | 788 | try expect(@backingInt(value) == 1); |
| 789 | } | 789 | } |
| 790 | 790 | ||
| 791 | test "enum with 1 field but explicit tag type should still have the tag type" { | 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,27 +802,27 @@ test "signed integer as enum tag" { |
| 802 | A2 = 1, | 802 | A2 = 1, |
| 803 | }; | 803 | }; |
| 804 | 804 | ||
| 805 | try expect(@intFromEnum(SignedEnum.A0) == -1); | 805 | try expect(@backingInt(SignedEnum.A0) == -1); |
| 806 | try expect(@intFromEnum(SignedEnum.A1) == 0); | 806 | try expect(@backingInt(SignedEnum.A1) == 0); |
| 807 | try expect(@intFromEnum(SignedEnum.A2) == 1); | 807 | try expect(@backingInt(SignedEnum.A2) == 1); |
| 808 | } | 808 | } |
| 809 | 809 | ||
| 810 | test "enum with one member and custom tag type" { | 810 | test "enum with one member and custom tag type" { |
| 811 | const E = enum(u2) { | 811 | const E = enum(u2) { |
| 812 | One, | 812 | One, |
| 813 | }; | 813 | }; |
| 814 | try expect(@intFromEnum(E.One) == 0); | 814 | try expect(@backingInt(E.One) == 0); |
| 815 | const E2 = enum(u2) { | 815 | const E2 = enum(u2) { |
| 816 | One = 2, | 816 | One = 2, |
| 817 | }; | 817 | }; |
| 818 | try expect(@intFromEnum(E2.One) == 2); | 818 | try expect(@backingInt(E2.One) == 2); |
| 819 | } | 819 | } |
| 820 | 820 | ||
| 821 | test "enum with one member and u1 tag type @intFromEnum" { | 821 | test "enum with one member and u1 tag type @intFromEnum" { |
| 822 | const Enum = enum(u1) { | 822 | const Enum = enum(u1) { |
| 823 | Test, | 823 | Test, |
| 824 | }; | 824 | }; |
| 825 | try expect(@intFromEnum(Enum.Test) == 0); | 825 | try expect(@backingInt(Enum.Test) == 0); |
| 826 | } | 826 | } |
| 827 | 827 | ||
| 828 | test "enum with one member default to u0 tag type" { | 828 | test "enum with one member default to u0 tag type" { |
| ... | @@ -886,9 +886,9 @@ test "enum value allocation" { | ... | @@ -886,9 +886,9 @@ test "enum value allocation" { |
| 886 | A2, | 886 | A2, |
| 887 | }; | 887 | }; |
| 888 | 888 | ||
| 889 | try expect(@intFromEnum(LargeEnum.A0) == 0x80000000); | 889 | try expect(@backingInt(LargeEnum.A0) == 0x80000000); |
| 890 | try expect(@intFromEnum(LargeEnum.A1) == 0x80000001); | 890 | try expect(@backingInt(LargeEnum.A1) == 0x80000001); |
| 891 | try expect(@intFromEnum(LargeEnum.A2) == 0x80000002); | 891 | try expect(@backingInt(LargeEnum.A2) == 0x80000002); |
| 892 | } | 892 | } |
| 893 | 893 | ||
| 894 | test "enum literal casting to tagged union" { | 894 | test "enum literal casting to tagged union" { |
| ... | @@ -1068,8 +1068,8 @@ test "tag name with large enum values" { | ... | @@ -1068,8 +1068,8 @@ test "tag name with large enum values" { |
| 1068 | var kdf: Kdf = .aes_kdf; | 1068 | var kdf: Kdf = .aes_kdf; |
| 1069 | try expect(mem.eql(u8, @tagName(kdf), "aes_kdf")); | 1069 | try expect(mem.eql(u8, @tagName(kdf), "aes_kdf")); |
| 1070 | var argon2d_value: u128 = undefined; | 1070 | var argon2d_value: u128 = undefined; |
| 1071 | argon2d_value = @intFromEnum(Kdf.argon2d); | 1071 | argon2d_value = @backingInt(Kdf.argon2d); |
| 1072 | kdf = @enumFromInt(argon2d_value); | 1072 | kdf = @fromBackingInt(@intCast(argon2d_value)); |
| 1073 | try expect(mem.eql(u8, @tagName(kdf), "argon2d")); | 1073 | try expect(mem.eql(u8, @tagName(kdf), "argon2d")); |
| 1074 | kdf = .argon2id; | 1074 | kdf = .argon2id; |
| 1075 | try expect(mem.eql(u8, @tagName(kdf), "argon2id")); | 1075 | try expect(mem.eql(u8, @tagName(kdf), "argon2id")); |
| ... | @@ -1343,7 +1343,7 @@ test "runtime int to enum with one possible value" { | ... | @@ -1343,7 +1343,7 @@ test "runtime int to enum with one possible value" { |
| 1343 | const E = enum { one }; | 1343 | const E = enum { one }; |
| 1344 | var runtime: usize = 0; | 1344 | var runtime: usize = 0; |
| 1345 | _ = &runtime; | 1345 | _ = &runtime; |
| 1346 | if (@as(E, @enumFromInt(runtime)) != .one) { | 1346 | if (@as(E, @fromBackingInt(@intCast(runtime))) != .one) { |
| 1347 | @compileError("test failed"); | 1347 | @compileError("test failed"); |
| 1348 | } | 1348 | } |
| 1349 | } | 1349 | } |
| ... | @@ -1354,8 +1354,8 @@ test "enum tag from a local variable" { | ... | @@ -1354,8 +1354,8 @@ test "enum tag from a local variable" { |
| 1354 | return enum(Inner) { _ }; | 1354 | return enum(Inner) { _ }; |
| 1355 | } | 1355 | } |
| 1356 | }; | 1356 | }; |
| 1357 | const i = @as(S.Int(u32), @enumFromInt(0)); | 1357 | const i = @as(S.Int(u32), @fromBackingInt(@intCast(0))); |
| 1358 | try std.testing.expect(@intFromEnum(i) == 0); | 1358 | try std.testing.expect(@backingInt(i) == 0); |
| 1359 | } | 1359 | } |
| 1360 | 1360 | ||
| 1361 | test "auto-numbered enum with signed tag type" { | 1361 | test "auto-numbered enum with signed tag type" { |
| ... | @@ -1363,14 +1363,14 @@ test "auto-numbered enum with signed tag type" { | ... | @@ -1363,14 +1363,14 @@ test "auto-numbered enum with signed tag type" { |
| 1363 | 1363 | ||
| 1364 | const E = enum(i32) { a, b }; | 1364 | const E = enum(i32) { a, b }; |
| 1365 | 1365 | ||
| 1366 | try std.testing.expectEqual(@as(i32, 0), @intFromEnum(E.a)); | 1366 | try std.testing.expectEqual(@as(i32, 0), @backingInt(E.a)); |
| 1367 | try std.testing.expectEqual(@as(i32, 1), @intFromEnum(E.b)); | 1367 | try std.testing.expectEqual(@as(i32, 1), @backingInt(E.b)); |
| 1368 | try std.testing.expectEqual(E.a, @as(E, @enumFromInt(0))); | 1368 | try std.testing.expectEqual(E.a, @as(E, @fromBackingInt(@intCast(0)))); |
| 1369 | try std.testing.expectEqual(E.b, @as(E, @enumFromInt(1))); | 1369 | try std.testing.expectEqual(E.b, @as(E, @fromBackingInt(@intCast(1)))); |
| 1370 | try std.testing.expectEqual(E.a, @as(E, @enumFromInt(@as(i32, 0)))); | 1370 | try std.testing.expectEqual(E.a, @as(E, @fromBackingInt(@intCast(@as(i32, 0))))); |
| 1371 | try std.testing.expectEqual(E.b, @as(E, @enumFromInt(@as(i32, 1)))); | 1371 | try std.testing.expectEqual(E.b, @as(E, @fromBackingInt(@intCast(@as(i32, 1))))); |
| 1372 | try std.testing.expectEqual(E.a, @as(E, @enumFromInt(@as(u32, 0)))); | 1372 | try std.testing.expectEqual(E.a, @as(E, @fromBackingInt(@intCast(@as(u32, 0))))); |
| 1373 | try std.testing.expectEqual(E.b, @as(E, @enumFromInt(@as(u32, 1)))); | 1373 | try std.testing.expectEqual(E.b, @as(E, @fromBackingInt(@intCast(@as(u32, 1))))); |
| 1374 | try std.testing.expectEqualStrings("a", @tagName(E.a)); | 1374 | try std.testing.expectEqualStrings("a", @tagName(E.a)); |
| 1375 | try std.testing.expectEqualStrings("b", @tagName(E.b)); | 1375 | try std.testing.expectEqualStrings("b", @tagName(E.b)); |
| 1376 | } | 1376 | } |
| ... | @@ -1382,7 +1382,7 @@ test "lazy initialized field" { | ... | @@ -1382,7 +1382,7 @@ test "lazy initialized field" { |
| 1382 | fn getLazyInitialized(param: enum(u8) { | 1382 | fn getLazyInitialized(param: enum(u8) { |
| 1383 | a = @bitCast(packed struct(u8) { a: u8 }{ .a = @alignOf(struct {}) }), | 1383 | a = @bitCast(packed struct(u8) { a: u8 }{ .a = @alignOf(struct {}) }), |
| 1384 | }) u8 { | 1384 | }) u8 { |
| 1385 | return @intFromEnum(param); | 1385 | return @backingInt(param); |
| 1386 | } | 1386 | } |
| 1387 | 1387 | ||
| 1388 | test "matching captures causes enum equivalence" { | 1388 | test "matching captures causes enum equivalence" { |
| ... | @@ -1397,10 +1397,10 @@ test "matching captures causes enum equivalence" { | ... | @@ -1397,10 +1397,10 @@ test "matching captures causes enum equivalence" { |
| 1397 | comptime assert(S.Nonexhaustive(u16) == S.Nonexhaustive(i16)); | 1397 | comptime assert(S.Nonexhaustive(u16) == S.Nonexhaustive(i16)); |
| 1398 | comptime assert(S.Nonexhaustive(u8) != S.Nonexhaustive(u16)); | 1398 | comptime assert(S.Nonexhaustive(u8) != S.Nonexhaustive(u16)); |
| 1399 | 1399 | ||
| 1400 | const a: S.Nonexhaustive(u8) = @enumFromInt(123); | 1400 | const a: S.Nonexhaustive(u8) = @fromBackingInt(@intCast(123)); |
| 1401 | const b: S.Nonexhaustive(i8) = @enumFromInt(123); | 1401 | const b: S.Nonexhaustive(i8) = @fromBackingInt(@intCast(123)); |
| 1402 | comptime assert(@TypeOf(a) == @TypeOf(b)); | 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 | test "large enum field values" { | 1406 | test "large enum field values" { |
| ... | @@ -1410,45 +1410,45 @@ test "large enum field values" { | ... | @@ -1410,45 +1410,45 @@ test "large enum field values" { |
| 1410 | const E = enum(u64) { min = std.math.minInt(u64), max = std.math.maxInt(u64) }; | 1410 | const E = enum(u64) { min = std.math.minInt(u64), max = std.math.maxInt(u64) }; |
| 1411 | var e: E = .min; | 1411 | var e: E = .min; |
| 1412 | try expect(e == .min); | 1412 | try expect(e == .min); |
| 1413 | try expect(@intFromEnum(e) == std.math.minInt(u64)); | 1413 | try expect(@backingInt(e) == std.math.minInt(u64)); |
| 1414 | e = .max; | 1414 | e = .max; |
| 1415 | try expect(e == .max); | 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 | const E = enum(i64) { min = std.math.minInt(i64), max = std.math.maxInt(i64) }; | 1419 | const E = enum(i64) { min = std.math.minInt(i64), max = std.math.maxInt(i64) }; |
| 1420 | var e: E = .min; | 1420 | var e: E = .min; |
| 1421 | try expect(e == .min); | 1421 | try expect(e == .min); |
| 1422 | try expect(@intFromEnum(e) == std.math.minInt(i64)); | 1422 | try expect(@backingInt(e) == std.math.minInt(i64)); |
| 1423 | e = .max; | 1423 | e = .max; |
| 1424 | try expect(e == .max); | 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 | const E = enum(u128) { min = std.math.minInt(u128), max = std.math.maxInt(u128) }; | 1428 | const E = enum(u128) { min = std.math.minInt(u128), max = std.math.maxInt(u128) }; |
| 1429 | var e: E = .min; | 1429 | var e: E = .min; |
| 1430 | try expect(e == .min); | 1430 | try expect(e == .min); |
| 1431 | try expect(@intFromEnum(e) == std.math.minInt(u128)); | 1431 | try expect(@backingInt(e) == std.math.minInt(u128)); |
| 1432 | e = .max; | 1432 | e = .max; |
| 1433 | try expect(e == .max); | 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 | const E = enum(i128) { min = std.math.minInt(i128), max = std.math.maxInt(i128) }; | 1437 | const E = enum(i128) { min = std.math.minInt(i128), max = std.math.maxInt(i128) }; |
| 1438 | var e: E = .min; | 1438 | var e: E = .min; |
| 1439 | try expect(e == .min); | 1439 | try expect(e == .min); |
| 1440 | try expect(@intFromEnum(e) == std.math.minInt(i128)); | 1440 | try expect(@backingInt(e) == std.math.minInt(i128)); |
| 1441 | e = .max; | 1441 | e = .max; |
| 1442 | try expect(e == .max); | 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 | test "comptime @enumFromInt with signed arithmetic" { | 1447 | test "comptime @enumFromInt with signed arithmetic" { |
| 1448 | const E = enum(i8) { foo = -1, bar = 0 }; | 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 | comptime assert(x == .bar); | 1450 | comptime assert(x == .bar); |
| 1451 | comptime assert(@intFromEnum(x) == 0); | 1451 | comptime assert(@backingInt(x) == 0); |
| 1452 | } | 1452 | } |
| 1453 | 1453 | ||
| 1454 | test "enum int tag type uses declaration inside the enum" { | 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,7 +1463,7 @@ test "enum int tag type uses declaration inside the enum" { |
| 1463 | try expect(@sizeOf(static.E) == @sizeOf(u8)); | 1463 | try expect(@sizeOf(static.E) == @sizeOf(u8)); |
| 1464 | const val: static.E = .b; | 1464 | const val: static.E = .b; |
| 1465 | try expect(val == .b); | 1465 | try expect(val == .b); |
| 1466 | try expect(@intFromEnum(val) == 1); | 1466 | try expect(@backingInt(val) == 1); |
| 1467 | } | 1467 | } |
| 1468 | 1468 | ||
| 1469 | test "convert from/to backing int" { | 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,8 +259,8 @@ test "generic function instantiation turns into comptime call" { |
| 259 | else => void, | 259 | else => void, |
| 260 | } { | 260 | } { |
| 261 | return .{ | 261 | return .{ |
| 262 | .name = @typeInfo(T).@"enum".field_names[@intFromEnum(field)], | 262 | .name = @typeInfo(T).@"enum".field_names[@backingInt(field)], |
| 263 | .value = @typeInfo(T).@"enum".field_values[@intFromEnum(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,7 +98,7 @@ test "inline else enum" { |
| 98 | _ = &a; | 98 | _ = &a; |
| 99 | switch (a) { | 99 | switch (a) { |
| 100 | .a, .b => {}, | 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,7 +1873,7 @@ test "runtime call in nested initializer" { |
| 1873 | B, | 1873 | B, |
| 1874 | 1874 | ||
| 1875 | fn letter(e: @This()) u8 { | 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,10 +777,10 @@ test "enum value without tag name used as switch item" { |
| 777 | b = 2, | 777 | b = 2, |
| 778 | _, | 778 | _, |
| 779 | }; | 779 | }; |
| 780 | var e: E = @enumFromInt(0); | 780 | var e: E = @fromBackingInt(@intCast(0)); |
| 781 | _ = &e; | 781 | _ = &e; |
| 782 | switch (e) { | 782 | switch (e) { |
| 783 | @as(E, @enumFromInt(0)) => {}, | 783 | @as(E, @fromBackingInt(@intCast(0))) => {}, |
| 784 | .a => return error.TestFailed, | 784 | .a => return error.TestFailed, |
| 785 | .b => return error.TestFailed, | 785 | .b => return error.TestFailed, |
| 786 | _ => return error.TestFailed, | 786 | _ => return error.TestFailed, |
| ... | @@ -1117,7 +1117,7 @@ test "decl literals as switch cases" { | ... | @@ -1117,7 +1117,7 @@ test "decl literals as switch cases" { |
| 1117 | bar = 3, | 1117 | bar = 3, |
| 1118 | _, | 1118 | _, |
| 1119 | 1119 | ||
| 1120 | const foo: @This() = @enumFromInt(0xa); | 1120 | const foo: @This() = @fromBackingInt(@intCast(0xa)); |
| 1121 | 1121 | ||
| 1122 | fn doTheTest(e: @This()) !void { | 1122 | fn doTheTest(e: @This()) !void { |
| 1123 | switch (e) { | 1123 | switch (e) { |
| ... | @@ -1185,7 +1185,7 @@ test "switch with tag capture" { | ... | @@ -1185,7 +1185,7 @@ test "switch with tag capture" { |
| 1185 | .a => |nothing, tag| { | 1185 | .a => |nothing, tag| { |
| 1186 | comptime assert(nothing == {}); | 1186 | comptime assert(nothing == {}); |
| 1187 | comptime assert(tag == .a); | 1187 | comptime assert(tag == .a); |
| 1188 | try expect(@intFromEnum(tag) == @intFromEnum(@This().a)); | 1188 | try expect(@backingInt(tag) == @backingInt(@This().a)); |
| 1189 | }, | 1189 | }, |
| 1190 | .b, .d => |_, tag| { | 1190 | .b, .d => |_, tag| { |
| 1191 | try expect(tag == .b or tag == .d); | 1191 | try expect(tag == .b or tag == .d); |
| ... | @@ -1226,8 +1226,8 @@ test "switch with complex item expressions" { | ... | @@ -1226,8 +1226,8 @@ test "switch with complex item expressions" { |
| 1226 | try doTheSwitch(2000, 10); | 1226 | try doTheSwitch(2000, 10); |
| 1227 | try doTheSwitch(2000, 5); | 1227 | try doTheSwitch(2000, 5); |
| 1228 | 1228 | ||
| 1229 | try doTheOtherSwitch(@enumFromInt(123)); | 1229 | try doTheOtherSwitch(@fromBackingInt(@intCast(123))); |
| 1230 | try doTheOtherSwitch(@enumFromInt(456)); | 1230 | try doTheOtherSwitch(@fromBackingInt(@intCast(456))); |
| 1231 | } | 1231 | } |
| 1232 | fn doTheSwitch(x: u32, comptime factor: u32) !void { | 1232 | fn doTheSwitch(x: u32, comptime factor: u32) !void { |
| 1233 | const ok = switch (x) { | 1233 | const ok = switch (x) { |
| ... | @@ -1252,8 +1252,8 @@ test "switch with complex item expressions" { | ... | @@ -1252,8 +1252,8 @@ test "switch with complex item expressions" { |
| 1252 | const E = enum(u32) { _ }; | 1252 | const E = enum(u32) { _ }; |
| 1253 | fn doTheOtherSwitch(e: E) !void { | 1253 | fn doTheOtherSwitch(e: E) !void { |
| 1254 | const ok = switch (e) { | 1254 | const ok = switch (e) { |
| 1255 | @enumFromInt(123) => true, | 1255 | @fromBackingInt(@intCast(123)) => true, |
| 1256 | @enumFromInt(456) => true, | 1256 | @fromBackingInt(@intCast(456)) => true, |
| 1257 | else => false, | 1257 | else => false, |
| 1258 | }; | 1258 | }; |
| 1259 | try expect(ok); | 1259 | try expect(ok); |
test/behavior/switch_loop.zig+3-3| ... | @@ -256,8 +256,8 @@ test "switch loop on non-exhaustive enum" { | ... | @@ -256,8 +256,8 @@ test "switch loop on non-exhaustive enum" { |
| 256 | start = .a; | 256 | start = .a; |
| 257 | const result: u32 = s: switch (start) { | 257 | const result: u32 = s: switch (start) { |
| 258 | .a => continue :s .c, | 258 | .a => continue :s .c, |
| 259 | else => continue :s @enumFromInt(123), | 259 | else => continue :s @fromBackingInt(@intCast(123)), |
| 260 | .b, _ => |x| break :s @intFromEnum(x), | 260 | .b, _ => |x| break :s @backingInt(x), |
| 261 | }; | 261 | }; |
| 262 | try expect(result == 123); | 262 | try expect(result == 123); |
| 263 | } | 263 | } |
| ... | @@ -407,7 +407,7 @@ test "switch loop with tag capture" { | ... | @@ -407,7 +407,7 @@ test "switch loop with tag capture" { |
| 407 | .a => |nothing, tag| { | 407 | .a => |nothing, tag| { |
| 408 | comptime assert(nothing == {}); | 408 | comptime assert(nothing == {}); |
| 409 | comptime assert(tag == .a); | 409 | comptime assert(tag == .a); |
| 410 | try expect(@intFromEnum(tag) == @intFromEnum(@This().a)); | 410 | try expect(@backingInt(tag) == @backingInt(@This().a)); |
| 411 | continue :label .{ .d = 456 }; | 411 | continue :label .{ .d = 456 }; |
| 412 | }, | 412 | }, |
| 413 | .b, .d => |_, tag| { | 413 | .b, .d => |_, tag| { |
test/behavior/type.zig+5-5| ... | @@ -197,13 +197,13 @@ test "Type.Enum" { | ... | @@ -197,13 +197,13 @@ test "Type.Enum" { |
| 197 | 197 | ||
| 198 | const Foo = @Enum(u8, .exhaustive, &.{ "a", "b" }, &.{ 1, 5 }); | 198 | const Foo = @Enum(u8, .exhaustive, &.{ "a", "b" }, &.{ 1, 5 }); |
| 199 | try testing.expectEqual(std.builtin.Type.Enum.Mode.exhaustive, @typeInfo(Foo).@"enum".mode); | 199 | try testing.expectEqual(std.builtin.Type.Enum.Mode.exhaustive, @typeInfo(Foo).@"enum".mode); |
| 200 | try testing.expectEqual(@as(u8, 1), @intFromEnum(Foo.a)); | 200 | try testing.expectEqual(@as(u8, 1), @backingInt(Foo.a)); |
| 201 | try testing.expectEqual(@as(u8, 5), @intFromEnum(Foo.b)); | 201 | try testing.expectEqual(@as(u8, 5), @backingInt(Foo.b)); |
| 202 | const Bar = @Enum(u32, .nonexhaustive, &.{ "a", "b" }, &.{ 1, 5 }); | 202 | const Bar = @Enum(u32, .nonexhaustive, &.{ "a", "b" }, &.{ 1, 5 }); |
| 203 | try testing.expectEqual(std.builtin.Type.Enum.Mode.nonexhaustive, @typeInfo(Bar).@"enum".mode); | 203 | try testing.expectEqual(std.builtin.Type.Enum.Mode.nonexhaustive, @typeInfo(Bar).@"enum".mode); |
| 204 | try testing.expectEqual(@as(u32, 1), @intFromEnum(Bar.a)); | 204 | try testing.expectEqual(@as(u32, 1), @backingInt(Bar.a)); |
| 205 | try testing.expectEqual(@as(u32, 5), @intFromEnum(Bar.b)); | 205 | try testing.expectEqual(@as(u32, 5), @backingInt(Bar.b)); |
| 206 | try testing.expectEqual(@as(u32, 6), @intFromEnum(@as(Bar, @enumFromInt(6)))); | 206 | try testing.expectEqual(@as(u32, 6), @backingInt(@as(Bar, @fromBackingInt(@intCast(6))))); |
| 207 | 207 | ||
| 208 | { // from https://github.com/ziglang/zig/issues/19985 | 208 | { // from https://github.com/ziglang/zig/issues/19985 |
| 209 | { // enum with single field can be initialized. | 209 | { // enum with single field can be initialized. |
test/behavior/union.zig+8-8| ... | @@ -337,7 +337,7 @@ test "simple union(enum(u32))" { | ... | @@ -337,7 +337,7 @@ test "simple union(enum(u32))" { |
| 337 | var x = MultipleChoice.C; | 337 | var x = MultipleChoice.C; |
| 338 | _ = &x; | 338 | _ = &x; |
| 339 | try expect(x == MultipleChoice.C); | 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 | test "packed union size" { | 343 | test "packed union size" { |
| ... | @@ -639,7 +639,7 @@ const MultipleChoice2 = union(enum(u32)) { | ... | @@ -639,7 +639,7 @@ const MultipleChoice2 = union(enum(u32)) { |
| 639 | }; | 639 | }; |
| 640 | 640 | ||
| 641 | fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { | 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 | try expect(1123 == switch (x) { | 643 | try expect(1123 == switch (x) { |
| 644 | MultipleChoice2.A => 1, | 644 | MultipleChoice2.A => 1, |
| 645 | MultipleChoice2.B => 2, | 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,9 +701,9 @@ test "union with only 1 field casted to its enum type which has enum value speci |
| 701 | 701 | ||
| 702 | const t: ExprTag = e; | 702 | const t: ExprTag = e; |
| 703 | comptime assert(t == Expr.literal); | 703 | comptime assert(t == Expr.literal); |
| 704 | comptime assert(@intFromEnum(t) == 33); | 704 | comptime assert(@backingInt(t) == 33); |
| 705 | try expect(t == Expr.literal); | 705 | try expect(t == Expr.literal); |
| 706 | try expect(@intFromEnum(t) == 33); | 706 | try expect(@backingInt(t) == 33); |
| 707 | } | 707 | } |
| 708 | 708 | ||
| 709 | test "@intFromEnum works on unions" { | 709 | test "@intFromEnum works on unions" { |
| ... | @@ -721,9 +721,9 @@ test "@intFromEnum works on unions" { | ... | @@ -721,9 +721,9 @@ test "@intFromEnum works on unions" { |
| 721 | var b = Bar{ .B = undefined }; | 721 | var b = Bar{ .B = undefined }; |
| 722 | var c = Bar.C; | 722 | var c = Bar.C; |
| 723 | _ = .{ &b, &c }; | 723 | _ = .{ &b, &c }; |
| 724 | try expect(@intFromEnum(a) == 0); | 724 | try expect(@backingInt(a) == 0); |
| 725 | try expect(@intFromEnum(b) == 1); | 725 | try expect(@backingInt(b) == 1); |
| 726 | try expect(@intFromEnum(c) == 2); | 726 | try expect(@backingInt(c) == 2); |
| 727 | } | 727 | } |
| 728 | 728 | ||
| 729 | test "comptime union field value equality" { | 729 | test "comptime union field value equality" { |
| ... | @@ -1278,7 +1278,7 @@ test "@unionInit uses tag value instead of field index" { | ... | @@ -1278,7 +1278,7 @@ test "@unionInit uses tag value instead of field index" { |
| 1278 | _ = &a; | 1278 | _ = &a; |
| 1279 | try expect(a.* == i); | 1279 | try expect(a.* == i); |
| 1280 | } | 1280 | } |
| 1281 | try expect(@intFromEnum(u) == 255); | 1281 | try expect(@backingInt(u) == 255); |
| 1282 | } | 1282 | } |
| 1283 | 1283 | ||
| 1284 | test "union field ptr - zero sized payload" { | 1284 | test "union field ptr - zero sized payload" { |
test/c.zig+5-5| ... | @@ -15,14 +15,14 @@ test { | ... | @@ -15,14 +15,14 @@ test { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | pub fn expectErrno(expected_errno: c.E) !void { | 17 | pub fn expectErrno(expected_errno: c.E) !void { |
| 18 | try std.testing.expectEqual(expected_errno, @as(c.E, @enumFromInt(c._errno().*))); | 18 | try std.testing.expectEqual(expected_errno, @as(c.E, @fromBackingInt(@intCast(c._errno().*)))); |
| 19 | c._errno().* = @intFromEnum(c.E.SUCCESS); | 19 | c._errno().* = @backingInt(c.E.SUCCESS); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | pub fn expectErrnoAny(expected_errnos: []const c.E) !void { | 22 | pub fn expectErrnoAny(expected_errnos: []const c.E) !void { |
| 23 | const errno = c._errno().*; | 23 | const errno = c._errno().*; |
| 24 | for (expected_errnos) |expected_errno| { | 24 | for (expected_errnos) |expected_errno| { |
| 25 | if (errno == @intFromEnum(expected_errno)) break; | 25 | if (errno == @backingInt(expected_errno)) break; |
| 26 | } else { | 26 | } else { |
| 27 | var buffer: [64]u8 = undefined; | 27 | var buffer: [64]u8 = undefined; |
| 28 | const stderr = std.debug.lockStderr(&buffer); | 28 | const stderr = std.debug.lockStderr(&buffer); |
| ... | @@ -31,8 +31,8 @@ pub fn expectErrnoAny(expected_errnos: []const c.E) !void { | ... | @@ -31,8 +31,8 @@ pub fn expectErrnoAny(expected_errnos: []const c.E) !void { |
| 31 | for (expected_errnos[1..]) |expected_errno| { | 31 | for (expected_errnos[1..]) |expected_errno| { |
| 32 | try stderr.file_writer.interface.print(", {t}", .{expected_errno}); | 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 | return error.TestExpectedEqual; | 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,9 +13,9 @@ test "pthread_spinlock_t" { |
| 13 | _ = c.pthread_spin_init(&spin, c.PTHREAD_PROCESS_PRIVATE); | 13 | _ = c.pthread_spin_init(&spin, c.PTHREAD_PROCESS_PRIVATE); |
| 14 | defer _ = c.pthread_spin_destroy(&spin); | 14 | defer _ = c.pthread_spin_destroy(&spin); |
| 15 | 15 | ||
| 16 | try std.testing.expectEqual(@intFromEnum(c.E.SUCCESS), c.pthread_spin_trylock(&spin)); | 16 | try std.testing.expectEqual(@backingInt(c.E.SUCCESS), c.pthread_spin_trylock(&spin)); |
| 17 | try std.testing.expectEqual(@intFromEnum(c.E.SUCCESS), c.pthread_spin_unlock(&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)); | 19 | try std.testing.expectEqual(@backingInt(c.E.SUCCESS), c.pthread_spin_lock(&spin)); |
| 20 | try std.testing.expectEqual(@intFromEnum(c.E.SUCCESS), c.pthread_spin_unlock(&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,7 +133,7 @@ fn testStrToLLikeFunctionAnyErrno( |
| 133 | test "strtol" { | 133 | test "strtol" { |
| 134 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | 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 | try testStrToLLikeFunctionAnyErrno(c.strtol, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 137 | try testStrToLLikeFunctionAnyErrno(c.strtol, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 138 | try testStrToLLikeFunction(c.strtol, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 138 | try testStrToLLikeFunction(c.strtol, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 139 | try testStrToLLikeFunction(c.strtol, @ptrCast("-01"), 0, -1, 3, .SUCCESS); | 139 | try testStrToLLikeFunction(c.strtol, @ptrCast("-01"), 0, -1, 3, .SUCCESS); |
| ... | @@ -173,7 +173,7 @@ test "strtol" { | ... | @@ -173,7 +173,7 @@ test "strtol" { |
| 173 | test "strtoll" { | 173 | test "strtoll" { |
| 174 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | 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 | try testStrToLLikeFunctionAnyErrno(c.strtoll, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 177 | try testStrToLLikeFunctionAnyErrno(c.strtoll, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 178 | try testStrToLLikeFunction(c.strtoll, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 178 | try testStrToLLikeFunction(c.strtoll, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 179 | try testStrToLLikeFunction(c.strtoll, @ptrCast("-01"), 0, -1, 3, .SUCCESS); | 179 | try testStrToLLikeFunction(c.strtoll, @ptrCast("-01"), 0, -1, 3, .SUCCESS); |
| ... | @@ -213,7 +213,7 @@ test "strtoll" { | ... | @@ -213,7 +213,7 @@ test "strtoll" { |
| 213 | test "strtoul" { | 213 | test "strtoul" { |
| 214 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | 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 | try testStrToLLikeFunctionAnyErrno(c.strtoul, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 217 | try testStrToLLikeFunctionAnyErrno(c.strtoul, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 218 | try testStrToLLikeFunction(c.strtoul, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 218 | try testStrToLLikeFunction(c.strtoul, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 219 | try testStrToLLikeFunction(c.strtoul, @ptrCast("-01"), 0, math.maxInt(c_ulong), 3, .SUCCESS); | 219 | try testStrToLLikeFunction(c.strtoul, @ptrCast("-01"), 0, math.maxInt(c_ulong), 3, .SUCCESS); |
| ... | @@ -251,7 +251,7 @@ test "strtoul" { | ... | @@ -251,7 +251,7 @@ test "strtoul" { |
| 251 | test "strtoull" { | 251 | test "strtoull" { |
| 252 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | 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 | try testStrToLLikeFunctionAnyErrno(c.strtoull, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 255 | try testStrToLLikeFunctionAnyErrno(c.strtoull, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 256 | try testStrToLLikeFunction(c.strtoull, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 256 | try testStrToLLikeFunction(c.strtoull, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 257 | try testStrToLLikeFunction(c.strtoull, @ptrCast("-01"), 0, math.maxInt(c_ulonglong), 3, .SUCCESS); | 257 | try testStrToLLikeFunction(c.strtoull, @ptrCast("-01"), 0, math.maxInt(c_ulonglong), 3, .SUCCESS); |
| ... | @@ -289,7 +289,7 @@ test "strtoull" { | ... | @@ -289,7 +289,7 @@ test "strtoull" { |
| 289 | test "strtoimax" { | 289 | test "strtoimax" { |
| 290 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | 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 | try testStrToLLikeFunctionAnyErrno(c.strtoimax, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 293 | try testStrToLLikeFunctionAnyErrno(c.strtoimax, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 294 | try testStrToLLikeFunction(c.strtoimax, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 294 | try testStrToLLikeFunction(c.strtoimax, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 295 | try testStrToLLikeFunction(c.strtoimax, @ptrCast("-01"), 0, -1, 3, .SUCCESS); | 295 | try testStrToLLikeFunction(c.strtoimax, @ptrCast("-01"), 0, -1, 3, .SUCCESS); |
| ... | @@ -329,7 +329,7 @@ test "strtoimax" { | ... | @@ -329,7 +329,7 @@ test "strtoimax" { |
| 329 | test "strtoumax" { | 329 | test "strtoumax" { |
| 330 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | 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 | try testStrToLLikeFunctionAnyErrno(c.strtoumax, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 333 | try testStrToLLikeFunctionAnyErrno(c.strtoumax, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 334 | try testStrToLLikeFunction(c.strtoumax, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 334 | try testStrToLLikeFunction(c.strtoumax, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| 335 | try testStrToLLikeFunction(c.strtoumax, @ptrCast("-01"), 0, math.maxInt(c.uintmax_t), 3, .SUCCESS); | 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,7 +229,7 @@ fn addCaseInstance( |
| 229 | run.addCheck(.{ .expect_term = term: { | 229 | run.addCheck(.{ .expect_term = term: { |
| 230 | if (!expect_panic) break :term .{ .exited = 0 }; | 230 | if (!expect_panic) break :term .{ .exited = 0 }; |
| 231 | if (target.result.os.tag == .windows) break :term .{ .exited = 3 }; | 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 | run.expectStdOutEqual(""); | 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,7 +162,7 @@ fn spawnVerify(verify_path: [:0]const u16, cmd_line: [:0]const u16) !windows.DWO |
| 162 | @sizeOf(windows.PROCESS.BASIC_INFORMATION), | 162 | @sizeOf(windows.PROCESS.BASIC_INFORMATION), |
| 163 | null, | 163 | null, |
| 164 | )) { | 164 | )) { |
| 165 | .SUCCESS => return @intFromEnum(info.ExitStatus), | 165 | .SUCCESS => return @backingInt(info.ExitStatus), |
| 166 | else => return error.UnableToGetExitCode, | 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,7 +44,7 @@ const Target = struct { |
| 44 | return std.fmt.allocPrint(allocator, "{s}-{s}.{d}-{s}", .{ | 44 | return std.fmt.allocPrint(allocator, "{s}-{s}.{d}-{s}", .{ |
| 45 | @tagName(self.arch), | 45 | @tagName(self.arch), |
| 46 | @tagName(self.os), | 46 | @tagName(self.os), |
| 47 | @intFromEnum(self.os_ver), | 47 | @backingInt(self.os_ver), |
| 48 | @tagName(self.abi), | 48 | @tagName(self.abi), |
| 49 | }); | 49 | }); |
| 50 | } | 50 | } |
| ... | @@ -97,7 +97,7 @@ pub fn main(init: std.process.Init) !void { | ... | @@ -97,7 +97,7 @@ pub fn main(init: std.process.Init) !void { |
| 97 | fatal("don't know how to parse SDK version: {s}", .{ | 97 | fatal("don't know how to parse SDK version: {s}", .{ |
| 98 | parsed_json.value.DefaultProperties.MACOSX_DEPLOYMENT_TARGET, | 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 | info("found SDK deployment target macOS {f} aka '{t}'", .{ version, os_ver }); | 101 | info("found SDK deployment target macOS {f} aka '{t}'", .{ version, os_ver }); |
| 102 | 102 | ||
| 103 | const tmp_dir: Io.Dir = .cwd(); | 103 | const tmp_dir: Io.Dir = .cwd(); |
tools/gen_outline_atomics.zig+3-3| ... | @@ -145,11 +145,11 @@ const N = enum(u8) { | ... | @@ -145,11 +145,11 @@ const N = enum(u8) { |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | fn register(n: N) []const u8 { | 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 | fn toBytes(n: N) u8 { | 151 | fn toBytes(n: N) u8 { |
| 152 | return @intFromEnum(n); | 152 | return @backingInt(n); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | fn toBits(n: N) u8 { | 155 | fn toBits(n: N) u8 { |
| ... | @@ -213,7 +213,7 @@ fn generateCas(arena: Allocator, n: N, order: Ordering) ![]const u8 { | ... | @@ -213,7 +213,7 @@ fn generateCas(arena: Allocator, n: N, order: Ordering) ![]const u8 { |
| 213 | 213 | ||
| 214 | const reg = n.register(); | 214 | const reg = n.register(); |
| 215 | 215 | ||
| 216 | if (@intFromEnum(n) < 16) { | 216 | if (@backingInt(n) < 16) { |
| 217 | const cas = try std.fmt.allocPrint(arena, ".inst 0x08a07c41 + {s} + {s}", .{ s_def.b, o_def.m }); | 217 | const cas = try std.fmt.allocPrint(arena, ".inst 0x08a07c41 + {s} + {s}", .{ s_def.b, o_def.m }); |
| 218 | const ldxr = try std.fmt.allocPrint(arena, "ld{s}xr{s}", .{ o_def.a, s_def.s }); | 218 | const ldxr = try std.fmt.allocPrint(arena, "ld{s}xr{s}", .{ o_def.a, s_def.s }); |
| 219 | const stxr = try std.fmt.allocPrint(arena, "st{s}xr{s}", .{ o_def.l, s_def.s }); | 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,7 +398,7 @@ const Parser = struct { |
| 398 | _, | 398 | _, |
| 399 | 399 | ||
| 400 | fn get(index: Index, p: *const Parser) Node { | 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,7 +750,7 @@ const Parser = struct { |
| 750 | 750 | ||
| 751 | fn addNode(p: *Parser, node: Node) !Node.Index { | 751 | fn addNode(p: *Parser, node: Node) !Node.Index { |
| 752 | try p.nodes.append(p.gpa, node); | 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 | fn addExtra(p: *Parser, nodes: []const Node.Index) !Node.Slice { | 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,7 +144,7 @@ const Family = enum { |
| 144 | const arches: [@typeInfo(Arch).@"enum".field_names.len]Arch = blk: { | 144 | const arches: [@typeInfo(Arch).@"enum".field_names.len]Arch = blk: { |
| 145 | var result: [@typeInfo(Arch).@"enum".field_names.len]Arch = undefined; | 145 | var result: [@typeInfo(Arch).@"enum".field_names.len]Arch = undefined; |
| 146 | for (@typeInfo(Arch).@"enum".field_values) |field_value| { | 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 | result[archIndex(arch)] = arch; | 148 | result[archIndex(arch)] = arch; |
| 149 | } | 149 | } |
| 150 | break :blk result; | 150 | break :blk result; |
| ... | @@ -161,7 +161,7 @@ const MultiSym = struct { | ... | @@ -161,7 +161,7 @@ const MultiSym = struct { |
| 161 | fn isSingleArch(ms: MultiSym) ?Arch { | 161 | fn isSingleArch(ms: MultiSym) ?Arch { |
| 162 | var result: ?Arch = null; | 162 | var result: ?Arch = null; |
| 163 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { | 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 | if (ms.present[archIndex(arch)]) { | 165 | if (ms.present[archIndex(arch)]) { |
| 166 | if (result != null) return null; | 166 | if (result != null) return null; |
| 167 | result = arch; | 167 | result = arch; |
| ... | @@ -173,7 +173,7 @@ const MultiSym = struct { | ... | @@ -173,7 +173,7 @@ const MultiSym = struct { |
| 173 | fn isFamily(ms: MultiSym) ?Family { | 173 | fn isFamily(ms: MultiSym) ?Family { |
| 174 | var result: ?Family = null; | 174 | var result: ?Family = null; |
| 175 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { | 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 | if (ms.present[archIndex(arch)]) { | 177 | if (ms.present[archIndex(arch)]) { |
| 178 | const family = arch.family(); | 178 | const family = arch.family(); |
| 179 | if (result) |r| if (family != r) return null; | 179 | if (result) |r| if (family != r) return null; |
| ... | @@ -194,7 +194,7 @@ const MultiSym = struct { | ... | @@ -194,7 +194,7 @@ const MultiSym = struct { |
| 194 | 194 | ||
| 195 | fn isTime32Only(ms: MultiSym) bool { | 195 | fn isTime32Only(ms: MultiSym) bool { |
| 196 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { | 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 | if (ms.present[archIndex(arch)] != arch.isTime32()) { | 198 | if (ms.present[archIndex(arch)] != arch.isTime32()) { |
| 199 | return false; | 199 | return false; |
| 200 | } | 200 | } |
| ... | @@ -234,7 +234,7 @@ const MultiSym = struct { | ... | @@ -234,7 +234,7 @@ const MultiSym = struct { |
| 234 | 234 | ||
| 235 | fn isPtrSize(ms: MultiSym, mult: u16) bool { | 235 | fn isPtrSize(ms: MultiSym, mult: u16) bool { |
| 236 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { | 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 | const arch_index = archIndex(arch); | 238 | const arch_index = archIndex(arch); |
| 239 | if (ms.present[arch_index] and ms.size[arch_index] != arch.ptrSize() * mult) { | 239 | if (ms.present[arch_index] and ms.size[arch_index] != arch.ptrSize() * mult) { |
| 240 | return false; | 240 | return false; |
| ... | @@ -245,7 +245,7 @@ const MultiSym = struct { | ... | @@ -245,7 +245,7 @@ const MultiSym = struct { |
| 245 | 245 | ||
| 246 | fn isWeak64(ms: MultiSym) bool { | 246 | fn isWeak64(ms: MultiSym) bool { |
| 247 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { | 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 | const arch_index = archIndex(arch); | 249 | const arch_index = archIndex(arch); |
| 250 | const binding: u4 = switch (arch.ptrSize()) { | 250 | const binding: u4 = switch (arch.ptrSize()) { |
| 251 | 4 => std.elf.STB_GLOBAL, | 251 | 4 => std.elf.STB_GLOBAL, |
| ... | @@ -261,7 +261,7 @@ const MultiSym = struct { | ... | @@ -261,7 +261,7 @@ const MultiSym = struct { |
| 261 | 261 | ||
| 262 | fn isWeakTime64(ms: MultiSym) bool { | 262 | fn isWeakTime64(ms: MultiSym) bool { |
| 263 | inline for (@typeInfo(Arch).@"enum".field_values) |field_value| { | 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 | const arch_index = archIndex(arch); | 265 | const arch_index = archIndex(arch); |
| 266 | const binding: u4 = if (arch.isTime32()) std.elf.STB_GLOBAL else std.elf.STB_WEAK; | 266 | const binding: u4 = if (arch.isTime32()) std.elf.STB_GLOBAL else std.elf.STB_WEAK; |
| 267 | if (ms.present[arch_index] and ms.binding[arch_index] != binding) { | 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,7 +605,7 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: std.builtin.End |
| 605 | const name = try arena.dupe(u8, mem.sliceTo(dynstr[s(sym.st_name)..], 0)); | 605 | const name = try arena.dupe(u8, mem.sliceTo(dynstr[s(sym.st_name)..], 0)); |
| 606 | const ty = @as(u4, @truncate(sym.st_info)); | 606 | const ty = @as(u4, @truncate(sym.st_info)); |
| 607 | const binding = @as(u4, @truncate(sym.st_info >> 4)); | 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 | const size = s(sym.st_size); | 609 | const size = s(sym.st_size); |
| 610 | 610 | ||
| 611 | if (size == 0) { | 611 | if (size == 0) { |
| ... | @@ -717,7 +717,7 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: std.builtin.End | ... | @@ -717,7 +717,7 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: std.builtin.End |
| 717 | } | 717 | } |
| 718 | 718 | ||
| 719 | fn archIndex(arch: Arch) u8 { | 719 | fn archIndex(arch: Arch) u8 { |
| 720 | return @intFromEnum(arch); | 720 | return @backingInt(arch); |
| 721 | } | 721 | } |
| 722 | 722 | ||
| 723 | fn archSetName(arch_set: [arches.len]bool) []const u8 { | 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,7 +44,7 @@ pub fn main(init: std.process.Init) !void { |
| 44 | var stdout_writer = Io.File.stdout().writerStreaming(io, &buffer); | 44 | var stdout_writer = Io.File.stdout().writerStreaming(io, &buffer); |
| 45 | const w = &stdout_writer.interface; | 45 | const w = &stdout_writer.interface; |
| 46 | inline for (@typeInfo(std.Target.CType).@"enum".field_values) |field_value| { | 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 | try w.print("_Static_assert(sizeof({0s}) == {1d}, \"sizeof({0s}) == {1d}\");\n", .{ | 48 | try w.print("_Static_assert(sizeof({0s}) == {1d}, \"sizeof({0s}) == {1d}\");\n", .{ |
| 49 | cName(c_type), | 49 | cName(c_type), |
| 50 | target.cTypeByteSize(c_type), | 50 | target.cTypeByteSize(c_type), |
tools/update-linux-headers.zig+1-1| ... | @@ -39,7 +39,7 @@ const MultiArch = union(enum) { | ... | @@ -39,7 +39,7 @@ const MultiArch = union(enum) { |
| 39 | specific: Arch, | 39 | specific: Arch, |
| 40 | 40 | ||
| 41 | fn eql(a: MultiArch, b: MultiArch) bool { | 41 | fn eql(a: MultiArch, b: MultiArch) bool { |
| 42 | if (@intFromEnum(a) != @intFromEnum(b)) | 42 | if (@backingInt(a) != @backingInt(b)) |
| 43 | return false; | 43 | return false; |
| 44 | if (a != .specific) | 44 | if (a != .specific) |
| 45 | return true; | 45 | return true; |
tools/update_clang_options.zig+1-1| ... | @@ -666,7 +666,7 @@ pub fn main(init: std.process.Init) !void { | ... | @@ -666,7 +666,7 @@ pub fn main(init: std.process.Init) !void { |
| 666 | 666 | ||
| 667 | for (all_features, 0..) |feat, i| { | 667 | for (all_features, 0..) |feat, i| { |
| 668 | const llvm_name = feat.llvm_name orelse continue; | 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 | const zig_name = @tagName(zig_feat); | 670 | const zig_name = @tagName(zig_feat); |
| 671 | try llvm_to_zig_cpu_features.put(llvm_name, zig_name); | 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,7 +76,7 @@ const spirv_extra_features: []const Feature = blk: { |
| 76 | .zig_name = name, | 76 | .zig_name = name, |
| 77 | .desc = "Enable " ++ name ++ " capability", | 77 | .desc = "Enable " ++ name ++ " capability", |
| 78 | .deps = &struct { | 78 | .deps = &struct { |
| 79 | const extensions = spirv_spec.Capability.dependencies(@enumFromInt(value)); | 79 | const extensions = spirv_spec.Capability.dependencies(@fromBackingInt(@intCast(value))); |
| 80 | const deps: [extensions.len][]const u8 = inner: { | 80 | const deps: [extensions.len][]const u8 = inner: { |
| 81 | var out: [extensions.len][]const u8 = undefined; | 81 | var out: [extensions.len][]const u8 = undefined; |
| 82 | for (extensions, 0..) |ext, i| out[i] = @tagName(ext); | 82 | for (extensions, 0..) |ext, i| out[i] = @tagName(ext); |