| author | |
| committer | |
| log | e73257dec2d997e9d573419178695992790a9525 |
| tree | ffebad814a53dfcad5facdc035f01f9956dd8982 |
| parent | ad7a028228eabffd19b2d831bebe87c67723347c |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31469
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: nektro <hello@nektro.net>
Co-committed-by: nektro <hello@nektro.net>18 files changed, 76 insertions(+), 66 deletions(-)
lib/compiler/aro/backend/Ir/x86/Renderer.zig+3-3| ... | ... | @@ -21,17 +21,17 @@ const RegisterManager = zig.RegisterManager(Renderer, Register, Ir.Ref, abi.allo |
| 21 | 21 | const RegisterBitSet = RegisterManager.RegisterBitSet; |
| 22 | 22 | const RegisterClass = struct { |
| 23 | 23 | const gp: RegisterBitSet = blk: { |
| 24 | var set = RegisterBitSet.initEmpty(); | |
| 24 | var set = RegisterBitSet.empty; | |
| 25 | 25 | for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .general_purpose) set.set(index); |
| 26 | 26 | break :blk set; |
| 27 | 27 | }; |
| 28 | 28 | const x87: RegisterBitSet = blk: { |
| 29 | var set = RegisterBitSet.initEmpty(); | |
| 29 | var set = RegisterBitSet.empty; | |
| 30 | 30 | for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .x87) set.set(index); |
| 31 | 31 | break :blk set; |
| 32 | 32 | }; |
| 33 | 33 | const sse: RegisterBitSet = blk: { |
| 34 | var set = RegisterBitSet.initEmpty(); | |
| 34 | var set = RegisterBitSet.empty; | |
| 35 | 35 | for (abi.allocatable_regs, 0..) |reg, index| if (reg.class() == .sse) set.set(index); |
| 36 | 36 | break :blk set; |
| 37 | 37 | }; |
lib/compiler/resinator/compile.zig+2-2| ... | ... | @@ -2746,7 +2746,7 @@ pub const Compiler = struct { |
| 2746 | 2746 | // 1. Any permutation that does not have PRELOAD in it just uses the |
| 2747 | 2747 | // default flags. |
| 2748 | 2748 | const initial_flags = flags.*; |
| 2749 | var flags_set = std.enums.EnumSet(rc.CommonResourceAttributes).initEmpty(); | |
| 2749 | var flags_set = std.enums.EnumSet(rc.CommonResourceAttributes).empty; | |
| 2750 | 2750 | for (tokens) |token| { |
| 2751 | 2751 | const attribute = rc.CommonResourceAttributes.map.get(token.slice(source)).?; |
| 2752 | 2752 | flags_set.insert(attribute); |
| ... | ... | @@ -2769,7 +2769,7 @@ pub const Compiler = struct { |
| 2769 | 2769 | // 3. If none of DISCARDABLE, SHARED, or PURE is specified, then PRELOAD |
| 2770 | 2770 | // implies `flags &= ~SHARED` and LOADONCALL implies `flags |= SHARED` |
| 2771 | 2771 | const shared_set = comptime blk: { |
| 2772 | var set = std.enums.EnumSet(rc.CommonResourceAttributes).initEmpty(); | |
| 2772 | var set = std.enums.EnumSet(rc.CommonResourceAttributes).empty; | |
| 2773 | 2773 | set.insert(.discardable); |
| 2774 | 2774 | set.insert(.shared); |
| 2775 | 2775 | set.insert(.pure); |
lib/std/Io/Kqueue.zig+2-2| ... | ... | @@ -186,7 +186,7 @@ pub fn init(k: *Kqueue, gpa: Allocator, options: InitOptions) !void { |
| 186 | 186 | .awaiter = null, |
| 187 | 187 | .queue_next = null, |
| 188 | 188 | .cancel_thread = null, |
| 189 | .awaiting_completions = .initEmpty(), | |
| 189 | .awaiting_completions = .empty, | |
| 190 | 190 | }; |
| 191 | 191 | const main_thread = &k.threads.allocated[0]; |
| 192 | 192 | Thread.self = main_thread; |
| ... | ... | @@ -713,7 +713,7 @@ fn concurrent( |
| 713 | 713 | .awaiter = null, |
| 714 | 714 | .queue_next = null, |
| 715 | 715 | .cancel_thread = null, |
| 716 | .awaiting_completions = .initEmpty(), | |
| 716 | .awaiting_completions = .empty, | |
| 717 | 717 | }; |
| 718 | 718 | closure.* = .{ |
| 719 | 719 | .kqueue = k, |
lib/std/bit_set.zig+22-6| ... | ... | @@ -68,16 +68,24 @@ pub fn IntegerBitSet(comptime size: u16) type { |
| 68 | 68 | /// The bit mask, as a single integer |
| 69 | 69 | mask: MaskInt, |
| 70 | 70 | |
| 71 | /// Deprecated: use `.empty`. | |
| 71 | 72 | /// Creates a bit set with no elements present. |
| 72 | 73 | pub fn initEmpty() Self { |
| 73 | 74 | return .{ .mask = 0 }; |
| 74 | 75 | } |
| 75 | 76 | |
| 77 | /// Deprecated: use `.full`. | |
| 76 | 78 | /// Creates a bit set with all elements present. |
| 77 | 79 | pub fn initFull() Self { |
| 78 | 80 | return .{ .mask = ~@as(MaskInt, 0) }; |
| 79 | 81 | } |
| 80 | 82 | |
| 83 | /// A bit set with no elements present. | |
| 84 | pub const empty: Self = .{ .mask = 0 }; | |
| 85 | ||
| 86 | /// A bit set with all elements present. | |
| 87 | pub const full: Self = .{ .mask = ~@as(MaskInt, 0) }; | |
| 88 | ||
| 81 | 89 | /// Returns the number of bits in this bit set |
| 82 | 90 | pub inline fn capacity(self: Self) usize { |
| 83 | 91 | _ = self; |
| ... | ... | @@ -387,11 +395,13 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type { |
| 387 | 395 | /// Padding bits at the end are undefined. |
| 388 | 396 | masks: [num_masks]MaskInt, |
| 389 | 397 | |
| 398 | /// Deprecated: use `.empty`. | |
| 390 | 399 | /// Creates a bit set with no elements present. |
| 391 | 400 | pub fn initEmpty() Self { |
| 392 | 401 | return .{ .masks = [_]MaskInt{0} ** num_masks }; |
| 393 | 402 | } |
| 394 | 403 | |
| 404 | /// Deprecated: use `.full`. | |
| 395 | 405 | /// Creates a bit set with all elements present. |
| 396 | 406 | pub fn initFull() Self { |
| 397 | 407 | if (num_masks == 0) { |
| ... | ... | @@ -401,6 +411,12 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type { |
| 401 | 411 | } |
| 402 | 412 | } |
| 403 | 413 | |
| 414 | /// A bit set with no elements present. | |
| 415 | pub const empty: Self = .{ .masks = @splat(0) }; | |
| 416 | ||
| 417 | /// A bit set with all elements present. | |
| 418 | pub const full: Self = .{ .masks = if (num_masks == 0) .{} else ([_]MaskInt{~@as(MaskInt, 0)} ** (num_masks - 1) ++ [_]MaskInt{last_item_mask}) }; | |
| 419 | ||
| 404 | 420 | /// Returns the number of bits in this bit set |
| 405 | 421 | pub inline fn capacity(self: Self) usize { |
| 406 | 422 | _ = self; |
| ... | ... | @@ -1633,17 +1649,17 @@ fn fillOdd(set: anytype, len: usize) void { |
| 1633 | 1649 | } |
| 1634 | 1650 | |
| 1635 | 1651 | fn testPureBitSet(comptime Set: type) !void { |
| 1636 | const empty = Set.initEmpty(); | |
| 1637 | const full = Set.initFull(); | |
| 1652 | const empty = Set.empty; | |
| 1653 | const full = Set.full; | |
| 1638 | 1654 | |
| 1639 | 1655 | const even = even: { |
| 1640 | var bit_set = Set.initEmpty(); | |
| 1656 | var bit_set = Set.empty; | |
| 1641 | 1657 | fillEven(&bit_set, Set.bit_length); |
| 1642 | 1658 | break :even bit_set; |
| 1643 | 1659 | }; |
| 1644 | 1660 | |
| 1645 | 1661 | const odd = odd: { |
| 1646 | var bit_set = Set.initEmpty(); | |
| 1662 | var bit_set = Set.empty; | |
| 1647 | 1663 | fillOdd(&bit_set, Set.bit_length); |
| 1648 | 1664 | break :odd bit_set; |
| 1649 | 1665 | }; |
| ... | ... | @@ -1686,8 +1702,8 @@ fn testPureBitSet(comptime Set: type) !void { |
| 1686 | 1702 | } |
| 1687 | 1703 | |
| 1688 | 1704 | fn testStaticBitSet(comptime Set: type) !void { |
| 1689 | var a = Set.initEmpty(); | |
| 1690 | var b = Set.initFull(); | |
| 1705 | var a = Set.empty; | |
| 1706 | var b = Set.full; | |
| 1691 | 1707 | try testing.expectEqual(@as(usize, 0), a.count()); |
| 1692 | 1708 | try testing.expectEqual(@as(usize, Set.bit_length), b.count()); |
| 1693 | 1709 |
lib/std/crypto/codecs/base64_hex_ct.zig+2-2| ... | ... | @@ -93,7 +93,7 @@ pub const hex = struct { |
| 93 | 93 | /// The decoder will skip any characters that are in the ignore list. |
| 94 | 94 | /// The ignore list must not contain any valid hexadecimal characters. |
| 95 | 95 | pub fn decoderWithIgnore(ignore_chars: []const u8) error{InvalidCharacter}!DecoderWithIgnore { |
| 96 | var ignored_chars = StaticBitSet(256).initEmpty(); | |
| 96 | var ignored_chars = StaticBitSet(256).empty; | |
| 97 | 97 | for (ignore_chars) |c| { |
| 98 | 98 | switch (c) { |
| 99 | 99 | '0'...'9', 'a'...'f', 'A'...'F' => return error.InvalidCharacter, |
| ... | ... | @@ -269,7 +269,7 @@ pub const base64 = struct { |
| 269 | 269 | |
| 270 | 270 | /// Creates a new decoder that ignores certain characters. |
| 271 | 271 | pub fn decoderWithIgnore(ignore_chars: []const u8) error{InvalidCharacter}!DecoderWithIgnore { |
| 272 | var ignored_chars = StaticBitSet(256).initEmpty(); | |
| 272 | var ignored_chars = StaticBitSet(256).empty; | |
| 273 | 273 | for (ignore_chars) |c| { |
| 274 | 274 | switch (c) { |
| 275 | 275 | 'A'...'Z', 'a'...'z', '0'...'9' => return error.InvalidCharacter, |
lib/std/enums.zig+19-25| ... | ... | @@ -252,7 +252,7 @@ pub fn EnumSet(comptime E: type) type { |
| 252 | 252 | /// The maximum number of items in this set. |
| 253 | 253 | pub const len = Indexer.count; |
| 254 | 254 | |
| 255 | bits: BitSet = BitSet.initEmpty(), | |
| 255 | bits: BitSet = .empty, | |
| 256 | 256 | |
| 257 | 257 | /// Initializes the set using a struct of bools |
| 258 | 258 | pub fn init(init_values: EnumFieldStruct(E, bool, false)) Self { |
| ... | ... | @@ -278,19 +278,15 @@ pub fn EnumSet(comptime E: type) type { |
| 278 | 278 | return result; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | /// Returns a set containing no keys. | |
| 282 | pub fn initEmpty() Self { | |
| 283 | return .{ .bits = BitSet.initEmpty() }; | |
| 284 | } | |
| 281 | /// A set containing no keys. | |
| 282 | pub const empty: Self = .{ .bits = .empty }; | |
| 285 | 283 | |
| 286 | /// Returns a set containing all possible keys. | |
| 287 | pub fn initFull() Self { | |
| 288 | return .{ .bits = BitSet.initFull() }; | |
| 289 | } | |
| 284 | /// A set containing all possible keys. | |
| 285 | pub const full: Self = .{ .bits = .full }; | |
| 290 | 286 | |
| 291 | 287 | /// Returns a set containing multiple keys. |
| 292 | 288 | pub fn initMany(keys: []const Key) Self { |
| 293 | var set = initEmpty(); | |
| 289 | var set: Self = .empty; | |
| 294 | 290 | for (keys) |key| set.insert(key); |
| 295 | 291 | return set; |
| 296 | 292 | } |
| ... | ... | @@ -440,7 +436,7 @@ pub fn EnumMap(comptime E: type, comptime V: type) type { |
| 440 | 436 | const BitSet = std.StaticBitSet(Indexer.count); |
| 441 | 437 | |
| 442 | 438 | /// Bits determining whether items are in the map |
| 443 | bits: BitSet = BitSet.initEmpty(), | |
| 439 | bits: BitSet = .empty, | |
| 444 | 440 | /// Values of items in the map. If the associated |
| 445 | 441 | /// bit is zero, the value is undefined. |
| 446 | 442 | values: [Indexer.count]Value = undefined, |
| ... | ... | @@ -475,7 +471,7 @@ pub fn EnumMap(comptime E: type, comptime V: type) type { |
| 475 | 471 | /// Consider using EnumArray instead if the map will remain full. |
| 476 | 472 | pub fn initFull(value: Value) Self { |
| 477 | 473 | var result: Self = .{ |
| 478 | .bits = Self.BitSet.initFull(), | |
| 474 | .bits = .full, | |
| 479 | 475 | .values = undefined, |
| 480 | 476 | }; |
| 481 | 477 | @memset(&result.values, value); |
| ... | ... | @@ -493,7 +489,7 @@ pub fn EnumMap(comptime E: type, comptime V: type) type { |
| 493 | 489 | pub fn initFullWithDefault(comptime default: ?Value, init_values: EnumFieldStruct(E, Value, default)) Self { |
| 494 | 490 | @setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len); |
| 495 | 491 | var result: Self = .{ |
| 496 | .bits = Self.BitSet.initFull(), | |
| 492 | .bits = .full, | |
| 497 | 493 | .values = undefined, |
| 498 | 494 | }; |
| 499 | 495 | inline for (0..Self.len) |i| { |
| ... | ... | @@ -687,16 +683,14 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 687 | 683 | return self; |
| 688 | 684 | } |
| 689 | 685 | |
| 690 | /// Initializes the multiset with a count of zero. | |
| 691 | pub fn initEmpty() Self { | |
| 692 | return initWithCount(0); | |
| 693 | } | |
| 686 | /// A multiset with a count of zero. | |
| 687 | pub const empty: Self = .initWithCount(0); | |
| 694 | 688 | |
| 695 | 689 | /// Initializes the multiset with all keys at the |
| 696 | 690 | /// same count. |
| 697 | 691 | pub fn initWithCount(comptime c: CountSize) Self { |
| 698 | 692 | return .{ |
| 699 | .counts = EnumArray(E, CountSize).initDefault(c, .{}), | |
| 693 | .counts = .initDefault(c, .{}), | |
| 700 | 694 | }; |
| 701 | 695 | } |
| 702 | 696 | |
| ... | ... | @@ -855,7 +849,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 855 | 849 | test EnumMultiset { |
| 856 | 850 | const Ball = enum { red, green, blue }; |
| 857 | 851 | |
| 858 | const empty = EnumMultiset(Ball).initEmpty(); | |
| 852 | const empty = EnumMultiset(Ball).empty; | |
| 859 | 853 | const r0_g1_b2 = EnumMultiset(Ball).init(.{ |
| 860 | 854 | .red = 0, |
| 861 | 855 | .green = 1, |
| ... | ... | @@ -1162,8 +1156,8 @@ pub fn EnumArray(comptime E: type, comptime V: type) type { |
| 1162 | 1156 | test "pure EnumSet fns" { |
| 1163 | 1157 | const Suit = enum { spades, hearts, clubs, diamonds }; |
| 1164 | 1158 | |
| 1165 | const empty = EnumSet(Suit).initEmpty(); | |
| 1166 | const full = EnumSet(Suit).initFull(); | |
| 1159 | const empty = EnumSet(Suit).empty; | |
| 1160 | const full = EnumSet(Suit).full; | |
| 1167 | 1161 | const black = EnumSet(Suit).initMany(&[_]Suit{ .spades, .clubs }); |
| 1168 | 1162 | const red = EnumSet(Suit).initMany(&[_]Suit{ .hearts, .diamonds }); |
| 1169 | 1163 | |
| ... | ... | @@ -1224,8 +1218,8 @@ test "pure EnumSet fns" { |
| 1224 | 1218 | |
| 1225 | 1219 | test "EnumSet empty" { |
| 1226 | 1220 | const E = enum {}; |
| 1227 | const empty = EnumSet(E).initEmpty(); | |
| 1228 | const full = EnumSet(E).initFull(); | |
| 1221 | const empty = EnumSet(E).empty; | |
| 1222 | const full = EnumSet(E).full; | |
| 1229 | 1223 | |
| 1230 | 1224 | try std.testing.expect(empty.eql(full)); |
| 1231 | 1225 | try std.testing.expect(empty.complement().eql(full)); |
| ... | ... | @@ -1236,13 +1230,13 @@ test "EnumSet empty" { |
| 1236 | 1230 | test "EnumSet const iterator" { |
| 1237 | 1231 | const Direction = enum { up, down, left, right }; |
| 1238 | 1232 | const diag_move = init: { |
| 1239 | var move = EnumSet(Direction).initEmpty(); | |
| 1233 | var move = EnumSet(Direction).empty; | |
| 1240 | 1234 | move.insert(.right); |
| 1241 | 1235 | move.insert(.up); |
| 1242 | 1236 | break :init move; |
| 1243 | 1237 | }; |
| 1244 | 1238 | |
| 1245 | var result = EnumSet(Direction).initEmpty(); | |
| 1239 | var result = EnumSet(Direction).empty; | |
| 1246 | 1240 | var it = diag_move.iterator(); |
| 1247 | 1241 | while (it.next()) |dir| { |
| 1248 | 1242 | result.insert(dir); |
src/Air/Legalize.zig+3-3| ... | ... | @@ -15,7 +15,7 @@ features: if (switch (dev.env) { |
| 15 | 15 | } |
| 16 | 16 | /// `inline` to propagate comptime-known result. |
| 17 | 17 | inline fn hasAny(_: @This(), comptime features: []const Feature) bool { |
| 18 | return comptime !bootstrap_features.intersectWith(.initMany(features)).eql(.initEmpty()); | |
| 18 | return comptime !bootstrap_features.intersectWith(.initMany(features)).eql(.empty); | |
| 19 | 19 | } |
| 20 | 20 | } else struct { |
| 21 | 21 | features: *const Features, |
| ... | ... | @@ -28,7 +28,7 @@ features: if (switch (dev.env) { |
| 28 | 28 | return rt.features.contains(feature); |
| 29 | 29 | } |
| 30 | 30 | fn hasAny(rt: @This(), comptime features: []const Feature) bool { |
| 31 | return !rt.features.intersectWith(comptime .initMany(features)).eql(comptime .initEmpty()); | |
| 31 | return !rt.features.intersectWith(comptime .initMany(features)).eql(.empty); | |
| 32 | 32 | } |
| 33 | 33 | }, |
| 34 | 34 | |
| ... | ... | @@ -276,7 +276,7 @@ pub const Features = std.enums.EnumSet(Feature); |
| 276 | 276 | pub const Error = std.mem.Allocator.Error; |
| 277 | 277 | |
| 278 | 278 | pub fn legalize(air: *Air, pt: Zcu.PerThread, features: *const Features) Error!void { |
| 279 | assert(!features.eql(comptime .initEmpty())); // backend asked to run legalize, but no features were enabled | |
| 279 | assert(!features.eql(.empty)); // backend asked to run legalize, but no features were enabled | |
| 280 | 280 | var l: Legalize = .{ |
| 281 | 281 | .pt = pt, |
| 282 | 282 | .air_instructions = air.instructions.toMultiArrayList(), |
src/codegen/aarch64.zig+1-1| ... | ... | @@ -46,7 +46,7 @@ pub fn generate( |
| 46 | 46 | .dom_len = 0, |
| 47 | 47 | .dom = .empty, |
| 48 | 48 | |
| 49 | .saved_registers = comptime .initEmpty(), | |
| 49 | .saved_registers = .empty, | |
| 50 | 50 | .instructions = .empty, |
| 51 | 51 | .literals = .empty, |
| 52 | 52 | .nav_relocs = .empty, |
src/codegen/aarch64/Assemble.zig+1-1| ... | ... | @@ -129,7 +129,7 @@ const matchers = matchers: { |
| 129 | 129 | break :Symbols @Struct(.auto, null, &field_names, &field_types, &@splat(.{})); |
| 130 | 130 | } = undefined; |
| 131 | 131 | const Symbol = std.meta.FieldEnum(@TypeOf(instruction.symbols)); |
| 132 | comptime var unused_symbols: std.enums.EnumSet(Symbol) = .initFull(); | |
| 132 | comptime var unused_symbols: std.enums.EnumSet(Symbol) = .full; | |
| 133 | 133 | comptime var pattern_as: Assemble = .{ .source = instruction.pattern, .operands = undefined }; |
| 134 | 134 | inline while (true) { |
| 135 | 135 | comptime var ct_token_buf: [token_buf_len]u8 = undefined; |
src/codegen/riscv64/CodeGen.zig+1-1| ... | ... | @@ -1386,7 +1386,7 @@ fn genBody(func: *Func, body: []const Air.Inst.Index) InnerError!void { |
| 1386 | 1386 | const old_air_bookkeeping = func.air_bookkeeping; |
| 1387 | 1387 | try func.ensureProcessDeathCapacity(Air.Liveness.bpi); |
| 1388 | 1388 | |
| 1389 | func.reused_operands = @TypeOf(func.reused_operands).initEmpty(); | |
| 1389 | func.reused_operands = @TypeOf(func.reused_operands).empty; | |
| 1390 | 1390 | try func.inst_tracking.ensureUnusedCapacity(func.gpa, 1); |
| 1391 | 1391 | const tag = air_tags[@intFromEnum(inst)]; |
| 1392 | 1392 | switch (tag) { |
src/codegen/riscv64/Mir.zig+1-1| ... | ... | @@ -189,7 +189,7 @@ pub const LoadSymbolPayload = struct { |
| 189 | 189 | |
| 190 | 190 | /// Used in conjunction with payload to transfer a list of used registers in a compact manner. |
| 191 | 191 | pub const RegisterList = struct { |
| 192 | bitset: BitSet = BitSet.initEmpty(), | |
| 192 | bitset: BitSet = .empty, | |
| 193 | 193 | |
| 194 | 194 | const BitSet = IntegerBitSet(32); |
| 195 | 195 | const Self = @This(); |
src/codegen/riscv64/abi.zig+1-1| ... | ... | @@ -344,7 +344,7 @@ pub const Registers = struct { |
| 344 | 344 | }; |
| 345 | 345 | |
| 346 | 346 | fn initRegBitSet(start: usize, length: usize) RegisterBitSet { |
| 347 | var set = RegisterBitSet.initEmpty(); | |
| 347 | var set = RegisterBitSet.empty; | |
| 348 | 348 | set.setRangeValue(.{ |
| 349 | 349 | .start = start, |
| 350 | 350 | .end = start + length, |
src/codegen/sparc64/CodeGen.zig+1-1| ... | ... | @@ -476,7 +476,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 476 | 476 | const old_air_bookkeeping = self.air_bookkeeping; |
| 477 | 477 | try self.ensureProcessDeathCapacity(Air.Liveness.bpi); |
| 478 | 478 | |
| 479 | self.reused_operands = @TypeOf(self.reused_operands).initEmpty(); | |
| 479 | self.reused_operands = @TypeOf(self.reused_operands).empty; | |
| 480 | 480 | switch (air_tags[@intFromEnum(inst)]) { |
| 481 | 481 | // zig fmt: off |
| 482 | 482 |
src/codegen/sparc64/abi.zig+1-1| ... | ... | @@ -49,7 +49,7 @@ pub const RegisterManager = RegisterManagerFn(@import("CodeGen.zig"), Register, |
| 49 | 49 | const RegisterBitSet = RegisterManager.RegisterBitSet; |
| 50 | 50 | pub const RegisterClass = struct { |
| 51 | 51 | pub const gp: RegisterBitSet = blk: { |
| 52 | var set = RegisterBitSet.initEmpty(); | |
| 52 | var set = RegisterBitSet.empty; | |
| 53 | 53 | set.setRangeValue(.{ |
| 54 | 54 | .start = 0, |
| 55 | 55 | .end = allocatable_regs.len, |
src/codegen/x86_64/CodeGen.zig+4-4| ... | ... | @@ -2298,7 +2298,7 @@ fn genBody(cg: *CodeGen, body: []const Air.Inst.Index) InnerError!void { |
| 2298 | 2298 | wip_mir_log.debug("{f}", .{cg.fmtAir(inst)}); |
| 2299 | 2299 | verbose_tracking_log.debug("{f}", .{cg.fmtTracking()}); |
| 2300 | 2300 | |
| 2301 | cg.reused_operands = .initEmpty(); | |
| 2301 | cg.reused_operands = .empty; | |
| 2302 | 2302 | try cg.inst_tracking.ensureUnusedCapacity(cg.gpa, 1); |
| 2303 | 2303 | switch (air_tags[@intFromEnum(inst)]) { |
| 2304 | 2304 | .select => try cg.airSelect(inst), |
| ... | ... | @@ -177417,7 +177417,7 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 177417 | 177417 | used: bool, |
| 177418 | 177418 | fn init(size: ?Memory.Size) @This() { |
| 177419 | 177419 | return .{ |
| 177420 | .op_has_size = if (size) |_| .initFull() else .initEmpty(), | |
| 177420 | .op_has_size = if (size) |_| .full else .empty, | |
| 177421 | 177421 | .size = size orelse .none, |
| 177422 | 177422 | .used = false, |
| 177423 | 177423 | }; |
| ... | ... | @@ -178351,9 +178351,9 @@ fn genCopy(self: *CodeGen, ty: Type, dst_mcv: MCValue, src_mcv: MCValue, opts: C |
| 178351 | 178351 | else => unreachable, |
| 178352 | 178352 | }, |
| 178353 | 178353 | dst_tag => |src_regs| { |
| 178354 | var remaining: std.StaticBitSet(dst_regs.len) = .initFull(); | |
| 178354 | var remaining: std.StaticBitSet(dst_regs.len) = .full; | |
| 178355 | 178355 | var hazard_regs = src_regs; |
| 178356 | while (!remaining.eql(.initEmpty())) { | |
| 178356 | while (!remaining.eql(.empty)) { | |
| 178357 | 178357 | var remaining_it = remaining.iterator(.{}); |
| 178358 | 178358 | next: while (remaining_it.next()) |index| { |
| 178359 | 178359 | const dst_reg = dst_regs[index]; |
src/codegen/x86_64/Mir.zig+1-1| ... | ... | @@ -1780,7 +1780,7 @@ pub const RegisterList = struct { |
| 1780 | 1780 | const BitSet = std.bit_set.IntegerBitSet(32); |
| 1781 | 1781 | const Self = @This(); |
| 1782 | 1782 | |
| 1783 | pub const empty: RegisterList = .{ .bitset = .initEmpty() }; | |
| 1783 | pub const empty: RegisterList = .{ .bitset = .empty }; | |
| 1784 | 1784 | |
| 1785 | 1785 | fn getIndexForReg(registers: []const Register, reg: Register) BitSet.MaskInt { |
| 1786 | 1786 | for (registers, 0..) |cpreg, i| { |
src/codegen/x86_64/abi.zig+4-4| ... | ... | @@ -575,22 +575,22 @@ pub const RegisterManager = RegisterManagerFn(@import("CodeGen.zig"), Register, |
| 575 | 575 | const RegisterBitSet = RegisterManager.RegisterBitSet; |
| 576 | 576 | pub const RegisterClass = struct { |
| 577 | 577 | pub const gp: RegisterBitSet = blk: { |
| 578 | var set = RegisterBitSet.initEmpty(); | |
| 578 | var set = RegisterBitSet.empty; | |
| 579 | 579 | for (allocatable_regs, 0..) |reg, index| if (reg.isClass(.general_purpose)) set.set(index); |
| 580 | 580 | break :blk set; |
| 581 | 581 | }; |
| 582 | 582 | pub const gphi: RegisterBitSet = blk: { |
| 583 | var set = RegisterBitSet.initEmpty(); | |
| 583 | var set = RegisterBitSet.empty; | |
| 584 | 584 | for (allocatable_regs, 0..) |reg, index| if (reg.isClass(.gphi)) set.set(index); |
| 585 | 585 | break :blk set; |
| 586 | 586 | }; |
| 587 | 587 | pub const x87: RegisterBitSet = blk: { |
| 588 | var set = RegisterBitSet.initEmpty(); | |
| 588 | var set = RegisterBitSet.empty; | |
| 589 | 589 | for (allocatable_regs, 0..) |reg, index| if (reg.isClass(.x87)) set.set(index); |
| 590 | 590 | break :blk set; |
| 591 | 591 | }; |
| 592 | 592 | pub const sse: RegisterBitSet = blk: { |
| 593 | var set = RegisterBitSet.initEmpty(); | |
| 593 | var set = RegisterBitSet.empty; | |
| 594 | 594 | for (allocatable_regs, 0..) |reg, index| if (reg.isClass(.sse)) set.set(index); |
| 595 | 595 | break :blk set; |
| 596 | 596 | }; |
src/register_manager.zig+7-7| ... | ... | @@ -34,12 +34,12 @@ pub fn RegisterManager( |
| 34 | 34 | registers: TrackedRegisters = undefined, |
| 35 | 35 | /// Tracks which registers are free (in which case the |
| 36 | 36 | /// corresponding bit is set to 1) |
| 37 | free_registers: RegisterBitSet = .initFull(), | |
| 37 | free_registers: RegisterBitSet = .full, | |
| 38 | 38 | /// Tracks all registers allocated in the course of this |
| 39 | 39 | /// function |
| 40 | allocated_registers: RegisterBitSet = .initEmpty(), | |
| 40 | allocated_registers: RegisterBitSet = .empty, | |
| 41 | 41 | /// Tracks registers which are locked from being allocated |
| 42 | locked_registers: RegisterBitSet = .initEmpty(), | |
| 42 | locked_registers: RegisterBitSet = .empty, | |
| 43 | 43 | |
| 44 | 44 | const Self = @This(); |
| 45 | 45 | |
| ... | ... | @@ -393,7 +393,7 @@ const MockRegister1 = enum(u2) { |
| 393 | 393 | ); |
| 394 | 394 | |
| 395 | 395 | const gp = blk: { |
| 396 | var set: RM.RegisterBitSet = .initEmpty(); | |
| 396 | var set: RM.RegisterBitSet = .empty; | |
| 397 | 397 | set.setRangeValue(.{ |
| 398 | 398 | .start = 0, |
| 399 | 399 | .end = allocatable_registers.len, |
| ... | ... | @@ -421,7 +421,7 @@ const MockRegister2 = enum(u2) { |
| 421 | 421 | ); |
| 422 | 422 | |
| 423 | 423 | const gp = blk: { |
| 424 | var set: RM.RegisterBitSet = .initEmpty(); | |
| 424 | var set: RM.RegisterBitSet = .empty; | |
| 425 | 425 | set.setRangeValue(.{ |
| 426 | 426 | .start = 0, |
| 427 | 427 | .end = allocatable_registers.len, |
| ... | ... | @@ -462,7 +462,7 @@ const MockRegister3 = enum(u3) { |
| 462 | 462 | ); |
| 463 | 463 | |
| 464 | 464 | const gp = blk: { |
| 465 | var set: RM.RegisterBitSet = .initEmpty(); | |
| 465 | var set: RM.RegisterBitSet = .empty; | |
| 466 | 466 | set.setRangeValue(.{ |
| 467 | 467 | .start = 0, |
| 468 | 468 | .end = gp_regs.len, |
| ... | ... | @@ -470,7 +470,7 @@ const MockRegister3 = enum(u3) { |
| 470 | 470 | break :blk set; |
| 471 | 471 | }; |
| 472 | 472 | const ext = blk: { |
| 473 | var set: RM.RegisterBitSet = .initEmpty(); | |
| 473 | var set: RM.RegisterBitSet = .empty; | |
| 474 | 474 | set.setRangeValue(.{ |
| 475 | 475 | .start = gp_regs.len, |
| 476 | 476 | .end = allocatable_registers.len, |