[Flint] adding IR lowering and printer
Mirror Gitea refs to GitHub / mirror (push) Successful in 18s
Test / build_and_test (push) Successful in 6m17s
Build / build (push) Successful in 7m51s

[IR] switching from "passes" to "transformers" for clarity
This commit is contained in:
2026-07-29 15:39:41 +02:00
parent 045497b264
commit 948e8b86a3
27 changed files with 3453 additions and 1816 deletions
+28
View File
@@ -1,3 +1,4 @@
const std = @import("std");
const spirv = @import("spirv.zig");
const Self = @This();
@@ -153,3 +154,30 @@ pub fn copyLiteralString(allocator: anytype, words: []const u32) ![]u8 {
}
return result;
}
test "SPIR-V: parser error zero-word instruction" {
const words = [_]u32{
spirv.magic_number,
0x0001_0000,
0,
2,
0,
instructionWord(.nop, 0),
};
try std.testing.expectError(error.ZeroWordInstruction, Self.init(&words));
const truncated = [_]u32{
spirv.magic_number,
0x0001_0000,
0,
2,
0,
instructionWord(.i_add, 5),
1,
};
try std.testing.expectError(error.TruncatedInstruction, Self.init(&truncated));
}
fn instructionWord(opcode: spirv.Opcode, word_count: u16) u32 {
return (@as(u32, word_count) << 16) | @intFromEnum(opcode);
}