aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-03-24 15:48:57 +0000
committergingerBill <bill@gingerbill.org>2020-03-24 15:48:57 +0000
commit6bfe9b66562f05fe262c08f7b71eb9fdaa5c11cc (patch)
tree7b2177b96116a3fc73f3467532491aa960b4a5b3 /src/ir.cpp
parent796331fea64a795b3764d61c840e8a55befec8fc (diff)
parentda703edbf47858c832a3f358967051c8f3cccb90 (diff)
Merge branch 'master' into llvm-integration
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 4736f2ba1..fe5608a4a 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -3929,7 +3929,20 @@ irValue *ir_addr_get_ptr(irProcedure *proc, irAddr const &addr) {
}
switch (addr.kind) {
- case irAddr_Map:
+ case irAddr_Map: {
+ Type *map_type = base_type(addr.map_type);
+ irValue *h = ir_gen_map_header(proc, addr.addr, map_type);
+ irValue *key = ir_gen_map_key(proc, addr.map_key, map_type->Map.key);
+
+ auto args = array_make<irValue *>(ir_allocator(), 2);
+ args[0] = h;
+ args[1] = key;
+
+ irValue *ptr = ir_emit_runtime_call(proc, "__dynamic_map_get", args);
+ return ir_emit_conv(proc, ptr, alloc_type_pointer(map_type->Map.value));
+ }
+
+
case irAddr_BitField: {
irValue *v = ir_addr_load(proc, addr);
return ir_address_from_load_or_generate_local(proc, v);