Skip to documentation
SLOP

tiny.choir.Value

Reference tiny.choir Value

Defined in tiny.choir.

API (19)

Actions

Public operations.

Types and contracts

Public types and contracts.

Fields and members

Public fields and members.

No direct callersNo direct callstiny.choirValue
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/choir/src/core/value.zig:4

zig
pub const Value = struct {    kind: Kind,    type: Type,    id: u32,    first_use: ?*OpOperand = null,    pub const Kind = union(enum) {        block_argument: BlockArgumentInfo,        op_result: OpResultInfo,    };    pub const BlockArgumentInfo = struct {        owner: *anyopaque,        arg_number: u32,    };    pub const OpResultInfo = struct {        owner: *anyopaque,        result_number: u32,    };    pub fn isBlockArgument(self: Value) bool {        return self.kind == .block_argument;    }    pub fn isOpResult(self: Value) bool {        return self.kind == .op_result;    }    pub fn getDefiningOp(self: Value) ?*anyopaque {        return switch (self.kind) {            .op_result => |info| info.owner,            .block_argument => null,        };    }    pub fn getOwnerBlock(self: Value) ?*anyopaque {        return switch (self.kind) {            .block_argument => |info| info.owner,            .op_result => null,        };    }    pub fn hasNoUses(self: Value) bool {        return self.first_use == null;    }    pub fn hasOneUse(self: Value) bool {        const first = self.first_use orelse return false;        return first.next_use == null;    }    pub fn getNumUses(self: Value) usize {        var count: usize = 0;        var use = self.first_use;        while (use) |u| {            count += 1;            use = u.next_use;        }        return count;    }    pub fn useIterator(self: *Value) UseIterator {        return .{ .current = self.first_use };    }    pub fn addUse(self: *Value, operand: *OpOperand) void {        operand.next_use = self.first_use;        if (self.first_use) |first| {            first.back = &operand.next_use;        }        self.first_use = operand;        operand.back = &self.first_use;    }    pub fn dropAllUses(self: *Value) void {        while (self.first_use) |op_operand| {            op_operand.detach();        }    }    pub fn replaceAllUsesWith(self: *Value, replacement: *Value) void {        if (self == replacement) return;        var uses = self.useIterator();        while (uses.next()) |op_operand| {            op_operand.setValue(replacement);        }    }    pub fn format(self: Value, writer: *std.Io.Writer) std.Io.Writer.Error!void {        try writer.print("%{d}", .{self.id});    }};

Source: lib/choir/src/root.zig:46

zig
pub const Value = ir.Value;
Called byCallsNo direct callsir.OpOperandattachValueaddUse
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersValueuseIteratorValuereplaceAllUsesWith
Static calls · unresolved targets: 0 · external targets: 2.
Called byCallsNo direct callsValuereplaceAllUsesWithValueuseIterator
Static calls · unresolved targets: 0 · external targets: 0.

Also reachable as

backends.wasm.emission.module_encoding.common.ir.Value, ir.Value.

Audit

Definitions16
Public names48
Members10
Version26.7.0
Revisiondaab053ee433