pub fn debugValue(self: *WipFunction, value: Value) Allocator.Error!Metadata.Optional self: *WipFunctionvalue: Value7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405 pub fn debugValue(self: *WipFunction, value: Value) Allocator.Error!Metadata.Optional {
if (self.strip) return .none;
const metadata: Metadata = metadata: switch (value.unwrap()) {
.instruction => |instr_index| {
const gop = try self.debug_values.getOrPut(self.builder.gpa, instr_index);
if (!gop.found_existing) gop.key_ptr.* = instr_index;
break :metadata .{ .index = @intCast(gop.index), .kind = .local };
},
.constant => |constant| try self.builder.metadataConstant(constant),
.metadata => |metadata| metadata,
};
return metadata.toOptional();
}