| author | |
| committer | |
| log | f5ddef1e45fb5e6defcad21e50736c6e0f63c089 |
| tree | 0fccbee2a74cc3dc4ce0e44dda245f4c22af16e9 |
| parent | 41a8f5aec34ad4d6e4f5c4a2a2dc47f10bb1311d |
9 files changed, 365 insertions(+), 365 deletions(-)
src/Compilation.zig+32-32| ... | @@ -1915,7 +1915,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -1915,7 +1915,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1915 | } | 1915 | } |
| 1916 | 1916 | ||
| 1917 | pub fn destroy(self: *Compilation) void { | 1917 | pub fn destroy(self: *Compilation) void { |
| 1918 | const optional_module = self.bin_file.options.module; | 1918 | const optional_module = self.module; |
| 1919 | self.bin_file.destroy(); | 1919 | self.bin_file.destroy(); |
| 1920 | if (optional_module) |module| module.deinit(); | 1920 | if (optional_module) |module| module.deinit(); |
| 1921 | 1921 | ||
| ... | @@ -2017,7 +2017,7 @@ fn restorePrevZigCacheArtifactDirectory(comp: *Compilation, directory: *Director | ... | @@ -2017,7 +2017,7 @@ fn restorePrevZigCacheArtifactDirectory(comp: *Compilation, directory: *Director |
| 2017 | // Restore the Module's previous zig_cache_artifact_directory | 2017 | // Restore the Module's previous zig_cache_artifact_directory |
| 2018 | // This is only for cleanup purposes; Module.deinit calls close | 2018 | // This is only for cleanup purposes; Module.deinit calls close |
| 2019 | // on the handle of zig_cache_artifact_directory. | 2019 | // on the handle of zig_cache_artifact_directory. |
| 2020 | if (comp.bin_file.options.module) |module| { | 2020 | if (comp.module) |module| { |
| 2021 | const builtin_mod = module.main_mod.deps.get("builtin").?; | 2021 | const builtin_mod = module.main_mod.deps.get("builtin").?; |
| 2022 | module.zig_cache_artifact_directory = builtin_mod.root.root_dir; | 2022 | module.zig_cache_artifact_directory = builtin_mod.root.root_dir; |
| 2023 | } | 2023 | } |
| ... | @@ -2109,7 +2109,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void | ... | @@ -2109,7 +2109,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void |
| 2109 | }; | 2109 | }; |
| 2110 | 2110 | ||
| 2111 | // This updates the output directory for linker outputs. | 2111 | // This updates the output directory for linker outputs. |
| 2112 | if (comp.bin_file.options.module) |module| { | 2112 | if (comp.module) |module| { |
| 2113 | module.zig_cache_artifact_directory = tmp_artifact_directory.?; | 2113 | module.zig_cache_artifact_directory = tmp_artifact_directory.?; |
| 2114 | } | 2114 | } |
| 2115 | 2115 | ||
| ... | @@ -2155,7 +2155,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void | ... | @@ -2155,7 +2155,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void |
| 2155 | } | 2155 | } |
| 2156 | } | 2156 | } |
| 2157 | 2157 | ||
| 2158 | if (comp.bin_file.options.module) |module| { | 2158 | if (comp.module) |module| { |
| 2159 | module.compile_log_text.shrinkAndFree(module.gpa, 0); | 2159 | module.compile_log_text.shrinkAndFree(module.gpa, 0); |
| 2160 | module.generation += 1; | 2160 | module.generation += 1; |
| 2161 | 2161 | ||
| ... | @@ -2206,7 +2206,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void | ... | @@ -2206,7 +2206,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void |
| 2206 | 2206 | ||
| 2207 | try comp.performAllTheWork(main_progress_node); | 2207 | try comp.performAllTheWork(main_progress_node); |
| 2208 | 2208 | ||
| 2209 | if (comp.bin_file.options.module) |module| { | 2209 | if (comp.module) |module| { |
| 2210 | if (builtin.mode == .Debug and comp.verbose_intern_pool) { | 2210 | if (builtin.mode == .Debug and comp.verbose_intern_pool) { |
| 2211 | std.debug.print("intern pool stats for '{s}':\n", .{ | 2211 | std.debug.print("intern pool stats for '{s}':\n", .{ |
| 2212 | comp.bin_file.options.root_name, | 2212 | comp.bin_file.options.root_name, |
| ... | @@ -2277,7 +2277,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void | ... | @@ -2277,7 +2277,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void |
| 2277 | } | 2277 | } |
| 2278 | 2278 | ||
| 2279 | // This is intentionally sandwiched between renameTmpIntoCache() and writeManifest(). | 2279 | // This is intentionally sandwiched between renameTmpIntoCache() and writeManifest(). |
| 2280 | if (comp.bin_file.options.module) |module| { | 2280 | if (comp.module) |module| { |
| 2281 | // We need to set the zig_cache_artifact_directory for -femit-asm, -femit-llvm-ir, | 2281 | // We need to set the zig_cache_artifact_directory for -femit-asm, -femit-llvm-ir, |
| 2282 | // etc to know where to output to. | 2282 | // etc to know where to output to. |
| 2283 | var artifact_dir = try comp.local_cache_directory.handle.openDir(o_sub_path, .{}); | 2283 | 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 | ... | @@ -2322,7 +2322,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void |
| 2322 | // to it, and (2) generic instantiations, comptime calls, inline calls will need | 2322 | // to it, and (2) generic instantiations, comptime calls, inline calls will need |
| 2323 | // to reference the ZIR. | 2323 | // to reference the ZIR. |
| 2324 | if (!comp.keep_source_files_loaded) { | 2324 | if (!comp.keep_source_files_loaded) { |
| 2325 | if (comp.bin_file.options.module) |module| { | 2325 | if (comp.module) |module| { |
| 2326 | for (module.import_table.values()) |file| { | 2326 | for (module.import_table.values()) |file| { |
| 2327 | file.unloadTree(comp.gpa); | 2327 | file.unloadTree(comp.gpa); |
| 2328 | file.unloadSource(comp.gpa); | 2328 | file.unloadSource(comp.gpa); |
| ... | @@ -2332,7 +2332,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void | ... | @@ -2332,7 +2332,7 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void |
| 2332 | } | 2332 | } |
| 2333 | 2333 | ||
| 2334 | fn maybeGenerateAutodocs(comp: *Compilation, prog_node: *std.Progress.Node) !void { | 2334 | fn 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; |
| 2336 | // TODO: do this in a separate job during performAllTheWork(). The | 2336 | // TODO: do this in a separate job during performAllTheWork(). The |
| 2337 | // file copies at the end of generate() can also be extracted to | 2337 | // file copies at the end of generate() can also be extracted to |
| 2338 | // separate jobs | 2338 | // separate jobs |
| ... | @@ -2360,7 +2360,7 @@ fn flush(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -2360,7 +2360,7 @@ fn flush(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 2360 | }; | 2360 | }; |
| 2361 | comp.link_error_flags = comp.bin_file.errorFlags(); | 2361 | comp.link_error_flags = comp.bin_file.errorFlags(); |
| 2362 | 2362 | ||
| 2363 | if (comp.bin_file.options.module) |module| { | 2363 | if (comp.module) |module| { |
| 2364 | try link.File.C.flushEmitH(module); | 2364 | try link.File.C.flushEmitH(module); |
| 2365 | } | 2365 | } |
| 2366 | } | 2366 | } |
| ... | @@ -2421,7 +2421,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes | ... | @@ -2421,7 +2421,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes |
| 2421 | 2421 | ||
| 2422 | comptime assert(link_hash_implementation_version == 10); | 2422 | comptime assert(link_hash_implementation_version == 10); |
| 2423 | 2423 | ||
| 2424 | if (comp.bin_file.options.module) |mod| { | 2424 | if (comp.module) |mod| { |
| 2425 | const main_zig_file = try mod.main_mod.root.joinString(arena, mod.main_mod.root_src_path); | 2425 | const main_zig_file = try mod.main_mod.root.joinString(arena, mod.main_mod.root_src_path); |
| 2426 | _ = try man.addFile(main_zig_file, null); | 2426 | _ = try man.addFile(main_zig_file, null); |
| 2427 | try addModuleTableToCacheHash(gpa, arena, &man.hash, mod.main_mod, .{ .files = man }); | 2427 | try addModuleTableToCacheHash(gpa, arena, &man.hash, mod.main_mod, .{ .files = man }); |
| ... | @@ -2559,7 +2559,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes | ... | @@ -2559,7 +2559,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes |
| 2559 | } | 2559 | } |
| 2560 | 2560 | ||
| 2561 | fn emitOthers(comp: *Compilation) void { | 2561 | fn 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 |
| 2563 | comp.c_object_table.count() == 0) | 2563 | comp.c_object_table.count() == 0) |
| 2564 | { | 2564 | { |
| 2565 | return; | 2565 | return; |
| ... | @@ -2727,7 +2727,7 @@ pub fn saveState(comp: *Compilation) !void { | ... | @@ -2727,7 +2727,7 @@ pub fn saveState(comp: *Compilation) !void { |
| 2727 | 2727 | ||
| 2728 | const emit = comp.bin_file.options.emit orelse return; | 2728 | const emit = comp.bin_file.options.emit orelse return; |
| 2729 | 2729 | ||
| 2730 | if (comp.bin_file.options.module) |mod| { | 2730 | if (comp.module) |mod| { |
| 2731 | const ip = &mod.intern_pool; | 2731 | const ip = &mod.intern_pool; |
| 2732 | const header: Header = .{ | 2732 | const header: Header = .{ |
| 2733 | .intern_pool = .{ | 2733 | .intern_pool = .{ |
| ... | @@ -2792,7 +2792,7 @@ pub fn totalErrorCount(self: *Compilation) u32 { | ... | @@ -2792,7 +2792,7 @@ pub fn totalErrorCount(self: *Compilation) u32 { |
| 2792 | } | 2792 | } |
| 2793 | } | 2793 | } |
| 2794 | 2794 | ||
| 2795 | if (self.bin_file.options.module) |module| { | 2795 | if (self.module) |module| { |
| 2796 | total += module.failed_exports.count(); | 2796 | total += module.failed_exports.count(); |
| 2797 | total += module.failed_embed_files.count(); | 2797 | total += module.failed_embed_files.count(); |
| 2798 | 2798 | ||
| ... | @@ -2844,7 +2844,7 @@ pub fn totalErrorCount(self: *Compilation) u32 { | ... | @@ -2844,7 +2844,7 @@ pub fn totalErrorCount(self: *Compilation) u32 { |
| 2844 | 2844 | ||
| 2845 | // Compile log errors only count if there are no other errors. | 2845 | // Compile log errors only count if there are no other errors. |
| 2846 | if (total == 0) { | 2846 | if (total == 0) { |
| 2847 | if (self.bin_file.options.module) |module| { | 2847 | if (self.module) |module| { |
| 2848 | total += @intFromBool(module.compile_log_decls.count() != 0); | 2848 | total += @intFromBool(module.compile_log_decls.count() != 0); |
| 2849 | } | 2849 | } |
| 2850 | } | 2850 | } |
| ... | @@ -2896,7 +2896,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { | ... | @@ -2896,7 +2896,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { |
| 2896 | .msg = try bundle.addString("memory allocation failure"), | 2896 | .msg = try bundle.addString("memory allocation failure"), |
| 2897 | }); | 2897 | }); |
| 2898 | } | 2898 | } |
| 2899 | if (self.bin_file.options.module) |module| { | 2899 | if (self.module) |module| { |
| 2900 | for (module.failed_files.keys(), module.failed_files.values()) |file, error_msg| { | 2900 | for (module.failed_files.keys(), module.failed_files.values()) |file, error_msg| { |
| 2901 | if (error_msg) |msg| { | 2901 | if (error_msg) |msg| { |
| 2902 | try addModuleErrorMsg(module, &bundle, msg.*); | 2902 | try addModuleErrorMsg(module, &bundle, msg.*); |
| ... | @@ -3002,7 +3002,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { | ... | @@ -3002,7 +3002,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { |
| 3002 | } | 3002 | } |
| 3003 | } | 3003 | } |
| 3004 | 3004 | ||
| 3005 | if (self.bin_file.options.module) |module| { | 3005 | if (self.module) |module| { |
| 3006 | if (bundle.root_list.items.len == 0 and module.compile_log_decls.count() != 0) { | 3006 | if (bundle.root_list.items.len == 0 and module.compile_log_decls.count() != 0) { |
| 3007 | const keys = module.compile_log_decls.keys(); | 3007 | const keys = module.compile_log_decls.keys(); |
| 3008 | const values = module.compile_log_decls.values(); | 3008 | const values = module.compile_log_decls.values(); |
| ... | @@ -3030,7 +3030,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { | ... | @@ -3030,7 +3030,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { |
| 3030 | 3030 | ||
| 3031 | assert(self.totalErrorCount() == bundle.root_list.items.len); | 3031 | assert(self.totalErrorCount() == bundle.root_list.items.len); |
| 3032 | 3032 | ||
| 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 ""; |
| 3034 | return bundle.toOwnedBundle(compile_log_text); | 3034 | return bundle.toOwnedBundle(compile_log_text); |
| 3035 | } | 3035 | } |
| 3036 | 3036 | ||
| ... | @@ -3314,7 +3314,7 @@ pub fn performAllTheWork( | ... | @@ -3314,7 +3314,7 @@ pub fn performAllTheWork( |
| 3314 | // 1. to avoid race condition of zig processes truncating each other's builtin.zig files | 3314 | // 1. to avoid race condition of zig processes truncating each other's builtin.zig files |
| 3315 | // 2. optimization; in the hot path it only incurs a stat() syscall, which happens | 3315 | // 2. optimization; in the hot path it only incurs a stat() syscall, which happens |
| 3316 | // in the `astgen_wait_group`. | 3316 | // in the `astgen_wait_group`. |
| 3317 | if (comp.bin_file.options.module) |mod| { | 3317 | if (comp.module) |mod| { |
| 3318 | if (mod.job_queued_update_builtin_zig) { | 3318 | if (mod.job_queued_update_builtin_zig) { |
| 3319 | mod.job_queued_update_builtin_zig = false; | 3319 | mod.job_queued_update_builtin_zig = false; |
| 3320 | 3320 | ||
| ... | @@ -3356,15 +3356,15 @@ pub fn performAllTheWork( | ... | @@ -3356,15 +3356,15 @@ pub fn performAllTheWork( |
| 3356 | } | 3356 | } |
| 3357 | } | 3357 | } |
| 3358 | 3358 | ||
| 3359 | if (comp.bin_file.options.module) |mod| { | 3359 | if (comp.module) |mod| { |
| 3360 | try reportMultiModuleErrors(mod); | 3360 | try reportMultiModuleErrors(mod); |
| 3361 | } | 3361 | } |
| 3362 | 3362 | ||
| 3363 | if (comp.bin_file.options.module) |mod| { | 3363 | if (comp.module) |mod| { |
| 3364 | mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0); | 3364 | mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0); |
| 3365 | mod.sema_prog_node.activate(); | 3365 | mod.sema_prog_node.activate(); |
| 3366 | } | 3366 | } |
| 3367 | defer if (comp.bin_file.options.module) |mod| { | 3367 | defer if (comp.module) |mod| { |
| 3368 | mod.sema_prog_node.end(); | 3368 | mod.sema_prog_node.end(); |
| 3369 | mod.sema_prog_node = undefined; | 3369 | mod.sema_prog_node = undefined; |
| 3370 | }; | 3370 | }; |
| ... | @@ -3398,7 +3398,7 @@ pub fn performAllTheWork( | ... | @@ -3398,7 +3398,7 @@ pub fn performAllTheWork( |
| 3398 | fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !void { | 3398 | fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !void { |
| 3399 | switch (job) { | 3399 | switch (job) { |
| 3400 | .codegen_decl => |decl_index| { | 3400 | .codegen_decl => |decl_index| { |
| 3401 | const module = comp.bin_file.options.module.?; | 3401 | const module = comp.module.?; |
| 3402 | const decl = module.declPtr(decl_index); | 3402 | const decl = module.declPtr(decl_index); |
| 3403 | 3403 | ||
| 3404 | switch (decl.analysis) { | 3404 | switch (decl.analysis) { |
| ... | @@ -3436,14 +3436,14 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v | ... | @@ -3436,14 +3436,14 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v |
| 3436 | const named_frame = tracy.namedFrame("codegen_func"); | 3436 | const named_frame = tracy.namedFrame("codegen_func"); |
| 3437 | defer named_frame.end(); | 3437 | defer named_frame.end(); |
| 3438 | 3438 | ||
| 3439 | const module = comp.bin_file.options.module.?; | 3439 | const module = comp.module.?; |
| 3440 | module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) { | 3440 | module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) { |
| 3441 | error.OutOfMemory => return error.OutOfMemory, | 3441 | error.OutOfMemory => return error.OutOfMemory, |
| 3442 | error.AnalysisFail => return, | 3442 | error.AnalysisFail => return, |
| 3443 | }; | 3443 | }; |
| 3444 | }, | 3444 | }, |
| 3445 | .emit_h_decl => |decl_index| { | 3445 | .emit_h_decl => |decl_index| { |
| 3446 | const module = comp.bin_file.options.module.?; | 3446 | const module = comp.module.?; |
| 3447 | const decl = module.declPtr(decl_index); | 3447 | const decl = module.declPtr(decl_index); |
| 3448 | 3448 | ||
| 3449 | switch (decl.analysis) { | 3449 | switch (decl.analysis) { |
| ... | @@ -3502,7 +3502,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v | ... | @@ -3502,7 +3502,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v |
| 3502 | } | 3502 | } |
| 3503 | }, | 3503 | }, |
| 3504 | .analyze_decl => |decl_index| { | 3504 | .analyze_decl => |decl_index| { |
| 3505 | const module = comp.bin_file.options.module.?; | 3505 | const module = comp.module.?; |
| 3506 | module.ensureDeclAnalyzed(decl_index) catch |err| switch (err) { | 3506 | module.ensureDeclAnalyzed(decl_index) catch |err| switch (err) { |
| 3507 | error.OutOfMemory => return error.OutOfMemory, | 3507 | error.OutOfMemory => return error.OutOfMemory, |
| 3508 | error.AnalysisFail => return, | 3508 | error.AnalysisFail => return, |
| ... | @@ -3520,7 +3520,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v | ... | @@ -3520,7 +3520,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v |
| 3520 | defer named_frame.end(); | 3520 | defer named_frame.end(); |
| 3521 | 3521 | ||
| 3522 | const gpa = comp.gpa; | 3522 | const gpa = comp.gpa; |
| 3523 | const module = comp.bin_file.options.module.?; | 3523 | const module = comp.module.?; |
| 3524 | const decl = module.declPtr(decl_index); | 3524 | const decl = module.declPtr(decl_index); |
| 3525 | comp.bin_file.updateDeclLineNumber(module, decl_index) catch |err| { | 3525 | comp.bin_file.updateDeclLineNumber(module, decl_index) catch |err| { |
| 3526 | try module.failed_decls.ensureUnusedCapacity(gpa, 1); | 3526 | try module.failed_decls.ensureUnusedCapacity(gpa, 1); |
| ... | @@ -3537,7 +3537,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v | ... | @@ -3537,7 +3537,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v |
| 3537 | const named_frame = tracy.namedFrame("analyze_mod"); | 3537 | const named_frame = tracy.namedFrame("analyze_mod"); |
| 3538 | defer named_frame.end(); | 3538 | defer named_frame.end(); |
| 3539 | 3539 | ||
| 3540 | const module = comp.bin_file.options.module.?; | 3540 | const module = comp.module.?; |
| 3541 | module.semaPkg(pkg) catch |err| switch (err) { | 3541 | module.semaPkg(pkg) catch |err| switch (err) { |
| 3542 | error.OutOfMemory => return error.OutOfMemory, | 3542 | error.OutOfMemory => return error.OutOfMemory, |
| 3543 | error.AnalysisFail => return, | 3543 | error.AnalysisFail => return, |
| ... | @@ -3716,7 +3716,7 @@ fn workerAstGenFile( | ... | @@ -3716,7 +3716,7 @@ fn workerAstGenFile( |
| 3716 | child_prog_node.activate(); | 3716 | child_prog_node.activate(); |
| 3717 | defer child_prog_node.end(); | 3717 | defer child_prog_node.end(); |
| 3718 | 3718 | ||
| 3719 | const mod = comp.bin_file.options.module.?; | 3719 | const mod = comp.module.?; |
| 3720 | mod.astGenFile(file) catch |err| switch (err) { | 3720 | mod.astGenFile(file) catch |err| switch (err) { |
| 3721 | error.AnalysisFail => return, | 3721 | error.AnalysisFail => return, |
| 3722 | else => { | 3722 | else => { |
| ... | @@ -3819,7 +3819,7 @@ fn workerCheckEmbedFile( | ... | @@ -3819,7 +3819,7 @@ fn workerCheckEmbedFile( |
| 3819 | } | 3819 | } |
| 3820 | 3820 | ||
| 3821 | fn detectEmbedFileUpdate(comp: *Compilation, embed_file: *Module.EmbedFile) !void { | 3821 | fn detectEmbedFileUpdate(comp: *Compilation, embed_file: *Module.EmbedFile) !void { |
| 3822 | const mod = comp.bin_file.options.module.?; | 3822 | const mod = comp.module.?; |
| 3823 | const ip = &mod.intern_pool; | 3823 | const ip = &mod.intern_pool; |
| 3824 | const sub_file_path = ip.stringToSlice(embed_file.sub_file_path); | 3824 | const sub_file_path = ip.stringToSlice(embed_file.sub_file_path); |
| 3825 | var file = try embed_file.owner.root.openFile(sub_file_path, .{}); | 3825 | var file = try embed_file.owner.root.openFile(sub_file_path, .{}); |
| ... | @@ -4142,7 +4142,7 @@ fn reportRetryableAstGenError( | ... | @@ -4142,7 +4142,7 @@ fn reportRetryableAstGenError( |
| 4142 | file: *Module.File, | 4142 | file: *Module.File, |
| 4143 | err: anyerror, | 4143 | err: anyerror, |
| 4144 | ) error{OutOfMemory}!void { | 4144 | ) error{OutOfMemory}!void { |
| 4145 | const mod = comp.bin_file.options.module.?; | 4145 | const mod = comp.module.?; |
| 4146 | const gpa = mod.gpa; | 4146 | const gpa = mod.gpa; |
| 4147 | 4147 | ||
| 4148 | file.status = .retryable_failure; | 4148 | file.status = .retryable_failure; |
| ... | @@ -4181,7 +4181,7 @@ fn reportRetryableEmbedFileError( | ... | @@ -4181,7 +4181,7 @@ fn reportRetryableEmbedFileError( |
| 4181 | embed_file: *Module.EmbedFile, | 4181 | embed_file: *Module.EmbedFile, |
| 4182 | err: anyerror, | 4182 | err: anyerror, |
| 4183 | ) error{OutOfMemory}!void { | 4183 | ) error{OutOfMemory}!void { |
| 4184 | const mod = comp.bin_file.options.module.?; | 4184 | const mod = comp.module.?; |
| 4185 | const gpa = mod.gpa; | 4185 | const gpa = mod.gpa; |
| 4186 | const src_loc = embed_file.src_loc; | 4186 | const src_loc = embed_file.src_loc; |
| 4187 | const ip = &mod.intern_pool; | 4187 | const ip = &mod.intern_pool; |
| ... | @@ -4248,7 +4248,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P | ... | @@ -4248,7 +4248,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: *std.P |
| 4248 | // Special case when doing build-obj for just one C file. When there are more than one object | 4248 | // Special case when doing build-obj for just one C file. When there are more than one object |
| 4249 | // file and building an object we need to link them together, but with just one it should go | 4249 | // file and building an object we need to link them together, but with just one it should go |
| 4250 | // directly to the output file. | 4250 | // 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 |
| 4252 | comp.bin_file.options.output_mode == .Obj and comp.bin_file.options.objects.len == 0; | 4252 | comp.bin_file.options.output_mode == .Obj and comp.bin_file.options.objects.len == 0; |
| 4253 | const o_basename_noext = if (direct_o) | 4253 | const o_basename_noext = if (direct_o) |
| 4254 | comp.bin_file.options.root_name | 4254 | comp.bin_file.options.root_name |
src/arch/aarch64/CodeGen.zig+68-68| ... | @@ -341,7 +341,7 @@ pub fn generate( | ... | @@ -341,7 +341,7 @@ pub fn generate( |
| 341 | @panic("Attempted to compile for architecture that was disabled by build configuration"); | 341 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | const mod = bin_file.options.module.?; | 344 | const mod = bin_file.comp.module.?; |
| 345 | const func = mod.funcInfo(func_index); | 345 | const func = mod.funcInfo(func_index); |
| 346 | const fn_owner_decl = mod.declPtr(func.owner_decl); | 346 | const fn_owner_decl = mod.declPtr(func.owner_decl); |
| 347 | assert(fn_owner_decl.has_tv); | 347 | assert(fn_owner_decl.has_tv); |
| ... | @@ -476,7 +476,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 { | ... | @@ -476,7 +476,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 { |
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | fn gen(self: *Self) !void { | 478 | fn gen(self: *Self) !void { |
| 479 | const mod = self.bin_file.options.module.?; | 479 | const mod = self.bin_file.comp.module.?; |
| 480 | const cc = self.fn_type.fnCallingConvention(mod); | 480 | const cc = self.fn_type.fnCallingConvention(mod); |
| 481 | if (cc != .Naked) { | 481 | if (cc != .Naked) { |
| 482 | // stp fp, lr, [sp, #-16]! | 482 | // stp fp, lr, [sp, #-16]! |
| ... | @@ -656,7 +656,7 @@ fn gen(self: *Self) !void { | ... | @@ -656,7 +656,7 @@ fn gen(self: *Self) !void { |
| 656 | } | 656 | } |
| 657 | 657 | ||
| 658 | fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { | 658 | fn 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.?; |
| 660 | const ip = &mod.intern_pool; | 660 | const ip = &mod.intern_pool; |
| 661 | const air_tags = self.air.instructions.items(.tag); | 661 | const air_tags = self.air.instructions.items(.tag); |
| 662 | 662 | ||
| ... | @@ -1028,7 +1028,7 @@ fn allocMem( | ... | @@ -1028,7 +1028,7 @@ fn allocMem( |
| 1028 | 1028 | ||
| 1029 | /// Use a pointer instruction as the basis for allocating stack memory. | 1029 | /// Use a pointer instruction as the basis for allocating stack memory. |
| 1030 | fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { | 1030 | fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { |
| 1031 | const mod = self.bin_file.options.module.?; | 1031 | const mod = self.bin_file.comp.module.?; |
| 1032 | const elem_ty = self.typeOfIndex(inst).childType(mod); | 1032 | const elem_ty = self.typeOfIndex(inst).childType(mod); |
| 1033 | 1033 | ||
| 1034 | if (!elem_ty.hasRuntimeBits(mod)) { | 1034 | if (!elem_ty.hasRuntimeBits(mod)) { |
| ... | @@ -1048,7 +1048,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { | ... | @@ -1048,7 +1048,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { |
| 1048 | } | 1048 | } |
| 1049 | 1049 | ||
| 1050 | fn allocRegOrMem(self: *Self, elem_ty: Type, reg_ok: bool, maybe_inst: ?Air.Inst.Index) !MCValue { | 1050 | fn 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.?; |
| 1052 | const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse { | 1052 | const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse { |
| 1053 | return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)}); | 1053 | return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)}); |
| 1054 | }; | 1054 | }; |
| ... | @@ -1139,7 +1139,7 @@ fn airAlloc(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1139,7 +1139,7 @@ fn airAlloc(self: *Self, inst: Air.Inst.Index) !void { |
| 1139 | } | 1139 | } |
| 1140 | 1140 | ||
| 1141 | fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void { | 1141 | fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 1142 | const mod = self.bin_file.options.module.?; | 1142 | const mod = self.bin_file.comp.module.?; |
| 1143 | const result: MCValue = switch (self.ret_mcv) { | 1143 | const result: MCValue = switch (self.ret_mcv) { |
| 1144 | .none, .register => .{ .ptr_stack_offset = try self.allocMemPtr(inst) }, | 1144 | .none, .register => .{ .ptr_stack_offset = try self.allocMemPtr(inst) }, |
| 1145 | .stack_offset => blk: { | 1145 | .stack_offset => blk: { |
| ... | @@ -1176,7 +1176,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1176,7 +1176,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { |
| 1176 | if (self.liveness.isUnused(inst)) | 1176 | if (self.liveness.isUnused(inst)) |
| 1177 | return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none }); | 1177 | return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none }); |
| 1178 | 1178 | ||
| 1179 | const mod = self.bin_file.options.module.?; | 1179 | const mod = self.bin_file.comp.module.?; |
| 1180 | const operand = ty_op.operand; | 1180 | const operand = ty_op.operand; |
| 1181 | const operand_mcv = try self.resolveInst(operand); | 1181 | const operand_mcv = try self.resolveInst(operand); |
| 1182 | const operand_ty = self.typeOf(operand); | 1182 | const operand_ty = self.typeOf(operand); |
| ... | @@ -1257,7 +1257,7 @@ fn trunc( | ... | @@ -1257,7 +1257,7 @@ fn trunc( |
| 1257 | operand_ty: Type, | 1257 | operand_ty: Type, |
| 1258 | dest_ty: Type, | 1258 | dest_ty: Type, |
| 1259 | ) !MCValue { | 1259 | ) !MCValue { |
| 1260 | const mod = self.bin_file.options.module.?; | 1260 | const mod = self.bin_file.comp.module.?; |
| 1261 | const info_a = operand_ty.intInfo(mod); | 1261 | const info_a = operand_ty.intInfo(mod); |
| 1262 | const info_b = dest_ty.intInfo(mod); | 1262 | const info_b = dest_ty.intInfo(mod); |
| 1263 | 1263 | ||
| ... | @@ -1320,7 +1320,7 @@ fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1320,7 +1320,7 @@ fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void { |
| 1320 | 1320 | ||
| 1321 | fn airNot(self: *Self, inst: Air.Inst.Index) !void { | 1321 | fn airNot(self: *Self, inst: Air.Inst.Index) !void { |
| 1322 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 1322 | 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.?; |
| 1324 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 1324 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1325 | const operand = try self.resolveInst(ty_op.operand); | 1325 | const operand = try self.resolveInst(ty_op.operand); |
| 1326 | const operand_ty = self.typeOf(ty_op.operand); | 1326 | const operand_ty = self.typeOf(ty_op.operand); |
| ... | @@ -1415,7 +1415,7 @@ fn minMax( | ... | @@ -1415,7 +1415,7 @@ fn minMax( |
| 1415 | rhs_ty: Type, | 1415 | rhs_ty: Type, |
| 1416 | maybe_inst: ?Air.Inst.Index, | 1416 | maybe_inst: ?Air.Inst.Index, |
| 1417 | ) !MCValue { | 1417 | ) !MCValue { |
| 1418 | const mod = self.bin_file.options.module.?; | 1418 | const mod = self.bin_file.comp.module.?; |
| 1419 | switch (lhs_ty.zigTypeTag(mod)) { | 1419 | switch (lhs_ty.zigTypeTag(mod)) { |
| 1420 | .Float => return self.fail("TODO ARM min/max on floats", .{}), | 1420 | .Float => return self.fail("TODO ARM min/max on floats", .{}), |
| 1421 | .Vector => return self.fail("TODO ARM min/max on vectors", .{}), | 1421 | .Vector => return self.fail("TODO ARM min/max on vectors", .{}), |
| ... | @@ -1905,7 +1905,7 @@ fn addSub( | ... | @@ -1905,7 +1905,7 @@ fn addSub( |
| 1905 | rhs_ty: Type, | 1905 | rhs_ty: Type, |
| 1906 | maybe_inst: ?Air.Inst.Index, | 1906 | maybe_inst: ?Air.Inst.Index, |
| 1907 | ) InnerError!MCValue { | 1907 | ) InnerError!MCValue { |
| 1908 | const mod = self.bin_file.options.module.?; | 1908 | const mod = self.bin_file.comp.module.?; |
| 1909 | switch (lhs_ty.zigTypeTag(mod)) { | 1909 | switch (lhs_ty.zigTypeTag(mod)) { |
| 1910 | .Float => return self.fail("TODO binary operations on floats", .{}), | 1910 | .Float => return self.fail("TODO binary operations on floats", .{}), |
| 1911 | .Vector => return self.fail("TODO binary operations on vectors", .{}), | 1911 | .Vector => return self.fail("TODO binary operations on vectors", .{}), |
| ... | @@ -1966,7 +1966,7 @@ fn mul( | ... | @@ -1966,7 +1966,7 @@ fn mul( |
| 1966 | rhs_ty: Type, | 1966 | rhs_ty: Type, |
| 1967 | maybe_inst: ?Air.Inst.Index, | 1967 | maybe_inst: ?Air.Inst.Index, |
| 1968 | ) InnerError!MCValue { | 1968 | ) InnerError!MCValue { |
| 1969 | const mod = self.bin_file.options.module.?; | 1969 | const mod = self.bin_file.comp.module.?; |
| 1970 | switch (lhs_ty.zigTypeTag(mod)) { | 1970 | switch (lhs_ty.zigTypeTag(mod)) { |
| 1971 | .Vector => return self.fail("TODO binary operations on vectors", .{}), | 1971 | .Vector => return self.fail("TODO binary operations on vectors", .{}), |
| 1972 | .Int => { | 1972 | .Int => { |
| ... | @@ -1998,7 +1998,7 @@ fn divFloat( | ... | @@ -1998,7 +1998,7 @@ fn divFloat( |
| 1998 | _ = rhs_ty; | 1998 | _ = rhs_ty; |
| 1999 | _ = maybe_inst; | 1999 | _ = maybe_inst; |
| 2000 | 2000 | ||
| 2001 | const mod = self.bin_file.options.module.?; | 2001 | const mod = self.bin_file.comp.module.?; |
| 2002 | switch (lhs_ty.zigTypeTag(mod)) { | 2002 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2003 | .Float => return self.fail("TODO div_float", .{}), | 2003 | .Float => return self.fail("TODO div_float", .{}), |
| 2004 | .Vector => return self.fail("TODO div_float on vectors", .{}), | 2004 | .Vector => return self.fail("TODO div_float on vectors", .{}), |
| ... | @@ -2014,7 +2014,7 @@ fn divTrunc( | ... | @@ -2014,7 +2014,7 @@ fn divTrunc( |
| 2014 | rhs_ty: Type, | 2014 | rhs_ty: Type, |
| 2015 | maybe_inst: ?Air.Inst.Index, | 2015 | maybe_inst: ?Air.Inst.Index, |
| 2016 | ) InnerError!MCValue { | 2016 | ) InnerError!MCValue { |
| 2017 | const mod = self.bin_file.options.module.?; | 2017 | const mod = self.bin_file.comp.module.?; |
| 2018 | switch (lhs_ty.zigTypeTag(mod)) { | 2018 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2019 | .Float => return self.fail("TODO div on floats", .{}), | 2019 | .Float => return self.fail("TODO div on floats", .{}), |
| 2020 | .Vector => return self.fail("TODO div on vectors", .{}), | 2020 | .Vector => return self.fail("TODO div on vectors", .{}), |
| ... | @@ -2048,7 +2048,7 @@ fn divFloor( | ... | @@ -2048,7 +2048,7 @@ fn divFloor( |
| 2048 | rhs_ty: Type, | 2048 | rhs_ty: Type, |
| 2049 | maybe_inst: ?Air.Inst.Index, | 2049 | maybe_inst: ?Air.Inst.Index, |
| 2050 | ) InnerError!MCValue { | 2050 | ) InnerError!MCValue { |
| 2051 | const mod = self.bin_file.options.module.?; | 2051 | const mod = self.bin_file.comp.module.?; |
| 2052 | switch (lhs_ty.zigTypeTag(mod)) { | 2052 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2053 | .Float => return self.fail("TODO div on floats", .{}), | 2053 | .Float => return self.fail("TODO div on floats", .{}), |
| 2054 | .Vector => return self.fail("TODO div on vectors", .{}), | 2054 | .Vector => return self.fail("TODO div on vectors", .{}), |
| ... | @@ -2081,7 +2081,7 @@ fn divExact( | ... | @@ -2081,7 +2081,7 @@ fn divExact( |
| 2081 | rhs_ty: Type, | 2081 | rhs_ty: Type, |
| 2082 | maybe_inst: ?Air.Inst.Index, | 2082 | maybe_inst: ?Air.Inst.Index, |
| 2083 | ) InnerError!MCValue { | 2083 | ) InnerError!MCValue { |
| 2084 | const mod = self.bin_file.options.module.?; | 2084 | const mod = self.bin_file.comp.module.?; |
| 2085 | switch (lhs_ty.zigTypeTag(mod)) { | 2085 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2086 | .Float => return self.fail("TODO div on floats", .{}), | 2086 | .Float => return self.fail("TODO div on floats", .{}), |
| 2087 | .Vector => return self.fail("TODO div on vectors", .{}), | 2087 | .Vector => return self.fail("TODO div on vectors", .{}), |
| ... | @@ -2117,7 +2117,7 @@ fn rem( | ... | @@ -2117,7 +2117,7 @@ fn rem( |
| 2117 | ) InnerError!MCValue { | 2117 | ) InnerError!MCValue { |
| 2118 | _ = maybe_inst; | 2118 | _ = maybe_inst; |
| 2119 | 2119 | ||
| 2120 | const mod = self.bin_file.options.module.?; | 2120 | const mod = self.bin_file.comp.module.?; |
| 2121 | switch (lhs_ty.zigTypeTag(mod)) { | 2121 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2122 | .Float => return self.fail("TODO rem/mod on floats", .{}), | 2122 | .Float => return self.fail("TODO rem/mod on floats", .{}), |
| 2123 | .Vector => return self.fail("TODO rem/mod on vectors", .{}), | 2123 | .Vector => return self.fail("TODO rem/mod on vectors", .{}), |
| ... | @@ -2188,7 +2188,7 @@ fn modulo( | ... | @@ -2188,7 +2188,7 @@ fn modulo( |
| 2188 | _ = rhs_ty; | 2188 | _ = rhs_ty; |
| 2189 | _ = maybe_inst; | 2189 | _ = maybe_inst; |
| 2190 | 2190 | ||
| 2191 | const mod = self.bin_file.options.module.?; | 2191 | const mod = self.bin_file.comp.module.?; |
| 2192 | switch (lhs_ty.zigTypeTag(mod)) { | 2192 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2193 | .Float => return self.fail("TODO mod on floats", .{}), | 2193 | .Float => return self.fail("TODO mod on floats", .{}), |
| 2194 | .Vector => return self.fail("TODO mod on vectors", .{}), | 2194 | .Vector => return self.fail("TODO mod on vectors", .{}), |
| ... | @@ -2206,7 +2206,7 @@ fn wrappingArithmetic( | ... | @@ -2206,7 +2206,7 @@ fn wrappingArithmetic( |
| 2206 | rhs_ty: Type, | 2206 | rhs_ty: Type, |
| 2207 | maybe_inst: ?Air.Inst.Index, | 2207 | maybe_inst: ?Air.Inst.Index, |
| 2208 | ) InnerError!MCValue { | 2208 | ) InnerError!MCValue { |
| 2209 | const mod = self.bin_file.options.module.?; | 2209 | const mod = self.bin_file.comp.module.?; |
| 2210 | switch (lhs_ty.zigTypeTag(mod)) { | 2210 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2211 | .Vector => return self.fail("TODO binary operations on vectors", .{}), | 2211 | .Vector => return self.fail("TODO binary operations on vectors", .{}), |
| 2212 | .Int => { | 2212 | .Int => { |
| ... | @@ -2241,7 +2241,7 @@ fn bitwise( | ... | @@ -2241,7 +2241,7 @@ fn bitwise( |
| 2241 | rhs_ty: Type, | 2241 | rhs_ty: Type, |
| 2242 | maybe_inst: ?Air.Inst.Index, | 2242 | maybe_inst: ?Air.Inst.Index, |
| 2243 | ) InnerError!MCValue { | 2243 | ) InnerError!MCValue { |
| 2244 | const mod = self.bin_file.options.module.?; | 2244 | const mod = self.bin_file.comp.module.?; |
| 2245 | switch (lhs_ty.zigTypeTag(mod)) { | 2245 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2246 | .Vector => return self.fail("TODO binary operations on vectors", .{}), | 2246 | .Vector => return self.fail("TODO binary operations on vectors", .{}), |
| 2247 | .Int => { | 2247 | .Int => { |
| ... | @@ -2276,7 +2276,7 @@ fn shiftExact( | ... | @@ -2276,7 +2276,7 @@ fn shiftExact( |
| 2276 | ) InnerError!MCValue { | 2276 | ) InnerError!MCValue { |
| 2277 | _ = rhs_ty; | 2277 | _ = rhs_ty; |
| 2278 | 2278 | ||
| 2279 | const mod = self.bin_file.options.module.?; | 2279 | const mod = self.bin_file.comp.module.?; |
| 2280 | switch (lhs_ty.zigTypeTag(mod)) { | 2280 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2281 | .Vector => return self.fail("TODO binary operations on vectors", .{}), | 2281 | .Vector => return self.fail("TODO binary operations on vectors", .{}), |
| 2282 | .Int => { | 2282 | .Int => { |
| ... | @@ -2326,7 +2326,7 @@ fn shiftNormal( | ... | @@ -2326,7 +2326,7 @@ fn shiftNormal( |
| 2326 | rhs_ty: Type, | 2326 | rhs_ty: Type, |
| 2327 | maybe_inst: ?Air.Inst.Index, | 2327 | maybe_inst: ?Air.Inst.Index, |
| 2328 | ) InnerError!MCValue { | 2328 | ) InnerError!MCValue { |
| 2329 | const mod = self.bin_file.options.module.?; | 2329 | const mod = self.bin_file.comp.module.?; |
| 2330 | switch (lhs_ty.zigTypeTag(mod)) { | 2330 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2331 | .Vector => return self.fail("TODO binary operations on vectors", .{}), | 2331 | .Vector => return self.fail("TODO binary operations on vectors", .{}), |
| 2332 | .Int => { | 2332 | .Int => { |
| ... | @@ -2366,7 +2366,7 @@ fn booleanOp( | ... | @@ -2366,7 +2366,7 @@ fn booleanOp( |
| 2366 | rhs_ty: Type, | 2366 | rhs_ty: Type, |
| 2367 | maybe_inst: ?Air.Inst.Index, | 2367 | maybe_inst: ?Air.Inst.Index, |
| 2368 | ) InnerError!MCValue { | 2368 | ) InnerError!MCValue { |
| 2369 | const mod = self.bin_file.options.module.?; | 2369 | const mod = self.bin_file.comp.module.?; |
| 2370 | switch (lhs_ty.zigTypeTag(mod)) { | 2370 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2371 | .Bool => { | 2371 | .Bool => { |
| 2372 | assert((try lhs_bind.resolveToImmediate(self)) == null); // should have been handled by Sema | 2372 | assert((try lhs_bind.resolveToImmediate(self)) == null); // should have been handled by Sema |
| ... | @@ -2393,7 +2393,7 @@ fn ptrArithmetic( | ... | @@ -2393,7 +2393,7 @@ fn ptrArithmetic( |
| 2393 | rhs_ty: Type, | 2393 | rhs_ty: Type, |
| 2394 | maybe_inst: ?Air.Inst.Index, | 2394 | maybe_inst: ?Air.Inst.Index, |
| 2395 | ) InnerError!MCValue { | 2395 | ) InnerError!MCValue { |
| 2396 | const mod = self.bin_file.options.module.?; | 2396 | const mod = self.bin_file.comp.module.?; |
| 2397 | switch (lhs_ty.zigTypeTag(mod)) { | 2397 | switch (lhs_ty.zigTypeTag(mod)) { |
| 2398 | .Pointer => { | 2398 | .Pointer => { |
| 2399 | assert(rhs_ty.eql(Type.usize, mod)); | 2399 | assert(rhs_ty.eql(Type.usize, mod)); |
| ... | @@ -2516,7 +2516,7 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2516,7 +2516,7 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 2516 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | 2516 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; |
| 2517 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 2517 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 2518 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 2518 | 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.?; |
| 2520 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2520 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2521 | const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs }; | 2521 | const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs }; |
| 2522 | const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs }; | 2522 | const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs }; |
| ... | @@ -2644,7 +2644,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2644,7 +2644,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 2644 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 2644 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 2645 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 2645 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2646 | if (self.liveness.isUnused(inst)) return self.finishAir(inst, .dead, .{ extra.lhs, extra.rhs, .none }); | 2646 | 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.?; |
| 2648 | const result: MCValue = result: { | 2648 | const result: MCValue = result: { |
| 2649 | const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs }; | 2649 | const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs }; |
| 2650 | const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs }; | 2650 | const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs }; |
| ... | @@ -2868,7 +2868,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2868,7 +2868,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 2868 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 2868 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 2869 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 2869 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 2870 | if (self.liveness.isUnused(inst)) return self.finishAir(inst, .dead, .{ extra.lhs, extra.rhs, .none }); | 2870 | 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.?; |
| 2872 | const result: MCValue = result: { | 2872 | const result: MCValue = result: { |
| 2873 | const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs }; | 2873 | const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs }; |
| 2874 | const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs }; | 2874 | const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs }; |
| ... | @@ -3016,7 +3016,7 @@ fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3016,7 +3016,7 @@ fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 3016 | } | 3016 | } |
| 3017 | 3017 | ||
| 3018 | fn optionalPayload(self: *Self, inst: Air.Inst.Index, mcv: MCValue, optional_ty: Type) !MCValue { | 3018 | fn 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.?; |
| 3020 | const payload_ty = optional_ty.optionalChild(mod); | 3020 | const payload_ty = optional_ty.optionalChild(mod); |
| 3021 | if (!payload_ty.hasRuntimeBits(mod)) return MCValue.none; | 3021 | if (!payload_ty.hasRuntimeBits(mod)) return MCValue.none; |
| 3022 | if (optional_ty.isPtrLikeOptional(mod)) { | 3022 | if (optional_ty.isPtrLikeOptional(mod)) { |
| ... | @@ -3060,7 +3060,7 @@ fn errUnionErr( | ... | @@ -3060,7 +3060,7 @@ fn errUnionErr( |
| 3060 | error_union_ty: Type, | 3060 | error_union_ty: Type, |
| 3061 | maybe_inst: ?Air.Inst.Index, | 3061 | maybe_inst: ?Air.Inst.Index, |
| 3062 | ) !MCValue { | 3062 | ) !MCValue { |
| 3063 | const mod = self.bin_file.options.module.?; | 3063 | const mod = self.bin_file.comp.module.?; |
| 3064 | const err_ty = error_union_ty.errorUnionSet(mod); | 3064 | const err_ty = error_union_ty.errorUnionSet(mod); |
| 3065 | const payload_ty = error_union_ty.errorUnionPayload(mod); | 3065 | const payload_ty = error_union_ty.errorUnionPayload(mod); |
| 3066 | if (err_ty.errorSetIsEmpty(mod)) { | 3066 | if (err_ty.errorSetIsEmpty(mod)) { |
| ... | @@ -3140,7 +3140,7 @@ fn errUnionPayload( | ... | @@ -3140,7 +3140,7 @@ fn errUnionPayload( |
| 3140 | error_union_ty: Type, | 3140 | error_union_ty: Type, |
| 3141 | maybe_inst: ?Air.Inst.Index, | 3141 | maybe_inst: ?Air.Inst.Index, |
| 3142 | ) !MCValue { | 3142 | ) !MCValue { |
| 3143 | const mod = self.bin_file.options.module.?; | 3143 | const mod = self.bin_file.comp.module.?; |
| 3144 | const err_ty = error_union_ty.errorUnionSet(mod); | 3144 | const err_ty = error_union_ty.errorUnionSet(mod); |
| 3145 | const payload_ty = error_union_ty.errorUnionPayload(mod); | 3145 | const payload_ty = error_union_ty.errorUnionPayload(mod); |
| 3146 | if (err_ty.errorSetIsEmpty(mod)) { | 3146 | if (err_ty.errorSetIsEmpty(mod)) { |
| ... | @@ -3252,7 +3252,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3252,7 +3252,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void { |
| 3252 | } | 3252 | } |
| 3253 | 3253 | ||
| 3254 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { | 3254 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { |
| 3255 | const mod = self.bin_file.options.module.?; | 3255 | const mod = self.bin_file.comp.module.?; |
| 3256 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 3256 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3257 | 3257 | ||
| 3258 | if (self.liveness.isUnused(inst)) { | 3258 | if (self.liveness.isUnused(inst)) { |
| ... | @@ -3297,7 +3297,7 @@ fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3297,7 +3297,7 @@ fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { |
| 3297 | 3297 | ||
| 3298 | /// T to E!T | 3298 | /// T to E!T |
| 3299 | fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { | 3299 | fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 3300 | const mod = self.bin_file.options.module.?; | 3300 | const mod = self.bin_file.comp.module.?; |
| 3301 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 3301 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3302 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 3302 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 3303 | const error_union_ty = ty_op.ty.toType(); | 3303 | const error_union_ty = ty_op.ty.toType(); |
| ... | @@ -3323,7 +3323,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3323,7 +3323,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 3323 | fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { | 3323 | fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { |
| 3324 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 3324 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3325 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 3325 | 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.?; |
| 3327 | const error_union_ty = ty_op.ty.toType(); | 3327 | const error_union_ty = ty_op.ty.toType(); |
| 3328 | const error_ty = error_union_ty.errorUnionSet(mod); | 3328 | const error_ty = error_union_ty.errorUnionSet(mod); |
| 3329 | const payload_ty = error_union_ty.errorUnionPayload(mod); | 3329 | const payload_ty = error_union_ty.errorUnionPayload(mod); |
| ... | @@ -3426,7 +3426,7 @@ fn airPtrSlicePtrPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3426,7 +3426,7 @@ fn airPtrSlicePtrPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 3426 | } | 3426 | } |
| 3427 | 3427 | ||
| 3428 | fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { | 3428 | fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 3429 | const mod = self.bin_file.options.module.?; | 3429 | const mod = self.bin_file.comp.module.?; |
| 3430 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 3430 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 3431 | const slice_ty = self.typeOf(bin_op.lhs); | 3431 | const slice_ty = self.typeOf(bin_op.lhs); |
| 3432 | const result: MCValue = if (!slice_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: { | 3432 | const result: MCValue = if (!slice_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: { |
| ... | @@ -3450,7 +3450,7 @@ fn ptrElemVal( | ... | @@ -3450,7 +3450,7 @@ fn ptrElemVal( |
| 3450 | ptr_ty: Type, | 3450 | ptr_ty: Type, |
| 3451 | maybe_inst: ?Air.Inst.Index, | 3451 | maybe_inst: ?Air.Inst.Index, |
| 3452 | ) !MCValue { | 3452 | ) !MCValue { |
| 3453 | const mod = self.bin_file.options.module.?; | 3453 | const mod = self.bin_file.comp.module.?; |
| 3454 | const elem_ty = ptr_ty.childType(mod); | 3454 | const elem_ty = ptr_ty.childType(mod); |
| 3455 | const elem_size = @as(u32, @intCast(elem_ty.abiSize(mod))); | 3455 | const elem_size = @as(u32, @intCast(elem_ty.abiSize(mod))); |
| 3456 | 3456 | ||
| ... | @@ -3492,7 +3492,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3492,7 +3492,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 3492 | } | 3492 | } |
| 3493 | 3493 | ||
| 3494 | fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { | 3494 | fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 3495 | const mod = self.bin_file.options.module.?; | 3495 | const mod = self.bin_file.comp.module.?; |
| 3496 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 3496 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 3497 | const ptr_ty = self.typeOf(bin_op.lhs); | 3497 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 3498 | const result: MCValue = if (!ptr_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: { | 3498 | const result: MCValue = if (!ptr_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: { |
| ... | @@ -3615,7 +3615,7 @@ fn reuseOperand( | ... | @@ -3615,7 +3615,7 @@ fn reuseOperand( |
| 3615 | } | 3615 | } |
| 3616 | 3616 | ||
| 3617 | fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!void { | 3617 | fn 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.?; |
| 3619 | const elem_ty = ptr_ty.childType(mod); | 3619 | const elem_ty = ptr_ty.childType(mod); |
| 3620 | const elem_size = elem_ty.abiSize(mod); | 3620 | const elem_size = elem_ty.abiSize(mod); |
| 3621 | 3621 | ||
| ... | @@ -3863,7 +3863,7 @@ fn genInlineMemsetCode( | ... | @@ -3863,7 +3863,7 @@ fn genInlineMemsetCode( |
| 3863 | } | 3863 | } |
| 3864 | 3864 | ||
| 3865 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { | 3865 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 3866 | const mod = self.bin_file.options.module.?; | 3866 | const mod = self.bin_file.comp.module.?; |
| 3867 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 3867 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 3868 | const elem_ty = self.typeOfIndex(inst); | 3868 | const elem_ty = self.typeOfIndex(inst); |
| 3869 | const elem_size = elem_ty.abiSize(mod); | 3869 | const elem_size = elem_ty.abiSize(mod); |
| ... | @@ -3894,7 +3894,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3894,7 +3894,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 3894 | } | 3894 | } |
| 3895 | 3895 | ||
| 3896 | fn genLdrRegister(self: *Self, value_reg: Register, addr_reg: Register, ty: Type) !void { | 3896 | fn 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.?; |
| 3898 | const abi_size = ty.abiSize(mod); | 3898 | const abi_size = ty.abiSize(mod); |
| 3899 | 3899 | ||
| 3900 | const tag: Mir.Inst.Tag = switch (abi_size) { | 3900 | const tag: Mir.Inst.Tag = switch (abi_size) { |
| ... | @@ -3917,7 +3917,7 @@ fn genLdrRegister(self: *Self, value_reg: Register, addr_reg: Register, ty: Type | ... | @@ -3917,7 +3917,7 @@ fn genLdrRegister(self: *Self, value_reg: Register, addr_reg: Register, ty: Type |
| 3917 | } | 3917 | } |
| 3918 | 3918 | ||
| 3919 | fn genStrRegister(self: *Self, value_reg: Register, addr_reg: Register, ty: Type) !void { | 3919 | fn 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.?; |
| 3921 | const abi_size = ty.abiSize(mod); | 3921 | const abi_size = ty.abiSize(mod); |
| 3922 | 3922 | ||
| 3923 | const tag: Mir.Inst.Tag = switch (abi_size) { | 3923 | const tag: Mir.Inst.Tag = switch (abi_size) { |
| ... | @@ -3939,7 +3939,7 @@ fn genStrRegister(self: *Self, value_reg: Register, addr_reg: Register, ty: Type | ... | @@ -3939,7 +3939,7 @@ fn genStrRegister(self: *Self, value_reg: Register, addr_reg: Register, ty: Type |
| 3939 | } | 3939 | } |
| 3940 | 3940 | ||
| 3941 | fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type) InnerError!void { | 3941 | fn 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.?; |
| 3943 | log.debug("store: storing {} to {}", .{ value, ptr }); | 3943 | log.debug("store: storing {} to {}", .{ value, ptr }); |
| 3944 | const abi_size = value_ty.abiSize(mod); | 3944 | const abi_size = value_ty.abiSize(mod); |
| 3945 | 3945 | ||
| ... | @@ -4092,7 +4092,7 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void { | ... | @@ -4092,7 +4092,7 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void { |
| 4092 | 4092 | ||
| 4093 | fn structFieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32) !MCValue { | 4093 | fn structFieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32) !MCValue { |
| 4094 | return if (self.liveness.isUnused(inst)) .dead else result: { | 4094 | 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.?; |
| 4096 | const mcv = try self.resolveInst(operand); | 4096 | const mcv = try self.resolveInst(operand); |
| 4097 | const ptr_ty = self.typeOf(operand); | 4097 | const ptr_ty = self.typeOf(operand); |
| 4098 | const struct_ty = ptr_ty.childType(mod); | 4098 | const struct_ty = ptr_ty.childType(mod); |
| ... | @@ -4117,7 +4117,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4117,7 +4117,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { |
| 4117 | const operand = extra.struct_operand; | 4117 | const operand = extra.struct_operand; |
| 4118 | const index = extra.field_index; | 4118 | const index = extra.field_index; |
| 4119 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 4119 | 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.?; |
| 4121 | const mcv = try self.resolveInst(operand); | 4121 | const mcv = try self.resolveInst(operand); |
| 4122 | const struct_ty = self.typeOf(operand); | 4122 | const struct_ty = self.typeOf(operand); |
| 4123 | const struct_field_ty = struct_ty.structFieldType(index, mod); | 4123 | const struct_field_ty = struct_ty.structFieldType(index, mod); |
| ... | @@ -4167,7 +4167,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4167,7 +4167,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { |
| 4167 | } | 4167 | } |
| 4168 | 4168 | ||
| 4169 | fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void { | 4169 | fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 4170 | const mod = self.bin_file.options.module.?; | 4170 | const mod = self.bin_file.comp.module.?; |
| 4171 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 4171 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 4172 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 4172 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 4173 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 4173 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| ... | @@ -4195,7 +4195,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4195,7 +4195,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void { |
| 4195 | while (self.args[arg_index] == .none) arg_index += 1; | 4195 | while (self.args[arg_index] == .none) arg_index += 1; |
| 4196 | self.arg_index = arg_index + 1; | 4196 | self.arg_index = arg_index + 1; |
| 4197 | 4197 | ||
| 4198 | const mod = self.bin_file.options.module.?; | 4198 | const mod = self.bin_file.comp.module.?; |
| 4199 | const ty = self.typeOfIndex(inst); | 4199 | const ty = self.typeOfIndex(inst); |
| 4200 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | 4200 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; |
| 4201 | const src_index = self.air.instructions.items(.data)[@intFromEnum(inst)].arg.src_index; | 4201 | 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 | ... | @@ -4250,7 +4250,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier |
| 4250 | const extra = self.air.extraData(Air.Call, pl_op.payload); | 4250 | const extra = self.air.extraData(Air.Call, pl_op.payload); |
| 4251 | const args = @as([]const Air.Inst.Ref, @ptrCast(self.air.extra[extra.end..][0..extra.data.args_len])); | 4251 | const args = @as([]const Air.Inst.Ref, @ptrCast(self.air.extra[extra.end..][0..extra.data.args_len])); |
| 4252 | const ty = self.typeOf(callee); | 4252 | const ty = self.typeOf(callee); |
| 4253 | const mod = self.bin_file.options.module.?; | 4253 | const mod = self.bin_file.comp.module.?; |
| 4254 | 4254 | ||
| 4255 | const fn_ty = switch (ty.zigTypeTag(mod)) { | 4255 | const fn_ty = switch (ty.zigTypeTag(mod)) { |
| 4256 | .Fn => ty, | 4256 | .Fn => ty, |
| ... | @@ -4422,7 +4422,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier | ... | @@ -4422,7 +4422,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier |
| 4422 | } | 4422 | } |
| 4423 | 4423 | ||
| 4424 | fn airRet(self: *Self, inst: Air.Inst.Index) !void { | 4424 | fn airRet(self: *Self, inst: Air.Inst.Index) !void { |
| 4425 | const mod = self.bin_file.options.module.?; | 4425 | const mod = self.bin_file.comp.module.?; |
| 4426 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 4426 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4427 | const operand = try self.resolveInst(un_op); | 4427 | const operand = try self.resolveInst(un_op); |
| 4428 | const ret_ty = self.fn_type.fnReturnType(mod); | 4428 | const ret_ty = self.fn_type.fnReturnType(mod); |
| ... | @@ -4454,7 +4454,7 @@ fn airRet(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4454,7 +4454,7 @@ fn airRet(self: *Self, inst: Air.Inst.Index) !void { |
| 4454 | } | 4454 | } |
| 4455 | 4455 | ||
| 4456 | fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void { | 4456 | fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 4457 | const mod = self.bin_file.options.module.?; | 4457 | const mod = self.bin_file.comp.module.?; |
| 4458 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 4458 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4459 | const ptr = try self.resolveInst(un_op); | 4459 | const ptr = try self.resolveInst(un_op); |
| 4460 | const ptr_ty = self.typeOf(un_op); | 4460 | const ptr_ty = self.typeOf(un_op); |
| ... | @@ -4514,7 +4514,7 @@ fn cmp( | ... | @@ -4514,7 +4514,7 @@ fn cmp( |
| 4514 | lhs_ty: Type, | 4514 | lhs_ty: Type, |
| 4515 | op: math.CompareOperator, | 4515 | op: math.CompareOperator, |
| 4516 | ) !MCValue { | 4516 | ) !MCValue { |
| 4517 | const mod = self.bin_file.options.module.?; | 4517 | const mod = self.bin_file.comp.module.?; |
| 4518 | const int_ty = switch (lhs_ty.zigTypeTag(mod)) { | 4518 | const int_ty = switch (lhs_ty.zigTypeTag(mod)) { |
| 4519 | .Optional => blk: { | 4519 | .Optional => blk: { |
| 4520 | const payload_ty = lhs_ty.optionalChild(mod); | 4520 | const payload_ty = lhs_ty.optionalChild(mod); |
| ... | @@ -4622,7 +4622,7 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4622,7 +4622,7 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void { |
| 4622 | 4622 | ||
| 4623 | fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void { | 4623 | fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void { |
| 4624 | const ty_fn = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_fn; | 4624 | 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.?; |
| 4626 | const func = mod.funcInfo(ty_fn.func); | 4626 | const func = mod.funcInfo(ty_fn.func); |
| 4627 | // TODO emit debug info for function change | 4627 | // TODO emit debug info for function change |
| 4628 | _ = func; | 4628 | _ = func; |
| ... | @@ -4830,7 +4830,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4830,7 +4830,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { |
| 4830 | } | 4830 | } |
| 4831 | 4831 | ||
| 4832 | fn isNull(self: *Self, operand_bind: ReadArg.Bind, operand_ty: Type) !MCValue { | 4832 | fn 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.?; |
| 4834 | const sentinel: struct { ty: Type, bind: ReadArg.Bind } = if (!operand_ty.isPtrLikeOptional(mod)) blk: { | 4834 | const sentinel: struct { ty: Type, bind: ReadArg.Bind } = if (!operand_ty.isPtrLikeOptional(mod)) blk: { |
| 4835 | const payload_ty = operand_ty.optionalChild(mod); | 4835 | const payload_ty = operand_ty.optionalChild(mod); |
| 4836 | if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) | 4836 | if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) |
| ... | @@ -4886,7 +4886,7 @@ fn isErr( | ... | @@ -4886,7 +4886,7 @@ fn isErr( |
| 4886 | error_union_bind: ReadArg.Bind, | 4886 | error_union_bind: ReadArg.Bind, |
| 4887 | error_union_ty: Type, | 4887 | error_union_ty: Type, |
| 4888 | ) !MCValue { | 4888 | ) !MCValue { |
| 4889 | const mod = self.bin_file.options.module.?; | 4889 | const mod = self.bin_file.comp.module.?; |
| 4890 | const error_type = error_union_ty.errorUnionSet(mod); | 4890 | const error_type = error_union_ty.errorUnionSet(mod); |
| 4891 | 4891 | ||
| 4892 | if (error_type.errorSetIsEmpty(mod)) { | 4892 | if (error_type.errorSetIsEmpty(mod)) { |
| ... | @@ -4928,7 +4928,7 @@ fn airIsNull(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4928,7 +4928,7 @@ fn airIsNull(self: *Self, inst: Air.Inst.Index) !void { |
| 4928 | } | 4928 | } |
| 4929 | 4929 | ||
| 4930 | fn airIsNullPtr(self: *Self, inst: Air.Inst.Index) !void { | 4930 | fn airIsNullPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 4931 | const mod = self.bin_file.options.module.?; | 4931 | const mod = self.bin_file.comp.module.?; |
| 4932 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 4932 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4933 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 4933 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 4934 | const operand_ptr = try self.resolveInst(un_op); | 4934 | const operand_ptr = try self.resolveInst(un_op); |
| ... | @@ -4955,7 +4955,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4955,7 +4955,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void { |
| 4955 | } | 4955 | } |
| 4956 | 4956 | ||
| 4957 | fn airIsNonNullPtr(self: *Self, inst: Air.Inst.Index) !void { | 4957 | fn airIsNonNullPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 4958 | const mod = self.bin_file.options.module.?; | 4958 | const mod = self.bin_file.comp.module.?; |
| 4959 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 4959 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4960 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 4960 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 4961 | const operand_ptr = try self.resolveInst(un_op); | 4961 | const operand_ptr = try self.resolveInst(un_op); |
| ... | @@ -4982,7 +4982,7 @@ fn airIsErr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4982,7 +4982,7 @@ fn airIsErr(self: *Self, inst: Air.Inst.Index) !void { |
| 4982 | } | 4982 | } |
| 4983 | 4983 | ||
| 4984 | fn airIsErrPtr(self: *Self, inst: Air.Inst.Index) !void { | 4984 | fn airIsErrPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 4985 | const mod = self.bin_file.options.module.?; | 4985 | const mod = self.bin_file.comp.module.?; |
| 4986 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 4986 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4987 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 4987 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 4988 | const operand_ptr = try self.resolveInst(un_op); | 4988 | const operand_ptr = try self.resolveInst(un_op); |
| ... | @@ -5009,7 +5009,7 @@ fn airIsNonErr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5009,7 +5009,7 @@ fn airIsNonErr(self: *Self, inst: Air.Inst.Index) !void { |
| 5009 | } | 5009 | } |
| 5010 | 5010 | ||
| 5011 | fn airIsNonErrPtr(self: *Self, inst: Air.Inst.Index) !void { | 5011 | fn airIsNonErrPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 5012 | const mod = self.bin_file.options.module.?; | 5012 | const mod = self.bin_file.comp.module.?; |
| 5013 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 5013 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 5014 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 5014 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 5015 | const operand_ptr = try self.resolveInst(un_op); | 5015 | const operand_ptr = try self.resolveInst(un_op); |
| ... | @@ -5226,7 +5226,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5226,7 +5226,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void { |
| 5226 | } | 5226 | } |
| 5227 | 5227 | ||
| 5228 | fn br(self: *Self, block: Air.Inst.Index, operand: Air.Inst.Ref) !void { | 5228 | fn 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.?; |
| 5230 | const block_data = self.blocks.getPtr(block).?; | 5230 | const block_data = self.blocks.getPtr(block).?; |
| 5231 | 5231 | ||
| 5232 | if (self.typeOf(operand).hasRuntimeBits(mod)) { | 5232 | if (self.typeOf(operand).hasRuntimeBits(mod)) { |
| ... | @@ -5403,7 +5403,7 @@ fn setRegOrMem(self: *Self, ty: Type, loc: MCValue, val: MCValue) !void { | ... | @@ -5403,7 +5403,7 @@ fn setRegOrMem(self: *Self, ty: Type, loc: MCValue, val: MCValue) !void { |
| 5403 | } | 5403 | } |
| 5404 | 5404 | ||
| 5405 | fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void { | 5405 | fn 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.?; |
| 5407 | const abi_size = @as(u32, @intCast(ty.abiSize(mod))); | 5407 | const abi_size = @as(u32, @intCast(ty.abiSize(mod))); |
| 5408 | switch (mcv) { | 5408 | switch (mcv) { |
| 5409 | .dead => unreachable, | 5409 | .dead => unreachable, |
| ... | @@ -5573,7 +5573,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro | ... | @@ -5573,7 +5573,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro |
| 5573 | } | 5573 | } |
| 5574 | 5574 | ||
| 5575 | fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void { | 5575 | fn 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.?; |
| 5577 | switch (mcv) { | 5577 | switch (mcv) { |
| 5578 | .dead => unreachable, | 5578 | .dead => unreachable, |
| 5579 | .unreach, .none => return, // Nothing to do. | 5579 | .unreach, .none => return, // Nothing to do. |
| ... | @@ -5735,7 +5735,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void | ... | @@ -5735,7 +5735,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void |
| 5735 | } | 5735 | } |
| 5736 | 5736 | ||
| 5737 | fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void { | 5737 | fn 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.?; |
| 5739 | const abi_size = @as(u32, @intCast(ty.abiSize(mod))); | 5739 | const abi_size = @as(u32, @intCast(ty.abiSize(mod))); |
| 5740 | switch (mcv) { | 5740 | switch (mcv) { |
| 5741 | .dead => unreachable, | 5741 | .dead => unreachable, |
| ... | @@ -5934,7 +5934,7 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5934,7 +5934,7 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { |
| 5934 | } | 5934 | } |
| 5935 | 5935 | ||
| 5936 | fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { | 5936 | fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { |
| 5937 | const mod = self.bin_file.options.module.?; | 5937 | const mod = self.bin_file.comp.module.?; |
| 5938 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 5938 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5939 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 5939 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 5940 | const ptr_ty = self.typeOf(ty_op.operand); | 5940 | const ptr_ty = self.typeOf(ty_op.operand); |
| ... | @@ -6054,7 +6054,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -6054,7 +6054,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void { |
| 6054 | } | 6054 | } |
| 6055 | 6055 | ||
| 6056 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { | 6056 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
| 6057 | const mod = self.bin_file.options.module.?; | 6057 | const mod = self.bin_file.comp.module.?; |
| 6058 | const vector_ty = self.typeOfIndex(inst); | 6058 | const vector_ty = self.typeOfIndex(inst); |
| 6059 | const len = vector_ty.vectorLen(mod); | 6059 | const len = vector_ty.vectorLen(mod); |
| 6060 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 6060 | 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 { | ... | @@ -6098,7 +6098,7 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void { |
| 6098 | } | 6098 | } |
| 6099 | 6099 | ||
| 6100 | fn airTry(self: *Self, inst: Air.Inst.Index) !void { | 6100 | fn airTry(self: *Self, inst: Air.Inst.Index) !void { |
| 6101 | const mod = self.bin_file.options.module.?; | 6101 | const mod = self.bin_file.comp.module.?; |
| 6102 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | 6102 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; |
| 6103 | const extra = self.air.extraData(Air.Try, pl_op.payload); | 6103 | const extra = self.air.extraData(Air.Try, pl_op.payload); |
| 6104 | const body: []const Air.Inst.Index = @ptrCast(self.air.extra[extra.end..][0..extra.data.body_len]); | 6104 | 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 { | ... | @@ -6135,7 +6135,7 @@ fn airTryPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 6135 | } | 6135 | } |
| 6136 | 6136 | ||
| 6137 | fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue { | 6137 | fn 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.?; |
| 6139 | 6139 | ||
| 6140 | // If the type has no codegen bits, no need to store it. | 6140 | // If the type has no codegen bits, no need to store it. |
| 6141 | const inst_ty = self.typeOf(inst); | 6141 | const inst_ty = self.typeOf(inst); |
| ... | @@ -6200,7 +6200,7 @@ const CallMCValues = struct { | ... | @@ -6200,7 +6200,7 @@ const CallMCValues = struct { |
| 6200 | 6200 | ||
| 6201 | /// Caller must call `CallMCValues.deinit`. | 6201 | /// Caller must call `CallMCValues.deinit`. |
| 6202 | fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues { | 6202 | fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues { |
| 6203 | const mod = self.bin_file.options.module.?; | 6203 | const mod = self.bin_file.comp.module.?; |
| 6204 | const ip = &mod.intern_pool; | 6204 | const ip = &mod.intern_pool; |
| 6205 | const fn_info = mod.typeToFunc(fn_ty).?; | 6205 | const fn_info = mod.typeToFunc(fn_ty).?; |
| 6206 | const cc = fn_info.cc; | 6206 | const cc = fn_info.cc; |
| ... | @@ -6363,7 +6363,7 @@ fn parseRegName(name: []const u8) ?Register { | ... | @@ -6363,7 +6363,7 @@ fn parseRegName(name: []const u8) ?Register { |
| 6363 | } | 6363 | } |
| 6364 | 6364 | ||
| 6365 | fn registerAlias(self: *Self, reg: Register, ty: Type) Register { | 6365 | fn registerAlias(self: *Self, reg: Register, ty: Type) Register { |
| 6366 | const mod = self.bin_file.options.module.?; | 6366 | const mod = self.bin_file.comp.module.?; |
| 6367 | const abi_size = ty.abiSize(mod); | 6367 | const abi_size = ty.abiSize(mod); |
| 6368 | 6368 | ||
| 6369 | switch (reg.class()) { | 6369 | switch (reg.class()) { |
| ... | @@ -6392,11 +6392,11 @@ fn registerAlias(self: *Self, reg: Register, ty: Type) Register { | ... | @@ -6392,11 +6392,11 @@ fn registerAlias(self: *Self, reg: Register, ty: Type) Register { |
| 6392 | } | 6392 | } |
| 6393 | 6393 | ||
| 6394 | fn typeOf(self: *Self, inst: Air.Inst.Ref) Type { | 6394 | fn typeOf(self: *Self, inst: Air.Inst.Ref) Type { |
| 6395 | const mod = self.bin_file.options.module.?; | 6395 | const mod = self.bin_file.comp.module.?; |
| 6396 | return self.air.typeOf(inst, &mod.intern_pool); | 6396 | return self.air.typeOf(inst, &mod.intern_pool); |
| 6397 | } | 6397 | } |
| 6398 | 6398 | ||
| 6399 | fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type { | 6399 | fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type { |
| 6400 | const mod = self.bin_file.options.module.?; | 6400 | const mod = self.bin_file.comp.module.?; |
| 6401 | return self.air.typeOfIndex(inst, &mod.intern_pool); | 6401 | return self.air.typeOfIndex(inst, &mod.intern_pool); |
| 6402 | } | 6402 | } |
src/arch/arm/CodeGen.zig+70-70| ... | @@ -260,7 +260,7 @@ const DbgInfoReloc = struct { | ... | @@ -260,7 +260,7 @@ const DbgInfoReloc = struct { |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | fn genArgDbgInfo(reloc: DbgInfoReloc, function: Self) error{OutOfMemory}!void { | 262 | 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.?; |
| 264 | switch (function.debug_output) { | 264 | switch (function.debug_output) { |
| 265 | .dwarf => |dw| { | 265 | .dwarf => |dw| { |
| 266 | const loc: link.File.Dwarf.DeclState.DbgInfoLoc = switch (reloc.mcv) { | 266 | const loc: link.File.Dwarf.DeclState.DbgInfoLoc = switch (reloc.mcv) { |
| ... | @@ -289,7 +289,7 @@ const DbgInfoReloc = struct { | ... | @@ -289,7 +289,7 @@ const DbgInfoReloc = struct { |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | fn genVarDbgInfo(reloc: DbgInfoReloc, function: Self) !void { | 291 | fn genVarDbgInfo(reloc: DbgInfoReloc, function: Self) !void { |
| 292 | const mod = function.bin_file.options.module.?; | 292 | const mod = function.bin_file.comp.module.?; |
| 293 | const is_ptr = switch (reloc.tag) { | 293 | const is_ptr = switch (reloc.tag) { |
| 294 | .dbg_var_ptr => true, | 294 | .dbg_var_ptr => true, |
| 295 | .dbg_var_val => false, | 295 | .dbg_var_val => false, |
| ... | @@ -348,7 +348,7 @@ pub fn generate( | ... | @@ -348,7 +348,7 @@ pub fn generate( |
| 348 | @panic("Attempted to compile for architecture that was disabled by build configuration"); | 348 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | const mod = bin_file.options.module.?; | 351 | const mod = bin_file.comp.module.?; |
| 352 | const func = mod.funcInfo(func_index); | 352 | const func = mod.funcInfo(func_index); |
| 353 | const fn_owner_decl = mod.declPtr(func.owner_decl); | 353 | const fn_owner_decl = mod.declPtr(func.owner_decl); |
| 354 | assert(fn_owner_decl.has_tv); | 354 | assert(fn_owner_decl.has_tv); |
| ... | @@ -482,7 +482,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 { | ... | @@ -482,7 +482,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 { |
| 482 | } | 482 | } |
| 483 | 483 | ||
| 484 | fn gen(self: *Self) !void { | 484 | fn gen(self: *Self) !void { |
| 485 | const mod = self.bin_file.options.module.?; | 485 | const mod = self.bin_file.comp.module.?; |
| 486 | const cc = self.fn_type.fnCallingConvention(mod); | 486 | const cc = self.fn_type.fnCallingConvention(mod); |
| 487 | if (cc != .Naked) { | 487 | if (cc != .Naked) { |
| 488 | // push {fp, lr} | 488 | // push {fp, lr} |
| ... | @@ -642,7 +642,7 @@ fn gen(self: *Self) !void { | ... | @@ -642,7 +642,7 @@ fn gen(self: *Self) !void { |
| 642 | } | 642 | } |
| 643 | 643 | ||
| 644 | fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { | 644 | fn 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.?; |
| 646 | const ip = &mod.intern_pool; | 646 | const ip = &mod.intern_pool; |
| 647 | const air_tags = self.air.instructions.items(.tag); | 647 | const air_tags = self.air.instructions.items(.tag); |
| 648 | 648 | ||
| ... | @@ -1010,7 +1010,7 @@ fn allocMem( | ... | @@ -1010,7 +1010,7 @@ fn allocMem( |
| 1010 | 1010 | ||
| 1011 | /// Use a pointer instruction as the basis for allocating stack memory. | 1011 | /// Use a pointer instruction as the basis for allocating stack memory. |
| 1012 | fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { | 1012 | fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { |
| 1013 | const mod = self.bin_file.options.module.?; | 1013 | const mod = self.bin_file.comp.module.?; |
| 1014 | const elem_ty = self.typeOfIndex(inst).childType(mod); | 1014 | const elem_ty = self.typeOfIndex(inst).childType(mod); |
| 1015 | 1015 | ||
| 1016 | if (!elem_ty.hasRuntimeBits(mod)) { | 1016 | if (!elem_ty.hasRuntimeBits(mod)) { |
| ... | @@ -1031,7 +1031,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { | ... | @@ -1031,7 +1031,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { |
| 1031 | } | 1031 | } |
| 1032 | 1032 | ||
| 1033 | fn allocRegOrMem(self: *Self, elem_ty: Type, reg_ok: bool, maybe_inst: ?Air.Inst.Index) !MCValue { | 1033 | fn 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.?; |
| 1035 | const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse { | 1035 | const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse { |
| 1036 | return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)}); | 1036 | return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)}); |
| 1037 | }; | 1037 | }; |
| ... | @@ -1118,7 +1118,7 @@ fn airAlloc(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1118,7 +1118,7 @@ fn airAlloc(self: *Self, inst: Air.Inst.Index) !void { |
| 1118 | } | 1118 | } |
| 1119 | 1119 | ||
| 1120 | fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void { | 1120 | fn airRetPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 1121 | const mod = self.bin_file.options.module.?; | 1121 | const mod = self.bin_file.comp.module.?; |
| 1122 | const result: MCValue = switch (self.ret_mcv) { | 1122 | const result: MCValue = switch (self.ret_mcv) { |
| 1123 | .none, .register => .{ .ptr_stack_offset = try self.allocMemPtr(inst) }, | 1123 | .none, .register => .{ .ptr_stack_offset = try self.allocMemPtr(inst) }, |
| 1124 | .stack_offset => blk: { | 1124 | .stack_offset => blk: { |
| ... | @@ -1151,7 +1151,7 @@ fn airFpext(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1151,7 +1151,7 @@ fn airFpext(self: *Self, inst: Air.Inst.Index) !void { |
| 1151 | } | 1151 | } |
| 1152 | 1152 | ||
| 1153 | fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { | 1153 | fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { |
| 1154 | const mod = self.bin_file.options.module.?; | 1154 | const mod = self.bin_file.comp.module.?; |
| 1155 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 1155 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 1156 | if (self.liveness.isUnused(inst)) | 1156 | if (self.liveness.isUnused(inst)) |
| 1157 | return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none }); | 1157 | return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none }); |
| ... | @@ -1217,7 +1217,7 @@ fn trunc( | ... | @@ -1217,7 +1217,7 @@ fn trunc( |
| 1217 | operand_ty: Type, | 1217 | operand_ty: Type, |
| 1218 | dest_ty: Type, | 1218 | dest_ty: Type, |
| 1219 | ) !MCValue { | 1219 | ) !MCValue { |
| 1220 | const mod = self.bin_file.options.module.?; | 1220 | const mod = self.bin_file.comp.module.?; |
| 1221 | const info_a = operand_ty.intInfo(mod); | 1221 | const info_a = operand_ty.intInfo(mod); |
| 1222 | const info_b = dest_ty.intInfo(mod); | 1222 | const info_b = dest_ty.intInfo(mod); |
| 1223 | 1223 | ||
| ... | @@ -1281,7 +1281,7 @@ fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1281,7 +1281,7 @@ fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void { |
| 1281 | 1281 | ||
| 1282 | fn airNot(self: *Self, inst: Air.Inst.Index) !void { | 1282 | fn airNot(self: *Self, inst: Air.Inst.Index) !void { |
| 1283 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 1283 | 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.?; |
| 1285 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 1285 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1286 | const operand_bind: ReadArg.Bind = .{ .inst = ty_op.operand }; | 1286 | const operand_bind: ReadArg.Bind = .{ .inst = ty_op.operand }; |
| 1287 | const operand_ty = self.typeOf(ty_op.operand); | 1287 | const operand_ty = self.typeOf(ty_op.operand); |
| ... | @@ -1377,7 +1377,7 @@ fn minMax( | ... | @@ -1377,7 +1377,7 @@ fn minMax( |
| 1377 | rhs_ty: Type, | 1377 | rhs_ty: Type, |
| 1378 | maybe_inst: ?Air.Inst.Index, | 1378 | maybe_inst: ?Air.Inst.Index, |
| 1379 | ) !MCValue { | 1379 | ) !MCValue { |
| 1380 | const mod = self.bin_file.options.module.?; | 1380 | const mod = self.bin_file.comp.module.?; |
| 1381 | switch (lhs_ty.zigTypeTag(mod)) { | 1381 | switch (lhs_ty.zigTypeTag(mod)) { |
| 1382 | .Float => return self.fail("TODO ARM min/max on floats", .{}), | 1382 | .Float => return self.fail("TODO ARM min/max on floats", .{}), |
| 1383 | .Vector => return self.fail("TODO ARM min/max on vectors", .{}), | 1383 | .Vector => return self.fail("TODO ARM min/max on vectors", .{}), |
| ... | @@ -1586,7 +1586,7 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1586,7 +1586,7 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 1586 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | 1586 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; |
| 1587 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 1587 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 1588 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 1588 | 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.?; |
| 1590 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 1590 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1591 | const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs }; | 1591 | const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs }; |
| 1592 | const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs }; | 1592 | const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs }; |
| ... | @@ -1699,7 +1699,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1699,7 +1699,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 1699 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 1699 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 1700 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 1700 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 1701 | if (self.liveness.isUnused(inst)) return self.finishAir(inst, .dead, .{ extra.lhs, extra.rhs, .none }); | 1701 | 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.?; |
| 1703 | const result: MCValue = result: { | 1703 | const result: MCValue = result: { |
| 1704 | const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs }; | 1704 | const lhs_bind: ReadArg.Bind = .{ .inst = extra.lhs }; |
| 1705 | const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs }; | 1705 | const rhs_bind: ReadArg.Bind = .{ .inst = extra.rhs }; |
| ... | @@ -1863,7 +1863,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1863,7 +1863,7 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 1863 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 1863 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 1864 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 1864 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 1865 | if (self.liveness.isUnused(inst)) return self.finishAir(inst, .dead, .{ extra.lhs, extra.rhs, .none }); | 1865 | 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.?; |
| 1867 | const result: MCValue = result: { | 1867 | const result: MCValue = result: { |
| 1868 | const lhs_ty = self.typeOf(extra.lhs); | 1868 | const lhs_ty = self.typeOf(extra.lhs); |
| 1869 | const rhs_ty = self.typeOf(extra.rhs); | 1869 | const rhs_ty = self.typeOf(extra.rhs); |
| ... | @@ -2019,7 +2019,7 @@ fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2019,7 +2019,7 @@ fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { |
| 2019 | } | 2019 | } |
| 2020 | 2020 | ||
| 2021 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { | 2021 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { |
| 2022 | const mod = self.bin_file.options.module.?; | 2022 | const mod = self.bin_file.comp.module.?; |
| 2023 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 2023 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2024 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2024 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2025 | const optional_ty = self.typeOfIndex(inst); | 2025 | const optional_ty = self.typeOfIndex(inst); |
| ... | @@ -2042,7 +2042,7 @@ fn errUnionErr( | ... | @@ -2042,7 +2042,7 @@ fn errUnionErr( |
| 2042 | error_union_ty: Type, | 2042 | error_union_ty: Type, |
| 2043 | maybe_inst: ?Air.Inst.Index, | 2043 | maybe_inst: ?Air.Inst.Index, |
| 2044 | ) !MCValue { | 2044 | ) !MCValue { |
| 2045 | const mod = self.bin_file.options.module.?; | 2045 | const mod = self.bin_file.comp.module.?; |
| 2046 | const err_ty = error_union_ty.errorUnionSet(mod); | 2046 | const err_ty = error_union_ty.errorUnionSet(mod); |
| 2047 | const payload_ty = error_union_ty.errorUnionPayload(mod); | 2047 | const payload_ty = error_union_ty.errorUnionPayload(mod); |
| 2048 | if (err_ty.errorSetIsEmpty(mod)) { | 2048 | if (err_ty.errorSetIsEmpty(mod)) { |
| ... | @@ -2119,7 +2119,7 @@ fn errUnionPayload( | ... | @@ -2119,7 +2119,7 @@ fn errUnionPayload( |
| 2119 | error_union_ty: Type, | 2119 | error_union_ty: Type, |
| 2120 | maybe_inst: ?Air.Inst.Index, | 2120 | maybe_inst: ?Air.Inst.Index, |
| 2121 | ) !MCValue { | 2121 | ) !MCValue { |
| 2122 | const mod = self.bin_file.options.module.?; | 2122 | const mod = self.bin_file.comp.module.?; |
| 2123 | const err_ty = error_union_ty.errorUnionSet(mod); | 2123 | const err_ty = error_union_ty.errorUnionSet(mod); |
| 2124 | const payload_ty = error_union_ty.errorUnionPayload(mod); | 2124 | const payload_ty = error_union_ty.errorUnionPayload(mod); |
| 2125 | if (err_ty.errorSetIsEmpty(mod)) { | 2125 | if (err_ty.errorSetIsEmpty(mod)) { |
| ... | @@ -2229,7 +2229,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2229,7 +2229,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void { |
| 2229 | 2229 | ||
| 2230 | /// T to E!T | 2230 | /// T to E!T |
| 2231 | fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { | 2231 | fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 2232 | const mod = self.bin_file.options.module.?; | 2232 | const mod = self.bin_file.comp.module.?; |
| 2233 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 2233 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2234 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2234 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2235 | const error_union_ty = ty_op.ty.toType(); | 2235 | const error_union_ty = ty_op.ty.toType(); |
| ... | @@ -2253,7 +2253,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2253,7 +2253,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 2253 | 2253 | ||
| 2254 | /// E to E!T | 2254 | /// E to E!T |
| 2255 | fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { | 2255 | fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2256 | const mod = self.bin_file.options.module.?; | 2256 | const mod = self.bin_file.comp.module.?; |
| 2257 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 2257 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2258 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2258 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2259 | const error_union_ty = ty_op.ty.toType(); | 2259 | const error_union_ty = ty_op.ty.toType(); |
| ... | @@ -2370,7 +2370,7 @@ fn ptrElemVal( | ... | @@ -2370,7 +2370,7 @@ fn ptrElemVal( |
| 2370 | ptr_ty: Type, | 2370 | ptr_ty: Type, |
| 2371 | maybe_inst: ?Air.Inst.Index, | 2371 | maybe_inst: ?Air.Inst.Index, |
| 2372 | ) !MCValue { | 2372 | ) !MCValue { |
| 2373 | const mod = self.bin_file.options.module.?; | 2373 | const mod = self.bin_file.comp.module.?; |
| 2374 | const elem_ty = ptr_ty.childType(mod); | 2374 | const elem_ty = ptr_ty.childType(mod); |
| 2375 | const elem_size: u32 = @intCast(elem_ty.abiSize(mod)); | 2375 | const elem_size: u32 = @intCast(elem_ty.abiSize(mod)); |
| 2376 | 2376 | ||
| ... | @@ -2429,7 +2429,7 @@ fn ptrElemVal( | ... | @@ -2429,7 +2429,7 @@ fn ptrElemVal( |
| 2429 | } | 2429 | } |
| 2430 | 2430 | ||
| 2431 | fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { | 2431 | fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2432 | const mod = self.bin_file.options.module.?; | 2432 | const mod = self.bin_file.comp.module.?; |
| 2433 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 2433 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 2434 | const slice_ty = self.typeOf(bin_op.lhs); | 2434 | const slice_ty = self.typeOf(bin_op.lhs); |
| 2435 | const result: MCValue = if (!slice_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: { | 2435 | const result: MCValue = if (!slice_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: { |
| ... | @@ -2472,7 +2472,7 @@ fn arrayElemVal( | ... | @@ -2472,7 +2472,7 @@ fn arrayElemVal( |
| 2472 | array_ty: Type, | 2472 | array_ty: Type, |
| 2473 | maybe_inst: ?Air.Inst.Index, | 2473 | maybe_inst: ?Air.Inst.Index, |
| 2474 | ) InnerError!MCValue { | 2474 | ) InnerError!MCValue { |
| 2475 | const mod = self.bin_file.options.module.?; | 2475 | const mod = self.bin_file.comp.module.?; |
| 2476 | const elem_ty = array_ty.childType(mod); | 2476 | const elem_ty = array_ty.childType(mod); |
| 2477 | 2477 | ||
| 2478 | const mcv = try array_bind.resolveToMcv(self); | 2478 | const mcv = try array_bind.resolveToMcv(self); |
| ... | @@ -2528,7 +2528,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2528,7 +2528,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2528 | } | 2528 | } |
| 2529 | 2529 | ||
| 2530 | fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { | 2530 | fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2531 | const mod = self.bin_file.options.module.?; | 2531 | const mod = self.bin_file.comp.module.?; |
| 2532 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 2532 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 2533 | const ptr_ty = self.typeOf(bin_op.lhs); | 2533 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 2534 | const result: MCValue = if (!ptr_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: { | 2534 | const result: MCValue = if (!ptr_ty.isVolatilePtr(mod) and self.liveness.isUnused(inst)) .dead else result: { |
| ... | @@ -2662,7 +2662,7 @@ fn reuseOperand( | ... | @@ -2662,7 +2662,7 @@ fn reuseOperand( |
| 2662 | } | 2662 | } |
| 2663 | 2663 | ||
| 2664 | fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!void { | 2664 | fn 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.?; |
| 2666 | const elem_ty = ptr_ty.childType(mod); | 2666 | const elem_ty = ptr_ty.childType(mod); |
| 2667 | const elem_size: u32 = @intCast(elem_ty.abiSize(mod)); | 2667 | const elem_size: u32 = @intCast(elem_ty.abiSize(mod)); |
| 2668 | 2668 | ||
| ... | @@ -2739,7 +2739,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!vo | ... | @@ -2739,7 +2739,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!vo |
| 2739 | } | 2739 | } |
| 2740 | 2740 | ||
| 2741 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { | 2741 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 2742 | const mod = self.bin_file.options.module.?; | 2742 | const mod = self.bin_file.comp.module.?; |
| 2743 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 2743 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2744 | const elem_ty = self.typeOfIndex(inst); | 2744 | const elem_ty = self.typeOfIndex(inst); |
| 2745 | const result: MCValue = result: { | 2745 | const result: MCValue = result: { |
| ... | @@ -2768,7 +2768,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2768,7 +2768,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 2768 | } | 2768 | } |
| 2769 | 2769 | ||
| 2770 | fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type) InnerError!void { | 2770 | fn 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.?; |
| 2772 | const elem_size: u32 = @intCast(value_ty.abiSize(mod)); | 2772 | const elem_size: u32 = @intCast(value_ty.abiSize(mod)); |
| 2773 | 2773 | ||
| 2774 | switch (ptr) { | 2774 | switch (ptr) { |
| ... | @@ -2888,7 +2888,7 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void { | ... | @@ -2888,7 +2888,7 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void { |
| 2888 | 2888 | ||
| 2889 | fn structFieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32) !MCValue { | 2889 | fn structFieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32) !MCValue { |
| 2890 | return if (self.liveness.isUnused(inst)) .dead else result: { | 2890 | 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.?; |
| 2892 | const mcv = try self.resolveInst(operand); | 2892 | const mcv = try self.resolveInst(operand); |
| 2893 | const ptr_ty = self.typeOf(operand); | 2893 | const ptr_ty = self.typeOf(operand); |
| 2894 | const struct_ty = ptr_ty.childType(mod); | 2894 | const struct_ty = ptr_ty.childType(mod); |
| ... | @@ -2912,7 +2912,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2912,7 +2912,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2912 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; | 2912 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 2913 | const operand = extra.struct_operand; | 2913 | const operand = extra.struct_operand; |
| 2914 | const index = extra.field_index; | 2914 | const index = extra.field_index; |
| 2915 | const mod = self.bin_file.options.module.?; | 2915 | const mod = self.bin_file.comp.module.?; |
| 2916 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2916 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2917 | const mcv = try self.resolveInst(operand); | 2917 | const mcv = try self.resolveInst(operand); |
| 2918 | const struct_ty = self.typeOf(operand); | 2918 | const struct_ty = self.typeOf(operand); |
| ... | @@ -3002,7 +3002,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3002,7 +3002,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { |
| 3002 | } | 3002 | } |
| 3003 | 3003 | ||
| 3004 | fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void { | 3004 | fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 3005 | const mod = self.bin_file.options.module.?; | 3005 | const mod = self.bin_file.comp.module.?; |
| 3006 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 3006 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 3007 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 3007 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 3008 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 3008 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| ... | @@ -3396,7 +3396,7 @@ fn addSub( | ... | @@ -3396,7 +3396,7 @@ fn addSub( |
| 3396 | rhs_ty: Type, | 3396 | rhs_ty: Type, |
| 3397 | maybe_inst: ?Air.Inst.Index, | 3397 | maybe_inst: ?Air.Inst.Index, |
| 3398 | ) InnerError!MCValue { | 3398 | ) InnerError!MCValue { |
| 3399 | const mod = self.bin_file.options.module.?; | 3399 | const mod = self.bin_file.comp.module.?; |
| 3400 | switch (lhs_ty.zigTypeTag(mod)) { | 3400 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3401 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), | 3401 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), |
| 3402 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3402 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| ... | @@ -3452,7 +3452,7 @@ fn mul( | ... | @@ -3452,7 +3452,7 @@ fn mul( |
| 3452 | rhs_ty: Type, | 3452 | rhs_ty: Type, |
| 3453 | maybe_inst: ?Air.Inst.Index, | 3453 | maybe_inst: ?Air.Inst.Index, |
| 3454 | ) InnerError!MCValue { | 3454 | ) InnerError!MCValue { |
| 3455 | const mod = self.bin_file.options.module.?; | 3455 | const mod = self.bin_file.comp.module.?; |
| 3456 | switch (lhs_ty.zigTypeTag(mod)) { | 3456 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3457 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), | 3457 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), |
| 3458 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3458 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| ... | @@ -3485,7 +3485,7 @@ fn divFloat( | ... | @@ -3485,7 +3485,7 @@ fn divFloat( |
| 3485 | _ = rhs_ty; | 3485 | _ = rhs_ty; |
| 3486 | _ = maybe_inst; | 3486 | _ = maybe_inst; |
| 3487 | 3487 | ||
| 3488 | const mod = self.bin_file.options.module.?; | 3488 | const mod = self.bin_file.comp.module.?; |
| 3489 | switch (lhs_ty.zigTypeTag(mod)) { | 3489 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3490 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), | 3490 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), |
| 3491 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3491 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| ... | @@ -3501,7 +3501,7 @@ fn divTrunc( | ... | @@ -3501,7 +3501,7 @@ fn divTrunc( |
| 3501 | rhs_ty: Type, | 3501 | rhs_ty: Type, |
| 3502 | maybe_inst: ?Air.Inst.Index, | 3502 | maybe_inst: ?Air.Inst.Index, |
| 3503 | ) InnerError!MCValue { | 3503 | ) InnerError!MCValue { |
| 3504 | const mod = self.bin_file.options.module.?; | 3504 | const mod = self.bin_file.comp.module.?; |
| 3505 | switch (lhs_ty.zigTypeTag(mod)) { | 3505 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3506 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), | 3506 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), |
| 3507 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3507 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| ... | @@ -3544,7 +3544,7 @@ fn divFloor( | ... | @@ -3544,7 +3544,7 @@ fn divFloor( |
| 3544 | rhs_ty: Type, | 3544 | rhs_ty: Type, |
| 3545 | maybe_inst: ?Air.Inst.Index, | 3545 | maybe_inst: ?Air.Inst.Index, |
| 3546 | ) InnerError!MCValue { | 3546 | ) InnerError!MCValue { |
| 3547 | const mod = self.bin_file.options.module.?; | 3547 | const mod = self.bin_file.comp.module.?; |
| 3548 | switch (lhs_ty.zigTypeTag(mod)) { | 3548 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3549 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), | 3549 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), |
| 3550 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3550 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| ... | @@ -3592,7 +3592,7 @@ fn divExact( | ... | @@ -3592,7 +3592,7 @@ fn divExact( |
| 3592 | _ = rhs_ty; | 3592 | _ = rhs_ty; |
| 3593 | _ = maybe_inst; | 3593 | _ = maybe_inst; |
| 3594 | 3594 | ||
| 3595 | const mod = self.bin_file.options.module.?; | 3595 | const mod = self.bin_file.comp.module.?; |
| 3596 | switch (lhs_ty.zigTypeTag(mod)) { | 3596 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3597 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), | 3597 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), |
| 3598 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3598 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| ... | @@ -3609,7 +3609,7 @@ fn rem( | ... | @@ -3609,7 +3609,7 @@ fn rem( |
| 3609 | rhs_ty: Type, | 3609 | rhs_ty: Type, |
| 3610 | maybe_inst: ?Air.Inst.Index, | 3610 | maybe_inst: ?Air.Inst.Index, |
| 3611 | ) InnerError!MCValue { | 3611 | ) InnerError!MCValue { |
| 3612 | const mod = self.bin_file.options.module.?; | 3612 | const mod = self.bin_file.comp.module.?; |
| 3613 | switch (lhs_ty.zigTypeTag(mod)) { | 3613 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3614 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), | 3614 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), |
| 3615 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3615 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| ... | @@ -3678,7 +3678,7 @@ fn modulo( | ... | @@ -3678,7 +3678,7 @@ fn modulo( |
| 3678 | _ = rhs_ty; | 3678 | _ = rhs_ty; |
| 3679 | _ = maybe_inst; | 3679 | _ = maybe_inst; |
| 3680 | 3680 | ||
| 3681 | const mod = self.bin_file.options.module.?; | 3681 | const mod = self.bin_file.comp.module.?; |
| 3682 | switch (lhs_ty.zigTypeTag(mod)) { | 3682 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3683 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), | 3683 | .Float => return self.fail("TODO ARM binary operations on floats", .{}), |
| 3684 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3684 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| ... | @@ -3696,7 +3696,7 @@ fn wrappingArithmetic( | ... | @@ -3696,7 +3696,7 @@ fn wrappingArithmetic( |
| 3696 | rhs_ty: Type, | 3696 | rhs_ty: Type, |
| 3697 | maybe_inst: ?Air.Inst.Index, | 3697 | maybe_inst: ?Air.Inst.Index, |
| 3698 | ) InnerError!MCValue { | 3698 | ) InnerError!MCValue { |
| 3699 | const mod = self.bin_file.options.module.?; | 3699 | const mod = self.bin_file.comp.module.?; |
| 3700 | switch (lhs_ty.zigTypeTag(mod)) { | 3700 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3701 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3701 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| 3702 | .Int => { | 3702 | .Int => { |
| ... | @@ -3734,7 +3734,7 @@ fn bitwise( | ... | @@ -3734,7 +3734,7 @@ fn bitwise( |
| 3734 | rhs_ty: Type, | 3734 | rhs_ty: Type, |
| 3735 | maybe_inst: ?Air.Inst.Index, | 3735 | maybe_inst: ?Air.Inst.Index, |
| 3736 | ) InnerError!MCValue { | 3736 | ) InnerError!MCValue { |
| 3737 | const mod = self.bin_file.options.module.?; | 3737 | const mod = self.bin_file.comp.module.?; |
| 3738 | switch (lhs_ty.zigTypeTag(mod)) { | 3738 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3739 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3739 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| 3740 | .Int => { | 3740 | .Int => { |
| ... | @@ -3779,7 +3779,7 @@ fn shiftExact( | ... | @@ -3779,7 +3779,7 @@ fn shiftExact( |
| 3779 | rhs_ty: Type, | 3779 | rhs_ty: Type, |
| 3780 | maybe_inst: ?Air.Inst.Index, | 3780 | maybe_inst: ?Air.Inst.Index, |
| 3781 | ) InnerError!MCValue { | 3781 | ) InnerError!MCValue { |
| 3782 | const mod = self.bin_file.options.module.?; | 3782 | const mod = self.bin_file.comp.module.?; |
| 3783 | switch (lhs_ty.zigTypeTag(mod)) { | 3783 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3784 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3784 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| 3785 | .Int => { | 3785 | .Int => { |
| ... | @@ -3818,7 +3818,7 @@ fn shiftNormal( | ... | @@ -3818,7 +3818,7 @@ fn shiftNormal( |
| 3818 | rhs_ty: Type, | 3818 | rhs_ty: Type, |
| 3819 | maybe_inst: ?Air.Inst.Index, | 3819 | maybe_inst: ?Air.Inst.Index, |
| 3820 | ) InnerError!MCValue { | 3820 | ) InnerError!MCValue { |
| 3821 | const mod = self.bin_file.options.module.?; | 3821 | const mod = self.bin_file.comp.module.?; |
| 3822 | switch (lhs_ty.zigTypeTag(mod)) { | 3822 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3823 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), | 3823 | .Vector => return self.fail("TODO ARM binary operations on vectors", .{}), |
| 3824 | .Int => { | 3824 | .Int => { |
| ... | @@ -3861,7 +3861,7 @@ fn booleanOp( | ... | @@ -3861,7 +3861,7 @@ fn booleanOp( |
| 3861 | rhs_ty: Type, | 3861 | rhs_ty: Type, |
| 3862 | maybe_inst: ?Air.Inst.Index, | 3862 | maybe_inst: ?Air.Inst.Index, |
| 3863 | ) InnerError!MCValue { | 3863 | ) InnerError!MCValue { |
| 3864 | const mod = self.bin_file.options.module.?; | 3864 | const mod = self.bin_file.comp.module.?; |
| 3865 | switch (lhs_ty.zigTypeTag(mod)) { | 3865 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3866 | .Bool => { | 3866 | .Bool => { |
| 3867 | const lhs_immediate = try lhs_bind.resolveToImmediate(self); | 3867 | const lhs_immediate = try lhs_bind.resolveToImmediate(self); |
| ... | @@ -3895,7 +3895,7 @@ fn ptrArithmetic( | ... | @@ -3895,7 +3895,7 @@ fn ptrArithmetic( |
| 3895 | rhs_ty: Type, | 3895 | rhs_ty: Type, |
| 3896 | maybe_inst: ?Air.Inst.Index, | 3896 | maybe_inst: ?Air.Inst.Index, |
| 3897 | ) InnerError!MCValue { | 3897 | ) InnerError!MCValue { |
| 3898 | const mod = self.bin_file.options.module.?; | 3898 | const mod = self.bin_file.comp.module.?; |
| 3899 | switch (lhs_ty.zigTypeTag(mod)) { | 3899 | switch (lhs_ty.zigTypeTag(mod)) { |
| 3900 | .Pointer => { | 3900 | .Pointer => { |
| 3901 | assert(rhs_ty.eql(Type.usize, mod)); | 3901 | assert(rhs_ty.eql(Type.usize, mod)); |
| ... | @@ -3932,7 +3932,7 @@ fn ptrArithmetic( | ... | @@ -3932,7 +3932,7 @@ fn ptrArithmetic( |
| 3932 | } | 3932 | } |
| 3933 | 3933 | ||
| 3934 | fn genLdrRegister(self: *Self, dest_reg: Register, addr_reg: Register, ty: Type) !void { | 3934 | fn 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.?; |
| 3936 | const abi_size = ty.abiSize(mod); | 3936 | const abi_size = ty.abiSize(mod); |
| 3937 | 3937 | ||
| 3938 | const tag: Mir.Inst.Tag = switch (abi_size) { | 3938 | const tag: Mir.Inst.Tag = switch (abi_size) { |
| ... | @@ -3967,7 +3967,7 @@ fn genLdrRegister(self: *Self, dest_reg: Register, addr_reg: Register, ty: Type) | ... | @@ -3967,7 +3967,7 @@ fn genLdrRegister(self: *Self, dest_reg: Register, addr_reg: Register, ty: Type) |
| 3967 | } | 3967 | } |
| 3968 | 3968 | ||
| 3969 | fn genStrRegister(self: *Self, source_reg: Register, addr_reg: Register, ty: Type) !void { | 3969 | fn 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.?; |
| 3971 | const abi_size = ty.abiSize(mod); | 3971 | const abi_size = ty.abiSize(mod); |
| 3972 | 3972 | ||
| 3973 | const tag: Mir.Inst.Tag = switch (abi_size) { | 3973 | const tag: Mir.Inst.Tag = switch (abi_size) { |
| ... | @@ -4174,7 +4174,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4174,7 +4174,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void { |
| 4174 | while (self.args[arg_index] == .none) arg_index += 1; | 4174 | while (self.args[arg_index] == .none) arg_index += 1; |
| 4175 | self.arg_index = arg_index + 1; | 4175 | self.arg_index = arg_index + 1; |
| 4176 | 4176 | ||
| 4177 | const mod = self.bin_file.options.module.?; | 4177 | const mod = self.bin_file.comp.module.?; |
| 4178 | const ty = self.typeOfIndex(inst); | 4178 | const ty = self.typeOfIndex(inst); |
| 4179 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | 4179 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; |
| 4180 | const src_index = self.air.instructions.items(.data)[@intFromEnum(inst)].arg.src_index; | 4180 | 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 | ... | @@ -4229,7 +4229,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier |
| 4229 | const extra = self.air.extraData(Air.Call, pl_op.payload); | 4229 | const extra = self.air.extraData(Air.Call, pl_op.payload); |
| 4230 | const args: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra.end..][0..extra.data.args_len]); | 4230 | const args: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra.end..][0..extra.data.args_len]); |
| 4231 | const ty = self.typeOf(callee); | 4231 | const ty = self.typeOf(callee); |
| 4232 | const mod = self.bin_file.options.module.?; | 4232 | const mod = self.bin_file.comp.module.?; |
| 4233 | 4233 | ||
| 4234 | const fn_ty = switch (ty.zigTypeTag(mod)) { | 4234 | const fn_ty = switch (ty.zigTypeTag(mod)) { |
| 4235 | .Fn => ty, | 4235 | .Fn => ty, |
| ... | @@ -4380,7 +4380,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier | ... | @@ -4380,7 +4380,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier |
| 4380 | } | 4380 | } |
| 4381 | 4381 | ||
| 4382 | fn airRet(self: *Self, inst: Air.Inst.Index) !void { | 4382 | fn airRet(self: *Self, inst: Air.Inst.Index) !void { |
| 4383 | const mod = self.bin_file.options.module.?; | 4383 | const mod = self.bin_file.comp.module.?; |
| 4384 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 4384 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4385 | const operand = try self.resolveInst(un_op); | 4385 | const operand = try self.resolveInst(un_op); |
| 4386 | const ret_ty = self.fn_type.fnReturnType(mod); | 4386 | const ret_ty = self.fn_type.fnReturnType(mod); |
| ... | @@ -4412,7 +4412,7 @@ fn airRet(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4412,7 +4412,7 @@ fn airRet(self: *Self, inst: Air.Inst.Index) !void { |
| 4412 | } | 4412 | } |
| 4413 | 4413 | ||
| 4414 | fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void { | 4414 | fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 4415 | const mod = self.bin_file.options.module.?; | 4415 | const mod = self.bin_file.comp.module.?; |
| 4416 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 4416 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4417 | const ptr = try self.resolveInst(un_op); | 4417 | const ptr = try self.resolveInst(un_op); |
| 4418 | const ptr_ty = self.typeOf(un_op); | 4418 | const ptr_ty = self.typeOf(un_op); |
| ... | @@ -4473,7 +4473,7 @@ fn cmp( | ... | @@ -4473,7 +4473,7 @@ fn cmp( |
| 4473 | lhs_ty: Type, | 4473 | lhs_ty: Type, |
| 4474 | op: math.CompareOperator, | 4474 | op: math.CompareOperator, |
| 4475 | ) !MCValue { | 4475 | ) !MCValue { |
| 4476 | const mod = self.bin_file.options.module.?; | 4476 | const mod = self.bin_file.comp.module.?; |
| 4477 | const int_ty = switch (lhs_ty.zigTypeTag(mod)) { | 4477 | const int_ty = switch (lhs_ty.zigTypeTag(mod)) { |
| 4478 | .Optional => blk: { | 4478 | .Optional => blk: { |
| 4479 | const payload_ty = lhs_ty.optionalChild(mod); | 4479 | const payload_ty = lhs_ty.optionalChild(mod); |
| ... | @@ -4580,7 +4580,7 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4580,7 +4580,7 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void { |
| 4580 | 4580 | ||
| 4581 | fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void { | 4581 | fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void { |
| 4582 | const ty_fn = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_fn; | 4582 | 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.?; |
| 4584 | const func = mod.funcInfo(ty_fn.func); | 4584 | const func = mod.funcInfo(ty_fn.func); |
| 4585 | // TODO emit debug info for function change | 4585 | // TODO emit debug info for function change |
| 4586 | _ = func; | 4586 | _ = func; |
| ... | @@ -4795,7 +4795,7 @@ fn isNull( | ... | @@ -4795,7 +4795,7 @@ fn isNull( |
| 4795 | operand_bind: ReadArg.Bind, | 4795 | operand_bind: ReadArg.Bind, |
| 4796 | operand_ty: Type, | 4796 | operand_ty: Type, |
| 4797 | ) !MCValue { | 4797 | ) !MCValue { |
| 4798 | const mod = self.bin_file.options.module.?; | 4798 | const mod = self.bin_file.comp.module.?; |
| 4799 | if (operand_ty.isPtrLikeOptional(mod)) { | 4799 | if (operand_ty.isPtrLikeOptional(mod)) { |
| 4800 | assert(operand_ty.abiSize(mod) == 4); | 4800 | assert(operand_ty.abiSize(mod) == 4); |
| 4801 | 4801 | ||
| ... | @@ -4829,7 +4829,7 @@ fn airIsNull(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4829,7 +4829,7 @@ fn airIsNull(self: *Self, inst: Air.Inst.Index) !void { |
| 4829 | } | 4829 | } |
| 4830 | 4830 | ||
| 4831 | fn airIsNullPtr(self: *Self, inst: Air.Inst.Index) !void { | 4831 | fn airIsNullPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 4832 | const mod = self.bin_file.options.module.?; | 4832 | const mod = self.bin_file.comp.module.?; |
| 4833 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 4833 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4834 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 4834 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 4835 | const operand_ptr = try self.resolveInst(un_op); | 4835 | const operand_ptr = try self.resolveInst(un_op); |
| ... | @@ -4856,7 +4856,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4856,7 +4856,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void { |
| 4856 | } | 4856 | } |
| 4857 | 4857 | ||
| 4858 | fn airIsNonNullPtr(self: *Self, inst: Air.Inst.Index) !void { | 4858 | fn airIsNonNullPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 4859 | const mod = self.bin_file.options.module.?; | 4859 | const mod = self.bin_file.comp.module.?; |
| 4860 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 4860 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4861 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 4861 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 4862 | const operand_ptr = try self.resolveInst(un_op); | 4862 | const operand_ptr = try self.resolveInst(un_op); |
| ... | @@ -4876,7 +4876,7 @@ fn isErr( | ... | @@ -4876,7 +4876,7 @@ fn isErr( |
| 4876 | error_union_bind: ReadArg.Bind, | 4876 | error_union_bind: ReadArg.Bind, |
| 4877 | error_union_ty: Type, | 4877 | error_union_ty: Type, |
| 4878 | ) !MCValue { | 4878 | ) !MCValue { |
| 4879 | const mod = self.bin_file.options.module.?; | 4879 | const mod = self.bin_file.comp.module.?; |
| 4880 | const error_type = error_union_ty.errorUnionSet(mod); | 4880 | const error_type = error_union_ty.errorUnionSet(mod); |
| 4881 | 4881 | ||
| 4882 | if (error_type.errorSetIsEmpty(mod)) { | 4882 | if (error_type.errorSetIsEmpty(mod)) { |
| ... | @@ -4918,7 +4918,7 @@ fn airIsErr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4918,7 +4918,7 @@ fn airIsErr(self: *Self, inst: Air.Inst.Index) !void { |
| 4918 | } | 4918 | } |
| 4919 | 4919 | ||
| 4920 | fn airIsErrPtr(self: *Self, inst: Air.Inst.Index) !void { | 4920 | fn airIsErrPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 4921 | const mod = self.bin_file.options.module.?; | 4921 | const mod = self.bin_file.comp.module.?; |
| 4922 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 4922 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4923 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 4923 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 4924 | const operand_ptr = try self.resolveInst(un_op); | 4924 | const operand_ptr = try self.resolveInst(un_op); |
| ... | @@ -4945,7 +4945,7 @@ fn airIsNonErr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4945,7 +4945,7 @@ fn airIsNonErr(self: *Self, inst: Air.Inst.Index) !void { |
| 4945 | } | 4945 | } |
| 4946 | 4946 | ||
| 4947 | fn airIsNonErrPtr(self: *Self, inst: Air.Inst.Index) !void { | 4947 | fn airIsNonErrPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 4948 | const mod = self.bin_file.options.module.?; | 4948 | const mod = self.bin_file.comp.module.?; |
| 4949 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 4949 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 4950 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 4950 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 4951 | const operand_ptr = try self.resolveInst(un_op); | 4951 | const operand_ptr = try self.resolveInst(un_op); |
| ... | @@ -5160,7 +5160,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5160,7 +5160,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void { |
| 5160 | } | 5160 | } |
| 5161 | 5161 | ||
| 5162 | fn br(self: *Self, block: Air.Inst.Index, operand: Air.Inst.Ref) !void { | 5162 | fn 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.?; |
| 5164 | const block_data = self.blocks.getPtr(block).?; | 5164 | const block_data = self.blocks.getPtr(block).?; |
| 5165 | 5165 | ||
| 5166 | if (self.typeOf(operand).hasRuntimeBits(mod)) { | 5166 | if (self.typeOf(operand).hasRuntimeBits(mod)) { |
| ... | @@ -5331,7 +5331,7 @@ fn setRegOrMem(self: *Self, ty: Type, loc: MCValue, val: MCValue) !void { | ... | @@ -5331,7 +5331,7 @@ fn setRegOrMem(self: *Self, ty: Type, loc: MCValue, val: MCValue) !void { |
| 5331 | } | 5331 | } |
| 5332 | 5332 | ||
| 5333 | fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void { | 5333 | fn 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.?; |
| 5335 | const abi_size: u32 = @intCast(ty.abiSize(mod)); | 5335 | const abi_size: u32 = @intCast(ty.abiSize(mod)); |
| 5336 | switch (mcv) { | 5336 | switch (mcv) { |
| 5337 | .dead => unreachable, | 5337 | .dead => unreachable, |
| ... | @@ -5493,7 +5493,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro | ... | @@ -5493,7 +5493,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro |
| 5493 | } | 5493 | } |
| 5494 | 5494 | ||
| 5495 | fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void { | 5495 | fn 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.?; |
| 5497 | switch (mcv) { | 5497 | switch (mcv) { |
| 5498 | .dead => unreachable, | 5498 | .dead => unreachable, |
| 5499 | .unreach, .none => return, // Nothing to do. | 5499 | .unreach, .none => return, // Nothing to do. |
| ... | @@ -5740,7 +5740,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void | ... | @@ -5740,7 +5740,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void |
| 5740 | } | 5740 | } |
| 5741 | 5741 | ||
| 5742 | fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void { | 5742 | fn 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.?; |
| 5744 | const abi_size: u32 = @intCast(ty.abiSize(mod)); | 5744 | const abi_size: u32 = @intCast(ty.abiSize(mod)); |
| 5745 | switch (mcv) { | 5745 | switch (mcv) { |
| 5746 | .dead => unreachable, | 5746 | .dead => unreachable, |
| ... | @@ -5896,7 +5896,7 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5896,7 +5896,7 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { |
| 5896 | } | 5896 | } |
| 5897 | 5897 | ||
| 5898 | fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { | 5898 | fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { |
| 5899 | const mod = self.bin_file.options.module.?; | 5899 | const mod = self.bin_file.comp.module.?; |
| 5900 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 5900 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5901 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 5901 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 5902 | const ptr_ty = self.typeOf(ty_op.operand); | 5902 | const ptr_ty = self.typeOf(ty_op.operand); |
| ... | @@ -6015,7 +6015,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -6015,7 +6015,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void { |
| 6015 | } | 6015 | } |
| 6016 | 6016 | ||
| 6017 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { | 6017 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
| 6018 | const mod = self.bin_file.options.module.?; | 6018 | const mod = self.bin_file.comp.module.?; |
| 6019 | const vector_ty = self.typeOfIndex(inst); | 6019 | const vector_ty = self.typeOfIndex(inst); |
| 6020 | const len = vector_ty.vectorLen(mod); | 6020 | const len = vector_ty.vectorLen(mod); |
| 6021 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 6021 | 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 { | ... | @@ -6066,7 +6066,7 @@ fn airTry(self: *Self, inst: Air.Inst.Index) !void { |
| 6066 | const result: MCValue = result: { | 6066 | const result: MCValue = result: { |
| 6067 | const error_union_bind: ReadArg.Bind = .{ .inst = pl_op.operand }; | 6067 | const error_union_bind: ReadArg.Bind = .{ .inst = pl_op.operand }; |
| 6068 | const error_union_ty = self.typeOf(pl_op.operand); | 6068 | 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.?; |
| 6070 | const error_union_size: u32 = @intCast(error_union_ty.abiSize(mod)); | 6070 | const error_union_size: u32 = @intCast(error_union_ty.abiSize(mod)); |
| 6071 | const error_union_align = error_union_ty.abiAlignment(mod); | 6071 | const error_union_align = error_union_ty.abiAlignment(mod); |
| 6072 | 6072 | ||
| ... | @@ -6097,7 +6097,7 @@ fn airTryPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -6097,7 +6097,7 @@ fn airTryPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 6097 | } | 6097 | } |
| 6098 | 6098 | ||
| 6099 | fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue { | 6099 | fn 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.?; |
| 6101 | 6101 | ||
| 6102 | // If the type has no codegen bits, no need to store it. | 6102 | // If the type has no codegen bits, no need to store it. |
| 6103 | const inst_ty = self.typeOf(inst); | 6103 | const inst_ty = self.typeOf(inst); |
| ... | @@ -6125,7 +6125,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue { | ... | @@ -6125,7 +6125,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue { |
| 6125 | } | 6125 | } |
| 6126 | 6126 | ||
| 6127 | fn genTypedValue(self: *Self, arg_tv: TypedValue) InnerError!MCValue { | 6127 | fn genTypedValue(self: *Self, arg_tv: TypedValue) InnerError!MCValue { |
| 6128 | const mod = self.bin_file.options.module.?; | 6128 | const mod = self.bin_file.comp.module.?; |
| 6129 | const mcv: MCValue = switch (try codegen.genTypedValue( | 6129 | const mcv: MCValue = switch (try codegen.genTypedValue( |
| 6130 | self.bin_file, | 6130 | self.bin_file, |
| 6131 | self.src_loc, | 6131 | self.src_loc, |
| ... | @@ -6161,7 +6161,7 @@ const CallMCValues = struct { | ... | @@ -6161,7 +6161,7 @@ const CallMCValues = struct { |
| 6161 | 6161 | ||
| 6162 | /// Caller must call `CallMCValues.deinit`. | 6162 | /// Caller must call `CallMCValues.deinit`. |
| 6163 | fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues { | 6163 | fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues { |
| 6164 | const mod = self.bin_file.options.module.?; | 6164 | const mod = self.bin_file.comp.module.?; |
| 6165 | const ip = &mod.intern_pool; | 6165 | const ip = &mod.intern_pool; |
| 6166 | const fn_info = mod.typeToFunc(fn_ty).?; | 6166 | const fn_info = mod.typeToFunc(fn_ty).?; |
| 6167 | const cc = fn_info.cc; | 6167 | const cc = fn_info.cc; |
| ... | @@ -6312,11 +6312,11 @@ fn parseRegName(name: []const u8) ?Register { | ... | @@ -6312,11 +6312,11 @@ fn parseRegName(name: []const u8) ?Register { |
| 6312 | } | 6312 | } |
| 6313 | 6313 | ||
| 6314 | fn typeOf(self: *Self, inst: Air.Inst.Ref) Type { | 6314 | fn typeOf(self: *Self, inst: Air.Inst.Ref) Type { |
| 6315 | const mod = self.bin_file.options.module.?; | 6315 | const mod = self.bin_file.comp.module.?; |
| 6316 | return self.air.typeOf(inst, &mod.intern_pool); | 6316 | return self.air.typeOf(inst, &mod.intern_pool); |
| 6317 | } | 6317 | } |
| 6318 | 6318 | ||
| 6319 | fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type { | 6319 | fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type { |
| 6320 | const mod = self.bin_file.options.module.?; | 6320 | const mod = self.bin_file.comp.module.?; |
| 6321 | return self.air.typeOfIndex(inst, &mod.intern_pool); | 6321 | return self.air.typeOfIndex(inst, &mod.intern_pool); |
| 6322 | } | 6322 | } |
src/arch/riscv64/CodeGen.zig+22-22| ... | @@ -229,7 +229,7 @@ pub fn generate( | ... | @@ -229,7 +229,7 @@ pub fn generate( |
| 229 | @panic("Attempted to compile for architecture that was disabled by build configuration"); | 229 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | const mod = bin_file.options.module.?; | 232 | const mod = bin_file.comp.module.?; |
| 233 | const func = mod.funcInfo(func_index); | 233 | const func = mod.funcInfo(func_index); |
| 234 | const fn_owner_decl = mod.declPtr(func.owner_decl); | 234 | const fn_owner_decl = mod.declPtr(func.owner_decl); |
| 235 | assert(fn_owner_decl.has_tv); | 235 | assert(fn_owner_decl.has_tv); |
| ... | @@ -350,7 +350,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 { | ... | @@ -350,7 +350,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 { |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | fn gen(self: *Self) !void { | 352 | fn gen(self: *Self) !void { |
| 353 | const mod = self.bin_file.options.module.?; | 353 | const mod = self.bin_file.comp.module.?; |
| 354 | const cc = self.fn_type.fnCallingConvention(mod); | 354 | const cc = self.fn_type.fnCallingConvention(mod); |
| 355 | if (cc != .Naked) { | 355 | if (cc != .Naked) { |
| 356 | // TODO Finish function prologue and epilogue for riscv64. | 356 | // TODO Finish function prologue and epilogue for riscv64. |
| ... | @@ -474,7 +474,7 @@ fn gen(self: *Self) !void { | ... | @@ -474,7 +474,7 @@ fn gen(self: *Self) !void { |
| 474 | } | 474 | } |
| 475 | 475 | ||
| 476 | fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { | 476 | fn 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.?; |
| 478 | const ip = &mod.intern_pool; | 478 | const ip = &mod.intern_pool; |
| 479 | const air_tags = self.air.instructions.items(.tag); | 479 | const air_tags = self.air.instructions.items(.tag); |
| 480 | 480 | ||
| ... | @@ -805,7 +805,7 @@ fn allocMem(self: *Self, inst: Air.Inst.Index, abi_size: u32, abi_align: Alignme | ... | @@ -805,7 +805,7 @@ fn allocMem(self: *Self, inst: Air.Inst.Index, abi_size: u32, abi_align: Alignme |
| 805 | 805 | ||
| 806 | /// Use a pointer instruction as the basis for allocating stack memory. | 806 | /// Use a pointer instruction as the basis for allocating stack memory. |
| 807 | fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { | 807 | fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { |
| 808 | const mod = self.bin_file.options.module.?; | 808 | const mod = self.bin_file.comp.module.?; |
| 809 | const elem_ty = self.typeOfIndex(inst).childType(mod); | 809 | const elem_ty = self.typeOfIndex(inst).childType(mod); |
| 810 | const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse { | 810 | const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse { |
| 811 | return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)}); | 811 | 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 { | ... | @@ -816,7 +816,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { |
| 816 | } | 816 | } |
| 817 | 817 | ||
| 818 | fn allocRegOrMem(self: *Self, inst: Air.Inst.Index, reg_ok: bool) !MCValue { | 818 | fn 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.?; |
| 820 | const elem_ty = self.typeOfIndex(inst); | 820 | const elem_ty = self.typeOfIndex(inst); |
| 821 | const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse { | 821 | const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse { |
| 822 | return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)}); | 822 | 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 { | ... | @@ -893,7 +893,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { |
| 893 | if (self.liveness.isUnused(inst)) | 893 | if (self.liveness.isUnused(inst)) |
| 894 | return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none }); | 894 | return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none }); |
| 895 | 895 | ||
| 896 | const mod = self.bin_file.options.module.?; | 896 | const mod = self.bin_file.comp.module.?; |
| 897 | const operand_ty = self.typeOf(ty_op.operand); | 897 | const operand_ty = self.typeOf(ty_op.operand); |
| 898 | const operand = try self.resolveInst(ty_op.operand); | 898 | const operand = try self.resolveInst(ty_op.operand); |
| 899 | const info_a = operand_ty.intInfo(mod); | 899 | const info_a = operand_ty.intInfo(mod); |
| ... | @@ -1069,7 +1069,7 @@ fn binOp( | ... | @@ -1069,7 +1069,7 @@ fn binOp( |
| 1069 | lhs_ty: Type, | 1069 | lhs_ty: Type, |
| 1070 | rhs_ty: Type, | 1070 | rhs_ty: Type, |
| 1071 | ) InnerError!MCValue { | 1071 | ) InnerError!MCValue { |
| 1072 | const mod = self.bin_file.options.module.?; | 1072 | const mod = self.bin_file.comp.module.?; |
| 1073 | switch (tag) { | 1073 | switch (tag) { |
| 1074 | // Arithmetic operations on integers and floats | 1074 | // Arithmetic operations on integers and floats |
| 1075 | .add, | 1075 | .add, |
| ... | @@ -1332,7 +1332,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1332,7 +1332,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void { |
| 1332 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { | 1332 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { |
| 1333 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 1333 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 1334 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 1334 | 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.?; |
| 1336 | const optional_ty = self.typeOfIndex(inst); | 1336 | const optional_ty = self.typeOfIndex(inst); |
| 1337 | 1337 | ||
| 1338 | // Optional with a zero-bit payload type is just a boolean true | 1338 | // 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 | ... | @@ -1506,7 +1506,7 @@ fn reuseOperand(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, op_ind |
| 1506 | } | 1506 | } |
| 1507 | 1507 | ||
| 1508 | fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!void { | 1508 | fn 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.?; |
| 1510 | const elem_ty = ptr_ty.childType(mod); | 1510 | const elem_ty = ptr_ty.childType(mod); |
| 1511 | switch (ptr) { | 1511 | switch (ptr) { |
| 1512 | .none => unreachable, | 1512 | .none => unreachable, |
| ... | @@ -1532,7 +1532,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!vo | ... | @@ -1532,7 +1532,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!vo |
| 1532 | } | 1532 | } |
| 1533 | 1533 | ||
| 1534 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { | 1534 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 1535 | const mod = self.bin_file.options.module.?; | 1535 | const mod = self.bin_file.comp.module.?; |
| 1536 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 1536 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 1537 | const elem_ty = self.typeOfIndex(inst); | 1537 | const elem_ty = self.typeOfIndex(inst); |
| 1538 | const result: MCValue = result: { | 1538 | const result: MCValue = result: { |
| ... | @@ -1633,7 +1633,7 @@ fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1633,7 +1633,7 @@ fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 1633 | } | 1633 | } |
| 1634 | 1634 | ||
| 1635 | fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, mcv: MCValue) !void { | 1635 | fn 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.?; |
| 1637 | const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg; | 1637 | const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg; |
| 1638 | const ty = arg.ty.toType(); | 1638 | const ty = arg.ty.toType(); |
| 1639 | const owner_decl = mod.funcOwnerDeclIndex(self.func_index); | 1639 | const owner_decl = mod.funcOwnerDeclIndex(self.func_index); |
| ... | @@ -1710,7 +1710,7 @@ fn airFence(self: *Self) !void { | ... | @@ -1710,7 +1710,7 @@ fn airFence(self: *Self) !void { |
| 1710 | } | 1710 | } |
| 1711 | 1711 | ||
| 1712 | fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier) !void { | 1712 | fn 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.?; |
| 1714 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for riscv64", .{}); | 1714 | if (modifier == .always_tail) return self.fail("TODO implement tail calls for riscv64", .{}); |
| 1715 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | 1715 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; |
| 1716 | const fn_ty = self.typeOf(pl_op.operand); | 1716 | const fn_ty = self.typeOf(pl_op.operand); |
| ... | @@ -1812,7 +1812,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier | ... | @@ -1812,7 +1812,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier |
| 1812 | } | 1812 | } |
| 1813 | 1813 | ||
| 1814 | fn ret(self: *Self, mcv: MCValue) !void { | 1814 | fn ret(self: *Self, mcv: MCValue) !void { |
| 1815 | const mod = self.bin_file.options.module.?; | 1815 | const mod = self.bin_file.comp.module.?; |
| 1816 | const ret_ty = self.fn_type.fnReturnType(mod); | 1816 | const ret_ty = self.fn_type.fnReturnType(mod); |
| 1817 | try self.setRegOrMem(ret_ty, self.ret_mcv, mcv); | 1817 | try self.setRegOrMem(ret_ty, self.ret_mcv, mcv); |
| 1818 | // Just add space for an instruction, patch this later | 1818 | // 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 { | ... | @@ -1843,7 +1843,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 1843 | if (self.liveness.isUnused(inst)) | 1843 | if (self.liveness.isUnused(inst)) |
| 1844 | return self.finishAir(inst, .dead, .{ bin_op.lhs, bin_op.rhs, .none }); | 1844 | return self.finishAir(inst, .dead, .{ bin_op.lhs, bin_op.rhs, .none }); |
| 1845 | const ty = self.typeOf(bin_op.lhs); | 1845 | const ty = self.typeOf(bin_op.lhs); |
| 1846 | const mod = self.bin_file.options.module.?; | 1846 | const mod = self.bin_file.comp.module.?; |
| 1847 | assert(ty.eql(self.typeOf(bin_op.rhs), mod)); | 1847 | assert(ty.eql(self.typeOf(bin_op.rhs), mod)); |
| 1848 | if (ty.zigTypeTag(mod) == .ErrorSet) | 1848 | if (ty.zigTypeTag(mod) == .ErrorSet) |
| 1849 | return self.fail("TODO implement cmp for errors", .{}); | 1849 | return self.fail("TODO implement cmp for errors", .{}); |
| ... | @@ -1887,7 +1887,7 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1887,7 +1887,7 @@ fn airDbgStmt(self: *Self, inst: Air.Inst.Index) !void { |
| 1887 | 1887 | ||
| 1888 | fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void { | 1888 | fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void { |
| 1889 | const ty_fn = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_fn; | 1889 | 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.?; |
| 1891 | const func = mod.funcInfo(ty_fn.func); | 1891 | const func = mod.funcInfo(ty_fn.func); |
| 1892 | // TODO emit debug info for function change | 1892 | // TODO emit debug info for function change |
| 1893 | _ = func; | 1893 | _ = func; |
| ... | @@ -2125,7 +2125,7 @@ fn airBoolOp(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2125,7 +2125,7 @@ fn airBoolOp(self: *Self, inst: Air.Inst.Index) !void { |
| 2125 | fn br(self: *Self, block: Air.Inst.Index, operand: Air.Inst.Ref) !void { | 2125 | fn br(self: *Self, block: Air.Inst.Index, operand: Air.Inst.Ref) !void { |
| 2126 | const block_data = self.blocks.getPtr(block).?; | 2126 | const block_data = self.blocks.getPtr(block).?; |
| 2127 | 2127 | ||
| 2128 | const mod = self.bin_file.options.module.?; | 2128 | const mod = self.bin_file.comp.module.?; |
| 2129 | if (self.typeOf(operand).hasRuntimeBits(mod)) { | 2129 | if (self.typeOf(operand).hasRuntimeBits(mod)) { |
| 2130 | const operand_mcv = try self.resolveInst(operand); | 2130 | const operand_mcv = try self.resolveInst(operand); |
| 2131 | const block_mcv = block_data.mcv; | 2131 | const block_mcv = block_data.mcv; |
| ... | @@ -2508,7 +2508,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2508,7 +2508,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void { |
| 2508 | } | 2508 | } |
| 2509 | 2509 | ||
| 2510 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { | 2510 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
| 2511 | const mod = self.bin_file.options.module.?; | 2511 | const mod = self.bin_file.comp.module.?; |
| 2512 | const vector_ty = self.typeOfIndex(inst); | 2512 | const vector_ty = self.typeOfIndex(inst); |
| 2513 | const len = vector_ty.vectorLen(mod); | 2513 | const len = vector_ty.vectorLen(mod); |
| 2514 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 2514 | 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 { | ... | @@ -2553,7 +2553,7 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void { |
| 2553 | } | 2553 | } |
| 2554 | 2554 | ||
| 2555 | fn resolveInst(self: *Self, inst: Air.Inst.Ref) InnerError!MCValue { | 2555 | fn 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.?; |
| 2557 | 2557 | ||
| 2558 | // If the type has no codegen bits, no need to store it. | 2558 | // If the type has no codegen bits, no need to store it. |
| 2559 | const inst_ty = self.typeOf(inst); | 2559 | const inst_ty = self.typeOf(inst); |
| ... | @@ -2581,7 +2581,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue { | ... | @@ -2581,7 +2581,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue { |
| 2581 | } | 2581 | } |
| 2582 | 2582 | ||
| 2583 | fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { | 2583 | fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { |
| 2584 | const mod = self.bin_file.options.module.?; | 2584 | const mod = self.bin_file.comp.module.?; |
| 2585 | const mcv: MCValue = switch (try codegen.genTypedValue( | 2585 | const mcv: MCValue = switch (try codegen.genTypedValue( |
| 2586 | self.bin_file, | 2586 | self.bin_file, |
| 2587 | self.src_loc, | 2587 | self.src_loc, |
| ... | @@ -2617,7 +2617,7 @@ const CallMCValues = struct { | ... | @@ -2617,7 +2617,7 @@ const CallMCValues = struct { |
| 2617 | 2617 | ||
| 2618 | /// Caller must call `CallMCValues.deinit`. | 2618 | /// Caller must call `CallMCValues.deinit`. |
| 2619 | fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues { | 2619 | fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues { |
| 2620 | const mod = self.bin_file.options.module.?; | 2620 | const mod = self.bin_file.comp.module.?; |
| 2621 | const ip = &mod.intern_pool; | 2621 | const ip = &mod.intern_pool; |
| 2622 | const fn_info = mod.typeToFunc(fn_ty).?; | 2622 | const fn_info = mod.typeToFunc(fn_ty).?; |
| 2623 | const cc = fn_info.cc; | 2623 | const cc = fn_info.cc; |
| ... | @@ -2739,11 +2739,11 @@ fn parseRegName(name: []const u8) ?Register { | ... | @@ -2739,11 +2739,11 @@ fn parseRegName(name: []const u8) ?Register { |
| 2739 | } | 2739 | } |
| 2740 | 2740 | ||
| 2741 | fn typeOf(self: *Self, inst: Air.Inst.Ref) Type { | 2741 | fn typeOf(self: *Self, inst: Air.Inst.Ref) Type { |
| 2742 | const mod = self.bin_file.options.module.?; | 2742 | const mod = self.bin_file.comp.module.?; |
| 2743 | return self.air.typeOf(inst, &mod.intern_pool); | 2743 | return self.air.typeOf(inst, &mod.intern_pool); |
| 2744 | } | 2744 | } |
| 2745 | 2745 | ||
| 2746 | fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type { | 2746 | fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type { |
| 2747 | const mod = self.bin_file.options.module.?; | 2747 | const mod = self.bin_file.comp.module.?; |
| 2748 | return self.air.typeOfIndex(inst, &mod.intern_pool); | 2748 | return self.air.typeOfIndex(inst, &mod.intern_pool); |
| 2749 | } | 2749 | } |
src/arch/sparc64/CodeGen.zig+43-43| ... | @@ -272,7 +272,7 @@ pub fn generate( | ... | @@ -272,7 +272,7 @@ pub fn generate( |
| 272 | @panic("Attempted to compile for architecture that was disabled by build configuration"); | 272 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | const mod = bin_file.options.module.?; | 275 | const mod = bin_file.comp.module.?; |
| 276 | const func = mod.funcInfo(func_index); | 276 | const func = mod.funcInfo(func_index); |
| 277 | const fn_owner_decl = mod.declPtr(func.owner_decl); | 277 | const fn_owner_decl = mod.declPtr(func.owner_decl); |
| 278 | assert(fn_owner_decl.has_tv); | 278 | assert(fn_owner_decl.has_tv); |
| ... | @@ -364,7 +364,7 @@ pub fn generate( | ... | @@ -364,7 +364,7 @@ pub fn generate( |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | fn gen(self: *Self) !void { | 366 | fn gen(self: *Self) !void { |
| 367 | const mod = self.bin_file.options.module.?; | 367 | const mod = self.bin_file.comp.module.?; |
| 368 | const cc = self.fn_type.fnCallingConvention(mod); | 368 | const cc = self.fn_type.fnCallingConvention(mod); |
| 369 | if (cc != .Naked) { | 369 | if (cc != .Naked) { |
| 370 | // TODO Finish function prologue and epilogue for sparc64. | 370 | // TODO Finish function prologue and epilogue for sparc64. |
| ... | @@ -492,7 +492,7 @@ fn gen(self: *Self) !void { | ... | @@ -492,7 +492,7 @@ fn gen(self: *Self) !void { |
| 492 | } | 492 | } |
| 493 | 493 | ||
| 494 | fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { | 494 | fn 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.?; |
| 496 | const ip = &mod.intern_pool; | 496 | const ip = &mod.intern_pool; |
| 497 | const air_tags = self.air.instructions.items(.tag); | 497 | const air_tags = self.air.instructions.items(.tag); |
| 498 | 498 | ||
| ... | @@ -762,7 +762,7 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -762,7 +762,7 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 762 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | 762 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; |
| 763 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 763 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 764 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 764 | 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.?; |
| 766 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 766 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 767 | const lhs = try self.resolveInst(extra.lhs); | 767 | const lhs = try self.resolveInst(extra.lhs); |
| 768 | const rhs = try self.resolveInst(extra.rhs); | 768 | const rhs = try self.resolveInst(extra.rhs); |
| ... | @@ -840,7 +840,7 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -840,7 +840,7 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 840 | } | 840 | } |
| 841 | 841 | ||
| 842 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { | 842 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
| 843 | const mod = self.bin_file.options.module.?; | 843 | const mod = self.bin_file.comp.module.?; |
| 844 | const vector_ty = self.typeOfIndex(inst); | 844 | const vector_ty = self.typeOfIndex(inst); |
| 845 | const len = vector_ty.vectorLen(mod); | 845 | const len = vector_ty.vectorLen(mod); |
| 846 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 846 | 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 { | ... | @@ -874,7 +874,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 874 | } | 874 | } |
| 875 | 875 | ||
| 876 | fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { | 876 | fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { |
| 877 | const mod = self.bin_file.options.module.?; | 877 | const mod = self.bin_file.comp.module.?; |
| 878 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 878 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 879 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 879 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 880 | const ptr_ty = self.typeOf(ty_op.operand); | 880 | const ptr_ty = self.typeOf(ty_op.operand); |
| ... | @@ -1011,7 +1011,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1011,7 +1011,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 1011 | } | 1011 | } |
| 1012 | 1012 | ||
| 1013 | fn airArg(self: *Self, inst: Air.Inst.Index) !void { | 1013 | fn airArg(self: *Self, inst: Air.Inst.Index) !void { |
| 1014 | const mod = self.bin_file.options.module.?; | 1014 | const mod = self.bin_file.comp.module.?; |
| 1015 | const arg_index = self.arg_index; | 1015 | const arg_index = self.arg_index; |
| 1016 | self.arg_index += 1; | 1016 | self.arg_index += 1; |
| 1017 | 1017 | ||
| ... | @@ -1206,7 +1206,7 @@ fn airBreakpoint(self: *Self) !void { | ... | @@ -1206,7 +1206,7 @@ fn airBreakpoint(self: *Self) !void { |
| 1206 | } | 1206 | } |
| 1207 | 1207 | ||
| 1208 | fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void { | 1208 | fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void { |
| 1209 | const mod = self.bin_file.options.module.?; | 1209 | const mod = self.bin_file.comp.module.?; |
| 1210 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 1210 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 1211 | 1211 | ||
| 1212 | // We have hardware byteswapper in SPARCv9, don't let mainstream compilers mislead you. | 1212 | // 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 | ... | @@ -1298,7 +1298,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier |
| 1298 | const extra = self.air.extraData(Air.Call, pl_op.payload); | 1298 | const extra = self.air.extraData(Air.Call, pl_op.payload); |
| 1299 | const args = @as([]const Air.Inst.Ref, @ptrCast(self.air.extra[extra.end .. extra.end + extra.data.args_len])); | 1299 | const args = @as([]const Air.Inst.Ref, @ptrCast(self.air.extra[extra.end .. extra.end + extra.data.args_len])); |
| 1300 | const ty = self.typeOf(callee); | 1300 | const ty = self.typeOf(callee); |
| 1301 | const mod = self.bin_file.options.module.?; | 1301 | const mod = self.bin_file.comp.module.?; |
| 1302 | const fn_ty = switch (ty.zigTypeTag(mod)) { | 1302 | const fn_ty = switch (ty.zigTypeTag(mod)) { |
| 1303 | .Fn => ty, | 1303 | .Fn => ty, |
| 1304 | .Pointer => ty.childType(mod), | 1304 | .Pointer => ty.childType(mod), |
| ... | @@ -1430,7 +1430,7 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1430,7 +1430,7 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void { |
| 1430 | 1430 | ||
| 1431 | fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { | 1431 | fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { |
| 1432 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 1432 | 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.?; |
| 1434 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 1434 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1435 | const lhs = try self.resolveInst(bin_op.lhs); | 1435 | const lhs = try self.resolveInst(bin_op.lhs); |
| 1436 | const rhs = try self.resolveInst(bin_op.rhs); | 1436 | const rhs = try self.resolveInst(bin_op.rhs); |
| ... | @@ -1662,7 +1662,7 @@ fn airDbgBlock(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1662,7 +1662,7 @@ fn airDbgBlock(self: *Self, inst: Air.Inst.Index) !void { |
| 1662 | 1662 | ||
| 1663 | fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void { | 1663 | fn airDbgInline(self: *Self, inst: Air.Inst.Index) !void { |
| 1664 | const ty_fn = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_fn; | 1664 | 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.?; |
| 1666 | const func = mod.funcInfo(ty_fn.func); | 1666 | const func = mod.funcInfo(ty_fn.func); |
| 1667 | // TODO emit debug info for function change | 1667 | // TODO emit debug info for function change |
| 1668 | _ = func; | 1668 | _ = func; |
| ... | @@ -1758,7 +1758,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1758,7 +1758,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { |
| 1758 | if (self.liveness.isUnused(inst)) | 1758 | if (self.liveness.isUnused(inst)) |
| 1759 | return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none }); | 1759 | return self.finishAir(inst, .dead, .{ ty_op.operand, .none, .none }); |
| 1760 | 1760 | ||
| 1761 | const mod = self.bin_file.options.module.?; | 1761 | const mod = self.bin_file.comp.module.?; |
| 1762 | const operand_ty = self.typeOf(ty_op.operand); | 1762 | const operand_ty = self.typeOf(ty_op.operand); |
| 1763 | const operand = try self.resolveInst(ty_op.operand); | 1763 | const operand = try self.resolveInst(ty_op.operand); |
| 1764 | const info_a = operand_ty.intInfo(mod); | 1764 | const info_a = operand_ty.intInfo(mod); |
| ... | @@ -1819,7 +1819,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1819,7 +1819,7 @@ fn airIsNonNull(self: *Self, inst: Air.Inst.Index) !void { |
| 1819 | } | 1819 | } |
| 1820 | 1820 | ||
| 1821 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { | 1821 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 1822 | const mod = self.bin_file.options.module.?; | 1822 | const mod = self.bin_file.comp.module.?; |
| 1823 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 1823 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 1824 | const elem_ty = self.typeOfIndex(inst); | 1824 | const elem_ty = self.typeOfIndex(inst); |
| 1825 | const elem_size = elem_ty.abiSize(mod); | 1825 | const elem_size = elem_ty.abiSize(mod); |
| ... | @@ -1903,7 +1903,7 @@ fn airMod(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1903,7 +1903,7 @@ fn airMod(self: *Self, inst: Air.Inst.Index) !void { |
| 1903 | const rhs = try self.resolveInst(bin_op.rhs); | 1903 | const rhs = try self.resolveInst(bin_op.rhs); |
| 1904 | const lhs_ty = self.typeOf(bin_op.lhs); | 1904 | const lhs_ty = self.typeOf(bin_op.lhs); |
| 1905 | const rhs_ty = self.typeOf(bin_op.rhs); | 1905 | 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.?)); |
| 1907 | 1907 | ||
| 1908 | if (self.liveness.isUnused(inst)) | 1908 | if (self.liveness.isUnused(inst)) |
| 1909 | return self.finishAir(inst, .dead, .{ bin_op.lhs, bin_op.rhs, .none }); | 1909 | 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 { | ... | @@ -2045,7 +2045,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 2045 | //const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | 2045 | //const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; |
| 2046 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 2046 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 2047 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 2047 | 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.?; |
| 2049 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2049 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2050 | const lhs = try self.resolveInst(extra.lhs); | 2050 | const lhs = try self.resolveInst(extra.lhs); |
| 2051 | const rhs = try self.resolveInst(extra.rhs); | 2051 | const rhs = try self.resolveInst(extra.rhs); |
| ... | @@ -2109,7 +2109,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2109,7 +2109,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 2109 | 2109 | ||
| 2110 | fn airNot(self: *Self, inst: Air.Inst.Index) !void { | 2110 | fn airNot(self: *Self, inst: Air.Inst.Index) !void { |
| 2111 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 2111 | 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.?; |
| 2113 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2113 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2114 | const operand = try self.resolveInst(ty_op.operand); | 2114 | const operand = try self.resolveInst(ty_op.operand); |
| 2115 | const operand_ty = self.typeOf(ty_op.operand); | 2115 | const operand_ty = self.typeOf(ty_op.operand); |
| ... | @@ -2341,7 +2341,7 @@ fn airShlSat(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2341,7 +2341,7 @@ fn airShlSat(self: *Self, inst: Air.Inst.Index) !void { |
| 2341 | fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | 2341 | fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 2342 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 2342 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 2343 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 2343 | 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.?; |
| 2345 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2345 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2346 | const lhs = try self.resolveInst(extra.lhs); | 2346 | const lhs = try self.resolveInst(extra.lhs); |
| 2347 | const rhs = try self.resolveInst(extra.rhs); | 2347 | const rhs = try self.resolveInst(extra.rhs); |
| ... | @@ -2446,7 +2446,7 @@ fn airSlice(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2446,7 +2446,7 @@ fn airSlice(self: *Self, inst: Air.Inst.Index) !void { |
| 2446 | } | 2446 | } |
| 2447 | 2447 | ||
| 2448 | fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { | 2448 | fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2449 | const mod = self.bin_file.options.module.?; | 2449 | const mod = self.bin_file.comp.module.?; |
| 2450 | const is_volatile = false; // TODO | 2450 | const is_volatile = false; // TODO |
| 2451 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 2451 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 2452 | 2452 | ||
| ... | @@ -2571,7 +2571,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2571,7 +2571,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { |
| 2571 | const operand = extra.struct_operand; | 2571 | const operand = extra.struct_operand; |
| 2572 | const index = extra.field_index; | 2572 | const index = extra.field_index; |
| 2573 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2573 | 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.?; |
| 2575 | const mcv = try self.resolveInst(operand); | 2575 | const mcv = try self.resolveInst(operand); |
| 2576 | const struct_ty = self.typeOf(operand); | 2576 | const struct_ty = self.typeOf(operand); |
| 2577 | const struct_field_offset = @as(u32, @intCast(struct_ty.structFieldOffset(index, mod))); | 2577 | 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 { | ... | @@ -2704,7 +2704,7 @@ fn airUnionInit(self: *Self, inst: Air.Inst.Index) !void { |
| 2704 | } | 2704 | } |
| 2705 | 2705 | ||
| 2706 | fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void { | 2706 | fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2707 | const mod = self.bin_file.options.module.?; | 2707 | const mod = self.bin_file.comp.module.?; |
| 2708 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 2708 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2709 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2709 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2710 | const error_union_ty = self.typeOf(ty_op.operand); | 2710 | const error_union_ty = self.typeOf(ty_op.operand); |
| ... | @@ -2718,7 +2718,7 @@ fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2718,7 +2718,7 @@ fn airUnwrapErrErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2718 | } | 2718 | } |
| 2719 | 2719 | ||
| 2720 | fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void { | 2720 | fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 2721 | const mod = self.bin_file.options.module.?; | 2721 | const mod = self.bin_file.comp.module.?; |
| 2722 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 2722 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2723 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2723 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2724 | const error_union_ty = self.typeOf(ty_op.operand); | 2724 | const error_union_ty = self.typeOf(ty_op.operand); |
| ... | @@ -2732,7 +2732,7 @@ fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2732,7 +2732,7 @@ fn airUnwrapErrPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 2732 | 2732 | ||
| 2733 | /// E to E!T | 2733 | /// E to E!T |
| 2734 | fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { | 2734 | fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { |
| 2735 | const mod = self.bin_file.options.module.?; | 2735 | const mod = self.bin_file.comp.module.?; |
| 2736 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 2736 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2737 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2737 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2738 | const error_union_ty = ty_op.ty.toType(); | 2738 | const error_union_ty = ty_op.ty.toType(); |
| ... | @@ -2753,7 +2753,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2753,7 +2753,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 2753 | } | 2753 | } |
| 2754 | 2754 | ||
| 2755 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { | 2755 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { |
| 2756 | const mod = self.bin_file.options.module.?; | 2756 | const mod = self.bin_file.comp.module.?; |
| 2757 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 2757 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2758 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 2758 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 2759 | const optional_ty = self.typeOfIndex(inst); | 2759 | const optional_ty = self.typeOfIndex(inst); |
| ... | @@ -2793,7 +2793,7 @@ fn allocMem(self: *Self, inst: Air.Inst.Index, abi_size: u32, abi_align: Alignme | ... | @@ -2793,7 +2793,7 @@ fn allocMem(self: *Self, inst: Air.Inst.Index, abi_size: u32, abi_align: Alignme |
| 2793 | 2793 | ||
| 2794 | /// Use a pointer instruction as the basis for allocating stack memory. | 2794 | /// Use a pointer instruction as the basis for allocating stack memory. |
| 2795 | fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { | 2795 | fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { |
| 2796 | const mod = self.bin_file.options.module.?; | 2796 | const mod = self.bin_file.comp.module.?; |
| 2797 | const elem_ty = self.typeOfIndex(inst).childType(mod); | 2797 | const elem_ty = self.typeOfIndex(inst).childType(mod); |
| 2798 | 2798 | ||
| 2799 | if (!elem_ty.hasRuntimeBits(mod)) { | 2799 | if (!elem_ty.hasRuntimeBits(mod)) { |
| ... | @@ -2813,7 +2813,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { | ... | @@ -2813,7 +2813,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { |
| 2813 | } | 2813 | } |
| 2814 | 2814 | ||
| 2815 | fn allocRegOrMem(self: *Self, inst: Air.Inst.Index, reg_ok: bool) !MCValue { | 2815 | fn 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.?; |
| 2817 | const elem_ty = self.typeOfIndex(inst); | 2817 | const elem_ty = self.typeOfIndex(inst); |
| 2818 | const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse { | 2818 | const abi_size = math.cast(u32, elem_ty.abiSize(mod)) orelse { |
| 2819 | return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)}); | 2819 | return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)}); |
| ... | @@ -2860,7 +2860,7 @@ fn binOp( | ... | @@ -2860,7 +2860,7 @@ fn binOp( |
| 2860 | rhs_ty: Type, | 2860 | rhs_ty: Type, |
| 2861 | metadata: ?BinOpMetadata, | 2861 | metadata: ?BinOpMetadata, |
| 2862 | ) InnerError!MCValue { | 2862 | ) InnerError!MCValue { |
| 2863 | const mod = self.bin_file.options.module.?; | 2863 | const mod = self.bin_file.comp.module.?; |
| 2864 | switch (tag) { | 2864 | switch (tag) { |
| 2865 | .add, | 2865 | .add, |
| 2866 | .sub, | 2866 | .sub, |
| ... | @@ -3401,7 +3401,7 @@ fn binOpRegister( | ... | @@ -3401,7 +3401,7 @@ fn binOpRegister( |
| 3401 | fn br(self: *Self, block: Air.Inst.Index, operand: Air.Inst.Ref) !void { | 3401 | fn br(self: *Self, block: Air.Inst.Index, operand: Air.Inst.Ref) !void { |
| 3402 | const block_data = self.blocks.getPtr(block).?; | 3402 | const block_data = self.blocks.getPtr(block).?; |
| 3403 | 3403 | ||
| 3404 | const mod = self.bin_file.options.module.?; | 3404 | const mod = self.bin_file.comp.module.?; |
| 3405 | if (self.typeOf(operand).hasRuntimeBits(mod)) { | 3405 | if (self.typeOf(operand).hasRuntimeBits(mod)) { |
| 3406 | const operand_mcv = try self.resolveInst(operand); | 3406 | const operand_mcv = try self.resolveInst(operand); |
| 3407 | const block_mcv = block_data.mcv; | 3407 | const block_mcv = block_data.mcv; |
| ... | @@ -3521,7 +3521,7 @@ fn ensureProcessDeathCapacity(self: *Self, additional_count: usize) !void { | ... | @@ -3521,7 +3521,7 @@ fn ensureProcessDeathCapacity(self: *Self, additional_count: usize) !void { |
| 3521 | 3521 | ||
| 3522 | /// Given an error union, returns the payload | 3522 | /// Given an error union, returns the payload |
| 3523 | fn errUnionPayload(self: *Self, error_union_mcv: MCValue, error_union_ty: Type) !MCValue { | 3523 | fn 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.?; |
| 3525 | const err_ty = error_union_ty.errorUnionSet(mod); | 3525 | const err_ty = error_union_ty.errorUnionSet(mod); |
| 3526 | const payload_ty = error_union_ty.errorUnionPayload(mod); | 3526 | const payload_ty = error_union_ty.errorUnionPayload(mod); |
| 3527 | if (err_ty.errorSetIsEmpty(mod)) { | 3527 | if (err_ty.errorSetIsEmpty(mod)) { |
| ... | @@ -3591,7 +3591,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live | ... | @@ -3591,7 +3591,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live |
| 3591 | } | 3591 | } |
| 3592 | 3592 | ||
| 3593 | fn genArgDbgInfo(self: Self, inst: Air.Inst.Index, mcv: MCValue) !void { | 3593 | fn 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.?; |
| 3595 | const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg; | 3595 | const arg = self.air.instructions.items(.data)[@intFromEnum(inst)].arg; |
| 3596 | const ty = arg.ty.toType(); | 3596 | const ty = arg.ty.toType(); |
| 3597 | const owner_decl = mod.funcOwnerDeclIndex(self.func_index); | 3597 | 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 | ... | @@ -3740,7 +3740,7 @@ fn genLoadASI(self: *Self, value_reg: Register, addr_reg: Register, off_reg: Reg |
| 3740 | } | 3740 | } |
| 3741 | 3741 | ||
| 3742 | fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void { | 3742 | fn 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.?; |
| 3744 | switch (mcv) { | 3744 | switch (mcv) { |
| 3745 | .dead => unreachable, | 3745 | .dead => unreachable, |
| 3746 | .unreach, .none => return, // Nothing to do. | 3746 | .unreach, .none => return, // Nothing to do. |
| ... | @@ -3951,7 +3951,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void | ... | @@ -3951,7 +3951,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void |
| 3951 | } | 3951 | } |
| 3952 | 3952 | ||
| 3953 | fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerError!void { | 3953 | fn 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.?; |
| 3955 | const abi_size = ty.abiSize(mod); | 3955 | const abi_size = ty.abiSize(mod); |
| 3956 | switch (mcv) { | 3956 | switch (mcv) { |
| 3957 | .dead => unreachable, | 3957 | .dead => unreachable, |
| ... | @@ -4125,7 +4125,7 @@ fn genStoreASI(self: *Self, value_reg: Register, addr_reg: Register, off_reg: Re | ... | @@ -4125,7 +4125,7 @@ fn genStoreASI(self: *Self, value_reg: Register, addr_reg: Register, off_reg: Re |
| 4125 | } | 4125 | } |
| 4126 | 4126 | ||
| 4127 | fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { | 4127 | fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { |
| 4128 | const mod = self.bin_file.options.module.?; | 4128 | const mod = self.bin_file.comp.module.?; |
| 4129 | const mcv: MCValue = switch (try codegen.genTypedValue( | 4129 | const mcv: MCValue = switch (try codegen.genTypedValue( |
| 4130 | self.bin_file, | 4130 | self.bin_file, |
| 4131 | self.src_loc, | 4131 | self.src_loc, |
| ... | @@ -4161,7 +4161,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue { | ... | @@ -4161,7 +4161,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) MCValue { |
| 4161 | } | 4161 | } |
| 4162 | 4162 | ||
| 4163 | fn isErr(self: *Self, ty: Type, operand: MCValue) !MCValue { | 4163 | fn isErr(self: *Self, ty: Type, operand: MCValue) !MCValue { |
| 4164 | const mod = self.bin_file.options.module.?; | 4164 | const mod = self.bin_file.comp.module.?; |
| 4165 | const error_type = ty.errorUnionSet(mod); | 4165 | const error_type = ty.errorUnionSet(mod); |
| 4166 | const payload_type = ty.errorUnionPayload(mod); | 4166 | const payload_type = ty.errorUnionPayload(mod); |
| 4167 | 4167 | ||
| ... | @@ -4259,7 +4259,7 @@ fn jump(self: *Self, inst: Mir.Inst.Index) !void { | ... | @@ -4259,7 +4259,7 @@ fn jump(self: *Self, inst: Mir.Inst.Index) !void { |
| 4259 | } | 4259 | } |
| 4260 | 4260 | ||
| 4261 | fn load(self: *Self, dst_mcv: MCValue, ptr: MCValue, ptr_ty: Type) InnerError!void { | 4261 | fn 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.?; |
| 4263 | const elem_ty = ptr_ty.childType(mod); | 4263 | const elem_ty = ptr_ty.childType(mod); |
| 4264 | const elem_size = elem_ty.abiSize(mod); | 4264 | const elem_size = elem_ty.abiSize(mod); |
| 4265 | 4265 | ||
| ... | @@ -4330,7 +4330,7 @@ fn minMax( | ... | @@ -4330,7 +4330,7 @@ fn minMax( |
| 4330 | lhs_ty: Type, | 4330 | lhs_ty: Type, |
| 4331 | rhs_ty: Type, | 4331 | rhs_ty: Type, |
| 4332 | ) InnerError!MCValue { | 4332 | ) InnerError!MCValue { |
| 4333 | const mod = self.bin_file.options.module.?; | 4333 | const mod = self.bin_file.comp.module.?; |
| 4334 | assert(lhs_ty.eql(rhs_ty, mod)); | 4334 | assert(lhs_ty.eql(rhs_ty, mod)); |
| 4335 | switch (lhs_ty.zigTypeTag(mod)) { | 4335 | switch (lhs_ty.zigTypeTag(mod)) { |
| 4336 | .Float => return self.fail("TODO min/max on floats", .{}), | 4336 | .Float => return self.fail("TODO min/max on floats", .{}), |
| ... | @@ -4450,7 +4450,7 @@ fn realStackOffset(off: u32) u32 { | ... | @@ -4450,7 +4450,7 @@ fn realStackOffset(off: u32) u32 { |
| 4450 | 4450 | ||
| 4451 | /// Caller must call `CallMCValues.deinit`. | 4451 | /// Caller must call `CallMCValues.deinit`. |
| 4452 | fn resolveCallingConventionValues(self: *Self, fn_ty: Type, role: RegisterView) !CallMCValues { | 4452 | fn 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.?; |
| 4454 | const ip = &mod.intern_pool; | 4454 | const ip = &mod.intern_pool; |
| 4455 | const fn_info = mod.typeToFunc(fn_ty).?; | 4455 | const fn_info = mod.typeToFunc(fn_ty).?; |
| 4456 | const cc = fn_info.cc; | 4456 | const cc = fn_info.cc; |
| ... | @@ -4542,7 +4542,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type, role: RegisterView) | ... | @@ -4542,7 +4542,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type, role: RegisterView) |
| 4542 | } | 4542 | } |
| 4543 | 4543 | ||
| 4544 | fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!MCValue { | 4544 | fn 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.?; |
| 4546 | const ty = self.typeOf(ref); | 4546 | const ty = self.typeOf(ref); |
| 4547 | 4547 | ||
| 4548 | // If the type has no codegen bits, no need to store it. | 4548 | // 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 { | ... | @@ -4559,7 +4559,7 @@ fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!MCValue { |
| 4559 | } | 4559 | } |
| 4560 | 4560 | ||
| 4561 | fn ret(self: *Self, mcv: MCValue) !void { | 4561 | fn ret(self: *Self, mcv: MCValue) !void { |
| 4562 | const mod = self.bin_file.options.module.?; | 4562 | const mod = self.bin_file.comp.module.?; |
| 4563 | const ret_ty = self.fn_type.fnReturnType(mod); | 4563 | const ret_ty = self.fn_type.fnReturnType(mod); |
| 4564 | try self.setRegOrMem(ret_ty, self.ret_mcv, mcv); | 4564 | try self.setRegOrMem(ret_ty, self.ret_mcv, mcv); |
| 4565 | 4565 | ||
| ... | @@ -4661,7 +4661,7 @@ pub fn spillInstruction(self: *Self, reg: Register, inst: Air.Inst.Index) !void | ... | @@ -4661,7 +4661,7 @@ pub fn spillInstruction(self: *Self, reg: Register, inst: Air.Inst.Index) !void |
| 4661 | } | 4661 | } |
| 4662 | 4662 | ||
| 4663 | fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type) InnerError!void { | 4663 | fn 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.?; |
| 4665 | const abi_size = value_ty.abiSize(mod); | 4665 | const abi_size = value_ty.abiSize(mod); |
| 4666 | 4666 | ||
| 4667 | switch (ptr) { | 4667 | switch (ptr) { |
| ... | @@ -4703,7 +4703,7 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type | ... | @@ -4703,7 +4703,7 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type |
| 4703 | 4703 | ||
| 4704 | fn structFieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32) !MCValue { | 4704 | fn structFieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32) !MCValue { |
| 4705 | return if (self.liveness.isUnused(inst)) .dead else result: { | 4705 | 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.?; |
| 4707 | const mcv = try self.resolveInst(operand); | 4707 | const mcv = try self.resolveInst(operand); |
| 4708 | const ptr_ty = self.typeOf(operand); | 4708 | const ptr_ty = self.typeOf(operand); |
| 4709 | const struct_ty = ptr_ty.childType(mod); | 4709 | const struct_ty = ptr_ty.childType(mod); |
| ... | @@ -4745,7 +4745,7 @@ fn trunc( | ... | @@ -4745,7 +4745,7 @@ fn trunc( |
| 4745 | operand_ty: Type, | 4745 | operand_ty: Type, |
| 4746 | dest_ty: Type, | 4746 | dest_ty: Type, |
| 4747 | ) !MCValue { | 4747 | ) !MCValue { |
| 4748 | const mod = self.bin_file.options.module.?; | 4748 | const mod = self.bin_file.comp.module.?; |
| 4749 | const info_a = operand_ty.intInfo(mod); | 4749 | const info_a = operand_ty.intInfo(mod); |
| 4750 | const info_b = dest_ty.intInfo(mod); | 4750 | const info_b = dest_ty.intInfo(mod); |
| 4751 | 4751 | ||
| ... | @@ -4866,11 +4866,11 @@ fn wantSafety(self: *Self) bool { | ... | @@ -4866,11 +4866,11 @@ fn wantSafety(self: *Self) bool { |
| 4866 | } | 4866 | } |
| 4867 | 4867 | ||
| 4868 | fn typeOf(self: *Self, inst: Air.Inst.Ref) Type { | 4868 | fn typeOf(self: *Self, inst: Air.Inst.Ref) Type { |
| 4869 | const mod = self.bin_file.options.module.?; | 4869 | const mod = self.bin_file.comp.module.?; |
| 4870 | return self.air.typeOf(inst, &mod.intern_pool); | 4870 | return self.air.typeOf(inst, &mod.intern_pool); |
| 4871 | } | 4871 | } |
| 4872 | 4872 | ||
| 4873 | fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type { | 4873 | fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type { |
| 4874 | const mod = self.bin_file.options.module.?; | 4874 | const mod = self.bin_file.comp.module.?; |
| 4875 | return self.air.typeOfIndex(inst, &mod.intern_pool); | 4875 | return self.air.typeOfIndex(inst, &mod.intern_pool); |
| 4876 | } | 4876 | } |
src/arch/wasm/CodeGen.zig+1-1| ... | @@ -1210,7 +1210,7 @@ pub fn generate( | ... | @@ -1210,7 +1210,7 @@ pub fn generate( |
| 1210 | debug_output: codegen.DebugInfoOutput, | 1210 | debug_output: codegen.DebugInfoOutput, |
| 1211 | ) codegen.CodeGenError!codegen.Result { | 1211 | ) codegen.CodeGenError!codegen.Result { |
| 1212 | _ = src_loc; | 1212 | _ = src_loc; |
| 1213 | const mod = bin_file.options.module.?; | 1213 | const mod = bin_file.comp.module.?; |
| 1214 | const func = mod.funcInfo(func_index); | 1214 | const func = mod.funcInfo(func_index); |
| 1215 | var code_gen: CodeGen = .{ | 1215 | var code_gen: CodeGen = .{ |
| 1216 | .gpa = bin_file.allocator, | 1216 | .gpa = bin_file.allocator, |
src/arch/x86_64/CodeGen.zig+120-120| ... | @@ -131,7 +131,7 @@ const Owner = union(enum) { | ... | @@ -131,7 +131,7 @@ const Owner = union(enum) { |
| 131 | fn getSymbolIndex(owner: Owner, ctx: *Self) !u32 { | 131 | fn getSymbolIndex(owner: Owner, ctx: *Self) !u32 { |
| 132 | switch (owner) { | 132 | switch (owner) { |
| 133 | .func_index => |func_index| { | 133 | .func_index => |func_index| { |
| 134 | const mod = ctx.bin_file.options.module.?; | 134 | const mod = ctx.bin_file.comp.module.?; |
| 135 | const decl_index = mod.funcOwnerDeclIndex(func_index); | 135 | const decl_index = mod.funcOwnerDeclIndex(func_index); |
| 136 | if (ctx.bin_file.cast(link.File.Elf)) |elf_file| { | 136 | if (ctx.bin_file.cast(link.File.Elf)) |elf_file| { |
| 137 | return elf_file.zigObjectPtr().?.getOrCreateMetadataForDecl(elf_file, decl_index); | 137 | return elf_file.zigObjectPtr().?.getOrCreateMetadataForDecl(elf_file, decl_index); |
| ... | @@ -799,7 +799,7 @@ pub fn generate( | ... | @@ -799,7 +799,7 @@ pub fn generate( |
| 799 | @panic("Attempted to compile for architecture that was disabled by build configuration"); | 799 | @panic("Attempted to compile for architecture that was disabled by build configuration"); |
| 800 | } | 800 | } |
| 801 | 801 | ||
| 802 | const mod = bin_file.options.module.?; | 802 | const mod = bin_file.comp.module.?; |
| 803 | const func = mod.funcInfo(func_index); | 803 | const func = mod.funcInfo(func_index); |
| 804 | const fn_owner_decl = mod.declPtr(func.owner_decl); | 804 | const fn_owner_decl = mod.declPtr(func.owner_decl); |
| 805 | assert(fn_owner_decl.has_tv); | 805 | assert(fn_owner_decl.has_tv); |
| ... | @@ -1060,7 +1060,7 @@ fn formatDecl( | ... | @@ -1060,7 +1060,7 @@ fn formatDecl( |
| 1060 | } | 1060 | } |
| 1061 | fn fmtDecl(self: *Self, decl_index: InternPool.DeclIndex) std.fmt.Formatter(formatDecl) { | 1061 | fn fmtDecl(self: *Self, decl_index: InternPool.DeclIndex) std.fmt.Formatter(formatDecl) { |
| 1062 | return .{ .data = .{ | 1062 | return .{ .data = .{ |
| 1063 | .mod = self.bin_file.options.module.?, | 1063 | .mod = self.bin_file.comp.module.?, |
| 1064 | .decl_index = decl_index, | 1064 | .decl_index = decl_index, |
| 1065 | } }; | 1065 | } }; |
| 1066 | } | 1066 | } |
| ... | @@ -1077,7 +1077,7 @@ fn formatAir( | ... | @@ -1077,7 +1077,7 @@ fn formatAir( |
| 1077 | ) @TypeOf(writer).Error!void { | 1077 | ) @TypeOf(writer).Error!void { |
| 1078 | @import("../../print_air.zig").dumpInst( | 1078 | @import("../../print_air.zig").dumpInst( |
| 1079 | data.inst, | 1079 | data.inst, |
| 1080 | data.self.bin_file.options.module.?, | 1080 | data.self.bin_file.comp.module.?, |
| 1081 | data.self.air, | 1081 | data.self.air, |
| 1082 | data.self.liveness, | 1082 | data.self.liveness, |
| 1083 | ); | 1083 | ); |
| ... | @@ -1683,7 +1683,7 @@ fn asmMemoryRegisterImmediate( | ... | @@ -1683,7 +1683,7 @@ fn asmMemoryRegisterImmediate( |
| 1683 | } | 1683 | } |
| 1684 | 1684 | ||
| 1685 | fn gen(self: *Self) InnerError!void { | 1685 | fn gen(self: *Self) InnerError!void { |
| 1686 | const mod = self.bin_file.options.module.?; | 1686 | const mod = self.bin_file.comp.module.?; |
| 1687 | const fn_info = mod.typeToFunc(self.fn_type).?; | 1687 | const fn_info = mod.typeToFunc(self.fn_type).?; |
| 1688 | const cc = abi.resolveCallingConvention(fn_info.cc, self.target.*); | 1688 | const cc = abi.resolveCallingConvention(fn_info.cc, self.target.*); |
| 1689 | if (cc != .Naked) { | 1689 | if (cc != .Naked) { |
| ... | @@ -1885,7 +1885,7 @@ fn gen(self: *Self) InnerError!void { | ... | @@ -1885,7 +1885,7 @@ fn gen(self: *Self) InnerError!void { |
| 1885 | } | 1885 | } |
| 1886 | 1886 | ||
| 1887 | fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { | 1887 | fn 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.?; |
| 1889 | const ip = &mod.intern_pool; | 1889 | const ip = &mod.intern_pool; |
| 1890 | const air_tags = self.air.instructions.items(.tag); | 1890 | const air_tags = self.air.instructions.items(.tag); |
| 1891 | 1891 | ||
| ... | @@ -2167,7 +2167,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { | ... | @@ -2167,7 +2167,7 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { |
| 2167 | } | 2167 | } |
| 2168 | 2168 | ||
| 2169 | fn genLazy(self: *Self, lazy_sym: link.File.LazySymbol) InnerError!void { | 2169 | fn 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.?; |
| 2171 | switch (lazy_sym.ty.zigTypeTag(mod)) { | 2171 | switch (lazy_sym.ty.zigTypeTag(mod)) { |
| 2172 | .Enum => { | 2172 | .Enum => { |
| 2173 | const enum_ty = lazy_sym.ty; | 2173 | const enum_ty = lazy_sym.ty; |
| ... | @@ -2418,7 +2418,7 @@ fn allocFrameIndex(self: *Self, alloc: FrameAlloc) !FrameIndex { | ... | @@ -2418,7 +2418,7 @@ fn allocFrameIndex(self: *Self, alloc: FrameAlloc) !FrameIndex { |
| 2418 | 2418 | ||
| 2419 | /// Use a pointer instruction as the basis for allocating stack memory. | 2419 | /// Use a pointer instruction as the basis for allocating stack memory. |
| 2420 | fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !FrameIndex { | 2420 | fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !FrameIndex { |
| 2421 | const mod = self.bin_file.options.module.?; | 2421 | const mod = self.bin_file.comp.module.?; |
| 2422 | const ptr_ty = self.typeOfIndex(inst); | 2422 | const ptr_ty = self.typeOfIndex(inst); |
| 2423 | const val_ty = ptr_ty.childType(mod); | 2423 | const val_ty = ptr_ty.childType(mod); |
| 2424 | return self.allocFrameIndex(FrameAlloc.init(.{ | 2424 | return self.allocFrameIndex(FrameAlloc.init(.{ |
| ... | @@ -2438,7 +2438,7 @@ fn allocTempRegOrMem(self: *Self, elem_ty: Type, reg_ok: bool) !MCValue { | ... | @@ -2438,7 +2438,7 @@ fn allocTempRegOrMem(self: *Self, elem_ty: Type, reg_ok: bool) !MCValue { |
| 2438 | } | 2438 | } |
| 2439 | 2439 | ||
| 2440 | fn allocRegOrMemAdvanced(self: *Self, ty: Type, inst: ?Air.Inst.Index, reg_ok: bool) !MCValue { | 2440 | fn 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.?; |
| 2442 | const abi_size = math.cast(u32, ty.abiSize(mod)) orelse { | 2442 | const abi_size = math.cast(u32, ty.abiSize(mod)) orelse { |
| 2443 | return self.fail("type '{}' too big to fit into stack frame", .{ty.fmt(mod)}); | 2443 | return self.fail("type '{}' too big to fit into stack frame", .{ty.fmt(mod)}); |
| 2444 | }; | 2444 | }; |
| ... | @@ -2471,7 +2471,7 @@ fn allocRegOrMemAdvanced(self: *Self, ty: Type, inst: ?Air.Inst.Index, reg_ok: b | ... | @@ -2471,7 +2471,7 @@ fn allocRegOrMemAdvanced(self: *Self, ty: Type, inst: ?Air.Inst.Index, reg_ok: b |
| 2471 | } | 2471 | } |
| 2472 | 2472 | ||
| 2473 | fn regClassForType(self: *Self, ty: Type) RegisterManager.RegisterBitSet { | 2473 | fn regClassForType(self: *Self, ty: Type) RegisterManager.RegisterBitSet { |
| 2474 | const mod = self.bin_file.options.module.?; | 2474 | const mod = self.bin_file.comp.module.?; |
| 2475 | return switch (ty.zigTypeTag(mod)) { | 2475 | return switch (ty.zigTypeTag(mod)) { |
| 2476 | .Float => switch (ty.floatBits(self.target.*)) { | 2476 | .Float => switch (ty.floatBits(self.target.*)) { |
| 2477 | 80 => abi.RegisterClass.x87, | 2477 | 80 => abi.RegisterClass.x87, |
| ... | @@ -2884,7 +2884,7 @@ fn airFpext(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2884,7 +2884,7 @@ fn airFpext(self: *Self, inst: Air.Inst.Index) !void { |
| 2884 | } | 2884 | } |
| 2885 | 2885 | ||
| 2886 | fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { | 2886 | fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { |
| 2887 | const mod = self.bin_file.options.module.?; | 2887 | const mod = self.bin_file.comp.module.?; |
| 2888 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 2888 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2889 | const result: MCValue = result: { | 2889 | const result: MCValue = result: { |
| 2890 | const src_ty = self.typeOf(ty_op.operand); | 2890 | const src_ty = self.typeOf(ty_op.operand); |
| ... | @@ -2975,7 +2975,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -2975,7 +2975,7 @@ fn airIntCast(self: *Self, inst: Air.Inst.Index) !void { |
| 2975 | } | 2975 | } |
| 2976 | 2976 | ||
| 2977 | fn airTrunc(self: *Self, inst: Air.Inst.Index) !void { | 2977 | fn airTrunc(self: *Self, inst: Air.Inst.Index) !void { |
| 2978 | const mod = self.bin_file.options.module.?; | 2978 | const mod = self.bin_file.comp.module.?; |
| 2979 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 2979 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 2980 | 2980 | ||
| 2981 | const dst_ty = self.typeOfIndex(inst); | 2981 | const dst_ty = self.typeOfIndex(inst); |
| ... | @@ -3102,7 +3102,7 @@ fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3102,7 +3102,7 @@ fn airIntFromBool(self: *Self, inst: Air.Inst.Index) !void { |
| 3102 | } | 3102 | } |
| 3103 | 3103 | ||
| 3104 | fn airSlice(self: *Self, inst: Air.Inst.Index) !void { | 3104 | fn airSlice(self: *Self, inst: Air.Inst.Index) !void { |
| 3105 | const mod = self.bin_file.options.module.?; | 3105 | const mod = self.bin_file.comp.module.?; |
| 3106 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 3106 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 3107 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 3107 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3108 | 3108 | ||
| ... | @@ -3131,7 +3131,7 @@ fn airUnOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { | ... | @@ -3131,7 +3131,7 @@ fn airUnOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { |
| 3131 | } | 3131 | } |
| 3132 | 3132 | ||
| 3133 | fn airBinOp(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void { | 3133 | fn 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.?; |
| 3135 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 3135 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 3136 | const dst_mcv = try self.genBinOp(inst, tag, bin_op.lhs, bin_op.rhs); | 3136 | const dst_mcv = try self.genBinOp(inst, tag, bin_op.lhs, bin_op.rhs); |
| 3137 | 3137 | ||
| ... | @@ -3172,7 +3172,7 @@ fn airPtrArithmetic(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void | ... | @@ -3172,7 +3172,7 @@ fn airPtrArithmetic(self: *Self, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void |
| 3172 | } | 3172 | } |
| 3173 | 3173 | ||
| 3174 | fn activeIntBits(self: *Self, dst_air: Air.Inst.Ref) u16 { | 3174 | fn 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.?; |
| 3176 | const air_tag = self.air.instructions.items(.tag); | 3176 | const air_tag = self.air.instructions.items(.tag); |
| 3177 | const air_data = self.air.instructions.items(.data); | 3177 | const air_data = self.air.instructions.items(.data); |
| 3178 | 3178 | ||
| ... | @@ -3206,7 +3206,7 @@ fn activeIntBits(self: *Self, dst_air: Air.Inst.Ref) u16 { | ... | @@ -3206,7 +3206,7 @@ fn activeIntBits(self: *Self, dst_air: Air.Inst.Ref) u16 { |
| 3206 | } | 3206 | } |
| 3207 | 3207 | ||
| 3208 | fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void { | 3208 | fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void { |
| 3209 | const mod = self.bin_file.options.module.?; | 3209 | const mod = self.bin_file.comp.module.?; |
| 3210 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 3210 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 3211 | const result = result: { | 3211 | const result = result: { |
| 3212 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | 3212 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; |
| ... | @@ -3432,7 +3432,7 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3432,7 +3432,7 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void { |
| 3432 | } | 3432 | } |
| 3433 | 3433 | ||
| 3434 | fn airAddSat(self: *Self, inst: Air.Inst.Index) !void { | 3434 | fn airAddSat(self: *Self, inst: Air.Inst.Index) !void { |
| 3435 | const mod = self.bin_file.options.module.?; | 3435 | const mod = self.bin_file.comp.module.?; |
| 3436 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 3436 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 3437 | const ty = self.typeOf(bin_op.lhs); | 3437 | const ty = self.typeOf(bin_op.lhs); |
| 3438 | if (ty.zigTypeTag(mod) == .Vector or ty.abiSize(mod) > 8) return self.fail( | 3438 | 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 { | ... | @@ -3515,7 +3515,7 @@ fn airAddSat(self: *Self, inst: Air.Inst.Index) !void { |
| 3515 | } | 3515 | } |
| 3516 | 3516 | ||
| 3517 | fn airSubSat(self: *Self, inst: Air.Inst.Index) !void { | 3517 | fn airSubSat(self: *Self, inst: Air.Inst.Index) !void { |
| 3518 | const mod = self.bin_file.options.module.?; | 3518 | const mod = self.bin_file.comp.module.?; |
| 3519 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 3519 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 3520 | const ty = self.typeOf(bin_op.lhs); | 3520 | const ty = self.typeOf(bin_op.lhs); |
| 3521 | if (ty.zigTypeTag(mod) == .Vector or ty.abiSize(mod) > 8) return self.fail( | 3521 | 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 { | ... | @@ -3591,7 +3591,7 @@ fn airSubSat(self: *Self, inst: Air.Inst.Index) !void { |
| 3591 | } | 3591 | } |
| 3592 | 3592 | ||
| 3593 | fn airMulSat(self: *Self, inst: Air.Inst.Index) !void { | 3593 | fn airMulSat(self: *Self, inst: Air.Inst.Index) !void { |
| 3594 | const mod = self.bin_file.options.module.?; | 3594 | const mod = self.bin_file.comp.module.?; |
| 3595 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 3595 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 3596 | const ty = self.typeOf(bin_op.lhs); | 3596 | const ty = self.typeOf(bin_op.lhs); |
| 3597 | 3597 | ||
| ... | @@ -3731,7 +3731,7 @@ fn airMulSat(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3731,7 +3731,7 @@ fn airMulSat(self: *Self, inst: Air.Inst.Index) !void { |
| 3731 | } | 3731 | } |
| 3732 | 3732 | ||
| 3733 | fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | 3733 | fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 3734 | const mod = self.bin_file.options.module.?; | 3734 | const mod = self.bin_file.comp.module.?; |
| 3735 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 3735 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 3736 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 3736 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3737 | const result: MCValue = result: { | 3737 | const result: MCValue = result: { |
| ... | @@ -3792,7 +3792,7 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3792,7 +3792,7 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 3792 | } | 3792 | } |
| 3793 | 3793 | ||
| 3794 | fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | 3794 | fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 3795 | const mod = self.bin_file.options.module.?; | 3795 | const mod = self.bin_file.comp.module.?; |
| 3796 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 3796 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 3797 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 3797 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3798 | const result: MCValue = result: { | 3798 | const result: MCValue = result: { |
| ... | @@ -3871,7 +3871,7 @@ fn genSetFrameTruncatedOverflowCompare( | ... | @@ -3871,7 +3871,7 @@ fn genSetFrameTruncatedOverflowCompare( |
| 3871 | src_mcv: MCValue, | 3871 | src_mcv: MCValue, |
| 3872 | overflow_cc: ?Condition, | 3872 | overflow_cc: ?Condition, |
| 3873 | ) !void { | 3873 | ) !void { |
| 3874 | const mod = self.bin_file.options.module.?; | 3874 | const mod = self.bin_file.comp.module.?; |
| 3875 | const src_lock = switch (src_mcv) { | 3875 | const src_lock = switch (src_mcv) { |
| 3876 | .register => |reg| self.register_manager.lockReg(reg), | 3876 | .register => |reg| self.register_manager.lockReg(reg), |
| 3877 | else => null, | 3877 | else => null, |
| ... | @@ -3935,7 +3935,7 @@ fn genSetFrameTruncatedOverflowCompare( | ... | @@ -3935,7 +3935,7 @@ fn genSetFrameTruncatedOverflowCompare( |
| 3935 | } | 3935 | } |
| 3936 | 3936 | ||
| 3937 | fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | 3937 | fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 3938 | const mod = self.bin_file.options.module.?; | 3938 | const mod = self.bin_file.comp.module.?; |
| 3939 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 3939 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 3940 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; | 3940 | const bin_op = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 3941 | const tuple_ty = self.typeOfIndex(inst); | 3941 | const tuple_ty = self.typeOfIndex(inst); |
| ... | @@ -4169,7 +4169,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4169,7 +4169,7 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void { |
| 4169 | /// Clobbers .rax and .rdx registers. | 4169 | /// Clobbers .rax and .rdx registers. |
| 4170 | /// Quotient is saved in .rax and remainder in .rdx. | 4170 | /// Quotient is saved in .rax and remainder in .rdx. |
| 4171 | fn genIntMulDivOpMir(self: *Self, tag: Mir.Inst.FixedTag, ty: Type, lhs: MCValue, rhs: MCValue) !void { | 4171 | fn 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.?; |
| 4173 | const abi_size: u32 = @intCast(ty.abiSize(mod)); | 4173 | const abi_size: u32 = @intCast(ty.abiSize(mod)); |
| 4174 | const bit_size: u32 = @intCast(self.regBitSize(ty)); | 4174 | const bit_size: u32 = @intCast(self.regBitSize(ty)); |
| 4175 | if (abi_size > 8) { | 4175 | if (abi_size > 8) { |
| ... | @@ -4219,7 +4219,7 @@ fn genIntMulDivOpMir(self: *Self, tag: Mir.Inst.FixedTag, ty: Type, lhs: MCValue | ... | @@ -4219,7 +4219,7 @@ fn genIntMulDivOpMir(self: *Self, tag: Mir.Inst.FixedTag, ty: Type, lhs: MCValue |
| 4219 | /// Always returns a register. | 4219 | /// Always returns a register. |
| 4220 | /// Clobbers .rax and .rdx registers. | 4220 | /// Clobbers .rax and .rdx registers. |
| 4221 | fn genInlineIntDivFloor(self: *Self, ty: Type, lhs: MCValue, rhs: MCValue) !MCValue { | 4221 | fn 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.?; |
| 4223 | const abi_size: u32 = @intCast(ty.abiSize(mod)); | 4223 | const abi_size: u32 = @intCast(ty.abiSize(mod)); |
| 4224 | const int_info = ty.intInfo(mod); | 4224 | const int_info = ty.intInfo(mod); |
| 4225 | const dividend = switch (lhs) { | 4225 | const dividend = switch (lhs) { |
| ... | @@ -4271,7 +4271,7 @@ fn genInlineIntDivFloor(self: *Self, ty: Type, lhs: MCValue, rhs: MCValue) !MCVa | ... | @@ -4271,7 +4271,7 @@ fn genInlineIntDivFloor(self: *Self, ty: Type, lhs: MCValue, rhs: MCValue) !MCVa |
| 4271 | } | 4271 | } |
| 4272 | 4272 | ||
| 4273 | fn airShlShrBinOp(self: *Self, inst: Air.Inst.Index) !void { | 4273 | fn airShlShrBinOp(self: *Self, inst: Air.Inst.Index) !void { |
| 4274 | const mod = self.bin_file.options.module.?; | 4274 | const mod = self.bin_file.comp.module.?; |
| 4275 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 4275 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 4276 | 4276 | ||
| 4277 | const air_tags = self.air.instructions.items(.tag); | 4277 | const air_tags = self.air.instructions.items(.tag); |
| ... | @@ -4546,7 +4546,7 @@ fn airShlSat(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4546,7 +4546,7 @@ fn airShlSat(self: *Self, inst: Air.Inst.Index) !void { |
| 4546 | } | 4546 | } |
| 4547 | 4547 | ||
| 4548 | fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) !void { | 4548 | fn airOptionalPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 4549 | const mod = self.bin_file.options.module.?; | 4549 | const mod = self.bin_file.comp.module.?; |
| 4550 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 4550 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4551 | const result: MCValue = result: { | 4551 | const result: MCValue = result: { |
| 4552 | const pl_ty = self.typeOfIndex(inst); | 4552 | const pl_ty = self.typeOfIndex(inst); |
| ... | @@ -4592,7 +4592,7 @@ fn airOptionalPayloadPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4592,7 +4592,7 @@ fn airOptionalPayloadPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 4592 | } | 4592 | } |
| 4593 | 4593 | ||
| 4594 | fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { | 4594 | fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { |
| 4595 | const mod = self.bin_file.options.module.?; | 4595 | const mod = self.bin_file.comp.module.?; |
| 4596 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 4596 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4597 | const result = result: { | 4597 | const result = result: { |
| 4598 | const dst_ty = self.typeOfIndex(inst); | 4598 | const dst_ty = self.typeOfIndex(inst); |
| ... | @@ -4626,7 +4626,7 @@ fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4626,7 +4626,7 @@ fn airOptionalPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { |
| 4626 | } | 4626 | } |
| 4627 | 4627 | ||
| 4628 | fn airUnwrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { | 4628 | fn airUnwrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { |
| 4629 | const mod = self.bin_file.options.module.?; | 4629 | const mod = self.bin_file.comp.module.?; |
| 4630 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 4630 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4631 | const err_union_ty = self.typeOf(ty_op.operand); | 4631 | const err_union_ty = self.typeOf(ty_op.operand); |
| 4632 | const err_ty = err_union_ty.errorUnionSet(mod); | 4632 | const err_ty = err_union_ty.errorUnionSet(mod); |
| ... | @@ -4678,7 +4678,7 @@ fn airUnwrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4678,7 +4678,7 @@ fn airUnwrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 4678 | 4678 | ||
| 4679 | // *(E!T) -> E | 4679 | // *(E!T) -> E |
| 4680 | fn airUnwrapErrUnionErrPtr(self: *Self, inst: Air.Inst.Index) !void { | 4680 | fn airUnwrapErrUnionErrPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 4681 | const mod = self.bin_file.options.module.?; | 4681 | const mod = self.bin_file.comp.module.?; |
| 4682 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 4682 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4683 | 4683 | ||
| 4684 | const src_ty = self.typeOf(ty_op.operand); | 4684 | const src_ty = self.typeOf(ty_op.operand); |
| ... | @@ -4725,7 +4725,7 @@ fn airUnwrapErrUnionPayloadPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4725,7 +4725,7 @@ fn airUnwrapErrUnionPayloadPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 4725 | } | 4725 | } |
| 4726 | 4726 | ||
| 4727 | fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { | 4727 | fn airErrUnionPayloadPtrSet(self: *Self, inst: Air.Inst.Index) !void { |
| 4728 | const mod = self.bin_file.options.module.?; | 4728 | const mod = self.bin_file.comp.module.?; |
| 4729 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 4729 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4730 | const result: MCValue = result: { | 4730 | const result: MCValue = result: { |
| 4731 | const src_ty = self.typeOf(ty_op.operand); | 4731 | const src_ty = self.typeOf(ty_op.operand); |
| ... | @@ -4785,7 +4785,7 @@ fn genUnwrapErrUnionPayloadMir( | ... | @@ -4785,7 +4785,7 @@ fn genUnwrapErrUnionPayloadMir( |
| 4785 | err_union_ty: Type, | 4785 | err_union_ty: Type, |
| 4786 | err_union: MCValue, | 4786 | err_union: MCValue, |
| 4787 | ) !MCValue { | 4787 | ) !MCValue { |
| 4788 | const mod = self.bin_file.options.module.?; | 4788 | const mod = self.bin_file.comp.module.?; |
| 4789 | const payload_ty = err_union_ty.errorUnionPayload(mod); | 4789 | const payload_ty = err_union_ty.errorUnionPayload(mod); |
| 4790 | 4790 | ||
| 4791 | const result: MCValue = result: { | 4791 | const result: MCValue = result: { |
| ... | @@ -4833,7 +4833,7 @@ fn genUnwrapErrUnionPayloadPtrMir( | ... | @@ -4833,7 +4833,7 @@ fn genUnwrapErrUnionPayloadPtrMir( |
| 4833 | ptr_ty: Type, | 4833 | ptr_ty: Type, |
| 4834 | ptr_mcv: MCValue, | 4834 | ptr_mcv: MCValue, |
| 4835 | ) !MCValue { | 4835 | ) !MCValue { |
| 4836 | const mod = self.bin_file.options.module.?; | 4836 | const mod = self.bin_file.comp.module.?; |
| 4837 | const err_union_ty = ptr_ty.childType(mod); | 4837 | const err_union_ty = ptr_ty.childType(mod); |
| 4838 | const payload_ty = err_union_ty.errorUnionPayload(mod); | 4838 | const payload_ty = err_union_ty.errorUnionPayload(mod); |
| 4839 | 4839 | ||
| ... | @@ -4867,7 +4867,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4867,7 +4867,7 @@ fn airSaveErrReturnTraceIndex(self: *Self, inst: Air.Inst.Index) !void { |
| 4867 | } | 4867 | } |
| 4868 | 4868 | ||
| 4869 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { | 4869 | fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { |
| 4870 | const mod = self.bin_file.options.module.?; | 4870 | const mod = self.bin_file.comp.module.?; |
| 4871 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 4871 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4872 | const result: MCValue = result: { | 4872 | const result: MCValue = result: { |
| 4873 | const pl_ty = self.typeOf(ty_op.operand); | 4873 | const pl_ty = self.typeOf(ty_op.operand); |
| ... | @@ -4921,7 +4921,7 @@ fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4921,7 +4921,7 @@ fn airWrapOptional(self: *Self, inst: Air.Inst.Index) !void { |
| 4921 | 4921 | ||
| 4922 | /// T to E!T | 4922 | /// T to E!T |
| 4923 | fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { | 4923 | fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 4924 | const mod = self.bin_file.options.module.?; | 4924 | const mod = self.bin_file.comp.module.?; |
| 4925 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 4925 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4926 | 4926 | ||
| 4927 | const eu_ty = ty_op.ty.toType(); | 4927 | const eu_ty = ty_op.ty.toType(); |
| ... | @@ -4944,7 +4944,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4944,7 +4944,7 @@ fn airWrapErrUnionPayload(self: *Self, inst: Air.Inst.Index) !void { |
| 4944 | 4944 | ||
| 4945 | /// E to E!T | 4945 | /// E to E!T |
| 4946 | fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { | 4946 | fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { |
| 4947 | const mod = self.bin_file.options.module.?; | 4947 | const mod = self.bin_file.comp.module.?; |
| 4948 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 4948 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 4949 | 4949 | ||
| 4950 | const eu_ty = ty_op.ty.toType(); | 4950 | const eu_ty = ty_op.ty.toType(); |
| ... | @@ -5003,7 +5003,7 @@ fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5003,7 +5003,7 @@ fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void { |
| 5003 | } | 5003 | } |
| 5004 | 5004 | ||
| 5005 | fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void { | 5005 | fn airPtrSliceLenPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 5006 | const mod = self.bin_file.options.module.?; | 5006 | const mod = self.bin_file.comp.module.?; |
| 5007 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 5007 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5008 | 5008 | ||
| 5009 | const src_ty = self.typeOf(ty_op.operand); | 5009 | 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 | ... | @@ -5071,7 +5071,7 @@ fn elemOffset(self: *Self, index_ty: Type, index: MCValue, elem_size: u64) !Regi |
| 5071 | } | 5071 | } |
| 5072 | 5072 | ||
| 5073 | fn genSliceElemPtr(self: *Self, lhs: Air.Inst.Ref, rhs: Air.Inst.Ref) !MCValue { | 5073 | fn 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.?; |
| 5075 | const slice_ty = self.typeOf(lhs); | 5075 | const slice_ty = self.typeOf(lhs); |
| 5076 | const slice_mcv = try self.resolveInst(lhs); | 5076 | const slice_mcv = try self.resolveInst(lhs); |
| 5077 | const slice_mcv_lock: ?RegisterLock = switch (slice_mcv) { | 5077 | 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 { | ... | @@ -5107,7 +5107,7 @@ fn genSliceElemPtr(self: *Self, lhs: Air.Inst.Ref, rhs: Air.Inst.Ref) !MCValue { |
| 5107 | } | 5107 | } |
| 5108 | 5108 | ||
| 5109 | fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { | 5109 | fn airSliceElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 5110 | const mod = self.bin_file.options.module.?; | 5110 | const mod = self.bin_file.comp.module.?; |
| 5111 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 5111 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 5112 | 5112 | ||
| 5113 | const result: MCValue = result: { | 5113 | const result: MCValue = result: { |
| ... | @@ -5132,7 +5132,7 @@ fn airSliceElemPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5132,7 +5132,7 @@ fn airSliceElemPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 5132 | } | 5132 | } |
| 5133 | 5133 | ||
| 5134 | fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { | 5134 | fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 5135 | const mod = self.bin_file.options.module.?; | 5135 | const mod = self.bin_file.comp.module.?; |
| 5136 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 5136 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 5137 | 5137 | ||
| 5138 | const result: MCValue = result: { | 5138 | const result: MCValue = result: { |
| ... | @@ -5246,7 +5246,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5246,7 +5246,7 @@ fn airArrayElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 5246 | } | 5246 | } |
| 5247 | 5247 | ||
| 5248 | fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { | 5248 | fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 5249 | const mod = self.bin_file.options.module.?; | 5249 | const mod = self.bin_file.comp.module.?; |
| 5250 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 5250 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 5251 | const ptr_ty = self.typeOf(bin_op.lhs); | 5251 | const ptr_ty = self.typeOf(bin_op.lhs); |
| 5252 | 5252 | ||
| ... | @@ -5296,7 +5296,7 @@ fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5296,7 +5296,7 @@ fn airPtrElemVal(self: *Self, inst: Air.Inst.Index) !void { |
| 5296 | } | 5296 | } |
| 5297 | 5297 | ||
| 5298 | fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void { | 5298 | fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 5299 | const mod = self.bin_file.options.module.?; | 5299 | const mod = self.bin_file.comp.module.?; |
| 5300 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 5300 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 5301 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; | 5301 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5302 | 5302 | ||
| ... | @@ -5341,7 +5341,7 @@ fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5341,7 +5341,7 @@ fn airPtrElemPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 5341 | } | 5341 | } |
| 5342 | 5342 | ||
| 5343 | fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void { | 5343 | fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void { |
| 5344 | const mod = self.bin_file.options.module.?; | 5344 | const mod = self.bin_file.comp.module.?; |
| 5345 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 5345 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 5346 | const ptr_union_ty = self.typeOf(bin_op.lhs); | 5346 | const ptr_union_ty = self.typeOf(bin_op.lhs); |
| 5347 | const union_ty = ptr_union_ty.childType(mod); | 5347 | const union_ty = ptr_union_ty.childType(mod); |
| ... | @@ -5385,7 +5385,7 @@ fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5385,7 +5385,7 @@ fn airSetUnionTag(self: *Self, inst: Air.Inst.Index) !void { |
| 5385 | } | 5385 | } |
| 5386 | 5386 | ||
| 5387 | fn airGetUnionTag(self: *Self, inst: Air.Inst.Index) !void { | 5387 | fn airGetUnionTag(self: *Self, inst: Air.Inst.Index) !void { |
| 5388 | const mod = self.bin_file.options.module.?; | 5388 | const mod = self.bin_file.comp.module.?; |
| 5389 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 5389 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5390 | 5390 | ||
| 5391 | const tag_ty = self.typeOfIndex(inst); | 5391 | const tag_ty = self.typeOfIndex(inst); |
| ... | @@ -5439,7 +5439,7 @@ fn airGetUnionTag(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5439,7 +5439,7 @@ fn airGetUnionTag(self: *Self, inst: Air.Inst.Index) !void { |
| 5439 | } | 5439 | } |
| 5440 | 5440 | ||
| 5441 | fn airClz(self: *Self, inst: Air.Inst.Index) !void { | 5441 | fn airClz(self: *Self, inst: Air.Inst.Index) !void { |
| 5442 | const mod = self.bin_file.options.module.?; | 5442 | const mod = self.bin_file.comp.module.?; |
| 5443 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 5443 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5444 | const result = result: { | 5444 | const result = result: { |
| 5445 | const dst_ty = self.typeOfIndex(inst); | 5445 | const dst_ty = self.typeOfIndex(inst); |
| ... | @@ -5598,7 +5598,7 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5598,7 +5598,7 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void { |
| 5598 | } | 5598 | } |
| 5599 | 5599 | ||
| 5600 | fn airCtz(self: *Self, inst: Air.Inst.Index) !void { | 5600 | fn airCtz(self: *Self, inst: Air.Inst.Index) !void { |
| 5601 | const mod = self.bin_file.options.module.?; | 5601 | const mod = self.bin_file.comp.module.?; |
| 5602 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 5602 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5603 | const result = result: { | 5603 | const result = result: { |
| 5604 | const dst_ty = self.typeOfIndex(inst); | 5604 | const dst_ty = self.typeOfIndex(inst); |
| ... | @@ -5716,7 +5716,7 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5716,7 +5716,7 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void { |
| 5716 | } | 5716 | } |
| 5717 | 5717 | ||
| 5718 | fn airPopCount(self: *Self, inst: Air.Inst.Index) !void { | 5718 | fn airPopCount(self: *Self, inst: Air.Inst.Index) !void { |
| 5719 | const mod = self.bin_file.options.module.?; | 5719 | const mod = self.bin_file.comp.module.?; |
| 5720 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 5720 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5721 | const result: MCValue = result: { | 5721 | const result: MCValue = result: { |
| 5722 | try self.spillEflagsIfOccupied(); | 5722 | try self.spillEflagsIfOccupied(); |
| ... | @@ -5779,7 +5779,7 @@ fn genPopCount( | ... | @@ -5779,7 +5779,7 @@ fn genPopCount( |
| 5779 | src_mcv: MCValue, | 5779 | src_mcv: MCValue, |
| 5780 | dst_contains_src: bool, | 5780 | dst_contains_src: bool, |
| 5781 | ) !void { | 5781 | ) !void { |
| 5782 | const mod = self.bin_file.options.module.?; | 5782 | const mod = self.bin_file.comp.module.?; |
| 5783 | 5783 | ||
| 5784 | const src_abi_size: u32 = @intCast(src_ty.abiSize(mod)); | 5784 | const src_abi_size: u32 = @intCast(src_ty.abiSize(mod)); |
| 5785 | if (self.hasFeature(.popcnt)) return self.genBinOpMir( | 5785 | if (self.hasFeature(.popcnt)) return self.genBinOpMir( |
| ... | @@ -5871,7 +5871,7 @@ fn genByteSwap( | ... | @@ -5871,7 +5871,7 @@ fn genByteSwap( |
| 5871 | src_mcv: MCValue, | 5871 | src_mcv: MCValue, |
| 5872 | mem_ok: bool, | 5872 | mem_ok: bool, |
| 5873 | ) !MCValue { | 5873 | ) !MCValue { |
| 5874 | const mod = self.bin_file.options.module.?; | 5874 | const mod = self.bin_file.comp.module.?; |
| 5875 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 5875 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5876 | 5876 | ||
| 5877 | if (src_ty.zigTypeTag(mod) == .Vector) return self.fail( | 5877 | if (src_ty.zigTypeTag(mod) == .Vector) return self.fail( |
| ... | @@ -5962,7 +5962,7 @@ fn genByteSwap( | ... | @@ -5962,7 +5962,7 @@ fn genByteSwap( |
| 5962 | } | 5962 | } |
| 5963 | 5963 | ||
| 5964 | fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void { | 5964 | fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void { |
| 5965 | const mod = self.bin_file.options.module.?; | 5965 | const mod = self.bin_file.comp.module.?; |
| 5966 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 5966 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5967 | 5967 | ||
| 5968 | const src_ty = self.typeOf(ty_op.operand); | 5968 | const src_ty = self.typeOf(ty_op.operand); |
| ... | @@ -5984,7 +5984,7 @@ fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -5984,7 +5984,7 @@ fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void { |
| 5984 | } | 5984 | } |
| 5985 | 5985 | ||
| 5986 | fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void { | 5986 | fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void { |
| 5987 | const mod = self.bin_file.options.module.?; | 5987 | const mod = self.bin_file.comp.module.?; |
| 5988 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 5988 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 5989 | 5989 | ||
| 5990 | const src_ty = self.typeOf(ty_op.operand); | 5990 | const src_ty = self.typeOf(ty_op.operand); |
| ... | @@ -6106,7 +6106,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -6106,7 +6106,7 @@ fn airBitReverse(self: *Self, inst: Air.Inst.Index) !void { |
| 6106 | } | 6106 | } |
| 6107 | 6107 | ||
| 6108 | fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type) !void { | 6108 | fn 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.?; |
| 6110 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; | 6110 | const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)]; |
| 6111 | 6111 | ||
| 6112 | const result = result: { | 6112 | const result = result: { |
| ... | @@ -6282,7 +6282,7 @@ fn airRound(self: *Self, inst: Air.Inst.Index, mode: RoundMode) !void { | ... | @@ -6282,7 +6282,7 @@ fn airRound(self: *Self, inst: Air.Inst.Index, mode: RoundMode) !void { |
| 6282 | } | 6282 | } |
| 6283 | 6283 | ||
| 6284 | fn getRoundTag(self: *Self, ty: Type) ?Mir.Inst.FixedTag { | 6284 | fn getRoundTag(self: *Self, ty: Type) ?Mir.Inst.FixedTag { |
| 6285 | const mod = self.bin_file.options.module.?; | 6285 | const mod = self.bin_file.comp.module.?; |
| 6286 | return if (self.hasFeature(.sse4_1)) switch (ty.zigTypeTag(mod)) { | 6286 | return if (self.hasFeature(.sse4_1)) switch (ty.zigTypeTag(mod)) { |
| 6287 | .Float => switch (ty.floatBits(self.target.*)) { | 6287 | .Float => switch (ty.floatBits(self.target.*)) { |
| 6288 | 32 => if (self.hasFeature(.avx)) .{ .v_ss, .round } else .{ ._ss, .round }, | 6288 | 32 => if (self.hasFeature(.avx)) .{ .v_ss, .round } else .{ ._ss, .round }, |
| ... | @@ -6314,7 +6314,7 @@ fn getRoundTag(self: *Self, ty: Type) ?Mir.Inst.FixedTag { | ... | @@ -6314,7 +6314,7 @@ fn getRoundTag(self: *Self, ty: Type) ?Mir.Inst.FixedTag { |
| 6314 | } | 6314 | } |
| 6315 | 6315 | ||
| 6316 | fn genRoundLibcall(self: *Self, ty: Type, src_mcv: MCValue, mode: RoundMode) !MCValue { | 6316 | fn 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.?; |
| 6318 | if (self.getRoundTag(ty)) |_| return .none; | 6318 | if (self.getRoundTag(ty)) |_| return .none; |
| 6319 | 6319 | ||
| 6320 | if (ty.zigTypeTag(mod) != .Float) | 6320 | if (ty.zigTypeTag(mod) != .Float) |
| ... | @@ -6338,7 +6338,7 @@ fn genRoundLibcall(self: *Self, ty: Type, src_mcv: MCValue, mode: RoundMode) !MC | ... | @@ -6338,7 +6338,7 @@ fn genRoundLibcall(self: *Self, ty: Type, src_mcv: MCValue, mode: RoundMode) !MC |
| 6338 | } | 6338 | } |
| 6339 | 6339 | ||
| 6340 | fn genRound(self: *Self, ty: Type, dst_reg: Register, src_mcv: MCValue, mode: RoundMode) !void { | 6340 | fn 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.?; |
| 6342 | const mir_tag = self.getRoundTag(ty) orelse { | 6342 | const mir_tag = self.getRoundTag(ty) orelse { |
| 6343 | const result = try self.genRoundLibcall(ty, src_mcv, mode); | 6343 | const result = try self.genRoundLibcall(ty, src_mcv, mode); |
| 6344 | return self.genSetReg(dst_reg, ty, result); | 6344 | 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 | ... | @@ -6380,7 +6380,7 @@ fn genRound(self: *Self, ty: Type, dst_reg: Register, src_mcv: MCValue, mode: Ro |
| 6380 | } | 6380 | } |
| 6381 | 6381 | ||
| 6382 | fn airAbs(self: *Self, inst: Air.Inst.Index) !void { | 6382 | fn airAbs(self: *Self, inst: Air.Inst.Index) !void { |
| 6383 | const mod = self.bin_file.options.module.?; | 6383 | const mod = self.bin_file.comp.module.?; |
| 6384 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 6384 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 6385 | const ty = self.typeOf(ty_op.operand); | 6385 | const ty = self.typeOf(ty_op.operand); |
| 6386 | 6386 | ||
| ... | @@ -6520,7 +6520,7 @@ fn airAbs(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -6520,7 +6520,7 @@ fn airAbs(self: *Self, inst: Air.Inst.Index) !void { |
| 6520 | } | 6520 | } |
| 6521 | 6521 | ||
| 6522 | fn airSqrt(self: *Self, inst: Air.Inst.Index) !void { | 6522 | fn airSqrt(self: *Self, inst: Air.Inst.Index) !void { |
| 6523 | const mod = self.bin_file.options.module.?; | 6523 | const mod = self.bin_file.comp.module.?; |
| 6524 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 6524 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 6525 | const ty = self.typeOf(un_op); | 6525 | const ty = self.typeOf(un_op); |
| 6526 | const abi_size: u32 = @intCast(ty.abiSize(mod)); | 6526 | const abi_size: u32 = @intCast(ty.abiSize(mod)); |
| ... | @@ -6765,7 +6765,7 @@ fn reuseOperandAdvanced( | ... | @@ -6765,7 +6765,7 @@ fn reuseOperandAdvanced( |
| 6765 | } | 6765 | } |
| 6766 | 6766 | ||
| 6767 | fn packedLoad(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerError!void { | 6767 | fn 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.?; |
| 6769 | 6769 | ||
| 6770 | const ptr_info = ptr_ty.ptrInfo(mod); | 6770 | const ptr_info = ptr_ty.ptrInfo(mod); |
| 6771 | const val_ty = Type.fromInterned(ptr_info.child); | 6771 | 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 | ... | @@ -6864,7 +6864,7 @@ fn packedLoad(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) Inn |
| 6864 | } | 6864 | } |
| 6865 | 6865 | ||
| 6866 | fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerError!void { | 6866 | fn 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.?; |
| 6868 | const dst_ty = ptr_ty.childType(mod); | 6868 | const dst_ty = ptr_ty.childType(mod); |
| 6869 | if (!dst_ty.hasRuntimeBitsIgnoreComptime(mod)) return; | 6869 | if (!dst_ty.hasRuntimeBitsIgnoreComptime(mod)) return; |
| 6870 | switch (ptr_mcv) { | 6870 | switch (ptr_mcv) { |
| ... | @@ -6905,7 +6905,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerErro | ... | @@ -6905,7 +6905,7 @@ fn load(self: *Self, dst_mcv: MCValue, ptr_ty: Type, ptr_mcv: MCValue) InnerErro |
| 6905 | } | 6905 | } |
| 6906 | 6906 | ||
| 6907 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { | 6907 | fn airLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 6908 | const mod = self.bin_file.options.module.?; | 6908 | const mod = self.bin_file.comp.module.?; |
| 6909 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 6909 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 6910 | const elem_ty = self.typeOfIndex(inst); | 6910 | const elem_ty = self.typeOfIndex(inst); |
| 6911 | const result: MCValue = result: { | 6911 | const result: MCValue = result: { |
| ... | @@ -6962,7 +6962,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -6962,7 +6962,7 @@ fn airLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 6962 | } | 6962 | } |
| 6963 | 6963 | ||
| 6964 | fn packedStore(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerError!void { | 6964 | fn 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.?; |
| 6966 | const ptr_info = ptr_ty.ptrInfo(mod); | 6966 | const ptr_info = ptr_ty.ptrInfo(mod); |
| 6967 | const src_ty = Type.fromInterned(ptr_info.child); | 6967 | const src_ty = Type.fromInterned(ptr_info.child); |
| 6968 | if (!src_ty.hasRuntimeBitsIgnoreComptime(mod)) return; | 6968 | if (!src_ty.hasRuntimeBitsIgnoreComptime(mod)) return; |
| ... | @@ -7059,7 +7059,7 @@ fn packedStore(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) In | ... | @@ -7059,7 +7059,7 @@ fn packedStore(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) In |
| 7059 | } | 7059 | } |
| 7060 | 7060 | ||
| 7061 | fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerError!void { | 7061 | fn 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.?; |
| 7063 | const src_ty = ptr_ty.childType(mod); | 7063 | const src_ty = ptr_ty.childType(mod); |
| 7064 | if (!src_ty.hasRuntimeBitsIgnoreComptime(mod)) return; | 7064 | if (!src_ty.hasRuntimeBitsIgnoreComptime(mod)) return; |
| 7065 | switch (ptr_mcv) { | 7065 | switch (ptr_mcv) { |
| ... | @@ -7100,7 +7100,7 @@ fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerErr | ... | @@ -7100,7 +7100,7 @@ fn store(self: *Self, ptr_ty: Type, ptr_mcv: MCValue, src_mcv: MCValue) InnerErr |
| 7100 | } | 7100 | } |
| 7101 | 7101 | ||
| 7102 | fn airStore(self: *Self, inst: Air.Inst.Index, safety: bool) !void { | 7102 | fn 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.?; |
| 7104 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 7104 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 7105 | 7105 | ||
| 7106 | result: { | 7106 | result: { |
| ... | @@ -7138,7 +7138,7 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void { | ... | @@ -7138,7 +7138,7 @@ fn airStructFieldPtrIndex(self: *Self, inst: Air.Inst.Index, index: u8) !void { |
| 7138 | } | 7138 | } |
| 7139 | 7139 | ||
| 7140 | fn fieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32) !MCValue { | 7140 | fn 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.?; |
| 7142 | const ptr_field_ty = self.typeOfIndex(inst); | 7142 | const ptr_field_ty = self.typeOfIndex(inst); |
| 7143 | const ptr_container_ty = self.typeOf(operand); | 7143 | const ptr_container_ty = self.typeOf(operand); |
| 7144 | const ptr_container_ty_info = ptr_container_ty.ptrInfo(mod); | 7144 | 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 | ... | @@ -7163,7 +7163,7 @@ fn fieldPtr(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, index: u32 |
| 7163 | } | 7163 | } |
| 7164 | 7164 | ||
| 7165 | fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { | 7165 | fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { |
| 7166 | const mod = self.bin_file.options.module.?; | 7166 | const mod = self.bin_file.comp.module.?; |
| 7167 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 7167 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 7168 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; | 7168 | const extra = self.air.extraData(Air.StructField, ty_pl.payload).data; |
| 7169 | const result: MCValue = result: { | 7169 | const result: MCValue = result: { |
| ... | @@ -7451,7 +7451,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -7451,7 +7451,7 @@ fn airStructFieldVal(self: *Self, inst: Air.Inst.Index) !void { |
| 7451 | } | 7451 | } |
| 7452 | 7452 | ||
| 7453 | fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void { | 7453 | fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 7454 | const mod = self.bin_file.options.module.?; | 7454 | const mod = self.bin_file.comp.module.?; |
| 7455 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 7455 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 7456 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; | 7456 | const extra = self.air.extraData(Air.FieldParentPtr, ty_pl.payload).data; |
| 7457 | 7457 | ||
| ... | @@ -7470,7 +7470,7 @@ fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -7470,7 +7470,7 @@ fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 7470 | } | 7470 | } |
| 7471 | 7471 | ||
| 7472 | fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air: Air.Inst.Ref) !MCValue { | 7472 | fn 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.?; |
| 7474 | const src_ty = self.typeOf(src_air); | 7474 | const src_ty = self.typeOf(src_air); |
| 7475 | if (src_ty.zigTypeTag(mod) == .Vector) | 7475 | if (src_ty.zigTypeTag(mod) == .Vector) |
| 7476 | return self.fail("TODO implement genUnOp for {}", .{src_ty.fmt(mod)}); | 7476 | 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: | ... | @@ -7558,7 +7558,7 @@ fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air: |
| 7558 | } | 7558 | } |
| 7559 | 7559 | ||
| 7560 | fn genUnOpMir(self: *Self, mir_tag: Mir.Inst.FixedTag, dst_ty: Type, dst_mcv: MCValue) !void { | 7560 | fn 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.?; |
| 7562 | const abi_size: u32 = @intCast(dst_ty.abiSize(mod)); | 7562 | const abi_size: u32 = @intCast(dst_ty.abiSize(mod)); |
| 7563 | if (abi_size > 8) return self.fail("TODO implement {} for {}", .{ mir_tag, dst_ty.fmt(mod) }); | 7563 | if (abi_size > 8) return self.fail("TODO implement {} for {}", .{ mir_tag, dst_ty.fmt(mod) }); |
| 7564 | switch (dst_mcv) { | 7564 | switch (dst_mcv) { |
| ... | @@ -7605,7 +7605,7 @@ fn genShiftBinOpMir( | ... | @@ -7605,7 +7605,7 @@ fn genShiftBinOpMir( |
| 7605 | lhs_mcv: MCValue, | 7605 | lhs_mcv: MCValue, |
| 7606 | shift_mcv: MCValue, | 7606 | shift_mcv: MCValue, |
| 7607 | ) !void { | 7607 | ) !void { |
| 7608 | const mod = self.bin_file.options.module.?; | 7608 | const mod = self.bin_file.comp.module.?; |
| 7609 | const rhs_mcv: MCValue = rhs: { | 7609 | const rhs_mcv: MCValue = rhs: { |
| 7610 | switch (shift_mcv) { | 7610 | switch (shift_mcv) { |
| 7611 | .immediate => |imm| switch (imm) { | 7611 | .immediate => |imm| switch (imm) { |
| ... | @@ -7975,7 +7975,7 @@ fn genShiftBinOp( | ... | @@ -7975,7 +7975,7 @@ fn genShiftBinOp( |
| 7975 | lhs_ty: Type, | 7975 | lhs_ty: Type, |
| 7976 | rhs_ty: Type, | 7976 | rhs_ty: Type, |
| 7977 | ) !MCValue { | 7977 | ) !MCValue { |
| 7978 | const mod = self.bin_file.options.module.?; | 7978 | const mod = self.bin_file.comp.module.?; |
| 7979 | if (lhs_ty.zigTypeTag(mod) == .Vector) return self.fail("TODO implement genShiftBinOp for {}", .{ | 7979 | if (lhs_ty.zigTypeTag(mod) == .Vector) return self.fail("TODO implement genShiftBinOp for {}", .{ |
| 7980 | lhs_ty.fmt(mod), | 7980 | lhs_ty.fmt(mod), |
| 7981 | }); | 7981 | }); |
| ... | @@ -8041,7 +8041,7 @@ fn genMulDivBinOp( | ... | @@ -8041,7 +8041,7 @@ fn genMulDivBinOp( |
| 8041 | lhs_mcv: MCValue, | 8041 | lhs_mcv: MCValue, |
| 8042 | rhs_mcv: MCValue, | 8042 | rhs_mcv: MCValue, |
| 8043 | ) !MCValue { | 8043 | ) !MCValue { |
| 8044 | const mod = self.bin_file.options.module.?; | 8044 | const mod = self.bin_file.comp.module.?; |
| 8045 | if (dst_ty.zigTypeTag(mod) == .Vector or dst_ty.zigTypeTag(mod) == .Float) return self.fail( | 8045 | if (dst_ty.zigTypeTag(mod) == .Vector or dst_ty.zigTypeTag(mod) == .Float) return self.fail( |
| 8046 | "TODO implement genMulDivBinOp for {s} from {} to {}", | 8046 | "TODO implement genMulDivBinOp for {s} from {} to {}", |
| 8047 | .{ @tagName(tag), src_ty.fmt(mod), dst_ty.fmt(mod) }, | 8047 | .{ @tagName(tag), src_ty.fmt(mod), dst_ty.fmt(mod) }, |
| ... | @@ -8283,7 +8283,7 @@ fn genBinOp( | ... | @@ -8283,7 +8283,7 @@ fn genBinOp( |
| 8283 | lhs_air: Air.Inst.Ref, | 8283 | lhs_air: Air.Inst.Ref, |
| 8284 | rhs_air: Air.Inst.Ref, | 8284 | rhs_air: Air.Inst.Ref, |
| 8285 | ) !MCValue { | 8285 | ) !MCValue { |
| 8286 | const mod = self.bin_file.options.module.?; | 8286 | const mod = self.bin_file.comp.module.?; |
| 8287 | const lhs_ty = self.typeOf(lhs_air); | 8287 | const lhs_ty = self.typeOf(lhs_air); |
| 8288 | const rhs_ty = self.typeOf(rhs_air); | 8288 | const rhs_ty = self.typeOf(rhs_air); |
| 8289 | const abi_size: u32 = @intCast(lhs_ty.abiSize(mod)); | 8289 | const abi_size: u32 = @intCast(lhs_ty.abiSize(mod)); |
| ... | @@ -10015,7 +10015,7 @@ fn genBinOpMir( | ... | @@ -10015,7 +10015,7 @@ fn genBinOpMir( |
| 10015 | dst_mcv: MCValue, | 10015 | dst_mcv: MCValue, |
| 10016 | src_mcv: MCValue, | 10016 | src_mcv: MCValue, |
| 10017 | ) !void { | 10017 | ) !void { |
| 10018 | const mod = self.bin_file.options.module.?; | 10018 | const mod = self.bin_file.comp.module.?; |
| 10019 | const abi_size: u32 = @intCast(ty.abiSize(mod)); | 10019 | const abi_size: u32 = @intCast(ty.abiSize(mod)); |
| 10020 | try self.spillEflagsIfOccupied(); | 10020 | try self.spillEflagsIfOccupied(); |
| 10021 | switch (dst_mcv) { | 10021 | switch (dst_mcv) { |
| ... | @@ -10435,7 +10435,7 @@ fn genBinOpMir( | ... | @@ -10435,7 +10435,7 @@ fn genBinOpMir( |
| 10435 | /// Performs multi-operand integer multiplication between dst_mcv and src_mcv, storing the result in dst_mcv. | 10435 | /// Performs multi-operand integer multiplication between dst_mcv and src_mcv, storing the result in dst_mcv. |
| 10436 | /// Does not support byte-size operands. | 10436 | /// Does not support byte-size operands. |
| 10437 | fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError!void { | 10437 | fn 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.?; |
| 10439 | const abi_size: u32 = @intCast(dst_ty.abiSize(mod)); | 10439 | const abi_size: u32 = @intCast(dst_ty.abiSize(mod)); |
| 10440 | try self.spillEflagsIfOccupied(); | 10440 | try self.spillEflagsIfOccupied(); |
| 10441 | switch (dst_mcv) { | 10441 | switch (dst_mcv) { |
| ... | @@ -10560,7 +10560,7 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M | ... | @@ -10560,7 +10560,7 @@ fn genIntMulComplexOpMir(self: *Self, dst_ty: Type, dst_mcv: MCValue, src_mcv: M |
| 10560 | } | 10560 | } |
| 10561 | 10561 | ||
| 10562 | fn airArg(self: *Self, inst: Air.Inst.Index) !void { | 10562 | fn airArg(self: *Self, inst: Air.Inst.Index) !void { |
| 10563 | const mod = self.bin_file.options.module.?; | 10563 | const mod = self.bin_file.comp.module.?; |
| 10564 | // skip zero-bit arguments as they don't have a corresponding arg instruction | 10564 | // skip zero-bit arguments as they don't have a corresponding arg instruction |
| 10565 | var arg_index = self.arg_index; | 10565 | var arg_index = self.arg_index; |
| 10566 | while (self.args[arg_index] == .none) arg_index += 1; | 10566 | while (self.args[arg_index] == .none) arg_index += 1; |
| ... | @@ -10593,7 +10593,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -10593,7 +10593,7 @@ fn airArg(self: *Self, inst: Air.Inst.Index) !void { |
| 10593 | } | 10593 | } |
| 10594 | 10594 | ||
| 10595 | fn genArgDbgInfo(self: Self, ty: Type, name: [:0]const u8, mcv: MCValue) !void { | 10595 | fn 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.?; |
| 10597 | switch (self.debug_output) { | 10597 | switch (self.debug_output) { |
| 10598 | .dwarf => |dw| { | 10598 | .dwarf => |dw| { |
| 10599 | const loc: link.File.Dwarf.DeclState.DbgInfoLoc = switch (mcv) { | 10599 | const loc: link.File.Dwarf.DeclState.DbgInfoLoc = switch (mcv) { |
| ... | @@ -10629,7 +10629,7 @@ fn genVarDbgInfo( | ... | @@ -10629,7 +10629,7 @@ fn genVarDbgInfo( |
| 10629 | mcv: MCValue, | 10629 | mcv: MCValue, |
| 10630 | name: [:0]const u8, | 10630 | name: [:0]const u8, |
| 10631 | ) !void { | 10631 | ) !void { |
| 10632 | const mod = self.bin_file.options.module.?; | 10632 | const mod = self.bin_file.comp.module.?; |
| 10633 | const is_ptr = switch (tag) { | 10633 | const is_ptr = switch (tag) { |
| 10634 | .dbg_var_ptr => true, | 10634 | .dbg_var_ptr => true, |
| 10635 | .dbg_var_val => false, | 10635 | .dbg_var_val => false, |
| ... | @@ -10748,7 +10748,7 @@ fn genCall(self: *Self, info: union(enum) { | ... | @@ -10748,7 +10748,7 @@ fn genCall(self: *Self, info: union(enum) { |
| 10748 | callee: []const u8, | 10748 | callee: []const u8, |
| 10749 | }, | 10749 | }, |
| 10750 | }, arg_types: []const Type, args: []const MCValue) !MCValue { | 10750 | }, arg_types: []const Type, args: []const MCValue) !MCValue { |
| 10751 | const mod = self.bin_file.options.module.?; | 10751 | const mod = self.bin_file.comp.module.?; |
| 10752 | 10752 | ||
| 10753 | const fn_ty = switch (info) { | 10753 | const fn_ty = switch (info) { |
| 10754 | .air => |callee| fn_info: { | 10754 | .air => |callee| fn_info: { |
| ... | @@ -10969,7 +10969,7 @@ fn genCall(self: *Self, info: union(enum) { | ... | @@ -10969,7 +10969,7 @@ fn genCall(self: *Self, info: union(enum) { |
| 10969 | } | 10969 | } |
| 10970 | 10970 | ||
| 10971 | fn airRet(self: *Self, inst: Air.Inst.Index) !void { | 10971 | fn airRet(self: *Self, inst: Air.Inst.Index) !void { |
| 10972 | const mod = self.bin_file.options.module.?; | 10972 | const mod = self.bin_file.comp.module.?; |
| 10973 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 10973 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 10974 | 10974 | ||
| 10975 | const ret_ty = self.fn_type.fnReturnType(mod); | 10975 | const ret_ty = self.fn_type.fnReturnType(mod); |
| ... | @@ -11018,7 +11018,7 @@ fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -11018,7 +11018,7 @@ fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 11018 | } | 11018 | } |
| 11019 | 11019 | ||
| 11020 | fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void { | 11020 | fn 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.?; |
| 11022 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 11022 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 11023 | const ty = self.typeOf(bin_op.lhs); | 11023 | const ty = self.typeOf(bin_op.lhs); |
| 11024 | 11024 | ||
| ... | @@ -11412,7 +11412,7 @@ fn airCmpVector(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -11412,7 +11412,7 @@ fn airCmpVector(self: *Self, inst: Air.Inst.Index) !void { |
| 11412 | } | 11412 | } |
| 11413 | 11413 | ||
| 11414 | fn airCmpLtErrorsLen(self: *Self, inst: Air.Inst.Index) !void { | 11414 | fn airCmpLtErrorsLen(self: *Self, inst: Air.Inst.Index) !void { |
| 11415 | const mod = self.bin_file.options.module.?; | 11415 | const mod = self.bin_file.comp.module.?; |
| 11416 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 11416 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 11417 | 11417 | ||
| 11418 | const addr_reg = try self.register_manager.allocReg(null, abi.RegisterClass.gp); | 11418 | 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 { | ... | @@ -11551,7 +11551,7 @@ fn airDbgVar(self: *Self, inst: Air.Inst.Index) !void { |
| 11551 | } | 11551 | } |
| 11552 | 11552 | ||
| 11553 | fn genCondBrMir(self: *Self, ty: Type, mcv: MCValue) !Mir.Inst.Index { | 11553 | fn 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.?; |
| 11555 | const abi_size = ty.abiSize(mod); | 11555 | const abi_size = ty.abiSize(mod); |
| 11556 | switch (mcv) { | 11556 | switch (mcv) { |
| 11557 | .eflags => |cc| { | 11557 | .eflags => |cc| { |
| ... | @@ -11624,7 +11624,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -11624,7 +11624,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { |
| 11624 | } | 11624 | } |
| 11625 | 11625 | ||
| 11626 | fn isNull(self: *Self, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) !MCValue { | 11626 | fn 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.?; |
| 11628 | switch (opt_mcv) { | 11628 | switch (opt_mcv) { |
| 11629 | .register_overflow => |ro| return .{ .eflags = ro.eflags.negate() }, | 11629 | .register_overflow => |ro| return .{ .eflags = ro.eflags.negate() }, |
| 11630 | else => {}, | 11630 | else => {}, |
| ... | @@ -11732,7 +11732,7 @@ fn isNull(self: *Self, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) !MC | ... | @@ -11732,7 +11732,7 @@ fn isNull(self: *Self, inst: Air.Inst.Index, opt_ty: Type, opt_mcv: MCValue) !MC |
| 11732 | } | 11732 | } |
| 11733 | 11733 | ||
| 11734 | fn isNullPtr(self: *Self, inst: Air.Inst.Index, ptr_ty: Type, ptr_mcv: MCValue) !MCValue { | 11734 | fn 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.?; |
| 11736 | const opt_ty = ptr_ty.childType(mod); | 11736 | const opt_ty = ptr_ty.childType(mod); |
| 11737 | const pl_ty = opt_ty.optionalChild(mod); | 11737 | const pl_ty = opt_ty.optionalChild(mod); |
| 11738 | 11738 | ||
| ... | @@ -11768,7 +11768,7 @@ fn isNullPtr(self: *Self, inst: Air.Inst.Index, ptr_ty: Type, ptr_mcv: MCValue) | ... | @@ -11768,7 +11768,7 @@ fn isNullPtr(self: *Self, inst: Air.Inst.Index, ptr_ty: Type, ptr_mcv: MCValue) |
| 11768 | } | 11768 | } |
| 11769 | 11769 | ||
| 11770 | fn isErr(self: *Self, maybe_inst: ?Air.Inst.Index, eu_ty: Type, eu_mcv: MCValue) !MCValue { | 11770 | fn 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.?; |
| 11772 | const err_ty = eu_ty.errorUnionSet(mod); | 11772 | const err_ty = eu_ty.errorUnionSet(mod); |
| 11773 | if (err_ty.errorSetIsEmpty(mod)) return MCValue{ .immediate = 0 }; // always false | 11773 | if (err_ty.errorSetIsEmpty(mod)) return MCValue{ .immediate = 0 }; // always false |
| 11774 | 11774 | ||
| ... | @@ -11815,7 +11815,7 @@ fn isErr(self: *Self, maybe_inst: ?Air.Inst.Index, eu_ty: Type, eu_mcv: MCValue) | ... | @@ -11815,7 +11815,7 @@ fn isErr(self: *Self, maybe_inst: ?Air.Inst.Index, eu_ty: Type, eu_mcv: MCValue) |
| 11815 | } | 11815 | } |
| 11816 | 11816 | ||
| 11817 | fn isErrPtr(self: *Self, maybe_inst: ?Air.Inst.Index, ptr_ty: Type, ptr_mcv: MCValue) !MCValue { | 11817 | fn 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.?; |
| 11819 | const eu_ty = ptr_ty.childType(mod); | 11819 | const eu_ty = ptr_ty.childType(mod); |
| 11820 | const err_ty = eu_ty.errorUnionSet(mod); | 11820 | const err_ty = eu_ty.errorUnionSet(mod); |
| 11821 | if (err_ty.errorSetIsEmpty(mod)) return MCValue{ .immediate = 0 }; // always false | 11821 | if (err_ty.errorSetIsEmpty(mod)) return MCValue{ .immediate = 0 }; // always false |
| ... | @@ -12097,7 +12097,7 @@ fn performReloc(self: *Self, reloc: Mir.Inst.Index) !void { | ... | @@ -12097,7 +12097,7 @@ fn performReloc(self: *Self, reloc: Mir.Inst.Index) !void { |
| 12097 | } | 12097 | } |
| 12098 | 12098 | ||
| 12099 | fn airBr(self: *Self, inst: Air.Inst.Index) !void { | 12099 | fn airBr(self: *Self, inst: Air.Inst.Index) !void { |
| 12100 | const mod = self.bin_file.options.module.?; | 12100 | const mod = self.bin_file.comp.module.?; |
| 12101 | const br = self.air.instructions.items(.data)[@intFromEnum(inst)].br; | 12101 | const br = self.air.instructions.items(.data)[@intFromEnum(inst)].br; |
| 12102 | 12102 | ||
| 12103 | const block_ty = self.typeOfIndex(br.block_inst); | 12103 | const block_ty = self.typeOfIndex(br.block_inst); |
| ... | @@ -12158,7 +12158,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -12158,7 +12158,7 @@ fn airBr(self: *Self, inst: Air.Inst.Index) !void { |
| 12158 | } | 12158 | } |
| 12159 | 12159 | ||
| 12160 | fn airAsm(self: *Self, inst: Air.Inst.Index) !void { | 12160 | fn airAsm(self: *Self, inst: Air.Inst.Index) !void { |
| 12161 | const mod = self.bin_file.options.module.?; | 12161 | const mod = self.bin_file.comp.module.?; |
| 12162 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 12162 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 12163 | const extra = self.air.extraData(Air.Asm, ty_pl.payload); | 12163 | const extra = self.air.extraData(Air.Asm, ty_pl.payload); |
| 12164 | const clobbers_len: u31 = @truncate(extra.data.flags); | 12164 | const clobbers_len: u31 = @truncate(extra.data.flags); |
| ... | @@ -12865,7 +12865,7 @@ const MoveStrategy = union(enum) { | ... | @@ -12865,7 +12865,7 @@ const MoveStrategy = union(enum) { |
| 12865 | } | 12865 | } |
| 12866 | }; | 12866 | }; |
| 12867 | fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !MoveStrategy { | 12867 | fn 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.?; |
| 12869 | switch (class) { | 12869 | switch (class) { |
| 12870 | .general_purpose, .segment => return .{ .move = .{ ._, .mov } }, | 12870 | .general_purpose, .segment => return .{ .move = .{ ._, .mov } }, |
| 12871 | .x87 => return .x87_load_store, | 12871 | .x87 => return .x87_load_store, |
| ... | @@ -13164,7 +13164,7 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo | ... | @@ -13164,7 +13164,7 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo |
| 13164 | } | 13164 | } |
| 13165 | 13165 | ||
| 13166 | fn genCopy(self: *Self, ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError!void { | 13166 | fn 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.?; |
| 13168 | 13168 | ||
| 13169 | const src_lock = if (src_mcv.getReg()) |reg| self.register_manager.lockReg(reg) else null; | 13169 | const src_lock = if (src_mcv.getReg()) |reg| self.register_manager.lockReg(reg) else null; |
| 13170 | defer if (src_lock) |lock| self.register_manager.unlockReg(lock); | 13170 | 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 | ... | @@ -13262,7 +13262,7 @@ fn genCopy(self: *Self, ty: Type, dst_mcv: MCValue, src_mcv: MCValue) InnerError |
| 13262 | } | 13262 | } |
| 13263 | 13263 | ||
| 13264 | fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerError!void { | 13264 | fn 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.?; |
| 13266 | const abi_size: u32 = @intCast(ty.abiSize(mod)); | 13266 | const abi_size: u32 = @intCast(ty.abiSize(mod)); |
| 13267 | if (ty.bitSize(mod) > dst_reg.bitSize()) | 13267 | if (ty.bitSize(mod) > dst_reg.bitSize()) |
| 13268 | return self.fail("genSetReg called with a value larger than dst_reg", .{}); | 13268 | 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 | ... | @@ -13561,7 +13561,7 @@ fn genSetReg(self: *Self, dst_reg: Register, ty: Type, src_mcv: MCValue) InnerEr |
| 13561 | } | 13561 | } |
| 13562 | 13562 | ||
| 13563 | fn genSetMem(self: *Self, base: Memory.Base, disp: i32, ty: Type, src_mcv: MCValue) InnerError!void { | 13563 | fn 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.?; |
| 13565 | const abi_size: u32 = @intCast(ty.abiSize(mod)); | 13565 | const abi_size: u32 = @intCast(ty.abiSize(mod)); |
| 13566 | const dst_ptr_mcv: MCValue = switch (base) { | 13566 | const dst_ptr_mcv: MCValue = switch (base) { |
| 13567 | .none => .{ .immediate = @bitCast(@as(i64, disp)) }, | 13567 | .none => .{ .immediate = @bitCast(@as(i64, disp)) }, |
| ... | @@ -13922,7 +13922,7 @@ fn airIntFromPtr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -13922,7 +13922,7 @@ fn airIntFromPtr(self: *Self, inst: Air.Inst.Index) !void { |
| 13922 | } | 13922 | } |
| 13923 | 13923 | ||
| 13924 | fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { | 13924 | fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { |
| 13925 | const mod = self.bin_file.options.module.?; | 13925 | const mod = self.bin_file.comp.module.?; |
| 13926 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 13926 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 13927 | const dst_ty = self.typeOfIndex(inst); | 13927 | const dst_ty = self.typeOfIndex(inst); |
| 13928 | const src_ty = self.typeOf(ty_op.operand); | 13928 | const src_ty = self.typeOf(ty_op.operand); |
| ... | @@ -13980,7 +13980,7 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -13980,7 +13980,7 @@ fn airBitCast(self: *Self, inst: Air.Inst.Index) !void { |
| 13980 | } | 13980 | } |
| 13981 | 13981 | ||
| 13982 | fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { | 13982 | fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { |
| 13983 | const mod = self.bin_file.options.module.?; | 13983 | const mod = self.bin_file.comp.module.?; |
| 13984 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 13984 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 13985 | 13985 | ||
| 13986 | const slice_ty = self.typeOfIndex(inst); | 13986 | const slice_ty = self.typeOfIndex(inst); |
| ... | @@ -14003,7 +14003,7 @@ fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -14003,7 +14003,7 @@ fn airArrayToSlice(self: *Self, inst: Air.Inst.Index) !void { |
| 14003 | } | 14003 | } |
| 14004 | 14004 | ||
| 14005 | fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void { | 14005 | fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void { |
| 14006 | const mod = self.bin_file.options.module.?; | 14006 | const mod = self.bin_file.comp.module.?; |
| 14007 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 14007 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 14008 | 14008 | ||
| 14009 | const dst_ty = self.typeOfIndex(inst); | 14009 | const dst_ty = self.typeOfIndex(inst); |
| ... | @@ -14082,7 +14082,7 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -14082,7 +14082,7 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void { |
| 14082 | } | 14082 | } |
| 14083 | 14083 | ||
| 14084 | fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void { | 14084 | fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void { |
| 14085 | const mod = self.bin_file.options.module.?; | 14085 | const mod = self.bin_file.comp.module.?; |
| 14086 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 14086 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 14087 | 14087 | ||
| 14088 | const dst_ty = self.typeOfIndex(inst); | 14088 | const dst_ty = self.typeOfIndex(inst); |
| ... | @@ -14153,7 +14153,7 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -14153,7 +14153,7 @@ fn airIntFromFloat(self: *Self, inst: Air.Inst.Index) !void { |
| 14153 | } | 14153 | } |
| 14154 | 14154 | ||
| 14155 | fn airCmpxchg(self: *Self, inst: Air.Inst.Index) !void { | 14155 | fn airCmpxchg(self: *Self, inst: Air.Inst.Index) !void { |
| 14156 | const mod = self.bin_file.options.module.?; | 14156 | const mod = self.bin_file.comp.module.?; |
| 14157 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 14157 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 14158 | const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data; | 14158 | const extra = self.air.extraData(Air.Cmpxchg, ty_pl.payload).data; |
| 14159 | 14159 | ||
| ... | @@ -14249,7 +14249,7 @@ fn atomicOp( | ... | @@ -14249,7 +14249,7 @@ fn atomicOp( |
| 14249 | rmw_op: ?std.builtin.AtomicRmwOp, | 14249 | rmw_op: ?std.builtin.AtomicRmwOp, |
| 14250 | order: std.builtin.AtomicOrder, | 14250 | order: std.builtin.AtomicOrder, |
| 14251 | ) InnerError!MCValue { | 14251 | ) InnerError!MCValue { |
| 14252 | const mod = self.bin_file.options.module.?; | 14252 | const mod = self.bin_file.comp.module.?; |
| 14253 | const ptr_lock = switch (ptr_mcv) { | 14253 | const ptr_lock = switch (ptr_mcv) { |
| 14254 | .register => |reg| self.register_manager.lockReg(reg), | 14254 | .register => |reg| self.register_manager.lockReg(reg), |
| 14255 | else => null, | 14255 | else => null, |
| ... | @@ -14653,7 +14653,7 @@ fn airAtomicStore(self: *Self, inst: Air.Inst.Index, order: std.builtin.AtomicOr | ... | @@ -14653,7 +14653,7 @@ fn airAtomicStore(self: *Self, inst: Air.Inst.Index, order: std.builtin.AtomicOr |
| 14653 | } | 14653 | } |
| 14654 | 14654 | ||
| 14655 | fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void { | 14655 | fn 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.?; |
| 14657 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 14657 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 14658 | 14658 | ||
| 14659 | result: { | 14659 | result: { |
| ... | @@ -14781,7 +14781,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void { | ... | @@ -14781,7 +14781,7 @@ fn airMemset(self: *Self, inst: Air.Inst.Index, safety: bool) !void { |
| 14781 | } | 14781 | } |
| 14782 | 14782 | ||
| 14783 | fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void { | 14783 | fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void { |
| 14784 | const mod = self.bin_file.options.module.?; | 14784 | const mod = self.bin_file.comp.module.?; |
| 14785 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; | 14785 | const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; |
| 14786 | 14786 | ||
| 14787 | try self.spillRegisters(&.{ .rdi, .rsi, .rcx }); | 14787 | try self.spillRegisters(&.{ .rdi, .rsi, .rcx }); |
| ... | @@ -14836,7 +14836,7 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -14836,7 +14836,7 @@ fn airMemcpy(self: *Self, inst: Air.Inst.Index) !void { |
| 14836 | } | 14836 | } |
| 14837 | 14837 | ||
| 14838 | fn airTagName(self: *Self, inst: Air.Inst.Index) !void { | 14838 | fn airTagName(self: *Self, inst: Air.Inst.Index) !void { |
| 14839 | const mod = self.bin_file.options.module.?; | 14839 | const mod = self.bin_file.comp.module.?; |
| 14840 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 14840 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 14841 | const inst_ty = self.typeOfIndex(inst); | 14841 | const inst_ty = self.typeOfIndex(inst); |
| 14842 | const enum_ty = self.typeOf(un_op); | 14842 | const enum_ty = self.typeOf(un_op); |
| ... | @@ -14878,7 +14878,7 @@ fn airTagName(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -14878,7 +14878,7 @@ fn airTagName(self: *Self, inst: Air.Inst.Index) !void { |
| 14878 | } | 14878 | } |
| 14879 | 14879 | ||
| 14880 | fn airErrorName(self: *Self, inst: Air.Inst.Index) !void { | 14880 | fn airErrorName(self: *Self, inst: Air.Inst.Index) !void { |
| 14881 | const mod = self.bin_file.options.module.?; | 14881 | const mod = self.bin_file.comp.module.?; |
| 14882 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; | 14882 | const un_op = self.air.instructions.items(.data)[@intFromEnum(inst)].un_op; |
| 14883 | 14883 | ||
| 14884 | const err_ty = self.typeOf(un_op); | 14884 | const err_ty = self.typeOf(un_op); |
| ... | @@ -14980,7 +14980,7 @@ fn airErrorName(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -14980,7 +14980,7 @@ fn airErrorName(self: *Self, inst: Air.Inst.Index) !void { |
| 14980 | } | 14980 | } |
| 14981 | 14981 | ||
| 14982 | fn airSplat(self: *Self, inst: Air.Inst.Index) !void { | 14982 | fn airSplat(self: *Self, inst: Air.Inst.Index) !void { |
| 14983 | const mod = self.bin_file.options.module.?; | 14983 | const mod = self.bin_file.comp.module.?; |
| 14984 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 14984 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 14985 | const vector_ty = self.typeOfIndex(inst); | 14985 | const vector_ty = self.typeOfIndex(inst); |
| 14986 | const vector_len = vector_ty.vectorLen(mod); | 14986 | const vector_len = vector_ty.vectorLen(mod); |
| ... | @@ -15332,7 +15332,7 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -15332,7 +15332,7 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void { |
| 15332 | } | 15332 | } |
| 15333 | 15333 | ||
| 15334 | fn airReduce(self: *Self, inst: Air.Inst.Index) !void { | 15334 | fn airReduce(self: *Self, inst: Air.Inst.Index) !void { |
| 15335 | const mod = self.bin_file.options.module.?; | 15335 | const mod = self.bin_file.comp.module.?; |
| 15336 | const reduce = self.air.instructions.items(.data)[@intFromEnum(inst)].reduce; | 15336 | const reduce = self.air.instructions.items(.data)[@intFromEnum(inst)].reduce; |
| 15337 | 15337 | ||
| 15338 | const result: MCValue = result: { | 15338 | const result: MCValue = result: { |
| ... | @@ -15389,7 +15389,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -15389,7 +15389,7 @@ fn airReduce(self: *Self, inst: Air.Inst.Index) !void { |
| 15389 | } | 15389 | } |
| 15390 | 15390 | ||
| 15391 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { | 15391 | fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
| 15392 | const mod = self.bin_file.options.module.?; | 15392 | const mod = self.bin_file.comp.module.?; |
| 15393 | const result_ty = self.typeOfIndex(inst); | 15393 | const result_ty = self.typeOfIndex(inst); |
| 15394 | const len: usize = @intCast(result_ty.arrayLen(mod)); | 15394 | const len: usize = @intCast(result_ty.arrayLen(mod)); |
| 15395 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 15395 | 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 { | ... | @@ -15562,7 +15562,7 @@ fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void { |
| 15562 | } | 15562 | } |
| 15563 | 15563 | ||
| 15564 | fn airUnionInit(self: *Self, inst: Air.Inst.Index) !void { | 15564 | fn airUnionInit(self: *Self, inst: Air.Inst.Index) !void { |
| 15565 | const mod = self.bin_file.options.module.?; | 15565 | const mod = self.bin_file.comp.module.?; |
| 15566 | const ip = &mod.intern_pool; | 15566 | const ip = &mod.intern_pool; |
| 15567 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; | 15567 | const ty_pl = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl; |
| 15568 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; | 15568 | const extra = self.air.extraData(Air.UnionInit, ty_pl.payload).data; |
| ... | @@ -15613,7 +15613,7 @@ fn airPrefetch(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -15613,7 +15613,7 @@ fn airPrefetch(self: *Self, inst: Air.Inst.Index) !void { |
| 15613 | } | 15613 | } |
| 15614 | 15614 | ||
| 15615 | fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void { | 15615 | fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void { |
| 15616 | const mod = self.bin_file.options.module.?; | 15616 | const mod = self.bin_file.comp.module.?; |
| 15617 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; | 15617 | const pl_op = self.air.instructions.items(.data)[@intFromEnum(inst)].pl_op; |
| 15618 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; | 15618 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; |
| 15619 | const ty = self.typeOfIndex(inst); | 15619 | const ty = self.typeOfIndex(inst); |
| ... | @@ -15780,7 +15780,7 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -15780,7 +15780,7 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void { |
| 15780 | } | 15780 | } |
| 15781 | 15781 | ||
| 15782 | fn airVaStart(self: *Self, inst: Air.Inst.Index) !void { | 15782 | fn airVaStart(self: *Self, inst: Air.Inst.Index) !void { |
| 15783 | const mod = self.bin_file.options.module.?; | 15783 | const mod = self.bin_file.comp.module.?; |
| 15784 | const va_list_ty = self.air.instructions.items(.data)[@intFromEnum(inst)].ty; | 15784 | const va_list_ty = self.air.instructions.items(.data)[@intFromEnum(inst)].ty; |
| 15785 | const ptr_anyopaque_ty = try mod.singleMutPtrType(Type.anyopaque); | 15785 | const ptr_anyopaque_ty = try mod.singleMutPtrType(Type.anyopaque); |
| 15786 | 15786 | ||
| ... | @@ -15833,7 +15833,7 @@ fn airVaStart(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -15833,7 +15833,7 @@ fn airVaStart(self: *Self, inst: Air.Inst.Index) !void { |
| 15833 | } | 15833 | } |
| 15834 | 15834 | ||
| 15835 | fn airVaArg(self: *Self, inst: Air.Inst.Index) !void { | 15835 | fn airVaArg(self: *Self, inst: Air.Inst.Index) !void { |
| 15836 | const mod = self.bin_file.options.module.?; | 15836 | const mod = self.bin_file.comp.module.?; |
| 15837 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; | 15837 | const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op; |
| 15838 | const ty = self.typeOfIndex(inst); | 15838 | const ty = self.typeOfIndex(inst); |
| 15839 | const promote_ty = self.promoteVarArg(ty); | 15839 | const promote_ty = self.promoteVarArg(ty); |
| ... | @@ -16042,7 +16042,7 @@ fn airVaEnd(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -16042,7 +16042,7 @@ fn airVaEnd(self: *Self, inst: Air.Inst.Index) !void { |
| 16042 | } | 16042 | } |
| 16043 | 16043 | ||
| 16044 | fn resolveInst(self: *Self, ref: Air.Inst.Ref) InnerError!MCValue { | 16044 | fn 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.?; |
| 16046 | const ty = self.typeOf(ref); | 16046 | const ty = self.typeOf(ref); |
| 16047 | 16047 | ||
| 16048 | // If the type has no codegen bits, no need to store it. | 16048 | // 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 | ... | @@ -16116,7 +16116,7 @@ fn limitImmediateType(self: *Self, operand: Air.Inst.Ref, comptime T: type) !MCV |
| 16116 | } | 16116 | } |
| 16117 | 16117 | ||
| 16118 | fn genTypedValue(self: *Self, arg_tv: TypedValue) InnerError!MCValue { | 16118 | fn genTypedValue(self: *Self, arg_tv: TypedValue) InnerError!MCValue { |
| 16119 | const mod = self.bin_file.options.module.?; | 16119 | const mod = self.bin_file.comp.module.?; |
| 16120 | return switch (try codegen.genTypedValue(self.bin_file, self.src_loc, arg_tv, self.owner.getDecl(mod))) { | 16120 | return switch (try codegen.genTypedValue(self.bin_file, self.src_loc, arg_tv, self.owner.getDecl(mod))) { |
| 16121 | .mcv => |mcv| switch (mcv) { | 16121 | .mcv => |mcv| switch (mcv) { |
| 16122 | .none => .none, | 16122 | .none => .none, |
| ... | @@ -16156,7 +16156,7 @@ fn resolveCallingConventionValues( | ... | @@ -16156,7 +16156,7 @@ fn resolveCallingConventionValues( |
| 16156 | var_args: []const Type, | 16156 | var_args: []const Type, |
| 16157 | stack_frame_base: FrameIndex, | 16157 | stack_frame_base: FrameIndex, |
| 16158 | ) !CallMCValues { | 16158 | ) !CallMCValues { |
| 16159 | const mod = self.bin_file.options.module.?; | 16159 | const mod = self.bin_file.comp.module.?; |
| 16160 | const ip = &mod.intern_pool; | 16160 | const ip = &mod.intern_pool; |
| 16161 | const cc = fn_info.cc; | 16161 | const cc = fn_info.cc; |
| 16162 | const param_types = try self.gpa.alloc(Type, fn_info.param_types.len + var_args.len); | 16162 | 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 { | ... | @@ -16468,7 +16468,7 @@ fn registerAlias(reg: Register, size_bytes: u32) Register { |
| 16468 | } | 16468 | } |
| 16469 | 16469 | ||
| 16470 | fn memSize(self: *Self, ty: Type) Memory.Size { | 16470 | fn memSize(self: *Self, ty: Type) Memory.Size { |
| 16471 | const mod = self.bin_file.options.module.?; | 16471 | const mod = self.bin_file.comp.module.?; |
| 16472 | return switch (ty.zigTypeTag(mod)) { | 16472 | return switch (ty.zigTypeTag(mod)) { |
| 16473 | .Float => Memory.Size.fromBitSize(ty.floatBits(self.target.*)), | 16473 | .Float => Memory.Size.fromBitSize(ty.floatBits(self.target.*)), |
| 16474 | else => Memory.Size.fromSize(@intCast(ty.abiSize(mod))), | 16474 | else => Memory.Size.fromSize(@intCast(ty.abiSize(mod))), |
| ... | @@ -16476,7 +16476,7 @@ fn memSize(self: *Self, ty: Type) Memory.Size { | ... | @@ -16476,7 +16476,7 @@ fn memSize(self: *Self, ty: Type) Memory.Size { |
| 16476 | } | 16476 | } |
| 16477 | 16477 | ||
| 16478 | fn splitType(self: *Self, ty: Type) ![2]Type { | 16478 | fn splitType(self: *Self, ty: Type) ![2]Type { |
| 16479 | const mod = self.bin_file.options.module.?; | 16479 | const mod = self.bin_file.comp.module.?; |
| 16480 | const classes = mem.sliceTo(&abi.classifySystemV(ty, mod, .other), .none); | 16480 | const classes = mem.sliceTo(&abi.classifySystemV(ty, mod, .other), .none); |
| 16481 | var parts: [2]Type = undefined; | 16481 | var parts: [2]Type = undefined; |
| 16482 | if (classes.len == 2) for (&parts, classes, 0..) |*part, class, part_i| { | 16482 | if (classes.len == 2) for (&parts, classes, 0..) |*part, class, part_i| { |
| ... | @@ -16505,7 +16505,7 @@ fn splitType(self: *Self, ty: Type) ![2]Type { | ... | @@ -16505,7 +16505,7 @@ fn splitType(self: *Self, ty: Type) ![2]Type { |
| 16505 | /// Truncates the value in the register in place. | 16505 | /// Truncates the value in the register in place. |
| 16506 | /// Clobbers any remaining bits. | 16506 | /// Clobbers any remaining bits. |
| 16507 | fn truncateRegister(self: *Self, ty: Type, reg: Register) !void { | 16507 | fn truncateRegister(self: *Self, ty: Type, reg: Register) !void { |
| 16508 | const mod = self.bin_file.options.module.?; | 16508 | const mod = self.bin_file.comp.module.?; |
| 16509 | const int_info = if (ty.isAbiInt(mod)) ty.intInfo(mod) else std.builtin.Type.Int{ | 16509 | const int_info = if (ty.isAbiInt(mod)) ty.intInfo(mod) else std.builtin.Type.Int{ |
| 16510 | .signedness = .unsigned, | 16510 | .signedness = .unsigned, |
| 16511 | .bits = @intCast(ty.bitSize(mod)), | 16511 | .bits = @intCast(ty.bitSize(mod)), |
| ... | @@ -16550,7 +16550,7 @@ fn truncateRegister(self: *Self, ty: Type, reg: Register) !void { | ... | @@ -16550,7 +16550,7 @@ fn truncateRegister(self: *Self, ty: Type, reg: Register) !void { |
| 16550 | } | 16550 | } |
| 16551 | 16551 | ||
| 16552 | fn regBitSize(self: *Self, ty: Type) u64 { | 16552 | fn regBitSize(self: *Self, ty: Type) u64 { |
| 16553 | const mod = self.bin_file.options.module.?; | 16553 | const mod = self.bin_file.comp.module.?; |
| 16554 | const abi_size = ty.abiSize(mod); | 16554 | const abi_size = ty.abiSize(mod); |
| 16555 | return switch (ty.zigTypeTag(mod)) { | 16555 | return switch (ty.zigTypeTag(mod)) { |
| 16556 | else => switch (abi_size) { | 16556 | else => switch (abi_size) { |
| ... | @@ -16569,7 +16569,7 @@ fn regBitSize(self: *Self, ty: Type) u64 { | ... | @@ -16569,7 +16569,7 @@ fn regBitSize(self: *Self, ty: Type) u64 { |
| 16569 | } | 16569 | } |
| 16570 | 16570 | ||
| 16571 | fn regExtraBits(self: *Self, ty: Type) u64 { | 16571 | fn regExtraBits(self: *Self, ty: Type) u64 { |
| 16572 | const mod = self.bin_file.options.module.?; | 16572 | const mod = self.bin_file.comp.module.?; |
| 16573 | return self.regBitSize(ty) - ty.bitSize(mod); | 16573 | return self.regBitSize(ty) - ty.bitSize(mod); |
| 16574 | } | 16574 | } |
| 16575 | 16575 | ||
| ... | @@ -16584,12 +16584,12 @@ fn hasAllFeatures(self: *Self, features: anytype) bool { | ... | @@ -16584,12 +16584,12 @@ fn hasAllFeatures(self: *Self, features: anytype) bool { |
| 16584 | } | 16584 | } |
| 16585 | 16585 | ||
| 16586 | fn typeOf(self: *Self, inst: Air.Inst.Ref) Type { | 16586 | fn typeOf(self: *Self, inst: Air.Inst.Ref) Type { |
| 16587 | const mod = self.bin_file.options.module.?; | 16587 | const mod = self.bin_file.comp.module.?; |
| 16588 | return self.air.typeOf(inst, &mod.intern_pool); | 16588 | return self.air.typeOf(inst, &mod.intern_pool); |
| 16589 | } | 16589 | } |
| 16590 | 16590 | ||
| 16591 | fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type { | 16591 | fn typeOfIndex(self: *Self, inst: Air.Inst.Index) Type { |
| 16592 | const mod = self.bin_file.options.module.?; | 16592 | const mod = self.bin_file.comp.module.?; |
| 16593 | return self.air.typeOfIndex(inst, &mod.intern_pool); | 16593 | return self.air.typeOfIndex(inst, &mod.intern_pool); |
| 16594 | } | 16594 | } |
| 16595 | 16595 | ||
| ... | @@ -16641,7 +16641,7 @@ fn floatLibcAbiSuffix(ty: Type) []const u8 { | ... | @@ -16641,7 +16641,7 @@ fn floatLibcAbiSuffix(ty: Type) []const u8 { |
| 16641 | } | 16641 | } |
| 16642 | 16642 | ||
| 16643 | fn promoteInt(self: *Self, ty: Type) Type { | 16643 | fn promoteInt(self: *Self, ty: Type) Type { |
| 16644 | const mod = self.bin_file.options.module.?; | 16644 | const mod = self.bin_file.comp.module.?; |
| 16645 | const int_info: InternPool.Key.IntType = switch (ty.toIntern()) { | 16645 | const int_info: InternPool.Key.IntType = switch (ty.toIntern()) { |
| 16646 | .bool_type => .{ .signedness = .unsigned, .bits = 1 }, | 16646 | .bool_type => .{ .signedness = .unsigned, .bits = 1 }, |
| 16647 | else => if (ty.isAbiInt(mod)) ty.intInfo(mod) else return ty, | 16647 | else => if (ty.isAbiInt(mod)) ty.intInfo(mod) else return ty, |
src/codegen.zig+8-8| ... | @@ -110,7 +110,7 @@ pub fn generateLazySymbol( | ... | @@ -110,7 +110,7 @@ pub fn generateLazySymbol( |
| 110 | const target = bin_file.options.target; | 110 | const target = bin_file.options.target; |
| 111 | const endian = target.cpu.arch.endian(); | 111 | const endian = target.cpu.arch.endian(); |
| 112 | 112 | ||
| 113 | const mod = bin_file.options.module.?; | 113 | const mod = bin_file.comp.module.?; |
| 114 | log.debug("generateLazySymbol: kind = {s}, ty = {}", .{ | 114 | log.debug("generateLazySymbol: kind = {s}, ty = {}", .{ |
| 115 | @tagName(lazy_sym.kind), | 115 | @tagName(lazy_sym.kind), |
| 116 | lazy_sym.ty.fmt(mod), | 116 | lazy_sym.ty.fmt(mod), |
| ... | @@ -165,7 +165,7 @@ pub fn generateSymbol( | ... | @@ -165,7 +165,7 @@ pub fn generateSymbol( |
| 165 | const tracy = trace(@src()); | 165 | const tracy = trace(@src()); |
| 166 | defer tracy.end(); | 166 | defer tracy.end(); |
| 167 | 167 | ||
| 168 | const mod = bin_file.options.module.?; | 168 | const mod = bin_file.comp.module.?; |
| 169 | const ip = &mod.intern_pool; | 169 | const ip = &mod.intern_pool; |
| 170 | const typed_value = arg_tv; | 170 | const typed_value = arg_tv; |
| 171 | 171 | ||
| ... | @@ -662,7 +662,7 @@ fn lowerParentPtr( | ... | @@ -662,7 +662,7 @@ fn lowerParentPtr( |
| 662 | debug_output: DebugInfoOutput, | 662 | debug_output: DebugInfoOutput, |
| 663 | reloc_info: RelocInfo, | 663 | reloc_info: RelocInfo, |
| 664 | ) CodeGenError!Result { | 664 | ) CodeGenError!Result { |
| 665 | const mod = bin_file.options.module.?; | 665 | const mod = bin_file.comp.module.?; |
| 666 | const ptr = mod.intern_pool.indexToKey(parent_ptr).ptr; | 666 | const ptr = mod.intern_pool.indexToKey(parent_ptr).ptr; |
| 667 | assert(ptr.len == .none); | 667 | assert(ptr.len == .none); |
| 668 | return switch (ptr.addr) { | 668 | return switch (ptr.addr) { |
| ... | @@ -766,7 +766,7 @@ fn lowerAnonDeclRef( | ... | @@ -766,7 +766,7 @@ fn lowerAnonDeclRef( |
| 766 | ) CodeGenError!Result { | 766 | ) CodeGenError!Result { |
| 767 | _ = debug_output; | 767 | _ = debug_output; |
| 768 | const target = bin_file.options.target; | 768 | const target = bin_file.options.target; |
| 769 | const mod = bin_file.options.module.?; | 769 | const mod = bin_file.comp.module.?; |
| 770 | 770 | ||
| 771 | const ptr_width_bytes = @divExact(target.ptrBitWidth(), 8); | 771 | const ptr_width_bytes = @divExact(target.ptrBitWidth(), 8); |
| 772 | const decl_val = anon_decl.val; | 772 | const decl_val = anon_decl.val; |
| ... | @@ -812,7 +812,7 @@ fn lowerDeclRef( | ... | @@ -812,7 +812,7 @@ fn lowerDeclRef( |
| 812 | _ = src_loc; | 812 | _ = src_loc; |
| 813 | _ = debug_output; | 813 | _ = debug_output; |
| 814 | const target = bin_file.options.target; | 814 | const target = bin_file.options.target; |
| 815 | const mod = bin_file.options.module.?; | 815 | const mod = bin_file.comp.module.?; |
| 816 | 816 | ||
| 817 | const ptr_width = target.ptrBitWidth(); | 817 | const ptr_width = target.ptrBitWidth(); |
| 818 | const decl = mod.declPtr(decl_index); | 818 | const decl = mod.declPtr(decl_index); |
| ... | @@ -902,7 +902,7 @@ fn genDeclRef( | ... | @@ -902,7 +902,7 @@ fn genDeclRef( |
| 902 | tv: TypedValue, | 902 | tv: TypedValue, |
| 903 | ptr_decl_index: InternPool.DeclIndex, | 903 | ptr_decl_index: InternPool.DeclIndex, |
| 904 | ) CodeGenError!GenResult { | 904 | ) CodeGenError!GenResult { |
| 905 | const mod = bin_file.options.module.?; | 905 | const mod = bin_file.comp.module.?; |
| 906 | log.debug("genDeclRef: ty = {}, val = {}", .{ tv.ty.fmt(mod), tv.val.fmtValue(tv.ty, mod) }); | 906 | log.debug("genDeclRef: ty = {}, val = {}", .{ tv.ty.fmt(mod), tv.val.fmtValue(tv.ty, mod) }); |
| 907 | 907 | ||
| 908 | const target = bin_file.options.target; | 908 | const target = bin_file.options.target; |
| ... | @@ -1010,7 +1010,7 @@ fn genUnnamedConst( | ... | @@ -1010,7 +1010,7 @@ fn genUnnamedConst( |
| 1010 | tv: TypedValue, | 1010 | tv: TypedValue, |
| 1011 | owner_decl_index: InternPool.DeclIndex, | 1011 | owner_decl_index: InternPool.DeclIndex, |
| 1012 | ) CodeGenError!GenResult { | 1012 | ) CodeGenError!GenResult { |
| 1013 | const mod = bin_file.options.module.?; | 1013 | const mod = bin_file.comp.module.?; |
| 1014 | log.debug("genUnnamedConst: ty = {}, val = {}", .{ tv.ty.fmt(mod), tv.val.fmtValue(tv.ty, mod) }); | 1014 | log.debug("genUnnamedConst: ty = {}, val = {}", .{ tv.ty.fmt(mod), tv.val.fmtValue(tv.ty, mod) }); |
| 1015 | 1015 | ||
| 1016 | const target = bin_file.options.target; | 1016 | const target = bin_file.options.target; |
| ... | @@ -1038,7 +1038,7 @@ pub fn genTypedValue( | ... | @@ -1038,7 +1038,7 @@ pub fn genTypedValue( |
| 1038 | arg_tv: TypedValue, | 1038 | arg_tv: TypedValue, |
| 1039 | owner_decl_index: InternPool.DeclIndex, | 1039 | owner_decl_index: InternPool.DeclIndex, |
| 1040 | ) CodeGenError!GenResult { | 1040 | ) CodeGenError!GenResult { |
| 1041 | const mod = bin_file.options.module.?; | 1041 | const mod = bin_file.comp.module.?; |
| 1042 | const typed_value = arg_tv; | 1042 | const typed_value = arg_tv; |
| 1043 | 1043 | ||
| 1044 | log.debug("genTypedValue: ty = {}, val = {}", .{ | 1044 | log.debug("genTypedValue: ty = {}, val = {}", .{ |
src/codegen/llvm.zig+1-1| ... | @@ -1227,7 +1227,7 @@ pub const Object = struct { | ... | @@ -1227,7 +1227,7 @@ pub const Object = struct { |
| 1227 | defer arena_allocator.deinit(); | 1227 | defer arena_allocator.deinit(); |
| 1228 | const arena = arena_allocator.allocator(); | 1228 | const arena = arena_allocator.allocator(); |
| 1229 | 1229 | ||
| 1230 | const mod = comp.bin_file.options.module.?; | 1230 | const mod = comp.module.?; |
| 1231 | const cache_dir = mod.zig_cache_artifact_directory; | 1231 | const cache_dir = mod.zig_cache_artifact_directory; |
| 1232 | 1232 | ||
| 1233 | if (std.debug.runtime_safety and !try self.builder.verify()) { | 1233 | if (std.debug.runtime_safety and !try self.builder.verify()) { |