struct WipPhi [src]
Fields
block: Block.Index
instruction: Instruction.Index
Members
Source
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);
}
}