github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/transform/testdata/maps.out.ll (about)

     1  target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
     2  target triple = "armv7m-none-eabi"
     3  
     4  @answer = constant [6 x i8] c"answer"
     5  
     6  declare nonnull ptr @runtime.hashmapMake(i8, i8, i32)
     7  
     8  declare void @runtime.hashmapStringSet(ptr nocapture, ptr, i32, ptr nocapture readonly)
     9  
    10  declare i1 @runtime.hashmapStringGet(ptr nocapture, ptr, i32, ptr nocapture)
    11  
    12  define void @testUnused() {
    13    ret void
    14  }
    15  
    16  define i32 @testReadonly() {
    17    %map = call ptr @runtime.hashmapMake(i8 4, i8 4, i32 0)
    18    %hashmap.value = alloca i32, align 4
    19    store i32 42, ptr %hashmap.value, align 4
    20    call void @runtime.hashmapStringSet(ptr %map, ptr @answer, i32 6, ptr %hashmap.value)
    21    %hashmap.value2 = alloca i32, align 4
    22    %commaOk = call i1 @runtime.hashmapStringGet(ptr %map, ptr @answer, i32 6, ptr %hashmap.value2)
    23    %loadedValue = load i32, ptr %hashmap.value2, align 4
    24    ret i32 %loadedValue
    25  }
    26  
    27  define ptr @testUsed() {
    28    %1 = call ptr @runtime.hashmapMake(i8 4, i8 4, i32 0)
    29    ret ptr %1
    30  }