authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-13 13:05:57-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:19-07:00
logf5ddef1e45fb5e6defcad21e50736c6e0f63c089
tree0fccbee2a74cc3dc4ce0e44dda245f4c22af16e9
parent41a8f5aec34ad4d6e4f5c4a2a2dc47f10bb1311d

update references to module (to be renamed to zcu)


9 files changed, 365 insertions(+), 365 deletions(-)

src/Compilation.zig+32-32
......@@ -1915,7 +1915,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
19151915}
19161916
19171917pub fn destroy(self: *Compilation) void {
1918 const optional_module = self.bin_file.options.module;
1918 const optional_module = self.module;
19191919 self.bin_file.destroy();
19201920 if (optional_module) |module| module.deinit();
19211921
......@@ -2017,7 +2017,7 @@ fn restorePrevZigCacheArtifactDirectory(comp: *Compilation, directory: *Director
20172017 // Restore the Module's previous zig_cache_artifact_directory
20182018 // This is only for cleanup purposes; Module.deinit calls close
20192019 // on the handle of zig_cache_artifact_directory.
2020 if (comp.bin_file.options.module) |module| {
2020 if (comp.module) |module| {
20212021 const builtin_mod = module.main_mod.deps.get("builtin").?;
20222022 module.zig_cache_artifact_directory = builtin_mod.root.root_dir;
20232023 }
......@@ -2109,7 +2109,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void
21092109 };
21102110
21112111 // This updates the output directory for linker outputs.
2112 if (comp.bin_file.options.module) |module| {
2112 if (comp.module) |module| {
21132113 module.zig_cache_artifact_directory = tmp_artifact_directory.?;
21142114 }
21152115
......@@ -2155,7 +2155,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void
21552155 }
21562156 }
21572157
2158 if (comp.bin_file.options.module) |module| {
2158 if (comp.module) |module| {
21592159 module.compile_log_text.shrinkAndFree(module.gpa, 0);
21602160 module.generation += 1;
21612161
......@@ -2206,7 +2206,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void
22062206
22072207 try comp.performAllTheWork(main_progress_node);
22082208
2209 if (comp.bin_file.options.module) |module| {
2209 if (comp.module) |module| {
22102210 if (builtin.mode == .Debug and comp.verbose_intern_pool) {
22112211 std.debug.print("intern pool stats for '{s}':\n", .{
22122212 comp.bin_file.options.root_name,
......@@ -2277,7 +2277,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void
22772277 }
22782278
22792279 // This is intentionally sandwiched between renameTmpIntoCache() and writeManifest().
2280 if (comp.bin_file.options.module) |module| {
2280 if (comp.module) |module| {
22812281 // We need to set the zig_cache_artifact_directory for -femit-asm, -femit-llvm-ir,
22822282 // etc to know where to output to.
22832283 var artifact_dir = try comp.local_cache_directory.handle.openDir(o_sub_path, .{});
......@@ -2322,7 +2322,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void
23222322 // to it, and (2) generic instantiations, comptime calls, inline calls will need
23232323 // to reference the ZIR.
23242324 if (!comp.keep_source_files_loaded) {
2325 if (comp.bin_file.options.module) |module| {
2325 if (comp.module) |module| {
23262326 for (module.import_table.values()) |file| {
23272327 file.unloadTree(comp.gpa);
23282328 file.unloadSource(comp.gpa);
......@@ -2332,7 +2332,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void
23322332}
23332333
23342334fn maybeGenerateAutodocs(comp: *Compilation, prog_node: *std.Progress.Node) !void {
2335 const mod = comp.bin_file.options.module orelse return;
2335 const mod = comp.module orelse return;
23362336 // TODO: do this in a separate job during performAllTheWork(). The
23372337 // file copies at the end of generate() can also be extracted to
23382338 // separate jobs
......@@ -2360,7 +2360,7 @@ fn flush(comp: *Compilation, prog_node: *std.Progress.Node) !void {
23602360 };
23612361 comp.link_error_flags = comp.bin_file.errorFlags();
23622362
2363 if (comp.bin_file.options.module) |module| {
2363 if (comp.module) |module| {
23642364 try link.File.C.flushEmitH(module);
23652365 }
23662366}
......@@ -2421,7 +2421,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes
24212421
24222422 comptime assert(link_hash_implementation_version == 10);
24232423
2424 if (comp.bin_file.options.module) |mod| {
2424 if (comp.module) |mod| {
24252425 const main_zig_file = try mod.main_mod.root.joinString(arena, mod.main_mod.root_src_path);
24262426 _ = try man.addFile(main_zig_file, null);
24272427 try addModuleTableToCacheHash(gpa, arena, &man.hash, mod.main_mod, .{ .files = man });
......@@ -2559,7 +2559,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes
25592559}
25602560
25612561fn emitOthers(comp: *Compilation) void {
2562 if (comp.bin_file.options.output_mode != .Obj or comp.bin_file.options.module != null or
2562 if (comp.bin_file.options.output_mode != .Obj or comp.module != null or
25632563 comp.c_object_table.count() == 0)
25642564 {
25652565 return;
......@@ -2727,7 +2727,7 @@ pub fn saveState(comp: *Compilation) !void {
27272727
27282728 const emit = comp.bin_file.options.emit orelse return;
27292729
2730 if (comp.bin_file.options.module) |mod| {
2730 if (comp.module) |mod| {
27312731 const ip = &mod.intern_pool;
27322732 const header: Header = .{
27332733 .intern_pool = .{
......@@ -2792,7 +2792,7 @@ pub fn totalErrorCount(self: *Compilation) u32 {
27922792 }
27932793 }
27942794
2795 if (self.bin_file.options.module) |module| {
2795 if (self.module) |module| {
27962796 total += module.failed_exports.count();
27972797 total += module.failed_embed_files.count();
27982798
......@@ -2844,7 +2844,7 @@ pub fn totalErrorCount(self: *Compilation) u32 {
28442844
28452845 // Compile log errors only count if there are no other errors.
28462846 if (total == 0) {
2847 if (self.bin_file.options.module) |module| {
2847 if (self.module) |module| {
28482848 total += @intFromBool(module.compile_log_decls.count() != 0);
28492849 }
28502850 }
......@@ -2896,7 +2896,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {
28962896 .msg = try bundle.addString("memory allocation failure"),
28972897 });
28982898 }
2899 if (self.bin_file.options.module) |module| {
2899 if (self.module) |module| {
29002900 for (module.failed_files.keys(), module.failed_files.values()) |file, error_msg| {
29012901 if (error_msg) |msg| {
29022902 try addModuleErrorMsg(module, &bundle, msg.*);
......@@ -3002,7 +3002,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {
30023002 }
30033003 }
30043004
3005 if (self.bin_file.options.module) |module| {
3005 if (self.module) |module| {
30063006 if (bundle.root_list.items.len == 0 and module.compile_log_decls.count() != 0) {
30073007 const keys = module.compile_log_decls.keys();
30083008 const values = module.compile_log_decls.values();
......@@ -3030,7 +3030,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle {
30303030
30313031 assert(self.totalErrorCount() == bundle.root_list.items.len);
30323032
3033 const compile_log_text = if (self.bin_file.options.module) |m| m.compile_log_text.items else "";
3033 const compile_log_text = if (self.module) |m| m.compile_log_text.items else "";
30343034 return bundle.toOwnedBundle(compile_log_text);
30353035}
30363036
......@@ -3314,7 +3314,7 @@ pub fn performAllTheWork(
33143314 // 1. to avoid race condition of zig processes truncating each other's builtin.zig files
33153315 // 2. optimization; in the hot path it only incurs a stat() syscall, which happens
33163316 // in the `astgen_wait_group`.
3317 if (comp.bin_file.options.module) |mod| {
3317 if (comp.module) |mod| {
33183318 if (mod.job_queued_update_builtin_zig) {
33193319 mod.job_queued_update_builtin_zig = false;
33203320
......@@ -3356,15 +3356,15 @@ pub fn performAllTheWork(
33563356 }
33573357 }
33583358
3359 if (comp.bin_file.options.module) |mod| {
3359 if (comp.module) |mod| {
33603360 try reportMultiModuleErrors(mod);
33613361 }
33623362
3363 if (comp.bin_file.options.module) |mod| {
3363 if (comp.module) |mod| {
33643364 mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0);
33653365 mod.sema_prog_node.activate();
33663366 }
3367 defer if (comp.bin_file.options.module) |mod| {
3367 defer if (comp.module) |mod| {
33683368 mod.sema_prog_node.end();
33693369 mod.sema_prog_node = undefined;
33703370 };
......@@ -3398,7 +3398,7 @@ pub fn performAllTheWork(
33983398fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !void {
33993399 switch (job) {
34003400 .codegen_decl => |decl_index| {
3401 const module = comp.bin_file.options.module.?;
3401 const module = comp.module.?;
34023402 const decl = module.declPtr(decl_index);
34033403
34043404 switch (decl.analysis) {
......@@ -3436,14 +3436,14 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v
34363436 const named_frame = tracy.namedFrame("codegen_func");
34373437 defer named_frame.end();
34383438
3439 const module = comp.bin_file.options.module.?;
3439 const module = comp.module.?;
34403440 module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) {
34413441 error.OutOfMemory => return error.OutOfMemory,
34423442 error.AnalysisFail => return,
34433443 };
34443444 },
34453445 .emit_h_decl => |decl_index| {
3446 const module = comp.bin_file.options.module.?;
3446 const module = comp.module.?;
34473447 const decl = module.declPtr(decl_index);
34483448
34493449 switch (decl.analysis) {
......@@ -3502,7 +3502,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v
35023502 }
35033503 },
35043504 .analyze_decl => |decl_index| {
3505 const module = comp.bin_file.options.module.?;
3505 const module = comp.module.?;
35063506 module.ensureDeclAnalyzed(decl_index) catch |err| switch (err) {
35073507 error.OutOfMemory => return error.OutOfMemory,
35083508 error.AnalysisFail => return,
......@@ -3520,7 +3520,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v
35203520 defer named_frame.end();
35213521
35223522 const gpa = comp.gpa;
3523 const module = comp.bin_file.options.module.?;
3523 const module = comp.module.?;
35243524 const decl = module.declPtr(decl_index);
35253525 comp.bin_file.updateDeclLineNumber(module, decl_index) catch |err| {
35263526 try module.failed_decls.ensureUnusedCapacity(gpa, 1);
......@@ -3537,7 +3537,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v
35373537 const named_frame = tracy.namedFrame("analyze_mod");
35383538 defer named_frame.end();
35393539
3540 const module = comp.bin_file.options.module.?;
3540 const module = comp.module.?;
35413541 module.semaPkg(pkg) catch |err| switch (err) {
35423542 error.OutOfMemory => return error.OutOfMemory,
35433543 error.AnalysisFail => return,
......@@ -3716,7 +3716,7 @@ fn workerAstGenFile(
37163716 child_prog_node.activate();
37173717 defer child_prog_node.end();
37183718
3719 const mod = comp.bin_file.options.module.?;
3719 const mod = comp.module.?;
37203720 mod.astGenFile(file) catch |err| switch (err) {
37213721 error.AnalysisFail => return,
37223722 else => {
......@@ -3819,7 +3819,7 @@ fn workerCheckEmbedFile(
38193819}
38203820
38213821fn detectEmbedFileUpdate(comp: *Compilation, embed_file: *Module.EmbedFile) !void {
3822 const mod = comp.bin_file.options.module.?;
3822 const mod = comp.module.?;
38233823 const ip = &mod.intern_pool;
38243824 const sub_file_path = ip.stringToSlice(embed_file.sub_file_path);
38253825 var file = try embed_file.owner.root.openFile(sub_file_path, .{});
......@@ -4142,7 +4142,7 @@ fn reportRetryableAstGenError(
41424142 file: *Module.File,
41434143 err: anyerror,
41444144) error{OutOfMemory}!void {
4145 const mod = comp.bin_file.options.module.?;
4145 const mod = comp.module.?;
41464146 const gpa = mod.gpa;
41474147
41484148 file.status = .retryable_failure;
......@@ -4181,7 +4181,7 @@ fn reportRetryableEmbedFileError(
41814181 embed_file: *Module.EmbedFile,
41824182 err: anyerror,
41834183) error{OutOfMemory}!void {
4184 const mod = comp.bin_file.options.module.?;
4184 const mod = comp.module.?;
41854185 const gpa = mod.gpa;
41864186 const src_loc = embed_file.src_loc;
41874187 const ip = &mod.intern_pool;
......@@ -4248,7 +4248,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P
42484248 // Special case when doing build-obj for just one C file. When there are more than one object
42494249 // file and building an object we need to link them together, but with just one it should go
42504250 // directly to the output file.
4251 const direct_o = comp.c_source_files.len == 1 and comp.bin_file.options.module == null and
4251 const direct_o = comp.c_source_files.len == 1 and comp.module == null and
42524252 comp.bin_file.options.output_mode == .Obj and comp.bin_file.options.objects.len == 0;
42534253 const o_basename_noext = if (direct_o)
42544254 comp.bin_file.options.root_name
src/arch/aarch64/CodeGen.zig+68-68
......@@ -341,7 +341,7 @@ pub fn generate(
341341 @panic("Attempted to compile for architecture that was disabled by build configuration");
342342 }
343343
344 const mod = bin_file.options.module.?;
344 const mod = bin_file.comp.module.?;
345345 const func = mod.funcInfo(func_index);
346346 const fn_owner_decl = mod.declPtr(func.owner_decl);
347347 assert(fn_owner_decl.has_tv);
......@@ -476,7 +476,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 {
476476}
477477
478478fn gen(self: *Self) !void {
479 const mod = self.bin_file.options.module.?;
479 const mod = self.bin_file.comp.module.?;
480480 const cc = self.fn_type.fnCallingConvention(mod);
481481 if (cc != .Naked) {
482482 // stp fp, lr, [sp, #-16]!
......@@ -656,7 +656,7 @@ fn gen(self: *Self) !void {
656656}
657657
658658fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
659 const mod = self.bin_file.options.module.?;
659 const mod = self.bin_file.comp.module.?;
660660 const ip = &mod.intern_pool;
661661 const air_tags = self.air.instructions.items(.tag);
662662
......@@ -1028,7 +1028,7 @@ fn allocMem(
10281028
10291029/// Use a pointer instruction as the basis for allocating stack memory.
10301030fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 {
1031 const mod = self.bin_file.options.module.?;
1031 const mod = self.bin_file.comp.module.?;
10321032 const elem_ty = self.typeOfIndex(inst).childType(mod);
10331033
10341034 if (!elem_ty.hasRuntimeBits(mod)) {
......@@ -1048,7 +1048,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 {
10481048}
10491049
10501050fn allocRegOrMem(self: *Self, elem_ty: Type, reg_ok: bool, maybe_inst: ?Air.Inst.Index) !MCValue {
1051 const mod = self.bin_file.options.module.?;
1051 const mod = self.bin_file.comp.module.?;
10521052 const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse {
10531053 return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)});
10541054 };
......@@ -1139,7 +1139,7 @@ fn airAlloc(self: *Self, inst: Air.Inst.Index) !void {
11391139}
11401140
11411141fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void {
1142 const mod = self.bin_file.options.module.?;
1142 const mod = self.bin_file.comp.module.?;
11431143 const result: MCValue = switch (self.ret_mcv) {
11441144 .none, .register => .{ .ptr_stack_offset = try self.allocMemPtr(inst) },
11451145 .stack_offset => blk: {
......@@ -1176,7 +1176,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void {
11761176 if (self.liveness.isUnused(inst))
11771177 return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none });
11781178
1179 const mod = self.bin_file.options.module.?;
1179 const mod = self.bin_file.comp.module.?;
11801180 const operand = ty_op.operand;
11811181 const operand_mcv = try self.resolveInst(operand);
11821182 const operand_ty = self.typeOf(operand);
......@@ -1257,7 +1257,7 @@ fn trunc(
12571257 operand_ty: Type,
12581258 dest_ty: Type,
12591259) !MCValue {
1260 const mod = self.bin_file.options.module.?;
1260 const mod = self.bin_file.comp.module.?;
12611261 const info_a = operand_ty.intInfo(mod);
12621262 const info_b = dest_ty.intInfo(mod);
12631263
......@@ -1320,7 +1320,7 @@ fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void {
13201320
13211321fn airNot(self: *Self, inst: Air.Inst.Index) !void {
13221322 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
1323 const mod = self.bin_file.options.module.?;
1323 const mod = self.bin_file.comp.module.?;
13241324 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
13251325 const operand = try self.resolveInst(ty_op.operand);
13261326 const operand_ty = self.typeOf(ty_op.operand);
......@@ -1415,7 +1415,7 @@ fn minMax(
14151415 rhs_ty: Type,
14161416 maybe_inst: ?Air.Inst.Index,
14171417) !MCValue {
1418 const mod = self.bin_file.options.module.?;
1418 const mod = self.bin_file.comp.module.?;
14191419 switch (lhs_ty.zigTypeTag(mod)) {
14201420 .Float => return self.fail("TODO ARM min/max on floats", .{}),
14211421 .Vector => return self.fail("TODO ARM min/max on vectors", .{}),
......@@ -1905,7 +1905,7 @@ fn addSub(
19051905 rhs_ty: Type,
19061906 maybe_inst: ?Air.Inst.Index,
19071907) InnerError!MCValue {
1908 const mod = self.bin_file.options.module.?;
1908 const mod = self.bin_file.comp.module.?;
19091909 switch (lhs_ty.zigTypeTag(mod)) {
19101910 .Float => return self.fail("TODO binary operations on floats", .{}),
19111911 .Vector => return self.fail("TODO binary operations on vectors", .{}),
......@@ -1966,7 +1966,7 @@ fn mul(
19661966 rhs_ty: Type,
19671967 maybe_inst: ?Air.Inst.Index,
19681968) InnerError!MCValue {
1969 const mod = self.bin_file.options.module.?;
1969 const mod = self.bin_file.comp.module.?;
19701970 switch (lhs_ty.zigTypeTag(mod)) {
19711971 .Vector => return self.fail("TODO binary operations on vectors", .{}),
19721972 .Int => {
......@@ -1998,7 +1998,7 @@ fn divFloat(
19981998 _ = rhs_ty;
19991999 _ = maybe_inst;
20002000
2001 const mod = self.bin_file.options.module.?;
2001 const mod = self.bin_file.comp.module.?;
20022002 switch (lhs_ty.zigTypeTag(mod)) {
20032003 .Float => return self.fail("TODO div_float", .{}),
20042004 .Vector => return self.fail("TODO div_float on vectors", .{}),
......@@ -2014,7 +2014,7 @@ fn divTrunc(
20142014 rhs_ty: Type,
20152015 maybe_inst: ?Air.Inst.Index,
20162016) InnerError!MCValue {
2017 const mod = self.bin_file.options.module.?;
2017 const mod = self.bin_file.comp.module.?;
20182018 switch (lhs_ty.zigTypeTag(mod)) {
20192019 .Float => return self.fail("TODO div on floats", .{}),
20202020 .Vector => return self.fail("TODO div on vectors", .{}),
......@@ -2048,7 +2048,7 @@ fn divFloor(
20482048 rhs_ty: Type,
20492049 maybe_inst: ?Air.Inst.Index,
20502050) InnerError!MCValue {
2051 const mod = self.bin_file.options.module.?;
2051 const mod = self.bin_file.comp.module.?;
20522052 switch (lhs_ty.zigTypeTag(mod)) {
20532053 .Float => return self.fail("TODO div on floats", .{}),
20542054 .Vector => return self.fail("TODO div on vectors", .{}),
......@@ -2081,7 +2081,7 @@ fn divExact(
20812081 rhs_ty: Type,
20822082 maybe_inst: ?Air.Inst.Index,
20832083) InnerError!MCValue {
2084 const mod = self.bin_file.options.module.?;
2084 const mod = self.bin_file.comp.module.?;
20852085 switch (lhs_ty.zigTypeTag(mod)) {
20862086 .Float => return self.fail("TODO div on floats", .{}),
20872087 .Vector => return self.fail("TODO div on vectors", .{}),
......@@ -2117,7 +2117,7 @@ fn rem(
21172117) InnerError!MCValue {
21182118 _ = maybe_inst;
21192119
2120 const mod = self.bin_file.options.module.?;
2120 const mod = self.bin_file.comp.module.?;
21212121 switch (lhs_ty.zigTypeTag(mod)) {
21222122 .Float => return self.fail("TODO rem/mod on floats", .{}),
21232123 .Vector => return self.fail("TODO rem/mod on vectors", .{}),
......@@ -2188,7 +2188,7 @@ fn modulo(
21882188 _ = rhs_ty;
21892189 _ = maybe_inst;
21902190
2191 const mod = self.bin_file.options.module.?;
2191 const mod = self.bin_file.comp.module.?;
21922192 switch (lhs_ty.zigTypeTag(mod)) {
21932193 .Float => return self.fail("TODO mod on floats", .{}),
21942194 .Vector => return self.fail("TODO mod on vectors", .{}),
......@@ -2206,7 +2206,7 @@ fn wrappingArithmetic(
22062206 rhs_ty: Type,
22072207 maybe_inst: ?Air.Inst.Index,
22082208) InnerError!MCValue {
2209 const mod = self.bin_file.options.module.?;
2209 const mod = self.bin_file.comp.module.?;
22102210 switch (lhs_ty.zigTypeTag(mod)) {
22112211 .Vector => return self.fail("TODO binary operations on vectors", .{}),
22122212 .Int => {
......@@ -2241,7 +2241,7 @@ fn bitwise(
22412241 rhs_ty: Type,
22422242 maybe_inst: ?Air.Inst.Index,
22432243) InnerError!MCValue {
2244 const mod = self.bin_file.options.module.?;
2244 const mod = self.bin_file.comp.module.?;
22452245 switch (lhs_ty.zigTypeTag(mod)) {
22462246 .Vector => return self.fail("TODO binary operations on vectors", .{}),
22472247 .Int => {
......@@ -2276,7 +2276,7 @@ fn shiftExact(
22762276) InnerError!MCValue {
22772277 _ = rhs_ty;
22782278
2279 const mod = self.bin_file.options.module.?;
2279 const mod = self.bin_file.comp.module.?;
22802280 switch (lhs_ty.zigTypeTag(mod)) {
22812281 .Vector => return self.fail("TODO binary operations on vectors", .{}),
22822282 .Int => {
......@@ -2326,7 +2326,7 @@ fn shiftNormal(
23262326 rhs_ty: Type,
23272327 maybe_inst: ?Air.Inst.Index,
23282328) InnerError!MCValue {
2329 const mod = self.bin_file.options.module.?;
2329 const mod = self.bin_file.comp.module.?;
23302330 switch (lhs_ty.zigTypeTag(mod)) {
23312331 .Vector => return self.fail("TODO binary operations on vectors", .{}),
23322332 .Int => {
......@@ -2366,7 +2366,7 @@ fn booleanOp(
23662366 rhs_ty: Type,
23672367 maybe_inst: ?Air.Inst.Index,
23682368) InnerError!MCValue {
2369 const mod = self.bin_file.options.module.?;
2369 const mod = self.bin_file.comp.module.?;
23702370 switch (lhs_ty.zigTypeTag(mod)) {
23712371 .Bool => {
23722372 assert((try lhs_bind.resolveToImmediate(self)) == null); // should have been handled by Sema
......@@ -2393,7 +2393,7 @@ fn ptrArithmetic(
23932393 rhs_ty: Type,
23942394 maybe_inst: ?Air.Inst.Index,
23952395) InnerError!MCValue {
2396 const mod = self.bin_file.options.module.?;
2396 const mod = self.bin_file.comp.module.?;
23972397 switch (lhs_ty.zigTypeTag(mod)) {
23982398 .Pointer => {
23992399 assert(rhs_ty.eql(Type.usize, mod));
......@@ -2516,7 +2516,7 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void {
25162516 const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
25172517 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
25182518 const extra = self.air.extraData(Air.Bin, ty_pl.payload).data;
2519 const mod = self.bin_file.options.module.?;
2519 const mod = self.bin_file.comp.module.?;
25202520 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
25212521 const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs };
25222522 const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs };
......@@ -2644,7 +2644,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
26442644 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
26452645 const extra = self.air.extraData(Air.Bin, ty_pl.payload).data;
26462646 if (self.liveness.isUnused(inst)) return self.finishAir(inst, .dead, .{ extra.lhs, extra.rhs, .none });
2647 const mod = self.bin_file.options.module.?;
2647 const mod = self.bin_file.comp.module.?;
26482648 const result: MCValue = result: {
26492649 const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs };
26502650 const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs };
......@@ -2868,7 +2868,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
28682868 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
28692869 const extra = self.air.extraData(Air.Bin, ty_pl.payload).data;
28702870 if (self.liveness.isUnused(inst)) return self.finishAir(inst, .dead, .{ extra.lhs, extra.rhs, .none });
2871 const mod = self.bin_file.options.module.?;
2871 const mod = self.bin_file.comp.module.?;
28722872 const result: MCValue = result: {
28732873 const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs };
28742874 const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs };
......@@ -3016,7 +3016,7 @@ fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) !void {
30163016}
30173017
30183018fn optionalPayload(self: *Self, inst: Air.Inst.Index, mcv: MCValue, optional_ty: Type) !MCValue {
3019 const mod = self.bin_file.options.module.?;
3019 const mod = self.bin_file.comp.module.?;
30203020 const payload_ty = optional_ty.optionalChild(mod);
30213021 if (!payload_ty.hasRuntimeBits(mod)) return MCValue.none;
30223022 if (optional_ty.isPtrLikeOptional(mod)) {
......@@ -3060,7 +3060,7 @@ fn errUnionErr(
30603060 error_union_ty: Type,
30613061 maybe_inst: ?Air.Inst.Index,
30623062) !MCValue {
3063 const mod = self.bin_file.options.module.?;
3063 const mod = self.bin_file.comp.module.?;
30643064 const err_ty = error_union_ty.errorUnionSet(mod);
30653065 const payload_ty = error_union_ty.errorUnionPayload(mod);
30663066 if (err_ty.errorSetIsEmpty(mod)) {
......@@ -3140,7 +3140,7 @@ fn errUnionPayload(
31403140 error_union_ty: Type,
31413141 maybe_inst: ?Air.Inst.Index,
31423142) !MCValue {
3143 const mod = self.bin_file.options.module.?;
3143 const mod = self.bin_file.comp.module.?;
31443144 const err_ty = error_union_ty.errorUnionSet(mod);
31453145 const payload_ty = error_union_ty.errorUnionPayload(mod);
31463146 if (err_ty.errorSetIsEmpty(mod)) {
......@@ -3252,7 +3252,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void {
32523252}
32533253
32543254fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void {
3255 const mod = self.bin_file.options.module.?;
3255 const mod = self.bin_file.comp.module.?;
32563256 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
32573257
32583258 if (self.liveness.isUnused(inst)) {
......@@ -3297,7 +3297,7 @@ fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void {
32973297
32983298/// T to E!T
32993299fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void {
3300 const mod = self.bin_file.options.module.?;
3300 const mod = self.bin_file.comp.module.?;
33013301 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
33023302 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
33033303 const error_union_ty = ty_op.ty.toType();
......@@ -3323,7 +3323,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void {
33233323fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void {
33243324 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
33253325 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
3326 const mod = self.bin_file.options.module.?;
3326 const mod = self.bin_file.comp.module.?;
33273327 const error_union_ty = ty_op.ty.toType();
33283328 const error_ty = error_union_ty.errorUnionSet(mod);
33293329 const payload_ty = error_union_ty.errorUnionPayload(mod);
......@@ -3426,7 +3426,7 @@ fn airPtrSlicePtrPtr(self: *Self, inst: Air.Inst.Index) !void {
34263426}
34273427
34283428fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void {
3429 const mod = self.bin_file.options.module.?;
3429 const mod = self.bin_file.comp.module.?;
34303430 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
34313431 const slice_ty = self.typeOf(bin_op.lhs);
34323432 const result: MCValue = if (!slice_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: {
......@@ -3450,7 +3450,7 @@ fn ptrElemVal(
34503450 ptr_ty: Type,
34513451 maybe_inst: ?Air.Inst.Index,
34523452) !MCValue {
3453 const mod = self.bin_file.options.module.?;
3453 const mod = self.bin_file.comp.module.?;
34543454 const elem_ty = ptr_ty.childType(mod);
34553455 const elem_size = @as(u32, @intCast(elem_ty.abiSize(mod)));
34563456
......@@ -3492,7 +3492,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void {
34923492}
34933493
34943494fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void {
3495 const mod = self.bin_file.options.module.?;
3495 const mod = self.bin_file.comp.module.?;
34963496 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
34973497 const ptr_ty = self.typeOf(bin_op.lhs);
34983498 const result: MCValue = if (!ptr_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: {
......@@ -3615,7 +3615,7 @@ fn reuseOperand(
36153615}
36163616
36173617fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!void {
3618 const mod = self.bin_file.options.module.?;
3618 const mod = self.bin_file.comp.module.?;
36193619 const elem_ty = ptr_ty.childType(mod);
36203620 const elem_size = elem_ty.abiSize(mod);
36213621
......@@ -3863,7 +3863,7 @@ fn genInlineMemsetCode(
38633863}
38643864
38653865fn airLoad(self: *Self, inst: Air.Inst.Index) !void {
3866 const mod = self.bin_file.options.module.?;
3866 const mod = self.bin_file.comp.module.?;
38673867 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
38683868 const elem_ty = self.typeOfIndex(inst);
38693869 const elem_size = elem_ty.abiSize(mod);
......@@ -3894,7 +3894,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) !void {
38943894}
38953895
38963896fn genLdrRegister(self: *Self, value_reg: Register, addr_reg: Register, ty: Type) !void {
3897 const mod = self.bin_file.options.module.?;
3897 const mod = self.bin_file.comp.module.?;
38983898 const abi_size = ty.abiSize(mod);
38993899
39003900 const tag: Mir.Inst.Tag = switch (abi_size) {
......@@ -3917,7 +3917,7 @@ fn genLdrRegister(self: *Self, value_reg: Register, addr_reg: Register, ty: Type
39173917}
39183918
39193919fn genStrRegister(self: *Self, value_reg: Register, addr_reg: Register, ty: Type) !void {
3920 const mod = self.bin_file.options.module.?;
3920 const mod = self.bin_file.comp.module.?;
39213921 const abi_size = ty.abiSize(mod);
39223922
39233923 const tag: Mir.Inst.Tag = switch (abi_size) {
......@@ -3939,7 +3939,7 @@ fn genStrRegister(self: *Self, value_reg: Register, addr_reg: Register, ty: Type
39393939}
39403940
39413941fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type) InnerError!void {
3942 const mod = self.bin_file.options.module.?;
3942 const mod = self.bin_file.comp.module.?;
39433943 log.debug("store: storing {} to {}", .{ value, ptr });
39443944 const abi_size = value_ty.abiSize(mod);
39453945
......@@ -4092,7 +4092,7 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void {
40924092
40934093fn structFieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32) !MCValue {
40944094 return if (self.liveness.isUnused(inst)) .dead else result: {
4095 const mod = self.bin_file.options.module.?;
4095 const mod = self.bin_file.comp.module.?;
40964096 const mcv = try self.resolveInst(operand);
40974097 const ptr_ty = self.typeOf(operand);
40984098 const struct_ty = ptr_ty.childType(mod);
......@@ -4117,7 +4117,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
41174117 const operand = extra.struct_operand;
41184118 const index = extra.field_index;
41194119 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
4120 const mod = self.bin_file.options.module.?;
4120 const mod = self.bin_file.comp.module.?;
41214121 const mcv = try self.resolveInst(operand);
41224122 const struct_ty = self.typeOf(operand);
41234123 const struct_field_ty = struct_ty.structFieldType(index, mod);
......@@ -4167,7 +4167,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
41674167}
41684168
41694169fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void {
4170 const mod = self.bin_file.options.module.?;
4170 const mod = self.bin_file.comp.module.?;
41714171 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
41724172 const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;
41734173 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
......@@ -4195,7 +4195,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void {
41954195 while (self.args[arg_index] == .none) arg_index += 1;
41964196 self.arg_index = arg_index + 1;
41974197
4198 const mod = self.bin_file.options.module.?;
4198 const mod = self.bin_file.comp.module.?;
41994199 const ty = self.typeOfIndex(inst);
42004200 const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
42014201 const src_index = self.air.instructions.items(.data)[@intFromEnum(inst)].arg.src_index;
......@@ -4250,7 +4250,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
42504250 const extra = self.air.extraData(Air.Call, pl_op.payload);
42514251 const args = @as([]const Air.Inst.Ref, @ptrCast(self.air.extra[extra.end..][0..extra.data.args_len]));
42524252 const ty = self.typeOf(callee);
4253 const mod = self.bin_file.options.module.?;
4253 const mod = self.bin_file.comp.module.?;
42544254
42554255 const fn_ty = switch (ty.zigTypeTag(mod)) {
42564256 .Fn => ty,
......@@ -4422,7 +4422,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
44224422}
44234423
44244424fn airRet(self: *Self, inst: Air.Inst.Index) !void {
4425 const mod = self.bin_file.options.module.?;
4425 const mod = self.bin_file.comp.module.?;
44264426 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
44274427 const operand = try self.resolveInst(un_op);
44284428 const ret_ty = self.fn_type.fnReturnType(mod);
......@@ -4454,7 +4454,7 @@ fn airRet(self: *Self, inst: Air.Inst.Index) !void {
44544454}
44554455
44564456fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void {
4457 const mod = self.bin_file.options.module.?;
4457 const mod = self.bin_file.comp.module.?;
44584458 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
44594459 const ptr = try self.resolveInst(un_op);
44604460 const ptr_ty = self.typeOf(un_op);
......@@ -4514,7 +4514,7 @@ fn cmp(
45144514 lhs_ty: Type,
45154515 op: math.CompareOperator,
45164516) !MCValue {
4517 const mod = self.bin_file.options.module.?;
4517 const mod = self.bin_file.comp.module.?;
45184518 const int_ty = switch (lhs_ty.zigTypeTag(mod)) {
45194519 .Optional => blk: {
45204520 const payload_ty = lhs_ty.optionalChild(mod);
......@@ -4622,7 +4622,7 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void {
46224622
46234623fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void {
46244624 const ty_fn = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_fn;
4625 const mod = self.bin_file.options.module.?;
4625 const mod = self.bin_file.comp.module.?;
46264626 const func = mod.funcInfo(ty_fn.func);
46274627 // TODO emit debug info for function change
46284628 _ = func;
......@@ -4830,7 +4830,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
48304830}
48314831
48324832fn isNull(self: *Self, operand_bind: ReadArg.Bind, operand_ty: Type) !MCValue {
4833 const mod = self.bin_file.options.module.?;
4833 const mod = self.bin_file.comp.module.?;
48344834 const sentinel: struct { ty: Type, bind: ReadArg.Bind } = if (!operand_ty.isPtrLikeOptional(mod)) blk: {
48354835 const payload_ty = operand_ty.optionalChild(mod);
48364836 if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod))
......@@ -4886,7 +4886,7 @@ fn isErr(
48864886 error_union_bind: ReadArg.Bind,
48874887 error_union_ty: Type,
48884888) !MCValue {
4889 const mod = self.bin_file.options.module.?;
4889 const mod = self.bin_file.comp.module.?;
48904890 const error_type = error_union_ty.errorUnionSet(mod);
48914891
48924892 if (error_type.errorSetIsEmpty(mod)) {
......@@ -4928,7 +4928,7 @@ fn airIsNull(self: *Self, inst: Air.Inst.Index) !void {
49284928}
49294929
49304930fn airIsNullPtr(self: *Self, inst: Air.Inst.Index) !void {
4931 const mod = self.bin_file.options.module.?;
4931 const mod = self.bin_file.comp.module.?;
49324932 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
49334933 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
49344934 const operand_ptr = try self.resolveInst(un_op);
......@@ -4955,7 +4955,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void {
49554955}
49564956
49574957fn airIsNonNullPtr(self: *Self, inst: Air.Inst.Index) !void {
4958 const mod = self.bin_file.options.module.?;
4958 const mod = self.bin_file.comp.module.?;
49594959 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
49604960 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
49614961 const operand_ptr = try self.resolveInst(un_op);
......@@ -4982,7 +4982,7 @@ fn airIsErr(self: *Self, inst: Air.Inst.Index) !void {
49824982}
49834983
49844984fn airIsErrPtr(self: *Self, inst: Air.Inst.Index) !void {
4985 const mod = self.bin_file.options.module.?;
4985 const mod = self.bin_file.comp.module.?;
49864986 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
49874987 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
49884988 const operand_ptr = try self.resolveInst(un_op);
......@@ -5009,7 +5009,7 @@ fn airIsNonErr(self: *Self, inst: Air.Inst.Index) !void {
50095009}
50105010
50115011fn airIsNonErrPtr(self: *Self, inst: Air.Inst.Index) !void {
5012 const mod = self.bin_file.options.module.?;
5012 const mod = self.bin_file.comp.module.?;
50135013 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
50145014 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
50155015 const operand_ptr = try self.resolveInst(un_op);
......@@ -5226,7 +5226,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void {
52265226}
52275227
52285228fn br(self: *Self, block: Air.Inst.Index, operand: Air.Inst.Ref) !void {
5229 const mod = self.bin_file.options.module.?;
5229 const mod = self.bin_file.comp.module.?;
52305230 const block_data = self.blocks.getPtr(block).?;
52315231
52325232 if (self.typeOf(operand).hasRuntimeBits(mod)) {
......@@ -5403,7 +5403,7 @@ fn setRegOrMem(self: *Self, ty: Type, loc: MCValue, val: MCValue) !void {
54035403}
54045404
54055405fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void {
5406 const mod = self.bin_file.options.module.?;
5406 const mod = self.bin_file.comp.module.?;
54075407 const abi_size = @as(u32, @intCast(ty.abiSize(mod)));
54085408 switch (mcv) {
54095409 .dead => unreachable,
......@@ -5573,7 +5573,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro
55735573}
55745574
55755575fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void {
5576 const mod = self.bin_file.options.module.?;
5576 const mod = self.bin_file.comp.module.?;
55775577 switch (mcv) {
55785578 .dead => unreachable,
55795579 .unreach, .none => return, // Nothing to do.
......@@ -5735,7 +5735,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void
57355735}
57365736
57375737fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void {
5738 const mod = self.bin_file.options.module.?;
5738 const mod = self.bin_file.comp.module.?;
57395739 const abi_size = @as(u32, @intCast(ty.abiSize(mod)));
57405740 switch (mcv) {
57415741 .dead => unreachable,
......@@ -5934,7 +5934,7 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void {
59345934}
59355935
59365936fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
5937 const mod = self.bin_file.options.module.?;
5937 const mod = self.bin_file.comp.module.?;
59385938 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
59395939 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
59405940 const ptr_ty = self.typeOf(ty_op.operand);
......@@ -6054,7 +6054,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void {
60546054}
60556055
60566056fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
6057 const mod = self.bin_file.options.module.?;
6057 const mod = self.bin_file.comp.module.?;
60586058 const vector_ty = self.typeOfIndex(inst);
60596059 const len = vector_ty.vectorLen(mod);
60606060 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
......@@ -6098,7 +6098,7 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
60986098}
60996099
61006100fn airTry(self: *Self, inst: Air.Inst.Index) !void {
6101 const mod = self.bin_file.options.module.?;
6101 const mod = self.bin_file.comp.module.?;
61026102 const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
61036103 const extra = self.air.extraData(Air.Try, pl_op.payload);
61046104 const body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra.end..][0..extra.data.body_len]);
......@@ -6135,7 +6135,7 @@ fn airTryPtr(self: *Self, inst: Air.Inst.Index) !void {
61356135}
61366136
61376137fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue {
6138 const mod = self.bin_file.options.module.?;
6138 const mod = self.bin_file.comp.module.?;
61396139
61406140 // If the type has no codegen bits, no need to store it.
61416141 const inst_ty = self.typeOf(inst);
......@@ -6200,7 +6200,7 @@ const CallMCValues = struct {
62006200
62016201/// Caller must call `CallMCValues.deinit`.
62026202fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
6203 const mod = self.bin_file.options.module.?;
6203 const mod = self.bin_file.comp.module.?;
62046204 const ip = &mod.intern_pool;
62056205 const fn_info = mod.typeToFunc(fn_ty).?;
62066206 const cc = fn_info.cc;
......@@ -6363,7 +6363,7 @@ fn parseRegName(name: []const u8) ?Register {
63636363}
63646364
63656365fn registerAlias(self: *Self, reg: Register, ty: Type) Register {
6366 const mod = self.bin_file.options.module.?;
6366 const mod = self.bin_file.comp.module.?;
63676367 const abi_size = ty.abiSize(mod);
63686368
63696369 switch (reg.class()) {
......@@ -6392,11 +6392,11 @@ fn registerAlias(self: *Self, reg: Register, ty: Type) Register {
63926392}
63936393
63946394fn typeOf(self: *Self, inst: Air.Inst.Ref) Type {
6395 const mod = self.bin_file.options.module.?;
6395 const mod = self.bin_file.comp.module.?;
63966396 return self.air.typeOf(inst, &mod.intern_pool);
63976397}
63986398
63996399fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type {
6400 const mod = self.bin_file.options.module.?;
6400 const mod = self.bin_file.comp.module.?;
64016401 return self.air.typeOfIndex(inst, &mod.intern_pool);
64026402}
src/arch/arm/CodeGen.zig+70-70
......@@ -260,7 +260,7 @@ const DbgInfoReloc = struct {
260260 }
261261
262262 fn genArgDbgInfo(reloc: DbgInfoReloc, function: Self) error{OutOfMemory}!void {
263 const mod = function.bin_file.options.module.?;
263 const mod = function.bin_file.comp.module.?;
264264 switch (function.debug_output) {
265265 .dwarf => |dw| {
266266 const loc: link.File.Dwarf.DeclState.DbgInfoLoc = switch (reloc.mcv) {
......@@ -289,7 +289,7 @@ const DbgInfoReloc = struct {
289289 }
290290
291291 fn genVarDbgInfo(reloc: DbgInfoReloc, function: Self) !void {
292 const mod = function.bin_file.options.module.?;
292 const mod = function.bin_file.comp.module.?;
293293 const is_ptr = switch (reloc.tag) {
294294 .dbg_var_ptr => true,
295295 .dbg_var_val => false,
......@@ -348,7 +348,7 @@ pub fn generate(
348348 @panic("Attempted to compile for architecture that was disabled by build configuration");
349349 }
350350
351 const mod = bin_file.options.module.?;
351 const mod = bin_file.comp.module.?;
352352 const func = mod.funcInfo(func_index);
353353 const fn_owner_decl = mod.declPtr(func.owner_decl);
354354 assert(fn_owner_decl.has_tv);
......@@ -482,7 +482,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 {
482482}
483483
484484fn gen(self: *Self) !void {
485 const mod = self.bin_file.options.module.?;
485 const mod = self.bin_file.comp.module.?;
486486 const cc = self.fn_type.fnCallingConvention(mod);
487487 if (cc != .Naked) {
488488 // push {fp, lr}
......@@ -642,7 +642,7 @@ fn gen(self: *Self) !void {
642642}
643643
644644fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
645 const mod = self.bin_file.options.module.?;
645 const mod = self.bin_file.comp.module.?;
646646 const ip = &mod.intern_pool;
647647 const air_tags = self.air.instructions.items(.tag);
648648
......@@ -1010,7 +1010,7 @@ fn allocMem(
10101010
10111011/// Use a pointer instruction as the basis for allocating stack memory.
10121012fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 {
1013 const mod = self.bin_file.options.module.?;
1013 const mod = self.bin_file.comp.module.?;
10141014 const elem_ty = self.typeOfIndex(inst).childType(mod);
10151015
10161016 if (!elem_ty.hasRuntimeBits(mod)) {
......@@ -1031,7 +1031,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 {
10311031}
10321032
10331033fn allocRegOrMem(self: *Self, elem_ty: Type, reg_ok: bool, maybe_inst: ?Air.Inst.Index) !MCValue {
1034 const mod = self.bin_file.options.module.?;
1034 const mod = self.bin_file.comp.module.?;
10351035 const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse {
10361036 return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)});
10371037 };
......@@ -1118,7 +1118,7 @@ fn airAlloc(self: *Self, inst: Air.Inst.Index) !void {
11181118}
11191119
11201120fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void {
1121 const mod = self.bin_file.options.module.?;
1121 const mod = self.bin_file.comp.module.?;
11221122 const result: MCValue = switch (self.ret_mcv) {
11231123 .none, .register => .{ .ptr_stack_offset = try self.allocMemPtr(inst) },
11241124 .stack_offset => blk: {
......@@ -1151,7 +1151,7 @@ fn airFpext(self: *Self, inst: Air.Inst.Index) !void {
11511151}
11521152
11531153fn airIntCast(self: *Self, inst: Air.Inst.Index) !void {
1154 const mod = self.bin_file.options.module.?;
1154 const mod = self.bin_file.comp.module.?;
11551155 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
11561156 if (self.liveness.isUnused(inst))
11571157 return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none });
......@@ -1217,7 +1217,7 @@ fn trunc(
12171217 operand_ty: Type,
12181218 dest_ty: Type,
12191219) !MCValue {
1220 const mod = self.bin_file.options.module.?;
1220 const mod = self.bin_file.comp.module.?;
12211221 const info_a = operand_ty.intInfo(mod);
12221222 const info_b = dest_ty.intInfo(mod);
12231223
......@@ -1281,7 +1281,7 @@ fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void {
12811281
12821282fn airNot(self: *Self, inst: Air.Inst.Index) !void {
12831283 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
1284 const mod = self.bin_file.options.module.?;
1284 const mod = self.bin_file.comp.module.?;
12851285 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
12861286 const operand_bind: ReadArg.Bind = .{ .inst = ty_op.operand };
12871287 const operand_ty = self.typeOf(ty_op.operand);
......@@ -1377,7 +1377,7 @@ fn minMax(
13771377 rhs_ty: Type,
13781378 maybe_inst: ?Air.Inst.Index,
13791379) !MCValue {
1380 const mod = self.bin_file.options.module.?;
1380 const mod = self.bin_file.comp.module.?;
13811381 switch (lhs_ty.zigTypeTag(mod)) {
13821382 .Float => return self.fail("TODO ARM min/max on floats", .{}),
13831383 .Vector => return self.fail("TODO ARM min/max on vectors", .{}),
......@@ -1586,7 +1586,7 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void {
15861586 const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
15871587 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
15881588 const extra = self.air.extraData(Air.Bin, ty_pl.payload).data;
1589 const mod = self.bin_file.options.module.?;
1589 const mod = self.bin_file.comp.module.?;
15901590 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
15911591 const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs };
15921592 const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs };
......@@ -1699,7 +1699,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
16991699 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
17001700 const extra = self.air.extraData(Air.Bin, ty_pl.payload).data;
17011701 if (self.liveness.isUnused(inst)) return self.finishAir(inst, .dead, .{ extra.lhs, extra.rhs, .none });
1702 const mod = self.bin_file.options.module.?;
1702 const mod = self.bin_file.comp.module.?;
17031703 const result: MCValue = result: {
17041704 const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs };
17051705 const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs };
......@@ -1863,7 +1863,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
18631863 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
18641864 const extra = self.air.extraData(Air.Bin, ty_pl.payload).data;
18651865 if (self.liveness.isUnused(inst)) return self.finishAir(inst, .dead, .{ extra.lhs, extra.rhs, .none });
1866 const mod = self.bin_file.options.module.?;
1866 const mod = self.bin_file.comp.module.?;
18671867 const result: MCValue = result: {
18681868 const lhs_ty = self.typeOf(extra.lhs);
18691869 const rhs_ty = self.typeOf(extra.rhs);
......@@ -2019,7 +2019,7 @@ fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
20192019}
20202020
20212021fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void {
2022 const mod = self.bin_file.options.module.?;
2022 const mod = self.bin_file.comp.module.?;
20232023 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
20242024 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
20252025 const optional_ty = self.typeOfIndex(inst);
......@@ -2042,7 +2042,7 @@ fn errUnionErr(
20422042 error_union_ty: Type,
20432043 maybe_inst: ?Air.Inst.Index,
20442044) !MCValue {
2045 const mod = self.bin_file.options.module.?;
2045 const mod = self.bin_file.comp.module.?;
20462046 const err_ty = error_union_ty.errorUnionSet(mod);
20472047 const payload_ty = error_union_ty.errorUnionPayload(mod);
20482048 if (err_ty.errorSetIsEmpty(mod)) {
......@@ -2119,7 +2119,7 @@ fn errUnionPayload(
21192119 error_union_ty: Type,
21202120 maybe_inst: ?Air.Inst.Index,
21212121) !MCValue {
2122 const mod = self.bin_file.options.module.?;
2122 const mod = self.bin_file.comp.module.?;
21232123 const err_ty = error_union_ty.errorUnionSet(mod);
21242124 const payload_ty = error_union_ty.errorUnionPayload(mod);
21252125 if (err_ty.errorSetIsEmpty(mod)) {
......@@ -2229,7 +2229,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void {
22292229
22302230/// T to E!T
22312231fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void {
2232 const mod = self.bin_file.options.module.?;
2232 const mod = self.bin_file.comp.module.?;
22332233 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
22342234 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
22352235 const error_union_ty = ty_op.ty.toType();
......@@ -2253,7 +2253,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void {
22532253
22542254/// E to E!T
22552255fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void {
2256 const mod = self.bin_file.options.module.?;
2256 const mod = self.bin_file.comp.module.?;
22572257 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
22582258 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
22592259 const error_union_ty = ty_op.ty.toType();
......@@ -2370,7 +2370,7 @@ fn ptrElemVal(
23702370 ptr_ty: Type,
23712371 maybe_inst: ?Air.Inst.Index,
23722372) !MCValue {
2373 const mod = self.bin_file.options.module.?;
2373 const mod = self.bin_file.comp.module.?;
23742374 const elem_ty = ptr_ty.childType(mod);
23752375 const elem_size: u32 = @intCast(elem_ty.abiSize(mod));
23762376
......@@ -2429,7 +2429,7 @@ fn ptrElemVal(
24292429}
24302430
24312431fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void {
2432 const mod = self.bin_file.options.module.?;
2432 const mod = self.bin_file.comp.module.?;
24332433 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
24342434 const slice_ty = self.typeOf(bin_op.lhs);
24352435 const result: MCValue = if (!slice_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: {
......@@ -2472,7 +2472,7 @@ fn arrayElemVal(
24722472 array_ty: Type,
24732473 maybe_inst: ?Air.Inst.Index,
24742474) InnerError!MCValue {
2475 const mod = self.bin_file.options.module.?;
2475 const mod = self.bin_file.comp.module.?;
24762476 const elem_ty = array_ty.childType(mod);
24772477
24782478 const mcv = try array_bind.resolveToMcv(self);
......@@ -2528,7 +2528,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void {
25282528}
25292529
25302530fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void {
2531 const mod = self.bin_file.options.module.?;
2531 const mod = self.bin_file.comp.module.?;
25322532 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
25332533 const ptr_ty = self.typeOf(bin_op.lhs);
25342534 const result: MCValue = if (!ptr_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: {
......@@ -2662,7 +2662,7 @@ fn reuseOperand(
26622662}
26632663
26642664fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!void {
2665 const mod = self.bin_file.options.module.?;
2665 const mod = self.bin_file.comp.module.?;
26662666 const elem_ty = ptr_ty.childType(mod);
26672667 const elem_size: u32 = @intCast(elem_ty.abiSize(mod));
26682668
......@@ -2739,7 +2739,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!vo
27392739}
27402740
27412741fn airLoad(self: *Self, inst: Air.Inst.Index) !void {
2742 const mod = self.bin_file.options.module.?;
2742 const mod = self.bin_file.comp.module.?;
27432743 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
27442744 const elem_ty = self.typeOfIndex(inst);
27452745 const result: MCValue = result: {
......@@ -2768,7 +2768,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) !void {
27682768}
27692769
27702770fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type) InnerError!void {
2771 const mod = self.bin_file.options.module.?;
2771 const mod = self.bin_file.comp.module.?;
27722772 const elem_size: u32 = @intCast(value_ty.abiSize(mod));
27732773
27742774 switch (ptr) {
......@@ -2888,7 +2888,7 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void {
28882888
28892889fn structFieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32) !MCValue {
28902890 return if (self.liveness.isUnused(inst)) .dead else result: {
2891 const mod = self.bin_file.options.module.?;
2891 const mod = self.bin_file.comp.module.?;
28922892 const mcv = try self.resolveInst(operand);
28932893 const ptr_ty = self.typeOf(operand);
28942894 const struct_ty = ptr_ty.childType(mod);
......@@ -2912,7 +2912,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
29122912 const extra = self.air.extraData(Air.StructField, ty_pl.payload).data;
29132913 const operand = extra.struct_operand;
29142914 const index = extra.field_index;
2915 const mod = self.bin_file.options.module.?;
2915 const mod = self.bin_file.comp.module.?;
29162916 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
29172917 const mcv = try self.resolveInst(operand);
29182918 const struct_ty = self.typeOf(operand);
......@@ -3002,7 +3002,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
30023002}
30033003
30043004fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void {
3005 const mod = self.bin_file.options.module.?;
3005 const mod = self.bin_file.comp.module.?;
30063006 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
30073007 const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;
30083008 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
......@@ -3396,7 +3396,7 @@ fn addSub(
33963396 rhs_ty: Type,
33973397 maybe_inst: ?Air.Inst.Index,
33983398) InnerError!MCValue {
3399 const mod = self.bin_file.options.module.?;
3399 const mod = self.bin_file.comp.module.?;
34003400 switch (lhs_ty.zigTypeTag(mod)) {
34013401 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
34023402 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
......@@ -3452,7 +3452,7 @@ fn mul(
34523452 rhs_ty: Type,
34533453 maybe_inst: ?Air.Inst.Index,
34543454) InnerError!MCValue {
3455 const mod = self.bin_file.options.module.?;
3455 const mod = self.bin_file.comp.module.?;
34563456 switch (lhs_ty.zigTypeTag(mod)) {
34573457 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
34583458 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
......@@ -3485,7 +3485,7 @@ fn divFloat(
34853485 _ = rhs_ty;
34863486 _ = maybe_inst;
34873487
3488 const mod = self.bin_file.options.module.?;
3488 const mod = self.bin_file.comp.module.?;
34893489 switch (lhs_ty.zigTypeTag(mod)) {
34903490 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
34913491 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
......@@ -3501,7 +3501,7 @@ fn divTrunc(
35013501 rhs_ty: Type,
35023502 maybe_inst: ?Air.Inst.Index,
35033503) InnerError!MCValue {
3504 const mod = self.bin_file.options.module.?;
3504 const mod = self.bin_file.comp.module.?;
35053505 switch (lhs_ty.zigTypeTag(mod)) {
35063506 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
35073507 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
......@@ -3544,7 +3544,7 @@ fn divFloor(
35443544 rhs_ty: Type,
35453545 maybe_inst: ?Air.Inst.Index,
35463546) InnerError!MCValue {
3547 const mod = self.bin_file.options.module.?;
3547 const mod = self.bin_file.comp.module.?;
35483548 switch (lhs_ty.zigTypeTag(mod)) {
35493549 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
35503550 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
......@@ -3592,7 +3592,7 @@ fn divExact(
35923592 _ = rhs_ty;
35933593 _ = maybe_inst;
35943594
3595 const mod = self.bin_file.options.module.?;
3595 const mod = self.bin_file.comp.module.?;
35963596 switch (lhs_ty.zigTypeTag(mod)) {
35973597 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
35983598 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
......@@ -3609,7 +3609,7 @@ fn rem(
36093609 rhs_ty: Type,
36103610 maybe_inst: ?Air.Inst.Index,
36113611) InnerError!MCValue {
3612 const mod = self.bin_file.options.module.?;
3612 const mod = self.bin_file.comp.module.?;
36133613 switch (lhs_ty.zigTypeTag(mod)) {
36143614 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
36153615 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
......@@ -3678,7 +3678,7 @@ fn modulo(
36783678 _ = rhs_ty;
36793679 _ = maybe_inst;
36803680
3681 const mod = self.bin_file.options.module.?;
3681 const mod = self.bin_file.comp.module.?;
36823682 switch (lhs_ty.zigTypeTag(mod)) {
36833683 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
36843684 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
......@@ -3696,7 +3696,7 @@ fn wrappingArithmetic(
36963696 rhs_ty: Type,
36973697 maybe_inst: ?Air.Inst.Index,
36983698) InnerError!MCValue {
3699 const mod = self.bin_file.options.module.?;
3699 const mod = self.bin_file.comp.module.?;
37003700 switch (lhs_ty.zigTypeTag(mod)) {
37013701 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
37023702 .Int => {
......@@ -3734,7 +3734,7 @@ fn bitwise(
37343734 rhs_ty: Type,
37353735 maybe_inst: ?Air.Inst.Index,
37363736) InnerError!MCValue {
3737 const mod = self.bin_file.options.module.?;
3737 const mod = self.bin_file.comp.module.?;
37383738 switch (lhs_ty.zigTypeTag(mod)) {
37393739 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
37403740 .Int => {
......@@ -3779,7 +3779,7 @@ fn shiftExact(
37793779 rhs_ty: Type,
37803780 maybe_inst: ?Air.Inst.Index,
37813781) InnerError!MCValue {
3782 const mod = self.bin_file.options.module.?;
3782 const mod = self.bin_file.comp.module.?;
37833783 switch (lhs_ty.zigTypeTag(mod)) {
37843784 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
37853785 .Int => {
......@@ -3818,7 +3818,7 @@ fn shiftNormal(
38183818 rhs_ty: Type,
38193819 maybe_inst: ?Air.Inst.Index,
38203820) InnerError!MCValue {
3821 const mod = self.bin_file.options.module.?;
3821 const mod = self.bin_file.comp.module.?;
38223822 switch (lhs_ty.zigTypeTag(mod)) {
38233823 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
38243824 .Int => {
......@@ -3861,7 +3861,7 @@ fn booleanOp(
38613861 rhs_ty: Type,
38623862 maybe_inst: ?Air.Inst.Index,
38633863) InnerError!MCValue {
3864 const mod = self.bin_file.options.module.?;
3864 const mod = self.bin_file.comp.module.?;
38653865 switch (lhs_ty.zigTypeTag(mod)) {
38663866 .Bool => {
38673867 const lhs_immediate = try lhs_bind.resolveToImmediate(self);
......@@ -3895,7 +3895,7 @@ fn ptrArithmetic(
38953895 rhs_ty: Type,
38963896 maybe_inst: ?Air.Inst.Index,
38973897) InnerError!MCValue {
3898 const mod = self.bin_file.options.module.?;
3898 const mod = self.bin_file.comp.module.?;
38993899 switch (lhs_ty.zigTypeTag(mod)) {
39003900 .Pointer => {
39013901 assert(rhs_ty.eql(Type.usize, mod));
......@@ -3932,7 +3932,7 @@ fn ptrArithmetic(
39323932}
39333933
39343934fn genLdrRegister(self: *Self, dest_reg: Register, addr_reg: Register, ty: Type) !void {
3935 const mod = self.bin_file.options.module.?;
3935 const mod = self.bin_file.comp.module.?;
39363936 const abi_size = ty.abiSize(mod);
39373937
39383938 const tag: Mir.Inst.Tag = switch (abi_size) {
......@@ -3967,7 +3967,7 @@ fn genLdrRegister(self: *Self, dest_reg: Register, addr_reg: Register, ty: Type)
39673967}
39683968
39693969fn genStrRegister(self: *Self, source_reg: Register, addr_reg: Register, ty: Type) !void {
3970 const mod = self.bin_file.options.module.?;
3970 const mod = self.bin_file.comp.module.?;
39713971 const abi_size = ty.abiSize(mod);
39723972
39733973 const tag: Mir.Inst.Tag = switch (abi_size) {
......@@ -4174,7 +4174,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void {
41744174 while (self.args[arg_index] == .none) arg_index += 1;
41754175 self.arg_index = arg_index + 1;
41764176
4177 const mod = self.bin_file.options.module.?;
4177 const mod = self.bin_file.comp.module.?;
41784178 const ty = self.typeOfIndex(inst);
41794179 const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
41804180 const src_index = self.air.instructions.items(.data)[@intFromEnum(inst)].arg.src_index;
......@@ -4229,7 +4229,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
42294229 const extra = self.air.extraData(Air.Call, pl_op.payload);
42304230 const args: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra.end..][0..extra.data.args_len]);
42314231 const ty = self.typeOf(callee);
4232 const mod = self.bin_file.options.module.?;
4232 const mod = self.bin_file.comp.module.?;
42334233
42344234 const fn_ty = switch (ty.zigTypeTag(mod)) {
42354235 .Fn => ty,
......@@ -4380,7 +4380,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
43804380}
43814381
43824382fn airRet(self: *Self, inst: Air.Inst.Index) !void {
4383 const mod = self.bin_file.options.module.?;
4383 const mod = self.bin_file.comp.module.?;
43844384 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
43854385 const operand = try self.resolveInst(un_op);
43864386 const ret_ty = self.fn_type.fnReturnType(mod);
......@@ -4412,7 +4412,7 @@ fn airRet(self: *Self, inst: Air.Inst.Index) !void {
44124412}
44134413
44144414fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void {
4415 const mod = self.bin_file.options.module.?;
4415 const mod = self.bin_file.comp.module.?;
44164416 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
44174417 const ptr = try self.resolveInst(un_op);
44184418 const ptr_ty = self.typeOf(un_op);
......@@ -4473,7 +4473,7 @@ fn cmp(
44734473 lhs_ty: Type,
44744474 op: math.CompareOperator,
44754475) !MCValue {
4476 const mod = self.bin_file.options.module.?;
4476 const mod = self.bin_file.comp.module.?;
44774477 const int_ty = switch (lhs_ty.zigTypeTag(mod)) {
44784478 .Optional => blk: {
44794479 const payload_ty = lhs_ty.optionalChild(mod);
......@@ -4580,7 +4580,7 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void {
45804580
45814581fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void {
45824582 const ty_fn = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_fn;
4583 const mod = self.bin_file.options.module.?;
4583 const mod = self.bin_file.comp.module.?;
45844584 const func = mod.funcInfo(ty_fn.func);
45854585 // TODO emit debug info for function change
45864586 _ = func;
......@@ -4795,7 +4795,7 @@ fn isNull(
47954795 operand_bind: ReadArg.Bind,
47964796 operand_ty: Type,
47974797) !MCValue {
4798 const mod = self.bin_file.options.module.?;
4798 const mod = self.bin_file.comp.module.?;
47994799 if (operand_ty.isPtrLikeOptional(mod)) {
48004800 assert(operand_ty.abiSize(mod) == 4);
48014801
......@@ -4829,7 +4829,7 @@ fn airIsNull(self: *Self, inst: Air.Inst.Index) !void {
48294829}
48304830
48314831fn airIsNullPtr(self: *Self, inst: Air.Inst.Index) !void {
4832 const mod = self.bin_file.options.module.?;
4832 const mod = self.bin_file.comp.module.?;
48334833 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
48344834 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
48354835 const operand_ptr = try self.resolveInst(un_op);
......@@ -4856,7 +4856,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void {
48564856}
48574857
48584858fn airIsNonNullPtr(self: *Self, inst: Air.Inst.Index) !void {
4859 const mod = self.bin_file.options.module.?;
4859 const mod = self.bin_file.comp.module.?;
48604860 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
48614861 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
48624862 const operand_ptr = try self.resolveInst(un_op);
......@@ -4876,7 +4876,7 @@ fn isErr(
48764876 error_union_bind: ReadArg.Bind,
48774877 error_union_ty: Type,
48784878) !MCValue {
4879 const mod = self.bin_file.options.module.?;
4879 const mod = self.bin_file.comp.module.?;
48804880 const error_type = error_union_ty.errorUnionSet(mod);
48814881
48824882 if (error_type.errorSetIsEmpty(mod)) {
......@@ -4918,7 +4918,7 @@ fn airIsErr(self: *Self, inst: Air.Inst.Index) !void {
49184918}
49194919
49204920fn airIsErrPtr(self: *Self, inst: Air.Inst.Index) !void {
4921 const mod = self.bin_file.options.module.?;
4921 const mod = self.bin_file.comp.module.?;
49224922 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
49234923 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
49244924 const operand_ptr = try self.resolveInst(un_op);
......@@ -4945,7 +4945,7 @@ fn airIsNonErr(self: *Self, inst: Air.Inst.Index) !void {
49454945}
49464946
49474947fn airIsNonErrPtr(self: *Self, inst: Air.Inst.Index) !void {
4948 const mod = self.bin_file.options.module.?;
4948 const mod = self.bin_file.comp.module.?;
49494949 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
49504950 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
49514951 const operand_ptr = try self.resolveInst(un_op);
......@@ -5160,7 +5160,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void {
51605160}
51615161
51625162fn br(self: *Self, block: Air.Inst.Index, operand: Air.Inst.Ref) !void {
5163 const mod = self.bin_file.options.module.?;
5163 const mod = self.bin_file.comp.module.?;
51645164 const block_data = self.blocks.getPtr(block).?;
51655165
51665166 if (self.typeOf(operand).hasRuntimeBits(mod)) {
......@@ -5331,7 +5331,7 @@ fn setRegOrMem(self: *Self, ty: Type, loc: MCValue, val: MCValue) !void {
53315331}
53325332
53335333fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void {
5334 const mod = self.bin_file.options.module.?;
5334 const mod = self.bin_file.comp.module.?;
53355335 const abi_size: u32 = @intCast(ty.abiSize(mod));
53365336 switch (mcv) {
53375337 .dead => unreachable,
......@@ -5493,7 +5493,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro
54935493}
54945494
54955495fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void {
5496 const mod = self.bin_file.options.module.?;
5496 const mod = self.bin_file.comp.module.?;
54975497 switch (mcv) {
54985498 .dead => unreachable,
54995499 .unreach, .none => return, // Nothing to do.
......@@ -5740,7 +5740,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void
57405740}
57415741
57425742fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void {
5743 const mod = self.bin_file.options.module.?;
5743 const mod = self.bin_file.comp.module.?;
57445744 const abi_size: u32 = @intCast(ty.abiSize(mod));
57455745 switch (mcv) {
57465746 .dead => unreachable,
......@@ -5896,7 +5896,7 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void {
58965896}
58975897
58985898fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
5899 const mod = self.bin_file.options.module.?;
5899 const mod = self.bin_file.comp.module.?;
59005900 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
59015901 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
59025902 const ptr_ty = self.typeOf(ty_op.operand);
......@@ -6015,7 +6015,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void {
60156015}
60166016
60176017fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
6018 const mod = self.bin_file.options.module.?;
6018 const mod = self.bin_file.comp.module.?;
60196019 const vector_ty = self.typeOfIndex(inst);
60206020 const len = vector_ty.vectorLen(mod);
60216021 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
......@@ -6066,7 +6066,7 @@ fn airTry(self: *Self, inst: Air.Inst.Index) !void {
60666066 const result: MCValue = result: {
60676067 const error_union_bind: ReadArg.Bind = .{ .inst = pl_op.operand };
60686068 const error_union_ty = self.typeOf(pl_op.operand);
6069 const mod = self.bin_file.options.module.?;
6069 const mod = self.bin_file.comp.module.?;
60706070 const error_union_size: u32 = @intCast(error_union_ty.abiSize(mod));
60716071 const error_union_align = error_union_ty.abiAlignment(mod);
60726072
......@@ -6097,7 +6097,7 @@ fn airTryPtr(self: *Self, inst: Air.Inst.Index) !void {
60976097}
60986098
60996099fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue {
6100 const mod = self.bin_file.options.module.?;
6100 const mod = self.bin_file.comp.module.?;
61016101
61026102 // If the type has no codegen bits, no need to store it.
61036103 const inst_ty = self.typeOf(inst);
......@@ -6125,7 +6125,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue {
61256125}
61266126
61276127fn genTypedValue(self: *Self, arg_tv: TypedValue) InnerError!MCValue {
6128 const mod = self.bin_file.options.module.?;
6128 const mod = self.bin_file.comp.module.?;
61296129 const mcv: MCValue = switch (try codegen.genTypedValue(
61306130 self.bin_file,
61316131 self.src_loc,
......@@ -6161,7 +6161,7 @@ const CallMCValues = struct {
61616161
61626162/// Caller must call `CallMCValues.deinit`.
61636163fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
6164 const mod = self.bin_file.options.module.?;
6164 const mod = self.bin_file.comp.module.?;
61656165 const ip = &mod.intern_pool;
61666166 const fn_info = mod.typeToFunc(fn_ty).?;
61676167 const cc = fn_info.cc;
......@@ -6312,11 +6312,11 @@ fn parseRegName(name: []const u8) ?Register {
63126312}
63136313
63146314fn typeOf(self: *Self, inst: Air.Inst.Ref) Type {
6315 const mod = self.bin_file.options.module.?;
6315 const mod = self.bin_file.comp.module.?;
63166316 return self.air.typeOf(inst, &mod.intern_pool);
63176317}
63186318
63196319fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type {
6320 const mod = self.bin_file.options.module.?;
6320 const mod = self.bin_file.comp.module.?;
63216321 return self.air.typeOfIndex(inst, &mod.intern_pool);
63226322}
src/arch/riscv64/CodeGen.zig+22-22
......@@ -229,7 +229,7 @@ pub fn generate(
229229 @panic("Attempted to compile for architecture that was disabled by build configuration");
230230 }
231231
232 const mod = bin_file.options.module.?;
232 const mod = bin_file.comp.module.?;
233233 const func = mod.funcInfo(func_index);
234234 const fn_owner_decl = mod.declPtr(func.owner_decl);
235235 assert(fn_owner_decl.has_tv);
......@@ -350,7 +350,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 {
350350}
351351
352352fn gen(self: *Self) !void {
353 const mod = self.bin_file.options.module.?;
353 const mod = self.bin_file.comp.module.?;
354354 const cc = self.fn_type.fnCallingConvention(mod);
355355 if (cc != .Naked) {
356356 // TODO Finish function prologue and epilogue for riscv64.
......@@ -474,7 +474,7 @@ fn gen(self: *Self) !void {
474474}
475475
476476fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
477 const mod = self.bin_file.options.module.?;
477 const mod = self.bin_file.comp.module.?;
478478 const ip = &mod.intern_pool;
479479 const air_tags = self.air.instructions.items(.tag);
480480
......@@ -805,7 +805,7 @@ fn allocMem(self: *Self, inst: Air.Inst.Index, abi_size: u32, abi_align: Alignme
805805
806806/// Use a pointer instruction as the basis for allocating stack memory.
807807fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 {
808 const mod = self.bin_file.options.module.?;
808 const mod = self.bin_file.comp.module.?;
809809 const elem_ty = self.typeOfIndex(inst).childType(mod);
810810 const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse {
811811 return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)});
......@@ -816,7 +816,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 {
816816}
817817
818818fn allocRegOrMem(self: *Self, inst: Air.Inst.Index, reg_ok: bool) !MCValue {
819 const mod = self.bin_file.options.module.?;
819 const mod = self.bin_file.comp.module.?;
820820 const elem_ty = self.typeOfIndex(inst);
821821 const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse {
822822 return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)});
......@@ -893,7 +893,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void {
893893 if (self.liveness.isUnused(inst))
894894 return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none });
895895
896 const mod = self.bin_file.options.module.?;
896 const mod = self.bin_file.comp.module.?;
897897 const operand_ty = self.typeOf(ty_op.operand);
898898 const operand = try self.resolveInst(ty_op.operand);
899899 const info_a = operand_ty.intInfo(mod);
......@@ -1069,7 +1069,7 @@ fn binOp(
10691069 lhs_ty: Type,
10701070 rhs_ty: Type,
10711071) InnerError!MCValue {
1072 const mod = self.bin_file.options.module.?;
1072 const mod = self.bin_file.comp.module.?;
10731073 switch (tag) {
10741074 // Arithmetic operations on integers and floats
10751075 .add,
......@@ -1332,7 +1332,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void {
13321332fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void {
13331333 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
13341334 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
1335 const mod = self.bin_file.options.module.?;
1335 const mod = self.bin_file.comp.module.?;
13361336 const optional_ty = self.typeOfIndex(inst);
13371337
13381338 // Optional with a zero-bit payload type is just a boolean true
......@@ -1506,7 +1506,7 @@ fn reuseOperand(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, op_ind
15061506}
15071507
15081508fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!void {
1509 const mod = self.bin_file.options.module.?;
1509 const mod = self.bin_file.comp.module.?;
15101510 const elem_ty = ptr_ty.childType(mod);
15111511 switch (ptr) {
15121512 .none => unreachable,
......@@ -1532,7 +1532,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!vo
15321532}
15331533
15341534fn airLoad(self: *Self, inst: Air.Inst.Index) !void {
1535 const mod = self.bin_file.options.module.?;
1535 const mod = self.bin_file.comp.module.?;
15361536 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
15371537 const elem_ty = self.typeOfIndex(inst);
15381538 const result: MCValue = result: {
......@@ -1633,7 +1633,7 @@ fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void {
16331633}
16341634
16351635fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, mcv: MCValue) !void {
1636 const mod = self.bin_file.options.module.?;
1636 const mod = self.bin_file.comp.module.?;
16371637 const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg;
16381638 const ty = arg.ty.toType();
16391639 const owner_decl = mod.funcOwnerDeclIndex(self.func_index);
......@@ -1710,7 +1710,7 @@ fn airFence(self: *Self) !void {
17101710}
17111711
17121712fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void {
1713 const mod = self.bin_file.options.module.?;
1713 const mod = self.bin_file.comp.module.?;
17141714 if (modifier == .always_tail) return self.fail("TODO implement tail calls for riscv64", .{});
17151715 const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
17161716 const fn_ty = self.typeOf(pl_op.operand);
......@@ -1812,7 +1812,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
18121812}
18131813
18141814fn ret(self: *Self, mcv: MCValue) !void {
1815 const mod = self.bin_file.options.module.?;
1815 const mod = self.bin_file.comp.module.?;
18161816 const ret_ty = self.fn_type.fnReturnType(mod);
18171817 try self.setRegOrMem(ret_ty, self.ret_mcv, mcv);
18181818 // Just add space for an instruction, patch this later
......@@ -1843,7 +1843,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
18431843 if (self.liveness.isUnused(inst))
18441844 return self.finishAir(inst, .dead, .{ bin_op.lhs, bin_op.rhs, .none });
18451845 const ty = self.typeOf(bin_op.lhs);
1846 const mod = self.bin_file.options.module.?;
1846 const mod = self.bin_file.comp.module.?;
18471847 assert(ty.eql(self.typeOf(bin_op.rhs), mod));
18481848 if (ty.zigTypeTag(mod) == .ErrorSet)
18491849 return self.fail("TODO implement cmp for errors", .{});
......@@ -1887,7 +1887,7 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void {
18871887
18881888fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void {
18891889 const ty_fn = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_fn;
1890 const mod = self.bin_file.options.module.?;
1890 const mod = self.bin_file.comp.module.?;
18911891 const func = mod.funcInfo(ty_fn.func);
18921892 // TODO emit debug info for function change
18931893 _ = func;
......@@ -2125,7 +2125,7 @@ fn airBoolOp(self: *Self, inst: Air.Inst.Index) !void {
21252125fn br(self: *Self, block: Air.Inst.Index, operand: Air.Inst.Ref) !void {
21262126 const block_data = self.blocks.getPtr(block).?;
21272127
2128 const mod = self.bin_file.options.module.?;
2128 const mod = self.bin_file.comp.module.?;
21292129 if (self.typeOf(operand).hasRuntimeBits(mod)) {
21302130 const operand_mcv = try self.resolveInst(operand);
21312131 const block_mcv = block_data.mcv;
......@@ -2508,7 +2508,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void {
25082508}
25092509
25102510fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
2511 const mod = self.bin_file.options.module.?;
2511 const mod = self.bin_file.comp.module.?;
25122512 const vector_ty = self.typeOfIndex(inst);
25132513 const len = vector_ty.vectorLen(mod);
25142514 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
......@@ -2553,7 +2553,7 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
25532553}
25542554
25552555fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue {
2556 const mod = self.bin_file.options.module.?;
2556 const mod = self.bin_file.comp.module.?;
25572557
25582558 // If the type has no codegen bits, no need to store it.
25592559 const inst_ty = self.typeOf(inst);
......@@ -2581,7 +2581,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue {
25812581}
25822582
25832583fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue {
2584 const mod = self.bin_file.options.module.?;
2584 const mod = self.bin_file.comp.module.?;
25852585 const mcv: MCValue = switch (try codegen.genTypedValue(
25862586 self.bin_file,
25872587 self.src_loc,
......@@ -2617,7 +2617,7 @@ const CallMCValues = struct {
26172617
26182618/// Caller must call `CallMCValues.deinit`.
26192619fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
2620 const mod = self.bin_file.options.module.?;
2620 const mod = self.bin_file.comp.module.?;
26212621 const ip = &mod.intern_pool;
26222622 const fn_info = mod.typeToFunc(fn_ty).?;
26232623 const cc = fn_info.cc;
......@@ -2739,11 +2739,11 @@ fn parseRegName(name: []const u8) ?Register {
27392739}
27402740
27412741fn typeOf(self: *Self, inst: Air.Inst.Ref) Type {
2742 const mod = self.bin_file.options.module.?;
2742 const mod = self.bin_file.comp.module.?;
27432743 return self.air.typeOf(inst, &mod.intern_pool);
27442744}
27452745
27462746fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type {
2747 const mod = self.bin_file.options.module.?;
2747 const mod = self.bin_file.comp.module.?;
27482748 return self.air.typeOfIndex(inst, &mod.intern_pool);
27492749}
src/arch/sparc64/CodeGen.zig+43-43
......@@ -272,7 +272,7 @@ pub fn generate(
272272 @panic("Attempted to compile for architecture that was disabled by build configuration");
273273 }
274274
275 const mod = bin_file.options.module.?;
275 const mod = bin_file.comp.module.?;
276276 const func = mod.funcInfo(func_index);
277277 const fn_owner_decl = mod.declPtr(func.owner_decl);
278278 assert(fn_owner_decl.has_tv);
......@@ -364,7 +364,7 @@ pub fn generate(
364364}
365365
366366fn gen(self: *Self) !void {
367 const mod = self.bin_file.options.module.?;
367 const mod = self.bin_file.comp.module.?;
368368 const cc = self.fn_type.fnCallingConvention(mod);
369369 if (cc != .Naked) {
370370 // TODO Finish function prologue and epilogue for sparc64.
......@@ -492,7 +492,7 @@ fn gen(self: *Self) !void {
492492}
493493
494494fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
495 const mod = self.bin_file.options.module.?;
495 const mod = self.bin_file.comp.module.?;
496496 const ip = &mod.intern_pool;
497497 const air_tags = self.air.instructions.items(.tag);
498498
......@@ -762,7 +762,7 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
762762 const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
763763 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
764764 const extra = self.air.extraData(Air.Bin, ty_pl.payload).data;
765 const mod = self.bin_file.options.module.?;
765 const mod = self.bin_file.comp.module.?;
766766 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
767767 const lhs = try self.resolveInst(extra.lhs);
768768 const rhs = try self.resolveInst(extra.rhs);
......@@ -840,7 +840,7 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
840840}
841841
842842fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
843 const mod = self.bin_file.options.module.?;
843 const mod = self.bin_file.comp.module.?;
844844 const vector_ty = self.typeOfIndex(inst);
845845 const len = vector_ty.vectorLen(mod);
846846 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
......@@ -874,7 +874,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void {
874874}
875875
876876fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
877 const mod = self.bin_file.options.module.?;
877 const mod = self.bin_file.comp.module.?;
878878 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
879879 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
880880 const ptr_ty = self.typeOf(ty_op.operand);
......@@ -1011,7 +1011,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
10111011}
10121012
10131013fn airArg(self: *Self, inst: Air.Inst.Index) !void {
1014 const mod = self.bin_file.options.module.?;
1014 const mod = self.bin_file.comp.module.?;
10151015 const arg_index = self.arg_index;
10161016 self.arg_index += 1;
10171017
......@@ -1206,7 +1206,7 @@ fn airBreakpoint(self: *Self) !void {
12061206}
12071207
12081208fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void {
1209 const mod = self.bin_file.options.module.?;
1209 const mod = self.bin_file.comp.module.?;
12101210 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
12111211
12121212 // We have hardware byteswapper in SPARCv9, don't let mainstream compilers mislead you.
......@@ -1298,7 +1298,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
12981298 const extra = self.air.extraData(Air.Call, pl_op.payload);
12991299 const args = @as([]const Air.Inst.Ref, @ptrCast(self.air.extra[extra.end .. extra.end + extra.data.args_len]));
13001300 const ty = self.typeOf(callee);
1301 const mod = self.bin_file.options.module.?;
1301 const mod = self.bin_file.comp.module.?;
13021302 const fn_ty = switch (ty.zigTypeTag(mod)) {
13031303 .Fn => ty,
13041304 .Pointer => ty.childType(mod),
......@@ -1430,7 +1430,7 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void {
14301430
14311431fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
14321432 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
1433 const mod = self.bin_file.options.module.?;
1433 const mod = self.bin_file.comp.module.?;
14341434 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
14351435 const lhs = try self.resolveInst(bin_op.lhs);
14361436 const rhs = try self.resolveInst(bin_op.rhs);
......@@ -1662,7 +1662,7 @@ fn airDbgBlock(self: *Self, inst: Air.Inst.Index) !void {
16621662
16631663fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void {
16641664 const ty_fn = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_fn;
1665 const mod = self.bin_file.options.module.?;
1665 const mod = self.bin_file.comp.module.?;
16661666 const func = mod.funcInfo(ty_fn.func);
16671667 // TODO emit debug info for function change
16681668 _ = func;
......@@ -1758,7 +1758,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void {
17581758 if (self.liveness.isUnused(inst))
17591759 return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none });
17601760
1761 const mod = self.bin_file.options.module.?;
1761 const mod = self.bin_file.comp.module.?;
17621762 const operand_ty = self.typeOf(ty_op.operand);
17631763 const operand = try self.resolveInst(ty_op.operand);
17641764 const info_a = operand_ty.intInfo(mod);
......@@ -1819,7 +1819,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void {
18191819}
18201820
18211821fn airLoad(self: *Self, inst: Air.Inst.Index) !void {
1822 const mod = self.bin_file.options.module.?;
1822 const mod = self.bin_file.comp.module.?;
18231823 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
18241824 const elem_ty = self.typeOfIndex(inst);
18251825 const elem_size = elem_ty.abiSize(mod);
......@@ -1903,7 +1903,7 @@ fn airMod(self: *Self, inst: Air.Inst.Index) !void {
19031903 const rhs = try self.resolveInst(bin_op.rhs);
19041904 const lhs_ty = self.typeOf(bin_op.lhs);
19051905 const rhs_ty = self.typeOf(bin_op.rhs);
1906 assert(lhs_ty.eql(rhs_ty, self.bin_file.options.module.?));
1906 assert(lhs_ty.eql(rhs_ty, self.bin_file.comp.module.?));
19071907
19081908 if (self.liveness.isUnused(inst))
19091909 return self.finishAir(inst, .dead, .{ bin_op.lhs, bin_op.rhs, .none });
......@@ -2045,7 +2045,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
20452045 //const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
20462046 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
20472047 const extra = self.air.extraData(Air.Bin, ty_pl.payload).data;
2048 const mod = self.bin_file.options.module.?;
2048 const mod = self.bin_file.comp.module.?;
20492049 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
20502050 const lhs = try self.resolveInst(extra.lhs);
20512051 const rhs = try self.resolveInst(extra.rhs);
......@@ -2109,7 +2109,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
21092109
21102110fn airNot(self: *Self, inst: Air.Inst.Index) !void {
21112111 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
2112 const mod = self.bin_file.options.module.?;
2112 const mod = self.bin_file.comp.module.?;
21132113 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
21142114 const operand = try self.resolveInst(ty_op.operand);
21152115 const operand_ty = self.typeOf(ty_op.operand);
......@@ -2341,7 +2341,7 @@ fn airShlSat(self: *Self, inst: Air.Inst.Index) !void {
23412341fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
23422342 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
23432343 const extra = self.air.extraData(Air.Bin, ty_pl.payload).data;
2344 const mod = self.bin_file.options.module.?;
2344 const mod = self.bin_file.comp.module.?;
23452345 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
23462346 const lhs = try self.resolveInst(extra.lhs);
23472347 const rhs = try self.resolveInst(extra.rhs);
......@@ -2446,7 +2446,7 @@ fn airSlice(self: *Self, inst: Air.Inst.Index) !void {
24462446}
24472447
24482448fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void {
2449 const mod = self.bin_file.options.module.?;
2449 const mod = self.bin_file.comp.module.?;
24502450 const is_volatile = false; // TODO
24512451 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
24522452
......@@ -2571,7 +2571,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
25712571 const operand = extra.struct_operand;
25722572 const index = extra.field_index;
25732573 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
2574 const mod = self.bin_file.options.module.?;
2574 const mod = self.bin_file.comp.module.?;
25752575 const mcv = try self.resolveInst(operand);
25762576 const struct_ty = self.typeOf(operand);
25772577 const struct_field_offset = @as(u32, @intCast(struct_ty.structFieldOffset(index, mod)));
......@@ -2704,7 +2704,7 @@ fn airUnionInit(self: *Self, inst: Air.Inst.Index) !void {
27042704}
27052705
27062706fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void {
2707 const mod = self.bin_file.options.module.?;
2707 const mod = self.bin_file.comp.module.?;
27082708 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
27092709 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
27102710 const error_union_ty = self.typeOf(ty_op.operand);
......@@ -2718,7 +2718,7 @@ fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void {
27182718}
27192719
27202720fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void {
2721 const mod = self.bin_file.options.module.?;
2721 const mod = self.bin_file.comp.module.?;
27222722 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
27232723 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
27242724 const error_union_ty = self.typeOf(ty_op.operand);
......@@ -2732,7 +2732,7 @@ fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void {
27322732
27332733/// E to E!T
27342734fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void {
2735 const mod = self.bin_file.options.module.?;
2735 const mod = self.bin_file.comp.module.?;
27362736 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
27372737 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
27382738 const error_union_ty = ty_op.ty.toType();
......@@ -2753,7 +2753,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void {
27532753}
27542754
27552755fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void {
2756 const mod = self.bin_file.options.module.?;
2756 const mod = self.bin_file.comp.module.?;
27572757 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
27582758 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
27592759 const optional_ty = self.typeOfIndex(inst);
......@@ -2793,7 +2793,7 @@ fn allocMem(self: *Self, inst: Air.Inst.Index, abi_size: u32, abi_align: Alignme
27932793
27942794/// Use a pointer instruction as the basis for allocating stack memory.
27952795fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 {
2796 const mod = self.bin_file.options.module.?;
2796 const mod = self.bin_file.comp.module.?;
27972797 const elem_ty = self.typeOfIndex(inst).childType(mod);
27982798
27992799 if (!elem_ty.hasRuntimeBits(mod)) {
......@@ -2813,7 +2813,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 {
28132813}
28142814
28152815fn allocRegOrMem(self: *Self, inst: Air.Inst.Index, reg_ok: bool) !MCValue {
2816 const mod = self.bin_file.options.module.?;
2816 const mod = self.bin_file.comp.module.?;
28172817 const elem_ty = self.typeOfIndex(inst);
28182818 const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse {
28192819 return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)});
......@@ -2860,7 +2860,7 @@ fn binOp(
28602860 rhs_ty: Type,
28612861 metadata: ?BinOpMetadata,
28622862) InnerError!MCValue {
2863 const mod = self.bin_file.options.module.?;
2863 const mod = self.bin_file.comp.module.?;
28642864 switch (tag) {
28652865 .add,
28662866 .sub,
......@@ -3401,7 +3401,7 @@ fn binOpRegister(
34013401fn br(self: *Self, block: Air.Inst.Index, operand: Air.Inst.Ref) !void {
34023402 const block_data = self.blocks.getPtr(block).?;
34033403
3404 const mod = self.bin_file.options.module.?;
3404 const mod = self.bin_file.comp.module.?;
34053405 if (self.typeOf(operand).hasRuntimeBits(mod)) {
34063406 const operand_mcv = try self.resolveInst(operand);
34073407 const block_mcv = block_data.mcv;
......@@ -3521,7 +3521,7 @@ fn ensureProcessDeathCapacity(self: *Self, additional_count: usize) !void {
35213521
35223522/// Given an error union, returns the payload
35233523fn errUnionPayload(self: *Self, error_union_mcv: MCValue, error_union_ty: Type) !MCValue {
3524 const mod = self.bin_file.options.module.?;
3524 const mod = self.bin_file.comp.module.?;
35253525 const err_ty = error_union_ty.errorUnionSet(mod);
35263526 const payload_ty = error_union_ty.errorUnionPayload(mod);
35273527 if (err_ty.errorSetIsEmpty(mod)) {
......@@ -3591,7 +3591,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live
35913591}
35923592
35933593fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, mcv: MCValue) !void {
3594 const mod = self.bin_file.options.module.?;
3594 const mod = self.bin_file.comp.module.?;
35953595 const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg;
35963596 const ty = arg.ty.toType();
35973597 const owner_decl = mod.funcOwnerDeclIndex(self.func_index);
......@@ -3740,7 +3740,7 @@ fn genLoadASI(self: *Self, value_reg: Register, addr_reg: Register, off_reg: Reg
37403740}
37413741
37423742fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void {
3743 const mod = self.bin_file.options.module.?;
3743 const mod = self.bin_file.comp.module.?;
37443744 switch (mcv) {
37453745 .dead => unreachable,
37463746 .unreach, .none => return, // Nothing to do.
......@@ -3951,7 +3951,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void
39513951}
39523952
39533953fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void {
3954 const mod = self.bin_file.options.module.?;
3954 const mod = self.bin_file.comp.module.?;
39553955 const abi_size = ty.abiSize(mod);
39563956 switch (mcv) {
39573957 .dead => unreachable,
......@@ -4125,7 +4125,7 @@ fn genStoreASI(self: *Self, value_reg: Register, addr_reg: Register, off_reg: Re
41254125}
41264126
41274127fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue {
4128 const mod = self.bin_file.options.module.?;
4128 const mod = self.bin_file.comp.module.?;
41294129 const mcv: MCValue = switch (try codegen.genTypedValue(
41304130 self.bin_file,
41314131 self.src_loc,
......@@ -4161,7 +4161,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue {
41614161}
41624162
41634163fn isErr(self: *Self, ty: Type, operand: MCValue) !MCValue {
4164 const mod = self.bin_file.options.module.?;
4164 const mod = self.bin_file.comp.module.?;
41654165 const error_type = ty.errorUnionSet(mod);
41664166 const payload_type = ty.errorUnionPayload(mod);
41674167
......@@ -4259,7 +4259,7 @@ fn jump(self: *Self, inst: Mir.Inst.Index) !void {
42594259}
42604260
42614261fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!void {
4262 const mod = self.bin_file.options.module.?;
4262 const mod = self.bin_file.comp.module.?;
42634263 const elem_ty = ptr_ty.childType(mod);
42644264 const elem_size = elem_ty.abiSize(mod);
42654265
......@@ -4330,7 +4330,7 @@ fn minMax(
43304330 lhs_ty: Type,
43314331 rhs_ty: Type,
43324332) InnerError!MCValue {
4333 const mod = self.bin_file.options.module.?;
4333 const mod = self.bin_file.comp.module.?;
43344334 assert(lhs_ty.eql(rhs_ty, mod));
43354335 switch (lhs_ty.zigTypeTag(mod)) {
43364336 .Float => return self.fail("TODO min/max on floats", .{}),
......@@ -4450,7 +4450,7 @@ fn realStackOffset(off: u32) u32 {
44504450
44514451/// Caller must call `CallMCValues.deinit`.
44524452fn resolveCallingConventionValues(self: *Self, fn_ty: Type, role: RegisterView) !CallMCValues {
4453 const mod = self.bin_file.options.module.?;
4453 const mod = self.bin_file.comp.module.?;
44544454 const ip = &mod.intern_pool;
44554455 const fn_info = mod.typeToFunc(fn_ty).?;
44564456 const cc = fn_info.cc;
......@@ -4542,7 +4542,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type, role: RegisterView)
45424542}
45434543
45444544fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!MCValue {
4545 const mod = self.bin_file.options.module.?;
4545 const mod = self.bin_file.comp.module.?;
45464546 const ty = self.typeOf(ref);
45474547
45484548 // If the type has no codegen bits, no need to store it.
......@@ -4559,7 +4559,7 @@ fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!MCValue {
45594559}
45604560
45614561fn ret(self: *Self, mcv: MCValue) !void {
4562 const mod = self.bin_file.options.module.?;
4562 const mod = self.bin_file.comp.module.?;
45634563 const ret_ty = self.fn_type.fnReturnType(mod);
45644564 try self.setRegOrMem(ret_ty, self.ret_mcv, mcv);
45654565
......@@ -4661,7 +4661,7 @@ pub fn spillInstruction(self: *Self, reg: Register, inst: Air.Inst.Index) !void
46614661}
46624662
46634663fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type) InnerError!void {
4664 const mod = self.bin_file.options.module.?;
4664 const mod = self.bin_file.comp.module.?;
46654665 const abi_size = value_ty.abiSize(mod);
46664666
46674667 switch (ptr) {
......@@ -4703,7 +4703,7 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type
47034703
47044704fn structFieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32) !MCValue {
47054705 return if (self.liveness.isUnused(inst)) .dead else result: {
4706 const mod = self.bin_file.options.module.?;
4706 const mod = self.bin_file.comp.module.?;
47074707 const mcv = try self.resolveInst(operand);
47084708 const ptr_ty = self.typeOf(operand);
47094709 const struct_ty = ptr_ty.childType(mod);
......@@ -4745,7 +4745,7 @@ fn trunc(
47454745 operand_ty: Type,
47464746 dest_ty: Type,
47474747) !MCValue {
4748 const mod = self.bin_file.options.module.?;
4748 const mod = self.bin_file.comp.module.?;
47494749 const info_a = operand_ty.intInfo(mod);
47504750 const info_b = dest_ty.intInfo(mod);
47514751
......@@ -4866,11 +4866,11 @@ fn wantSafety(self: *Self) bool {
48664866}
48674867
48684868fn typeOf(self: *Self, inst: Air.Inst.Ref) Type {
4869 const mod = self.bin_file.options.module.?;
4869 const mod = self.bin_file.comp.module.?;
48704870 return self.air.typeOf(inst, &mod.intern_pool);
48714871}
48724872
48734873fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type {
4874 const mod = self.bin_file.options.module.?;
4874 const mod = self.bin_file.comp.module.?;
48754875 return self.air.typeOfIndex(inst, &mod.intern_pool);
48764876}
src/arch/wasm/CodeGen.zig+1-1
......@@ -1210,7 +1210,7 @@ pub fn generate(
12101210 debug_output: codegen.DebugInfoOutput,
12111211) codegen.CodeGenError!codegen.Result {
12121212 _ = src_loc;
1213 const mod = bin_file.options.module.?;
1213 const mod = bin_file.comp.module.?;
12141214 const func = mod.funcInfo(func_index);
12151215 var code_gen: CodeGen = .{
12161216 .gpa = bin_file.allocator,
src/arch/x86_64/CodeGen.zig+120-120
......@@ -131,7 +131,7 @@ const Owner = union(enum) {
131131 fn getSymbolIndex(owner: Owner, ctx: *Self) !u32 {
132132 switch (owner) {
133133 .func_index => |func_index| {
134 const mod = ctx.bin_file.options.module.?;
134 const mod = ctx.bin_file.comp.module.?;
135135 const decl_index = mod.funcOwnerDeclIndex(func_index);
136136 if (ctx.bin_file.cast(link.File.Elf)) |elf_file| {
137137 return elf_file.zigObjectPtr().?.getOrCreateMetadataForDecl(elf_file, decl_index);
......@@ -799,7 +799,7 @@ pub fn generate(
799799 @panic("Attempted to compile for architecture that was disabled by build configuration");
800800 }
801801
802 const mod = bin_file.options.module.?;
802 const mod = bin_file.comp.module.?;
803803 const func = mod.funcInfo(func_index);
804804 const fn_owner_decl = mod.declPtr(func.owner_decl);
805805 assert(fn_owner_decl.has_tv);
......@@ -1060,7 +1060,7 @@ fn formatDecl(
10601060}
10611061fn fmtDecl(self: *Self, decl_index: InternPool.DeclIndex) std.fmt.Formatter(formatDecl) {
10621062 return .{ .data = .{
1063 .mod = self.bin_file.options.module.?,
1063 .mod = self.bin_file.comp.module.?,
10641064 .decl_index = decl_index,
10651065 } };
10661066}
......@@ -1077,7 +1077,7 @@ fn formatAir(
10771077) @TypeOf(writer).Error!void {
10781078 @import("../../print_air.zig").dumpInst(
10791079 data.inst,
1080 data.self.bin_file.options.module.?,
1080 data.self.bin_file.comp.module.?,
10811081 data.self.air,
10821082 data.self.liveness,
10831083 );
......@@ -1683,7 +1683,7 @@ fn asmMemoryRegisterImmediate(
16831683}
16841684
16851685fn gen(self: *Self) InnerError!void {
1686 const mod = self.bin_file.options.module.?;
1686 const mod = self.bin_file.comp.module.?;
16871687 const fn_info = mod.typeToFunc(self.fn_type).?;
16881688 const cc = abi.resolveCallingConvention(fn_info.cc, self.target.*);
16891689 if (cc != .Naked) {
......@@ -1885,7 +1885,7 @@ fn gen(self: *Self) InnerError!void {
18851885}
18861886
18871887fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
1888 const mod = self.bin_file.options.module.?;
1888 const mod = self.bin_file.comp.module.?;
18891889 const ip = &mod.intern_pool;
18901890 const air_tags = self.air.instructions.items(.tag);
18911891
......@@ -2167,7 +2167,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void {
21672167}
21682168
21692169fn genLazy(self: *Self, lazy_sym: link.File.LazySymbol) InnerError!void {
2170 const mod = self.bin_file.options.module.?;
2170 const mod = self.bin_file.comp.module.?;
21712171 switch (lazy_sym.ty.zigTypeTag(mod)) {
21722172 .Enum => {
21732173 const enum_ty = lazy_sym.ty;
......@@ -2418,7 +2418,7 @@ fn allocFrameIndex(self: *Self, alloc: FrameAlloc) !FrameIndex {
24182418
24192419/// Use a pointer instruction as the basis for allocating stack memory.
24202420fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !FrameIndex {
2421 const mod = self.bin_file.options.module.?;
2421 const mod = self.bin_file.comp.module.?;
24222422 const ptr_ty = self.typeOfIndex(inst);
24232423 const val_ty = ptr_ty.childType(mod);
24242424 return self.allocFrameIndex(FrameAlloc.init(.{
......@@ -2438,7 +2438,7 @@ fn allocTempRegOrMem(self: *Self, elem_ty: Type, reg_ok: bool) !MCValue {
24382438}
24392439
24402440fn allocRegOrMemAdvanced(self: *Self, ty: Type, inst: ?Air.Inst.Index, reg_ok: bool) !MCValue {
2441 const mod = self.bin_file.options.module.?;
2441 const mod = self.bin_file.comp.module.?;
24422442 const abi_size = math.cast(u32, ty.abiSize(mod)) orelse {
24432443 return self.fail("type '{}' too big to fit into stack frame", .{ty.fmt(mod)});
24442444 };
......@@ -2471,7 +2471,7 @@ fn allocRegOrMemAdvanced(self: *Self, ty: Type, inst: ?Air.Inst.Index, reg_ok: b
24712471}
24722472
24732473fn regClassForType(self: *Self, ty: Type) RegisterManager.RegisterBitSet {
2474 const mod = self.bin_file.options.module.?;
2474 const mod = self.bin_file.comp.module.?;
24752475 return switch (ty.zigTypeTag(mod)) {
24762476 .Float => switch (ty.floatBits(self.target.*)) {
24772477 80 => abi.RegisterClass.x87,
......@@ -2884,7 +2884,7 @@ fn airFpext(self: *Self, inst: Air.Inst.Index) !void {
28842884}
28852885
28862886fn airIntCast(self: *Self, inst: Air.Inst.Index) !void {
2887 const mod = self.bin_file.options.module.?;
2887 const mod = self.bin_file.comp.module.?;
28882888 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
28892889 const result: MCValue = result: {
28902890 const src_ty = self.typeOf(ty_op.operand);
......@@ -2975,7 +2975,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void {
29752975}
29762976
29772977fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
2978 const mod = self.bin_file.options.module.?;
2978 const mod = self.bin_file.comp.module.?;
29792979 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
29802980
29812981 const dst_ty = self.typeOfIndex(inst);
......@@ -3102,7 +3102,7 @@ fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void {
31023102}
31033103
31043104fn airSlice(self: *Self, inst: Air.Inst.Index) !void {
3105 const mod = self.bin_file.options.module.?;
3105 const mod = self.bin_file.comp.module.?;
31063106 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
31073107 const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data;
31083108
......@@ -3131,7 +3131,7 @@ fn airUnOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
31313131}
31323132
31333133fn airBinOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
3134 const mod = self.bin_file.options.module.?;
3134 const mod = self.bin_file.comp.module.?;
31353135 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
31363136 const dst_mcv = try self.genBinOp(inst, tag, bin_op.lhs, bin_op.rhs);
31373137
......@@ -3172,7 +3172,7 @@ fn airPtrArithmetic(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void
31723172}
31733173
31743174fn activeIntBits(self: *Self, dst_air: Air.Inst.Ref) u16 {
3175 const mod = self.bin_file.options.module.?;
3175 const mod = self.bin_file.comp.module.?;
31763176 const air_tag = self.air.instructions.items(.tag);
31773177 const air_data = self.air.instructions.items(.data);
31783178
......@@ -3206,7 +3206,7 @@ fn activeIntBits(self: *Self, dst_air: Air.Inst.Ref) u16 {
32063206}
32073207
32083208fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void {
3209 const mod = self.bin_file.options.module.?;
3209 const mod = self.bin_file.comp.module.?;
32103210 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
32113211 const result = result: {
32123212 const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
......@@ -3432,7 +3432,7 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void {
34323432}
34333433
34343434fn airAddSat(self: *Self, inst: Air.Inst.Index) !void {
3435 const mod = self.bin_file.options.module.?;
3435 const mod = self.bin_file.comp.module.?;
34363436 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
34373437 const ty = self.typeOf(bin_op.lhs);
34383438 if (ty.zigTypeTag(mod) == .Vector or ty.abiSize(mod) > 8) return self.fail(
......@@ -3515,7 +3515,7 @@ fn airAddSat(self: *Self, inst: Air.Inst.Index) !void {
35153515}
35163516
35173517fn airSubSat(self: *Self, inst: Air.Inst.Index) !void {
3518 const mod = self.bin_file.options.module.?;
3518 const mod = self.bin_file.comp.module.?;
35193519 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
35203520 const ty = self.typeOf(bin_op.lhs);
35213521 if (ty.zigTypeTag(mod) == .Vector or ty.abiSize(mod) > 8) return self.fail(
......@@ -3591,7 +3591,7 @@ fn airSubSat(self: *Self, inst: Air.Inst.Index) !void {
35913591}
35923592
35933593fn airMulSat(self: *Self, inst: Air.Inst.Index) !void {
3594 const mod = self.bin_file.options.module.?;
3594 const mod = self.bin_file.comp.module.?;
35953595 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
35963596 const ty = self.typeOf(bin_op.lhs);
35973597
......@@ -3731,7 +3731,7 @@ fn airMulSat(self: *Self, inst: Air.Inst.Index) !void {
37313731}
37323732
37333733fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
3734 const mod = self.bin_file.options.module.?;
3734 const mod = self.bin_file.comp.module.?;
37353735 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
37363736 const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data;
37373737 const result: MCValue = result: {
......@@ -3792,7 +3792,7 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
37923792}
37933793
37943794fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
3795 const mod = self.bin_file.options.module.?;
3795 const mod = self.bin_file.comp.module.?;
37963796 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
37973797 const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data;
37983798 const result: MCValue = result: {
......@@ -3871,7 +3871,7 @@ fn genSetFrameTruncatedOverflowCompare(
38713871 src_mcv: MCValue,
38723872 overflow_cc: ?Condition,
38733873) !void {
3874 const mod = self.bin_file.options.module.?;
3874 const mod = self.bin_file.comp.module.?;
38753875 const src_lock = switch (src_mcv) {
38763876 .register => |reg| self.register_manager.lockReg(reg),
38773877 else => null,
......@@ -3935,7 +3935,7 @@ fn genSetFrameTruncatedOverflowCompare(
39353935}
39363936
39373937fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
3938 const mod = self.bin_file.options.module.?;
3938 const mod = self.bin_file.comp.module.?;
39393939 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
39403940 const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data;
39413941 const tuple_ty = self.typeOfIndex(inst);
......@@ -4169,7 +4169,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
41694169/// Clobbers .rax and .rdx registers.
41704170/// Quotient is saved in .rax and remainder in .rdx.
41714171fn genIntMulDivOpMir(self: *Self, tag: Mir.Inst.FixedTag, ty: Type, lhs: MCValue, rhs: MCValue) !void {
4172 const mod = self.bin_file.options.module.?;
4172 const mod = self.bin_file.comp.module.?;
41734173 const abi_size: u32 = @intCast(ty.abiSize(mod));
41744174 const bit_size: u32 = @intCast(self.regBitSize(ty));
41754175 if (abi_size > 8) {
......@@ -4219,7 +4219,7 @@ fn genIntMulDivOpMir(self: *Self, tag: Mir.Inst.FixedTag, ty: Type, lhs: MCValue
42194219/// Always returns a register.
42204220/// Clobbers .rax and .rdx registers.
42214221fn genInlineIntDivFloor(self: *Self, ty: Type, lhs: MCValue, rhs: MCValue) !MCValue {
4222 const mod = self.bin_file.options.module.?;
4222 const mod = self.bin_file.comp.module.?;
42234223 const abi_size: u32 = @intCast(ty.abiSize(mod));
42244224 const int_info = ty.intInfo(mod);
42254225 const dividend = switch (lhs) {
......@@ -4271,7 +4271,7 @@ fn genInlineIntDivFloor(self: *Self, ty: Type, lhs: MCValue, rhs: MCValue) !MCVa
42714271}
42724272
42734273fn airShlShrBinOp(self: *Self, inst: Air.Inst.Index) !void {
4274 const mod = self.bin_file.options.module.?;
4274 const mod = self.bin_file.comp.module.?;
42754275 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
42764276
42774277 const air_tags = self.air.instructions.items(.tag);
......@@ -4546,7 +4546,7 @@ fn airShlSat(self: *Self, inst: Air.Inst.Index) !void {
45464546}
45474547
45484548fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) !void {
4549 const mod = self.bin_file.options.module.?;
4549 const mod = self.bin_file.comp.module.?;
45504550 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
45514551 const result: MCValue = result: {
45524552 const pl_ty = self.typeOfIndex(inst);
......@@ -4592,7 +4592,7 @@ fn airOptionalPayloadPtr(self: *Self, inst: Air.Inst.Index) !void {
45924592}
45934593
45944594fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
4595 const mod = self.bin_file.options.module.?;
4595 const mod = self.bin_file.comp.module.?;
45964596 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
45974597 const result = result: {
45984598 const dst_ty = self.typeOfIndex(inst);
......@@ -4626,7 +4626,7 @@ fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
46264626}
46274627
46284628fn airUnwrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void {
4629 const mod = self.bin_file.options.module.?;
4629 const mod = self.bin_file.comp.module.?;
46304630 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
46314631 const err_union_ty = self.typeOf(ty_op.operand);
46324632 const err_ty = err_union_ty.errorUnionSet(mod);
......@@ -4678,7 +4678,7 @@ fn airUnwrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void {
46784678
46794679// *(E!T) -> E
46804680fn airUnwrapErrUnionErrPtr(self: *Self, inst: Air.Inst.Index) !void {
4681 const mod = self.bin_file.options.module.?;
4681 const mod = self.bin_file.comp.module.?;
46824682 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
46834683
46844684 const src_ty = self.typeOf(ty_op.operand);
......@@ -4725,7 +4725,7 @@ fn airUnwrapErrUnionPayloadPtr(self: *Self, inst: Air.Inst.Index) !void {
47254725}
47264726
47274727fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void {
4728 const mod = self.bin_file.options.module.?;
4728 const mod = self.bin_file.comp.module.?;
47294729 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
47304730 const result: MCValue = result: {
47314731 const src_ty = self.typeOf(ty_op.operand);
......@@ -4785,7 +4785,7 @@ fn genUnwrapErrUnionPayloadMir(
47854785 err_union_ty: Type,
47864786 err_union: MCValue,
47874787) !MCValue {
4788 const mod = self.bin_file.options.module.?;
4788 const mod = self.bin_file.comp.module.?;
47894789 const payload_ty = err_union_ty.errorUnionPayload(mod);
47904790
47914791 const result: MCValue = result: {
......@@ -4833,7 +4833,7 @@ fn genUnwrapErrUnionPayloadPtrMir(
48334833 ptr_ty: Type,
48344834 ptr_mcv: MCValue,
48354835) !MCValue {
4836 const mod = self.bin_file.options.module.?;
4836 const mod = self.bin_file.comp.module.?;
48374837 const err_union_ty = ptr_ty.childType(mod);
48384838 const payload_ty = err_union_ty.errorUnionPayload(mod);
48394839
......@@ -4867,7 +4867,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void {
48674867}
48684868
48694869fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void {
4870 const mod = self.bin_file.options.module.?;
4870 const mod = self.bin_file.comp.module.?;
48714871 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
48724872 const result: MCValue = result: {
48734873 const pl_ty = self.typeOf(ty_op.operand);
......@@ -4921,7 +4921,7 @@ fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void {
49214921
49224922/// T to E!T
49234923fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void {
4924 const mod = self.bin_file.options.module.?;
4924 const mod = self.bin_file.comp.module.?;
49254925 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
49264926
49274927 const eu_ty = ty_op.ty.toType();
......@@ -4944,7 +4944,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void {
49444944
49454945/// E to E!T
49464946fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void {
4947 const mod = self.bin_file.options.module.?;
4947 const mod = self.bin_file.comp.module.?;
49484948 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
49494949
49504950 const eu_ty = ty_op.ty.toType();
......@@ -5003,7 +5003,7 @@ fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void {
50035003}
50045004
50055005fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void {
5006 const mod = self.bin_file.options.module.?;
5006 const mod = self.bin_file.comp.module.?;
50075007 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
50085008
50095009 const src_ty = self.typeOf(ty_op.operand);
......@@ -5071,7 +5071,7 @@ fn elemOffset(self: *Self, index_ty: Type, index: MCValue, elem_size: u64) !Regi
50715071}
50725072
50735073fn genSliceElemPtr(self: *Self, lhs: Air.Inst.Ref, rhs: Air.Inst.Ref) !MCValue {
5074 const mod = self.bin_file.options.module.?;
5074 const mod = self.bin_file.comp.module.?;
50755075 const slice_ty = self.typeOf(lhs);
50765076 const slice_mcv = try self.resolveInst(lhs);
50775077 const slice_mcv_lock: ?RegisterLock = switch (slice_mcv) {
......@@ -5107,7 +5107,7 @@ fn genSliceElemPtr(self: *Self, lhs: Air.Inst.Ref, rhs: Air.Inst.Ref) !MCValue {
51075107}
51085108
51095109fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void {
5110 const mod = self.bin_file.options.module.?;
5110 const mod = self.bin_file.comp.module.?;
51115111 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
51125112
51135113 const result: MCValue = result: {
......@@ -5132,7 +5132,7 @@ fn airSliceElemPtr(self: *Self, inst: Air.Inst.Index) !void {
51325132}
51335133
51345134fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void {
5135 const mod = self.bin_file.options.module.?;
5135 const mod = self.bin_file.comp.module.?;
51365136 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
51375137
51385138 const result: MCValue = result: {
......@@ -5246,7 +5246,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void {
52465246}
52475247
52485248fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void {
5249 const mod = self.bin_file.options.module.?;
5249 const mod = self.bin_file.comp.module.?;
52505250 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
52515251 const ptr_ty = self.typeOf(bin_op.lhs);
52525252
......@@ -5296,7 +5296,7 @@ fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void {
52965296}
52975297
52985298fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void {
5299 const mod = self.bin_file.options.module.?;
5299 const mod = self.bin_file.comp.module.?;
53005300 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
53015301 const extra = self.air.extraData(Air.Bin, ty_pl.payload).data;
53025302
......@@ -5341,7 +5341,7 @@ fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void {
53415341}
53425342
53435343fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void {
5344 const mod = self.bin_file.options.module.?;
5344 const mod = self.bin_file.comp.module.?;
53455345 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
53465346 const ptr_union_ty = self.typeOf(bin_op.lhs);
53475347 const union_ty = ptr_union_ty.childType(mod);
......@@ -5385,7 +5385,7 @@ fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void {
53855385}
53865386
53875387fn airGetUnionTag(self: *Self, inst: Air.Inst.Index) !void {
5388 const mod = self.bin_file.options.module.?;
5388 const mod = self.bin_file.comp.module.?;
53895389 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
53905390
53915391 const tag_ty = self.typeOfIndex(inst);
......@@ -5439,7 +5439,7 @@ fn airGetUnionTag(self: *Self, inst: Air.Inst.Index) !void {
54395439}
54405440
54415441fn airClz(self: *Self, inst: Air.Inst.Index) !void {
5442 const mod = self.bin_file.options.module.?;
5442 const mod = self.bin_file.comp.module.?;
54435443 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
54445444 const result = result: {
54455445 const dst_ty = self.typeOfIndex(inst);
......@@ -5598,7 +5598,7 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void {
55985598}
55995599
56005600fn airCtz(self: *Self, inst: Air.Inst.Index) !void {
5601 const mod = self.bin_file.options.module.?;
5601 const mod = self.bin_file.comp.module.?;
56025602 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
56035603 const result = result: {
56045604 const dst_ty = self.typeOfIndex(inst);
......@@ -5716,7 +5716,7 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void {
57165716}
57175717
57185718fn airPopCount(self: *Self, inst: Air.Inst.Index) !void {
5719 const mod = self.bin_file.options.module.?;
5719 const mod = self.bin_file.comp.module.?;
57205720 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
57215721 const result: MCValue = result: {
57225722 try self.spillEflagsIfOccupied();
......@@ -5779,7 +5779,7 @@ fn genPopCount(
57795779 src_mcv: MCValue,
57805780 dst_contains_src: bool,
57815781) !void {
5782 const mod = self.bin_file.options.module.?;
5782 const mod = self.bin_file.comp.module.?;
57835783
57845784 const src_abi_size: u32 = @intCast(src_ty.abiSize(mod));
57855785 if (self.hasFeature(.popcnt)) return self.genBinOpMir(
......@@ -5871,7 +5871,7 @@ fn genByteSwap(
58715871 src_mcv: MCValue,
58725872 mem_ok: bool,
58735873) !MCValue {
5874 const mod = self.bin_file.options.module.?;
5874 const mod = self.bin_file.comp.module.?;
58755875 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
58765876
58775877 if (src_ty.zigTypeTag(mod) == .Vector) return self.fail(
......@@ -5962,7 +5962,7 @@ fn genByteSwap(
59625962}
59635963
59645964fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void {
5965 const mod = self.bin_file.options.module.?;
5965 const mod = self.bin_file.comp.module.?;
59665966 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
59675967
59685968 const src_ty = self.typeOf(ty_op.operand);
......@@ -5984,7 +5984,7 @@ fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void {
59845984}
59855985
59865986fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {
5987 const mod = self.bin_file.options.module.?;
5987 const mod = self.bin_file.comp.module.?;
59885988 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
59895989
59905990 const src_ty = self.typeOf(ty_op.operand);
......@@ -6106,7 +6106,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void {
61066106}
61076107
61086108fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type) !void {
6109 const mod = self.bin_file.options.module.?;
6109 const mod = self.bin_file.comp.module.?;
61106110 const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
61116111
61126112 const result = result: {
......@@ -6282,7 +6282,7 @@ fn airRound(self: *Self, inst: Air.Inst.Index, mode: RoundMode) !void {
62826282}
62836283
62846284fn getRoundTag(self: *Self, ty: Type) ?Mir.Inst.FixedTag {
6285 const mod = self.bin_file.options.module.?;
6285 const mod = self.bin_file.comp.module.?;
62866286 return if (self.hasFeature(.sse4_1)) switch (ty.zigTypeTag(mod)) {
62876287 .Float => switch (ty.floatBits(self.target.*)) {
62886288 32 => if (self.hasFeature(.avx)) .{ .v_ss, .round } else .{ ._ss, .round },
......@@ -6314,7 +6314,7 @@ fn getRoundTag(self: *Self, ty: Type) ?Mir.Inst.FixedTag {
63146314}
63156315
63166316fn genRoundLibcall(self: *Self, ty: Type, src_mcv: MCValue, mode: RoundMode) !MCValue {
6317 const mod = self.bin_file.options.module.?;
6317 const mod = self.bin_file.comp.module.?;
63186318 if (self.getRoundTag(ty)) |_| return .none;
63196319
63206320 if (ty.zigTypeTag(mod) != .Float)
......@@ -6338,7 +6338,7 @@ fn genRoundLibcall(self: *Self, ty: Type, src_mcv: MCValue, mode: RoundMode) !MC
63386338}
63396339
63406340fn genRound(self: *Self, ty: Type, dst_reg: Register, src_mcv: MCValue, mode: RoundMode) !void {
6341 const mod = self.bin_file.options.module.?;
6341 const mod = self.bin_file.comp.module.?;
63426342 const mir_tag = self.getRoundTag(ty) orelse {
63436343 const result = try self.genRoundLibcall(ty, src_mcv, mode);
63446344 return self.genSetReg(dst_reg, ty, result);
......@@ -6380,7 +6380,7 @@ fn genRound(self: *Self, ty: Type, dst_reg: Register, src_mcv: MCValue, mode: Ro
63806380}
63816381
63826382fn airAbs(self: *Self, inst: Air.Inst.Index) !void {
6383 const mod = self.bin_file.options.module.?;
6383 const mod = self.bin_file.comp.module.?;
63846384 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
63856385 const ty = self.typeOf(ty_op.operand);
63866386
......@@ -6520,7 +6520,7 @@ fn airAbs(self: *Self, inst: Air.Inst.Index) !void {
65206520}
65216521
65226522fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
6523 const mod = self.bin_file.options.module.?;
6523 const mod = self.bin_file.comp.module.?;
65246524 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
65256525 const ty = self.typeOf(un_op);
65266526 const abi_size: u32 = @intCast(ty.abiSize(mod));
......@@ -6765,7 +6765,7 @@ fn reuseOperandAdvanced(
67656765}
67666766
67676767fn packedLoad(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerError!void {
6768 const mod = self.bin_file.options.module.?;
6768 const mod = self.bin_file.comp.module.?;
67696769
67706770 const ptr_info = ptr_ty.ptrInfo(mod);
67716771 const val_ty = Type.fromInterned(ptr_info.child);
......@@ -6864,7 +6864,7 @@ fn packedLoad(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) Inn
68646864}
68656865
68666866fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerError!void {
6867 const mod = self.bin_file.options.module.?;
6867 const mod = self.bin_file.comp.module.?;
68686868 const dst_ty = ptr_ty.childType(mod);
68696869 if (!dst_ty.hasRuntimeBitsIgnoreComptime(mod)) return;
68706870 switch (ptr_mcv) {
......@@ -6905,7 +6905,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerErro
69056905}
69066906
69076907fn airLoad(self: *Self, inst: Air.Inst.Index) !void {
6908 const mod = self.bin_file.options.module.?;
6908 const mod = self.bin_file.comp.module.?;
69096909 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
69106910 const elem_ty = self.typeOfIndex(inst);
69116911 const result: MCValue = result: {
......@@ -6962,7 +6962,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) !void {
69626962}
69636963
69646964fn packedStore(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerError!void {
6965 const mod = self.bin_file.options.module.?;
6965 const mod = self.bin_file.comp.module.?;
69666966 const ptr_info = ptr_ty.ptrInfo(mod);
69676967 const src_ty = Type.fromInterned(ptr_info.child);
69686968 if (!src_ty.hasRuntimeBitsIgnoreComptime(mod)) return;
......@@ -7059,7 +7059,7 @@ fn packedStore(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) In
70597059}
70607060
70617061fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerError!void {
7062 const mod = self.bin_file.options.module.?;
7062 const mod = self.bin_file.comp.module.?;
70637063 const src_ty = ptr_ty.childType(mod);
70647064 if (!src_ty.hasRuntimeBitsIgnoreComptime(mod)) return;
70657065 switch (ptr_mcv) {
......@@ -7100,7 +7100,7 @@ fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerErr
71007100}
71017101
71027102fn airStore(self: *Self, inst: Air.Inst.Index, safety: bool) !void {
7103 const mod = self.bin_file.options.module.?;
7103 const mod = self.bin_file.comp.module.?;
71047104 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
71057105
71067106 result: {
......@@ -7138,7 +7138,7 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void {
71387138}
71397139
71407140fn fieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32) !MCValue {
7141 const mod = self.bin_file.options.module.?;
7141 const mod = self.bin_file.comp.module.?;
71427142 const ptr_field_ty = self.typeOfIndex(inst);
71437143 const ptr_container_ty = self.typeOf(operand);
71447144 const ptr_container_ty_info = ptr_container_ty.ptrInfo(mod);
......@@ -7163,7 +7163,7 @@ fn fieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32
71637163}
71647164
71657165fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
7166 const mod = self.bin_file.options.module.?;
7166 const mod = self.bin_file.comp.module.?;
71677167 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
71687168 const extra = self.air.extraData(Air.StructField, ty_pl.payload).data;
71697169 const result: MCValue = result: {
......@@ -7451,7 +7451,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void {
74517451}
74527452
74537453fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void {
7454 const mod = self.bin_file.options.module.?;
7454 const mod = self.bin_file.comp.module.?;
74557455 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
74567456 const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;
74577457
......@@ -7470,7 +7470,7 @@ fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void {
74707470}
74717471
74727472fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air: Air.Inst.Ref) !MCValue {
7473 const mod = self.bin_file.options.module.?;
7473 const mod = self.bin_file.comp.module.?;
74747474 const src_ty = self.typeOf(src_air);
74757475 if (src_ty.zigTypeTag(mod) == .Vector)
74767476 return self.fail("TODO implement genUnOp for {}", .{src_ty.fmt(mod)});
......@@ -7558,7 +7558,7 @@ fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air:
75587558}
75597559
75607560fn genUnOpMir(self: *Self, mir_tag: Mir.Inst.FixedTag, dst_ty: Type, dst_mcv: MCValue) !void {
7561 const mod = self.bin_file.options.module.?;
7561 const mod = self.bin_file.comp.module.?;
75627562 const abi_size: u32 = @intCast(dst_ty.abiSize(mod));
75637563 if (abi_size > 8) return self.fail("TODO implement {} for {}", .{ mir_tag, dst_ty.fmt(mod) });
75647564 switch (dst_mcv) {
......@@ -7605,7 +7605,7 @@ fn genShiftBinOpMir(
76057605 lhs_mcv: MCValue,
76067606 shift_mcv: MCValue,
76077607) !void {
7608 const mod = self.bin_file.options.module.?;
7608 const mod = self.bin_file.comp.module.?;
76097609 const rhs_mcv: MCValue = rhs: {
76107610 switch (shift_mcv) {
76117611 .immediate => |imm| switch (imm) {
......@@ -7975,7 +7975,7 @@ fn genShiftBinOp(
79757975 lhs_ty: Type,
79767976 rhs_ty: Type,
79777977) !MCValue {
7978 const mod = self.bin_file.options.module.?;
7978 const mod = self.bin_file.comp.module.?;
79797979 if (lhs_ty.zigTypeTag(mod) == .Vector) return self.fail("TODO implement genShiftBinOp for {}", .{
79807980 lhs_ty.fmt(mod),
79817981 });
......@@ -8041,7 +8041,7 @@ fn genMulDivBinOp(
80418041 lhs_mcv: MCValue,
80428042 rhs_mcv: MCValue,
80438043) !MCValue {
8044 const mod = self.bin_file.options.module.?;
8044 const mod = self.bin_file.comp.module.?;
80458045 if (dst_ty.zigTypeTag(mod) == .Vector or dst_ty.zigTypeTag(mod) == .Float) return self.fail(
80468046 "TODO implement genMulDivBinOp for {s} from {} to {}",
80478047 .{ @tagName(tag), src_ty.fmt(mod), dst_ty.fmt(mod) },
......@@ -8283,7 +8283,7 @@ fn genBinOp(
82838283 lhs_air: Air.Inst.Ref,
82848284 rhs_air: Air.Inst.Ref,
82858285) !MCValue {
8286 const mod = self.bin_file.options.module.?;
8286 const mod = self.bin_file.comp.module.?;
82878287 const lhs_ty = self.typeOf(lhs_air);
82888288 const rhs_ty = self.typeOf(rhs_air);
82898289 const abi_size: u32 = @intCast(lhs_ty.abiSize(mod));
......@@ -10015,7 +10015,7 @@ fn genBinOpMir(
1001510015 dst_mcv: MCValue,
1001610016 src_mcv: MCValue,
1001710017) !void {
10018 const mod = self.bin_file.options.module.?;
10018 const mod = self.bin_file.comp.module.?;
1001910019 const abi_size: u32 = @intCast(ty.abiSize(mod));
1002010020 try self.spillEflagsIfOccupied();
1002110021 switch (dst_mcv) {
......@@ -10435,7 +10435,7 @@ fn genBinOpMir(
1043510435/// Performs multi-operand integer multiplication between dst_mcv and src_mcv, storing the result in dst_mcv.
1043610436/// Does not support byte-size operands.
1043710437fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError!void {
10438 const mod = self.bin_file.options.module.?;
10438 const mod = self.bin_file.comp.module.?;
1043910439 const abi_size: u32 = @intCast(dst_ty.abiSize(mod));
1044010440 try self.spillEflagsIfOccupied();
1044110441 switch (dst_mcv) {
......@@ -10560,7 +10560,7 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M
1056010560}
1056110561
1056210562fn airArg(self: *Self, inst: Air.Inst.Index) !void {
10563 const mod = self.bin_file.options.module.?;
10563 const mod = self.bin_file.comp.module.?;
1056410564 // skip zero-bit arguments as they don't have a corresponding arg instruction
1056510565 var arg_index = self.arg_index;
1056610566 while (self.args[arg_index] == .none) arg_index += 1;
......@@ -10593,7 +10593,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void {
1059310593}
1059410594
1059510595fn genArgDbgInfo(self: Self, ty: Type, name: [:0]const u8, mcv: MCValue) !void {
10596 const mod = self.bin_file.options.module.?;
10596 const mod = self.bin_file.comp.module.?;
1059710597 switch (self.debug_output) {
1059810598 .dwarf => |dw| {
1059910599 const loc: link.File.Dwarf.DeclState.DbgInfoLoc = switch (mcv) {
......@@ -10629,7 +10629,7 @@ fn genVarDbgInfo(
1062910629 mcv: MCValue,
1063010630 name: [:0]const u8,
1063110631) !void {
10632 const mod = self.bin_file.options.module.?;
10632 const mod = self.bin_file.comp.module.?;
1063310633 const is_ptr = switch (tag) {
1063410634 .dbg_var_ptr => true,
1063510635 .dbg_var_val => false,
......@@ -10748,7 +10748,7 @@ fn genCall(self: *Self, info: union(enum) {
1074810748 callee: []const u8,
1074910749 },
1075010750}, arg_types: []const Type, args: []const MCValue) !MCValue {
10751 const mod = self.bin_file.options.module.?;
10751 const mod = self.bin_file.comp.module.?;
1075210752
1075310753 const fn_ty = switch (info) {
1075410754 .air => |callee| fn_info: {
......@@ -10969,7 +10969,7 @@ fn genCall(self: *Self, info: union(enum) {
1096910969}
1097010970
1097110971fn airRet(self: *Self, inst: Air.Inst.Index) !void {
10972 const mod = self.bin_file.options.module.?;
10972 const mod = self.bin_file.comp.module.?;
1097310973 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
1097410974
1097510975 const ret_ty = self.fn_type.fnReturnType(mod);
......@@ -11018,7 +11018,7 @@ fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void {
1101811018}
1101911019
1102011020fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
11021 const mod = self.bin_file.options.module.?;
11021 const mod = self.bin_file.comp.module.?;
1102211022 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
1102311023 const ty = self.typeOf(bin_op.lhs);
1102411024
......@@ -11412,7 +11412,7 @@ fn airCmpVector(self: *Self, inst: Air.Inst.Index) !void {
1141211412}
1141311413
1141411414fn airCmpLtErrorsLen(self: *Self, inst: Air.Inst.Index) !void {
11415 const mod = self.bin_file.options.module.?;
11415 const mod = self.bin_file.comp.module.?;
1141611416 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
1141711417
1141811418 const addr_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp);
......@@ -11551,7 +11551,7 @@ fn airDbgVar(self: *Self, inst: Air.Inst.Index) !void {
1155111551}
1155211552
1155311553fn genCondBrMir(self: *Self, ty: Type, mcv: MCValue) !Mir.Inst.Index {
11554 const mod = self.bin_file.options.module.?;
11554 const mod = self.bin_file.comp.module.?;
1155511555 const abi_size = ty.abiSize(mod);
1155611556 switch (mcv) {
1155711557 .eflags => |cc| {
......@@ -11624,7 +11624,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void {
1162411624}
1162511625
1162611626fn isNull(self: *Self, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) !MCValue {
11627 const mod = self.bin_file.options.module.?;
11627 const mod = self.bin_file.comp.module.?;
1162811628 switch (opt_mcv) {
1162911629 .register_overflow => |ro| return .{ .eflags = ro.eflags.negate() },
1163011630 else => {},
......@@ -11732,7 +11732,7 @@ fn isNull(self: *Self, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) !MC
1173211732}
1173311733
1173411734fn isNullPtr(self: *Self, inst: Air.Inst.Index, ptr_ty: Type, ptr_mcv: MCValue) !MCValue {
11735 const mod = self.bin_file.options.module.?;
11735 const mod = self.bin_file.comp.module.?;
1173611736 const opt_ty = ptr_ty.childType(mod);
1173711737 const pl_ty = opt_ty.optionalChild(mod);
1173811738
......@@ -11768,7 +11768,7 @@ fn isNullPtr(self: *Self, inst: Air.Inst.Index, ptr_ty: Type, ptr_mcv: MCValue)
1176811768}
1176911769
1177011770fn isErr(self: *Self, maybe_inst: ?Air.Inst.Index, eu_ty: Type, eu_mcv: MCValue) !MCValue {
11771 const mod = self.bin_file.options.module.?;
11771 const mod = self.bin_file.comp.module.?;
1177211772 const err_ty = eu_ty.errorUnionSet(mod);
1177311773 if (err_ty.errorSetIsEmpty(mod)) return MCValue{ .immediate = 0 }; // always false
1177411774
......@@ -11815,7 +11815,7 @@ fn isErr(self: *Self, maybe_inst: ?Air.Inst.Index, eu_ty: Type, eu_mcv: MCValue)
1181511815}
1181611816
1181711817fn isErrPtr(self: *Self, maybe_inst: ?Air.Inst.Index, ptr_ty: Type, ptr_mcv: MCValue) !MCValue {
11818 const mod = self.bin_file.options.module.?;
11818 const mod = self.bin_file.comp.module.?;
1181911819 const eu_ty = ptr_ty.childType(mod);
1182011820 const err_ty = eu_ty.errorUnionSet(mod);
1182111821 if (err_ty.errorSetIsEmpty(mod)) return MCValue{ .immediate = 0 }; // always false
......@@ -12097,7 +12097,7 @@ fn performReloc(self: *Self, reloc: Mir.Inst.Index) !void {
1209712097}
1209812098
1209912099fn airBr(self: *Self, inst: Air.Inst.Index) !void {
12100 const mod = self.bin_file.options.module.?;
12100 const mod = self.bin_file.comp.module.?;
1210112101 const br = self.air.instructions.items(.data)[@intFromEnum(inst)].br;
1210212102
1210312103 const block_ty = self.typeOfIndex(br.block_inst);
......@@ -12158,7 +12158,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void {
1215812158}
1215912159
1216012160fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
12161 const mod = self.bin_file.options.module.?;
12161 const mod = self.bin_file.comp.module.?;
1216212162 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
1216312163 const extra = self.air.extraData(Air.Asm, ty_pl.payload);
1216412164 const clobbers_len: u31 = @truncate(extra.data.flags);
......@@ -12865,7 +12865,7 @@ const MoveStrategy = union(enum) {
1286512865 }
1286612866};
1286712867fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !MoveStrategy {
12868 const mod = self.bin_file.options.module.?;
12868 const mod = self.bin_file.comp.module.?;
1286912869 switch (class) {
1287012870 .general_purpose, .segment => return .{ .move = .{ ._, .mov } },
1287112871 .x87 => return .x87_load_store,
......@@ -13164,7 +13164,7 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo
1316413164}
1316513165
1316613166fn genCopy(self: *Self, ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError!void {
13167 const mod = self.bin_file.options.module.?;
13167 const mod = self.bin_file.comp.module.?;
1316813168
1316913169 const src_lock = if (src_mcv.getReg()) |reg| self.register_manager.lockReg(reg) else null;
1317013170 defer if (src_lock) |lock| self.register_manager.unlockReg(lock);
......@@ -13262,7 +13262,7 @@ fn genCopy(self: *Self, ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError
1326213262}
1326313263
1326413264fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerError!void {
13265 const mod = self.bin_file.options.module.?;
13265 const mod = self.bin_file.comp.module.?;
1326613266 const abi_size: u32 = @intCast(ty.abiSize(mod));
1326713267 if (ty.bitSize(mod) > dst_reg.bitSize())
1326813268 return self.fail("genSetReg called with a value larger than dst_reg", .{});
......@@ -13561,7 +13561,7 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr
1356113561}
1356213562
1356313563fn genSetMem(self: *Self, base: Memory.Base, disp: i32, ty: Type, src_mcv: MCValue) InnerError!void {
13564 const mod = self.bin_file.options.module.?;
13564 const mod = self.bin_file.comp.module.?;
1356513565 const abi_size: u32 = @intCast(ty.abiSize(mod));
1356613566 const dst_ptr_mcv: MCValue = switch (base) {
1356713567 .none => .{ .immediate = @bitCast(@as(i64, disp)) },
......@@ -13922,7 +13922,7 @@ fn airIntFromPtr(self: *Self, inst: Air.Inst.Index) !void {
1392213922}
1392313923
1392413924fn airBitCast(self: *Self, inst: Air.Inst.Index) !void {
13925 const mod = self.bin_file.options.module.?;
13925 const mod = self.bin_file.comp.module.?;
1392613926 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
1392713927 const dst_ty = self.typeOfIndex(inst);
1392813928 const src_ty = self.typeOf(ty_op.operand);
......@@ -13980,7 +13980,7 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void {
1398013980}
1398113981
1398213982fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
13983 const mod = self.bin_file.options.module.?;
13983 const mod = self.bin_file.comp.module.?;
1398413984 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
1398513985
1398613986 const slice_ty = self.typeOfIndex(inst);
......@@ -14003,7 +14003,7 @@ fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void {
1400314003}
1400414004
1400514005fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
14006 const mod = self.bin_file.options.module.?;
14006 const mod = self.bin_file.comp.module.?;
1400714007 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
1400814008
1400914009 const dst_ty = self.typeOfIndex(inst);
......@@ -14082,7 +14082,7 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
1408214082}
1408314083
1408414084fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {
14085 const mod = self.bin_file.options.module.?;
14085 const mod = self.bin_file.comp.module.?;
1408614086 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
1408714087
1408814088 const dst_ty = self.typeOfIndex(inst);
......@@ -14153,7 +14153,7 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void {
1415314153}
1415414154
1415514155fn airCmpxchg(self: *Self, inst: Air.Inst.Index) !void {
14156 const mod = self.bin_file.options.module.?;
14156 const mod = self.bin_file.comp.module.?;
1415714157 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
1415814158 const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data;
1415914159
......@@ -14249,7 +14249,7 @@ fn atomicOp(
1424914249 rmw_op: ?std.builtin.AtomicRmwOp,
1425014250 order: std.builtin.AtomicOrder,
1425114251) InnerError!MCValue {
14252 const mod = self.bin_file.options.module.?;
14252 const mod = self.bin_file.comp.module.?;
1425314253 const ptr_lock = switch (ptr_mcv) {
1425414254 .register => |reg| self.register_manager.lockReg(reg),
1425514255 else => null,
......@@ -14653,7 +14653,7 @@ fn airAtomicStore(self: *Self, inst: Air.Inst.Index, order: std.builtin.AtomicOr
1465314653}
1465414654
1465514655fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {
14656 const mod = self.bin_file.options.module.?;
14656 const mod = self.bin_file.comp.module.?;
1465714657 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
1465814658
1465914659 result: {
......@@ -14781,7 +14781,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void {
1478114781}
1478214782
1478314783fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void {
14784 const mod = self.bin_file.options.module.?;
14784 const mod = self.bin_file.comp.module.?;
1478514785 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
1478614786
1478714787 try self.spillRegisters(&.{ .rdi, .rsi, .rcx });
......@@ -14836,7 +14836,7 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void {
1483614836}
1483714837
1483814838fn airTagName(self: *Self, inst: Air.Inst.Index) !void {
14839 const mod = self.bin_file.options.module.?;
14839 const mod = self.bin_file.comp.module.?;
1484014840 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
1484114841 const inst_ty = self.typeOfIndex(inst);
1484214842 const enum_ty = self.typeOf(un_op);
......@@ -14878,7 +14878,7 @@ fn airTagName(self: *Self, inst: Air.Inst.Index) !void {
1487814878}
1487914879
1488014880fn airErrorName(self: *Self, inst: Air.Inst.Index) !void {
14881 const mod = self.bin_file.options.module.?;
14881 const mod = self.bin_file.comp.module.?;
1488214882 const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
1488314883
1488414884 const err_ty = self.typeOf(un_op);
......@@ -14980,7 +14980,7 @@ fn airErrorName(self: *Self, inst: Air.Inst.Index) !void {
1498014980}
1498114981
1498214982fn airSplat(self: *Self, inst: Air.Inst.Index) !void {
14983 const mod = self.bin_file.options.module.?;
14983 const mod = self.bin_file.comp.module.?;
1498414984 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
1498514985 const vector_ty = self.typeOfIndex(inst);
1498614986 const vector_len = vector_ty.vectorLen(mod);
......@@ -15332,7 +15332,7 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void {
1533215332}
1533315333
1533415334fn airReduce(self: *Self, inst: Air.Inst.Index) !void {
15335 const mod = self.bin_file.options.module.?;
15335 const mod = self.bin_file.comp.module.?;
1533615336 const reduce = self.air.instructions.items(.data)[@intFromEnum(inst)].reduce;
1533715337
1533815338 const result: MCValue = result: {
......@@ -15389,7 +15389,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void {
1538915389}
1539015390
1539115391fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
15392 const mod = self.bin_file.options.module.?;
15392 const mod = self.bin_file.comp.module.?;
1539315393 const result_ty = self.typeOfIndex(inst);
1539415394 const len: usize = @intCast(result_ty.arrayLen(mod));
1539515395 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
......@@ -15562,7 +15562,7 @@ fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
1556215562}
1556315563
1556415564fn airUnionInit(self: *Self, inst: Air.Inst.Index) !void {
15565 const mod = self.bin_file.options.module.?;
15565 const mod = self.bin_file.comp.module.?;
1556615566 const ip = &mod.intern_pool;
1556715567 const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
1556815568 const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data;
......@@ -15613,7 +15613,7 @@ fn airPrefetch(self: *Self, inst: Air.Inst.Index) !void {
1561315613}
1561415614
1561515615fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
15616 const mod = self.bin_file.options.module.?;
15616 const mod = self.bin_file.comp.module.?;
1561715617 const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
1561815618 const extra = self.air.extraData(Air.Bin, pl_op.payload).data;
1561915619 const ty = self.typeOfIndex(inst);
......@@ -15780,7 +15780,7 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
1578015780}
1578115781
1578215782fn airVaStart(self: *Self, inst: Air.Inst.Index) !void {
15783 const mod = self.bin_file.options.module.?;
15783 const mod = self.bin_file.comp.module.?;
1578415784 const va_list_ty = self.air.instructions.items(.data)[@intFromEnum(inst)].ty;
1578515785 const ptr_anyopaque_ty = try mod.singleMutPtrType(Type.anyopaque);
1578615786
......@@ -15833,7 +15833,7 @@ fn airVaStart(self: *Self, inst: Air.Inst.Index) !void {
1583315833}
1583415834
1583515835fn airVaArg(self: *Self, inst: Air.Inst.Index) !void {
15836 const mod = self.bin_file.options.module.?;
15836 const mod = self.bin_file.comp.module.?;
1583715837 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
1583815838 const ty = self.typeOfIndex(inst);
1583915839 const promote_ty = self.promoteVarArg(ty);
......@@ -16042,7 +16042,7 @@ fn airVaEnd(self: *Self, inst: Air.Inst.Index) !void {
1604216042}
1604316043
1604416044fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!MCValue {
16045 const mod = self.bin_file.options.module.?;
16045 const mod = self.bin_file.comp.module.?;
1604616046 const ty = self.typeOf(ref);
1604716047
1604816048 // If the type has no codegen bits, no need to store it.
......@@ -16116,7 +16116,7 @@ fn limitImmediateType(self: *Self, operand: Air.Inst.Ref, comptime T: type) !MCV
1611616116}
1611716117
1611816118fn genTypedValue(self: *Self, arg_tv: TypedValue) InnerError!MCValue {
16119 const mod = self.bin_file.options.module.?;
16119 const mod = self.bin_file.comp.module.?;
1612016120 return switch (try codegen.genTypedValue(self.bin_file, self.src_loc, arg_tv, self.owner.getDecl(mod))) {
1612116121 .mcv => |mcv| switch (mcv) {
1612216122 .none => .none,
......@@ -16156,7 +16156,7 @@ fn resolveCallingConventionValues(
1615616156 var_args: []const Type,
1615716157 stack_frame_base: FrameIndex,
1615816158) !CallMCValues {
16159 const mod = self.bin_file.options.module.?;
16159 const mod = self.bin_file.comp.module.?;
1616016160 const ip = &mod.intern_pool;
1616116161 const cc = fn_info.cc;
1616216162 const param_types = try self.gpa.alloc(Type, fn_info.param_types.len + var_args.len);
......@@ -16468,7 +16468,7 @@ fn registerAlias(reg: Register, size_bytes: u32) Register {
1646816468}
1646916469
1647016470fn memSize(self: *Self, ty: Type) Memory.Size {
16471 const mod = self.bin_file.options.module.?;
16471 const mod = self.bin_file.comp.module.?;
1647216472 return switch (ty.zigTypeTag(mod)) {
1647316473 .Float => Memory.Size.fromBitSize(ty.floatBits(self.target.*)),
1647416474 else => Memory.Size.fromSize(@intCast(ty.abiSize(mod))),
......@@ -16476,7 +16476,7 @@ fn memSize(self: *Self, ty: Type) Memory.Size {
1647616476}
1647716477
1647816478fn splitType(self: *Self, ty: Type) ![2]Type {
16479 const mod = self.bin_file.options.module.?;
16479 const mod = self.bin_file.comp.module.?;
1648016480 const classes = mem.sliceTo(&abi.classifySystemV(ty, mod, .other), .none);
1648116481 var parts: [2]Type = undefined;
1648216482 if (classes.len == 2) for (&parts, classes, 0..) |*part, class, part_i| {
......@@ -16505,7 +16505,7 @@ fn splitType(self: *Self, ty: Type) ![2]Type {
1650516505/// Truncates the value in the register in place.
1650616506/// Clobbers any remaining bits.
1650716507fn truncateRegister(self: *Self, ty: Type, reg: Register) !void {
16508 const mod = self.bin_file.options.module.?;
16508 const mod = self.bin_file.comp.module.?;
1650916509 const int_info = if (ty.isAbiInt(mod)) ty.intInfo(mod) else std.builtin.Type.Int{
1651016510 .signedness = .unsigned,
1651116511 .bits = @intCast(ty.bitSize(mod)),
......@@ -16550,7 +16550,7 @@ fn truncateRegister(self: *Self, ty: Type, reg: Register) !void {
1655016550}
1655116551
1655216552fn regBitSize(self: *Self, ty: Type) u64 {
16553 const mod = self.bin_file.options.module.?;
16553 const mod = self.bin_file.comp.module.?;
1655416554 const abi_size = ty.abiSize(mod);
1655516555 return switch (ty.zigTypeTag(mod)) {
1655616556 else => switch (abi_size) {
......@@ -16569,7 +16569,7 @@ fn regBitSize(self: *Self, ty: Type) u64 {
1656916569}
1657016570
1657116571fn regExtraBits(self: *Self, ty: Type) u64 {
16572 const mod = self.bin_file.options.module.?;
16572 const mod = self.bin_file.comp.module.?;
1657316573 return self.regBitSize(ty) - ty.bitSize(mod);
1657416574}
1657516575
......@@ -16584,12 +16584,12 @@ fn hasAllFeatures(self: *Self, features: anytype) bool {
1658416584}
1658516585
1658616586fn typeOf(self: *Self, inst: Air.Inst.Ref) Type {
16587 const mod = self.bin_file.options.module.?;
16587 const mod = self.bin_file.comp.module.?;
1658816588 return self.air.typeOf(inst, &mod.intern_pool);
1658916589}
1659016590
1659116591fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type {
16592 const mod = self.bin_file.options.module.?;
16592 const mod = self.bin_file.comp.module.?;
1659316593 return self.air.typeOfIndex(inst, &mod.intern_pool);
1659416594}
1659516595
......@@ -16641,7 +16641,7 @@ fn floatLibcAbiSuffix(ty: Type) []const u8 {
1664116641}
1664216642
1664316643fn promoteInt(self: *Self, ty: Type) Type {
16644 const mod = self.bin_file.options.module.?;
16644 const mod = self.bin_file.comp.module.?;
1664516645 const int_info: InternPool.Key.IntType = switch (ty.toIntern()) {
1664616646 .bool_type => .{ .signedness = .unsigned, .bits = 1 },
1664716647 else => if (ty.isAbiInt(mod)) ty.intInfo(mod) else return ty,
src/codegen.zig+8-8
......@@ -110,7 +110,7 @@ pub fn generateLazySymbol(
110110 const target = bin_file.options.target;
111111 const endian = target.cpu.arch.endian();
112112
113 const mod = bin_file.options.module.?;
113 const mod = bin_file.comp.module.?;
114114 log.debug("generateLazySymbol: kind = {s}, ty = {}", .{
115115 @tagName(lazy_sym.kind),
116116 lazy_sym.ty.fmt(mod),
......@@ -165,7 +165,7 @@ pub fn generateSymbol(
165165 const tracy = trace(@src());
166166 defer tracy.end();
167167
168 const mod = bin_file.options.module.?;
168 const mod = bin_file.comp.module.?;
169169 const ip = &mod.intern_pool;
170170 const typed_value = arg_tv;
171171
......@@ -662,7 +662,7 @@ fn lowerParentPtr(
662662 debug_output: DebugInfoOutput,
663663 reloc_info: RelocInfo,
664664) CodeGenError!Result {
665 const mod = bin_file.options.module.?;
665 const mod = bin_file.comp.module.?;
666666 const ptr = mod.intern_pool.indexToKey(parent_ptr).ptr;
667667 assert(ptr.len == .none);
668668 return switch (ptr.addr) {
......@@ -766,7 +766,7 @@ fn lowerAnonDeclRef(
766766) CodeGenError!Result {
767767 _ = debug_output;
768768 const target = bin_file.options.target;
769 const mod = bin_file.options.module.?;
769 const mod = bin_file.comp.module.?;
770770
771771 const ptr_width_bytes = @divExact(target.ptrBitWidth(), 8);
772772 const decl_val = anon_decl.val;
......@@ -812,7 +812,7 @@ fn lowerDeclRef(
812812 _ = src_loc;
813813 _ = debug_output;
814814 const target = bin_file.options.target;
815 const mod = bin_file.options.module.?;
815 const mod = bin_file.comp.module.?;
816816
817817 const ptr_width = target.ptrBitWidth();
818818 const decl = mod.declPtr(decl_index);
......@@ -902,7 +902,7 @@ fn genDeclRef(
902902 tv: TypedValue,
903903 ptr_decl_index: InternPool.DeclIndex,
904904) CodeGenError!GenResult {
905 const mod = bin_file.options.module.?;
905 const mod = bin_file.comp.module.?;
906906 log.debug("genDeclRef: ty = {}, val = {}", .{ tv.ty.fmt(mod), tv.val.fmtValue(tv.ty, mod) });
907907
908908 const target = bin_file.options.target;
......@@ -1010,7 +1010,7 @@ fn genUnnamedConst(
10101010 tv: TypedValue,
10111011 owner_decl_index: InternPool.DeclIndex,
10121012) CodeGenError!GenResult {
1013 const mod = bin_file.options.module.?;
1013 const mod = bin_file.comp.module.?;
10141014 log.debug("genUnnamedConst: ty = {}, val = {}", .{ tv.ty.fmt(mod), tv.val.fmtValue(tv.ty, mod) });
10151015
10161016 const target = bin_file.options.target;
......@@ -1038,7 +1038,7 @@ pub fn genTypedValue(
10381038 arg_tv: TypedValue,
10391039 owner_decl_index: InternPool.DeclIndex,
10401040) CodeGenError!GenResult {
1041 const mod = bin_file.options.module.?;
1041 const mod = bin_file.comp.module.?;
10421042 const typed_value = arg_tv;
10431043
10441044 log.debug("genTypedValue: ty = {}, val = {}", .{
src/codegen/llvm.zig+1-1
......@@ -1227,7 +1227,7 @@ pub const Object = struct {
12271227 defer arena_allocator.deinit();
12281228 const arena = arena_allocator.allocator();
12291229
1230 const mod = comp.bin_file.options.module.?;
1230 const mod = comp.module.?;
12311231 const cache_dir = mod.zig_cache_artifact_directory;
12321232
12331233 if (std.debug.runtime_safety and !try self.builder.verify()) {