diff options
| author | Robin Voetter <robin@voetter.nl> | 2023-11-24 23:01:32 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-24 23:01:32 +0100 |
| commit | 608b5d06eace0ccdce816725b8f0d7a6e9c12b81 (patch) | |
| tree | 10bcadb165648f599616789f995c1ec8406cdd93 /src/codegen/spirv | |
| parent | 3acb0e30a06d7ef7ece9257bc3423b9c85a12c06 (diff) | |
| parent | decff512383e8ea8a52583ba0e39617fa24dc79d (diff) | |
| download | zig-608b5d06eace0ccdce816725b8f0d7a6e9c12b81.tar.gz zig-608b5d06eace0ccdce816725b8f0d7a6e9c12b81.zip | |
Merge pull request #18097 from Snektron/spirv-structured-codegen
spirv: structured codegen
Diffstat (limited to 'src/codegen/spirv')
| -rw-r--r-- | src/codegen/spirv/Module.zig | 1 | ||||
| -rw-r--r-- | src/codegen/spirv/Section.zig | 17 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index 4ecbc8d7a0..056792ab9a 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -184,6 +184,7 @@ pub fn deinit(self: *Module) void { self.sections.debug_strings.deinit(self.gpa); self.sections.debug_names.deinit(self.gpa); self.sections.annotations.deinit(self.gpa); + self.sections.types_globals_constants.deinit(self.gpa); self.sections.functions.deinit(self.gpa); self.source_file_names.deinit(self.gpa); diff --git a/src/codegen/spirv/Section.zig b/src/codegen/spirv/Section.zig index ae88dc7c8a..2ce11111a7 100644 --- a/src/codegen/spirv/Section.zig +++ b/src/codegen/spirv/Section.zig @@ -65,6 +65,16 @@ pub fn emit( section.writeOperands(opcode.Operands(), operands); } +pub fn emitBranch( + section: *Section, + allocator: Allocator, + target_label: spec.IdRef, +) !void { + try section.emit(allocator, .OpBranch, .{ + .target_label = target_label, + }); +} + pub fn emitSpecConstantOp( section: *Section, allocator: Allocator, @@ -198,10 +208,6 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand } } - if (mask == 0) { - return; - } - section.writeWord(mask); inline for (@typeInfo(Operand).Struct.fields) |field| { @@ -304,9 +310,6 @@ fn extendedMaskSize(comptime Operand: type, operand: Operand) usize { else => unreachable, } } - if (!any_set) { - return 0; - } return total + 1; // Add one for the mask itself. } |
