github.com/goplus/llgo@v0.8.3/cl/_testrt/callback/out.ll (about) 1 ; ModuleID = 'main' 2 source_filename = "main" 3 4 @"main.init$guard" = global ptr null 5 @__llgo_argc = global ptr null 6 @__llgo_argv = global ptr null 7 @0 = private unnamed_addr constant [7 x i8] c"Hello\0A\00", align 1 8 @1 = private unnamed_addr constant [10 x i8] c"callback\0A\00", align 1 9 10 define void @main.callback(ptr %0, { ptr, ptr } %1) { 11 _llgo_0: 12 %2 = extractvalue { ptr, ptr } %1, 1 13 %3 = extractvalue { ptr, ptr } %1, 0 14 call void %3(ptr %2, ptr %0) 15 ret void 16 } 17 18 define void @main.init() { 19 _llgo_0: 20 %0 = load i1, ptr @"main.init$guard", align 1 21 br i1 %0, label %_llgo_2, label %_llgo_1 22 23 _llgo_1: ; preds = %_llgo_0 24 store i1 true, ptr @"main.init$guard", align 1 25 br label %_llgo_2 26 27 _llgo_2: ; preds = %_llgo_1, %_llgo_0 28 ret void 29 } 30 31 define i32 @main(i32 %0, ptr %1) { 32 _llgo_0: 33 store i32 %0, ptr @__llgo_argc, align 4 34 store ptr %1, ptr @__llgo_argv, align 8 35 call void @"github.com/goplus/llgo/internal/runtime.init"() 36 call void @main.init() 37 %2 = alloca { ptr, ptr }, align 8 38 %3 = getelementptr inbounds { ptr, ptr }, ptr %2, i32 0, i32 0 39 store ptr @__llgo_stub.main.print, ptr %3, align 8 40 %4 = getelementptr inbounds { ptr, ptr }, ptr %2, i32 0, i32 1 41 store ptr null, ptr %4, align 8 42 %5 = load { ptr, ptr }, ptr %2, align 8 43 call void @main.callback(ptr @0, { ptr, ptr } %5) 44 %6 = alloca { ptr, ptr }, align 8 45 %7 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 0 46 store ptr @__llgo_stub.main.print, ptr %7, align 8 47 %8 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 1 48 store ptr null, ptr %8, align 8 49 %9 = load { ptr, ptr }, ptr %6, align 8 50 call void @main.callback(ptr @1, { ptr, ptr } %9) 51 ret i32 0 52 } 53 54 define void @main.print(ptr %0) { 55 _llgo_0: 56 %1 = call i32 (ptr, ...) @printf(ptr %0) 57 ret void 58 } 59 60 declare void @"github.com/goplus/llgo/internal/runtime.init"() 61 62 define linkonce void @__llgo_stub.main.print(ptr %0, ptr %1) { 63 _llgo_0: 64 tail call void @main.print(ptr %1) 65 ret void 66 } 67 68 declare i32 @printf(ptr, ...)