github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/compiler/testdata/gc.ll (about) 1 ; ModuleID = 'gc.go' 2 source_filename = "gc.go" 3 target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20" 4 target triple = "wasm32-unknown-wasi" 5 6 %runtime._interface = type { ptr, ptr } 7 8 @main.scalar1 = hidden global ptr null, align 4 9 @main.scalar2 = hidden global ptr null, align 4 10 @main.scalar3 = hidden global ptr null, align 4 11 @main.scalar4 = hidden global ptr null, align 4 12 @main.array1 = hidden global ptr null, align 4 13 @main.array2 = hidden global ptr null, align 4 14 @main.array3 = hidden global ptr null, align 4 15 @main.struct1 = hidden global ptr null, align 4 16 @main.struct2 = hidden global ptr null, align 4 17 @main.struct3 = hidden global ptr null, align 4 18 @main.struct4 = hidden global ptr null, align 4 19 @main.slice1 = hidden global { ptr, i32, i32 } zeroinitializer, align 8 20 @main.slice2 = hidden global { ptr, i32, i32 } zeroinitializer, align 8 21 @main.slice3 = hidden global { ptr, i32, i32 } zeroinitializer, align 8 22 @"runtime/gc.layout:62-2000000000000001" = linkonce_odr unnamed_addr constant { i32, [8 x i8] } { i32 62, [8 x i8] c"\01\00\00\00\00\00\00 " } 23 @"runtime/gc.layout:62-0001" = linkonce_odr unnamed_addr constant { i32, [8 x i8] } { i32 62, [8 x i8] c"\01\00\00\00\00\00\00\00" } 24 @"reflect/types.type:basic:complex128" = linkonce_odr constant { i8, ptr } { i8 80, ptr @"reflect/types.type:pointer:basic:complex128" }, align 4 25 @"reflect/types.type:pointer:basic:complex128" = linkonce_odr constant { i8, i16, ptr } { i8 -43, i16 0, ptr @"reflect/types.type:basic:complex128" }, align 4 26 27 ; Function Attrs: allockind("alloc,zeroed") allocsize(0) 28 declare noalias nonnull ptr @runtime.alloc(i32, ptr, ptr) #0 29 30 declare void @runtime.trackPointer(ptr nocapture readonly, ptr, ptr) #1 31 32 ; Function Attrs: nounwind 33 define hidden void @main.init(ptr %context) unnamed_addr #2 { 34 entry: 35 ret void 36 } 37 38 ; Function Attrs: nounwind 39 define hidden void @main.newScalar(ptr %context) unnamed_addr #2 { 40 entry: 41 %stackalloc = alloca i8, align 1 42 %new = call dereferenceable(1) ptr @runtime.alloc(i32 1, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3 43 call void @runtime.trackPointer(ptr nonnull %new, ptr nonnull %stackalloc, ptr undef) #3 44 store ptr %new, ptr @main.scalar1, align 4 45 %new1 = call dereferenceable(4) ptr @runtime.alloc(i32 4, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3 46 call void @runtime.trackPointer(ptr nonnull %new1, ptr nonnull %stackalloc, ptr undef) #3 47 store ptr %new1, ptr @main.scalar2, align 4 48 %new2 = call dereferenceable(8) ptr @runtime.alloc(i32 8, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3 49 call void @runtime.trackPointer(ptr nonnull %new2, ptr nonnull %stackalloc, ptr undef) #3 50 store ptr %new2, ptr @main.scalar3, align 4 51 %new3 = call dereferenceable(4) ptr @runtime.alloc(i32 4, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3 52 call void @runtime.trackPointer(ptr nonnull %new3, ptr nonnull %stackalloc, ptr undef) #3 53 store ptr %new3, ptr @main.scalar4, align 4 54 ret void 55 } 56 57 ; Function Attrs: nounwind 58 define hidden void @main.newArray(ptr %context) unnamed_addr #2 { 59 entry: 60 %stackalloc = alloca i8, align 1 61 %new = call dereferenceable(3) ptr @runtime.alloc(i32 3, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3 62 call void @runtime.trackPointer(ptr nonnull %new, ptr nonnull %stackalloc, ptr undef) #3 63 store ptr %new, ptr @main.array1, align 4 64 %new1 = call dereferenceable(71) ptr @runtime.alloc(i32 71, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3 65 call void @runtime.trackPointer(ptr nonnull %new1, ptr nonnull %stackalloc, ptr undef) #3 66 store ptr %new1, ptr @main.array2, align 4 67 %new2 = call dereferenceable(12) ptr @runtime.alloc(i32 12, ptr nonnull inttoptr (i32 67 to ptr), ptr undef) #3 68 call void @runtime.trackPointer(ptr nonnull %new2, ptr nonnull %stackalloc, ptr undef) #3 69 store ptr %new2, ptr @main.array3, align 4 70 ret void 71 } 72 73 ; Function Attrs: nounwind 74 define hidden void @main.newStruct(ptr %context) unnamed_addr #2 { 75 entry: 76 %stackalloc = alloca i8, align 1 77 %new = call ptr @runtime.alloc(i32 0, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3 78 call void @runtime.trackPointer(ptr nonnull %new, ptr nonnull %stackalloc, ptr undef) #3 79 store ptr %new, ptr @main.struct1, align 4 80 %new1 = call dereferenceable(8) ptr @runtime.alloc(i32 8, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3 81 call void @runtime.trackPointer(ptr nonnull %new1, ptr nonnull %stackalloc, ptr undef) #3 82 store ptr %new1, ptr @main.struct2, align 4 83 %new2 = call dereferenceable(248) ptr @runtime.alloc(i32 248, ptr nonnull @"runtime/gc.layout:62-2000000000000001", ptr undef) #3 84 call void @runtime.trackPointer(ptr nonnull %new2, ptr nonnull %stackalloc, ptr undef) #3 85 store ptr %new2, ptr @main.struct3, align 4 86 %new3 = call dereferenceable(248) ptr @runtime.alloc(i32 248, ptr nonnull @"runtime/gc.layout:62-0001", ptr undef) #3 87 call void @runtime.trackPointer(ptr nonnull %new3, ptr nonnull %stackalloc, ptr undef) #3 88 store ptr %new3, ptr @main.struct4, align 4 89 ret void 90 } 91 92 ; Function Attrs: nounwind 93 define hidden ptr @main.newFuncValue(ptr %context) unnamed_addr #2 { 94 entry: 95 %stackalloc = alloca i8, align 1 96 %new = call dereferenceable(8) ptr @runtime.alloc(i32 8, ptr nonnull inttoptr (i32 197 to ptr), ptr undef) #3 97 call void @runtime.trackPointer(ptr nonnull %new, ptr nonnull %stackalloc, ptr undef) #3 98 ret ptr %new 99 } 100 101 ; Function Attrs: nounwind 102 define hidden void @main.makeSlice(ptr %context) unnamed_addr #2 { 103 entry: 104 %stackalloc = alloca i8, align 1 105 %makeslice = call dereferenceable(5) ptr @runtime.alloc(i32 5, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #3 106 call void @runtime.trackPointer(ptr nonnull %makeslice, ptr nonnull %stackalloc, ptr undef) #3 107 store ptr %makeslice, ptr @main.slice1, align 8 108 store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice1, i32 0, i32 1), align 4 109 store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice1, i32 0, i32 2), align 8 110 %makeslice1 = call dereferenceable(20) ptr @runtime.alloc(i32 20, ptr nonnull inttoptr (i32 67 to ptr), ptr undef) #3 111 call void @runtime.trackPointer(ptr nonnull %makeslice1, ptr nonnull %stackalloc, ptr undef) #3 112 store ptr %makeslice1, ptr @main.slice2, align 8 113 store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice2, i32 0, i32 1), align 4 114 store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice2, i32 0, i32 2), align 8 115 %makeslice3 = call dereferenceable(60) ptr @runtime.alloc(i32 60, ptr nonnull inttoptr (i32 71 to ptr), ptr undef) #3 116 call void @runtime.trackPointer(ptr nonnull %makeslice3, ptr nonnull %stackalloc, ptr undef) #3 117 store ptr %makeslice3, ptr @main.slice3, align 8 118 store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice3, i32 0, i32 1), align 4 119 store i32 5, ptr getelementptr inbounds ({ ptr, i32, i32 }, ptr @main.slice3, i32 0, i32 2), align 8 120 ret void 121 } 122 123 ; Function Attrs: nounwind 124 define hidden %runtime._interface @main.makeInterface(double %v.r, double %v.i, ptr %context) unnamed_addr #2 { 125 entry: 126 %stackalloc = alloca i8, align 1 127 %0 = call dereferenceable(16) ptr @runtime.alloc(i32 16, ptr null, ptr undef) #3 128 call void @runtime.trackPointer(ptr nonnull %0, ptr nonnull %stackalloc, ptr undef) #3 129 store double %v.r, ptr %0, align 8 130 %.repack1 = getelementptr inbounds { double, double }, ptr %0, i32 0, i32 1 131 store double %v.i, ptr %.repack1, align 8 132 %1 = insertvalue %runtime._interface { ptr @"reflect/types.type:basic:complex128", ptr undef }, ptr %0, 1 133 call void @runtime.trackPointer(ptr nonnull @"reflect/types.type:basic:complex128", ptr nonnull %stackalloc, ptr undef) #3 134 call void @runtime.trackPointer(ptr nonnull %0, ptr nonnull %stackalloc, ptr undef) #3 135 ret %runtime._interface %1 136 } 137 138 attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 139 attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 140 attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 141 attributes #3 = { nounwind }