structstd.zig.llvm.Builder.WipFunction.WipPhi[src]

Fields

block: Block.Index
instruction: Instruction.Index

Functions

FunctiontoValue[src]

pub fn toValue(self: WipPhi) Value

Parameters

self: WipPhi

Source Code

Source code
pub fn toValue(self: WipPhi) Value {
    return self.instruction.toValue();
}

Functionfinish[src]

pub fn finish( self: WipPhi, vals: []const Value, blocks: []const Block.Index, wip: *WipFunction, ) void

Parameters

self: WipPhi
vals: []const Value
blocks: []const Block.Index

Source Code

Source code
pub fn finish(
    self: WipPhi,
    vals: []const Value,
    blocks: []const Block.Index,
    wip: *WipFunction,
) void {
    const incoming_len = self.block.ptrConst(wip).incoming;
    assert(vals.len == incoming_len and blocks.len == incoming_len);
    const instruction = wip.instructions.get(@intFromEnum(self.instruction));
    var extra = wip.extraDataTrail(Instruction.Phi, instruction.data);
    for (vals) |val| assert(val.typeOfWip(wip) == extra.data.type);
    @memcpy(extra.trail.nextMut(incoming_len, Value, wip), vals);
    @memcpy(extra.trail.nextMut(incoming_len, Block.Index, wip), blocks);
}

Source Code

Source code
pub const WipPhi = struct {
    block: Block.Index,
    instruction: Instruction.Index,

    pub fn toValue(self: WipPhi) Value {
        return self.instruction.toValue();
    }

    pub fn finish(
        self: WipPhi,
        vals: []const Value,
        blocks: []const Block.Index,
        wip: *WipFunction,
    ) void {
        const incoming_len = self.block.ptrConst(wip).incoming;
        assert(vals.len == incoming_len and blocks.len == incoming_len);
        const instruction = wip.instructions.get(@intFromEnum(self.instruction));
        var extra = wip.extraDataTrail(Instruction.Phi, instruction.data);
        for (vals) |val| assert(val.typeOfWip(wip) == extra.data.type);
        @memcpy(extra.trail.nextMut(incoming_len, Value, wip), vals);
        @memcpy(extra.trail.nextMut(incoming_len, Block.Index, wip), blocks);
    }
}