|
| 1 | +; ModuleID = 'github.com/goplus/llgo/cl/_testgo/typerecur' |
| 2 | +source_filename = "github.com/goplus/llgo/cl/_testgo/typerecur" |
| 3 | + |
| 4 | +%"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" = type { ptr, ptr } |
| 5 | +%"github.com/goplus/llgo/cl/_testgo/typerecur.counter" = type { i64, i64, %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" } |
| 6 | +%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 } |
| 7 | + |
| 8 | +@"github.com/goplus/llgo/cl/_testgo/typerecur.init$guard" = global i1 false, align 1 |
| 9 | +@0 = private unnamed_addr constant [6 x i8] c"count:", align 1 |
| 10 | + |
| 11 | +define %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" @"github.com/goplus/llgo/cl/_testgo/typerecur.countState"(ptr %0) { |
| 12 | +_llgo_0: |
| 13 | + %1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/typerecur.counter", ptr %0, i32 0, i32 0 |
| 14 | + %2 = load i64, ptr %1, align 4 |
| 15 | + %3 = add i64 %2, 1 |
| 16 | + %4 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/typerecur.counter", ptr %0, i32 0, i32 0 |
| 17 | + store i64 %3, ptr %4, align 4 |
| 18 | + %5 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/typerecur.counter", ptr %0, i32 0, i32 0 |
| 19 | + %6 = load i64, ptr %5, align 4 |
| 20 | + call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 6 }) |
| 21 | + call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32) |
| 22 | + call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %6) |
| 23 | + call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10) |
| 24 | + %7 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/typerecur.counter", ptr %0, i32 0, i32 0 |
| 25 | + %8 = load i64, ptr %7, align 4 |
| 26 | + %9 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/typerecur.counter", ptr %0, i32 0, i32 1 |
| 27 | + %10 = load i64, ptr %9, align 4 |
| 28 | + %11 = icmp sge i64 %8, %10 |
| 29 | + br i1 %11, label %_llgo_1, label %_llgo_2 |
| 30 | + |
| 31 | +_llgo_1: ; preds = %_llgo_0 |
| 32 | + ret %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" zeroinitializer |
| 33 | + |
| 34 | +_llgo_2: ; preds = %_llgo_0 |
| 35 | + ret %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" { ptr @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/typerecur.countState", ptr null } |
| 36 | +} |
| 37 | + |
| 38 | +define void @"github.com/goplus/llgo/cl/_testgo/typerecur.init"() { |
| 39 | +_llgo_0: |
| 40 | + %0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/typerecur.init$guard", align 1 |
| 41 | + br i1 %0, label %_llgo_2, label %_llgo_1 |
| 42 | + |
| 43 | +_llgo_1: ; preds = %_llgo_0 |
| 44 | + store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/typerecur.init$guard", align 1 |
| 45 | + br label %_llgo_2 |
| 46 | + |
| 47 | +_llgo_2: ; preds = %_llgo_1, %_llgo_0 |
| 48 | + ret void |
| 49 | +} |
| 50 | + |
| 51 | +define void @"github.com/goplus/llgo/cl/_testgo/typerecur.main"() { |
| 52 | +_llgo_0: |
| 53 | + %0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 32) |
| 54 | + %1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/typerecur.counter", ptr %0, i32 0, i32 1 |
| 55 | + %2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/typerecur.counter", ptr %0, i32 0, i32 2 |
| 56 | + store i64 5, ptr %1, align 4 |
| 57 | + store %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" { ptr @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/typerecur.countState", ptr null }, ptr %2, align 8 |
| 58 | + br label %_llgo_3 |
| 59 | + |
| 60 | +_llgo_1: ; preds = %_llgo_3 |
| 61 | + %3 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/typerecur.counter", ptr %0, i32 0, i32 2 |
| 62 | + %4 = load %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn", ptr %3, align 8 |
| 63 | + %5 = extractvalue %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" %4, 1 |
| 64 | + %6 = extractvalue %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" %4, 0 |
| 65 | + %7 = call %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" %6(ptr %5, ptr %0) |
| 66 | + %8 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/typerecur.counter", ptr %0, i32 0, i32 2 |
| 67 | + store %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" %7, ptr %8, align 8 |
| 68 | + br label %_llgo_3 |
| 69 | + |
| 70 | +_llgo_2: ; preds = %_llgo_3 |
| 71 | + ret void |
| 72 | + |
| 73 | +_llgo_3: ; preds = %_llgo_1, %_llgo_0 |
| 74 | + %9 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/typerecur.counter", ptr %0, i32 0, i32 2 |
| 75 | + %10 = load %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn", ptr %9, align 8 |
| 76 | + %11 = extractvalue %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" %10, 0 |
| 77 | + %12 = icmp ne ptr %11, null |
| 78 | + br i1 %12, label %_llgo_1, label %_llgo_2 |
| 79 | +} |
| 80 | + |
| 81 | +declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String") |
| 82 | + |
| 83 | +declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8) |
| 84 | + |
| 85 | +declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64) |
| 86 | + |
| 87 | +define linkonce %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/typerecur.countState"(ptr %0, ptr %1) { |
| 88 | +_llgo_0: |
| 89 | + %2 = tail call %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" @"github.com/goplus/llgo/cl/_testgo/typerecur.countState"(ptr %1) |
| 90 | + ret %"github.com/goplus/llgo/cl/_testgo/typerecur.stateFn" %2 |
| 91 | +} |
| 92 | + |
| 93 | +declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64) |
0 commit comments