From 28dd9d478d24190ab5c8c4b892d7dfc16c380ae0 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 12 Jul 2021 12:40:32 -0700 Subject: C backend: TypedefMap is now ArrayHashMap The C backend depends on insertion order into this map so that type definitions will be declared before they are used. --- src/codegen/c.zig | 6 +++--- src/codegen/spirv.zig | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/codegen') diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 31c7fa76d3..391375c709 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -39,11 +39,11 @@ const BlockData = struct { }; pub const CValueMap = std.AutoHashMap(*Inst, CValue); -pub const TypedefMap = std.HashMap( +pub const TypedefMap = std.ArrayHashMap( Type, struct { name: []const u8, rendered: []u8 }, - Type.HashContext, - std.hash_map.default_max_load_percentage, + Type.HashContext32, + true, ); fn formatTypeAsCIdentifier( diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 9e0cd19f6f..7fa813e565 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -18,7 +18,7 @@ const Inst = ir.Inst; pub const Word = u32; pub const ResultId = u32; -pub const TypeMap = std.HashMap(Type, u32, Type.HashContext, std.hash_map.default_max_load_percentage); +pub const TypeMap = std.HashMap(Type, u32, Type.HashContext64, std.hash_map.default_max_load_percentage); pub const InstMap = std.AutoHashMap(*Inst, ResultId); const IncomingBlock = struct { -- cgit v1.2.3