merge upstream
This commit is contained in:
@@ -187,7 +187,7 @@ Here are some examples related to Go syntax:
|
||||
|
||||
### Garbage Collection (GC)
|
||||
|
||||
By default, LLGo implements `gc` based on [bdwgc](https://www.hboehm.info/gc/).
|
||||
By default, LLGo implements `gc` based on [bdwgc](https://www.hboehm.info/gc/) (also known as [libgc](https://www.hboehm.info/gc/)).
|
||||
|
||||
However, you can disable gc by specifying the `nogc` tag. For example:
|
||||
|
||||
@@ -214,7 +214,7 @@ Follow these steps to generate the `llgo` command (its usage is the same as the
|
||||
|
||||
```sh
|
||||
brew update # execute if needed
|
||||
brew install bdw-gc
|
||||
brew install libgc
|
||||
brew install llvm@17
|
||||
go install -v ./...
|
||||
```
|
||||
|
||||
85
cl/_testgo/ifaceconv/in.go
Normal file
85
cl/_testgo/ifaceconv/in.go
Normal file
@@ -0,0 +1,85 @@
|
||||
package main
|
||||
|
||||
// Tests of interface conversions and type assertions.
|
||||
|
||||
type I0 interface {
|
||||
}
|
||||
type I1 interface {
|
||||
f()
|
||||
}
|
||||
type I2 interface {
|
||||
f()
|
||||
g()
|
||||
}
|
||||
|
||||
type C0 struct{}
|
||||
type C1 struct{}
|
||||
|
||||
func (C1) f() {}
|
||||
|
||||
type C2 struct{}
|
||||
|
||||
func (C2) f() {}
|
||||
func (C2) g() {}
|
||||
|
||||
func main() {
|
||||
var i0 I0
|
||||
var i1 I1
|
||||
var i2 I2
|
||||
|
||||
// Nil always causes a type assertion to fail, even to the
|
||||
// same type.
|
||||
if _, ok := i0.(I0); ok {
|
||||
panic("nil i0.(I0) succeeded")
|
||||
}
|
||||
if _, ok := i1.(I1); ok {
|
||||
panic("nil i1.(I1) succeeded")
|
||||
}
|
||||
if _, ok := i2.(I2); ok {
|
||||
panic("nil i2.(I2) succeeded")
|
||||
}
|
||||
|
||||
// Conversions can't fail, even with nil.
|
||||
_ = I0(i0)
|
||||
|
||||
_ = I0(i1)
|
||||
_ = I1(i1)
|
||||
|
||||
_ = I0(i2)
|
||||
_ = I1(i2)
|
||||
_ = I2(i2)
|
||||
|
||||
// Non-nil type assertions pass or fail based on the concrete type.
|
||||
i1 = C1{}
|
||||
if _, ok := i1.(I0); !ok {
|
||||
panic("C1 i1.(I0) failed")
|
||||
}
|
||||
if _, ok := i1.(I1); !ok {
|
||||
panic("C1 i1.(I1) failed")
|
||||
}
|
||||
if _, ok := i1.(I2); ok {
|
||||
panic("C1 i1.(I2) succeeded")
|
||||
}
|
||||
|
||||
i1 = C2{}
|
||||
if _, ok := i1.(I0); !ok {
|
||||
panic("C2 i1.(I0) failed")
|
||||
}
|
||||
if _, ok := i1.(I1); !ok {
|
||||
panic("C2 i1.(I1) failed")
|
||||
}
|
||||
if _, ok := i1.(I2); !ok {
|
||||
panic("C2 i1.(I2) failed")
|
||||
}
|
||||
|
||||
// Conversions can't fail.
|
||||
i1 = C1{}
|
||||
if I0(i1) == nil {
|
||||
panic("C1 I0(i1) was nil")
|
||||
}
|
||||
if I1(i1) == nil {
|
||||
panic("C1 I1(i1) was nil")
|
||||
}
|
||||
|
||||
println("pass")
|
||||
}
|
||||
1305
cl/_testgo/ifaceconv/out.ll
Normal file
1305
cl/_testgo/ifaceconv/out.ll
Normal file
File diff suppressed because it is too large
Load Diff
60
cl/_testgo/ifaceprom/in.go
Normal file
60
cl/_testgo/ifaceprom/in.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package main
|
||||
|
||||
// Test of promotion of methods of an interface embedded within a
|
||||
// struct. In particular, this test exercises that the correct
|
||||
// method is called.
|
||||
|
||||
type I interface {
|
||||
one() int
|
||||
two() string
|
||||
}
|
||||
|
||||
type S struct {
|
||||
I
|
||||
}
|
||||
|
||||
type impl struct{}
|
||||
|
||||
func (impl) one() int {
|
||||
return 1
|
||||
}
|
||||
|
||||
func (impl) two() string {
|
||||
return "two"
|
||||
}
|
||||
|
||||
func main() {
|
||||
var s S
|
||||
s.I = impl{}
|
||||
if one := s.I.one(); one != 1 {
|
||||
panic(one)
|
||||
}
|
||||
if one := s.one(); one != 1 {
|
||||
panic(one)
|
||||
}
|
||||
closOne := s.I.one
|
||||
if one := closOne(); one != 1 {
|
||||
panic(one)
|
||||
}
|
||||
closOne = s.one
|
||||
if one := closOne(); one != 1 {
|
||||
panic(one)
|
||||
}
|
||||
|
||||
if two := s.I.two(); two != "two" {
|
||||
panic(two)
|
||||
}
|
||||
if two := s.two(); two != "two" {
|
||||
panic(two)
|
||||
}
|
||||
closTwo := s.I.two
|
||||
if two := closTwo(); two != "two" {
|
||||
panic(two)
|
||||
}
|
||||
closTwo = s.two
|
||||
if two := closTwo(); two != "two" {
|
||||
panic(two)
|
||||
}
|
||||
|
||||
println("pass")
|
||||
}
|
||||
1050
cl/_testgo/ifaceprom/out.ll
Normal file
1050
cl/_testgo/ifaceprom/out.ll
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,38 +7,51 @@ source_filename = "main"
|
||||
%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"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 }
|
||||
%"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.Imethod" = type { %"github.com/goplus/llgo/internal/runtime.String", ptr }
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@"*_llgo_main.Game1" = linkonce global ptr null
|
||||
@_llgo_main.Game1 = linkonce global ptr null
|
||||
@_llgo_int = linkonce global ptr null
|
||||
@"_llgo_struct$cJmCzeVn0orHWafCrTGAnbbAF46F2A4Fms4bJBm8ITI" = linkonce global ptr null
|
||||
@"*_llgo_github.com/goplus/llgo/cl/internal/foo.Game" = linkonce global ptr null
|
||||
@"_llgo_github.com/goplus/llgo/cl/internal/foo.Game" = linkonce global ptr null
|
||||
@"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw" = linkonce global ptr null
|
||||
@0 = private unnamed_addr constant [5 x i8] c"main\00", align 1
|
||||
@1 = private unnamed_addr constant [11 x i8] c"main.Game1\00", align 1
|
||||
@1 = private unnamed_addr constant [5 x i8] c"Load\00", align 1
|
||||
@"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac" = linkonce global ptr null
|
||||
@2 = private unnamed_addr constant [9 x i8] c"initGame\00", align 1
|
||||
@3 = private unnamed_addr constant [48 x i8] c"github.com/goplus/llgo/cl/internal/foo.initGame\00", align 1
|
||||
@4 = private unnamed_addr constant [39 x i8] c"github.com/goplus/llgo/cl/internal/foo\00", align 1
|
||||
@5 = private unnamed_addr constant [44 x i8] c"github.com/goplus/llgo/cl/internal/foo.Game\00", align 1
|
||||
@6 = private unnamed_addr constant [5 x i8] c"Game\00", align 1
|
||||
@7 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@8 = private unnamed_addr constant [5 x i8] c"main\00", align 1
|
||||
@9 = private unnamed_addr constant [5 x i8] c"Load\00", align 1
|
||||
@10 = private unnamed_addr constant [9 x i8] c"initGame\00", align 1
|
||||
@11 = private unnamed_addr constant [48 x i8] c"github.com/goplus/llgo/cl/internal/foo.initGame\00", align 1
|
||||
@12 = private unnamed_addr constant [5 x i8] c"main\00", align 1
|
||||
@13 = private unnamed_addr constant [11 x i8] c"main.Game1\00", align 1
|
||||
@"*_llgo_main.Game2" = linkonce global ptr null
|
||||
@_llgo_main.Game2 = linkonce global ptr null
|
||||
@"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw" = linkonce global ptr null
|
||||
@2 = private unnamed_addr constant [5 x i8] c"main\00", align 1
|
||||
@3 = private unnamed_addr constant [9 x i8] c"initGame\00", align 1
|
||||
@4 = private unnamed_addr constant [14 x i8] c"main.initGame\00", align 1
|
||||
@"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac" = linkonce global ptr null
|
||||
@5 = private unnamed_addr constant [5 x i8] c"main\00", align 1
|
||||
@6 = private unnamed_addr constant [11 x i8] c"main.Game2\00", align 1
|
||||
@14 = private unnamed_addr constant [9 x i8] c"initGame\00", align 1
|
||||
@15 = private unnamed_addr constant [14 x i8] c"main.initGame\00", align 1
|
||||
@16 = private unnamed_addr constant [5 x i8] c"main\00", align 1
|
||||
@17 = private unnamed_addr constant [11 x i8] c"main.Game2\00", align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/internal/foo.Gamer" = linkonce global ptr null
|
||||
@7 = private unnamed_addr constant [5 x i8] c"Load\00", align 1
|
||||
@8 = private unnamed_addr constant [48 x i8] c"github.com/goplus/llgo/cl/internal/foo.initGame\00", align 1
|
||||
@9 = private unnamed_addr constant [39 x i8] c"github.com/goplus/llgo/cl/internal/foo\00", align 1
|
||||
@10 = private unnamed_addr constant [45 x i8] c"github.com/goplus/llgo/cl/internal/foo.Gamer\00", align 1
|
||||
@18 = private unnamed_addr constant [5 x i8] c"Load\00", align 1
|
||||
@19 = private unnamed_addr constant [48 x i8] c"github.com/goplus/llgo/cl/internal/foo.initGame\00", align 1
|
||||
@20 = private unnamed_addr constant [39 x i8] c"github.com/goplus/llgo/cl/internal/foo\00", align 1
|
||||
@21 = private unnamed_addr constant [45 x i8] c"github.com/goplus/llgo/cl/internal/foo.Gamer\00", align 1
|
||||
@"main.iface$sO8a1LvuUsjXwiwaC6sR9-L4DiYgiOnZi7iosyShJXg" = global ptr null
|
||||
@11 = private unnamed_addr constant [5 x i8] c"Load\00", align 1
|
||||
@12 = private unnamed_addr constant [48 x i8] c"github.com/goplus/llgo/cl/internal/foo.initGame\00", align 1
|
||||
@13 = private unnamed_addr constant [5 x i8] c"main\00", align 1
|
||||
@14 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@15 = private unnamed_addr constant [3 x i8] c"OK\00", align 1
|
||||
@16 = private unnamed_addr constant [5 x i8] c"FAIL\00", align 1
|
||||
@22 = private unnamed_addr constant [5 x i8] c"Load\00", align 1
|
||||
@23 = private unnamed_addr constant [48 x i8] c"github.com/goplus/llgo/cl/internal/foo.initGame\00", align 1
|
||||
@24 = private unnamed_addr constant [5 x i8] c"main\00", align 1
|
||||
@25 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@26 = private unnamed_addr constant [3 x i8] c"OK\00", align 1
|
||||
@27 = private unnamed_addr constant [5 x i8] c"FAIL\00", align 1
|
||||
|
||||
define void @main.Game1.Load(%main.Game1 %0) {
|
||||
_llgo_0:
|
||||
@@ -183,7 +196,7 @@ _llgo_5: ; preds = %_llgo_4, %_llgo_3
|
||||
%49 = extractvalue { %"github.com/goplus/llgo/internal/runtime.iface", i1 } %47, 1
|
||||
%50 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%51 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %50, i32 0, i32 0
|
||||
store ptr @15, ptr %51, align 8
|
||||
store ptr @26, ptr %51, align 8
|
||||
%52 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %50, i32 0, i32 1
|
||||
store i64 2, ptr %52, align 4
|
||||
%53 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %50, align 8
|
||||
@@ -228,7 +241,7 @@ _llgo_8: ; preds = %_llgo_7, %_llgo_6
|
||||
%71 = extractvalue { %"github.com/goplus/llgo/internal/runtime.iface", i1 } %69, 1
|
||||
%72 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%73 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %72, i32 0, i32 0
|
||||
store ptr @16, ptr %73, align 8
|
||||
store ptr @27, ptr %73, align 8
|
||||
%74 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %72, i32 0, i32 1
|
||||
store i64 4, ptr %74, align 4
|
||||
%75 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %72, align 8
|
||||
@@ -260,313 +273,489 @@ _llgo_0:
|
||||
br i1 %1, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.NewNamed"(i64 2, i64 0, i64 0)
|
||||
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.NewNamed"(i64 25, i64 2, i64 2)
|
||||
store ptr %2, ptr @_llgo_main.Game1, align 8
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
%3 = load ptr, ptr @_llgo_int, align 8
|
||||
%3 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/internal/foo.Game", align 8
|
||||
%4 = icmp eq ptr %3, null
|
||||
br i1 %4, label %_llgo_3, label %_llgo_4
|
||||
|
||||
_llgo_3: ; preds = %_llgo_2
|
||||
%5 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
|
||||
store ptr %5, ptr @_llgo_int, align 8
|
||||
%5 = call ptr @"github.com/goplus/llgo/internal/runtime.NewNamed"(i64 25, i64 0, i64 2)
|
||||
store ptr %5, ptr @"_llgo_github.com/goplus/llgo/cl/internal/foo.Game", align 8
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_4: ; preds = %_llgo_3, %_llgo_2
|
||||
%6 = load ptr, ptr @_llgo_int, align 8
|
||||
br i1 %1, label %_llgo_5, label %_llgo_6
|
||||
%6 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
%7 = icmp eq ptr %6, null
|
||||
br i1 %7, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4
|
||||
%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 @0, 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
|
||||
%11 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %11, i32 0, i32 0
|
||||
store ptr @1, ptr %12, align 8
|
||||
%13 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %11, i32 0, i32 1
|
||||
store i64 10, ptr %13, align 4
|
||||
%14 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %11, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %2, %"github.com/goplus/llgo/internal/runtime.String" %10, %"github.com/goplus/llgo/internal/runtime.String" %14, ptr %6, { ptr, i64, i64 } zeroinitializer, { ptr, i64, i64 } zeroinitializer)
|
||||
%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 @0, 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
|
||||
%12 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 0)
|
||||
%13 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%14 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %13, i32 0, i32 0
|
||||
store ptr %12, ptr %14, align 8
|
||||
%15 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %13, i32 0, i32 1
|
||||
store i64 0, ptr %15, align 4
|
||||
%16 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %13, i32 0, i32 2
|
||||
store i64 0, ptr %16, align 4
|
||||
%17 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %13, align 8
|
||||
%18 = call ptr @"github.com/goplus/llgo/internal/runtime.Struct"(%"github.com/goplus/llgo/internal/runtime.String" %11, i64 0, %"github.com/goplus/llgo/internal/runtime.Slice" %17)
|
||||
store ptr %18, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
br label %_llgo_6
|
||||
|
||||
_llgo_6: ; preds = %_llgo_5, %_llgo_4
|
||||
%15 = load ptr, ptr @_llgo_main.Game1, align 8
|
||||
%16 = load ptr, ptr @"*_llgo_main.Game1", align 8
|
||||
%17 = icmp eq ptr %16, null
|
||||
br i1 %17, label %_llgo_7, label %_llgo_8
|
||||
%19 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
br i1 %4, label %_llgo_7, label %_llgo_8
|
||||
|
||||
_llgo_7: ; preds = %_llgo_6
|
||||
%18 = call ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr %15)
|
||||
store ptr %18, ptr @"*_llgo_main.Game1", align 8
|
||||
br label %_llgo_8
|
||||
%20 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%21 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %20, i32 0, i32 0
|
||||
store ptr @1, ptr %21, align 8
|
||||
%22 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %20, i32 0, i32 1
|
||||
store i64 4, ptr %22, align 4
|
||||
%23 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %20, align 8
|
||||
%24 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%25 = icmp eq ptr %24, null
|
||||
br i1 %25, label %_llgo_9, label %_llgo_10
|
||||
|
||||
_llgo_8: ; preds = %_llgo_7, %_llgo_6
|
||||
%19 = load ptr, ptr @_llgo_main.Game2, align 8
|
||||
%20 = icmp eq ptr %19, null
|
||||
br i1 %20, label %_llgo_9, label %_llgo_10
|
||||
_llgo_8: ; preds = %_llgo_10, %_llgo_6
|
||||
%26 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/internal/foo.Game", align 8
|
||||
%27 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/internal/foo.Game", align 8
|
||||
%28 = icmp eq ptr %27, null
|
||||
br i1 %28, label %_llgo_11, label %_llgo_12
|
||||
|
||||
_llgo_9: ; preds = %_llgo_8
|
||||
%21 = call ptr @"github.com/goplus/llgo/internal/runtime.NewNamed"(i64 25, i64 0, i64 1)
|
||||
store ptr %21, ptr @_llgo_main.Game2, align 8
|
||||
_llgo_9: ; preds = %_llgo_7
|
||||
%29 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 0)
|
||||
%30 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%31 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %30, i32 0, i32 0
|
||||
store ptr %29, ptr %31, align 8
|
||||
%32 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %30, i32 0, i32 1
|
||||
store i64 0, ptr %32, align 4
|
||||
%33 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %30, i32 0, i32 2
|
||||
store i64 0, ptr %33, align 4
|
||||
%34 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %30, align 8
|
||||
%35 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 0)
|
||||
%36 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%37 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %36, i32 0, i32 0
|
||||
store ptr %35, ptr %37, align 8
|
||||
%38 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %36, i32 0, i32 1
|
||||
store i64 0, ptr %38, align 4
|
||||
%39 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %36, i32 0, i32 2
|
||||
store i64 0, ptr %39, align 4
|
||||
%40 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %36, align 8
|
||||
%41 = call ptr @"github.com/goplus/llgo/internal/runtime.Func"(%"github.com/goplus/llgo/internal/runtime.Slice" %34, %"github.com/goplus/llgo/internal/runtime.Slice" %40, i1 false)
|
||||
store ptr %41, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
br label %_llgo_10
|
||||
|
||||
_llgo_10: ; preds = %_llgo_9, %_llgo_8
|
||||
%22 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
%23 = icmp eq ptr %22, null
|
||||
br i1 %23, label %_llgo_11, label %_llgo_12
|
||||
|
||||
_llgo_11: ; preds = %_llgo_10
|
||||
%24 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%25 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %24, i32 0, i32 0
|
||||
store ptr @2, ptr %25, align 8
|
||||
%26 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %24, i32 0, i32 1
|
||||
store i64 4, ptr %26, align 4
|
||||
%27 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %24, align 8
|
||||
%28 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 0)
|
||||
%29 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%30 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %29, i32 0, i32 0
|
||||
store ptr %28, ptr %30, align 8
|
||||
%31 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %29, i32 0, i32 1
|
||||
store i64 0, ptr %31, align 4
|
||||
%32 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %29, i32 0, i32 2
|
||||
store i64 0, ptr %32, align 4
|
||||
%33 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %29, align 8
|
||||
%34 = call ptr @"github.com/goplus/llgo/internal/runtime.Struct"(%"github.com/goplus/llgo/internal/runtime.String" %27, i64 0, %"github.com/goplus/llgo/internal/runtime.Slice" %33)
|
||||
store ptr %34, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
br label %_llgo_12
|
||||
|
||||
_llgo_12: ; preds = %_llgo_11, %_llgo_10
|
||||
%35 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
br i1 %20, label %_llgo_13, label %_llgo_14
|
||||
|
||||
_llgo_13: ; preds = %_llgo_12
|
||||
%36 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%37 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %36, i32 0, i32 0
|
||||
store ptr @3, ptr %37, align 8
|
||||
%38 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %36, i32 0, i32 1
|
||||
store i64 8, ptr %38, align 4
|
||||
%39 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %36, align 8
|
||||
%40 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%41 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %40, i32 0, i32 0
|
||||
store ptr @4, ptr %41, align 8
|
||||
%42 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %40, i32 0, i32 1
|
||||
store i64 13, ptr %42, align 4
|
||||
%43 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %40, align 8
|
||||
%44 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%45 = icmp eq ptr %44, null
|
||||
br i1 %45, label %_llgo_15, label %_llgo_16
|
||||
|
||||
_llgo_14: ; preds = %_llgo_16, %_llgo_12
|
||||
%46 = load ptr, ptr @_llgo_main.Game2, align 8
|
||||
%47 = load ptr, ptr @"*_llgo_main.Game2", align 8
|
||||
%48 = icmp eq ptr %47, null
|
||||
br i1 %48, label %_llgo_17, label %_llgo_18
|
||||
|
||||
_llgo_15: ; preds = %_llgo_13
|
||||
%49 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 0)
|
||||
%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 %49, ptr %51, align 8
|
||||
%52 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %50, i32 0, i32 1
|
||||
store i64 0, ptr %52, align 4
|
||||
%53 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %50, i32 0, i32 2
|
||||
store i64 0, ptr %53, align 4
|
||||
%54 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %50, align 8
|
||||
%55 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 0)
|
||||
%56 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%57 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %56, i32 0, i32 0
|
||||
store ptr %55, ptr %57, align 8
|
||||
%58 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %56, i32 0, i32 1
|
||||
store i64 0, ptr %58, align 4
|
||||
%59 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %56, i32 0, i32 2
|
||||
store i64 0, ptr %59, align 4
|
||||
%60 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %56, align 8
|
||||
%61 = call ptr @"github.com/goplus/llgo/internal/runtime.Func"(%"github.com/goplus/llgo/internal/runtime.Slice" %54, %"github.com/goplus/llgo/internal/runtime.Slice" %60, i1 false)
|
||||
store ptr %61, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
br label %_llgo_16
|
||||
|
||||
_llgo_16: ; preds = %_llgo_15, %_llgo_13
|
||||
%62 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%63 = alloca %"github.com/goplus/llgo/internal/abi.Method", align 8
|
||||
%64 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %63, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %43, ptr %64, align 8
|
||||
%65 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %63, i32 0, i32 1
|
||||
store ptr %62, ptr %65, align 8
|
||||
%66 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %63, i32 0, i32 2
|
||||
store ptr @"main.(*Game2).initGame", ptr %66, align 8
|
||||
%67 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %63, i32 0, i32 3
|
||||
store ptr @"main.(*Game2).initGame", ptr %67, align 8
|
||||
%68 = load %"github.com/goplus/llgo/internal/abi.Method", ptr %63, align 8
|
||||
%69 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 40)
|
||||
%70 = getelementptr %"github.com/goplus/llgo/internal/abi.Method", ptr %69, i64 0
|
||||
store %"github.com/goplus/llgo/internal/abi.Method" %68, ptr %70, align 8
|
||||
%71 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%72 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %71, i32 0, i32 0
|
||||
store ptr %69, ptr %72, align 8
|
||||
%73 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %71, i32 0, i32 1
|
||||
store i64 1, ptr %73, align 4
|
||||
%74 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %71, i32 0, i32 2
|
||||
store i64 1, ptr %74, align 4
|
||||
%75 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %71, align 8
|
||||
_llgo_10: ; preds = %_llgo_9, %_llgo_7
|
||||
%42 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%43 = alloca %"github.com/goplus/llgo/internal/abi.Method", align 8
|
||||
%44 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %43, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %23, ptr %44, align 8
|
||||
%45 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %43, i32 0, i32 1
|
||||
store ptr %42, ptr %45, align 8
|
||||
%46 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %43, i32 0, i32 2
|
||||
store ptr @"github.com/goplus/llgo/cl/internal/foo.(*Game).Load", ptr %46, align 8
|
||||
%47 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %43, i32 0, i32 3
|
||||
store ptr @"github.com/goplus/llgo/cl/internal/foo.(*Game).Load", ptr %47, align 8
|
||||
%48 = load %"github.com/goplus/llgo/internal/abi.Method", ptr %43, 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 @2, ptr %50, align 8
|
||||
%51 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %49, i32 0, i32 1
|
||||
store i64 8, ptr %51, align 4
|
||||
%52 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %49, align 8
|
||||
%53 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%54 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %53, i32 0, i32 0
|
||||
store ptr @3, ptr %54, align 8
|
||||
%55 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %53, i32 0, i32 1
|
||||
store i64 47, ptr %55, align 4
|
||||
%56 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %53, align 8
|
||||
%57 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%58 = alloca %"github.com/goplus/llgo/internal/abi.Method", align 8
|
||||
%59 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %58, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %56, ptr %59, align 8
|
||||
%60 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %58, i32 0, i32 1
|
||||
store ptr %57, ptr %60, align 8
|
||||
%61 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %58, i32 0, i32 2
|
||||
store ptr @"github.com/goplus/llgo/cl/internal/foo.(*Game).initGame", ptr %61, align 8
|
||||
%62 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %58, i32 0, i32 3
|
||||
store ptr @"github.com/goplus/llgo/cl/internal/foo.(*Game).initGame", ptr %62, align 8
|
||||
%63 = load %"github.com/goplus/llgo/internal/abi.Method", ptr %58, align 8
|
||||
%64 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 80)
|
||||
%65 = getelementptr %"github.com/goplus/llgo/internal/abi.Method", ptr %64, i64 0
|
||||
store %"github.com/goplus/llgo/internal/abi.Method" %48, ptr %65, align 8
|
||||
%66 = getelementptr %"github.com/goplus/llgo/internal/abi.Method", ptr %64, i64 1
|
||||
store %"github.com/goplus/llgo/internal/abi.Method" %63, ptr %66, align 8
|
||||
%67 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%68 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %67, i32 0, i32 0
|
||||
store ptr %64, ptr %68, align 8
|
||||
%69 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %67, i32 0, i32 1
|
||||
store i64 2, ptr %69, align 4
|
||||
%70 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %67, i32 0, i32 2
|
||||
store i64 2, ptr %70, align 4
|
||||
%71 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %67, align 8
|
||||
%72 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%73 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %72, i32 0, i32 0
|
||||
store ptr @4, ptr %73, align 8
|
||||
%74 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %72, i32 0, i32 1
|
||||
store i64 38, ptr %74, align 4
|
||||
%75 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %72, align 8
|
||||
%76 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%77 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %76, i32 0, i32 0
|
||||
store ptr @5, ptr %77, align 8
|
||||
%78 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %76, i32 0, i32 1
|
||||
store i64 4, ptr %78, align 4
|
||||
store i64 43, ptr %78, align 4
|
||||
%79 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %76, align 8
|
||||
%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 @6, ptr %81, align 8
|
||||
%82 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %80, i32 0, i32 1
|
||||
store i64 10, 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.InitNamed"(ptr %21, %"github.com/goplus/llgo/internal/runtime.String" %79, %"github.com/goplus/llgo/internal/runtime.String" %83, ptr %35, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %75)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %5, %"github.com/goplus/llgo/internal/runtime.String" %75, %"github.com/goplus/llgo/internal/runtime.String" %79, ptr %19, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %71)
|
||||
br label %_llgo_8
|
||||
|
||||
_llgo_11: ; preds = %_llgo_8
|
||||
%80 = call ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr %26)
|
||||
store ptr %80, ptr @"*_llgo_github.com/goplus/llgo/cl/internal/foo.Game", align 8
|
||||
br label %_llgo_12
|
||||
|
||||
_llgo_12: ; preds = %_llgo_11, %_llgo_8
|
||||
%81 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/internal/foo.Game", align 8
|
||||
%82 = load ptr, ptr @"_llgo_struct$cJmCzeVn0orHWafCrTGAnbbAF46F2A4Fms4bJBm8ITI", align 8
|
||||
%83 = icmp eq ptr %82, null
|
||||
br i1 %83, label %_llgo_13, label %_llgo_14
|
||||
|
||||
_llgo_13: ; preds = %_llgo_12
|
||||
%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 @6, ptr %85, align 8
|
||||
%86 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %84, i32 0, i32 1
|
||||
store i64 4, ptr %86, align 4
|
||||
%87 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %84, align 8
|
||||
%88 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%89 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %88, i32 0, i32 0
|
||||
store ptr @7, ptr %89, align 8
|
||||
%90 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %88, i32 0, i32 1
|
||||
store i64 0, ptr %90, align 4
|
||||
%91 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %88, align 8
|
||||
%92 = call %"github.com/goplus/llgo/internal/abi.StructField" @"github.com/goplus/llgo/internal/runtime.StructField"(%"github.com/goplus/llgo/internal/runtime.String" %87, ptr %81, i64 0, %"github.com/goplus/llgo/internal/runtime.String" %91, i1 true)
|
||||
%93 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%94 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %93, i32 0, i32 0
|
||||
store ptr @8, ptr %94, align 8
|
||||
%95 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %93, i32 0, i32 1
|
||||
store i64 4, ptr %95, align 4
|
||||
%96 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %93, align 8
|
||||
%97 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 56)
|
||||
%98 = getelementptr %"github.com/goplus/llgo/internal/abi.StructField", ptr %97, i64 0
|
||||
store %"github.com/goplus/llgo/internal/abi.StructField" %92, ptr %98, align 8
|
||||
%99 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%100 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %99, i32 0, i32 0
|
||||
store ptr %97, ptr %100, align 8
|
||||
%101 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %99, i32 0, i32 1
|
||||
store i64 1, ptr %101, align 4
|
||||
%102 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %99, i32 0, i32 2
|
||||
store i64 1, ptr %102, align 4
|
||||
%103 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %99, align 8
|
||||
%104 = call ptr @"github.com/goplus/llgo/internal/runtime.Struct"(%"github.com/goplus/llgo/internal/runtime.String" %96, i64 8, %"github.com/goplus/llgo/internal/runtime.Slice" %103)
|
||||
store ptr %104, ptr @"_llgo_struct$cJmCzeVn0orHWafCrTGAnbbAF46F2A4Fms4bJBm8ITI", align 8
|
||||
br label %_llgo_14
|
||||
|
||||
_llgo_17: ; preds = %_llgo_14
|
||||
%84 = call ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr %46)
|
||||
store ptr %84, ptr @"*_llgo_main.Game2", align 8
|
||||
br label %_llgo_18
|
||||
_llgo_14: ; preds = %_llgo_13, %_llgo_12
|
||||
%105 = load ptr, ptr @"_llgo_struct$cJmCzeVn0orHWafCrTGAnbbAF46F2A4Fms4bJBm8ITI", align 8
|
||||
br i1 %1, label %_llgo_15, label %_llgo_16
|
||||
|
||||
_llgo_18: ; preds = %_llgo_17, %_llgo_14
|
||||
%85 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%86 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%87 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/internal/foo.Gamer", align 8
|
||||
%88 = icmp eq ptr %87, null
|
||||
br i1 %88, label %_llgo_19, label %_llgo_20
|
||||
|
||||
_llgo_19: ; preds = %_llgo_18
|
||||
%89 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%90 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %89, i32 0, i32 0
|
||||
store ptr @7, ptr %90, align 8
|
||||
%91 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %89, i32 0, i32 1
|
||||
store i64 4, ptr %91, align 4
|
||||
%92 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %89, align 8
|
||||
%93 = alloca %"github.com/goplus/llgo/internal/abi.Imethod", align 8
|
||||
%94 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %93, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %92, ptr %94, align 8
|
||||
%95 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %93, i32 0, i32 1
|
||||
store ptr %85, ptr %95, align 8
|
||||
%96 = load %"github.com/goplus/llgo/internal/abi.Imethod", ptr %93, align 8
|
||||
%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 @8, ptr %98, align 8
|
||||
%99 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %97, i32 0, i32 1
|
||||
store i64 47, ptr %99, align 4
|
||||
%100 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %97, align 8
|
||||
%101 = alloca %"github.com/goplus/llgo/internal/abi.Imethod", align 8
|
||||
%102 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %101, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %100, ptr %102, align 8
|
||||
%103 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %101, i32 0, i32 1
|
||||
store ptr %86, ptr %103, align 8
|
||||
%104 = load %"github.com/goplus/llgo/internal/abi.Imethod", ptr %101, align 8
|
||||
%105 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 48)
|
||||
%106 = getelementptr %"github.com/goplus/llgo/internal/abi.Imethod", ptr %105, i64 0
|
||||
store %"github.com/goplus/llgo/internal/abi.Imethod" %96, ptr %106, align 8
|
||||
%107 = getelementptr %"github.com/goplus/llgo/internal/abi.Imethod", ptr %105, i64 1
|
||||
store %"github.com/goplus/llgo/internal/abi.Imethod" %104, ptr %107, align 8
|
||||
%108 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%109 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %108, i32 0, i32 0
|
||||
store ptr %105, ptr %109, align 8
|
||||
%110 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %108, i32 0, i32 1
|
||||
store i64 2, ptr %110, align 4
|
||||
%111 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %108, i32 0, i32 2
|
||||
store i64 2, ptr %111, align 4
|
||||
%112 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %108, align 8
|
||||
%113 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%114 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %113, i32 0, i32 0
|
||||
store ptr @9, ptr %114, align 8
|
||||
%115 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %113, i32 0, i32 1
|
||||
store i64 38, ptr %115, align 4
|
||||
%116 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %113, align 8
|
||||
_llgo_15: ; preds = %_llgo_14
|
||||
%106 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%107 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %106, i32 0, i32 0
|
||||
store ptr @9, ptr %107, align 8
|
||||
%108 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %106, i32 0, i32 1
|
||||
store i64 4, ptr %108, align 4
|
||||
%109 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %106, align 8
|
||||
%110 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%111 = alloca %"github.com/goplus/llgo/internal/abi.Method", align 8
|
||||
%112 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %111, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %109, ptr %112, align 8
|
||||
%113 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %111, i32 0, i32 1
|
||||
store ptr %110, ptr %113, align 8
|
||||
%114 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %111, i32 0, i32 2
|
||||
store ptr @"github.com/goplus/llgo/cl/internal/foo.(*Game).Load", ptr %114, align 8
|
||||
%115 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %111, i32 0, i32 3
|
||||
store ptr @"github.com/goplus/llgo/cl/internal/foo.(*Game).Load", ptr %115, align 8
|
||||
%116 = load %"github.com/goplus/llgo/internal/abi.Method", ptr %111, align 8
|
||||
%117 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%118 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %117, i32 0, i32 0
|
||||
store ptr @10, ptr %118, align 8
|
||||
%119 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %117, i32 0, i32 1
|
||||
store i64 44, ptr %119, align 4
|
||||
store i64 8, ptr %119, align 4
|
||||
%120 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %117, align 8
|
||||
%121 = call ptr @"github.com/goplus/llgo/internal/runtime.Interface"(%"github.com/goplus/llgo/internal/runtime.String" %116, %"github.com/goplus/llgo/internal/runtime.String" %120, %"github.com/goplus/llgo/internal/runtime.Slice" %112)
|
||||
store ptr %121, ptr @"_llgo_github.com/goplus/llgo/cl/internal/foo.Gamer", align 8
|
||||
%121 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%122 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %121, i32 0, i32 0
|
||||
store ptr @11, ptr %122, align 8
|
||||
%123 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %121, i32 0, i32 1
|
||||
store i64 47, ptr %123, align 4
|
||||
%124 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %121, align 8
|
||||
%125 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%126 = alloca %"github.com/goplus/llgo/internal/abi.Method", align 8
|
||||
%127 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %126, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %124, ptr %127, align 8
|
||||
%128 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %126, i32 0, i32 1
|
||||
store ptr %125, ptr %128, align 8
|
||||
%129 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %126, i32 0, i32 2
|
||||
store ptr @"github.com/goplus/llgo/cl/internal/foo.(*Game).initGame", ptr %129, align 8
|
||||
%130 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %126, i32 0, i32 3
|
||||
store ptr @"github.com/goplus/llgo/cl/internal/foo.(*Game).initGame", ptr %130, align 8
|
||||
%131 = load %"github.com/goplus/llgo/internal/abi.Method", ptr %126, align 8
|
||||
%132 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 80)
|
||||
%133 = getelementptr %"github.com/goplus/llgo/internal/abi.Method", ptr %132, i64 0
|
||||
store %"github.com/goplus/llgo/internal/abi.Method" %116, ptr %133, align 8
|
||||
%134 = getelementptr %"github.com/goplus/llgo/internal/abi.Method", ptr %132, i64 1
|
||||
store %"github.com/goplus/llgo/internal/abi.Method" %131, ptr %134, align 8
|
||||
%135 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%136 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %135, i32 0, i32 0
|
||||
store ptr %132, ptr %136, align 8
|
||||
%137 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %135, i32 0, i32 1
|
||||
store i64 2, ptr %137, align 4
|
||||
%138 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %135, i32 0, i32 2
|
||||
store i64 2, ptr %138, align 4
|
||||
%139 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %135, align 8
|
||||
%140 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%141 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %140, i32 0, i32 0
|
||||
store ptr @12, ptr %141, align 8
|
||||
%142 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %140, i32 0, i32 1
|
||||
store i64 4, ptr %142, align 4
|
||||
%143 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %140, align 8
|
||||
%144 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%145 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %144, i32 0, i32 0
|
||||
store ptr @13, ptr %145, align 8
|
||||
%146 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %144, i32 0, i32 1
|
||||
store i64 10, ptr %146, align 4
|
||||
%147 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %144, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %2, %"github.com/goplus/llgo/internal/runtime.String" %143, %"github.com/goplus/llgo/internal/runtime.String" %147, ptr %105, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %139)
|
||||
br label %_llgo_16
|
||||
|
||||
_llgo_16: ; preds = %_llgo_15, %_llgo_14
|
||||
%148 = load ptr, ptr @_llgo_main.Game1, align 8
|
||||
%149 = load ptr, ptr @"*_llgo_main.Game1", align 8
|
||||
%150 = icmp eq ptr %149, null
|
||||
br i1 %150, label %_llgo_17, label %_llgo_18
|
||||
|
||||
_llgo_17: ; preds = %_llgo_16
|
||||
%151 = call ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr %148)
|
||||
store ptr %151, ptr @"*_llgo_main.Game1", align 8
|
||||
br label %_llgo_18
|
||||
|
||||
_llgo_18: ; preds = %_llgo_17, %_llgo_16
|
||||
%152 = load ptr, ptr @_llgo_main.Game2, align 8
|
||||
%153 = icmp eq ptr %152, null
|
||||
br i1 %153, label %_llgo_19, label %_llgo_20
|
||||
|
||||
_llgo_19: ; preds = %_llgo_18
|
||||
%154 = call ptr @"github.com/goplus/llgo/internal/runtime.NewNamed"(i64 25, i64 0, i64 1)
|
||||
store ptr %154, ptr @_llgo_main.Game2, align 8
|
||||
br label %_llgo_20
|
||||
|
||||
_llgo_20: ; preds = %_llgo_19, %_llgo_18
|
||||
%122 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%123 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%124 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%125 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %124, i32 0, i32 0
|
||||
store ptr @11, ptr %125, align 8
|
||||
%126 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %124, i32 0, i32 1
|
||||
store i64 4, ptr %126, align 4
|
||||
%127 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %124, align 8
|
||||
%128 = alloca %"github.com/goplus/llgo/internal/abi.Imethod", align 8
|
||||
%129 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %128, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %127, ptr %129, align 8
|
||||
%130 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %128, i32 0, i32 1
|
||||
store ptr %122, ptr %130, align 8
|
||||
%131 = load %"github.com/goplus/llgo/internal/abi.Imethod", ptr %128, align 8
|
||||
%132 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%133 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %132, i32 0, i32 0
|
||||
store ptr @12, ptr %133, align 8
|
||||
%134 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %132, i32 0, i32 1
|
||||
store i64 47, ptr %134, align 4
|
||||
%135 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %132, align 8
|
||||
%136 = alloca %"github.com/goplus/llgo/internal/abi.Imethod", align 8
|
||||
%137 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %136, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %135, ptr %137, align 8
|
||||
%138 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %136, i32 0, i32 1
|
||||
store ptr %123, ptr %138, align 8
|
||||
%139 = load %"github.com/goplus/llgo/internal/abi.Imethod", ptr %136, align 8
|
||||
%140 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 48)
|
||||
%141 = getelementptr %"github.com/goplus/llgo/internal/abi.Imethod", ptr %140, i64 0
|
||||
store %"github.com/goplus/llgo/internal/abi.Imethod" %131, ptr %141, align 8
|
||||
%142 = getelementptr %"github.com/goplus/llgo/internal/abi.Imethod", ptr %140, i64 1
|
||||
store %"github.com/goplus/llgo/internal/abi.Imethod" %139, ptr %142, align 8
|
||||
%143 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%144 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %143, i32 0, i32 0
|
||||
store ptr %140, ptr %144, align 8
|
||||
%145 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %143, i32 0, i32 1
|
||||
store i64 2, ptr %145, align 4
|
||||
%146 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %143, i32 0, i32 2
|
||||
store i64 2, ptr %146, align 4
|
||||
%147 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %143, align 8
|
||||
%148 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%149 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %148, i32 0, i32 0
|
||||
store ptr @13, ptr %149, align 8
|
||||
%150 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %148, i32 0, i32 1
|
||||
store i64 4, ptr %150, align 4
|
||||
%151 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %148, align 8
|
||||
%152 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%153 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %152, i32 0, i32 0
|
||||
store ptr @14, ptr %153, align 8
|
||||
%154 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %152, i32 0, i32 1
|
||||
store i64 0, ptr %154, align 4
|
||||
%155 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %152, align 8
|
||||
%156 = call ptr @"github.com/goplus/llgo/internal/runtime.Interface"(%"github.com/goplus/llgo/internal/runtime.String" %151, %"github.com/goplus/llgo/internal/runtime.String" %155, %"github.com/goplus/llgo/internal/runtime.Slice" %147)
|
||||
store ptr %156, ptr @"main.iface$sO8a1LvuUsjXwiwaC6sR9-L4DiYgiOnZi7iosyShJXg", align 8
|
||||
%155 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
br i1 %153, label %_llgo_21, label %_llgo_22
|
||||
|
||||
_llgo_21: ; preds = %_llgo_20
|
||||
%156 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%157 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %156, i32 0, i32 0
|
||||
store ptr @14, ptr %157, align 8
|
||||
%158 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %156, i32 0, i32 1
|
||||
store i64 8, ptr %158, align 4
|
||||
%159 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %156, align 8
|
||||
%160 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%161 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %160, i32 0, i32 0
|
||||
store ptr @15, ptr %161, align 8
|
||||
%162 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %160, i32 0, i32 1
|
||||
store i64 13, ptr %162, align 4
|
||||
%163 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %160, align 8
|
||||
%164 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%165 = alloca %"github.com/goplus/llgo/internal/abi.Method", align 8
|
||||
%166 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %165, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %163, ptr %166, align 8
|
||||
%167 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %165, i32 0, i32 1
|
||||
store ptr %164, ptr %167, align 8
|
||||
%168 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %165, i32 0, i32 2
|
||||
store ptr @"main.(*Game2).initGame", ptr %168, align 8
|
||||
%169 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Method", ptr %165, i32 0, i32 3
|
||||
store ptr @"main.(*Game2).initGame", ptr %169, align 8
|
||||
%170 = load %"github.com/goplus/llgo/internal/abi.Method", ptr %165, align 8
|
||||
%171 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 40)
|
||||
%172 = getelementptr %"github.com/goplus/llgo/internal/abi.Method", ptr %171, i64 0
|
||||
store %"github.com/goplus/llgo/internal/abi.Method" %170, ptr %172, align 8
|
||||
%173 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%174 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %173, i32 0, i32 0
|
||||
store ptr %171, ptr %174, align 8
|
||||
%175 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %173, i32 0, i32 1
|
||||
store i64 1, ptr %175, align 4
|
||||
%176 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %173, i32 0, i32 2
|
||||
store i64 1, ptr %176, align 4
|
||||
%177 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %173, align 8
|
||||
%178 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%179 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %178, i32 0, i32 0
|
||||
store ptr @16, ptr %179, align 8
|
||||
%180 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %178, i32 0, i32 1
|
||||
store i64 4, ptr %180, align 4
|
||||
%181 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %178, align 8
|
||||
%182 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%183 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %182, i32 0, i32 0
|
||||
store ptr @17, ptr %183, align 8
|
||||
%184 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %182, i32 0, i32 1
|
||||
store i64 10, ptr %184, align 4
|
||||
%185 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %182, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.InitNamed"(ptr %154, %"github.com/goplus/llgo/internal/runtime.String" %181, %"github.com/goplus/llgo/internal/runtime.String" %185, ptr %155, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/internal/runtime.Slice" %177)
|
||||
br label %_llgo_22
|
||||
|
||||
_llgo_22: ; preds = %_llgo_21, %_llgo_20
|
||||
%186 = load ptr, ptr @_llgo_main.Game2, align 8
|
||||
%187 = load ptr, ptr @"*_llgo_main.Game2", align 8
|
||||
%188 = icmp eq ptr %187, null
|
||||
br i1 %188, label %_llgo_23, label %_llgo_24
|
||||
|
||||
_llgo_23: ; preds = %_llgo_22
|
||||
%189 = call ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr %186)
|
||||
store ptr %189, ptr @"*_llgo_main.Game2", align 8
|
||||
br label %_llgo_24
|
||||
|
||||
_llgo_24: ; preds = %_llgo_23, %_llgo_22
|
||||
%190 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%191 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%192 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/internal/foo.Gamer", align 8
|
||||
%193 = icmp eq ptr %192, null
|
||||
br i1 %193, label %_llgo_25, label %_llgo_26
|
||||
|
||||
_llgo_25: ; preds = %_llgo_24
|
||||
%194 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%195 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %194, i32 0, i32 0
|
||||
store ptr @18, ptr %195, align 8
|
||||
%196 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %194, i32 0, i32 1
|
||||
store i64 4, ptr %196, align 4
|
||||
%197 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %194, align 8
|
||||
%198 = alloca %"github.com/goplus/llgo/internal/abi.Imethod", align 8
|
||||
%199 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %198, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %197, ptr %199, align 8
|
||||
%200 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %198, i32 0, i32 1
|
||||
store ptr %190, ptr %200, align 8
|
||||
%201 = load %"github.com/goplus/llgo/internal/abi.Imethod", ptr %198, align 8
|
||||
%202 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%203 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %202, i32 0, i32 0
|
||||
store ptr @19, ptr %203, align 8
|
||||
%204 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %202, i32 0, i32 1
|
||||
store i64 47, ptr %204, align 4
|
||||
%205 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %202, align 8
|
||||
%206 = alloca %"github.com/goplus/llgo/internal/abi.Imethod", align 8
|
||||
%207 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %206, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %205, ptr %207, align 8
|
||||
%208 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %206, i32 0, i32 1
|
||||
store ptr %191, ptr %208, align 8
|
||||
%209 = load %"github.com/goplus/llgo/internal/abi.Imethod", ptr %206, align 8
|
||||
%210 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 48)
|
||||
%211 = getelementptr %"github.com/goplus/llgo/internal/abi.Imethod", ptr %210, i64 0
|
||||
store %"github.com/goplus/llgo/internal/abi.Imethod" %201, ptr %211, align 8
|
||||
%212 = getelementptr %"github.com/goplus/llgo/internal/abi.Imethod", ptr %210, i64 1
|
||||
store %"github.com/goplus/llgo/internal/abi.Imethod" %209, ptr %212, align 8
|
||||
%213 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%214 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %213, i32 0, i32 0
|
||||
store ptr %210, ptr %214, align 8
|
||||
%215 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %213, i32 0, i32 1
|
||||
store i64 2, ptr %215, align 4
|
||||
%216 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %213, i32 0, i32 2
|
||||
store i64 2, ptr %216, align 4
|
||||
%217 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %213, align 8
|
||||
%218 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%219 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %218, i32 0, i32 0
|
||||
store ptr @20, ptr %219, align 8
|
||||
%220 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %218, i32 0, i32 1
|
||||
store i64 38, ptr %220, align 4
|
||||
%221 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %218, align 8
|
||||
%222 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%223 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %222, i32 0, i32 0
|
||||
store ptr @21, ptr %223, align 8
|
||||
%224 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %222, i32 0, i32 1
|
||||
store i64 44, ptr %224, align 4
|
||||
%225 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %222, align 8
|
||||
%226 = call ptr @"github.com/goplus/llgo/internal/runtime.Interface"(%"github.com/goplus/llgo/internal/runtime.String" %221, %"github.com/goplus/llgo/internal/runtime.String" %225, %"github.com/goplus/llgo/internal/runtime.Slice" %217)
|
||||
store ptr %226, ptr @"_llgo_github.com/goplus/llgo/cl/internal/foo.Gamer", align 8
|
||||
br label %_llgo_26
|
||||
|
||||
_llgo_26: ; preds = %_llgo_25, %_llgo_24
|
||||
%227 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%228 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%229 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%230 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %229, i32 0, i32 0
|
||||
store ptr @22, ptr %230, align 8
|
||||
%231 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %229, i32 0, i32 1
|
||||
store i64 4, ptr %231, align 4
|
||||
%232 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %229, align 8
|
||||
%233 = alloca %"github.com/goplus/llgo/internal/abi.Imethod", align 8
|
||||
%234 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %233, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %232, ptr %234, align 8
|
||||
%235 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %233, i32 0, i32 1
|
||||
store ptr %227, ptr %235, align 8
|
||||
%236 = load %"github.com/goplus/llgo/internal/abi.Imethod", ptr %233, align 8
|
||||
%237 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%238 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %237, i32 0, i32 0
|
||||
store ptr @23, ptr %238, align 8
|
||||
%239 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %237, i32 0, i32 1
|
||||
store i64 47, ptr %239, align 4
|
||||
%240 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %237, align 8
|
||||
%241 = alloca %"github.com/goplus/llgo/internal/abi.Imethod", align 8
|
||||
%242 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %241, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %240, ptr %242, align 8
|
||||
%243 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Imethod", ptr %241, i32 0, i32 1
|
||||
store ptr %228, ptr %243, align 8
|
||||
%244 = load %"github.com/goplus/llgo/internal/abi.Imethod", ptr %241, align 8
|
||||
%245 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 48)
|
||||
%246 = getelementptr %"github.com/goplus/llgo/internal/abi.Imethod", ptr %245, i64 0
|
||||
store %"github.com/goplus/llgo/internal/abi.Imethod" %236, ptr %246, align 8
|
||||
%247 = getelementptr %"github.com/goplus/llgo/internal/abi.Imethod", ptr %245, i64 1
|
||||
store %"github.com/goplus/llgo/internal/abi.Imethod" %244, ptr %247, align 8
|
||||
%248 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%249 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %248, i32 0, i32 0
|
||||
store ptr %245, ptr %249, align 8
|
||||
%250 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %248, i32 0, i32 1
|
||||
store i64 2, ptr %250, align 4
|
||||
%251 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %248, i32 0, i32 2
|
||||
store i64 2, ptr %251, align 4
|
||||
%252 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %248, align 8
|
||||
%253 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%254 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %253, i32 0, i32 0
|
||||
store ptr @24, ptr %254, align 8
|
||||
%255 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %253, i32 0, i32 1
|
||||
store i64 4, ptr %255, align 4
|
||||
%256 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %253, align 8
|
||||
%257 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%258 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %257, i32 0, i32 0
|
||||
store ptr @25, ptr %258, align 8
|
||||
%259 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %257, i32 0, i32 1
|
||||
store i64 0, ptr %259, align 4
|
||||
%260 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %257, align 8
|
||||
%261 = call ptr @"github.com/goplus/llgo/internal/runtime.Interface"(%"github.com/goplus/llgo/internal/runtime.String" %256, %"github.com/goplus/llgo/internal/runtime.String" %260, %"github.com/goplus/llgo/internal/runtime.Slice" %252)
|
||||
store ptr %261, ptr @"main.iface$sO8a1LvuUsjXwiwaC6sR9-L4DiYgiOnZi7iosyShJXg", align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.NewNamed"(i64, i64, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64)
|
||||
|
||||
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.PointerTo"(ptr)
|
||||
|
||||
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.AllocU"(i64)
|
||||
|
||||
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.Func"(%"github.com/goplus/llgo/internal/runtime.Slice", %"github.com/goplus/llgo/internal/runtime.Slice", i1)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(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 i1 @"github.com/goplus/llgo/internal/runtime.Implements"(ptr, ptr)
|
||||
|
||||
@@ -376,90 +376,91 @@ _llgo_1: ; preds = %_llgo_0
|
||||
call void @main.invoke(%"github.com/goplus/llgo/internal/runtime.iface" %118)
|
||||
%119 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %108, 0
|
||||
%120 = load ptr, ptr @_llgo_any, align 8
|
||||
br i1 true, label %_llgo_3, label %_llgo_4
|
||||
%121 = call i1 @"github.com/goplus/llgo/internal/runtime.Implements"(ptr %120, ptr %119)
|
||||
br i1 %121, label %_llgo_3, label %_llgo_4
|
||||
|
||||
_llgo_2: ; preds = %_llgo_0
|
||||
%121 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%122 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %121, i32 0, i32 0
|
||||
store ptr @32, ptr %122, align 8
|
||||
%123 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %121, i32 0, i32 1
|
||||
store i64 21, ptr %123, align 4
|
||||
%124 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %121, align 8
|
||||
%125 = load ptr, ptr @_llgo_string, align 8
|
||||
%126 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %124, ptr %126, align 8
|
||||
%127 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
|
||||
%128 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %127, i32 0, i32 0
|
||||
store ptr %125, ptr %128, align 8
|
||||
%129 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %127, i32 0, i32 1
|
||||
%122 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%123 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %122, i32 0, i32 0
|
||||
store ptr @32, ptr %123, align 8
|
||||
%124 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %122, i32 0, i32 1
|
||||
store i64 21, ptr %124, align 4
|
||||
%125 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %122, align 8
|
||||
%126 = load ptr, ptr @_llgo_string, align 8
|
||||
%127 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %125, ptr %127, align 8
|
||||
%128 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
|
||||
%129 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %128, i32 0, i32 0
|
||||
store ptr %126, ptr %129, align 8
|
||||
%130 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %127, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %130)
|
||||
%130 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %128, i32 0, i32 1
|
||||
store ptr %127, ptr %130, align 8
|
||||
%131 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %128, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %131)
|
||||
unreachable
|
||||
|
||||
_llgo_3: ; preds = %_llgo_1
|
||||
%131 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %108, 1
|
||||
%132 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
|
||||
%133 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %132, i32 0, i32 0
|
||||
store ptr %119, ptr %133, align 8
|
||||
%134 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %132, i32 0, i32 1
|
||||
store ptr %131, ptr %134, align 8
|
||||
%135 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %132, align 8
|
||||
%136 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %135, 0
|
||||
%137 = load ptr, ptr @"_llgo_iface$uRUteI7wmSy7y7ODhGzk0FdDaxGKMhVSSu6HZEv9aa0", align 8
|
||||
%138 = call i1 @"github.com/goplus/llgo/internal/runtime.Implements"(ptr %137, ptr %136)
|
||||
br i1 %138, label %_llgo_5, label %_llgo_6
|
||||
%132 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %108, 1
|
||||
%133 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
|
||||
%134 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %133, i32 0, i32 0
|
||||
store ptr %119, ptr %134, align 8
|
||||
%135 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %133, i32 0, i32 1
|
||||
store ptr %132, ptr %135, align 8
|
||||
%136 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %133, align 8
|
||||
%137 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %136, 0
|
||||
%138 = load ptr, ptr @"_llgo_iface$uRUteI7wmSy7y7ODhGzk0FdDaxGKMhVSSu6HZEv9aa0", align 8
|
||||
%139 = call i1 @"github.com/goplus/llgo/internal/runtime.Implements"(ptr %138, ptr %137)
|
||||
br i1 %139, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_4: ; preds = %_llgo_1
|
||||
%139 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%140 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %139, i32 0, i32 0
|
||||
store ptr @35, ptr %140, align 8
|
||||
%141 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %139, i32 0, i32 1
|
||||
store i64 21, ptr %141, align 4
|
||||
%142 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %139, align 8
|
||||
%143 = load ptr, ptr @_llgo_string, align 8
|
||||
%144 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %142, ptr %144, align 8
|
||||
%145 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
|
||||
%146 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %145, i32 0, i32 0
|
||||
store ptr %143, ptr %146, align 8
|
||||
%147 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %145, i32 0, i32 1
|
||||
%140 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%141 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %140, i32 0, i32 0
|
||||
store ptr @35, ptr %141, align 8
|
||||
%142 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %140, i32 0, i32 1
|
||||
store i64 21, ptr %142, align 4
|
||||
%143 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %140, align 8
|
||||
%144 = load ptr, ptr @_llgo_string, align 8
|
||||
%145 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %143, ptr %145, align 8
|
||||
%146 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
|
||||
%147 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %146, i32 0, i32 0
|
||||
store ptr %144, ptr %147, align 8
|
||||
%148 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %145, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %148)
|
||||
%148 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %146, i32 0, i32 1
|
||||
store ptr %145, ptr %148, align 8
|
||||
%149 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %146, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %149)
|
||||
unreachable
|
||||
|
||||
_llgo_5: ; preds = %_llgo_3
|
||||
%149 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %135, 1
|
||||
%150 = load ptr, ptr @"_llgo_iface$uRUteI7wmSy7y7ODhGzk0FdDaxGKMhVSSu6HZEv9aa0", align 8
|
||||
%151 = call ptr @"github.com/goplus/llgo/internal/runtime.NewItab"(ptr %150, ptr %136)
|
||||
%152 = alloca %"github.com/goplus/llgo/internal/runtime.iface", align 8
|
||||
%153 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %152, i32 0, i32 0
|
||||
store ptr %151, ptr %153, align 8
|
||||
%154 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %152, i32 0, i32 1
|
||||
store ptr %149, ptr %154, align 8
|
||||
%155 = load %"github.com/goplus/llgo/internal/runtime.iface", ptr %152, align 8
|
||||
call void @main.invoke(%"github.com/goplus/llgo/internal/runtime.iface" %155)
|
||||
%150 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %136, 1
|
||||
%151 = load ptr, ptr @"_llgo_iface$uRUteI7wmSy7y7ODhGzk0FdDaxGKMhVSSu6HZEv9aa0", align 8
|
||||
%152 = call ptr @"github.com/goplus/llgo/internal/runtime.NewItab"(ptr %151, ptr %137)
|
||||
%153 = alloca %"github.com/goplus/llgo/internal/runtime.iface", align 8
|
||||
%154 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %153, i32 0, i32 0
|
||||
store ptr %152, ptr %154, align 8
|
||||
%155 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %153, i32 0, i32 1
|
||||
store ptr %150, ptr %155, align 8
|
||||
%156 = load %"github.com/goplus/llgo/internal/runtime.iface", ptr %153, align 8
|
||||
call void @main.invoke(%"github.com/goplus/llgo/internal/runtime.iface" %156)
|
||||
call void @main.invoke(%"github.com/goplus/llgo/internal/runtime.iface" zeroinitializer)
|
||||
ret i32 0
|
||||
|
||||
_llgo_6: ; preds = %_llgo_3
|
||||
%156 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%157 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %156, i32 0, i32 0
|
||||
store ptr @36, ptr %157, align 8
|
||||
%158 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %156, i32 0, i32 1
|
||||
store i64 21, ptr %158, align 4
|
||||
%159 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %156, align 8
|
||||
%160 = load ptr, ptr @_llgo_string, align 8
|
||||
%161 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %159, ptr %161, align 8
|
||||
%162 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
|
||||
%163 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %162, i32 0, i32 0
|
||||
store ptr %160, ptr %163, align 8
|
||||
%164 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %162, i32 0, i32 1
|
||||
%157 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%158 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %157, i32 0, i32 0
|
||||
store ptr @36, ptr %158, align 8
|
||||
%159 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %157, i32 0, i32 1
|
||||
store i64 21, ptr %159, align 4
|
||||
%160 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %157, align 8
|
||||
%161 = load ptr, ptr @_llgo_string, align 8
|
||||
%162 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %160, ptr %162, align 8
|
||||
%163 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
|
||||
%164 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %163, i32 0, i32 0
|
||||
store ptr %161, ptr %164, align 8
|
||||
%165 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %162, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %165)
|
||||
%165 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %163, i32 0, i32 1
|
||||
store ptr %162, ptr %165, align 8
|
||||
%166 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %163, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface" %166)
|
||||
unreachable
|
||||
}
|
||||
|
||||
|
||||
307
cl/_testgo/reader/in.go
Normal file
307
cl/_testgo/reader/in.go
Normal file
@@ -0,0 +1,307 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
type Reader interface {
|
||||
Read(p []byte) (n int, err error)
|
||||
}
|
||||
|
||||
type Writer interface {
|
||||
Write(p []byte) (n int, err error)
|
||||
}
|
||||
|
||||
type Closer interface {
|
||||
Close() error
|
||||
}
|
||||
|
||||
type Seeker interface {
|
||||
Seek(offset int64, whence int) (int64, error)
|
||||
}
|
||||
|
||||
type ReadWriter interface {
|
||||
Reader
|
||||
Writer
|
||||
}
|
||||
|
||||
type ReadCloser interface {
|
||||
Reader
|
||||
Closer
|
||||
}
|
||||
|
||||
type WriteCloser interface {
|
||||
Writer
|
||||
Closer
|
||||
}
|
||||
|
||||
type ReadWriteCloser interface {
|
||||
Reader
|
||||
Writer
|
||||
Closer
|
||||
}
|
||||
|
||||
type ReadSeeker interface {
|
||||
Reader
|
||||
Seeker
|
||||
}
|
||||
|
||||
type ReadSeekCloser interface {
|
||||
Reader
|
||||
Seeker
|
||||
Closer
|
||||
}
|
||||
|
||||
type WriteSeeker interface {
|
||||
Writer
|
||||
Seeker
|
||||
}
|
||||
|
||||
type ReadWriteSeeker interface {
|
||||
Reader
|
||||
Writer
|
||||
Seeker
|
||||
}
|
||||
|
||||
type ReaderFrom interface {
|
||||
ReadFrom(r Reader) (n int64, err error)
|
||||
}
|
||||
|
||||
type WriterTo interface {
|
||||
WriteTo(w Writer) (n int64, err error)
|
||||
}
|
||||
|
||||
type ReaderAt interface {
|
||||
ReadAt(p []byte, off int64) (n int, err error)
|
||||
}
|
||||
|
||||
type WriterAt interface {
|
||||
WriteAt(p []byte, off int64) (n int, err error)
|
||||
}
|
||||
|
||||
type ByteReader interface {
|
||||
ReadByte() (byte, error)
|
||||
}
|
||||
|
||||
type ByteScanner interface {
|
||||
ByteReader
|
||||
UnreadByte() error
|
||||
}
|
||||
|
||||
type ByteWriter interface {
|
||||
WriteByte(c byte) error
|
||||
}
|
||||
|
||||
type RuneReader interface {
|
||||
ReadRune() (r rune, size int, err error)
|
||||
}
|
||||
|
||||
type RuneScanner interface {
|
||||
RuneReader
|
||||
UnreadRune() error
|
||||
}
|
||||
|
||||
type StringWriter interface {
|
||||
WriteString(s string) (n int, err error)
|
||||
}
|
||||
|
||||
func WriteString(w Writer, s string) (n int, err error) {
|
||||
if sw, ok := w.(StringWriter); ok {
|
||||
return sw.WriteString(s)
|
||||
}
|
||||
return w.Write([]byte(s))
|
||||
}
|
||||
|
||||
func NopCloser(r Reader) ReadCloser {
|
||||
if _, ok := r.(WriterTo); ok {
|
||||
return nopCloserWriterTo{r}
|
||||
}
|
||||
return nopCloser{r}
|
||||
}
|
||||
|
||||
type nopCloser struct {
|
||||
Reader
|
||||
}
|
||||
|
||||
func (nopCloser) Close() error { return nil }
|
||||
|
||||
type nopCloserWriterTo struct {
|
||||
Reader
|
||||
}
|
||||
|
||||
func (nopCloserWriterTo) Close() error { return nil }
|
||||
|
||||
func (c nopCloserWriterTo) WriteTo(w Writer) (n int64, err error) {
|
||||
return c.Reader.(WriterTo).WriteTo(w)
|
||||
}
|
||||
|
||||
func ReadAll(r Reader) ([]byte, error) {
|
||||
b := make([]byte, 0, 512)
|
||||
for {
|
||||
n, err := r.Read(b[len(b):cap(b)])
|
||||
b = b[:len(b)+n]
|
||||
if err != nil {
|
||||
if err == EOF {
|
||||
err = nil
|
||||
}
|
||||
return b, err
|
||||
}
|
||||
|
||||
if len(b) == cap(b) {
|
||||
// Add more capacity (let append pick how much).
|
||||
b = append(b, 0)[:len(b)]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type stringReader struct {
|
||||
s string
|
||||
i int64 // current reading index
|
||||
prevRune int // index of previous rune; or < 0
|
||||
}
|
||||
|
||||
func (r *stringReader) Len() int {
|
||||
if r.i >= int64(len(r.s)) {
|
||||
return 0
|
||||
}
|
||||
return int(int64(len(r.s)) - r.i)
|
||||
}
|
||||
|
||||
func (r *stringReader) Size() int64 { return int64(len(r.s)) }
|
||||
|
||||
func (r *stringReader) Read(b []byte) (n int, err error) {
|
||||
if r.i >= int64(len(r.s)) {
|
||||
return 0, EOF
|
||||
}
|
||||
r.prevRune = -1
|
||||
n = copy(b, r.s[r.i:])
|
||||
r.i += int64(n)
|
||||
return
|
||||
}
|
||||
|
||||
func (r *stringReader) ReadAt(b []byte, off int64) (n int, err error) {
|
||||
if off < 0 {
|
||||
return 0, newError("stringsReader.ReadAt: negative offset")
|
||||
}
|
||||
if off >= int64(len(r.s)) {
|
||||
return 0, EOF
|
||||
}
|
||||
n = copy(b, r.s[off:])
|
||||
if n < len(b) {
|
||||
err = EOF
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (r *stringReader) ReadByte() (byte, error) {
|
||||
r.prevRune = -1
|
||||
if r.i >= int64(len(r.s)) {
|
||||
return 0, EOF
|
||||
}
|
||||
b := r.s[r.i]
|
||||
r.i++
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (r *stringReader) UnreadByte() error {
|
||||
if r.i <= 0 {
|
||||
return newError("stringsReader.UnreadByte: at beginning of string")
|
||||
}
|
||||
r.prevRune = -1
|
||||
r.i--
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *stringReader) ReadRune() (ch rune, size int, err error) {
|
||||
if r.i >= int64(len(r.s)) {
|
||||
r.prevRune = -1
|
||||
return 0, 0, EOF
|
||||
}
|
||||
r.prevRune = int(r.i)
|
||||
if c := r.s[r.i]; c < utf8.RuneSelf {
|
||||
r.i++
|
||||
return rune(c), 1, nil
|
||||
}
|
||||
ch, size = utf8.DecodeRuneInString(r.s[r.i:])
|
||||
r.i += int64(size)
|
||||
return
|
||||
}
|
||||
|
||||
func (r *stringReader) UnreadRune() error {
|
||||
if r.i <= 0 {
|
||||
return newError("strings.Reader.UnreadRune: at beginning of string")
|
||||
}
|
||||
if r.prevRune < 0 {
|
||||
return newError("strings.Reader.UnreadRune: previous operation was not ReadRune")
|
||||
}
|
||||
r.i = int64(r.prevRune)
|
||||
r.prevRune = -1
|
||||
return nil
|
||||
}
|
||||
|
||||
const (
|
||||
SeekStart = 0 // seek relative to the origin of the file
|
||||
SeekCurrent = 1 // seek relative to the current offset
|
||||
SeekEnd = 2 // seek relative to the end
|
||||
)
|
||||
|
||||
func (r *stringReader) Seek(offset int64, whence int) (int64, error) {
|
||||
r.prevRune = -1
|
||||
var abs int64
|
||||
switch whence {
|
||||
case SeekStart:
|
||||
abs = offset
|
||||
case SeekCurrent:
|
||||
abs = r.i + offset
|
||||
case SeekEnd:
|
||||
abs = int64(len(r.s)) + offset
|
||||
default:
|
||||
return 0, newError("stringsReader.Seek: invalid whence")
|
||||
}
|
||||
if abs < 0 {
|
||||
return 0, newError("stringsReader.Seek: negative position")
|
||||
}
|
||||
r.i = abs
|
||||
return abs, nil
|
||||
}
|
||||
|
||||
func (r *stringReader) WriteTo(w Writer) (n int64, err error) {
|
||||
r.prevRune = -1
|
||||
if r.i >= int64(len(r.s)) {
|
||||
return 0, nil
|
||||
}
|
||||
s := r.s[r.i:]
|
||||
m, err := WriteString(w, s)
|
||||
if m > len(s) {
|
||||
panic("stringsReader.WriteTo: invalid WriteString count")
|
||||
}
|
||||
r.i += int64(m)
|
||||
n = int64(m)
|
||||
if m != len(s) && err == nil {
|
||||
err = ErrShortWrite
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func newError(text string) error {
|
||||
return &errorString{text}
|
||||
}
|
||||
|
||||
type errorString struct {
|
||||
s string
|
||||
}
|
||||
|
||||
func (e *errorString) Error() string {
|
||||
return e.s
|
||||
}
|
||||
|
||||
var (
|
||||
EOF = newError("EOF")
|
||||
ErrShortWrite = newError("short write")
|
||||
)
|
||||
|
||||
func main() {
|
||||
r := &stringReader{s: "hello world"}
|
||||
data, err := ReadAll(r)
|
||||
println(string(data), err)
|
||||
}
|
||||
2750
cl/_testgo/reader/out.ll
Normal file
2750
cl/_testgo/reader/out.ll
Normal file
File diff suppressed because it is too large
Load Diff
16
cl/_testlibc/defer/in.go
Normal file
16
cl/_testlibc/defer/in.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import "github.com/goplus/llgo/c"
|
||||
|
||||
func f(s string) bool {
|
||||
return len(s) > 2
|
||||
}
|
||||
|
||||
func main() {
|
||||
if s := "hello"; f(s) {
|
||||
defer c.Printf(c.Str("%s\n"), c.AllocaCStr(s))
|
||||
} else {
|
||||
defer c.Printf(c.Str("world\n"))
|
||||
}
|
||||
defer c.Printf(c.Str("bye\n"))
|
||||
}
|
||||
167
cl/_testlibc/defer/out.ll
Normal file
167
cl/_testlibc/defer/out.ll
Normal file
@@ -0,0 +1,167 @@
|
||||
; ModuleID = 'main'
|
||||
source_filename = "main"
|
||||
|
||||
%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/internal/runtime.Defer" = type { ptr, i64, ptr, ptr }
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
||||
@1 = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
|
||||
@2 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
||||
@__llgo_defer = linkonce global ptr null
|
||||
@3 = private unnamed_addr constant [7 x i8] c"world\0A\00", align 1
|
||||
@4 = private unnamed_addr constant [5 x i8] c"bye\0A\00", align 1
|
||||
|
||||
define i1 @main.f(%"github.com/goplus/llgo/internal/runtime.String" %0) {
|
||||
_llgo_0:
|
||||
%1 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %0, 1
|
||||
%2 = icmp sgt i64 %1, 2
|
||||
ret i1 %2
|
||||
}
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"main.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"main.init$guard", align 1
|
||||
call void @"main.init$after"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define i32 @main(i32 %0, ptr %1) {
|
||||
_llgo_0:
|
||||
store i32 %0, ptr @__llgo_argc, align 4
|
||||
store ptr %1, ptr @__llgo_argv, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
call void @main.init()
|
||||
%2 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%3 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %2, i32 0, i32 0
|
||||
store ptr @0, ptr %3, align 8
|
||||
%4 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %2, i32 0, i32 1
|
||||
store i64 5, ptr %4, align 4
|
||||
%5 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %2, align 8
|
||||
%6 = call i1 @main.f(%"github.com/goplus/llgo/internal/runtime.String" %5)
|
||||
%7 = load i32, ptr @__llgo_defer, align 4
|
||||
%8 = call ptr @pthread_getspecific(i32 %7)
|
||||
%9 = alloca i8, i64 196, align 1
|
||||
%10 = alloca i8, i64 32, align 1
|
||||
%11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Defer", ptr %10, i32 0, i32 0
|
||||
store ptr %9, ptr %11, align 8
|
||||
%12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Defer", ptr %10, i32 0, i32 1
|
||||
store i64 0, ptr %12, align 4
|
||||
%13 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Defer", ptr %10, i32 0, i32 2
|
||||
store ptr %8, ptr %13, align 8
|
||||
%14 = call i32 @pthread_setspecific(i32 %7, ptr %10)
|
||||
%15 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Defer", ptr %10, i32 0, i32 1
|
||||
%16 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Defer", ptr %10, i32 0, i32 3
|
||||
%17 = call i32 @sigsetjmp(ptr %9, i32 0)
|
||||
%18 = icmp eq i32 %17, 0
|
||||
br i1 %18, label %_llgo_5, label %_llgo_8
|
||||
|
||||
_llgo_1: ; preds = %_llgo_5
|
||||
%19 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%20 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %19, i32 0, i32 0
|
||||
store ptr @2, ptr %20, align 8
|
||||
%21 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %19, i32 0, i32 1
|
||||
store i64 5, ptr %21, align 4
|
||||
%22 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %19, align 8
|
||||
%23 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %22, 1
|
||||
%24 = add i64 %23, 1
|
||||
%25 = alloca i8, i64 %24, align 1
|
||||
%26 = call ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr %25, %"github.com/goplus/llgo/internal/runtime.String" %22)
|
||||
%27 = load i64, ptr %15, align 4
|
||||
%28 = or i64 %27, 1
|
||||
store i64 %28, ptr %15, align 4
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_3, %_llgo_1
|
||||
store ptr blockaddress(@main, %_llgo_9), ptr %16, align 8
|
||||
br label %_llgo_6
|
||||
|
||||
_llgo_3: ; preds = %_llgo_5
|
||||
%29 = load i64, ptr %15, align 4
|
||||
%30 = or i64 %29, 2
|
||||
store i64 %30, ptr %15, align 4
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_4: ; No predecessors!
|
||||
ret i32 0
|
||||
|
||||
_llgo_5: ; preds = %_llgo_0
|
||||
br i1 %6, label %_llgo_1, label %_llgo_3
|
||||
|
||||
_llgo_6: ; preds = %_llgo_2, %_llgo_8
|
||||
%31 = load i64, ptr %15, align 4
|
||||
%32 = call i32 (ptr, ...) @printf(ptr @4)
|
||||
%33 = and i64 %31, 2
|
||||
%34 = icmp ne i64 %33, 0
|
||||
br i1 %34, label %_llgo_10, label %_llgo_11
|
||||
|
||||
_llgo_7: ; preds = %_llgo_13
|
||||
call void @"github.com/goplus/llgo/internal/runtime.Rethrow"(ptr %8)
|
||||
unreachable
|
||||
|
||||
_llgo_8: ; preds = %_llgo_0
|
||||
store ptr blockaddress(@main, %_llgo_7), ptr %16, align 8
|
||||
br label %_llgo_6
|
||||
|
||||
_llgo_9: ; preds = %_llgo_13
|
||||
ret i32 0
|
||||
|
||||
_llgo_10: ; preds = %_llgo_6
|
||||
%35 = call i32 (ptr, ...) @printf(ptr @3)
|
||||
br label %_llgo_11
|
||||
|
||||
_llgo_11: ; preds = %_llgo_10, %_llgo_6
|
||||
%36 = and i64 %31, 1
|
||||
%37 = icmp ne i64 %36, 0
|
||||
br i1 %37, label %_llgo_12, label %_llgo_13
|
||||
|
||||
_llgo_12: ; preds = %_llgo_11
|
||||
%38 = call i32 (ptr, ...) @printf(ptr @1, ptr %26)
|
||||
br label %_llgo_13
|
||||
|
||||
_llgo_13: ; preds = %_llgo_12, %_llgo_11
|
||||
%39 = load %"github.com/goplus/llgo/internal/runtime.Defer", ptr %10, align 8
|
||||
%40 = extractvalue %"github.com/goplus/llgo/internal/runtime.Defer" %39, 2
|
||||
%41 = call i32 @pthread_setspecific(i32 %7, ptr %40)
|
||||
%42 = load ptr, ptr %16, align 8
|
||||
indirectbr ptr %42, [label %_llgo_7, label %_llgo_9]
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr, %"github.com/goplus/llgo/internal/runtime.String")
|
||||
|
||||
declare i32 @printf(ptr, ...)
|
||||
|
||||
declare ptr @pthread_getspecific(i32)
|
||||
|
||||
declare i32 @pthread_setspecific(i32, ptr)
|
||||
|
||||
declare i32 @sigsetjmp(ptr, i32)
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.Rethrow"(ptr)
|
||||
|
||||
define void @"main.init$after"() {
|
||||
_llgo_0:
|
||||
%0 = load i32, ptr @__llgo_defer, align 4
|
||||
%1 = icmp eq i32 %0, 0
|
||||
br i1 %1, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%2 = call i32 @pthread_key_create(ptr @__llgo_defer, ptr null)
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i32 @pthread_key_create(ptr, ptr)
|
||||
@@ -21,11 +21,42 @@ import (
|
||||
"go/constant"
|
||||
"go/types"
|
||||
"testing"
|
||||
"unsafe"
|
||||
|
||||
llssa "github.com/goplus/llgo/ssa"
|
||||
"golang.org/x/tools/go/ssa"
|
||||
)
|
||||
|
||||
func TestIsAllocVargs(t *testing.T) {
|
||||
if isAllocVargs(nil, ssaAlloc(&ssa.Return{})) {
|
||||
t.Fatal("isVargs?")
|
||||
}
|
||||
if isAllocVargs(nil, ssaAlloc(ssaSlice(&ssa.Go{}))) {
|
||||
t.Fatal("isVargs?")
|
||||
}
|
||||
if isAllocVargs(nil, ssaAlloc(ssaSlice(&ssa.Return{}))) {
|
||||
t.Fatal("isVargs?")
|
||||
}
|
||||
}
|
||||
|
||||
func ssaSlice(refs ...ssa.Instruction) *ssa.Slice {
|
||||
a := &ssa.Slice{}
|
||||
setRefs(unsafe.Pointer(a), refs...)
|
||||
return a
|
||||
}
|
||||
|
||||
func ssaAlloc(refs ...ssa.Instruction) *ssa.Alloc {
|
||||
a := &ssa.Alloc{}
|
||||
setRefs(unsafe.Pointer(a), refs...)
|
||||
return a
|
||||
}
|
||||
|
||||
func setRefs(v unsafe.Pointer, refs ...ssa.Instruction) {
|
||||
off := unsafe.Offsetof(ssa.Alloc{}.Comment) - unsafe.Sizeof([]int(nil))
|
||||
ptr := uintptr(v) + off
|
||||
*(*[]ssa.Instruction)(unsafe.Pointer(ptr)) = refs
|
||||
}
|
||||
|
||||
func TestRecvTypeName(t *testing.T) {
|
||||
if ret := recvTypeName(&ast.IndexExpr{
|
||||
X: &ast.Ident{Name: "Pointer"},
|
||||
@@ -121,6 +152,12 @@ func TestPkgKind(t *testing.T) {
|
||||
if v, _ := pkgKind(""); v != PkgLLGo {
|
||||
t.Fatal("pkgKind:", v)
|
||||
}
|
||||
if v, _ := pkgKind("decl"); v != PkgDeclOnly {
|
||||
t.Fatal("pkgKind:", v)
|
||||
}
|
||||
if v, _ := pkgKind("decl: test.ll"); v != PkgDeclOnly {
|
||||
t.Fatal("pkgKind:", v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPkgKindOf(t *testing.T) {
|
||||
|
||||
@@ -432,12 +432,10 @@ func intVal(v ssa.Value) int64 {
|
||||
panic("intVal: ssa.Value is not a const int")
|
||||
}
|
||||
|
||||
func (p *context) isVArgs(vx ssa.Value) (ret []llssa.Expr, ok bool) {
|
||||
switch vx := vx.(type) {
|
||||
func (p *context) isVArgs(v ssa.Value) (ret []llssa.Expr, ok bool) {
|
||||
switch v := v.(type) {
|
||||
case *ssa.Alloc:
|
||||
ret, ok = p.vargs[vx] // varargs: this is a varargs index
|
||||
case *ssa.Const:
|
||||
ok = vx.Value == nil
|
||||
ret, ok = p.vargs[v] // varargs: this is a varargs index
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -445,7 +443,7 @@ func (p *context) isVArgs(vx ssa.Value) (ret []llssa.Expr, ok bool) {
|
||||
func (p *context) checkVArgs(v *ssa.Alloc, t *types.Pointer) bool {
|
||||
if v.Comment == "varargs" { // this maybe a varargs allocation
|
||||
if arr, ok := t.Elem().(*types.Array); ok {
|
||||
if isAny(arr.Elem()) && isVargs(p, v) {
|
||||
if isAny(arr.Elem()) && isAllocVargs(p, v) {
|
||||
p.vargs[v] = make([]llssa.Expr, arr.Len())
|
||||
return true
|
||||
}
|
||||
@@ -454,15 +452,24 @@ func (p *context) checkVArgs(v *ssa.Alloc, t *types.Pointer) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func isVargs(ctx *context, v *ssa.Alloc) bool {
|
||||
func isAllocVargs(ctx *context, v *ssa.Alloc) bool {
|
||||
refs := *v.Referrers()
|
||||
n := len(refs)
|
||||
lastref := refs[n-1]
|
||||
if i, ok := lastref.(*ssa.Slice); ok {
|
||||
if refs = *i.Referrers(); len(refs) == 1 {
|
||||
if call, ok := refs[0].(*ssa.Call); ok {
|
||||
return ctx.funcKind(call.Call.Value) == fnHasVArg
|
||||
var call *ssa.CallCommon
|
||||
switch ref := refs[0].(type) {
|
||||
case *ssa.Call:
|
||||
call = &ref.Call
|
||||
case *ssa.Defer:
|
||||
call = &ref.Call
|
||||
case *ssa.Go:
|
||||
call = &ref.Call
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return ctx.funcKind(call.Value) == fnHasVArg
|
||||
}
|
||||
}
|
||||
return false
|
||||
@@ -786,6 +793,9 @@ func (p *context) compileInstrOrValue(b llssa.Builder, iv instrOrValue, asValue
|
||||
t := v.Type()
|
||||
x := p.compileValue(b, v.X)
|
||||
ret = b.ChangeInterface(p.prog.Type(t, llssa.InGo), x)
|
||||
case *ssa.Field:
|
||||
x := p.compileValue(b, v.X)
|
||||
ret = b.Field(x, v.Field)
|
||||
default:
|
||||
panic(fmt.Sprintf("compileInstrAndValue: unknown instr - %T\n", iv))
|
||||
}
|
||||
|
||||
@@ -341,6 +341,9 @@ func linkMainPkg(pkg *packages.Package, pkgs []*aPackage, runtimeFiles []string,
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Run()
|
||||
if s := cmd.ProcessState; s != nil {
|
||||
os.Exit(s.ExitCode())
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -131,5 +131,5 @@ func genZip(dir string, outFile, inFile string) {
|
||||
}
|
||||
|
||||
func inCompilerDir(dir string) bool {
|
||||
return strings.Contains(dir, "/llgo/cl/")
|
||||
return strings.Contains(dir, "/cl/_test")
|
||||
}
|
||||
|
||||
@@ -268,6 +268,9 @@ func IfacePtrData(i iface) unsafe.Pointer {
|
||||
|
||||
// Implements reports whether the type V implements the interface type T.
|
||||
func Implements(T, V *abi.Type) bool {
|
||||
if V == nil {
|
||||
return false
|
||||
}
|
||||
if T.Kind() != abi.Interface {
|
||||
return false
|
||||
}
|
||||
@@ -322,4 +325,95 @@ func Implements(T, V *abi.Type) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func EfaceEqual(v, u eface) bool {
|
||||
if v.Kind() == abi.Interface {
|
||||
v = v.Elem()
|
||||
}
|
||||
if u.Kind() == abi.Interface {
|
||||
u = u.Elem()
|
||||
}
|
||||
if v._type == nil || u._type == nil {
|
||||
return v._type == u._type
|
||||
}
|
||||
if v._type != u._type {
|
||||
return false
|
||||
}
|
||||
if v._type.Kind_&abi.KindDirectIface != 0 {
|
||||
return v.data == u.data
|
||||
}
|
||||
switch v.Kind() {
|
||||
case abi.Bool,
|
||||
abi.Int, abi.Int8, abi.Int16, abi.Int32, abi.Int64,
|
||||
abi.Uint, abi.Uint8, abi.Uint16, abi.Uint32, abi.Uint64, abi.Uintptr,
|
||||
abi.Float32, abi.Float64:
|
||||
return *(*uintptr)(v.data) == *(*uintptr)(u.data)
|
||||
case abi.Complex64, abi.Complex128:
|
||||
panic("TODO complex")
|
||||
case abi.String:
|
||||
return *(*string)(v.data) == *(*string)(u.data)
|
||||
case abi.Pointer, abi.UnsafePointer:
|
||||
return v.data == u.data
|
||||
case abi.Array:
|
||||
n := v._type.Len()
|
||||
tt := v._type.ArrayType()
|
||||
index := func(data unsafe.Pointer, i int) eface {
|
||||
offset := i * int(tt.Elem.Size_)
|
||||
return eface{tt.Elem, c.Advance(data, offset)}
|
||||
}
|
||||
for i := 0; i < n; i++ {
|
||||
if !EfaceEqual(index(v.data, i), index(u.data, i)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
case abi.Struct:
|
||||
st := v._type.StructType()
|
||||
field := func(data unsafe.Pointer, ft *abi.StructField) eface {
|
||||
return eface{ft.Typ, c.Advance(data, int(ft.Offset))}
|
||||
}
|
||||
for _, ft := range st.Fields {
|
||||
if !EfaceEqual(field(v.data, &ft), field(u.data, &ft)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
case abi.Func, abi.Map, abi.Slice:
|
||||
break
|
||||
}
|
||||
panic("not comparable")
|
||||
}
|
||||
|
||||
func (v eface) Kind() abi.Kind {
|
||||
if v._type == nil {
|
||||
return abi.Invalid
|
||||
}
|
||||
return v._type.Kind()
|
||||
}
|
||||
|
||||
func (v eface) Elem() eface {
|
||||
switch v.Kind() {
|
||||
case abi.Interface:
|
||||
var i any
|
||||
tt := (*abi.InterfaceType)(unsafe.Pointer(v._type))
|
||||
if len(tt.Methods) == 0 {
|
||||
i = *(*any)(v.data)
|
||||
} else {
|
||||
i = (any)(*(*interface {
|
||||
M()
|
||||
})(v.data))
|
||||
}
|
||||
return *(*eface)(unsafe.Pointer(&i))
|
||||
case abi.Pointer:
|
||||
ptr := v.data
|
||||
if v._type.Kind_&abi.KindDirectIface != 0 {
|
||||
ptr = *(*unsafe.Pointer)(ptr)
|
||||
}
|
||||
if ptr == nil {
|
||||
return eface{}
|
||||
}
|
||||
return eface{v._type.Elem(), ptr}
|
||||
}
|
||||
panic("invalid eface elem")
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -166,6 +166,9 @@ func (b *Builder) TypeName(t types.Type) (ret string, pub bool) {
|
||||
|
||||
// PathOf returns the package path of the specified package.
|
||||
func PathOf(pkg *types.Package) string {
|
||||
if pkg == nil {
|
||||
return ""
|
||||
}
|
||||
if pkg.Name() == "main" {
|
||||
return "main"
|
||||
}
|
||||
@@ -174,6 +177,9 @@ func PathOf(pkg *types.Package) string {
|
||||
|
||||
// FullName returns the full name of a package member.
|
||||
func FullName(pkg *types.Package, name string) string {
|
||||
if pkg == nil {
|
||||
return name
|
||||
}
|
||||
return PathOf(pkg) + "." + name
|
||||
}
|
||||
|
||||
|
||||
@@ -118,11 +118,9 @@ func (b Builder) abiMethods(t *types.Named) (ret, pret int) {
|
||||
}
|
||||
|
||||
// Method{name string, typ *FuncType, ifn, tfn abi.Text}
|
||||
func (b Builder) abiMethodOf(m *types.Func /*, bg Background = InGo */) (mthd, ptrMthd Expr) {
|
||||
func (b Builder) abiMethodOf(m types.Object, mSig *types.Signature /*, bg Background = InGo */) (mthd, ptrMthd Expr) {
|
||||
prog := b.Prog
|
||||
mPkg, mName := m.Pkg(), m.Name()
|
||||
mSig := m.Type().(*types.Signature)
|
||||
|
||||
name := b.Str(mName).impl
|
||||
if !token.IsExported(mName) {
|
||||
name = b.Str(abi.FullName(mPkg, m.Name())).impl
|
||||
@@ -217,8 +215,12 @@ func (b Builder) abiInitNamed(ret Expr, t *types.Named) func() Expr {
|
||||
var mthds []Expr
|
||||
var ptrMthds = make([]Expr, 0, n)
|
||||
for i := 0; i < n; i++ {
|
||||
m := mset[i].Obj().(*types.Func)
|
||||
mthd, ptrMthd := b.abiMethodOf(m)
|
||||
m := mset[i]
|
||||
sig := m.Obj().(*types.Func).Type().(*types.Signature)
|
||||
if _, ok := sig.Recv().Type().Underlying().(*types.Interface); ok {
|
||||
sig = m.Type().(*types.Signature)
|
||||
}
|
||||
mthd, ptrMthd := b.abiMethodOf(m.Obj(), sig)
|
||||
if !mthd.IsNil() {
|
||||
mthds = append(mthds, mthd)
|
||||
}
|
||||
|
||||
16
ssa/expr.go
16
ssa/expr.go
@@ -421,6 +421,22 @@ func (b Builder) BinOp(op token.Token, x, y Expr) Expr {
|
||||
ret.impl = llvm.CreateNot(b.impl, ret.impl)
|
||||
return ret
|
||||
}
|
||||
case vkIface, vkEface:
|
||||
prog := b.Prog
|
||||
toEface := func(x Expr, emtpy bool) Expr {
|
||||
if emtpy {
|
||||
return x
|
||||
}
|
||||
return Expr{b.unsafeEface(b.faceAbiType(x).impl, b.faceData(x.impl)), prog.rtType("Eface")}
|
||||
}
|
||||
switch op {
|
||||
case token.EQL:
|
||||
return b.InlineCall(b.Pkg.rtFunc("EfaceEqual"), toEface(x, x.kind == vkEface), toEface(y, y.kind == vkEface))
|
||||
case token.NEQ:
|
||||
ret := b.InlineCall(b.Pkg.rtFunc("EfaceEqual"), toEface(x, x.kind == vkEface), toEface(y, y.kind == vkEface))
|
||||
ret.impl = llvm.CreateNot(b.impl, ret.impl)
|
||||
return ret
|
||||
}
|
||||
}
|
||||
}
|
||||
panic("todo")
|
||||
|
||||
@@ -238,11 +238,7 @@ func (b Builder) TypeAssert(x Expr, assertedTyp Type, commaOk bool) Expr {
|
||||
var eq Expr
|
||||
var val func() Expr
|
||||
if rawIntf, ok := assertedTyp.raw.Type.Underlying().(*types.Interface); ok {
|
||||
if rawIntf.Empty() {
|
||||
eq = b.Prog.BoolVal(true)
|
||||
} else {
|
||||
eq = b.InlineCall(b.Pkg.rtFunc("Implements"), tabi, tx)
|
||||
}
|
||||
eq = b.InlineCall(b.Pkg.rtFunc("Implements"), tabi, tx)
|
||||
val = func() Expr { return Expr{b.unsafeInterface(rawIntf, tx, b.faceData(x.impl)), assertedTyp} }
|
||||
} else {
|
||||
eq = b.BinOp(token.EQL, tx, tabi)
|
||||
|
||||
@@ -128,6 +128,7 @@ func (p goTypes) cvtNamed(t *types.Named) (raw *types.Named, cvt bool) {
|
||||
named.SetUnderlying(tund)
|
||||
return named, true
|
||||
}
|
||||
p.typs[unsafe.Pointer(t)] = unsafe.Pointer(t)
|
||||
return t, false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user