diff options
Diffstat (limited to 'src/codegen/spirv.zig')
| -rw-r--r-- | src/codegen/spirv.zig | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 399a314bf0..4ce5de7523 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -2,6 +2,7 @@ const std = @import("std"); const Allocator = std.mem.Allocator; const Target = std.Target; const log = std.log.scoped(.codegen); +const assert = std.debug.assert; const spec = @import("spirv/spec.zig"); const Opcode = spec.Opcode; @@ -17,7 +18,7 @@ const Inst = ir.Inst; pub const Word = u32; pub const ResultId = u32; -pub const TypeMap = std.HashMap(Type, ResultId, Type.hash, Type.eql, std.hash_map.default_max_load_percentage); +pub const TypeMap = std.HashMap(Type, u32, Type.HashContext, std.hash_map.default_max_load_percentage); pub const InstMap = std.AutoHashMap(*Inst, ResultId); const IncomingBlock = struct { @@ -141,16 +142,16 @@ pub const SPIRVModule = struct { const path = decl.namespace.file_scope.sub_file_path; const result = try self.file_names.getOrPut(path); if (!result.found_existing) { - result.entry.value = self.allocResultId(); - try writeInstructionWithString(&self.binary.debug_strings, .OpString, &[_]Word{result.entry.value}, path); + result.value_ptr.* = self.allocResultId(); + try writeInstructionWithString(&self.binary.debug_strings, .OpString, &[_]Word{result.value_ptr.*}, path); try writeInstruction(&self.binary.debug_strings, .OpSource, &[_]Word{ @enumToInt(spec.SourceLanguage.Unknown), // TODO: Register Zig source language. 0, // TODO: Zig version as u32? - result.entry.value, + result.value_ptr.*, }); } - return result.entry.value; + return result.value_ptr.*; } }; @@ -847,7 +848,7 @@ pub const DeclGen = struct { .incoming_blocks = &incoming_blocks, }); defer { - self.blocks.removeAssertDiscard(inst); + assert(self.blocks.remove(inst)); incoming_blocks.deinit(self.spv.gpa); } |
