aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-11-29 16:12:21 +0000
committergingerBill <bill@gingerbill.org>2020-11-29 16:12:21 +0000
commit57f5976ac1b5416093ef25d725c30ae5ff270809 (patch)
tree578ed2767af296e9144fb04ec912fad8ae86e485 /src/llvm_backend.cpp
parent7fbc081119c57bf378a317fe6618eacd0465834d (diff)
Support map keys for simple compare types
Diffstat (limited to 'src/llvm_backend.cpp')
-rw-r--r--src/llvm_backend.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index a4cd32efa..4fe98bfcf 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -9284,8 +9284,14 @@ lbValue lb_get_hasher_proc_for_type(lbModule *m, Type *type) {
if (type->kind == Type_Struct) {
type_set_offsets(type);
-
- GB_PANIC("Type_Struct");
+ GB_ASSERT(is_type_simple_compare(type));
+ i64 sz = type_size_of(type);
+ auto args = array_make<lbValue>(permanent_allocator(), 3);
+ args[0] = data;
+ args[1] = seed;
+ args[2] = lb_const_int(m, t_int, sz);
+ lbValue res = lb_emit_runtime_call(p, "default_hasher_n", args);
+ LLVMBuildRet(p->builder, res.value);
} else if (is_type_cstring(type)) {
auto args = array_make<lbValue>(permanent_allocator(), 2);
args[0] = data;