diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/process_headers.zig | 24 | ||||
| -rw-r--r-- | tools/update_clang_options.zig | 6 | ||||
| -rw-r--r-- | tools/update_cpu_features.zig | 34 | ||||
| -rw-r--r-- | tools/update_glibc.zig | 44 |
4 files changed, 54 insertions, 54 deletions
diff --git a/tools/process_headers.zig b/tools/process_headers.zig index 5f4055c909..da7ab11143 100644 --- a/tools/process_headers.zig +++ b/tools/process_headers.zig @@ -377,14 +377,14 @@ pub fn main() !void { const gop = try hash_to_contents.getOrPut(hash); if (gop.found_existing) { max_bytes_saved += raw_bytes.len; - gop.entry.value.hit_count += 1; + gop.value_ptr.hit_count += 1; std.debug.warn("duplicate: {s} {s} ({:2})\n", .{ libc_target.name, rel_path, std.fmt.fmtIntSizeDec(raw_bytes.len), }); } else { - gop.entry.value = Contents{ + gop.value_ptr.* = Contents{ .bytes = trimmed, .hit_count = 1, .hash = hash, @@ -392,10 +392,10 @@ pub fn main() !void { }; } const path_gop = try path_table.getOrPut(rel_path); - const target_to_hash = if (path_gop.found_existing) path_gop.entry.value else blk: { + const target_to_hash = if (path_gop.found_existing) path_gop.value_ptr.* else blk: { const ptr = try allocator.create(TargetToHash); ptr.* = TargetToHash.init(allocator); - path_gop.entry.value = ptr; + path_gop.value_ptr.* = ptr; break :blk ptr; }; try target_to_hash.putNoClobber(dest_target, hash); @@ -423,9 +423,9 @@ pub fn main() !void { while (path_it.next()) |path_kv| { var contents_list = std.ArrayList(*Contents).init(allocator); { - var hash_it = path_kv.value.iterator(); + var hash_it = path_kv.value.*.iterator(); while (hash_it.next()) |hash_kv| { - const contents = &hash_to_contents.getEntry(hash_kv.value).?.value; + const contents = hash_to_contents.get(hash_kv.value.*).?; try contents_list.append(contents); } } @@ -433,7 +433,7 @@ pub fn main() !void { const best_contents = contents_list.popOrNull().?; if (best_contents.hit_count > 1) { // worth it to make it generic - const full_path = try std.fs.path.join(allocator, &[_][]const u8{ out_dir, generic_name, path_kv.key }); + const full_path = try std.fs.path.join(allocator, &[_][]const u8{ out_dir, generic_name, path_kv.key.* }); try std.fs.cwd().makePath(std.fs.path.dirname(full_path).?); try std.fs.cwd().writeFile(full_path, best_contents.bytes); best_contents.is_generic = true; @@ -443,17 +443,17 @@ pub fn main() !void { missed_opportunity_bytes += this_missed_bytes; std.debug.warn("Missed opportunity ({:2}): {s}\n", .{ std.fmt.fmtIntSizeDec(this_missed_bytes), - path_kv.key, + path_kv.key.*, }); } else break; } } - var hash_it = path_kv.value.iterator(); + var hash_it = path_kv.value.*.iterator(); while (hash_it.next()) |hash_kv| { - const contents = &hash_to_contents.getEntry(hash_kv.value).?.value; + const contents = hash_to_contents.get(hash_kv.value.*).?; if (contents.is_generic) continue; - const dest_target = hash_kv.key; + const dest_target = hash_kv.key.*; const arch_name = switch (dest_target.arch) { .specific => |a| @tagName(a), else => @tagName(dest_target.arch), @@ -463,7 +463,7 @@ pub fn main() !void { @tagName(dest_target.os), @tagName(dest_target.abi), }); - const full_path = try std.fs.path.join(allocator, &[_][]const u8{ out_dir, out_subpath, path_kv.key }); + const full_path = try std.fs.path.join(allocator, &[_][]const u8{ out_dir, out_subpath, path_kv.key.* }); try std.fs.cwd().makePath(std.fs.path.dirname(full_path).?); try std.fs.cwd().writeFile(full_path, contents.bytes); } diff --git a/tools/update_clang_options.zig b/tools/update_clang_options.zig index 8c3eddf7cf..aea080f23d 100644 --- a/tools/update_clang_options.zig +++ b/tools/update_clang_options.zig @@ -413,12 +413,12 @@ pub fn main() anyerror!void { var it = root_map.iterator(); it_map: while (it.next()) |kv| { if (kv.key.len == 0) continue; - if (kv.key[0] == '!') continue; - if (kv.value != .Object) continue; + if (kv.key.*[0] == '!') continue; + if (kv.value.* != .Object) continue; if (!kv.value.Object.contains("NumArgs")) continue; if (!kv.value.Object.contains("Name")) continue; for (blacklisted_options) |blacklisted_key| { - if (std.mem.eql(u8, blacklisted_key, kv.key)) continue :it_map; + if (std.mem.eql(u8, blacklisted_key, kv.key.*)) continue :it_map; } if (kv.value.Object.get("Name").?.String.len == 0) continue; try all_objects.append(&kv.value.Object); diff --git a/tools/update_cpu_features.zig b/tools/update_cpu_features.zig index c2ddd87f7c..9cda12c63a 100644 --- a/tools/update_cpu_features.zig +++ b/tools/update_cpu_features.zig @@ -903,8 +903,8 @@ fn processOneTarget(job: Job) anyerror!void { var it = root_map.iterator(); root_it: while (it.next()) |kv| { if (kv.key.len == 0) continue; - if (kv.key[0] == '!') continue; - if (kv.value != .Object) continue; + if (kv.key.*[0] == '!') continue; + if (kv.value.* != .Object) continue; if (hasSuperclass(&kv.value.Object, "SubtargetFeature")) { const llvm_name = kv.value.Object.get("Name").?.String; if (llvm_name.len == 0) continue; @@ -917,7 +917,7 @@ fn processOneTarget(job: Job) anyerror!void { const implies = kv.value.Object.get("Implies").?.Array; for (implies.items) |imply| { const other_key = imply.Object.get("def").?.String; - const other_obj = &root_map.getEntry(other_key).?.value.Object; + const other_obj = &root_map.getPtr(other_key).?.Object; const other_llvm_name = other_obj.get("Name").?.String; const other_zig_name = (try llvmNameToZigNameOmit( arena, @@ -969,7 +969,7 @@ fn processOneTarget(job: Job) anyerror!void { const features = kv.value.Object.get("Features").?.Array; for (features.items) |feature| { const feature_key = feature.Object.get("def").?.String; - const feature_obj = &root_map.getEntry(feature_key).?.value.Object; + const feature_obj = &root_map.getPtr(feature_key).?.Object; const feature_llvm_name = feature_obj.get("Name").?.String; if (feature_llvm_name.len == 0) continue; const feature_zig_name = (try llvmNameToZigNameOmit( @@ -982,7 +982,7 @@ fn processOneTarget(job: Job) anyerror!void { const tune_features = kv.value.Object.get("TuneFeatures").?.Array; for (tune_features.items) |feature| { const feature_key = feature.Object.get("def").?.String; - const feature_obj = &root_map.getEntry(feature_key).?.value.Object; + const feature_obj = &root_map.getPtr(feature_key).?.Object; const feature_llvm_name = feature_obj.get("Name").?.String; if (feature_llvm_name.len == 0) continue; const feature_zig_name = (try llvmNameToZigNameOmit( @@ -1109,9 +1109,9 @@ fn processOneTarget(job: Job) anyerror!void { try pruneFeatures(arena, features_table, &deps_set); var dependencies = std.ArrayList([]const u8).init(arena); { - var it = deps_set.iterator(); - while (it.next()) |entry| { - try dependencies.append(entry.key); + var it = deps_set.keyIterator(); + while (it.next()) |key| { + try dependencies.append(key.*); } } std.sort.sort([]const u8, dependencies.items, {}, asciiLessThan); @@ -1154,9 +1154,9 @@ fn processOneTarget(job: Job) anyerror!void { try pruneFeatures(arena, features_table, &deps_set); var cpu_features = std.ArrayList([]const u8).init(arena); { - var it = deps_set.iterator(); - while (it.next()) |entry| { - try cpu_features.append(entry.key); + var it = deps_set.keyIterator(); + while (it.next()) |key| { + try cpu_features.append(key.*); } } std.sort.sort([]const u8, cpu_features.items, {}, asciiLessThan); @@ -1278,16 +1278,16 @@ fn pruneFeatures( // Then, iterate over the deletion set and delete all that stuff from `deps_set`. var deletion_set = std.StringHashMap(void).init(arena); { - var it = deps_set.iterator(); - while (it.next()) |entry| { - const feature = features_table.get(entry.key).?; + var it = deps_set.keyIterator(); + while (it.next()) |key| { + const feature = features_table.get(key.*).?; try walkFeatures(features_table, &deletion_set, feature); } } { - var it = deletion_set.iterator(); - while (it.next()) |entry| { - _ = deps_set.remove(entry.key); + var it = deletion_set.keyIterator(); + while (it.next()) |key| { + _ = deps_set.remove(key.*); } } } diff --git a/tools/update_glibc.zig b/tools/update_glibc.zig index e3652acf1c..94e4ab756e 100644 --- a/tools/update_glibc.zig +++ b/tools/update_glibc.zig @@ -148,12 +148,12 @@ pub fn main() !void { for (abi_lists) |*abi_list| { const target_funcs_gop = try target_functions.getOrPut(@ptrToInt(abi_list)); if (!target_funcs_gop.found_existing) { - target_funcs_gop.entry.value = FunctionSet{ + target_funcs_gop.value_ptr.* = FunctionSet{ .list = std.ArrayList(VersionedFn).init(allocator), .fn_vers_list = FnVersionList.init(allocator), }; } - const fn_set = &target_funcs_gop.entry.value.list; + const fn_set = &target_funcs_gop.value_ptr.list; for (lib_names) |lib_name, lib_name_index| { const lib_prefix = if (std.mem.eql(u8, lib_name, "ld")) "" else "lib"; @@ -203,11 +203,11 @@ pub fn main() !void { try global_ver_set.put(ver, undefined); const gop = try global_fn_set.getOrPut(name); if (gop.found_existing) { - if (!std.mem.eql(u8, gop.entry.value.lib, "c")) { - gop.entry.value.lib = lib_name; + if (!std.mem.eql(u8, gop.value_ptr.lib, "c")) { + gop.value_ptr.lib = lib_name; } } else { - gop.entry.value = Function{ + gop.value_ptr.* = Function{ .name = name, .lib = lib_name, .index = undefined, @@ -223,15 +223,15 @@ pub fn main() !void { const global_fn_list = blk: { var list = std.ArrayList([]const u8).init(allocator); - var it = global_fn_set.iterator(); - while (it.next()) |entry| try list.append(entry.key); + var it = global_fn_set.keyIterator(); + while (it.next()) |key| try list.append(key.*); std.sort.sort([]const u8, list.items, {}, strCmpLessThan); break :blk list.items; }; const global_ver_list = blk: { var list = std.ArrayList([]const u8).init(allocator); - var it = global_ver_set.iterator(); - while (it.next()) |entry| try list.append(entry.key); + var it = global_ver_set.keyIterator(); + while (it.next()) |key| try list.append(key.*); std.sort.sort([]const u8, list.items, {}, versionLessThan); break :blk list.items; }; @@ -254,9 +254,9 @@ pub fn main() !void { var buffered = std.io.bufferedWriter(fns_txt_file.writer()); const fns_txt = buffered.writer(); for (global_fn_list) |name, i| { - const entry = global_fn_set.getEntry(name).?; - entry.value.index = i; - try fns_txt.print("{s} {s}\n", .{ name, entry.value.lib }); + const value = global_fn_set.getPtr(name).?; + value.index = i; + try fns_txt.print("{s} {s}\n", .{ name, value.lib }); } try buffered.flush(); } @@ -264,16 +264,16 @@ pub fn main() !void { // Now the mapping of version and function to integer index is complete. // Here we create a mapping of function name to list of versions. for (abi_lists) |*abi_list, abi_index| { - const entry = target_functions.getEntry(@ptrToInt(abi_list)).?; - const fn_vers_list = &entry.value.fn_vers_list; - for (entry.value.list.items) |*ver_fn| { + const value = target_functions.getPtr(@ptrToInt(abi_list)).?; + const fn_vers_list = &value.fn_vers_list; + for (value.list.items) |*ver_fn| { const gop = try fn_vers_list.getOrPut(ver_fn.name); if (!gop.found_existing) { - gop.entry.value = std.ArrayList(usize).init(allocator); + gop.value_ptr.* = std.ArrayList(usize).init(allocator); } - const ver_index = global_ver_set.getEntry(ver_fn.ver).?.value; - if (std.mem.indexOfScalar(usize, gop.entry.value.items, ver_index) == null) { - try gop.entry.value.append(ver_index); + const ver_index = global_ver_set.get(ver_fn.ver).?; + if (std.mem.indexOfScalar(usize, gop.value_ptr.items, ver_index) == null) { + try gop.value_ptr.append(ver_index); } } } @@ -287,7 +287,7 @@ pub fn main() !void { // first iterate over the abi lists for (abi_lists) |*abi_list, abi_index| { - const fn_vers_list = &target_functions.getEntry(@ptrToInt(abi_list)).?.value.fn_vers_list; + const fn_vers_list = &target_functions.getPtr(@ptrToInt(abi_list)).?.fn_vers_list; for (abi_list.targets) |target, it_i| { if (it_i != 0) try abilist_txt.writeByte(' '); try abilist_txt.print("{s}-linux-{s}", .{ @tagName(target.arch), @tagName(target.abi) }); @@ -295,11 +295,11 @@ pub fn main() !void { try abilist_txt.writeByte('\n'); // next, each line implicitly corresponds to a function for (global_fn_list) |name| { - const entry = fn_vers_list.getEntry(name) orelse { + const value = fn_vers_list.getPtr(name) orelse { try abilist_txt.writeByte('\n'); continue; }; - for (entry.value.items) |ver_index, it_i| { + for (value.items) |ver_index, it_i| { if (it_i != 0) try abilist_txt.writeByte(' '); try abilist_txt.print("{d}", .{ver_index}); } |
