From 1ed798342a0982410d2d412bc3c047ac2845a0d2 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Sat, 14 Sep 2024 18:46:44 +0800 Subject: [PATCH] move debug test into _testdata --- chore/gentests/gentests.go | 22 +- cl/_testdata/debug/flags.txt | 1 + cl/_testdata/debug/in.go | 35 ++ cl/_testdata/debug/out.ll | 1 + cl/_testgo/selects/out.ll | 408 ++++++++++----------- cl/blocks/block_test.go | 2 +- cl/cltest/cltest.go | 2 +- cl/compile_test.go | 692 ----------------------------------- 8 files changed, 254 insertions(+), 909 deletions(-) create mode 100644 cl/_testdata/debug/flags.txt create mode 100644 cl/_testdata/debug/in.go create mode 100644 cl/_testdata/debug/out.ll diff --git a/chore/gentests/gentests.go b/chore/gentests/gentests.go index cc7d5692..ca9ec331 100644 --- a/chore/gentests/gentests.go +++ b/chore/gentests/gentests.go @@ -64,17 +64,17 @@ func llgenDir(dir string, pkgPath ...string) { if !fi.IsDir() || strings.HasPrefix(name, "_") { continue } - func() { - testDir := dir + "/" + name - fmt.Fprintln(os.Stderr, "llgen", testDir) - os.Chdir(testDir) - dbg := isDbgSymEnabled("flags.txt") - if dbg { - cl.EnableDebugSymbols() - } - defer cl.DisableDebugSymbols() - llgen.SmartDoFile("in.go", pkgPath...) - }() + testDir := dir + "/" + name + fmt.Fprintln(os.Stderr, "llgen", testDir) + os.Chdir(testDir) + dbg := isDbgSymEnabled("flags.txt") + if dbg { + cl.EnableDebugSymbols() + } else { + cl.DisableDebugSymbols() + } + + llgen.SmartDoFile("in.go", pkgPath...) } } diff --git a/cl/_testdata/debug/flags.txt b/cl/_testdata/debug/flags.txt new file mode 100644 index 00000000..ec2d3db9 --- /dev/null +++ b/cl/_testdata/debug/flags.txt @@ -0,0 +1 @@ +-dbg \ No newline at end of file diff --git a/cl/_testdata/debug/in.go b/cl/_testdata/debug/in.go new file mode 100644 index 00000000..be79647d --- /dev/null +++ b/cl/_testdata/debug/in.go @@ -0,0 +1,35 @@ +package foo + +type IFoo interface { + Foo(a []int, b string) int +} + +type Foo struct { + nexy *Foo + data map[string]uint64 +} + +func (Foo) Foo(a []int, b string) int { + return 1 +} + +func fn(a int, b float64) int { + return 1 +} + +func fn1(fn func(int, float64) int) { + fn(1, 1.0) +} + +func fn2() { + fn1(fn) + ch := make(chan int) + go func() { + ch <- 1 + }() + <-ch + + f := Foo{} + var foo IFoo = f + foo.Foo(nil, "") +} diff --git a/cl/_testdata/debug/out.ll b/cl/_testdata/debug/out.ll new file mode 100644 index 00000000..1c8a0e79 --- /dev/null +++ b/cl/_testdata/debug/out.ll @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/cl/_testgo/selects/out.ll b/cl/_testgo/selects/out.ll index ee7881bc..6ca105e4 100644 --- a/cl/_testgo/selects/out.ll +++ b/cl/_testgo/selects/out.ll @@ -75,122 +75,124 @@ _llgo_0: %24 = call i32 @"github.com/goplus/llgo/internal/runtime.CreateThread"(ptr %19, ptr null, %"github.com/goplus/llgo/c/pthread.RoutineFunc" %23, ptr %17) %25 = load ptr, ptr %2, align 8 %26 = alloca {}, align 8 - call void @llvm.memset(ptr %26, i8 0, i64 0, i1 false) - store {} zeroinitializer, ptr %26, align 1 - %27 = call i1 @"github.com/goplus/llgo/internal/runtime.ChanSend"(ptr %25, ptr %26, i64 0) - %28 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %29 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %28, i32 0, i32 0 - store ptr @0, ptr %29, align 8 - %30 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %28, i32 0, i32 1 - store i64 4, ptr %30, align 4 - %31 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %28, align 8 - call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %31) + %27 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %26, i64 0) + store {} zeroinitializer, ptr %27, align 1 + %28 = call i1 @"github.com/goplus/llgo/internal/runtime.ChanSend"(ptr %25, ptr %27, i64 0) + %29 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %30 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %29, i32 0, i32 0 + store ptr @0, ptr %30, align 8 + %31 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %29, i32 0, i32 1 + store i64 4, ptr %31, align 4 + %32 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %29, align 8 + call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %32) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %32 = load ptr, ptr %4, align 8 - %33 = alloca {}, align 8 - call void @llvm.memset(ptr %33, i8 0, i64 0, i1 false) - %34 = alloca %"github.com/goplus/llgo/internal/runtime.ChanOp", align 8 - %35 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %34, i32 0, i32 0 - store ptr %32, ptr %35, align 8 - %36 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %34, i32 0, i32 1 - store ptr %33, ptr %36, align 8 - %37 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %34, i32 0, i32 2 - store i64 0, ptr %37, align 4 - %38 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %34, i32 0, i32 3 - store i1 false, ptr %38, align 1 - %39 = load %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %34, align 8 - %40 = alloca {}, align 8 - call void @llvm.memset(ptr %40, i8 0, i64 0, i1 false) - %41 = alloca %"github.com/goplus/llgo/internal/runtime.ChanOp", align 8 - %42 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %41, i32 0, i32 0 - store ptr %8, ptr %42, align 8 - %43 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %41, i32 0, i32 1 - store ptr %40, ptr %43, align 8 - %44 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %41, i32 0, i32 2 - store i64 0, ptr %44, align 4 - %45 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %41, i32 0, i32 3 - store i1 false, ptr %45, align 1 - %46 = load %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %41, align 8 - %47 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 48) - %48 = getelementptr %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %47, i64 0 - store %"github.com/goplus/llgo/internal/runtime.ChanOp" %39, ptr %48, align 8 - %49 = getelementptr %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %47, i64 1 - store %"github.com/goplus/llgo/internal/runtime.ChanOp" %46, ptr %49, align 8 - %50 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 - %51 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %50, i32 0, i32 0 - store ptr %47, ptr %51, align 8 - %52 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %50, i32 0, i32 1 - store i64 2, ptr %52, align 4 - %53 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %50, i32 0, i32 2 - store i64 2, ptr %53, align 4 - %54 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %50, align 8 - %55 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.Select"(%"github.com/goplus/llgo/internal/runtime.Slice" %54) - %56 = extractvalue { i64, i1 } %55, 0 - %57 = extractvalue { i64, i1 } %55, 1 - %58 = extractvalue %"github.com/goplus/llgo/internal/runtime.ChanOp" %39, 1 - %59 = load {}, ptr %58, align 1 - %60 = extractvalue %"github.com/goplus/llgo/internal/runtime.ChanOp" %46, 1 - %61 = load {}, ptr %60, align 1 - %62 = alloca { i64, i1, {}, {} }, align 8 - %63 = getelementptr inbounds { i64, i1, {}, {} }, ptr %62, i32 0, i32 0 - store i64 %56, ptr %63, align 4 - %64 = getelementptr inbounds { i64, i1, {}, {} }, ptr %62, i32 0, i32 1 - store i1 %57, ptr %64, align 1 - %65 = getelementptr inbounds { i64, i1, {}, {} }, ptr %62, i32 0, i32 2 - store {} %59, ptr %65, align 1 - %66 = getelementptr inbounds { i64, i1, {}, {} }, ptr %62, i32 0, i32 3 - store {} %61, ptr %66, align 1 - %67 = load { i64, i1, {}, {} }, ptr %62, align 4 - %68 = extractvalue { i64, i1, {}, {} } %67, 0 - %69 = icmp eq i64 %68, 0 - br i1 %69, label %_llgo_2, label %_llgo_3 + %33 = load ptr, ptr %4, align 8 + %34 = alloca {}, align 8 + %35 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %34, i64 0) + %36 = alloca %"github.com/goplus/llgo/internal/runtime.ChanOp", align 8 + %37 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %36, i32 0, i32 0 + store ptr %33, ptr %37, align 8 + %38 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %36, i32 0, i32 1 + store ptr %35, ptr %38, align 8 + %39 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %36, i32 0, i32 2 + store i64 0, ptr %39, align 4 + %40 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %36, i32 0, i32 3 + store i1 false, ptr %40, align 1 + %41 = load %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %36, align 8 + %42 = alloca {}, align 8 + %43 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %42, i64 0) + %44 = alloca %"github.com/goplus/llgo/internal/runtime.ChanOp", align 8 + %45 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %44, i32 0, i32 0 + store ptr %8, ptr %45, align 8 + %46 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %44, i32 0, i32 1 + store ptr %43, ptr %46, align 8 + %47 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %44, i32 0, i32 2 + store i64 0, ptr %47, align 4 + %48 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %44, i32 0, i32 3 + store i1 false, ptr %48, align 1 + %49 = load %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %44, align 8 + %50 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 48) + %51 = getelementptr %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %50, i64 0 + store %"github.com/goplus/llgo/internal/runtime.ChanOp" %41, ptr %51, align 8 + %52 = getelementptr %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %50, i64 1 + store %"github.com/goplus/llgo/internal/runtime.ChanOp" %49, ptr %52, align 8 + %53 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %54 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %53, i32 0, i32 0 + store ptr %50, ptr %54, align 8 + %55 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %53, i32 0, i32 1 + store i64 2, ptr %55, align 4 + %56 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %53, i32 0, i32 2 + store i64 2, ptr %56, align 4 + %57 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %53, align 8 + %58 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.Select"(%"github.com/goplus/llgo/internal/runtime.Slice" %57) + %59 = extractvalue { i64, i1 } %58, 0 + %60 = extractvalue { i64, i1 } %58, 1 + %61 = extractvalue %"github.com/goplus/llgo/internal/runtime.ChanOp" %41, 1 + %62 = load {}, ptr %61, align 1 + %63 = extractvalue %"github.com/goplus/llgo/internal/runtime.ChanOp" %49, 1 + %64 = load {}, ptr %63, align 1 + %65 = alloca { i64, i1, {}, {} }, align 8 + %66 = getelementptr inbounds { i64, i1, {}, {} }, ptr %65, i32 0, i32 0 + store i64 %59, ptr %66, align 4 + %67 = getelementptr inbounds { i64, i1, {}, {} }, ptr %65, i32 0, i32 1 + store i1 %60, ptr %67, align 1 + %68 = getelementptr inbounds { i64, i1, {}, {} }, ptr %65, i32 0, i32 2 + store {} %62, ptr %68, align 1 + %69 = getelementptr inbounds { i64, i1, {}, {} }, ptr %65, i32 0, i32 3 + store {} %64, ptr %69, align 1 + %70 = load { i64, i1, {}, {} }, ptr %65, align 4 + %71 = extractvalue { i64, i1, {}, {} } %70, 0 + %72 = icmp eq i64 %71, 0 + br i1 %72, label %_llgo_2, label %_llgo_3 _llgo_1: ; preds = %_llgo_4, %_llgo_2 ret i32 0 _llgo_2: ; preds = %_llgo_0 - %70 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %71 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %70, i32 0, i32 0 - store ptr @1, ptr %71, align 8 - %72 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %70, i32 0, i32 1 - store i64 4, ptr %72, align 4 - %73 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %70, align 8 - call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %73) + %73 = extractvalue { i64, i1, {}, {} } %70, 2 + %74 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %75 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %74, i32 0, i32 0 + store ptr @1, ptr %75, align 8 + %76 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %74, i32 0, i32 1 + store i64 4, ptr %76, align 4 + %77 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %74, align 8 + call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %77) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) br label %_llgo_1 _llgo_3: ; preds = %_llgo_0 - %74 = icmp eq i64 %68, 1 - br i1 %74, label %_llgo_4, label %_llgo_5 + %78 = icmp eq i64 %71, 1 + br i1 %78, label %_llgo_4, label %_llgo_5 _llgo_4: ; preds = %_llgo_3 - %75 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %76 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %75, i32 0, i32 0 - store ptr @2, ptr %76, align 8 - %77 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %75, i32 0, i32 1 - store i64 4, ptr %77, align 4 - %78 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %75, align 8 - call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %78) + %79 = extractvalue { i64, i1, {}, {} } %70, 3 + %80 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %81 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %80, i32 0, i32 0 + store ptr @2, ptr %81, align 8 + %82 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %80, i32 0, i32 1 + store i64 4, ptr %82, align 4 + %83 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %80, align 8 + call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %83) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) br label %_llgo_1 _llgo_5: ; preds = %_llgo_3 - %79 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %80 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %79, i32 0, i32 0 - store ptr @3, ptr %80, align 8 - %81 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %79, i32 0, i32 1 - store i64 31, ptr %81, align 4 - %82 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %79, align 8 - %83 = load ptr, ptr @_llgo_string, align 8 - %84 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) - store %"github.com/goplus/llgo/internal/runtime.String" %82, ptr %84, align 8 - %85 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 - %86 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %85, i32 0, i32 0 - store ptr %83, ptr %86, align 8 - %87 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %85, i32 0, i32 1 - store ptr %84, ptr %87, align 8 - %88 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %85, align 8 - call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %88) + %84 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %85 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %84, i32 0, i32 0 + store ptr @3, ptr %85, align 8 + %86 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %84, i32 0, i32 1 + store i64 31, ptr %86, align 4 + %87 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %84, align 8 + %88 = load ptr, ptr @_llgo_string, align 8 + %89 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %87, ptr %89, align 8 + %90 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %91 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %90, i32 0, i32 0 + store ptr %88, ptr %91, align 8 + %92 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %90, i32 0, i32 1 + store ptr %89, ptr %92, align 8 + %93 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %90, align 8 + call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %93) unreachable } @@ -200,122 +202,123 @@ _llgo_0: %2 = extractvalue { ptr, ptr, ptr } %1, 0 %3 = load ptr, ptr %2, align 8 %4 = alloca {}, align 8 - call void @llvm.memset(ptr %4, i8 0, i64 0, i1 false) - %5 = call i1 @"github.com/goplus/llgo/internal/runtime.ChanRecv"(ptr %3, ptr %4, i64 0) - %6 = load {}, ptr %4, align 1 - %7 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %8 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %7, i32 0, i32 0 - store ptr @4, ptr %8, align 8 - %9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %7, i32 0, i32 1 - store i64 4, ptr %9, align 4 - %10 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %7, align 8 - call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %10) + %5 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %4, i64 0) + %6 = call i1 @"github.com/goplus/llgo/internal/runtime.ChanRecv"(ptr %3, ptr %5, i64 0) + %7 = load {}, ptr %5, align 1 + %8 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %8, i32 0, i32 0 + store ptr @4, ptr %9, align 8 + %10 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %8, i32 0, i32 1 + store i64 4, ptr %10, align 4 + %11 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %8, align 8 + call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %11) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) - %11 = extractvalue { ptr, ptr, ptr } %1, 1 - %12 = load ptr, ptr %11, align 8 - %13 = extractvalue { ptr, ptr, ptr } %1, 2 - %14 = load ptr, ptr %13, align 8 - %15 = alloca {}, align 8 - call void @llvm.memset(ptr %15, i8 0, i64 0, i1 false) - store {} zeroinitializer, ptr %15, align 1 - %16 = alloca %"github.com/goplus/llgo/internal/runtime.ChanOp", align 8 - %17 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %16, i32 0, i32 0 - store ptr %12, ptr %17, align 8 - %18 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %16, i32 0, i32 1 - store ptr %15, ptr %18, align 8 - %19 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %16, i32 0, i32 2 - store i32 0, ptr %19, align 4 - %20 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %16, i32 0, i32 3 - store i1 true, ptr %20, align 1 - %21 = load %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %16, align 8 - %22 = alloca {}, align 8 - call void @llvm.memset(ptr %22, i8 0, i64 0, i1 false) - %23 = alloca %"github.com/goplus/llgo/internal/runtime.ChanOp", align 8 - %24 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %23, i32 0, i32 0 - store ptr %14, ptr %24, align 8 - %25 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %23, i32 0, i32 1 - store ptr %22, ptr %25, align 8 - %26 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %23, i32 0, i32 2 - store i64 0, ptr %26, align 4 - %27 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %23, i32 0, i32 3 - store i1 false, ptr %27, align 1 - %28 = load %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %23, align 8 - %29 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 48) - %30 = getelementptr %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %29, i64 0 - store %"github.com/goplus/llgo/internal/runtime.ChanOp" %21, ptr %30, align 8 - %31 = getelementptr %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %29, i64 1 - store %"github.com/goplus/llgo/internal/runtime.ChanOp" %28, ptr %31, align 8 - %32 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 - %33 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %32, i32 0, i32 0 - store ptr %29, ptr %33, align 8 - %34 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %32, i32 0, i32 1 - store i64 2, ptr %34, align 4 - %35 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %32, i32 0, i32 2 - store i64 2, ptr %35, align 4 - %36 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %32, align 8 - %37 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.Select"(%"github.com/goplus/llgo/internal/runtime.Slice" %36) - %38 = extractvalue { i64, i1 } %37, 0 - %39 = extractvalue { i64, i1 } %37, 1 - %40 = extractvalue %"github.com/goplus/llgo/internal/runtime.ChanOp" %28, 1 - %41 = load {}, ptr %40, align 1 - %42 = alloca { i64, i1, {} }, align 8 - %43 = getelementptr inbounds { i64, i1, {} }, ptr %42, i32 0, i32 0 - store i64 %38, ptr %43, align 4 - %44 = getelementptr inbounds { i64, i1, {} }, ptr %42, i32 0, i32 1 - store i1 %39, ptr %44, align 1 - %45 = getelementptr inbounds { i64, i1, {} }, ptr %42, i32 0, i32 2 - store {} %41, ptr %45, align 1 - %46 = load { i64, i1, {} }, ptr %42, align 4 - %47 = extractvalue { i64, i1, {} } %46, 0 - %48 = icmp eq i64 %47, 0 - br i1 %48, label %_llgo_2, label %_llgo_3 + %12 = extractvalue { ptr, ptr, ptr } %1, 1 + %13 = load ptr, ptr %12, align 8 + %14 = extractvalue { ptr, ptr, ptr } %1, 2 + %15 = load ptr, ptr %14, align 8 + %16 = alloca {}, align 8 + %17 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %16, i64 0) + store {} zeroinitializer, ptr %17, align 1 + %18 = alloca %"github.com/goplus/llgo/internal/runtime.ChanOp", align 8 + %19 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %18, i32 0, i32 0 + store ptr %13, ptr %19, align 8 + %20 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %18, i32 0, i32 1 + store ptr %17, ptr %20, align 8 + %21 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %18, i32 0, i32 2 + store i32 0, ptr %21, align 4 + %22 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %18, i32 0, i32 3 + store i1 true, ptr %22, align 1 + %23 = load %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %18, align 8 + %24 = alloca {}, align 8 + %25 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %24, i64 0) + %26 = alloca %"github.com/goplus/llgo/internal/runtime.ChanOp", align 8 + %27 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %26, i32 0, i32 0 + store ptr %15, ptr %27, align 8 + %28 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %26, i32 0, i32 1 + store ptr %25, ptr %28, align 8 + %29 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %26, i32 0, i32 2 + store i64 0, ptr %29, align 4 + %30 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %26, i32 0, i32 3 + store i1 false, ptr %30, align 1 + %31 = load %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %26, align 8 + %32 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 48) + %33 = getelementptr %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %32, i64 0 + store %"github.com/goplus/llgo/internal/runtime.ChanOp" %23, ptr %33, align 8 + %34 = getelementptr %"github.com/goplus/llgo/internal/runtime.ChanOp", ptr %32, i64 1 + store %"github.com/goplus/llgo/internal/runtime.ChanOp" %31, ptr %34, align 8 + %35 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 + %36 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %35, i32 0, i32 0 + store ptr %32, ptr %36, align 8 + %37 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %35, i32 0, i32 1 + store i64 2, ptr %37, align 4 + %38 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %35, i32 0, i32 2 + store i64 2, ptr %38, align 4 + %39 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %35, align 8 + %40 = call { i64, i1 } @"github.com/goplus/llgo/internal/runtime.Select"(%"github.com/goplus/llgo/internal/runtime.Slice" %39) + %41 = extractvalue { i64, i1 } %40, 0 + %42 = extractvalue { i64, i1 } %40, 1 + %43 = extractvalue %"github.com/goplus/llgo/internal/runtime.ChanOp" %31, 1 + %44 = load {}, ptr %43, align 1 + %45 = alloca { i64, i1, {} }, align 8 + %46 = getelementptr inbounds { i64, i1, {} }, ptr %45, i32 0, i32 0 + store i64 %41, ptr %46, align 4 + %47 = getelementptr inbounds { i64, i1, {} }, ptr %45, i32 0, i32 1 + store i1 %42, ptr %47, align 1 + %48 = getelementptr inbounds { i64, i1, {} }, ptr %45, i32 0, i32 2 + store {} %44, ptr %48, align 1 + %49 = load { i64, i1, {} }, ptr %45, align 4 + %50 = extractvalue { i64, i1, {} } %49, 0 + %51 = icmp eq i64 %50, 0 + br i1 %51, label %_llgo_2, label %_llgo_3 _llgo_1: ; preds = %_llgo_4, %_llgo_2 ret void _llgo_2: ; preds = %_llgo_0 - %49 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %50 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %49, i32 0, i32 0 - store ptr @5, ptr %50, align 8 - %51 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %49, i32 0, i32 1 - store i64 4, ptr %51, align 4 - %52 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %49, align 8 - call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %52) + %52 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %53 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %52, i32 0, i32 0 + store ptr @5, ptr %53, align 8 + %54 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %52, i32 0, i32 1 + store i64 4, ptr %54, align 4 + %55 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %52, align 8 + call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %55) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) br label %_llgo_1 _llgo_3: ; preds = %_llgo_0 - %53 = icmp eq i64 %47, 1 - br i1 %53, label %_llgo_4, label %_llgo_5 + %56 = icmp eq i64 %50, 1 + br i1 %56, label %_llgo_4, label %_llgo_5 _llgo_4: ; preds = %_llgo_3 - %54 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %55 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %54, i32 0, i32 0 - store ptr @6, ptr %55, align 8 - %56 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %54, i32 0, i32 1 - store i64 4, ptr %56, align 4 - %57 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %54, align 8 - call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %57) + %57 = extractvalue { i64, i1, {} } %49, 2 + %58 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %59 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %58, i32 0, i32 0 + store ptr @6, ptr %59, align 8 + %60 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %58, i32 0, i32 1 + store i64 4, ptr %60, align 4 + %61 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %58, align 8 + call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %61) call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10) br label %_llgo_1 _llgo_5: ; preds = %_llgo_3 - %58 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %59 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %58, i32 0, i32 0 - store ptr @3, ptr %59, align 8 - %60 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %58, i32 0, i32 1 - store i64 31, ptr %60, align 4 - %61 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %58, align 8 - %62 = load ptr, ptr @_llgo_string, align 8 - %63 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) - store %"github.com/goplus/llgo/internal/runtime.String" %61, ptr %63, align 8 - %64 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 - %65 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %64, i32 0, i32 0 - store ptr %62, ptr %65, align 8 - %66 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %64, i32 0, i32 1 - store ptr %63, ptr %66, align 8 - %67 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %64, align 8 - call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %67) + %62 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 + %63 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %62, i32 0, i32 0 + store ptr @3, ptr %63, align 8 + %64 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %62, i32 0, i32 1 + store i64 31, ptr %64, align 4 + %65 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %62, align 8 + %66 = load ptr, ptr @_llgo_string, align 8 + %67 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) + store %"github.com/goplus/llgo/internal/runtime.String" %65, ptr %67, align 8 + %68 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8 + %69 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i32 0, i32 0 + store ptr %66, ptr %69, align 8 + %70 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, i32 0, i32 1 + store ptr %67, ptr %70, align 8 + %71 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %68, align 8 + call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %71) unreachable } @@ -352,8 +355,7 @@ _llgo_0: declare i1 @"github.com/goplus/llgo/internal/runtime.ChanSend"(ptr, ptr, i64) -; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write) -declare void @llvm.memset(ptr nocapture writeonly, i8, i64, i1 immarg) #0 +declare ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr, i64) declare void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String") @@ -381,5 +383,3 @@ declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64) declare void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface") declare i1 @"github.com/goplus/llgo/internal/runtime.ChanRecv"(ptr, ptr, i64) - -attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) } diff --git a/cl/blocks/block_test.go b/cl/blocks/block_test.go index 92b00399..f30b582c 100644 --- a/cl/blocks/block_test.go +++ b/cl/blocks/block_test.go @@ -104,7 +104,7 @@ func testBlockInfo(t *testing.T, src any, fname, expected, fn string) { pkg := types.NewPackage(name, name) imp := packages.NewImporter(fset) foo, _, err := ssautil.BuildPackage( - &types.Config{Importer: imp}, fset, pkg, files, ssa.SanityCheckFunctions|ssa.InstantiateGenerics) + &types.Config{Importer: imp}, fset, pkg, files, ssa.SanityCheckFunctions|ssa.InstantiateGenerics|ssa.GlobalDebug) if err != nil { t.Fatal("BuildPackage failed:", err) } diff --git a/cl/cltest/cltest.go b/cl/cltest/cltest.go index 9ce09eb1..e3286b1d 100644 --- a/cl/cltest/cltest.go +++ b/cl/cltest/cltest.go @@ -159,7 +159,7 @@ func TestCompileEx(t *testing.T, src any, fname, expected string) { pkg := types.NewPackage(name, name) imp := packages.NewImporter(fset) foo, _, err := ssautil.BuildPackage( - &types.Config{Importer: imp}, fset, pkg, files, ssa.SanityCheckFunctions|ssa.InstantiateGenerics) + &types.Config{Importer: imp}, fset, pkg, files, ssa.SanityCheckFunctions|ssa.InstantiateGenerics|ssa.GlobalDebug) if err != nil { t.Fatal("BuildPackage failed:", err) } diff --git a/cl/compile_test.go b/cl/compile_test.go index 4b38abac..fa77673c 100644 --- a/cl/compile_test.go +++ b/cl/compile_test.go @@ -124,695 +124,3 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0 } `) } - -func TestDebugInfo(t *testing.T) { - cl.EnableDebugSymbols() - defer cl.DisableDebugSymbols() - - testCompile(t, `package foo - -type IFoo interface { - Foo(a []int, b string) int -} - -type Foo struct{ - nexy *Foo - data map[string]uint64 -} - -func (Foo) Foo(a []int, b string) int { - return 1 -} - -func fn(a int, b float64) int { - return 1 -} - -func fn1(fn func(int, float64) int) { - fn(1, 1.0) -} - -func fn2() { - fn1(fn) - ch := make(chan int) - go func() { - ch <- 1 - }() - <-ch - - f := Foo{} - var foo IFoo = f - foo.Foo(nil, "") -} -`, `; ModuleID = 'foo' -source_filename = "foo" - -%foo.Foo = type { ptr, ptr } -%"github.com/goplus/llgo/internal/runtime.Slice" = type { ptr, i64, i64 } -%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 } -%"github.com/goplus/llgo/c/pthread.RoutineFunc" = type { ptr, ptr } -%"github.com/goplus/llgo/internal/runtime.iface" = type { ptr, ptr } -%"github.com/goplus/llgo/internal/abi.StructField" = type { %"github.com/goplus/llgo/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/internal/runtime.String", i1 } -%"github.com/goplus/llgo/internal/abi.Method" = type { %"github.com/goplus/llgo/internal/runtime.String", ptr, ptr, ptr } -%"github.com/goplus/llgo/internal/abi.Imethod" = type { %"github.com/goplus/llgo/internal/runtime.String", ptr } - -@"foo.init$guard" = global i1 false, align 1 -@_llgo_foo.Foo = linkonce global ptr null, align 8 -@"foo.struct$sUOINQ1FDCN7y-nzX20cgAVFoHXQ1pkjKP9R_Z6Irsk" = linkonce global ptr null, align 8 -@0 = private unnamed_addr constant [4 x i8] c"nexy", align 1 -@1 = private unnamed_addr constant [4 x i8] c"data", align 1 -@2 = private unnamed_addr constant [7 x i8] c"topbits", align 1 -@3 = private unnamed_addr constant [4 x i8] c"keys", align 1 -@4 = private unnamed_addr constant [5 x i8] c"elems", align 1 -@5 = private unnamed_addr constant [8 x i8] c"overflow", align 1 -@6 = private unnamed_addr constant [3 x i8] c"foo", align 1 -@7 = private unnamed_addr constant [3 x i8] c"Foo", align 1 -@"_llgo_func$w7i25ru9Alz5aegActeASLLTXdwBqJ6Wc6FdpkIn_cs" = linkonce global ptr null, align 8 -@"[]_llgo_int" = linkonce global ptr null, align 8 -@_llgo_string = linkonce global ptr null, align 8 -@_llgo_int = linkonce global ptr null, align 8 -@"_llgo_iface$opv3stH14p-JT6UN0WEYD-Tr6bHK3MHpC4KSk10pjNU" = linkonce global ptr null, align 8 - -define i64 @foo.Foo.Foo(%foo.Foo %0, %"github.com/goplus/llgo/internal/runtime.Slice" %1, %"github.com/goplus/llgo/internal/runtime.String" %2) !dbg !4 { -_llgo_0: - call void @llvm.dbg.declare(metadata %foo.Foo %0, metadata !16, metadata !DIExpression()), !dbg !17 - call void @llvm.dbg.declare(metadata %"github.com/goplus/llgo/internal/runtime.Slice" %1, metadata !18, metadata !DIExpression()), !dbg !19 - call void @llvm.dbg.declare(metadata %"github.com/goplus/llgo/internal/runtime.String" %2, metadata !20, metadata !DIExpression()), !dbg !21 - ret i64 1, !dbg !22 -} - -define i64 @"foo.(*Foo).Foo"(ptr %0, %"github.com/goplus/llgo/internal/runtime.Slice" %1, %"github.com/goplus/llgo/internal/runtime.String" %2) !dbg !23 { -_llgo_0: - call void @llvm.dbg.declare(metadata ptr %0, metadata !26, metadata !DIExpression()), !dbg !27 - call void @llvm.dbg.declare(metadata %"github.com/goplus/llgo/internal/runtime.Slice" %1, metadata !28, metadata !DIExpression()), !dbg !29 - call void @llvm.dbg.declare(metadata %"github.com/goplus/llgo/internal/runtime.String" %2, metadata !30, metadata !DIExpression()), !dbg !31 - %3 = load %foo.Foo, ptr %0, align 8, !dbg !32 - %4 = call i64 @foo.Foo.Foo(%foo.Foo %3, %"github.com/goplus/llgo/internal/runtime.Slice" %1, %"github.com/goplus/llgo/internal/runtime.String" %2), !dbg !32 - ret i64 %4, !dbg !32 -} - -define i64 @foo.fn(i64 %0, double %1) !dbg !33 { -_llgo_0: - call void @llvm.dbg.declare(metadata i64 %0, metadata !38, metadata !DIExpression()), !dbg !39 - call void @llvm.dbg.declare(metadata double %1, metadata !40, metadata !DIExpression()), !dbg !41 - ret i64 1, !dbg !42 -} - -define void @foo.fn1({ ptr, ptr } %0) !dbg !43 { -_llgo_0: - call void @llvm.dbg.declare(metadata { ptr, ptr } %0, metadata !55, metadata !DIExpression()), !dbg !56 - %1 = extractvalue { ptr, ptr } %0, 1, !dbg !57 - %2 = extractvalue { ptr, ptr } %0, 0, !dbg !57 - %3 = call i64 %2(ptr %1, i64 1, double 1.000000e+00), !dbg !57 - ret void, !dbg !57 -} - -define void @foo.fn2() !dbg !58 { -_llgo_0: - %0 = alloca { ptr, ptr }, align 8, !dbg !61 - %1 = getelementptr inbounds { ptr, ptr }, ptr %0, i32 0, i32 0, !dbg !61 - store ptr @__llgo_stub.foo.fn, ptr %1, align 8, !dbg !61 - %2 = getelementptr inbounds { ptr, ptr }, ptr %0, i32 0, i32 1, !dbg !61 - store ptr null, ptr %2, align 8, !dbg !61 - %3 = load { ptr, ptr }, ptr %0, align 8, !dbg !61 - call void @foo.fn1({ ptr, ptr } %3), !dbg !61 - %4 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 8), !dbg !62 - %5 = call ptr @"github.com/goplus/llgo/internal/runtime.NewChan"(i64 8, i64 0), !dbg !63 - store ptr %5, ptr %4, align 8, !dbg !63 - %6 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8), !dbg !64 - %7 = getelementptr inbounds { ptr }, ptr %6, i32 0, i32 0, !dbg !64 - store ptr %4, ptr %7, align 8, !dbg !64 - %8 = alloca { ptr, ptr }, align 8, !dbg !64 - %9 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 0, !dbg !64 - store ptr @"foo.fn2$1", ptr %9, align 8, !dbg !64 - %10 = getelementptr inbounds { ptr, ptr }, ptr %8, i32 0, i32 1, !dbg !64 - store ptr %6, ptr %10, align 8, !dbg !64 - %11 = load { ptr, ptr }, ptr %8, align 8, !dbg !64 - %12 = call ptr @malloc(i64 16), !dbg !64 - %13 = getelementptr inbounds { { ptr, ptr } }, ptr %12, i32 0, i32 0, !dbg !64 - store { ptr, ptr } %11, ptr %13, align 8, !dbg !64 - %14 = alloca i8, i64 8, align 1, !dbg !64 - %15 = alloca %"github.com/goplus/llgo/c/pthread.RoutineFunc", align 8, !dbg !64 - %16 = getelementptr inbounds %"github.com/goplus/llgo/c/pthread.RoutineFunc", ptr %15, i32 0, i32 0, !dbg !64 - store ptr @"__llgo_stub.foo._llgo_routine$1", ptr %16, align 8, !dbg !64 - %17 = getelementptr inbounds %"github.com/goplus/llgo/c/pthread.RoutineFunc", ptr %15, i32 0, i32 1, !dbg !64 - store ptr null, ptr %17, align 8, !dbg !64 - %18 = load %"github.com/goplus/llgo/c/pthread.RoutineFunc", ptr %15, align 8, !dbg !64 - %19 = call i32 @"github.com/goplus/llgo/internal/runtime.CreateThread"(ptr %14, ptr null, %"github.com/goplus/llgo/c/pthread.RoutineFunc" %18, ptr %12), !dbg !64 - %20 = load ptr, ptr %4, align 8, !dbg !65 - %21 = alloca i64, align 8, !dbg !66 - %22 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %21, i64 8), !dbg !66 - %23 = call i1 @"github.com/goplus/llgo/internal/runtime.ChanRecv"(ptr %20, ptr %22, i64 8), !dbg !66 - %24 = load i64, ptr %22, align 4, !dbg !66 - %25 = load ptr, ptr @_llgo_foo.Foo, align 8, !dbg !64 - %26 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16), !dbg !64 - store %foo.Foo zeroinitializer, ptr %26, align 8, !dbg !64 - %27 = load ptr, ptr @"_llgo_iface$opv3stH14p-JT6UN0WEYD-Tr6bHK3MHpC4KSk10pjNU", align 8, !dbg !64 - %28 = call ptr @"github.com/goplus/llgo/internal/runtime.NewItab"(ptr %27, ptr %25), !dbg !64 - %29 = alloca %"github.com/goplus/llgo/internal/runtime.iface", align 8, !dbg !64 - %30 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %29, i32 0, i32 0, !dbg !64 - store ptr %28, ptr %30, align 8, !dbg !64 - %31 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %29, i32 0, i32 1, !dbg !64 - store ptr %26, ptr %31, align 8, !dbg !64 - %32 = load %"github.com/goplus/llgo/internal/runtime.iface", ptr %29, align 8, !dbg !64 - %33 = call ptr @"github.com/goplus/llgo/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/internal/runtime.iface" %32), !dbg !67 - %34 = extractvalue %"github.com/goplus/llgo/internal/runtime.iface" %32, 0, !dbg !67 - %35 = getelementptr ptr, ptr %34, i64 3, !dbg !67 - %36 = load ptr, ptr %35, align 8, !dbg !67 - %37 = alloca { ptr, ptr }, align 8, !dbg !67 - %38 = getelementptr inbounds { ptr, ptr }, ptr %37, i32 0, i32 0, !dbg !67 - store ptr %36, ptr %38, align 8, !dbg !67 - %39 = getelementptr inbounds { ptr, ptr }, ptr %37, i32 0, i32 1, !dbg !67 - store ptr %33, ptr %39, align 8, !dbg !67 - %40 = load { ptr, ptr }, ptr %37, align 8, !dbg !67 - %41 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8, !dbg !67 - %42 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %41, i32 0, i32 0, !dbg !67 - store ptr null, ptr %42, align 8, !dbg !67 - %43 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %41, i32 0, i32 1, !dbg !67 - store i64 0, ptr %43, align 4, !dbg !67 - %44 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %41, align 8, !dbg !67 - %45 = extractvalue { ptr, ptr } %40, 1, !dbg !67 - %46 = extractvalue { ptr, ptr } %40, 0, !dbg !67 - %47 = call i64 %46(ptr %45, %"github.com/goplus/llgo/internal/runtime.Slice" zeroinitializer, %"github.com/goplus/llgo/internal/runtime.String" %44), !dbg !67 - ret void, !dbg !67 -} - -define void @"foo.fn2$1"(ptr %0) !dbg !68 { -_llgo_0: - %1 = load { ptr }, ptr %0, align 8, !dbg !77 - %2 = extractvalue { ptr } %1, 0, !dbg !77 - %3 = load ptr, ptr %2, align 8, !dbg !77 - %4 = alloca i64, align 8, !dbg !77 - %5 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %4, i64 8), !dbg !77 - store i64 1, ptr %5, align 4, !dbg !77 - %6 = call i1 @"github.com/goplus/llgo/internal/runtime.ChanSend"(ptr %3, ptr %5, i64 8), !dbg !77 - ret void, !dbg !77 -} - -define void @foo.init() !dbg !78 { -_llgo_0: - %0 = load i1, ptr @"foo.init$guard", align 1, !dbg !80 - br i1 %0, label %_llgo_2, label %_llgo_1, !dbg !80 - -_llgo_1: ; preds = %_llgo_0 - store i1 true, ptr @"foo.init$guard", align 1, !dbg !80 - call void @"foo.init$after"(), !dbg !80 - br label %_llgo_2, !dbg !80 - -_llgo_2: ; preds = %_llgo_1, %_llgo_0 - ret void, !dbg !80 -} - -; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) -declare void @llvm.dbg.declare(metadata, metadata, metadata) #0 - -define linkonce i64 @__llgo_stub.foo.fn(ptr %0, i64 %1, double %2) { -_llgo_0: - %3 = tail call i64 @foo.fn(i64 %1, double %2) - ret i64 %3 -} - -declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64) - -declare ptr @"github.com/goplus/llgo/internal/runtime.NewChan"(i64, i64) - -declare ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64) - -declare ptr @malloc(i64) - -define ptr @"foo._llgo_routine$1"(ptr %0) { -_llgo_0: - %1 = load { { ptr, ptr } }, ptr %0, align 8 - %2 = extractvalue { { ptr, ptr } } %1, 0 - %3 = extractvalue { ptr, ptr } %2, 1 - %4 = extractvalue { ptr, ptr } %2, 0 - call void %4(ptr %3) - call void @free(ptr %0) - ret ptr null -} - -declare void @free(ptr) - -declare i32 @"github.com/goplus/llgo/internal/runtime.CreateThread"(ptr, ptr, %"github.com/goplus/llgo/c/pthread.RoutineFunc", ptr) - -define linkonce ptr @"__llgo_stub.foo._llgo_routine$1"(ptr %0, ptr %1) { -_llgo_0: - %2 = tail call ptr @"foo._llgo_routine$1"(ptr %1) - ret ptr %2 -} - -declare ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr, i64) - -declare i1 @"github.com/goplus/llgo/internal/runtime.ChanRecv"(ptr, ptr, i64) - -define void @"foo.init$after"() { -_llgo_0: - %0 = call ptr @"github.com/goplus/llgo/internal/runtime.NewNamed"(i64 25, i64 16, i64 1, i64 1) - %1 = load ptr, ptr @_llgo_foo.Foo, align 8 - %2 = icmp eq ptr %1, null - br i1 %2, label %_llgo_1, label %_llgo_2 - -_llgo_1: ; preds = %_llgo_0 - store ptr %0, ptr @_llgo_foo.Foo, align 8 - br label %_llgo_2 - -_llgo_2: ; preds = %_llgo_1, %_llgo_0 - %3 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %4 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %3, i32 0, i32 0 - store ptr @0, ptr %4, align 8 - %5 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %3, i32 0, i32 1 - store i64 4, ptr %5, align 4 - %6 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %3, align 8 - %7 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %8 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %7, i32 0, i32 0 - store ptr null, ptr %8, align 8 - %9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %7, i32 0, i32 1 - store i64 0, ptr %9, align 4 - %10 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %7, align 8 - %11 = call ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr %0) - %12 = call %"github.com/goplus/llgo/internal/abi.StructField" @"github.com/goplus/llgo/internal/runtime.StructField"(%"github.com/goplus/llgo/internal/runtime.String" %6, ptr %11, i64 0, %"github.com/goplus/llgo/internal/runtime.String" %10, i1 false) - %13 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %14 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %13, i32 0, i32 0 - store ptr @1, ptr %14, align 8 - %15 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %13, i32 0, i32 1 - store i64 4, ptr %15, align 4 - %16 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %13, align 8 - %17 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %18 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %17, i32 0, i32 0 - store ptr null, ptr %18, align 8 - %19 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %17, i32 0, i32 1 - store i64 0, ptr %19, align 4 - %20 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %17, align 8 - %21 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) - %22 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 43) - %23 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %24 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %23, i32 0, i32 0 - store ptr @2, ptr %24, align 8 - %25 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %23, i32 0, i32 1 - store i64 7, ptr %25, align 4 - %26 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %23, align 8 - %27 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %28 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %27, i32 0, i32 0 - store ptr null, ptr %28, align 8 - %29 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %27, i32 0, i32 1 - store i64 0, ptr %29, align 4 - %30 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %27, align 8 - %31 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 40) - %32 = call ptr @"github.com/goplus/llgo/internal/runtime.ArrayOf"(i64 8, ptr %31) - %33 = call %"github.com/goplus/llgo/internal/abi.StructField" @"github.com/goplus/llgo/internal/runtime.StructField"(%"github.com/goplus/llgo/internal/runtime.String" %26, ptr %32, i64 0, %"github.com/goplus/llgo/internal/runtime.String" %30, i1 false) - %34 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %35 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %34, i32 0, i32 0 - store ptr @3, ptr %35, align 8 - %36 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %34, i32 0, i32 1 - store i64 4, ptr %36, align 4 - %37 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %34, align 8 - %38 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %39 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %38, i32 0, i32 0 - store ptr null, ptr %39, align 8 - %40 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %38, i32 0, i32 1 - store i64 0, ptr %40, align 4 - %41 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %38, align 8 - %42 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) - %43 = call ptr @"github.com/goplus/llgo/internal/runtime.ArrayOf"(i64 8, ptr %42) - %44 = call %"github.com/goplus/llgo/internal/abi.StructField" @"github.com/goplus/llgo/internal/runtime.StructField"(%"github.com/goplus/llgo/internal/runtime.String" %37, ptr %43, i64 8, %"github.com/goplus/llgo/internal/runtime.String" %41, i1 false) - %45 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %46 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %45, i32 0, i32 0 - store ptr @4, ptr %46, align 8 - %47 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %45, i32 0, i32 1 - store i64 5, ptr %47, align 4 - %48 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %45, align 8 - %49 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %50 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %49, i32 0, i32 0 - store ptr null, ptr %50, align 8 - %51 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %49, i32 0, i32 1 - store i64 0, ptr %51, align 4 - %52 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %49, align 8 - %53 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 43) - %54 = call ptr @"github.com/goplus/llgo/internal/runtime.ArrayOf"(i64 8, ptr %53) - %55 = call %"github.com/goplus/llgo/internal/abi.StructField" @"github.com/goplus/llgo/internal/runtime.StructField"(%"github.com/goplus/llgo/internal/runtime.String" %48, ptr %54, i64 136, %"github.com/goplus/llgo/internal/runtime.String" %52, i1 false) - %56 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %57 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %56, i32 0, i32 0 - store ptr @5, ptr %57, align 8 - %58 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %56, i32 0, i32 1 - store i64 8, ptr %58, align 4 - %59 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %56, align 8 - %60 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %61 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %60, i32 0, i32 0 - store ptr null, ptr %61, align 8 - %62 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %60, i32 0, i32 1 - store i64 0, ptr %62, align 4 - %63 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %60, align 8 - %64 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 58) - %65 = call %"github.com/goplus/llgo/internal/abi.StructField" @"github.com/goplus/llgo/internal/runtime.StructField"(%"github.com/goplus/llgo/internal/runtime.String" %59, ptr %64, i64 200, %"github.com/goplus/llgo/internal/runtime.String" %63, i1 false) - %66 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %67 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %66, i32 0, i32 0 - store ptr @6, ptr %67, align 8 - %68 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %66, i32 0, i32 1 - store i64 3, ptr %68, align 4 - %69 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %66, align 8 - %70 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 224) - %71 = getelementptr %"github.com/goplus/llgo/internal/abi.StructField", ptr %70, i64 0 - store %"github.com/goplus/llgo/internal/abi.StructField" %33, ptr %71, align 8 - %72 = getelementptr %"github.com/goplus/llgo/internal/abi.StructField", ptr %70, i64 1 - store %"github.com/goplus/llgo/internal/abi.StructField" %44, ptr %72, align 8 - %73 = getelementptr %"github.com/goplus/llgo/internal/abi.StructField", ptr %70, i64 2 - store %"github.com/goplus/llgo/internal/abi.StructField" %55, ptr %73, align 8 - %74 = getelementptr %"github.com/goplus/llgo/internal/abi.StructField", ptr %70, i64 3 - store %"github.com/goplus/llgo/internal/abi.StructField" %65, ptr %74, align 8 - %75 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 - %76 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %75, i32 0, i32 0 - store ptr %70, ptr %76, align 8 - %77 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %75, i32 0, i32 1 - store i64 4, ptr %77, align 4 - %78 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %75, i32 0, i32 2 - store i64 4, ptr %78, align 4 - %79 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %75, align 8 - %80 = call ptr @"github.com/goplus/llgo/internal/runtime.Struct"(%"github.com/goplus/llgo/internal/runtime.String" %69, i64 208, %"github.com/goplus/llgo/internal/runtime.Slice" %79) - %81 = call ptr @"github.com/goplus/llgo/internal/runtime.MapOf"(ptr %21, ptr %22, ptr %80, i64 12) - %82 = call %"github.com/goplus/llgo/internal/abi.StructField" @"github.com/goplus/llgo/internal/runtime.StructField"(%"github.com/goplus/llgo/internal/runtime.String" %16, ptr %81, i64 8, %"github.com/goplus/llgo/internal/runtime.String" %20, i1 false) - %83 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %84 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %83, i32 0, i32 0 - store ptr @6, ptr %84, align 8 - %85 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %83, i32 0, i32 1 - store i64 3, ptr %85, align 4 - %86 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %83, align 8 - %87 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 112) - %88 = getelementptr %"github.com/goplus/llgo/internal/abi.StructField", ptr %87, i64 0 - store %"github.com/goplus/llgo/internal/abi.StructField" %12, ptr %88, align 8 - %89 = getelementptr %"github.com/goplus/llgo/internal/abi.StructField", ptr %87, i64 1 - store %"github.com/goplus/llgo/internal/abi.StructField" %82, ptr %89, align 8 - %90 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 - %91 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %90, i32 0, i32 0 - store ptr %87, ptr %91, align 8 - %92 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %90, i32 0, i32 1 - store i64 2, ptr %92, align 4 - %93 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %90, i32 0, i32 2 - store i64 2, ptr %93, align 4 - %94 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %90, align 8 - %95 = call ptr @"github.com/goplus/llgo/internal/runtime.Struct"(%"github.com/goplus/llgo/internal/runtime.String" %86, i64 16, %"github.com/goplus/llgo/internal/runtime.Slice" %94) - store ptr %95, ptr @"foo.struct$sUOINQ1FDCN7y-nzX20cgAVFoHXQ1pkjKP9R_Z6Irsk", align 8 - %96 = load ptr, ptr @"foo.struct$sUOINQ1FDCN7y-nzX20cgAVFoHXQ1pkjKP9R_Z6Irsk", align 8 - br i1 %2, label %_llgo_3, label %_llgo_4 - -_llgo_3: ; preds = %_llgo_2 - %97 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %98 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %97, i32 0, i32 0 - store ptr @7, ptr %98, align 8 - %99 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %97, i32 0, i32 1 - store i64 3, ptr %99, align 4 - %100 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %97, align 8 - %101 = load ptr, ptr @"[]_llgo_int", align 8 - %102 = icmp eq ptr %101, null - br i1 %102, label %_llgo_5, label %_llgo_6 - -_llgo_4: ; preds = %_llgo_12, %_llgo_2 - %103 = load ptr, ptr @"_llgo_func$w7i25ru9Alz5aegActeASLLTXdwBqJ6Wc6FdpkIn_cs", align 8 - %104 = load ptr, ptr @"_llgo_iface$opv3stH14p-JT6UN0WEYD-Tr6bHK3MHpC4KSk10pjNU", align 8 - %105 = icmp eq ptr %104, null - br i1 %105, label %_llgo_13, label %_llgo_14 - -_llgo_5: ; preds = %_llgo_3 - %106 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 34) - %107 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceOf"(ptr %106) - store ptr %107, ptr @"[]_llgo_int", align 8 - br label %_llgo_6 - -_llgo_6: ; preds = %_llgo_5, %_llgo_3 - %108 = load ptr, ptr @"[]_llgo_int", align 8 - %109 = load ptr, ptr @_llgo_string, align 8 - %110 = icmp eq ptr %109, null - br i1 %110, label %_llgo_7, label %_llgo_8 - -_llgo_7: ; preds = %_llgo_6 - %111 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24) - store ptr %111, ptr @_llgo_string, align 8 - br label %_llgo_8 - -_llgo_8: ; preds = %_llgo_7, %_llgo_6 - %112 = load ptr, ptr @_llgo_string, align 8 - %113 = load ptr, ptr @_llgo_int, align 8 - %114 = icmp eq ptr %113, null - br i1 %114, label %_llgo_9, label %_llgo_10 - -_llgo_9: ; preds = %_llgo_8 - %115 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 34) - store ptr %115, ptr @_llgo_int, align 8 - br label %_llgo_10 - -_llgo_10: ; preds = %_llgo_9, %_llgo_8 - %116 = load ptr, ptr @_llgo_int, align 8 - %117 = load ptr, ptr @"_llgo_func$w7i25ru9Alz5aegActeASLLTXdwBqJ6Wc6FdpkIn_cs", align 8 - %118 = icmp eq ptr %117, null - br i1 %118, label %_llgo_11, label %_llgo_12 - -_llgo_11: ; preds = %_llgo_10 - %119 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16) - %120 = getelementptr ptr, ptr %119, i64 0 - store ptr %108, ptr %120, align 8 - %121 = getelementptr ptr, ptr %119, i64 1 - store ptr %112, ptr %121, align 8 - %122 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 - %123 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %122, i32 0, i32 0 - store ptr %119, ptr %123, align 8 - %124 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %122, i32 0, i32 1 - store i64 2, ptr %124, align 4 - %125 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %122, i32 0, i32 2 - store i64 2, ptr %125, align 4 - %126 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %122, align 8 - %127 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8) - %128 = getelementptr ptr, ptr %127, i64 0 - store ptr %116, ptr %128, align 8 - %129 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 - %130 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %129, i32 0, i32 0 - store ptr %127, ptr %130, align 8 - %131 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %129, i32 0, i32 1 - store i64 1, ptr %131, align 4 - %132 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %129, i32 0, i32 2 - store i64 1, ptr %132, align 4 - %133 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %129, align 8 - %134 = call ptr @"github.com/goplus/llgo/internal/runtime.Func"(%"github.com/goplus/llgo/internal/runtime.Slice" %126, %"github.com/goplus/llgo/internal/runtime.Slice" %133, i1 false) - call void @"github.com/goplus/llgo/internal/runtime.SetDirectIface"(ptr %134) - store ptr %134, ptr @"_llgo_func$w7i25ru9Alz5aegActeASLLTXdwBqJ6Wc6FdpkIn_cs", align 8 - br label %_llgo_12 - -_llgo_12: ; preds = %_llgo_11, %_llgo_10 - %135 = load ptr, ptr @"_llgo_func$w7i25ru9Alz5aegActeASLLTXdwBqJ6Wc6FdpkIn_cs", align 8 - %136 = alloca %"github.com/goplus/llgo/internal/abi.Method", align 8 - %137 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %136, i32 0, i32 0 - store %"github.com/goplus/llgo/internal/runtime.String" %100, ptr %137, align 8 - %138 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %136, i32 0, i32 1 - store ptr %135, ptr %138, align 8 - %139 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %136, i32 0, i32 2 - store ptr @"foo.(*Foo).Foo", ptr %139, align 8 - %140 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %136, i32 0, i32 3 - store ptr @"foo.(*Foo).Foo", ptr %140, align 8 - %141 = load %"github.com/goplus/llgo/internal/abi.Method", ptr %136, align 8 - %142 = alloca %"github.com/goplus/llgo/internal/abi.Method", align 8 - %143 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %142, i32 0, i32 0 - store %"github.com/goplus/llgo/internal/runtime.String" %100, ptr %143, align 8 - %144 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %142, i32 0, i32 1 - store ptr %135, ptr %144, align 8 - %145 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %142, i32 0, i32 2 - store ptr @"foo.(*Foo).Foo", ptr %145, align 8 - %146 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %142, i32 0, i32 3 - store ptr @foo.Foo.Foo, ptr %146, align 8 - %147 = load %"github.com/goplus/llgo/internal/abi.Method", ptr %142, align 8 - %148 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 40) - %149 = getelementptr %"github.com/goplus/llgo/internal/abi.Method", ptr %148, i64 0 - store %"github.com/goplus/llgo/internal/abi.Method" %147, ptr %149, align 8 - %150 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 - %151 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %150, i32 0, i32 0 - store ptr %148, ptr %151, align 8 - %152 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %150, i32 0, i32 1 - store i64 1, ptr %152, align 4 - %153 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %150, i32 0, i32 2 - store i64 1, ptr %153, align 4 - %154 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %150, align 8 - %155 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 40) - %156 = getelementptr %"github.com/goplus/llgo/internal/abi.Method", ptr %155, i64 0 - store %"github.com/goplus/llgo/internal/abi.Method" %141, ptr %156, align 8 - %157 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 - %158 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %157, i32 0, i32 0 - store ptr %155, ptr %158, align 8 - %159 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %157, i32 0, i32 1 - store i64 1, ptr %159, align 4 - %160 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %157, i32 0, i32 2 - store i64 1, ptr %160, align 4 - %161 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %157, align 8 - %162 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %163 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %162, i32 0, i32 0 - store ptr @6, ptr %163, align 8 - %164 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %162, i32 0, i32 1 - store i64 3, ptr %164, align 4 - %165 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %162, align 8 - %166 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %167 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %166, i32 0, i32 0 - store ptr @7, ptr %167, align 8 - %168 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %166, i32 0, i32 1 - store i64 3, ptr %168, align 4 - %169 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %166, align 8 - call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %0, %"github.com/goplus/llgo/internal/runtime.String" %165, %"github.com/goplus/llgo/internal/runtime.String" %169, ptr %96, %"github.com/goplus/llgo/internal/runtime.Slice" %154, %"github.com/goplus/llgo/internal/runtime.Slice" %161) - br label %_llgo_4 - -_llgo_13: ; preds = %_llgo_4 - %170 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %171 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %170, i32 0, i32 0 - store ptr @7, ptr %171, align 8 - %172 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %170, i32 0, i32 1 - store i64 3, ptr %172, align 4 - %173 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %170, align 8 - %174 = alloca %"github.com/goplus/llgo/internal/abi.Imethod", align 8 - %175 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %174, i32 0, i32 0 - store %"github.com/goplus/llgo/internal/runtime.String" %173, ptr %175, align 8 - %176 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %174, i32 0, i32 1 - store ptr %103, ptr %176, align 8 - %177 = load %"github.com/goplus/llgo/internal/abi.Imethod", ptr %174, align 8 - %178 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 24) - %179 = getelementptr %"github.com/goplus/llgo/internal/abi.Imethod", ptr %178, i64 0 - store %"github.com/goplus/llgo/internal/abi.Imethod" %177, ptr %179, align 8 - %180 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8 - %181 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %180, i32 0, i32 0 - store ptr %178, ptr %181, align 8 - %182 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %180, i32 0, i32 1 - store i64 1, ptr %182, align 4 - %183 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %180, i32 0, i32 2 - store i64 1, ptr %183, align 4 - %184 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %180, align 8 - %185 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %186 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %185, i32 0, i32 0 - store ptr @6, ptr %186, align 8 - %187 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %185, i32 0, i32 1 - store i64 3, ptr %187, align 4 - %188 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %185, align 8 - %189 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8 - %190 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %189, i32 0, i32 0 - store ptr null, ptr %190, align 8 - %191 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %189, i32 0, i32 1 - store i64 0, ptr %191, align 4 - %192 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %189, align 8 - %193 = call ptr @"github.com/goplus/llgo/internal/runtime.Interface"(%"github.com/goplus/llgo/internal/runtime.String" %188, %"github.com/goplus/llgo/internal/runtime.String" %192, %"github.com/goplus/llgo/internal/runtime.Slice" %184) - store ptr %193, ptr @"_llgo_iface$opv3stH14p-JT6UN0WEYD-Tr6bHK3MHpC4KSk10pjNU", align 8 - br label %_llgo_14 - -_llgo_14: ; preds = %_llgo_13, %_llgo_4 - ret void -} - -declare ptr @"github.com/goplus/llgo/internal/runtime.NewNamed"(i64, i64, i64, i64) - -declare ptr @"github.com/goplus/llgo/internal/runtime.Struct"(%"github.com/goplus/llgo/internal/runtime.String", i64, %"github.com/goplus/llgo/internal/runtime.Slice") - -declare %"github.com/goplus/llgo/internal/abi.StructField" @"github.com/goplus/llgo/internal/runtime.StructField"(%"github.com/goplus/llgo/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/internal/runtime.String", i1) - -declare ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr) - -declare ptr @"github.com/goplus/llgo/internal/runtime.MapOf"(ptr, ptr, ptr, i64) - -declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64) - -declare ptr @"github.com/goplus/llgo/internal/runtime.ArrayOf"(i64, ptr) - -declare void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr, %"github.com/goplus/llgo/internal/runtime.String", %"github.com/goplus/llgo/internal/runtime.String", ptr, %"github.com/goplus/llgo/internal/runtime.Slice", %"github.com/goplus/llgo/internal/runtime.Slice") - -declare ptr @"github.com/goplus/llgo/internal/runtime.SliceOf"(ptr) - -declare ptr @"github.com/goplus/llgo/internal/runtime.Func"(%"github.com/goplus/llgo/internal/runtime.Slice", %"github.com/goplus/llgo/internal/runtime.Slice", i1) - -declare void @"github.com/goplus/llgo/internal/runtime.SetDirectIface"(ptr) - -declare ptr @"github.com/goplus/llgo/internal/runtime.Interface"(%"github.com/goplus/llgo/internal/runtime.String", %"github.com/goplus/llgo/internal/runtime.String", %"github.com/goplus/llgo/internal/runtime.Slice") - -declare ptr @"github.com/goplus/llgo/internal/runtime.NewItab"(ptr, ptr) - -declare ptr @"github.com/goplus/llgo/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/internal/runtime.iface") - -declare i1 @"github.com/goplus/llgo/internal/runtime.ChanSend"(ptr, ptr, i64) - -attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } - -!llvm.module.flags = !{!0, !1} -!llvm.dbg.cu = !{!2} - -!0 = !{i32 2, !"Debug Info Version", i32 3} -!1 = !{i32 7, !"Dwarf Version", i32 5} -!2 = distinct !DICompileUnit(language: DW_LANG_Go, file: !3, producer: "LLGo", isOptimized: true, runtimeVersion: 1, emissionKind: FullDebug) -!3 = !DIFile(filename: "foo", directory: "foo") -!4 = distinct !DISubprogram(name: "foo.Foo.Foo", linkageName: "foo.Foo.Foo", scope: null, file: !5, line: 12, type: !6, spFlags: DISPFlagDefinition, unit: !2) -!5 = !DIFile(filename: "foo.go", directory: "") -!6 = !DISubroutineType(types: !7) -!7 = !{!8, !14, !15} -!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "struct{nexy *foo.Foo; data map[string]uint64}", scope: !5, file: !5, line: 12, size: 128, align: 64, elements: !9) -!9 = !{!10, !12} -!10 = !DIDerivedType(tag: DW_TAG_member, name: "nexy", scope: !5, file: !5, line: 12, baseType: !11, size: 64, align: 8) -!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 128, align: 64, dwarfAddressSpace: 0) -!12 = !DIDerivedType(tag: DW_TAG_member, name: "data", scope: !5, file: !5, line: 12, baseType: !13, size: 64, align: 8, offset: 64) -!13 = !DIBasicType(name: "map[string]uint64", size: 64, encoding: DW_ATE_unsigned) -!14 = !DIBasicType(name: "[]int", size: 192, encoding: DW_ATE_unsigned) -!15 = !DIBasicType(name: "string", size: 128, encoding: DW_ATE_unsigned_char) -!16 = !DILocalVariable(name: "arg0", arg: 1, scope: !4, file: !5, line: 12, type: !8) -!17 = !DILocation(line: 12, column: 7, scope: !4) -!18 = !DILocalVariable(name: "a", arg: 2, scope: !4, file: !5, line: 12, type: !14) -!19 = !DILocation(line: 12, column: 16, scope: !4) -!20 = !DILocalVariable(name: "b", arg: 3, scope: !4, file: !5, line: 12, type: !15) -!21 = !DILocation(line: 12, column: 25, scope: !4) -!22 = !DILocation(line: 12, column: 12, scope: !4) -!23 = distinct !DISubprogram(name: "foo.(*Foo).Foo", linkageName: "foo.(*Foo).Foo", scope: null, file: !5, line: 12, type: !24, spFlags: DISPFlagDefinition, unit: !2) -!24 = !DISubroutineType(types: !25) -!25 = !{!11, !14, !15} -!26 = !DILocalVariable(name: "arg0", arg: 1, scope: !23, file: !5, line: 12, type: !11) -!27 = !DILocation(line: 12, column: 7, scope: !23) -!28 = !DILocalVariable(name: "a", arg: 2, scope: !23, file: !5, line: 12, type: !14) -!29 = !DILocation(line: 12, column: 16, scope: !23) -!30 = !DILocalVariable(name: "b", arg: 3, scope: !23, file: !5, line: 12, type: !15) -!31 = !DILocation(line: 12, column: 25, scope: !23) -!32 = !DILocation(line: 0, scope: !23) -!33 = distinct !DISubprogram(name: "foo.fn", linkageName: "foo.fn", scope: null, file: !5, line: 16, type: !34, spFlags: DISPFlagDefinition, unit: !2) -!34 = !DISubroutineType(types: !35) -!35 = !{!36, !37} -!36 = !DIBasicType(name: "int", size: 64, encoding: DW_ATE_signed) -!37 = !DIBasicType(name: "float64", size: 64, encoding: DW_ATE_float) -!38 = !DILocalVariable(name: "a", arg: 1, scope: !33, file: !5, line: 16, type: !36) -!39 = !DILocation(line: 16, column: 9, scope: !33) -!40 = !DILocalVariable(name: "b", arg: 2, scope: !33, file: !5, line: 16, type: !37) -!41 = !DILocation(line: 16, column: 16, scope: !33) -!42 = !DILocation(line: 16, column: 6, scope: !33) -!43 = distinct !DISubprogram(name: "foo.fn1", linkageName: "foo.fn1", scope: null, file: !5, line: 20, type: !44, spFlags: DISPFlagDefinition, unit: !2) -!44 = !DISubroutineType(types: !45) -!45 = !{!46} -!46 = !DICompositeType(tag: DW_TAG_structure_type, name: "struct{f func(__llgo_ctx unsafe.Pointer, int, float64) int; data unsafe.Pointer}", scope: !5, file: !5, line: 20, size: 128, align: 64, elements: !47) -!47 = !{!48, !54} -!48 = !DIDerivedType(tag: DW_TAG_member, name: "f", scope: !5, file: !5, line: 20, baseType: !49, size: 64, align: 8) -!49 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !50, size: 64, align: 8, dwarfAddressSpace: 0) -!50 = !DISubroutineType(types: !51) -!51 = !{!52, !53, !36, !37} -!52 = !DIBasicType(name: "(int)", size: 64, encoding: DW_ATE_unsigned) -!53 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "unsafe.Pointer", baseType: null, size: 64, align: 64, dwarfAddressSpace: 0) -!54 = !DIDerivedType(tag: DW_TAG_member, name: "data", scope: !5, file: !5, line: 20, baseType: !53, size: 64, align: 8, offset: 64) -!55 = !DILocalVariable(name: "fn", arg: 1, scope: !43, file: !5, line: 20, type: !46) -!56 = !DILocation(line: 20, column: 10, scope: !43) -!57 = !DILocation(line: 21, column: 4, scope: !43) -!58 = distinct !DISubprogram(name: "foo.fn2", linkageName: "foo.fn2", scope: null, file: !5, line: 24, type: !59, spFlags: DISPFlagDefinition, unit: !2) -!59 = !DISubroutineType(types: !60) -!60 = !{} -!61 = !DILocation(line: 25, column: 5, scope: !58) -!62 = !DILocation(line: 26, column: 2, scope: !58) -!63 = !DILocation(line: 26, column: 12, scope: !58) -!64 = !DILocation(line: 0, scope: !58) -!65 = !DILocation(line: 30, column: 4, scope: !58) -!66 = !DILocation(line: 30, column: 2, scope: !58) -!67 = !DILocation(line: 34, column: 10, scope: !58) -!68 = distinct !DISubprogram(name: "foo.fn2$1", linkageName: "foo.fn2$1", scope: null, file: !5, line: 27, type: !69, spFlags: DISPFlagDefinition, unit: !2) -!69 = !DISubroutineType(types: !70) -!70 = !{!71} -!71 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !72, size: 64, align: 64, dwarfAddressSpace: 0) -!72 = !DICompositeType(tag: DW_TAG_structure_type, name: "struct{ch *chan int}", scope: !5, file: !5, line: 27, size: 64, align: 64, elements: !73) -!73 = !{!74} -!74 = !DIDerivedType(tag: DW_TAG_member, name: "ch", scope: !5, file: !5, line: 27, baseType: !75, size: 64, align: 8) -!75 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !76, size: 64, align: 64, dwarfAddressSpace: 0) -!76 = !DIBasicType(name: "chan int", size: 64, encoding: DW_ATE_unsigned) -!77 = !DILocation(line: 28, column: 3, scope: !68) -!78 = distinct !DISubprogram(name: "foo.init", linkageName: "foo.init", scope: null, file: !79, type: !59, spFlags: DISPFlagDefinition, unit: !2) -!79 = !DIFile(filename: "", directory: "") -!80 = !DILocation(line: 0, scope: !78) -`) -}