Skip to documentation
SLOP

tiny.choir.backends.wasm.emission.function.instruction

Reference tiny.choir backends wasm emission function instruction

Defined in backends.wasm.emission.function.

API (5)

Actions

Public operations.

Namespaces

Public namespaces.

No direct callersNo direct callsbackends.wasm.emission.functioninstruction
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/choir/src/backends/wasm/emission/function/instruction/writer.zig:12

zig
pub fn Writer(comptime Out: type) type {    return struct {        out: Out,        plan: *const emission.Plan,        function_ordinal: usize,        const Self = @This();        pub fn writeOperation(self: *Self, operation: *ir.Operation) emission.Error!void {            const name = operation.name.name;            if (std.mem.eql(u8, name, ArithDialect.ConstantOp.operation_name)) {                return instruction.arithmetic.lowering.writeConstant(Out, self, operation);            }            if (std.mem.eql(u8, name, ArithDialect.AddOp.operation_name)) {                return instruction.arithmetic.lowering.writeBinary(Out, self, operation, .add);            }            if (std.mem.eql(u8, name, ArithDialect.SubOp.operation_name)) {                return instruction.arithmetic.lowering.writeBinary(Out, self, operation, .sub);            }            if (std.mem.eql(u8, name, ArithDialect.MulOp.operation_name)) {                return instruction.arithmetic.lowering.writeBinary(Out, self, operation, .mul);            }            if (std.mem.eql(u8, name, ArithDialect.DivOp.operation_name)) {                return instruction.arithmetic.lowering.writeBinary(Out, self, operation, .div);            }            if (std.mem.eql(u8, name, ArithDialect.RemOp.operation_name)) {                return instruction.arithmetic.lowering.writeBinary(Out, self, operation, .rem);            }            if (std.mem.eql(u8, name, ArithDialect.AndOp.operation_name)) {                return instruction.arithmetic.lowering.writeBinary(Out, self, operation, .band);            }            if (std.mem.eql(u8, name, ArithDialect.OrOp.operation_name)) {                return instruction.arithmetic.lowering.writeBinary(Out, self, operation, .bor);            }            if (std.mem.eql(u8, name, ArithDialect.XorOp.operation_name)) {                return instruction.arithmetic.lowering.writeBinary(Out, self, operation, .bxor);            }            if (std.mem.eql(u8, name, ArithDialect.ShlOp.operation_name)) {                return instruction.arithmetic.lowering.writeBinary(Out, self, operation, .shl);            }            if (std.mem.eql(u8, name, ArithDialect.ShrOp.operation_name)) {                return instruction.arithmetic.lowering.writeBinary(Out, self, operation, .shr);            }            if (std.mem.eql(u8, name, ArithDialect.UshrOp.operation_name)) {                return instruction.arithmetic.lowering.writeBinary(Out, self, operation, .ushr);            }            if (std.mem.eql(u8, name, ArithDialect.CmpOp.operation_name)) {                return instruction.arithmetic.lowering.writeCmp(Out, self, operation);            }            if (std.mem.eql(u8, name, ArithDialect.SelectOp.operation_name)) {                return instruction.arithmetic.lowering.writeSelect(Out, self, operation);            }            if (std.mem.eql(u8, name, ArithDialect.NegOp.operation_name)) {                return instruction.arithmetic.lowering.writeNeg(Out, self, operation);            }            if (std.mem.eql(u8, name, ArithDialect.AbsOp.operation_name)) {                return instruction.arithmetic.lowering.writeAbs(Out, self, operation);            }            if (std.mem.eql(u8, name, ArithDialect.SqrtOp.operation_name)) {                return instruction.arithmetic.lowering.writeSqrt(Out, self, operation);            }            if (std.mem.eql(u8, name, ArithDialect.BitcastOp.operation_name)) {                return instruction.cast.write(Out, self, operation, true);            }            if (std.mem.eql(u8, name, ArithDialect.CastOp.operation_name)) {                return instruction.cast.write(Out, self, operation, false);            }            if (std.mem.eql(u8, name, FuncDialect.CallOp.operation_name)) {                return instruction.call.write(Out, self, operation);            }            if (std.mem.eql(u8, name, MemrefDialect.LoadOp.operation_name)) {                return instruction.memory.writeLoad(Out, self, operation);            }            if (std.mem.eql(u8, name, MemrefDialect.StoreOp.operation_name)) {                return instruction.memory.writeStore(Out, self, operation);            }            inline for (.{ ArithDialect.AddoOp, ArithDialect.SuboOp, ArithDialect.MuloOp }) |Op| {                if (std.mem.eql(u8, name, Op.operation_name)) return error.UnsupportedOperation;            }            return error.CodeGenFailed;        }        pub fn writeValue(self: *Self, value: *ir.Value) emission.Error!void {            try self.writeLocalGet(try self.localFor(value));        }        pub fn writeLocalGet(self: *Self, local: u32) emission.Error!void {            try self.out.writeByte(0x20);            try wasm.binary.writeUleb(self.out, local);        }        pub fn writeLocalSet(self: *Self, local: u32) emission.Error!void {            try self.out.writeByte(0x21);            try wasm.binary.writeUleb(self.out, local);        }        pub fn localFor(self: *const Self, value: *ir.Value) emission.Error!u32 {            return self.plan.localFor(self.function_ordinal, value) orelse                error.CodeGenFailed;        }    };}
Called byCallsNo direct callersbackends.wasm.emission.function.instruction.a...writeAbsbackends.wasm.emission.function.instruction.a...writeBinarybackends.wasm.emission.function.instruction.a...writeCmpbackends.wasm.emission.function.instruction.a...writeConstantbackends.wasm.emission.function.instruction.a...writeNeg+6 morebackends.wasm.emission.function.instructionWriter
Static calls · unresolved targets: 0 · external targets: 5.

Source: lib/choir/src/backends/wasm/emission/function/instruction/root.zig

zig
pub const arithmetic = @import("arithmetic/root.zig");pub const cast = @import("cast.zig");pub const call = @import("call.zig");pub const memory = @import("memory.zig");pub const Writer = @import("writer.zig").Writer;

Source: lib/choir/src/backends/wasm/emission/function/root.zig:2

zig
pub const instruction = @import("instruction/root.zig");

Complete call list for backends.wasm.emission.function.instruction.Writer

11 direct calls.

Audit

Definitions2
Public names2
Members0
Version26.7.0
Revisiondaab053ee433