adding opcodes and results

This commit is contained in:
2025-12-27 00:46:40 +01:00
parent 49f0219900
commit 3283ed42a8
7 changed files with 336 additions and 62 deletions

View File

@@ -1,5 +1,6 @@
const std = @import("std");
const spv = @import("spv.zig");
const op = @import("opcodes.zig");
const SpvVoid = spv.SpvVoid;
const SpvByte = spv.SpvByte;
@@ -7,35 +8,36 @@ const SpvWord = spv.SpvWord;
const SpvBool = spv.SpvBool;
const Module = @import("Module.zig");
const Result = @import("Result.zig");
const WordIterator = @import("WordIterator.zig");
const Self = @This();
pub const CallError = error{
pub const RuntimeError = error{
InvalidSpirV,
OutOfMemory,
Unreachable,
Killed,
Error,
InitEnd,
ExecEnd,
};
module: *Module,
mod: *Module,
it: WordIterator,
stack_frames: std.SinglyLinkedList,
pub fn init(module: *Module) !Self {
return .{
.module = module,
current_function: ?*Result,
pub fn init(module: *Module) Self {
return std.mem.zeroInit(Self, .{
.mod = module,
.it = module.it,
.stack_frames = .{},
};
.current_function = null,
});
}
pub fn deinit(self: *const Self) void {
_ = self;
}
pub fn callEntryPoint(self: *Self, entry: SpvWord) CallError!void {
pub fn callEntryPoint(self: *Self, entry: SpvWord) RuntimeError!void {
_ = self;
_ = entry;
}