DoxigAlpha

debugValue

Function parameters

Parameters

#
self:*WipFunction

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#

= 16

Values

#

Source

Implementation

#
pub fn debugValue(self: *WipFunction, value: Value) Allocator.Error!Metadata {
    if (self.strip) return .none;
    return switch (value.unwrap()) {
        .instruction => |instr_index| blk: {
            const gop = try self.debug_values.getOrPut(self.builder.gpa, instr_index);

            const metadata: Metadata = @enumFromInt(Metadata.first_local_metadata + gop.index);
            if (!gop.found_existing) gop.key_ptr.* = instr_index;

            break :blk metadata;
        },
        .constant => |constant| try self.builder.metadataConstant(constant),
        .metadata => |metadata| metadata,
    };
}