authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-11 21:21:01-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:19-07:00
log2be36c5b8d7d22c2ffc20b88e497da7e6612de5c
tree05c9d7f58e82ff51ffa5be439ff75b37abe3b6ba
parent2bef0715c740024c515dce73d267ead5af49d1a9

linker: update references to module


10 files changed, 179 insertions(+), 179 deletions(-)

src/arch/wasm/CodeGen.zig+118-118
......@@ -766,7 +766,7 @@ pub fn deinit(func: *CodeGen) void {
766766
767767/// Sets `err_msg` on `CodeGen` and returns `error.CodegenFail` which is caught in link/Wasm.zig
768768fn fail(func: *CodeGen, comptime fmt: []const u8, args: anytype) InnerError {
769 const mod = func.bin_file.base.options.module.?;
769 const mod = func.bin_file.base.comp.module.?;
770770 const src = LazySrcLoc.nodeOffset(0);
771771 const src_loc = src.toSrcLoc(func.decl, mod);
772772 func.err_msg = try Module.ErrorMsg.create(func.gpa, src_loc, fmt, args);
......@@ -791,7 +791,7 @@ fn resolveInst(func: *CodeGen, ref: Air.Inst.Ref) InnerError!WValue {
791791 const gop = try func.branches.items[0].values.getOrPut(func.gpa, ref);
792792 assert(!gop.found_existing);
793793
794 const mod = func.bin_file.base.options.module.?;
794 const mod = func.bin_file.base.comp.module.?;
795795 const val = (try func.air.value(ref, mod)).?;
796796 const ty = func.typeOf(ref);
797797 if (!ty.hasRuntimeBitsIgnoreComptime(mod) and !ty.isInt(mod) and !ty.isError(mod)) {
......@@ -1101,7 +1101,7 @@ fn getResolvedInst(func: *CodeGen, ref: Air.Inst.Ref) *WValue {
11011101/// Creates one locals for a given `Type`.
11021102/// Returns a corresponding `Wvalue` with `local` as active tag
11031103fn allocLocal(func: *CodeGen, ty: Type) InnerError!WValue {
1104 const mod = func.bin_file.base.options.module.?;
1104 const mod = func.bin_file.base.comp.module.?;
11051105 const valtype = typeToValtype(ty, mod);
11061106 switch (valtype) {
11071107 .i32 => if (func.free_locals_i32.popOrNull()) |index| {
......@@ -1133,7 +1133,7 @@ fn allocLocal(func: *CodeGen, ty: Type) InnerError!WValue {
11331133/// Ensures a new local will be created. This is useful when it's useful
11341134/// to use a zero-initialized local.
11351135fn ensureAllocLocal(func: *CodeGen, ty: Type) InnerError!WValue {
1136 const mod = func.bin_file.base.options.module.?;
1136 const mod = func.bin_file.base.comp.module.?;
11371137 try func.locals.append(func.gpa, genValtype(ty, mod));
11381138 const initial_index = func.local_index;
11391139 func.local_index += 1;
......@@ -1237,7 +1237,7 @@ pub fn generate(
12371237}
12381238
12391239fn genFunc(func: *CodeGen) InnerError!void {
1240 const mod = func.bin_file.base.options.module.?;
1240 const mod = func.bin_file.base.comp.module.?;
12411241 const ip = &mod.intern_pool;
12421242 const fn_info = mod.typeToFunc(func.decl.ty).?;
12431243 var func_type = try genFunctype(func.gpa, fn_info.cc, fn_info.param_types.get(ip), Type.fromInterned(fn_info.return_type), mod);
......@@ -1348,7 +1348,7 @@ const CallWValues = struct {
13481348};
13491349
13501350fn resolveCallingConventionValues(func: *CodeGen, fn_ty: Type) InnerError!CallWValues {
1351 const mod = func.bin_file.base.options.module.?;
1351 const mod = func.bin_file.base.comp.module.?;
13521352 const ip = &mod.intern_pool;
13531353 const fn_info = mod.typeToFunc(fn_ty).?;
13541354 const cc = fn_info.cc;
......@@ -1417,7 +1417,7 @@ fn lowerArg(func: *CodeGen, cc: std.builtin.CallingConvention, ty: Type, value:
14171417 return func.lowerToStack(value);
14181418 }
14191419
1420 const mod = func.bin_file.base.options.module.?;
1420 const mod = func.bin_file.base.comp.module.?;
14211421 const ty_classes = abi.classifyType(ty, mod);
14221422 assert(ty_classes[0] != .none);
14231423 switch (ty.zigTypeTag(mod)) {
......@@ -1516,7 +1516,7 @@ fn restoreStackPointer(func: *CodeGen) !void {
15161516///
15171517/// Asserts Type has codegenbits
15181518fn allocStack(func: *CodeGen, ty: Type) !WValue {
1519 const mod = func.bin_file.base.options.module.?;
1519 const mod = func.bin_file.base.comp.module.?;
15201520 assert(ty.hasRuntimeBitsIgnoreComptime(mod));
15211521 if (func.initial_stack_value == .none) {
15221522 try func.initializeStack();
......@@ -1542,7 +1542,7 @@ fn allocStack(func: *CodeGen, ty: Type) !WValue {
15421542/// This is different from allocStack where this will use the pointer's alignment
15431543/// if it is set, to ensure the stack alignment will be set correctly.
15441544fn allocStackPtr(func: *CodeGen, inst: Air.Inst.Index) !WValue {
1545 const mod = func.bin_file.base.options.module.?;
1545 const mod = func.bin_file.base.comp.module.?;
15461546 const ptr_ty = func.typeOfIndex(inst);
15471547 const pointee_ty = ptr_ty.childType(mod);
15481548
......@@ -2072,7 +2072,7 @@ fn genInst(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
20722072}
20732073
20742074fn genBody(func: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
2075 const mod = func.bin_file.base.options.module.?;
2075 const mod = func.bin_file.base.comp.module.?;
20762076 const ip = &mod.intern_pool;
20772077
20782078 for (body) |inst| {
......@@ -2093,7 +2093,7 @@ fn genBody(func: *CodeGen, body: []const Air.Inst.Index) InnerError!void {
20932093}
20942094
20952095fn airRet(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
2096 const mod = func.bin_file.base.options.module.?;
2096 const mod = func.bin_file.base.comp.module.?;
20972097 const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
20982098 const operand = try func.resolveInst(un_op);
20992099 const fn_info = mod.typeToFunc(func.decl.ty).?;
......@@ -2136,7 +2136,7 @@ fn airRet(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
21362136}
21372137
21382138fn airRetPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
2139 const mod = func.bin_file.base.options.module.?;
2139 const mod = func.bin_file.base.comp.module.?;
21402140 const child_type = func.typeOfIndex(inst).childType(mod);
21412141
21422142 const result = result: {
......@@ -2156,7 +2156,7 @@ fn airRetPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
21562156}
21572157
21582158fn airRetLoad(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
2159 const mod = func.bin_file.base.options.module.?;
2159 const mod = func.bin_file.base.comp.module.?;
21602160 const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
21612161 const operand = try func.resolveInst(un_op);
21622162 const ret_ty = func.typeOf(un_op).childType(mod);
......@@ -2183,7 +2183,7 @@ fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif
21832183 const args = @as([]const Air.Inst.Ref, @ptrCast(func.air.extra[extra.end..][0..extra.data.args_len]));
21842184 const ty = func.typeOf(pl_op.operand);
21852185
2186 const mod = func.bin_file.base.options.module.?;
2186 const mod = func.bin_file.base.comp.module.?;
21872187 const ip = &mod.intern_pool;
21882188 const fn_ty = switch (ty.zigTypeTag(mod)) {
21892189 .Fn => ty,
......@@ -2295,7 +2295,7 @@ fn airAlloc(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
22952295}
22962296
22972297fn airStore(func: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void {
2298 const mod = func.bin_file.base.options.module.?;
2298 const mod = func.bin_file.base.comp.module.?;
22992299 if (safety) {
23002300 // TODO if the value is undef, write 0xaa bytes to dest
23012301 } else {
......@@ -2349,7 +2349,7 @@ fn airStore(func: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void
23492349
23502350fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerError!void {
23512351 assert(!(lhs != .stack and rhs == .stack));
2352 const mod = func.bin_file.base.options.module.?;
2352 const mod = func.bin_file.base.comp.module.?;
23532353 const abi_size = ty.abiSize(mod);
23542354 switch (ty.zigTypeTag(mod)) {
23552355 .ErrorUnion => {
......@@ -2428,7 +2428,7 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE
24282428 },
24292429 else => if (abi_size > 8) {
24302430 return func.fail("TODO: `store` for type `{}` with abisize `{d}`", .{
2431 ty.fmt(func.bin_file.base.options.module.?),
2431 ty.fmt(func.bin_file.base.comp.module.?),
24322432 abi_size,
24332433 });
24342434 },
......@@ -2456,7 +2456,7 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE
24562456}
24572457
24582458fn airLoad(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
2459 const mod = func.bin_file.base.options.module.?;
2459 const mod = func.bin_file.base.comp.module.?;
24602460 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
24612461 const operand = try func.resolveInst(ty_op.operand);
24622462 const ty = ty_op.ty.toType();
......@@ -2499,7 +2499,7 @@ fn airLoad(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
24992499/// Loads an operand from the linear memory section.
25002500/// NOTE: Leaves the value on the stack.
25012501fn load(func: *CodeGen, operand: WValue, ty: Type, offset: u32) InnerError!WValue {
2502 const mod = func.bin_file.base.options.module.?;
2502 const mod = func.bin_file.base.comp.module.?;
25032503 // load local's value from memory by its stack position
25042504 try func.emitWValue(operand);
25052505
......@@ -2536,7 +2536,7 @@ fn load(func: *CodeGen, operand: WValue, ty: Type, offset: u32) InnerError!WValu
25362536}
25372537
25382538fn airArg(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
2539 const mod = func.bin_file.base.options.module.?;
2539 const mod = func.bin_file.base.comp.module.?;
25402540 const arg_index = func.arg_index;
25412541 const arg = func.args[arg_index];
25422542 const cc = mod.typeToFunc(func.decl.ty).?.cc;
......@@ -2555,7 +2555,7 @@ fn airArg(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
25552555 if (arg_ty.zigTypeTag(mod) != .Int and arg_ty.zigTypeTag(mod) != .Float) {
25562556 return func.fail(
25572557 "TODO: Implement C-ABI argument for type '{}'",
2558 .{arg_ty.fmt(func.bin_file.base.options.module.?)},
2558 .{arg_ty.fmt(func.bin_file.base.comp.module.?)},
25592559 );
25602560 }
25612561 const result = try func.allocStack(arg_ty);
......@@ -2582,7 +2582,7 @@ fn airArg(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
25822582}
25832583
25842584fn airBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
2585 const mod = func.bin_file.base.options.module.?;
2585 const mod = func.bin_file.base.comp.module.?;
25862586 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
25872587 const lhs = try func.resolveInst(bin_op.lhs);
25882588 const rhs = try func.resolveInst(bin_op.rhs);
......@@ -2619,7 +2619,7 @@ fn airBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
26192619/// Performs a binary operation on the given `WValue`'s
26202620/// NOTE: THis leaves the value on top of the stack.
26212621fn binOp(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) InnerError!WValue {
2622 const mod = func.bin_file.base.options.module.?;
2622 const mod = func.bin_file.base.comp.module.?;
26232623 assert(!(lhs != .stack and rhs == .stack));
26242624
26252625 if (ty.isAnyFloat()) {
......@@ -2633,7 +2633,7 @@ fn binOp(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) InnerError!
26332633 } else {
26342634 return func.fail(
26352635 "TODO: Implement binary operation for type: {}",
2636 .{ty.fmt(func.bin_file.base.options.module.?)},
2636 .{ty.fmt(func.bin_file.base.comp.module.?)},
26372637 );
26382638 }
26392639 }
......@@ -2652,7 +2652,7 @@ fn binOp(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) InnerError!
26522652}
26532653
26542654fn binOpBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) InnerError!WValue {
2655 const mod = func.bin_file.base.options.module.?;
2655 const mod = func.bin_file.base.comp.module.?;
26562656 const int_info = ty.intInfo(mod);
26572657 if (int_info.bits > 128) {
26582658 return func.fail("TODO: Implement binary operation for big integers larger than 128 bits", .{});
......@@ -2788,7 +2788,7 @@ const FloatOp = enum {
27882788};
27892789
27902790fn airAbs(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
2791 const mod = func.bin_file.base.options.module.?;
2791 const mod = func.bin_file.base.comp.module.?;
27922792 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
27932793 const operand = try func.resolveInst(ty_op.operand);
27942794 const ty = func.typeOf(ty_op.operand);
......@@ -2873,7 +2873,7 @@ fn airUnaryFloatOp(func: *CodeGen, inst: Air.Inst.Index, op: FloatOp) InnerError
28732873}
28742874
28752875fn floatOp(func: *CodeGen, float_op: FloatOp, ty: Type, args: []const WValue) InnerError!WValue {
2876 const mod = func.bin_file.base.options.module.?;
2876 const mod = func.bin_file.base.comp.module.?;
28772877 if (ty.zigTypeTag(mod) == .Vector) {
28782878 return func.fail("TODO: Implement floatOps for vectors", .{});
28792879 }
......@@ -2979,7 +2979,7 @@ fn floatNeg(func: *CodeGen, ty: Type, arg: WValue) InnerError!WValue {
29792979}
29802980
29812981fn airWrapBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
2982 const mod = func.bin_file.base.options.module.?;
2982 const mod = func.bin_file.base.comp.module.?;
29832983 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
29842984
29852985 const lhs = try func.resolveInst(bin_op.lhs);
......@@ -3030,7 +3030,7 @@ fn wrapBinOp(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) InnerEr
30303030/// Asserts `Type` is <= 128 bits.
30313031/// NOTE: When the Type is <= 64 bits, leaves the value on top of the stack.
30323032fn wrapOperand(func: *CodeGen, operand: WValue, ty: Type) InnerError!WValue {
3033 const mod = func.bin_file.base.options.module.?;
3033 const mod = func.bin_file.base.comp.module.?;
30343034 assert(ty.abiSize(mod) <= 16);
30353035 const bitsize = @as(u16, @intCast(ty.bitSize(mod)));
30363036 const wasm_bits = toWasmBits(bitsize) orelse {
......@@ -3069,7 +3069,7 @@ fn wrapOperand(func: *CodeGen, operand: WValue, ty: Type) InnerError!WValue {
30693069}
30703070
30713071fn lowerParentPtr(func: *CodeGen, ptr_val: Value, offset: u32) InnerError!WValue {
3072 const mod = func.bin_file.base.options.module.?;
3072 const mod = func.bin_file.base.comp.module.?;
30733073 const ptr = mod.intern_pool.indexToKey(ptr_val.ip_index).ptr;
30743074 switch (ptr.addr) {
30753075 .decl => |decl_index| {
......@@ -3132,7 +3132,7 @@ fn lowerParentPtr(func: *CodeGen, ptr_val: Value, offset: u32) InnerError!WValue
31323132}
31333133
31343134fn lowerParentPtrDecl(func: *CodeGen, ptr_val: Value, decl_index: InternPool.DeclIndex, offset: u32) InnerError!WValue {
3135 const mod = func.bin_file.base.options.module.?;
3135 const mod = func.bin_file.base.comp.module.?;
31363136 const decl = mod.declPtr(decl_index);
31373137 try mod.markDeclAlive(decl);
31383138 const ptr_ty = try mod.singleMutPtrType(decl.ty);
......@@ -3144,7 +3144,7 @@ fn lowerAnonDeclRef(
31443144 anon_decl: InternPool.Key.Ptr.Addr.AnonDecl,
31453145 offset: u32,
31463146) InnerError!WValue {
3147 const mod = func.bin_file.base.options.module.?;
3147 const mod = func.bin_file.base.comp.module.?;
31483148 const decl_val = anon_decl.val;
31493149 const ty = Type.fromInterned(mod.intern_pool.typeOf(decl_val));
31503150
......@@ -3172,7 +3172,7 @@ fn lowerAnonDeclRef(
31723172}
31733173
31743174fn lowerDeclRefValue(func: *CodeGen, tv: TypedValue, decl_index: InternPool.DeclIndex, offset: u32) InnerError!WValue {
3175 const mod = func.bin_file.base.options.module.?;
3175 const mod = func.bin_file.base.comp.module.?;
31763176 if (tv.ty.isSlice(mod)) {
31773177 return WValue{ .memory = try func.bin_file.lowerUnnamedConst(tv, decl_index) };
31783178 }
......@@ -3225,7 +3225,7 @@ fn toTwosComplement(value: anytype, bits: u7) std.meta.Int(.unsigned, @typeInfo(
32253225/// This function is intended to assert that `isByRef` returns `false` for `ty`.
32263226/// However such an assertion fails on the behavior tests currently.
32273227fn lowerConstant(func: *CodeGen, val: Value, ty: Type) InnerError!WValue {
3228 const mod = func.bin_file.base.options.module.?;
3228 const mod = func.bin_file.base.comp.module.?;
32293229 // TODO: enable this assertion
32303230 //assert(!isByRef(ty, mod));
32313231 const ip = &mod.intern_pool;
......@@ -3394,7 +3394,7 @@ fn storeSimdImmd(func: *CodeGen, value: [16]u8) !WValue {
33943394}
33953395
33963396fn emitUndefined(func: *CodeGen, ty: Type) InnerError!WValue {
3397 const mod = func.bin_file.base.options.module.?;
3397 const mod = func.bin_file.base.comp.module.?;
33983398 const ip = &mod.intern_pool;
33993399 switch (ty.zigTypeTag(mod)) {
34003400 .Bool, .ErrorSet => return WValue{ .imm32 = 0xaaaaaaaa },
......@@ -3436,7 +3436,7 @@ fn emitUndefined(func: *CodeGen, ty: Type) InnerError!WValue {
34363436/// It's illegal to provide a value with a type that cannot be represented
34373437/// as an integer value.
34383438fn valueAsI32(func: *const CodeGen, val: Value, ty: Type) i32 {
3439 const mod = func.bin_file.base.options.module.?;
3439 const mod = func.bin_file.base.comp.module.?;
34403440
34413441 switch (val.ip_index) {
34423442 .none => {},
......@@ -3472,7 +3472,7 @@ fn intStorageAsI32(storage: InternPool.Key.Int.Storage, mod: *Module) i32 {
34723472}
34733473
34743474fn airBlock(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
3475 const mod = func.bin_file.base.options.module.?;
3475 const mod = func.bin_file.base.comp.module.?;
34763476 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
34773477 const block_ty = ty_pl.ty.toType();
34783478 const wasm_block_ty = genBlockType(block_ty, mod);
......@@ -3593,7 +3593,7 @@ fn airCmp(func: *CodeGen, inst: Air.Inst.Index, op: std.math.CompareOperator) In
35933593/// NOTE: This leaves the result on top of the stack, rather than a new local.
35943594fn cmp(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: std.math.CompareOperator) InnerError!WValue {
35953595 assert(!(lhs != .stack and rhs == .stack));
3596 const mod = func.bin_file.base.options.module.?;
3596 const mod = func.bin_file.base.comp.module.?;
35973597 if (ty.zigTypeTag(mod) == .Optional and !ty.optionalReprIsPayload(mod)) {
35983598 const payload_ty = ty.optionalChild(mod);
35993599 if (payload_ty.hasRuntimeBitsIgnoreComptime(mod)) {
......@@ -3711,7 +3711,7 @@ fn airCmpLtErrorsLen(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
37113711 const errors_len = WValue{ .memory = sym_index };
37123712
37133713 try func.emitWValue(operand);
3714 const mod = func.bin_file.base.options.module.?;
3714 const mod = func.bin_file.base.comp.module.?;
37153715 const err_int_ty = try mod.errorIntType();
37163716 const errors_len_val = try func.load(errors_len, err_int_ty, 0);
37173717 const result = try func.cmp(.stack, errors_len_val, err_int_ty, .lt);
......@@ -3720,7 +3720,7 @@ fn airCmpLtErrorsLen(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
37203720}
37213721
37223722fn airBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
3723 const mod = func.bin_file.base.options.module.?;
3723 const mod = func.bin_file.base.comp.module.?;
37243724 const br = func.air.instructions.items(.data)[@intFromEnum(inst)].br;
37253725 const block = func.blocks.get(br.block_inst).?;
37263726
......@@ -3747,7 +3747,7 @@ fn airNot(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
37473747
37483748 const operand = try func.resolveInst(ty_op.operand);
37493749 const operand_ty = func.typeOf(ty_op.operand);
3750 const mod = func.bin_file.base.options.module.?;
3750 const mod = func.bin_file.base.comp.module.?;
37513751
37523752 const result = result: {
37533753 if (operand_ty.zigTypeTag(mod) == .Bool) {
......@@ -3818,7 +3818,7 @@ fn airBitcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
38183818 const bitcast_result = try func.bitcast(wanted_ty, given_ty, operand);
38193819 break :result try bitcast_result.toLocal(func, wanted_ty);
38203820 }
3821 const mod = func.bin_file.base.options.module.?;
3821 const mod = func.bin_file.base.comp.module.?;
38223822 if (isByRef(given_ty, mod) and !isByRef(wanted_ty, mod)) {
38233823 const loaded_memory = try func.load(operand, wanted_ty, 0);
38243824 break :result try loaded_memory.toLocal(func, wanted_ty);
......@@ -3834,7 +3834,7 @@ fn airBitcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
38343834}
38353835
38363836fn bitcast(func: *CodeGen, wanted_ty: Type, given_ty: Type, operand: WValue) InnerError!WValue {
3837 const mod = func.bin_file.base.options.module.?;
3837 const mod = func.bin_file.base.comp.module.?;
38383838 // if we bitcast a float to or from an integer we must use the 'reinterpret' instruction
38393839 if (!(wanted_ty.isAnyFloat() or given_ty.isAnyFloat())) return operand;
38403840 if (wanted_ty.ip_index == .f16_type or given_ty.ip_index == .f16_type) return operand;
......@@ -3852,7 +3852,7 @@ fn bitcast(func: *CodeGen, wanted_ty: Type, given_ty: Type, operand: WValue) Inn
38523852}
38533853
38543854fn airStructFieldPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
3855 const mod = func.bin_file.base.options.module.?;
3855 const mod = func.bin_file.base.comp.module.?;
38563856 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
38573857 const extra = func.air.extraData(Air.StructField, ty_pl.payload);
38583858
......@@ -3864,7 +3864,7 @@ fn airStructFieldPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
38643864}
38653865
38663866fn airStructFieldPtrIndex(func: *CodeGen, inst: Air.Inst.Index, index: u32) InnerError!void {
3867 const mod = func.bin_file.base.options.module.?;
3867 const mod = func.bin_file.base.comp.module.?;
38683868 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
38693869 const struct_ptr = try func.resolveInst(ty_op.operand);
38703870 const struct_ptr_ty = func.typeOf(ty_op.operand);
......@@ -3883,7 +3883,7 @@ fn structFieldPtr(
38833883 struct_ty: Type,
38843884 index: u32,
38853885) InnerError!WValue {
3886 const mod = func.bin_file.base.options.module.?;
3886 const mod = func.bin_file.base.comp.module.?;
38873887 const result_ty = func.typeOfIndex(inst);
38883888 const struct_ptr_ty_info = struct_ptr_ty.ptrInfo(mod);
38893889
......@@ -3914,7 +3914,7 @@ fn structFieldPtr(
39143914}
39153915
39163916fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
3917 const mod = func.bin_file.base.options.module.?;
3917 const mod = func.bin_file.base.comp.module.?;
39183918 const ip = &mod.intern_pool;
39193919 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
39203920 const struct_field = func.air.extraData(Air.StructField, ty_pl.payload).data;
......@@ -4013,7 +4013,7 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
40134013}
40144014
40154015fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4016 const mod = func.bin_file.base.options.module.?;
4016 const mod = func.bin_file.base.comp.module.?;
40174017 // result type is always 'noreturn'
40184018 const blocktype = wasm.block_empty;
40194019 const pl_op = func.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
......@@ -4193,7 +4193,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
41934193}
41944194
41954195fn airIsErr(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode) InnerError!void {
4196 const mod = func.bin_file.base.options.module.?;
4196 const mod = func.bin_file.base.comp.module.?;
41974197 const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
41984198 const operand = try func.resolveInst(un_op);
41994199 const err_union_ty = func.typeOf(un_op);
......@@ -4228,7 +4228,7 @@ fn airIsErr(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode) InnerErro
42284228}
42294229
42304230fn airUnwrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void {
4231 const mod = func.bin_file.base.options.module.?;
4231 const mod = func.bin_file.base.comp.module.?;
42324232 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
42334233
42344234 const operand = try func.resolveInst(ty_op.operand);
......@@ -4256,7 +4256,7 @@ fn airUnwrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: boo
42564256}
42574257
42584258fn airUnwrapErrUnionError(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool) InnerError!void {
4259 const mod = func.bin_file.base.options.module.?;
4259 const mod = func.bin_file.base.comp.module.?;
42604260 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
42614261
42624262 const operand = try func.resolveInst(ty_op.operand);
......@@ -4280,7 +4280,7 @@ fn airUnwrapErrUnionError(func: *CodeGen, inst: Air.Inst.Index, op_is_ptr: bool)
42804280}
42814281
42824282fn airWrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4283 const mod = func.bin_file.base.options.module.?;
4283 const mod = func.bin_file.base.comp.module.?;
42844284 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
42854285
42864286 const operand = try func.resolveInst(ty_op.operand);
......@@ -4310,7 +4310,7 @@ fn airWrapErrUnionPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void
43104310}
43114311
43124312fn airWrapErrUnionErr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4313 const mod = func.bin_file.base.options.module.?;
4313 const mod = func.bin_file.base.comp.module.?;
43144314 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
43154315
43164316 const operand = try func.resolveInst(ty_op.operand);
......@@ -4342,7 +4342,7 @@ fn airIntcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
43424342 const ty = ty_op.ty.toType();
43434343 const operand = try func.resolveInst(ty_op.operand);
43444344 const operand_ty = func.typeOf(ty_op.operand);
4345 const mod = func.bin_file.base.options.module.?;
4345 const mod = func.bin_file.base.comp.module.?;
43464346 if (ty.zigTypeTag(mod) == .Vector or operand_ty.zigTypeTag(mod) == .Vector) {
43474347 return func.fail("todo Wasm intcast for vectors", .{});
43484348 }
......@@ -4365,7 +4365,7 @@ fn airIntcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
43654365/// Asserts type's bitsize <= 128
43664366/// NOTE: May leave the result on the top of the stack.
43674367fn intcast(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerError!WValue {
4368 const mod = func.bin_file.base.options.module.?;
4368 const mod = func.bin_file.base.comp.module.?;
43694369 const given_bitsize = @as(u16, @intCast(given.bitSize(mod)));
43704370 const wanted_bitsize = @as(u16, @intCast(wanted.bitSize(mod)));
43714371 assert(given_bitsize <= 128);
......@@ -4433,7 +4433,7 @@ fn intcast(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerErro
44334433}
44344434
44354435fn airIsNull(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode, op_kind: enum { value, ptr }) InnerError!void {
4436 const mod = func.bin_file.base.options.module.?;
4436 const mod = func.bin_file.base.comp.module.?;
44374437 const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
44384438 const operand = try func.resolveInst(un_op);
44394439
......@@ -4447,7 +4447,7 @@ fn airIsNull(func: *CodeGen, inst: Air.Inst.Index, opcode: wasm.Opcode, op_kind:
44474447/// For a given type and operand, checks if it's considered `null`.
44484448/// NOTE: Leaves the result on the stack
44494449fn isNull(func: *CodeGen, operand: WValue, optional_ty: Type, opcode: wasm.Opcode) InnerError!WValue {
4450 const mod = func.bin_file.base.options.module.?;
4450 const mod = func.bin_file.base.comp.module.?;
44514451 try func.emitWValue(operand);
44524452 const payload_ty = optional_ty.optionalChild(mod);
44534453 if (!optional_ty.optionalReprIsPayload(mod)) {
......@@ -4475,7 +4475,7 @@ fn isNull(func: *CodeGen, operand: WValue, optional_ty: Type, opcode: wasm.Opcod
44754475}
44764476
44774477fn airOptionalPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4478 const mod = func.bin_file.base.options.module.?;
4478 const mod = func.bin_file.base.comp.module.?;
44794479 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
44804480 const opt_ty = func.typeOf(ty_op.operand);
44814481 const payload_ty = func.typeOfIndex(inst);
......@@ -4498,7 +4498,7 @@ fn airOptionalPayload(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
44984498}
44994499
45004500fn airOptionalPayloadPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4501 const mod = func.bin_file.base.options.module.?;
4501 const mod = func.bin_file.base.comp.module.?;
45024502 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
45034503 const operand = try func.resolveInst(ty_op.operand);
45044504 const opt_ty = func.typeOf(ty_op.operand).childType(mod);
......@@ -4515,7 +4515,7 @@ fn airOptionalPayloadPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
45154515}
45164516
45174517fn airOptionalPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4518 const mod = func.bin_file.base.options.module.?;
4518 const mod = func.bin_file.base.comp.module.?;
45194519 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
45204520 const operand = try func.resolveInst(ty_op.operand);
45214521 const opt_ty = func.typeOf(ty_op.operand).childType(mod);
......@@ -4543,7 +4543,7 @@ fn airOptionalPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!voi
45434543fn airWrapOptional(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
45444544 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
45454545 const payload_ty = func.typeOf(ty_op.operand);
4546 const mod = func.bin_file.base.options.module.?;
4546 const mod = func.bin_file.base.comp.module.?;
45474547
45484548 const result = result: {
45494549 if (!payload_ty.hasRuntimeBitsIgnoreComptime(mod)) {
......@@ -4600,7 +4600,7 @@ fn airSliceLen(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
46004600}
46014601
46024602fn airSliceElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4603 const mod = func.bin_file.base.options.module.?;
4603 const mod = func.bin_file.base.comp.module.?;
46044604 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
46054605
46064606 const slice_ty = func.typeOf(bin_op.lhs);
......@@ -4630,7 +4630,7 @@ fn airSliceElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
46304630}
46314631
46324632fn airSliceElemPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4633 const mod = func.bin_file.base.options.module.?;
4633 const mod = func.bin_file.base.comp.module.?;
46344634 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
46354635 const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data;
46364636
......@@ -4683,7 +4683,7 @@ fn airTrunc(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
46834683/// Truncates a given operand to a given type, discarding any overflown bits.
46844684/// NOTE: Resulting value is left on the stack.
46854685fn trunc(func: *CodeGen, operand: WValue, wanted_ty: Type, given_ty: Type) InnerError!WValue {
4686 const mod = func.bin_file.base.options.module.?;
4686 const mod = func.bin_file.base.comp.module.?;
46874687 const given_bits = @as(u16, @intCast(given_ty.bitSize(mod)));
46884688 if (toWasmBits(given_bits) == null) {
46894689 return func.fail("TODO: Implement wasm integer truncation for integer bitsize: {d}", .{given_bits});
......@@ -4707,7 +4707,7 @@ fn airIntFromBool(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
47074707}
47084708
47094709fn airArrayToSlice(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4710 const mod = func.bin_file.base.options.module.?;
4710 const mod = func.bin_file.base.comp.module.?;
47114711 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
47124712
47134713 const operand = try func.resolveInst(ty_op.operand);
......@@ -4730,7 +4730,7 @@ fn airArrayToSlice(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
47304730}
47314731
47324732fn airIntFromPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4733 const mod = func.bin_file.base.options.module.?;
4733 const mod = func.bin_file.base.comp.module.?;
47344734 const un_op = func.air.instructions.items(.data)[@intFromEnum(inst)].un_op;
47354735 const operand = try func.resolveInst(un_op);
47364736 const ptr_ty = func.typeOf(un_op);
......@@ -4745,7 +4745,7 @@ fn airIntFromPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
47454745}
47464746
47474747fn airPtrElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4748 const mod = func.bin_file.base.options.module.?;
4748 const mod = func.bin_file.base.comp.module.?;
47494749 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
47504750
47514751 const ptr_ty = func.typeOf(bin_op.lhs);
......@@ -4782,7 +4782,7 @@ fn airPtrElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
47824782}
47834783
47844784fn airPtrElemPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4785 const mod = func.bin_file.base.options.module.?;
4785 const mod = func.bin_file.base.comp.module.?;
47864786 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
47874787 const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data;
47884788
......@@ -4812,7 +4812,7 @@ fn airPtrElemPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
48124812}
48134813
48144814fn airPtrBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
4815 const mod = func.bin_file.base.options.module.?;
4815 const mod = func.bin_file.base.comp.module.?;
48164816 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
48174817 const bin_op = func.air.extraData(Air.Bin, ty_pl.payload).data;
48184818
......@@ -4840,7 +4840,7 @@ fn airPtrBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
48404840}
48414841
48424842fn airMemset(func: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void {
4843 const mod = func.bin_file.base.options.module.?;
4843 const mod = func.bin_file.base.comp.module.?;
48444844 if (safety) {
48454845 // TODO if the value is undef, write 0xaa bytes to dest
48464846 } else {
......@@ -4873,7 +4873,7 @@ fn airMemset(func: *CodeGen, inst: Air.Inst.Index, safety: bool) InnerError!void
48734873/// this to wasm's memset instruction. When the feature is not present,
48744874/// we implement it manually.
48754875fn memset(func: *CodeGen, elem_ty: Type, ptr: WValue, len: WValue, value: WValue) InnerError!void {
4876 const mod = func.bin_file.base.options.module.?;
4876 const mod = func.bin_file.base.comp.module.?;
48774877 const abi_size = @as(u32, @intCast(elem_ty.abiSize(mod)));
48784878
48794879 // When bulk_memory is enabled, we lower it to wasm's memset instruction.
......@@ -4962,7 +4962,7 @@ fn memset(func: *CodeGen, elem_ty: Type, ptr: WValue, len: WValue, value: WValue
49624962}
49634963
49644964fn airArrayElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
4965 const mod = func.bin_file.base.options.module.?;
4965 const mod = func.bin_file.base.comp.module.?;
49664966 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
49674967
49684968 const array_ty = func.typeOf(bin_op.lhs);
......@@ -5031,7 +5031,7 @@ fn airArrayElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
50315031}
50325032
50335033fn airIntFromFloat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5034 const mod = func.bin_file.base.options.module.?;
5034 const mod = func.bin_file.base.comp.module.?;
50355035 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
50365036
50375037 const operand = try func.resolveInst(ty_op.operand);
......@@ -5076,7 +5076,7 @@ fn airIntFromFloat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
50765076}
50775077
50785078fn airFloatFromInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5079 const mod = func.bin_file.base.options.module.?;
5079 const mod = func.bin_file.base.comp.module.?;
50805080 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
50815081
50825082 const operand = try func.resolveInst(ty_op.operand);
......@@ -5122,7 +5122,7 @@ fn airFloatFromInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
51225122}
51235123
51245124fn airSplat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5125 const mod = func.bin_file.base.options.module.?;
5125 const mod = func.bin_file.base.comp.module.?;
51265126 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
51275127 const operand = try func.resolveInst(ty_op.operand);
51285128 const ty = func.typeOfIndex(inst);
......@@ -5201,7 +5201,7 @@ fn airSelect(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
52015201}
52025202
52035203fn airShuffle(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5204 const mod = func.bin_file.base.options.module.?;
5204 const mod = func.bin_file.base.comp.module.?;
52055205 const inst_ty = func.typeOfIndex(inst);
52065206 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
52075207 const extra = func.air.extraData(Air.Shuffle, ty_pl.payload).data;
......@@ -5270,7 +5270,7 @@ fn airReduce(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
52705270}
52715271
52725272fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5273 const mod = func.bin_file.base.options.module.?;
5273 const mod = func.bin_file.base.comp.module.?;
52745274 const ip = &mod.intern_pool;
52755275 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
52765276 const result_ty = func.typeOfIndex(inst);
......@@ -5400,7 +5400,7 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
54005400}
54015401
54025402fn airUnionInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5403 const mod = func.bin_file.base.options.module.?;
5403 const mod = func.bin_file.base.comp.module.?;
54045404 const ip = &mod.intern_pool;
54055405 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
54065406 const extra = func.air.extraData(Air.UnionInit, ty_pl.payload).data;
......@@ -5499,7 +5499,7 @@ fn airWasmMemoryGrow(func: *CodeGen, inst: Air.Inst.Index) !void {
54995499}
55005500
55015501fn cmpOptionals(func: *CodeGen, lhs: WValue, rhs: WValue, operand_ty: Type, op: std.math.CompareOperator) InnerError!WValue {
5502 const mod = func.bin_file.base.options.module.?;
5502 const mod = func.bin_file.base.comp.module.?;
55035503 assert(operand_ty.hasRuntimeBitsIgnoreComptime(mod));
55045504 assert(op == .eq or op == .neq);
55055505 const payload_ty = operand_ty.optionalChild(mod);
......@@ -5535,7 +5535,7 @@ fn cmpOptionals(func: *CodeGen, lhs: WValue, rhs: WValue, operand_ty: Type, op:
55355535/// NOTE: Leaves the result of the comparison on top of the stack.
55365536/// TODO: Lower this to compiler_rt call when bitsize > 128
55375537fn cmpBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, operand_ty: Type, op: std.math.CompareOperator) InnerError!WValue {
5538 const mod = func.bin_file.base.options.module.?;
5538 const mod = func.bin_file.base.comp.module.?;
55395539 assert(operand_ty.abiSize(mod) >= 16);
55405540 assert(!(lhs != .stack and rhs == .stack));
55415541 if (operand_ty.bitSize(mod) > 128) {
......@@ -5577,7 +5577,7 @@ fn cmpBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, operand_ty: Type, op: std
55775577}
55785578
55795579fn airSetUnionTag(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5580 const mod = func.bin_file.base.options.module.?;
5580 const mod = func.bin_file.base.comp.module.?;
55815581 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
55825582 const un_ty = func.typeOf(bin_op.lhs).childType(mod);
55835583 const tag_ty = func.typeOf(bin_op.rhs);
......@@ -5601,7 +5601,7 @@ fn airSetUnionTag(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
56015601}
56025602
56035603fn airGetUnionTag(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5604 const mod = func.bin_file.base.options.module.?;
5604 const mod = func.bin_file.base.comp.module.?;
56055605 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
56065606
56075607 const un_ty = func.typeOf(ty_op.operand);
......@@ -5706,7 +5706,7 @@ fn fptrunc(func: *CodeGen, operand: WValue, given: Type, wanted: Type) InnerErro
57065706}
57075707
57085708fn airErrUnionPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5709 const mod = func.bin_file.base.options.module.?;
5709 const mod = func.bin_file.base.comp.module.?;
57105710 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
57115711
57125712 const err_set_ty = func.typeOf(ty_op.operand).childType(mod);
......@@ -5732,7 +5732,7 @@ fn airErrUnionPayloadPtrSet(func: *CodeGen, inst: Air.Inst.Index) InnerError!voi
57325732}
57335733
57345734fn airFieldParentPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5735 const mod = func.bin_file.base.options.module.?;
5735 const mod = func.bin_file.base.comp.module.?;
57365736 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
57375737 const extra = func.air.extraData(Air.FieldParentPtr, ty_pl.payload).data;
57385738
......@@ -5753,7 +5753,7 @@ fn airFieldParentPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
57535753}
57545754
57555755fn sliceOrArrayPtr(func: *CodeGen, ptr: WValue, ptr_ty: Type) InnerError!WValue {
5756 const mod = func.bin_file.base.options.module.?;
5756 const mod = func.bin_file.base.comp.module.?;
57575757 if (ptr_ty.isSlice(mod)) {
57585758 return func.slicePtr(ptr);
57595759 } else {
......@@ -5762,7 +5762,7 @@ fn sliceOrArrayPtr(func: *CodeGen, ptr: WValue, ptr_ty: Type) InnerError!WValue
57625762}
57635763
57645764fn airMemcpy(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5765 const mod = func.bin_file.base.options.module.?;
5765 const mod = func.bin_file.base.comp.module.?;
57665766 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
57675767 const dst = try func.resolveInst(bin_op.lhs);
57685768 const dst_ty = func.typeOf(bin_op.lhs);
......@@ -5802,7 +5802,7 @@ fn airRetAddr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
58025802}
58035803
58045804fn airPopcount(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
5805 const mod = func.bin_file.base.options.module.?;
5805 const mod = func.bin_file.base.comp.module.?;
58065806 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
58075807
58085808 const operand = try func.resolveInst(ty_op.operand);
......@@ -5863,7 +5863,7 @@ fn airErrorName(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
58635863 // to make a copy of the ptr+value but can point towards them directly.
58645864 const error_table_symbol = try func.bin_file.getErrorTableSymbol();
58655865 const name_ty = Type.slice_const_u8_sentinel_0;
5866 const mod = func.bin_file.base.options.module.?;
5866 const mod = func.bin_file.base.comp.module.?;
58675867 const abi_size = name_ty.abiSize(mod);
58685868
58695869 const error_name_value: WValue = .{ .memory = error_table_symbol }; // emitting this will create a relocation
......@@ -5903,7 +5903,7 @@ fn airAddSubWithOverflow(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerErro
59035903 const lhs_op = try func.resolveInst(extra.lhs);
59045904 const rhs_op = try func.resolveInst(extra.rhs);
59055905 const lhs_ty = func.typeOf(extra.lhs);
5906 const mod = func.bin_file.base.options.module.?;
5906 const mod = func.bin_file.base.comp.module.?;
59075907
59085908 if (lhs_ty.zigTypeTag(mod) == .Vector) {
59095909 return func.fail("TODO: Implement overflow arithmetic for vectors", .{});
......@@ -5975,7 +5975,7 @@ fn airAddSubWithOverflow(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerErro
59755975}
59765976
59775977fn addSubWithOverflowBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, result_ty: Type, op: Op) InnerError!WValue {
5978 const mod = func.bin_file.base.options.module.?;
5978 const mod = func.bin_file.base.comp.module.?;
59795979 assert(op == .add or op == .sub);
59805980 const int_info = ty.intInfo(mod);
59815981 const is_signed = int_info.signedness == .signed;
......@@ -6040,7 +6040,7 @@ fn addSubWithOverflowBigInt(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type,
60406040}
60416041
60426042fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
6043 const mod = func.bin_file.base.options.module.?;
6043 const mod = func.bin_file.base.comp.module.?;
60446044 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
60456045 const extra = func.air.extraData(Air.Bin, ty_pl.payload).data;
60466046
......@@ -6103,7 +6103,7 @@ fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
61036103 const lhs = try func.resolveInst(extra.lhs);
61046104 const rhs = try func.resolveInst(extra.rhs);
61056105 const lhs_ty = func.typeOf(extra.lhs);
6106 const mod = func.bin_file.base.options.module.?;
6106 const mod = func.bin_file.base.comp.module.?;
61076107
61086108 if (lhs_ty.zigTypeTag(mod) == .Vector) {
61096109 return func.fail("TODO: Implement overflow arithmetic for vectors", .{});
......@@ -6273,7 +6273,7 @@ fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
62736273
62746274fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
62756275 assert(op == .max or op == .min);
6276 const mod = func.bin_file.base.options.module.?;
6276 const mod = func.bin_file.base.comp.module.?;
62776277 const target = mod.getTarget();
62786278 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
62796279
......@@ -6317,7 +6317,7 @@ fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
63176317}
63186318
63196319fn airMulAdd(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
6320 const mod = func.bin_file.base.options.module.?;
6320 const mod = func.bin_file.base.comp.module.?;
63216321 const pl_op = func.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
63226322 const bin_op = func.air.extraData(Air.Bin, pl_op.payload).data;
63236323
......@@ -6351,7 +6351,7 @@ fn airMulAdd(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
63516351}
63526352
63536353fn airClz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
6354 const mod = func.bin_file.base.options.module.?;
6354 const mod = func.bin_file.base.comp.module.?;
63556355 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
63566356
63576357 const ty = func.typeOf(ty_op.operand);
......@@ -6404,7 +6404,7 @@ fn airClz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
64046404}
64056405
64066406fn airCtz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
6407 const mod = func.bin_file.base.options.module.?;
6407 const mod = func.bin_file.base.comp.module.?;
64086408 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
64096409
64106410 const ty = func.typeOf(ty_op.operand);
......@@ -6471,7 +6471,7 @@ fn airCtz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
64716471fn airDbgVar(func: *CodeGen, inst: Air.Inst.Index, is_ptr: bool) !void {
64726472 if (func.debug_output != .dwarf) return func.finishAir(inst, .none, &.{});
64736473
6474 const mod = func.bin_file.base.options.module.?;
6474 const mod = func.bin_file.base.comp.module.?;
64756475 const pl_op = func.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
64766476 const ty = func.typeOf(pl_op.operand);
64776477 const operand = try func.resolveInst(pl_op.operand);
......@@ -6517,7 +6517,7 @@ fn airTry(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
65176517}
65186518
65196519fn airTryPtr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
6520 const mod = func.bin_file.base.options.module.?;
6520 const mod = func.bin_file.base.comp.module.?;
65216521 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
65226522 const extra = func.air.extraData(Air.TryPtr, ty_pl.payload);
65236523 const err_union_ptr = try func.resolveInst(extra.data.ptr);
......@@ -6535,7 +6535,7 @@ fn lowerTry(
65356535 err_union_ty: Type,
65366536 operand_is_ptr: bool,
65376537) InnerError!WValue {
6538 const mod = func.bin_file.base.options.module.?;
6538 const mod = func.bin_file.base.comp.module.?;
65396539 if (operand_is_ptr) {
65406540 return func.fail("TODO: lowerTry for pointers", .{});
65416541 }
......@@ -6584,7 +6584,7 @@ fn lowerTry(
65846584}
65856585
65866586fn airByteSwap(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
6587 const mod = func.bin_file.base.options.module.?;
6587 const mod = func.bin_file.base.comp.module.?;
65886588 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
65896589
65906590 const ty = func.typeOfIndex(inst);
......@@ -6655,7 +6655,7 @@ fn airByteSwap(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
66556655}
66566656
66576657fn airDiv(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
6658 const mod = func.bin_file.base.options.module.?;
6658 const mod = func.bin_file.base.comp.module.?;
66596659 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
66606660
66616661 const ty = func.typeOfIndex(inst);
......@@ -6670,7 +6670,7 @@ fn airDiv(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
66706670}
66716671
66726672fn airDivTrunc(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
6673 const mod = func.bin_file.base.options.module.?;
6673 const mod = func.bin_file.base.comp.module.?;
66746674 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
66756675
66766676 const ty = func.typeOfIndex(inst);
......@@ -6693,7 +6693,7 @@ fn airDivTrunc(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
66936693fn airDivFloor(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
66946694 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
66956695
6696 const mod = func.bin_file.base.options.module.?;
6696 const mod = func.bin_file.base.comp.module.?;
66976697 const ty = func.typeOfIndex(inst);
66986698 const lhs = try func.resolveInst(bin_op.lhs);
66996699 const rhs = try func.resolveInst(bin_op.rhs);
......@@ -6806,7 +6806,7 @@ fn airDivFloor(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
68066806}
68076807
68086808fn divSigned(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type) InnerError!WValue {
6809 const mod = func.bin_file.base.options.module.?;
6809 const mod = func.bin_file.base.comp.module.?;
68106810 const int_bits = ty.intInfo(mod).bits;
68116811 const wasm_bits = toWasmBits(int_bits) orelse {
68126812 return func.fail("TODO: Implement signed division for integers with bitsize '{d}'", .{int_bits});
......@@ -6836,7 +6836,7 @@ fn divSigned(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type) InnerError!WVal
68366836fn airMod(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
68376837 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
68386838
6839 const mod = func.bin_file.base.options.module.?;
6839 const mod = func.bin_file.base.comp.module.?;
68406840 const ty = func.typeOfIndex(inst);
68416841 const lhs = try func.resolveInst(bin_op.lhs);
68426842 const rhs = try func.resolveInst(bin_op.rhs);
......@@ -6883,7 +6883,7 @@ fn airMod(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
68836883/// The result will be sign extended to 32 bits if N <= 32 or 64 bits if N <= 64.
68846884/// Support for integers wider than 64 bits has not yet been implemented.
68856885fn signExtendInt(func: *CodeGen, operand: WValue, ty: Type) InnerError!WValue {
6886 const mod = func.bin_file.base.options.module.?;
6886 const mod = func.bin_file.base.comp.module.?;
68876887 const int_bits = ty.intInfo(mod).bits;
68886888 const wasm_bits = toWasmBits(int_bits) orelse {
68896889 return func.fail("TODO: signExtendInt for signed integers larger than '{d}' bits", .{int_bits});
......@@ -6919,7 +6919,7 @@ fn airSatBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
69196919 assert(op == .add or op == .sub);
69206920 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
69216921
6922 const mod = func.bin_file.base.options.module.?;
6922 const mod = func.bin_file.base.comp.module.?;
69236923 const ty = func.typeOfIndex(inst);
69246924 const lhs = try func.resolveInst(bin_op.lhs);
69256925 const rhs = try func.resolveInst(bin_op.rhs);
......@@ -6967,7 +6967,7 @@ fn airSatBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
69676967}
69686968
69696969fn signedSat(func: *CodeGen, lhs_operand: WValue, rhs_operand: WValue, ty: Type, op: Op) InnerError!WValue {
6970 const mod = func.bin_file.base.options.module.?;
6970 const mod = func.bin_file.base.comp.module.?;
69716971 const int_info = ty.intInfo(mod);
69726972 const wasm_bits = toWasmBits(int_info.bits).?;
69736973 const is_wasm_bits = wasm_bits == int_info.bits;
......@@ -7034,7 +7034,7 @@ fn signedSat(func: *CodeGen, lhs_operand: WValue, rhs_operand: WValue, ty: Type,
70347034fn airShlSat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
70357035 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
70367036
7037 const mod = func.bin_file.base.options.module.?;
7037 const mod = func.bin_file.base.comp.module.?;
70387038 const ty = func.typeOfIndex(inst);
70397039 const int_info = ty.intInfo(mod);
70407040 const is_signed = int_info.signedness == .signed;
......@@ -7155,7 +7155,7 @@ fn callIntrinsic(
71557155 };
71567156
71577157 // Always pass over C-ABI
7158 const mod = func.bin_file.base.options.module.?;
7158 const mod = func.bin_file.base.comp.module.?;
71597159 var func_type = try genFunctype(func.gpa, .C, param_types, return_type, mod);
71607160 defer func_type.deinit(func.gpa);
71617161 const func_type_index = try func.bin_file.putOrGetFuncType(func_type);
......@@ -7208,7 +7208,7 @@ fn airTagName(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
72087208}
72097209
72107210fn getTagNameFunction(func: *CodeGen, enum_ty: Type) InnerError!u32 {
7211 const mod = func.bin_file.base.options.module.?;
7211 const mod = func.bin_file.base.comp.module.?;
72127212 const enum_decl_index = enum_ty.getOwnerDecl(mod);
72137213
72147214 var arena_allocator = std.heap.ArenaAllocator.init(func.gpa);
......@@ -7364,7 +7364,7 @@ fn getTagNameFunction(func: *CodeGen, enum_ty: Type) InnerError!u32 {
73647364}
73657365
73667366fn airErrorSetHasValue(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
7367 const mod = func.bin_file.base.options.module.?;
7367 const mod = func.bin_file.base.comp.module.?;
73687368 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
73697369
73707370 const operand = try func.resolveInst(ty_op.operand);
......@@ -7449,7 +7449,7 @@ inline fn useAtomicFeature(func: *const CodeGen) bool {
74497449}
74507450
74517451fn airCmpxchg(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
7452 const mod = func.bin_file.base.options.module.?;
7452 const mod = func.bin_file.base.comp.module.?;
74537453 const ty_pl = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_pl;
74547454 const extra = func.air.extraData(Air.Cmpxchg, ty_pl.payload).data;
74557455
......@@ -7522,7 +7522,7 @@ fn airCmpxchg(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
75227522}
75237523
75247524fn airAtomicLoad(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
7525 const mod = func.bin_file.base.options.module.?;
7525 const mod = func.bin_file.base.comp.module.?;
75267526 const atomic_load = func.air.instructions.items(.data)[@intFromEnum(inst)].atomic_load;
75277527 const ptr = try func.resolveInst(atomic_load.ptr);
75287528 const ty = func.typeOfIndex(inst);
......@@ -7549,7 +7549,7 @@ fn airAtomicLoad(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
75497549}
75507550
75517551fn airAtomicRmw(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
7552 const mod = func.bin_file.base.options.module.?;
7552 const mod = func.bin_file.base.comp.module.?;
75537553 const pl_op = func.air.instructions.items(.data)[@intFromEnum(inst)].pl_op;
75547554 const extra = func.air.extraData(Air.AtomicRmw, pl_op.payload).data;
75557555
......@@ -7735,7 +7735,7 @@ fn airFence(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
77357735}
77367736
77377737fn airAtomicStore(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
7738 const mod = func.bin_file.base.options.module.?;
7738 const mod = func.bin_file.base.comp.module.?;
77397739 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
77407740
77417741 const ptr = try func.resolveInst(bin_op.lhs);
......@@ -7774,11 +7774,11 @@ fn airFrameAddress(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
77747774}
77757775
77767776fn typeOf(func: *CodeGen, inst: Air.Inst.Ref) Type {
7777 const mod = func.bin_file.base.options.module.?;
7777 const mod = func.bin_file.base.comp.module.?;
77787778 return func.air.typeOf(inst, &mod.intern_pool);
77797779}
77807780
77817781fn typeOfIndex(func: *CodeGen, inst: Air.Inst.Index) Type {
7782 const mod = func.bin_file.base.options.module.?;
7782 const mod = func.bin_file.base.comp.module.?;
77837783 return func.air.typeOfIndex(inst, &mod.intern_pool);
77847784}
src/arch/wasm/Emit.zig+1-1
......@@ -254,7 +254,7 @@ fn offset(self: Emit) u32 {
254254fn fail(emit: *Emit, comptime format: []const u8, args: anytype) InnerError {
255255 @setCold(true);
256256 std.debug.assert(emit.error_msg == null);
257 const mod = emit.bin_file.base.options.module.?;
257 const mod = emit.bin_file.base.comp.module.?;
258258 emit.error_msg = try Module.ErrorMsg.create(emit.bin_file.base.allocator, mod.declPtr(emit.decl_index).srcLoc(mod), format, args);
259259 return error.EmitFail;
260260}
src/link/C.zig+4-4
......@@ -386,7 +386,7 @@ pub fn flushModule(self: *C, _: *Compilation, prog_node: *std.Progress.Node) !vo
386386 defer sub_prog_node.end();
387387
388388 const gpa = self.base.comp.gpa;
389 const module = self.base.options.module.?;
389 const module = self.base.comp.module.?;
390390
391391 {
392392 var i: usize = 0;
......@@ -535,7 +535,7 @@ fn flushCTypes(
535535 decl_ctypes: codegen.CType.Store,
536536) FlushDeclError!void {
537537 const gpa = self.base.comp.gpa;
538 const mod = self.base.options.module.?;
538 const mod = self.base.comp.module.?;
539539
540540 const decl_ctypes_len = decl_ctypes.count();
541541 f.ctypes_map.clearRetainingCapacity();
......@@ -623,7 +623,7 @@ fn flushErrDecls(self: *C, ctypes: *codegen.CType.Store) FlushDeclError!void {
623623 var object = codegen.Object{
624624 .dg = .{
625625 .gpa = gpa,
626 .module = self.base.options.module.?,
626 .module = self.base.comp.module.?,
627627 .error_msg = null,
628628 .pass = .flush,
629629 .is_naked_fn = false,
......@@ -665,7 +665,7 @@ fn flushLazyFn(
665665 var object = codegen.Object{
666666 .dg = .{
667667 .gpa = gpa,
668 .module = self.base.options.module.?,
668 .module = self.base.comp.module.?,
669669 .error_msg = null,
670670 .pass = .flush,
671671 .is_naked_fn = false,
src/link/Coff.zig+10-10
......@@ -1118,7 +1118,7 @@ pub fn updateFunc(self: *Coff, mod: *Module, func_index: InternPool.Index, air:
11181118
11191119pub fn lowerUnnamedConst(self: *Coff, tv: TypedValue, decl_index: InternPool.DeclIndex) !u32 {
11201120 const gpa = self.base.comp.gpa;
1121 const mod = self.base.options.module.?;
1121 const mod = self.base.comp.module.?;
11221122 const decl = mod.declPtr(decl_index);
11231123 const gop = try self.unnamed_const_atoms.getOrPut(gpa, decl_index);
11241124 if (!gop.found_existing) {
......@@ -1249,7 +1249,7 @@ fn updateLazySymbolAtom(
12491249 section_index: u16,
12501250) !void {
12511251 const gpa = self.base.comp.gpa;
1252 const mod = self.base.options.module.?;
1252 const mod = self.base.comp.module.?;
12531253
12541254 var required_alignment: InternPool.Alignment = .none;
12551255 var code_buffer = std.ArrayList(u8).init(gpa);
......@@ -1310,7 +1310,7 @@ fn updateLazySymbolAtom(
13101310
13111311pub fn getOrCreateAtomForLazySymbol(self: *Coff, sym: link.File.LazySymbol) !Atom.Index {
13121312 const gpa = self.base.comp.gpa;
1313 const mod = self.base.options.module.?;
1313 const mod = self.base.comp.module.?;
13141314 const gop = try self.lazy_syms.getOrPut(gpa, sym.getDecl(mod));
13151315 errdefer _ = if (!gop.found_existing) self.lazy_syms.pop();
13161316 if (!gop.found_existing) gop.value_ptr.* = .{};
......@@ -1347,9 +1347,9 @@ pub fn getOrCreateAtomForDecl(self: *Coff, decl_index: InternPool.DeclIndex) !At
13471347}
13481348
13491349fn getDeclOutputSection(self: *Coff, decl_index: InternPool.DeclIndex) u16 {
1350 const decl = self.base.options.module.?.declPtr(decl_index);
1350 const decl = self.base.comp.module.?.declPtr(decl_index);
13511351 const ty = decl.ty;
1352 const mod = self.base.options.module.?;
1352 const mod = self.base.comp.module.?;
13531353 const zig_ty = ty.zigTypeTag(mod);
13541354 const val = decl.val;
13551355 const index: u16 = blk: {
......@@ -1373,7 +1373,7 @@ fn getDeclOutputSection(self: *Coff, decl_index: InternPool.DeclIndex) u16 {
13731373}
13741374
13751375fn updateDeclCode(self: *Coff, decl_index: InternPool.DeclIndex, code: []u8, complex_type: coff.ComplexType) !void {
1376 const mod = self.base.options.module.?;
1376 const mod = self.base.comp.module.?;
13771377 const decl = mod.declPtr(decl_index);
13781378
13791379 const decl_name = mod.intern_pool.stringToSlice(try decl.getFullyQualifiedName(mod));
......@@ -1443,7 +1443,7 @@ pub fn freeDecl(self: *Coff, decl_index: InternPool.DeclIndex) void {
14431443 if (self.llvm_object) |llvm_object| return llvm_object.freeDecl(decl_index);
14441444
14451445 const gpa = self.base.comp.gpa;
1446 const mod = self.base.options.module.?;
1446 const mod = self.base.comp.module.?;
14471447 const decl = mod.declPtr(decl_index);
14481448
14491449 log.debug("freeDecl {*}", .{decl});
......@@ -1599,7 +1599,7 @@ pub fn deleteDeclExport(
15991599) void {
16001600 if (self.llvm_object) |_| return;
16011601 const metadata = self.decls.getPtr(decl_index) orelse return;
1602 const mod = self.base.options.module.?;
1602 const mod = self.base.comp.module.?;
16031603 const name = mod.intern_pool.stringToSlice(name_ip);
16041604 const sym_index = metadata.getExportPtr(self, name) orelse return;
16051605
......@@ -1678,7 +1678,7 @@ pub fn flushModule(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
16781678
16791679 const gpa = self.base.comp.gpa;
16801680
1681 const module = self.base.options.module orelse return error.LinkingWithoutZigSourceUnimplemented;
1681 const module = self.base.comp.module orelse return error.LinkingWithoutZigSourceUnimplemented;
16821682
16831683 if (self.lazy_syms.getPtr(.none)) |metadata| {
16841684 // Most lazy symbols can be updated on first use, but
......@@ -1818,7 +1818,7 @@ pub fn lowerAnonDecl(
18181818 src_loc: Module.SrcLoc,
18191819) !codegen.Result {
18201820 const gpa = self.base.comp.gpa;
1821 const mod = self.base.options.module.?;
1821 const mod = self.base.comp.module.?;
18221822 const ty = Type.fromInterned(mod.intern_pool.typeOf(decl_val));
18231823 const decl_alignment = switch (explicit_alignment) {
18241824 .none => ty.abiAlignment(mod),
src/link/Coff/lld.zig+3-3
......@@ -30,7 +30,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
3030
3131 // If there is no Zig code to compile, then we should skip flushing the output file because it
3232 // will not be part of the linker line anyway.
33 const module_obj_path: ?[]const u8 = if (self.base.options.module != null) blk: {
33 const module_obj_path: ?[]const u8 = if (self.base.comp.module != null) blk: {
3434 try self.flushModule(comp, prog_node);
3535
3636 if (fs.path.dirname(full_out_path)) |dirname| {
......@@ -289,7 +289,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
289289 if (self.base.options.subsystem) |explicit| break :blk explicit;
290290 switch (target.os.tag) {
291291 .windows => {
292 if (self.base.options.module) |module| {
292 if (self.base.comp.module) |module| {
293293 if (module.stage1_flags.have_dllmain_crt_startup or is_dyn_lib)
294294 break :blk null;
295295 if (module.stage1_flags.have_c_main or self.base.options.is_test or
......@@ -450,7 +450,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
450450 } else {
451451 try argv.append("-NODEFAULTLIB");
452452 if (!is_lib and self.base.options.entry == null) {
453 if (self.base.options.module) |module| {
453 if (self.base.comp.module) |module| {
454454 if (module.stage1_flags.have_winmain_crt_startup) {
455455 try argv.append("-ENTRY:WinMainCRTStartup");
456456 } else {
src/link/Elf.zig+1-1
......@@ -2309,7 +2309,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v
23092309
23102310 // If there is no Zig code to compile, then we should skip flushing the output file because it
23112311 // will not be part of the linker line anyway.
2312 const module_obj_path: ?[]const u8 = if (self.base.options.module != null) blk: {
2312 const module_obj_path: ?[]const u8 = if (self.base.comp.module != null) blk: {
23132313 try self.flushModule(comp, prog_node);
23142314
23152315 if (fs.path.dirname(full_out_path)) |dirname| {
src/link/MachO.zig+11-11
......@@ -356,7 +356,7 @@ pub fn flushModule(self: *MachO, comp: *Compilation, prog_node: *std.Progress.No
356356 defer sub_prog_node.end();
357357
358358 const output_mode = self.base.comp.config.output_mode;
359 const module = self.base.options.module orelse return error.LinkingWithoutZigSourceUnimplemented;
359 const module = self.base.comp.module orelse return error.LinkingWithoutZigSourceUnimplemented;
360360
361361 if (self.lazy_syms.getPtr(.none)) |metadata| {
362362 // Most lazy symbols can be updated on first use, but
......@@ -2333,7 +2333,7 @@ pub fn updateFunc(self: *MachO, mod: *Module, func_index: InternPool.Index, air:
23332333
23342334pub fn lowerUnnamedConst(self: *MachO, typed_value: TypedValue, decl_index: InternPool.DeclIndex) !u32 {
23352335 const gpa = self.base.comp.gpa;
2336 const mod = self.base.options.module.?;
2336 const mod = self.base.comp.module.?;
23372337 const gop = try self.unnamed_const_atoms.getOrPut(gpa, decl_index);
23382338 if (!gop.found_existing) {
23392339 gop.value_ptr.* = .{};
......@@ -2504,7 +2504,7 @@ fn updateLazySymbolAtom(
25042504 section_index: u8,
25052505) !void {
25062506 const gpa = self.base.comp.gpa;
2507 const mod = self.base.options.module.?;
2507 const mod = self.base.comp.module.?;
25082508
25092509 var required_alignment: Alignment = .none;
25102510 var code_buffer = std.ArrayList(u8).init(gpa);
......@@ -2568,7 +2568,7 @@ fn updateLazySymbolAtom(
25682568}
25692569
25702570pub fn getOrCreateAtomForLazySymbol(self: *MachO, sym: File.LazySymbol) !Atom.Index {
2571 const mod = self.base.options.module.?;
2571 const mod = self.base.comp.module.?;
25722572 const gpa = self.base.comp.gpa;
25732573 const gop = try self.lazy_syms.getOrPut(gpa, sym.getDecl(mod));
25742574 errdefer _ = if (!gop.found_existing) self.lazy_syms.pop();
......@@ -2600,7 +2600,7 @@ pub fn getOrCreateAtomForLazySymbol(self: *MachO, sym: File.LazySymbol) !Atom.In
26002600}
26012601
26022602fn updateThreadlocalVariable(self: *MachO, module: *Module, decl_index: InternPool.DeclIndex) !void {
2603 const mod = self.base.options.module.?;
2603 const mod = self.base.comp.module.?;
26042604 // Lowering a TLV on macOS involves two stages:
26052605 // 1. first we lower the initializer into appopriate section (__thread_data or __thread_bss)
26062606 // 2. next, we create a corresponding threadlocal variable descriptor in __thread_vars
......@@ -2711,10 +2711,10 @@ pub fn getOrCreateAtomForDecl(self: *MachO, decl_index: InternPool.DeclIndex) !A
27112711}
27122712
27132713fn getDeclOutputSection(self: *MachO, decl_index: InternPool.DeclIndex) u8 {
2714 const decl = self.base.options.module.?.declPtr(decl_index);
2714 const decl = self.base.comp.module.?.declPtr(decl_index);
27152715 const ty = decl.ty;
27162716 const val = decl.val;
2717 const mod = self.base.options.module.?;
2717 const mod = self.base.comp.module.?;
27182718 const zig_ty = ty.zigTypeTag(mod);
27192719 const any_non_single_threaded = self.base.comp.config.any_non_single_threaded;
27202720 const optimize_mode = self.base.comp.root_mod.optimize_mode;
......@@ -2751,7 +2751,7 @@ fn getDeclOutputSection(self: *MachO, decl_index: InternPool.DeclIndex) u8 {
27512751
27522752fn updateDeclCode(self: *MachO, decl_index: InternPool.DeclIndex, code: []u8) !u64 {
27532753 const gpa = self.base.comp.gpa;
2754 const mod = self.base.options.module.?;
2754 const mod = self.base.comp.module.?;
27552755 const decl = mod.declPtr(decl_index);
27562756
27572757 const required_alignment = decl.getAlignment(mod);
......@@ -2967,7 +2967,7 @@ pub fn deleteDeclExport(
29672967 const metadata = self.decls.getPtr(decl_index) orelse return;
29682968
29692969 const gpa = self.base.comp.gpa;
2970 const mod = self.base.options.module.?;
2970 const mod = self.base.comp.module.?;
29712971 const exp_name = try std.fmt.allocPrint(gpa, "_{s}", .{mod.intern_pool.stringToSlice(name)});
29722972 defer gpa.free(exp_name);
29732973 const sym_index = metadata.getExportPtr(self, exp_name) orelse return;
......@@ -3006,7 +3006,7 @@ fn freeUnnamedConsts(self: *MachO, decl_index: InternPool.DeclIndex) void {
30063006pub fn freeDecl(self: *MachO, decl_index: InternPool.DeclIndex) void {
30073007 if (self.llvm_object) |llvm_object| return llvm_object.freeDecl(decl_index);
30083008 const gpa = self.base.comp.gpa;
3009 const mod = self.base.options.module.?;
3009 const mod = self.base.comp.module.?;
30103010 const decl = mod.declPtr(decl_index);
30113011
30123012 log.debug("freeDecl {*}", .{decl});
......@@ -3049,7 +3049,7 @@ pub fn lowerAnonDecl(
30493049 src_loc: Module.SrcLoc,
30503050) !codegen.Result {
30513051 const gpa = self.base.comp.gpa;
3052 const mod = self.base.options.module.?;
3052 const mod = self.base.comp.module.?;
30533053 const ty = Type.fromInterned(mod.intern_pool.typeOf(decl_val));
30543054 const decl_alignment = switch (explicit_alignment) {
30553055 .none => ty.abiAlignment(mod),
src/link/Plan9.zig+15-15
......@@ -174,7 +174,7 @@ pub const Atom = struct {
174174 return .{ .code_ptr = slice.ptr, .other = .{ .code_len = slice.len } };
175175 }
176176 fn getCode(self: CodePtr, plan9: *const Plan9) []u8 {
177 const mod = plan9.base.options.module.?;
177 const mod = plan9.base.comp.module.?;
178178 return if (self.code_ptr) |p| p[0..self.other.code_len] else blk: {
179179 const decl_index = self.other.decl_index;
180180 const decl = mod.declPtr(decl_index);
......@@ -324,7 +324,7 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*Plan9 {
324324
325325fn putFn(self: *Plan9, decl_index: InternPool.DeclIndex, out: FnDeclOutput) !void {
326326 const gpa = self.base.comp.gpa;
327 const mod = self.base.options.module.?;
327 const mod = self.base.comp.module.?;
328328 const decl = mod.declPtr(decl_index);
329329 const fn_map_res = try self.fn_decl_table.getOrPut(gpa, decl.getFileScope(mod));
330330 if (fn_map_res.found_existing) {
......@@ -455,7 +455,7 @@ pub fn lowerUnnamedConst(self: *Plan9, tv: TypedValue, decl_index: InternPool.De
455455 var code_buffer = std.ArrayList(u8).init(gpa);
456456 defer code_buffer.deinit();
457457
458 const mod = self.base.options.module.?;
458 const mod = self.base.comp.module.?;
459459 const decl = mod.declPtr(decl_index);
460460
461461 const gop = try self.unnamed_const_atoms.getOrPut(gpa, decl_index);
......@@ -550,7 +550,7 @@ pub fn updateDecl(self: *Plan9, mod: *Module, decl_index: InternPool.DeclIndex)
550550/// called at the end of update{Decl,Func}
551551fn updateFinish(self: *Plan9, decl_index: InternPool.DeclIndex) !void {
552552 const gpa = self.base.comp.gpa;
553 const mod = self.base.options.module.?;
553 const mod = self.base.comp.module.?;
554554 const decl = mod.declPtr(decl_index);
555555 const is_fn = (decl.ty.zigTypeTag(mod) == .Fn);
556556 const sym_t: aout.Sym.Type = if (is_fn) .t else .d;
......@@ -670,7 +670,7 @@ pub fn flushModule(self: *Plan9, comp: *Compilation, prog_node: *std.Progress.No
670670
671671 defer assert(self.hdr.entry != 0x0);
672672
673 const mod = self.base.options.module orelse return error.LinkingWithoutZigSourceUnimplemented;
673 const mod = self.base.comp.module orelse return error.LinkingWithoutZigSourceUnimplemented;
674674
675675 // finish up the lazy syms
676676 if (self.lazy_syms.getPtr(.none)) |metadata| {
......@@ -1032,7 +1032,7 @@ pub fn freeDecl(self: *Plan9, decl_index: InternPool.DeclIndex) void {
10321032 // freeDecl without any updateDecl in between.
10331033 // However that is planned to change, see the TODO comment in Module.zig
10341034 // in the deleteUnusedDecl function.
1035 const mod = self.base.options.module.?;
1035 const mod = self.base.comp.module.?;
10361036 const decl = mod.declPtr(decl_index);
10371037 const is_fn = decl.val.isFuncBody(mod);
10381038 if (is_fn) {
......@@ -1112,7 +1112,7 @@ pub fn seeDecl(self: *Plan9, decl_index: InternPool.DeclIndex) !Atom.Index {
11121112 }
11131113 const atom_idx = gop.value_ptr.index;
11141114 // handle externs here because they might not get updateDecl called on them
1115 const mod = self.base.options.module.?;
1115 const mod = self.base.comp.module.?;
11161116 const decl = mod.declPtr(decl_index);
11171117 const name = mod.intern_pool.stringToSlice(decl.name);
11181118 if (decl.isExtern(mod)) {
......@@ -1147,7 +1147,7 @@ pub fn updateExports(
11471147
11481148pub fn getOrCreateAtomForLazySymbol(self: *Plan9, sym: File.LazySymbol) !Atom.Index {
11491149 const gpa = self.base.comp.gpa;
1150 const gop = try self.lazy_syms.getOrPut(gpa, sym.getDecl(self.base.options.module.?));
1150 const gop = try self.lazy_syms.getOrPut(gpa, sym.getDecl(self.base.comp.module.?));
11511151 errdefer _ = if (!gop.found_existing) self.lazy_syms.pop();
11521152
11531153 if (!gop.found_existing) gop.value_ptr.* = .{};
......@@ -1166,7 +1166,7 @@ pub fn getOrCreateAtomForLazySymbol(self: *Plan9, sym: File.LazySymbol) !Atom.In
11661166 _ = try self.getAtomPtr(atom).getOrCreateSymbolTableEntry(self);
11671167 _ = self.getAtomPtr(atom).getOrCreateOffsetTableEntry(self);
11681168 // anyerror needs to be deferred until flushModule
1169 if (sym.getDecl(self.base.options.module.?) != .none) {
1169 if (sym.getDecl(self.base.comp.module.?) != .none) {
11701170 try self.updateLazySymbolAtom(sym, atom);
11711171 }
11721172 return atom;
......@@ -1174,7 +1174,7 @@ pub fn getOrCreateAtomForLazySymbol(self: *Plan9, sym: File.LazySymbol) !Atom.In
11741174
11751175fn updateLazySymbolAtom(self: *Plan9, sym: File.LazySymbol, atom_index: Atom.Index) !void {
11761176 const gpa = self.base.comp.gpa;
1177 const mod = self.base.options.module.?;
1177 const mod = self.base.comp.module.?;
11781178
11791179 var required_alignment: InternPool.Alignment = .none;
11801180 var code_buffer = std.ArrayList(u8).init(gpa);
......@@ -1348,7 +1348,7 @@ pub fn writeSym(self: *Plan9, w: anytype, sym: aout.Sym) !void {
13481348}
13491349
13501350pub fn writeSyms(self: *Plan9, buf: *std.ArrayList(u8)) !void {
1351 const mod = self.base.options.module.?;
1351 const mod = self.base.comp.module.?;
13521352 const ip = &mod.intern_pool;
13531353 const writer = buf.writer();
13541354 // write __GOT
......@@ -1374,7 +1374,7 @@ pub fn writeSyms(self: *Plan9, buf: *std.ArrayList(u8)) !void {
13741374 const atom = self.getAtom(decl_metadata.index);
13751375 const sym = self.syms.items[atom.sym_index.?];
13761376 try self.writeSym(writer, sym);
1377 if (self.base.options.module.?.decl_exports.get(decl_index)) |exports| {
1377 if (self.base.comp.module.?.decl_exports.get(decl_index)) |exports| {
13781378 for (exports.items) |e| if (decl_metadata.getExport(self, ip.stringToSlice(e.opts.name))) |exp_i| {
13791379 try self.writeSym(writer, self.syms.items[exp_i]);
13801380 };
......@@ -1421,7 +1421,7 @@ pub fn writeSyms(self: *Plan9, buf: *std.ArrayList(u8)) !void {
14211421 const atom = self.getAtom(decl_metadata.index);
14221422 const sym = self.syms.items[atom.sym_index.?];
14231423 try self.writeSym(writer, sym);
1424 if (self.base.options.module.?.decl_exports.get(decl_index)) |exports| {
1424 if (self.base.comp.module.?.decl_exports.get(decl_index)) |exports| {
14251425 for (exports.items) |e| if (decl_metadata.getExport(self, ip.stringToSlice(e.opts.name))) |exp_i| {
14261426 const s = self.syms.items[exp_i];
14271427 if (mem.eql(u8, s.name, "_start"))
......@@ -1464,7 +1464,7 @@ pub fn getDeclVAddr(
14641464 decl_index: InternPool.DeclIndex,
14651465 reloc_info: link.File.RelocInfo,
14661466) !u64 {
1467 const mod = self.base.options.module.?;
1467 const mod = self.base.comp.module.?;
14681468 const decl = mod.declPtr(decl_index);
14691469 log.debug("getDeclVAddr for {s}", .{mod.intern_pool.stringToSlice(decl.name)});
14701470 if (decl.isExtern(mod)) {
......@@ -1517,7 +1517,7 @@ pub fn lowerAnonDecl(self: *Plan9, decl_val: InternPool.Index, src_loc: Module.S
15171517 // ...
15181518 const gpa = self.base.comp.gpa;
15191519 const gop = try self.anon_decls.getOrPut(gpa, decl_val);
1520 const mod = self.base.options.module.?;
1520 const mod = self.base.comp.module.?;
15211521 if (!gop.found_existing) {
15221522 const ty = Type.fromInterned(mod.intern_pool.typeOf(decl_val));
15231523 const val = Value.fromInterned(decl_val);
src/link/SpirV.zig+1-1
......@@ -196,7 +196,7 @@ pub fn flushModule(self: *SpirV, comp: *Compilation, prog_node: *std.Progress.No
196196 defer error_info.deinit();
197197
198198 try error_info.appendSlice("zig_errors");
199 const module = self.base.options.module.?;
199 const module = self.base.comp.module.?;
200200 for (module.global_error_set.keys()) |name_nts| {
201201 const name = module.intern_pool.stringToSlice(name_nts);
202202 // Errors can contain pretty much any character - to encode them in a string we must escape
src/link/Wasm.zig+15-15
......@@ -632,7 +632,7 @@ pub fn getOrCreateAtomForDecl(wasm: *Wasm, decl_index: InternPool.DeclIndex) !At
632632 gop.value_ptr.* = atom_index;
633633 const atom = wasm.getAtom(atom_index);
634634 const symbol = atom.symbolLoc().getSymbol(wasm);
635 const mod = wasm.base.options.module.?;
635 const mod = wasm.base.comp.module.?;
636636 const decl = mod.declPtr(decl_index);
637637 const full_name = mod.intern_pool.stringToSlice(try decl.getFullyQualifiedName(mod));
638638 symbol.name = try wasm.string_table.put(gpa, full_name);
......@@ -1568,7 +1568,7 @@ pub fn updateDeclLineNumber(wasm: *Wasm, mod: *Module, decl_index: InternPool.De
15681568
15691569fn finishUpdateDecl(wasm: *Wasm, decl_index: InternPool.DeclIndex, code: []const u8, symbol_tag: Symbol.Tag) !void {
15701570 const gpa = wasm.base.comp.gpa;
1571 const mod = wasm.base.options.module.?;
1571 const mod = wasm.base.comp.module.?;
15721572 const decl = mod.declPtr(decl_index);
15731573 const atom_index = wasm.decls.get(decl_index).?;
15741574 const atom = wasm.getAtomPtr(atom_index);
......@@ -1632,7 +1632,7 @@ fn getFunctionSignature(wasm: *const Wasm, loc: SymbolLoc) std.wasm.Type {
16321632/// The given `decl` is the parent decl whom owns the constant.
16331633pub fn lowerUnnamedConst(wasm: *Wasm, tv: TypedValue, decl_index: InternPool.DeclIndex) !u32 {
16341634 const gpa = wasm.base.comp.gpa;
1635 const mod = wasm.base.options.module.?;
1635 const mod = wasm.base.comp.module.?;
16361636 assert(tv.ty.zigTypeTag(mod) != .Fn); // cannot create local symbols for functions
16371637 const decl = mod.declPtr(decl_index);
16381638
......@@ -1665,7 +1665,7 @@ const LowerConstResult = union(enum) {
16651665
16661666fn lowerConst(wasm: *Wasm, name: []const u8, tv: TypedValue, src_loc: Module.SrcLoc) !LowerConstResult {
16671667 const gpa = wasm.base.comp.gpa;
1668 const mod = wasm.base.options.module.?;
1668 const mod = wasm.base.comp.module.?;
16691669
16701670 // Create and initialize a new local symbol and atom
16711671 const atom_index = try wasm.createAtom();
......@@ -1753,7 +1753,7 @@ pub fn getDeclVAddr(
17531753 reloc_info: link.File.RelocInfo,
17541754) !u64 {
17551755 const gpa = wasm.base.comp.gpa;
1756 const mod = wasm.base.options.module.?;
1756 const mod = wasm.base.comp.module.?;
17571757 const decl = mod.declPtr(decl_index);
17581758
17591759 const target_atom_index = try wasm.getOrCreateAtomForDecl(decl_index);
......@@ -1798,7 +1798,7 @@ pub fn lowerAnonDecl(
17981798 const gpa = wasm.base.comp.gpa;
17991799 const gop = try wasm.anon_decls.getOrPut(gpa, decl_val);
18001800 if (!gop.found_existing) {
1801 const mod = wasm.base.options.module.?;
1801 const mod = wasm.base.comp.module.?;
18021802 const ty = Type.fromInterned(mod.intern_pool.typeOf(decl_val));
18031803 const tv: TypedValue = .{ .ty = ty, .val = Value.fromInterned(decl_val) };
18041804 var name_buf: [32]u8 = undefined;
......@@ -1831,7 +1831,7 @@ pub fn getAnonDeclVAddr(wasm: *Wasm, decl_val: InternPool.Index, reloc_info: lin
18311831 const parent_atom_index = wasm.symbol_atom.get(.{ .file = null, .index = reloc_info.parent_atom_index }).?;
18321832 const parent_atom = wasm.getAtomPtr(parent_atom_index);
18331833 const is_wasm32 = wasm.base.options.target.cpu.arch == .wasm32;
1834 const mod = wasm.base.options.module.?;
1834 const mod = wasm.base.comp.module.?;
18351835 const ty = Type.fromInterned(mod.intern_pool.typeOf(decl_val));
18361836 if (ty.zigTypeTag(mod) == .Fn) {
18371837 assert(reloc_info.addend == 0); // addend not allowed for function relocations
......@@ -2004,7 +2004,7 @@ pub fn updateExports(
20042004pub fn freeDecl(wasm: *Wasm, decl_index: InternPool.DeclIndex) void {
20052005 if (wasm.llvm_object) |llvm_object| return llvm_object.freeDecl(decl_index);
20062006 const gpa = wasm.base.comp.gpa;
2007 const mod = wasm.base.options.module.?;
2007 const mod = wasm.base.comp.module.?;
20082008 const decl = mod.declPtr(decl_index);
20092009 const atom_index = wasm.decls.get(decl_index).?;
20102010 const atom = wasm.getAtomPtr(atom_index);
......@@ -2492,7 +2492,7 @@ fn setupErrorsLen(wasm: *Wasm) !void {
24922492 const gpa = wasm.base.comp.gpa;
24932493 const loc = wasm.findGlobalSymbol("__zig_errors_len") orelse return;
24942494
2495 const errors_len = wasm.base.options.module.?.global_error_set.count();
2495 const errors_len = wasm.base.comp.module.?.global_error_set.count();
24962496 // overwrite existing atom if it already exists (maybe the error set has increased)
24972497 // if not, allcoate a new atom.
24982498 const atom_index = if (wasm.symbol_atom.get(loc)) |index| blk: {
......@@ -3268,7 +3268,7 @@ pub fn getErrorTableSymbol(wasm: *Wasm) !u32 {
32683268 const atom_index = try wasm.createAtom();
32693269 const atom = wasm.getAtomPtr(atom_index);
32703270 const slice_ty = Type.slice_const_u8_sentinel_0;
3271 const mod = wasm.base.options.module.?;
3271 const mod = wasm.base.comp.module.?;
32723272 atom.alignment = slice_ty.abiAlignment(mod);
32733273 const sym_index = atom.sym_index;
32743274
......@@ -3322,7 +3322,7 @@ fn populateErrorNameTable(wasm: *Wasm) !void {
33223322
33233323 // Addend for each relocation to the table
33243324 var addend: u32 = 0;
3325 const mod = wasm.base.options.module.?;
3325 const mod = wasm.base.comp.module.?;
33263326 for (mod.global_error_set.keys()) |error_name_nts| {
33273327 const atom = wasm.getAtomPtr(atom_index);
33283328
......@@ -3708,7 +3708,7 @@ pub fn flushModule(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Nod
37083708 try wasm.markReferences();
37093709 try wasm.setupErrorsLen();
37103710 try wasm.setupImports();
3711 if (wasm.base.options.module) |mod| {
3711 if (wasm.base.comp.module) |mod| {
37123712 var decl_it = wasm.decls.iterator();
37133713 while (decl_it.next()) |entry| {
37143714 const decl = mod.declPtr(entry.key_ptr.*);
......@@ -3759,7 +3759,7 @@ pub fn flushModule(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Nod
37593759 }
37603760
37613761 if (wasm.dwarf) |*dwarf| {
3762 try dwarf.flushModule(wasm.base.options.module.?);
3762 try dwarf.flushModule(wasm.base.comp.module.?);
37633763 }
37643764 }
37653765
......@@ -4190,7 +4190,7 @@ fn writeToFile(
41904190 }
41914191
41924192 // if (wasm.dwarf) |*dwarf| {
4193 // const mod = wasm.base.options.module.?;
4193 // const mod = wasm.base.comp.module.?;
41944194 // try dwarf.writeDbgAbbrev();
41954195 // // for debug info and ranges, the address is always 0,
41964196 // // as locations are always offsets relative to 'code' section.
......@@ -4535,7 +4535,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !
45354535
45364536 // If there is no Zig code to compile, then we should skip flushing the output file because it
45374537 // will not be part of the linker line anyway.
4538 const module_obj_path: ?[]const u8 = if (wasm.base.options.module != null) blk: {
4538 const module_obj_path: ?[]const u8 = if (wasm.base.comp.module != null) blk: {
45394539 try wasm.flushModule(comp, prog_node);
45404540
45414541 if (fs.path.dirname(full_out_path)) |dirname| {