github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/compiler/testdata/func.ll (about) 1 ; ModuleID = 'func.go' 2 source_filename = "func.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 ; Function Attrs: allockind("alloc,zeroed") allocsize(0) 7 declare noalias nonnull ptr @runtime.alloc(i32, ptr, ptr) #0 8 9 declare void @runtime.trackPointer(ptr nocapture readonly, ptr, ptr) #1 10 11 ; Function Attrs: nounwind 12 define hidden void @main.init(ptr %context) unnamed_addr #2 { 13 entry: 14 ret void 15 } 16 17 ; Function Attrs: nounwind 18 define hidden void @main.foo(ptr %callback.context, ptr %callback.funcptr, ptr %context) unnamed_addr #2 { 19 entry: 20 %0 = icmp eq ptr %callback.funcptr, null 21 br i1 %0, label %fpcall.throw, label %fpcall.next 22 23 fpcall.next: ; preds = %entry 24 call void %callback.funcptr(i32 3, ptr %callback.context) #3 25 ret void 26 27 fpcall.throw: ; preds = %entry 28 call void @runtime.nilPanic(ptr undef) #3 29 unreachable 30 } 31 32 declare void @runtime.nilPanic(ptr) #1 33 34 ; Function Attrs: nounwind 35 define hidden void @main.bar(ptr %context) unnamed_addr #2 { 36 entry: 37 call void @main.foo(ptr undef, ptr nonnull @main.someFunc, ptr undef) 38 ret void 39 } 40 41 ; Function Attrs: nounwind 42 define hidden void @main.someFunc(i32 %arg0, ptr %context) unnamed_addr #2 { 43 entry: 44 ret void 45 } 46 47 attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 48 attributes #1 = { "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 49 attributes #2 = { nounwind "target-features"="+bulk-memory,+mutable-globals,+nontrapping-fptoint,+sign-ext" } 50 attributes #3 = { nounwind }