| ... | ... | @@ -3903,17 +3903,17 @@ fn airDbgVar(self: *Self, inst: Air.Inst.Index) !void { |
| 3903 | 3903 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; |
| 3904 | 3904 | const operand = pl_op.operand; |
| 3905 | 3905 | const ty = self.air.typeOf(operand); |
| 3906 | const mcv = try self.resolveInst(operand); |
| 3906 | 3907 | |
| 3907 | | if (!self.liveness.operandDies(inst, 0)) { |
| 3908 | | const mcv = try self.resolveInst(operand); |
| 3909 | | const name = self.air.nullTerminatedString(pl_op.payload); |
| 3908 | log.debug("airDbgVar: %{d}: {}, {}", .{ inst, ty.fmtDebug(), mcv }); |
| 3910 | 3909 | |
| 3911 | | const tag = self.air.instructions.items(.tag)[inst]; |
| 3912 | | switch (tag) { |
| 3913 | | .dbg_var_ptr => try self.genVarDbgInfo(ty.childType(), mcv, name), |
| 3914 | | .dbg_var_val => try self.genVarDbgInfo(ty, mcv, name), |
| 3915 | | else => unreachable, |
| 3916 | | } |
| 3910 | const name = self.air.nullTerminatedString(pl_op.payload); |
| 3911 | |
| 3912 | const tag = self.air.instructions.items(.tag)[inst]; |
| 3913 | switch (tag) { |
| 3914 | .dbg_var_ptr => try self.genVarDbgInfo(ty.childType(), mcv, name), |
| 3915 | .dbg_var_val => try self.genVarDbgInfo(ty, mcv, name), |
| 3916 | else => unreachable, |
| 3917 | 3917 | } |
| 3918 | 3918 | |
| 3919 | 3919 | return self.finishAir(inst, .dead, .{ operand, .none, .none }); |
| ... | ... | @@ -6089,6 +6089,7 @@ fn limitImmediateType(self: *Self, operand: Air.Inst.Ref, comptime T: type) !MCV |
| 6089 | 6089 | } |
| 6090 | 6090 | |
| 6091 | 6091 | fn lowerDeclRef(self: *Self, tv: TypedValue, decl: *Module.Decl) InnerError!MCValue { |
| 6092 | log.debug("lowerDeclRef: ty = {}, val = {}", .{ tv.ty.fmtDebug(), tv.val.fmtDebug() }); |
| 6092 | 6093 | const ptr_bits = self.target.cpu.arch.ptrBitWidth(); |
| 6093 | 6094 | const ptr_bytes: u64 = @divExact(ptr_bits, 8); |
| 6094 | 6095 | |
| ... | ... | @@ -6100,7 +6101,8 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl: *Module.Decl) InnerError!MCVa |
| 6100 | 6101 | } |
| 6101 | 6102 | } |
| 6102 | 6103 | |
| 6103 | | decl.alive = true; |
| 6104 | decl.markAlive(); |
| 6105 | |
| 6104 | 6106 | if (self.bin_file.cast(link.File.Elf)) |elf_file| { |
| 6105 | 6107 | const got = &elf_file.program_headers.items[elf_file.phdr_got_index.?]; |
| 6106 | 6108 | const got_addr = got.p_vaddr + decl.link.elf.offset_table_index * ptr_bytes; |
| ... | ... | @@ -6120,8 +6122,6 @@ fn lowerDeclRef(self: *Self, tv: TypedValue, decl: *Module.Decl) InnerError!MCVa |
| 6120 | 6122 | } else { |
| 6121 | 6123 | return self.fail("TODO codegen non-ELF const Decl pointer", .{}); |
| 6122 | 6124 | } |
| 6123 | | |
| 6124 | | _ = tv; |
| 6125 | 6125 | } |
| 6126 | 6126 | |
| 6127 | 6127 | fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue { |
| ... | ... | @@ -6144,6 +6144,7 @@ fn lowerUnnamedConst(self: *Self, tv: TypedValue) InnerError!MCValue { |
| 6144 | 6144 | } |
| 6145 | 6145 | |
| 6146 | 6146 | fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { |
| 6147 | log.debug("genTypedValue: ty = {}, val = {}", .{ typed_value.ty.fmtDebug(), typed_value.val.fmtDebug() }); |
| 6147 | 6148 | if (typed_value.val.isUndef()) |
| 6148 | 6149 | return MCValue{ .undef = {} }; |
| 6149 | 6150 | const ptr_bits = self.target.cpu.arch.ptrBitWidth(); |
| ... | ... | @@ -6181,8 +6182,6 @@ fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { |
| 6181 | 6182 | .Bool => { |
| 6182 | 6183 | return MCValue{ .immediate = @boolToInt(typed_value.val.toBool()) }; |
| 6183 | 6184 | }, |
| 6184 | | .ComptimeInt => unreachable, // semantic analysis prevents this |
| 6185 | | .ComptimeFloat => unreachable, // semantic analysis prevents this |
| 6186 | 6185 | .Optional => { |
| 6187 | 6186 | if (typed_value.ty.isPtrLikeOptional()) { |
| 6188 | 6187 | if (typed_value.val.isNull()) |
| ... | ... | @@ -6243,6 +6242,18 @@ fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { |
| 6243 | 6242 | } |
| 6244 | 6243 | } |
| 6245 | 6244 | }, |
| 6245 | |
| 6246 | .ComptimeInt => unreachable, |
| 6247 | .ComptimeFloat => unreachable, |
| 6248 | .Type => unreachable, |
| 6249 | .EnumLiteral => unreachable, |
| 6250 | .Void => unreachable, |
| 6251 | .NoReturn => unreachable, |
| 6252 | .Undefined => unreachable, |
| 6253 | .Null => unreachable, |
| 6254 | .BoundFn => unreachable, |
| 6255 | .Opaque => unreachable, |
| 6256 | |
| 6246 | 6257 | else => {}, |
| 6247 | 6258 | } |
| 6248 | 6259 | |