move out c/cpp/py
This commit is contained in:
17
cl/_testgo/allocinloop/in.go
Normal file
17
cl/_testgo/allocinloop/in.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
func Foo(s string) int {
|
||||
return len(s)
|
||||
}
|
||||
|
||||
func Test() {
|
||||
j := 0
|
||||
for i := 0; i < 10000000; i++ {
|
||||
j += Foo("hello")
|
||||
}
|
||||
println(j)
|
||||
}
|
||||
|
||||
func main() {
|
||||
Test()
|
||||
}
|
||||
58
cl/_testgo/allocinloop/out.ll
Normal file
58
cl/_testgo/allocinloop/out.ll
Normal file
@@ -0,0 +1,58 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/allocinloop'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/allocinloop"
|
||||
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/allocinloop.init$guard" = global i1 false, align 1
|
||||
@0 = private unnamed_addr constant [5 x i8] c"hello", align 1
|
||||
|
||||
define i64 @"github.com/goplus/llgo/cl/_testgo/allocinloop.Foo"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %0) {
|
||||
_llgo_0:
|
||||
%1 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.String" %0, 1
|
||||
ret i64 %1
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/allocinloop.Test"() {
|
||||
_llgo_0:
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
%0 = phi i64 [ 0, %_llgo_0 ], [ %4, %_llgo_2 ]
|
||||
%1 = phi i64 [ 0, %_llgo_0 ], [ %5, %_llgo_2 ]
|
||||
%2 = icmp slt i64 %1, 10000000
|
||||
br i1 %2, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1
|
||||
%3 = call i64 @"github.com/goplus/llgo/cl/_testgo/allocinloop.Foo"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 })
|
||||
%4 = add i64 %0, %3
|
||||
%5 = add i64 %1, 1
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_3: ; preds = %_llgo_1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %0)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/allocinloop.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/allocinloop.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/allocinloop.init$guard", align 1
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/allocinloop.main"() {
|
||||
_llgo_0:
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/allocinloop.Test"()
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
55
cl/_testgo/cgobasic/cgobasic.go
Normal file
55
cl/_testgo/cgobasic/cgobasic.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// C.CString example
|
||||
cstr := C.CString("Hello, World!")
|
||||
C.puts(cstr)
|
||||
|
||||
// C.CBytes example
|
||||
bytes := []byte{65, 66, 67, 68} // ABCD
|
||||
cbytes := C.CBytes(bytes)
|
||||
|
||||
// C.GoString example
|
||||
gostr := C.GoString(cstr)
|
||||
println("Converted back to Go string: ", gostr)
|
||||
|
||||
// C.GoStringN example (with length limit)
|
||||
gostringN := C.GoStringN(cstr, 5) // only take first 5 characters
|
||||
println("Length-limited string: ", gostringN)
|
||||
|
||||
// C.GoBytes example
|
||||
gobytes := C.GoBytes(cbytes, 4) // 4 is the length
|
||||
println("Converted back to Go byte slice: ", gobytes)
|
||||
|
||||
// C math library examples
|
||||
x := 2.0
|
||||
// Calculate square root
|
||||
sqrtResult := C.sqrt(C.double(x))
|
||||
fmt.Printf("sqrt(%v) = %v\n", x, float64(sqrtResult))
|
||||
|
||||
// Calculate sine
|
||||
sinResult := C.sin(C.double(x))
|
||||
fmt.Printf("sin(%v) = %v\n", x, float64(sinResult))
|
||||
|
||||
// Calculate cosine
|
||||
cosResult := C.cos(C.double(x))
|
||||
fmt.Printf("cos(%v) = %v\n", x, float64(cosResult))
|
||||
|
||||
// Calculate natural logarithm
|
||||
logResult := C.log(C.double(x))
|
||||
fmt.Printf("log(%v) = %v\n", x, float64(logResult))
|
||||
|
||||
C.free(unsafe.Pointer(cstr))
|
||||
C.free(cbytes)
|
||||
}
|
||||
1
cl/_testgo/cgobasic/out.ll
Normal file
1
cl/_testgo/cgobasic/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
15
cl/_testgo/cgocfiles/cgocfiles.go
Normal file
15
cl/_testgo/cgocfiles/cgocfiles.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#include "in.h"
|
||||
*/
|
||||
import "C"
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
r := C.test_structs(&C.s4{a: 1}, &C.s8{a: 1, b: 2}, &C.s12{a: 1, b: 2, c: 3}, &C.s16{a: 1, b: 2, c: 3, d: 4}, &C.s20{a: 1, b: 2, c: 3, d: 4, e: 5})
|
||||
fmt.Println(r)
|
||||
if r != 35 {
|
||||
panic("test_structs failed")
|
||||
}
|
||||
}
|
||||
12
cl/_testgo/cgocfiles/in.c
Normal file
12
cl/_testgo/cgocfiles/in.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <stdio.h>
|
||||
#include "in.h"
|
||||
|
||||
int test_structs(s4* s4, s8* s8, s12* s12, s16* s16, s20* s20) {
|
||||
printf("s4.a: %d\n", s4->a);
|
||||
printf("s8.a: %d, s8.b: %d\n", s8->a, s8->b);
|
||||
printf("s12.a: %d, s12.b: %d, s12.c: %d\n", s12->a, s12->b, s12->c);
|
||||
printf("s16.a: %d, s16.b: %d, s16.c: %d, s16.d: %d\n", s16->a, s16->b, s16->c, s16->d);
|
||||
printf("s20.a: %d, s20.b: %d, s20.c: %d, s20.d: %d, s20.e: %d\n", s20->a, s20->b, s20->c, s20->d, s20->e);
|
||||
|
||||
return s4->a + s8->a + s8->b + s12->a + s12->b + s12->c + s16->a + s16->b + s16->c + s16->d + s20->a + s20->b + s20->c + s20->d + s20->e;
|
||||
}
|
||||
33
cl/_testgo/cgocfiles/in.h
Normal file
33
cl/_testgo/cgocfiles/in.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
} s4;
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
int b;
|
||||
} s8;
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
} s12;
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
int d;
|
||||
} s16;
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
int d;
|
||||
int e;
|
||||
} s20;
|
||||
|
||||
extern int test_structs(s4* s4, s8* s8, s12* s12, s16* s16, s20* s20);
|
||||
1
cl/_testgo/cgocfiles/out.ll
Normal file
1
cl/_testgo/cgocfiles/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
11
cl/_testgo/cgodefer/cgodefer.go
Normal file
11
cl/_testgo/cgodefer/cgodefer.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#include <stdlib.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
func main() {
|
||||
p := C.malloc(1024)
|
||||
defer C.free(p)
|
||||
}
|
||||
1
cl/_testgo/cgodefer/out.ll
Normal file
1
cl/_testgo/cgodefer/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
16
cl/_testgo/cgofull/bar.go
Normal file
16
cl/_testgo/cgofull/bar.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#cgo CFLAGS: -DBAR
|
||||
#include <stdio.h>
|
||||
#include "foo.h"
|
||||
static void foo(Foo* f) {
|
||||
printf("foo in bar: %d\n", f->a);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
func Bar(f *C.Foo) {
|
||||
C.print_foo(f)
|
||||
C.foo(f)
|
||||
}
|
||||
157
cl/_testgo/cgofull/cgofull.go
Normal file
157
cl/_testgo/cgofull/cgofull.go
Normal file
@@ -0,0 +1,157 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#cgo windows,!amd64 CFLAGS: -D_WIN32
|
||||
#cgo !windows CFLAGS: -D_POSIX
|
||||
#cgo windows,amd64 CFLAGS: -D_WIN64
|
||||
#cgo linux,amd64 CFLAGS: -D_LINUX64
|
||||
#cgo !windows,amd64 CFLAGS: -D_UNIX64
|
||||
#cgo pkg-config: python3-embed
|
||||
#include <stdio.h>
|
||||
#include <Python.h>
|
||||
#include "foo.h"
|
||||
typedef struct {
|
||||
int a;
|
||||
} s4;
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
int b;
|
||||
} s8;
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
} s12;
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
int d;
|
||||
} s16;
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
int d;
|
||||
int e;
|
||||
} s20;
|
||||
|
||||
static int test_structs(s4* s4, s8* s8, s12* s12, s16* s16, s20* s20) {
|
||||
printf("s4.a: %d\n", s4->a);
|
||||
printf("s8.a: %d, s8.b: %d\n", s8->a, s8->b);
|
||||
printf("s12.a: %d, s12.b: %d, s12.c: %d\n", s12->a, s12->b, s12->c);
|
||||
printf("s16.a: %d, s16.b: %d, s16.c: %d, s16.d: %d\n", s16->a, s16->b, s16->c, s16->d);
|
||||
printf("s20.a: %d, s20.b: %d, s20.c: %d, s20.d: %d, s20.e: %d\n", s20->a, s20->b, s20->c, s20->d, s20->e);
|
||||
|
||||
return s4->a + s8->a + s8->b + s12->a + s12->b + s12->c + s16->a + s16->b + s16->c + s16->d + s20->a + s20->b + s20->c + s20->d + s20->e;
|
||||
}
|
||||
|
||||
static void test_macros() {
|
||||
#ifdef FOO
|
||||
printf("FOO is defined\n");
|
||||
#endif
|
||||
#ifdef BAR
|
||||
printf("BAR is defined\n");
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
printf("WIN32 is defined\n");
|
||||
#endif
|
||||
#ifdef _POSIX
|
||||
printf("POSIX is defined\n");
|
||||
#endif
|
||||
#ifdef _WIN64
|
||||
printf("WIN64 is defined\n");
|
||||
#endif
|
||||
#ifdef _LINUX64
|
||||
printf("LINUX64 is defined\n");
|
||||
#endif
|
||||
#ifdef _UNIX64
|
||||
printf("UNIX64 is defined\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
#define MY_VERSION "1.0.0"
|
||||
#define MY_CODE 0x12345678
|
||||
|
||||
static void test_void() {
|
||||
printf("test_void\n");
|
||||
}
|
||||
|
||||
typedef int (*Cb)(int);
|
||||
|
||||
extern int go_callback(int);
|
||||
|
||||
extern int c_callback(int i);
|
||||
|
||||
static void test_callback(Cb cb) {
|
||||
printf("test_callback, cb: %p, go_callback: %p, c_callback: %p\n", cb, go_callback, c_callback);
|
||||
printf("test_callback, *cb: %p, *go_callback: %p, *c_callback: %p\n", *(void**)cb, *(void**)(go_callback), *(void**)(c_callback));
|
||||
printf("cb result: %d\n", cb(123));
|
||||
printf("done\n");
|
||||
}
|
||||
|
||||
extern int go_callback_not_use_in_go(int);
|
||||
|
||||
static void run_callback() {
|
||||
test_callback(c_callback);
|
||||
test_callback(go_callback_not_use_in_go);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
|
||||
"github.com/goplus/llgo/cl/_testgo/cgofull/pymod1"
|
||||
"github.com/goplus/llgo/cl/_testgo/cgofull/pymod2"
|
||||
)
|
||||
|
||||
//export go_callback_not_use_in_go
|
||||
func go_callback_not_use_in_go(i C.int) C.int {
|
||||
return i + 1
|
||||
}
|
||||
|
||||
//export go_callback
|
||||
func go_callback(i C.int) C.int {
|
||||
return i + 1
|
||||
}
|
||||
|
||||
func main() {
|
||||
runPy()
|
||||
f := &C.Foo{a: 1}
|
||||
Foo(f)
|
||||
Bar(f)
|
||||
C.test_macros()
|
||||
r := C.test_structs(&C.s4{a: 1}, &C.s8{a: 1, b: 2}, &C.s12{a: 1, b: 2, c: 3}, &C.s16{a: 1, b: 2, c: 3, d: 4}, &C.s20{a: 1, b: 2, c: 3, d: 4, e: 5})
|
||||
fmt.Println(r)
|
||||
if r != 35 {
|
||||
panic("test_structs failed")
|
||||
}
|
||||
fmt.Println(C.MY_VERSION)
|
||||
fmt.Println(int(C.MY_CODE))
|
||||
C.test_void()
|
||||
|
||||
println("call run_callback")
|
||||
C.run_callback()
|
||||
|
||||
// test _Cgo_ptr and _cgoCheckResult
|
||||
println("call with go_callback")
|
||||
C.test_callback((C.Cb)(C.go_callback))
|
||||
|
||||
println("call with c_callback")
|
||||
C.test_callback((C.Cb)(C.c_callback))
|
||||
}
|
||||
|
||||
func runPy() {
|
||||
Initialize()
|
||||
defer Finalize()
|
||||
Run("print('Hello, Python!')")
|
||||
C.PyObject_Print((*C.PyObject)(unsafe.Pointer(pymod1.Float(1.23))), C.stderr, 0)
|
||||
C.PyObject_Print((*C.PyObject)(unsafe.Pointer(pymod2.Long(123))), C.stdout, 0)
|
||||
// test _Cgo_use
|
||||
C.PyObject_Print((*C.PyObject)(unsafe.Pointer(C.PyComplex_FromDoubles(C.double(1.23), C.double(4.56)))), C.stdout, 0)
|
||||
}
|
||||
12
cl/_testgo/cgofull/foo.c
Normal file
12
cl/_testgo/cgofull/foo.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <stdio.h>
|
||||
#include "foo.h"
|
||||
|
||||
void print_foo(Foo *f)
|
||||
{
|
||||
printf("print_foo: %d\n", f->a);
|
||||
}
|
||||
|
||||
int c_callback(int i)
|
||||
{
|
||||
return i + 1;
|
||||
}
|
||||
16
cl/_testgo/cgofull/foo.go
Normal file
16
cl/_testgo/cgofull/foo.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#cgo CFLAGS: -DFOO
|
||||
#include <stdio.h>
|
||||
#include "foo.h"
|
||||
static void foo(Foo* f) {
|
||||
printf("foo in bar: %d\n", f->a);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
func Foo(f *C.Foo) {
|
||||
C.print_foo(f)
|
||||
C.foo(f)
|
||||
}
|
||||
7
cl/_testgo/cgofull/foo.h
Normal file
7
cl/_testgo/cgofull/foo.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
} Foo;
|
||||
|
||||
extern void print_foo(Foo* f);
|
||||
1
cl/_testgo/cgofull/out.ll
Normal file
1
cl/_testgo/cgofull/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
24
cl/_testgo/cgofull/py.go
Normal file
24
cl/_testgo/cgofull/py.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#cgo pkg-config: python3-embed
|
||||
#include <Python.h>
|
||||
*/
|
||||
import "C"
|
||||
import "fmt"
|
||||
|
||||
func Initialize() {
|
||||
C.Py_Initialize()
|
||||
}
|
||||
|
||||
func Finalize() {
|
||||
C.Py_Finalize()
|
||||
}
|
||||
|
||||
func Run(code string) error {
|
||||
if C.PyRun_SimpleString(C.CString(code)) != 0 {
|
||||
C.PyErr_Print()
|
||||
return fmt.Errorf("failed to run code")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
11
cl/_testgo/cgofull/pymod1/pymod1.go
Normal file
11
cl/_testgo/cgofull/pymod1/pymod1.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package pymod1
|
||||
|
||||
/*
|
||||
#cgo pkg-config: python3-embed
|
||||
#include <Python.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
func Float(f float64) *C.PyObject {
|
||||
return C.PyFloat_FromDouble(C.double(f))
|
||||
}
|
||||
11
cl/_testgo/cgofull/pymod2/pymod2.go
Normal file
11
cl/_testgo/cgofull/pymod2/pymod2.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package pymod2
|
||||
|
||||
/*
|
||||
#cgo pkg-config: python3-embed
|
||||
#include <Python.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
func Long(l int64) *C.PyObject {
|
||||
return C.PyLong_FromLongLong(C.longlong(l))
|
||||
}
|
||||
31
cl/_testgo/cgomacro/cgomacro.go
Normal file
31
cl/_testgo/cgomacro/cgomacro.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#cgo pkg-config: python3-embed
|
||||
#include <stdio.h>
|
||||
#include <Python.h>
|
||||
|
||||
void test_stdout() {
|
||||
printf("stdout ptr: %p\n", stdout);
|
||||
fputs("outputs to stdout\n", stdout);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"github.com/goplus/lib/c"
|
||||
)
|
||||
|
||||
func main() {
|
||||
C.test_stdout()
|
||||
C.fputs((*C.char)(unsafe.Pointer(c.Str("hello\n"))), C.stdout)
|
||||
C.Py_Initialize()
|
||||
defer C.Py_Finalize()
|
||||
C.PyObject_Print(C.Py_True, C.stdout, 0)
|
||||
C.fputs((*C.char)(unsafe.Pointer(c.Str("\n"))), C.stdout)
|
||||
C.PyObject_Print(C.Py_False, C.stdout, 0)
|
||||
C.fputs((*C.char)(unsafe.Pointer(c.Str("\n"))), C.stdout)
|
||||
C.PyObject_Print(C.Py_None, C.stdout, 0)
|
||||
C.fputs((*C.char)(unsafe.Pointer(c.Str("\n"))), C.stdout)
|
||||
}
|
||||
1
cl/_testgo/cgomacro/out.ll
Normal file
1
cl/_testgo/cgomacro/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
13
cl/_testgo/cgopython/cgopython.go
Normal file
13
cl/_testgo/cgopython/cgopython.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#cgo pkg-config: python3-embed
|
||||
#include <Python.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
func main() {
|
||||
C.Py_Initialize()
|
||||
defer C.Py_Finalize()
|
||||
C.PyRun_SimpleString(C.CString("print('Hello, Python!')"))
|
||||
}
|
||||
1
cl/_testgo/cgopython/out.ll
Normal file
1
cl/_testgo/cgopython/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
19
cl/_testgo/chan/in.go
Normal file
19
cl/_testgo/chan/in.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
ch := make(chan int, 10)
|
||||
var v any = ch
|
||||
println(ch, len(ch), cap(ch), v)
|
||||
go func() {
|
||||
ch <- 100
|
||||
}()
|
||||
n := <-ch
|
||||
println(n)
|
||||
|
||||
ch2 := make(chan int, 10)
|
||||
go func() {
|
||||
close(ch2)
|
||||
}()
|
||||
n2, ok := <-ch2
|
||||
println(n2, ok)
|
||||
}
|
||||
1
cl/_testgo/chan/out.ll
Normal file
1
cl/_testgo/chan/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
15
cl/_testgo/closure/in.go
Normal file
15
cl/_testgo/closure/in.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package main
|
||||
|
||||
type T func(n int)
|
||||
|
||||
func main() {
|
||||
var env string = "env"
|
||||
var v1 T = func(i int) {
|
||||
println("func", i)
|
||||
}
|
||||
var v2 T = func(i int) {
|
||||
println("closure", i, env)
|
||||
}
|
||||
v1(100)
|
||||
v2(200)
|
||||
}
|
||||
80
cl/_testgo/closure/out.ll
Normal file
80
cl/_testgo/closure/out.ll
Normal file
@@ -0,0 +1,80 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/closure'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/closure"
|
||||
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/cl/_testgo/closure.T" = type { ptr, ptr }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/closure.init$guard" = global i1 false, align 1
|
||||
@0 = private unnamed_addr constant [3 x i8] c"env", align 1
|
||||
@1 = private unnamed_addr constant [4 x i8] c"func", align 1
|
||||
@2 = private unnamed_addr constant [7 x i8] c"closure", align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/closure.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/closure.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/closure.init$guard", align 1
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/closure.main"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 3 }, ptr %0, align 8
|
||||
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
|
||||
%2 = getelementptr inbounds { ptr }, ptr %1, i32 0, i32 0
|
||||
store ptr %0, ptr %2, align 8
|
||||
%3 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/cl/_testgo/closure.main$2", ptr undef }, ptr %1, 1
|
||||
%4 = alloca %"github.com/goplus/llgo/cl/_testgo/closure.T", align 8
|
||||
store { ptr, ptr } %3, ptr %4, align 8
|
||||
%5 = load %"github.com/goplus/llgo/cl/_testgo/closure.T", ptr %4, align 8
|
||||
call void @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/closure.main$1"(ptr null, i64 100)
|
||||
%6 = extractvalue %"github.com/goplus/llgo/cl/_testgo/closure.T" %5, 1
|
||||
%7 = extractvalue %"github.com/goplus/llgo/cl/_testgo/closure.T" %5, 0
|
||||
call void %7(ptr %6, i64 200)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/closure.main$1"(i64 %0) {
|
||||
_llgo_0:
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 4 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %0)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/closure.main$2"(ptr %0, i64 %1) {
|
||||
_llgo_0:
|
||||
%2 = load { ptr }, ptr %0, align 8
|
||||
%3 = extractvalue { ptr } %2, 0
|
||||
%4 = load %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr %3, align 8
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 7 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %1)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %4)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
||||
|
||||
define linkonce void @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/closure.main$1"(ptr %0, i64 %1) {
|
||||
_llgo_0:
|
||||
tail call void @"github.com/goplus/llgo/cl/_testgo/closure.main$1"(i64 %1)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
|
||||
11
cl/_testgo/closure2/in.go
Normal file
11
cl/_testgo/closure2/in.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
x := 1
|
||||
f := func(i int) func(int) {
|
||||
return func(i int) {
|
||||
println("closure", i, x)
|
||||
}
|
||||
}
|
||||
f(1)(2)
|
||||
}
|
||||
72
cl/_testgo/closure2/out.ll
Normal file
72
cl/_testgo/closure2/out.ll
Normal file
@@ -0,0 +1,72 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/closure2'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/closure2"
|
||||
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/closure2.init$guard" = global i1 false, align 1
|
||||
@0 = private unnamed_addr constant [7 x i8] c"closure", align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/closure2.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/closure2.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/closure2.init$guard", align 1
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/closure2.main"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
|
||||
store i64 1, ptr %0, align 4
|
||||
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
|
||||
%2 = getelementptr inbounds { ptr }, ptr %1, i32 0, i32 0
|
||||
store ptr %0, ptr %2, align 8
|
||||
%3 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/cl/_testgo/closure2.main$1", ptr undef }, ptr %1, 1
|
||||
%4 = extractvalue { ptr, ptr } %3, 1
|
||||
%5 = extractvalue { ptr, ptr } %3, 0
|
||||
%6 = call { ptr, ptr } %5(ptr %4, i64 1)
|
||||
%7 = extractvalue { ptr, ptr } %6, 1
|
||||
%8 = extractvalue { ptr, ptr } %6, 0
|
||||
call void %8(ptr %7, i64 2)
|
||||
ret void
|
||||
}
|
||||
|
||||
define { ptr, ptr } @"github.com/goplus/llgo/cl/_testgo/closure2.main$1"(ptr %0, i64 %1) {
|
||||
_llgo_0:
|
||||
%2 = load { ptr }, ptr %0, align 8
|
||||
%3 = extractvalue { ptr } %2, 0
|
||||
%4 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
|
||||
%5 = getelementptr inbounds { ptr }, ptr %4, i32 0, i32 0
|
||||
store ptr %3, ptr %5, align 8
|
||||
%6 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/cl/_testgo/closure2.main$1$1", ptr undef }, ptr %4, 1
|
||||
ret { ptr, ptr } %6
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/closure2.main$1$1"(ptr %0, i64 %1) {
|
||||
_llgo_0:
|
||||
%2 = load { ptr }, ptr %0, align 8
|
||||
%3 = extractvalue { ptr } %2, 0
|
||||
%4 = load i64, ptr %3, align 4
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 7 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %1)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %4)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
|
||||
9
cl/_testgo/constconv/in.go
Normal file
9
cl/_testgo/constconv/in.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
var i64 int64 = 1
|
||||
var u64 uint64 = 1
|
||||
var c int64 = i64 + (1.0 / (1.0 / 10))
|
||||
var d uint64 = u64 + (1.0 / (1.0 / 10))
|
||||
println(u64, i64, c, d)
|
||||
}
|
||||
36
cl/_testgo/constconv/out.ll
Normal file
36
cl/_testgo/constconv/out.ll
Normal file
@@ -0,0 +1,36 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/constconv'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/constconv"
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/constconv.init$guard" = global i1 false, align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/constconv.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/constconv.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/constconv.init$guard", align 1
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/constconv.main"() {
|
||||
_llgo_0:
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 1)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 1)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 11)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 11)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
|
||||
18
cl/_testgo/defer1/in.go
Normal file
18
cl/_testgo/defer1/in.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
func f(s string) bool {
|
||||
return len(s) > 2
|
||||
}
|
||||
|
||||
func main() {
|
||||
defer func() {
|
||||
println("hi")
|
||||
}()
|
||||
if s := "hello"; f(s) {
|
||||
defer println(s)
|
||||
} else {
|
||||
defer println("world")
|
||||
return
|
||||
}
|
||||
defer println("bye")
|
||||
}
|
||||
1
cl/_testgo/defer1/out.ll
Normal file
1
cl/_testgo/defer1/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
15
cl/_testgo/defer2/in.go
Normal file
15
cl/_testgo/defer2/in.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package main
|
||||
|
||||
func f(s string) bool {
|
||||
return len(s) > 2
|
||||
}
|
||||
|
||||
func main() {
|
||||
if s := "hello"; f(s) {
|
||||
defer println(s)
|
||||
} else {
|
||||
defer println("world")
|
||||
return
|
||||
}
|
||||
defer println("bye")
|
||||
}
|
||||
1
cl/_testgo/defer2/out.ll
Normal file
1
cl/_testgo/defer2/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
24
cl/_testgo/defer3/in.go
Normal file
24
cl/_testgo/defer3/in.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
func f(s string) bool {
|
||||
return len(s) > 2
|
||||
}
|
||||
|
||||
func fail() {
|
||||
defer println("bye")
|
||||
panic("panic message")
|
||||
}
|
||||
|
||||
func main() {
|
||||
defer func() {
|
||||
println("hi")
|
||||
}()
|
||||
if s := "hello"; f(s) {
|
||||
defer println(s)
|
||||
} else {
|
||||
defer println("world")
|
||||
return
|
||||
}
|
||||
fail()
|
||||
println("unreachable")
|
||||
}
|
||||
1
cl/_testgo/defer3/out.ll
Normal file
1
cl/_testgo/defer3/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
29
cl/_testgo/defer4/in.go
Normal file
29
cl/_testgo/defer4/in.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
func f(s string) bool {
|
||||
return len(s) > 2
|
||||
}
|
||||
|
||||
func fail() {
|
||||
defer println("bye")
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
println("recover:", e.(string))
|
||||
}
|
||||
}()
|
||||
panic("panic message")
|
||||
}
|
||||
|
||||
func main() {
|
||||
defer func() {
|
||||
println("hi")
|
||||
}()
|
||||
if s := "hello"; f(s) {
|
||||
defer println(s)
|
||||
} else {
|
||||
defer println("world")
|
||||
return
|
||||
}
|
||||
fail()
|
||||
println("reachable")
|
||||
}
|
||||
1
cl/_testgo/defer4/out.ll
Normal file
1
cl/_testgo/defer4/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
17
cl/_testgo/defer5/in.go
Normal file
17
cl/_testgo/defer5/in.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
defer println("A")
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
println("in defer 1")
|
||||
panic("panic in defer 1")
|
||||
}
|
||||
}()
|
||||
defer func() {
|
||||
println("in defer 2")
|
||||
panic("panic in defer 2")
|
||||
}()
|
||||
defer println("B")
|
||||
panic("panic in main")
|
||||
}
|
||||
1
cl/_testgo/defer5/out.ll
Normal file
1
cl/_testgo/defer5/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
109
cl/_testgo/equal/in.go
Normal file
109
cl/_testgo/equal/in.go
Normal file
@@ -0,0 +1,109 @@
|
||||
package main
|
||||
|
||||
func test() {}
|
||||
|
||||
// func
|
||||
func init() {
|
||||
fn1 := test
|
||||
fn2 := func(i, j int) int { return i + j }
|
||||
var n int
|
||||
fn3 := func() { println(n) }
|
||||
var fn4 func() int
|
||||
assert(test != nil)
|
||||
assert(nil != test)
|
||||
assert(fn1 != nil)
|
||||
assert(nil != fn1)
|
||||
assert(fn2 != nil)
|
||||
assert(nil != fn2)
|
||||
assert(fn3 != nil)
|
||||
assert(nil != fn3)
|
||||
assert(fn4 == nil)
|
||||
assert(nil == fn4)
|
||||
}
|
||||
|
||||
// array
|
||||
func init() {
|
||||
assert([0]float64{} == [0]float64{})
|
||||
ar1 := [...]int{1, 2, 3}
|
||||
ar2 := [...]int{1, 2, 3}
|
||||
assert(ar1 == ar2)
|
||||
ar2[1] = 1
|
||||
assert(ar1 != ar2)
|
||||
}
|
||||
|
||||
type T struct {
|
||||
X int
|
||||
Y int
|
||||
Z string
|
||||
V any
|
||||
}
|
||||
|
||||
type N struct{}
|
||||
|
||||
// struct
|
||||
func init() {
|
||||
var n1, n2 N
|
||||
var t1, t2 T
|
||||
x := T{10, 20, "hello", 1}
|
||||
y := T{10, 20, "hello", 1}
|
||||
z := T{10, 20, "hello", "ok"}
|
||||
assert(n1 == n2)
|
||||
assert(t1 == t2)
|
||||
assert(x == y)
|
||||
assert(x != z)
|
||||
assert(y != z)
|
||||
}
|
||||
|
||||
// slice
|
||||
func init() {
|
||||
var a []int
|
||||
var b = []int{1, 2, 3}
|
||||
c := make([]int, 2)
|
||||
d := make([]int, 0, 2)
|
||||
assert(a == nil)
|
||||
assert(b != nil)
|
||||
assert(c != nil)
|
||||
assert(d != nil)
|
||||
b = nil
|
||||
assert(b == nil)
|
||||
}
|
||||
|
||||
// iface
|
||||
func init() {
|
||||
var a any = 100
|
||||
var b any = struct{}{}
|
||||
var c any = T{10, 20, "hello", 1}
|
||||
x := T{10, 20, "hello", 1}
|
||||
y := T{10, 20, "hello", "ok"}
|
||||
assert(a == 100)
|
||||
assert(b == struct{}{})
|
||||
assert(b != N{})
|
||||
assert(c == x)
|
||||
assert(c != y)
|
||||
}
|
||||
|
||||
// chan
|
||||
func init() {
|
||||
a := make(chan int)
|
||||
b := make(chan int)
|
||||
assert(a == a)
|
||||
assert(a != b)
|
||||
assert(a != nil)
|
||||
}
|
||||
|
||||
// map
|
||||
func init() {
|
||||
m1 := make(map[int]string)
|
||||
var m2 map[int]string
|
||||
assert(m1 != nil)
|
||||
assert(m2 == nil)
|
||||
}
|
||||
|
||||
func assert(cond bool) {
|
||||
if !cond {
|
||||
panic("failed")
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
}
|
||||
625
cl/_testgo/equal/out.ll
Normal file
625
cl/_testgo/equal/out.ll
Normal file
@@ -0,0 +1,625 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/equal'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/equal"
|
||||
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/cl/_testgo/equal.T" = type { i64, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.eface" }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"github.com/goplus/llgo/cl/_testgo/equal.N" = type {}
|
||||
%"github.com/goplus/llgo/runtime/abi.StructField" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1 }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/equal.init$guard" = global i1 false, align 1
|
||||
@0 = private unnamed_addr constant [6 x i8] c"failed", align 1
|
||||
@_llgo_string = linkonce global ptr null, align 8
|
||||
@1 = private unnamed_addr constant [5 x i8] c"hello", align 1
|
||||
@_llgo_int = linkonce global ptr null, align 8
|
||||
@2 = private unnamed_addr constant [2 x i8] c"ok", align 1
|
||||
@"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw" = linkonce global ptr null, align 8
|
||||
@3 = private unnamed_addr constant [39 x i8] c"github.com/goplus/llgo/cl/_testgo/equal", align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/equal.T" = linkonce global ptr null, align 8
|
||||
@4 = private unnamed_addr constant [1 x i8] c"T", align 1
|
||||
@_llgo_any = linkonce global ptr null, align 8
|
||||
@"_llgo_struct$5D_KhR3tDEp-wpx9caTiVZca43wS-XW6slE9Bsr8rsk" = linkonce global ptr null, align 8
|
||||
@5 = private unnamed_addr constant [1 x i8] c"X", align 1
|
||||
@6 = private unnamed_addr constant [1 x i8] c"Y", align 1
|
||||
@7 = private unnamed_addr constant [1 x i8] c"Z", align 1
|
||||
@8 = private unnamed_addr constant [1 x i8] c"V", align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/equal.N" = linkonce global ptr null, align 8
|
||||
@9 = private unnamed_addr constant [1 x i8] c"N", align 1
|
||||
@"map[_llgo_int]_llgo_string" = linkonce global ptr null, align 8
|
||||
@10 = private unnamed_addr constant [7 x i8] c"topbits", align 1
|
||||
@11 = private unnamed_addr constant [4 x i8] c"keys", align 1
|
||||
@12 = private unnamed_addr constant [5 x i8] c"elems", align 1
|
||||
@13 = private unnamed_addr constant [8 x i8] c"overflow", align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %0) {
|
||||
_llgo_0:
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%1 = load ptr, ptr @_llgo_string, align 8
|
||||
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 6 }, ptr %2, align 8
|
||||
%3 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %1, 0
|
||||
%4 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %3, ptr %2, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %4)
|
||||
unreachable
|
||||
|
||||
_llgo_2: ; preds = %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/equal.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/equal.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.init$after"()
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.init#1"()
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.init#2"()
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.init#3"()
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.init#4"()
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.init#5"()
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.init#6"()
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.init#7"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.init#1"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
|
||||
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
|
||||
%2 = getelementptr inbounds { ptr }, ptr %1, i32 0, i32 0
|
||||
store ptr %0, ptr %2, align 8
|
||||
%3 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/cl/_testgo/equal.init#1$2", ptr undef }, ptr %1, 1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
%4 = extractvalue { ptr, ptr } %3, 0
|
||||
%5 = icmp ne ptr %4, null
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %5)
|
||||
%6 = extractvalue { ptr, ptr } %3, 0
|
||||
%7 = icmp ne ptr null, %6
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %7)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
ret void
|
||||
}
|
||||
|
||||
define i64 @"github.com/goplus/llgo/cl/_testgo/equal.init#1$1"(i64 %0, i64 %1) {
|
||||
_llgo_0:
|
||||
%2 = add i64 %0, %1
|
||||
ret i64 %2
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.init#1$2"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load { ptr }, ptr %0, align 8
|
||||
%2 = extractvalue { ptr } %1, 0
|
||||
%3 = load i64, ptr %2, align 4
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %3)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.init#2"() {
|
||||
_llgo_0:
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
%0 = alloca [3 x i64], align 8
|
||||
call void @llvm.memset(ptr %0, i8 0, i64 24, i1 false)
|
||||
%1 = getelementptr inbounds i64, ptr %0, i64 0
|
||||
%2 = getelementptr inbounds i64, ptr %0, i64 1
|
||||
%3 = getelementptr inbounds i64, ptr %0, i64 2
|
||||
store i64 1, ptr %1, align 4
|
||||
store i64 2, ptr %2, align 4
|
||||
store i64 3, ptr %3, align 4
|
||||
%4 = alloca [3 x i64], align 8
|
||||
call void @llvm.memset(ptr %4, i8 0, i64 24, i1 false)
|
||||
%5 = getelementptr inbounds i64, ptr %4, i64 0
|
||||
%6 = getelementptr inbounds i64, ptr %4, i64 1
|
||||
%7 = getelementptr inbounds i64, ptr %4, i64 2
|
||||
store i64 1, ptr %5, align 4
|
||||
store i64 2, ptr %6, align 4
|
||||
store i64 3, ptr %7, align 4
|
||||
%8 = load [3 x i64], ptr %0, align 4
|
||||
%9 = load [3 x i64], ptr %4, align 4
|
||||
%10 = extractvalue [3 x i64] %8, 0
|
||||
%11 = extractvalue [3 x i64] %9, 0
|
||||
%12 = icmp eq i64 %10, %11
|
||||
%13 = and i1 true, %12
|
||||
%14 = extractvalue [3 x i64] %8, 1
|
||||
%15 = extractvalue [3 x i64] %9, 1
|
||||
%16 = icmp eq i64 %14, %15
|
||||
%17 = and i1 %13, %16
|
||||
%18 = extractvalue [3 x i64] %8, 2
|
||||
%19 = extractvalue [3 x i64] %9, 2
|
||||
%20 = icmp eq i64 %18, %19
|
||||
%21 = and i1 %17, %20
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %21)
|
||||
%22 = getelementptr inbounds i64, ptr %4, i64 1
|
||||
store i64 1, ptr %22, align 4
|
||||
%23 = load [3 x i64], ptr %0, align 4
|
||||
%24 = load [3 x i64], ptr %4, align 4
|
||||
%25 = extractvalue [3 x i64] %23, 0
|
||||
%26 = extractvalue [3 x i64] %24, 0
|
||||
%27 = icmp eq i64 %25, %26
|
||||
%28 = and i1 true, %27
|
||||
%29 = extractvalue [3 x i64] %23, 1
|
||||
%30 = extractvalue [3 x i64] %24, 1
|
||||
%31 = icmp eq i64 %29, %30
|
||||
%32 = and i1 %28, %31
|
||||
%33 = extractvalue [3 x i64] %23, 2
|
||||
%34 = extractvalue [3 x i64] %24, 2
|
||||
%35 = icmp eq i64 %33, %34
|
||||
%36 = and i1 %32, %35
|
||||
%37 = xor i1 %36, true
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %37)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.init#3"() {
|
||||
_llgo_0:
|
||||
%0 = alloca %"github.com/goplus/llgo/cl/_testgo/equal.T", align 8
|
||||
call void @llvm.memset(ptr %0, i8 0, i64 48, i1 false)
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %0, i32 0, i32 0
|
||||
%2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %0, i32 0, i32 1
|
||||
%3 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %0, i32 0, i32 2
|
||||
%4 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %0, i32 0, i32 3
|
||||
store i64 10, ptr %1, align 4
|
||||
store i64 20, ptr %2, align 4
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 5 }, ptr %3, align 8
|
||||
%5 = load ptr, ptr @_llgo_int, align 8
|
||||
%6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %5, 0
|
||||
%7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr inttoptr (i64 1 to ptr), 1
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %7, ptr %4, align 8
|
||||
%8 = alloca %"github.com/goplus/llgo/cl/_testgo/equal.T", align 8
|
||||
call void @llvm.memset(ptr %8, i8 0, i64 48, i1 false)
|
||||
%9 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %8, i32 0, i32 0
|
||||
%10 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %8, i32 0, i32 1
|
||||
%11 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %8, i32 0, i32 2
|
||||
%12 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %8, i32 0, i32 3
|
||||
store i64 10, ptr %9, align 4
|
||||
store i64 20, ptr %10, align 4
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 5 }, ptr %11, align 8
|
||||
%13 = load ptr, ptr @_llgo_int, align 8
|
||||
%14 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %13, 0
|
||||
%15 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %14, ptr inttoptr (i64 1 to ptr), 1
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %15, ptr %12, align 8
|
||||
%16 = alloca %"github.com/goplus/llgo/cl/_testgo/equal.T", align 8
|
||||
call void @llvm.memset(ptr %16, i8 0, i64 48, i1 false)
|
||||
%17 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %16, i32 0, i32 0
|
||||
%18 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %16, i32 0, i32 1
|
||||
%19 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %16, i32 0, i32 2
|
||||
%20 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %16, i32 0, i32 3
|
||||
store i64 10, ptr %17, align 4
|
||||
store i64 20, ptr %18, align 4
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 5 }, ptr %19, align 8
|
||||
%21 = load ptr, ptr @_llgo_string, align 8
|
||||
%22 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 2 }, ptr %22, align 8
|
||||
%23 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %21, 0
|
||||
%24 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %23, ptr %22, 1
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %24, ptr %20, align 8
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
%25 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer)
|
||||
%26 = and i1 true, %25
|
||||
%27 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" zeroinitializer, %"github.com/goplus/llgo/runtime/internal/runtime.eface" zeroinitializer)
|
||||
%28 = and i1 %26, %27
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %28)
|
||||
%29 = load %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %0, align 8
|
||||
%30 = load %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %8, align 8
|
||||
%31 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %29, 0
|
||||
%32 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %30, 0
|
||||
%33 = icmp eq i64 %31, %32
|
||||
%34 = and i1 true, %33
|
||||
%35 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %29, 1
|
||||
%36 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %30, 1
|
||||
%37 = icmp eq i64 %35, %36
|
||||
%38 = and i1 %34, %37
|
||||
%39 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %29, 2
|
||||
%40 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %30, 2
|
||||
%41 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %39, %"github.com/goplus/llgo/runtime/internal/runtime.String" %40)
|
||||
%42 = and i1 %38, %41
|
||||
%43 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %29, 3
|
||||
%44 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %30, 3
|
||||
%45 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %43, %"github.com/goplus/llgo/runtime/internal/runtime.eface" %44)
|
||||
%46 = and i1 %42, %45
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %46)
|
||||
%47 = load %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %0, align 8
|
||||
%48 = load %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %16, align 8
|
||||
%49 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %47, 0
|
||||
%50 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %48, 0
|
||||
%51 = icmp eq i64 %49, %50
|
||||
%52 = and i1 true, %51
|
||||
%53 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %47, 1
|
||||
%54 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %48, 1
|
||||
%55 = icmp eq i64 %53, %54
|
||||
%56 = and i1 %52, %55
|
||||
%57 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %47, 2
|
||||
%58 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %48, 2
|
||||
%59 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %57, %"github.com/goplus/llgo/runtime/internal/runtime.String" %58)
|
||||
%60 = and i1 %56, %59
|
||||
%61 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %47, 3
|
||||
%62 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %48, 3
|
||||
%63 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %61, %"github.com/goplus/llgo/runtime/internal/runtime.eface" %62)
|
||||
%64 = and i1 %60, %63
|
||||
%65 = xor i1 %64, true
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %65)
|
||||
%66 = load %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %8, align 8
|
||||
%67 = load %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %16, align 8
|
||||
%68 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %66, 0
|
||||
%69 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %67, 0
|
||||
%70 = icmp eq i64 %68, %69
|
||||
%71 = and i1 true, %70
|
||||
%72 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %66, 1
|
||||
%73 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %67, 1
|
||||
%74 = icmp eq i64 %72, %73
|
||||
%75 = and i1 %71, %74
|
||||
%76 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %66, 2
|
||||
%77 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %67, 2
|
||||
%78 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %76, %"github.com/goplus/llgo/runtime/internal/runtime.String" %77)
|
||||
%79 = and i1 %75, %78
|
||||
%80 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %66, 3
|
||||
%81 = extractvalue %"github.com/goplus/llgo/cl/_testgo/equal.T" %67, 3
|
||||
%82 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %80, %"github.com/goplus/llgo/runtime/internal/runtime.eface" %81)
|
||||
%83 = and i1 %79, %82
|
||||
%84 = xor i1 %83, true
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %84)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.init#4"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 24)
|
||||
%1 = getelementptr inbounds i64, ptr %0, i64 0
|
||||
store i64 1, ptr %1, align 4
|
||||
%2 = getelementptr inbounds i64, ptr %0, i64 1
|
||||
store i64 2, ptr %2, align 4
|
||||
%3 = getelementptr inbounds i64, ptr %0, i64 2
|
||||
store i64 3, ptr %3, align 4
|
||||
%4 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %0, 0
|
||||
%5 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %4, i64 3, 1
|
||||
%6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %5, i64 3, 2
|
||||
%7 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 16)
|
||||
%8 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.NewSlice3"(ptr %7, i64 8, i64 2, i64 0, i64 2, i64 2)
|
||||
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 16)
|
||||
%10 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.NewSlice3"(ptr %9, i64 8, i64 2, i64 0, i64 0, i64 2)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
%11 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %6, 0
|
||||
%12 = icmp ne ptr %11, null
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %12)
|
||||
%13 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %8, 0
|
||||
%14 = icmp ne ptr %13, null
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %14)
|
||||
%15 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %10, 0
|
||||
%16 = icmp ne ptr %15, null
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %16)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.init#5"() {
|
||||
_llgo_0:
|
||||
%0 = load ptr, ptr @_llgo_int, align 8
|
||||
%1 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %0, 0
|
||||
%2 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %1, ptr inttoptr (i64 100 to ptr), 1
|
||||
%3 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
%4 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
store {} zeroinitializer, ptr %4, align 1
|
||||
%5 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %3, 0
|
||||
%6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %5, ptr %4, 1
|
||||
%7 = alloca %"github.com/goplus/llgo/cl/_testgo/equal.T", align 8
|
||||
call void @llvm.memset(ptr %7, i8 0, i64 48, i1 false)
|
||||
%8 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %7, i32 0, i32 0
|
||||
%9 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %7, i32 0, i32 1
|
||||
%10 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %7, i32 0, i32 2
|
||||
%11 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %7, i32 0, i32 3
|
||||
store i64 10, ptr %8, align 4
|
||||
store i64 20, ptr %9, align 4
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 5 }, ptr %10, align 8
|
||||
%12 = load ptr, ptr @_llgo_int, align 8
|
||||
%13 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %12, 0
|
||||
%14 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %13, ptr inttoptr (i64 1 to ptr), 1
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %14, ptr %11, align 8
|
||||
%15 = load %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %7, align 8
|
||||
%16 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/equal.T", align 8
|
||||
%17 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 48)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/equal.T" %15, ptr %17, align 8
|
||||
%18 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %16, 0
|
||||
%19 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %18, ptr %17, 1
|
||||
%20 = alloca %"github.com/goplus/llgo/cl/_testgo/equal.T", align 8
|
||||
call void @llvm.memset(ptr %20, i8 0, i64 48, i1 false)
|
||||
%21 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %20, i32 0, i32 0
|
||||
%22 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %20, i32 0, i32 1
|
||||
%23 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %20, i32 0, i32 2
|
||||
%24 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %20, i32 0, i32 3
|
||||
store i64 10, ptr %21, align 4
|
||||
store i64 20, ptr %22, align 4
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 5 }, ptr %23, align 8
|
||||
%25 = load ptr, ptr @_llgo_int, align 8
|
||||
%26 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %25, 0
|
||||
%27 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %26, ptr inttoptr (i64 1 to ptr), 1
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %27, ptr %24, align 8
|
||||
%28 = alloca %"github.com/goplus/llgo/cl/_testgo/equal.T", align 8
|
||||
call void @llvm.memset(ptr %28, i8 0, i64 48, i1 false)
|
||||
%29 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %28, i32 0, i32 0
|
||||
%30 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %28, i32 0, i32 1
|
||||
%31 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %28, i32 0, i32 2
|
||||
%32 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %28, i32 0, i32 3
|
||||
store i64 10, ptr %29, align 4
|
||||
store i64 20, ptr %30, align 4
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 5 }, ptr %31, align 8
|
||||
%33 = load ptr, ptr @_llgo_string, align 8
|
||||
%34 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 2 }, ptr %34, align 8
|
||||
%35 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %33, 0
|
||||
%36 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %35, ptr %34, 1
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %36, ptr %32, align 8
|
||||
%37 = load ptr, ptr @_llgo_int, align 8
|
||||
%38 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %37, 0
|
||||
%39 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %38, ptr inttoptr (i64 100 to ptr), 1
|
||||
%40 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %2, %"github.com/goplus/llgo/runtime/internal/runtime.eface" %39)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %40)
|
||||
%41 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
%42 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
store {} zeroinitializer, ptr %42, align 1
|
||||
%43 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %41, 0
|
||||
%44 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %43, ptr %42, 1
|
||||
%45 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, %"github.com/goplus/llgo/runtime/internal/runtime.eface" %44)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %45)
|
||||
%46 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/equal.N", align 8
|
||||
%47 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/equal.N" zeroinitializer, ptr %47, align 1
|
||||
%48 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %46, 0
|
||||
%49 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %48, ptr %47, 1
|
||||
%50 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, %"github.com/goplus/llgo/runtime/internal/runtime.eface" %49)
|
||||
%51 = xor i1 %50, true
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %51)
|
||||
%52 = load %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %20, align 8
|
||||
%53 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/equal.T", align 8
|
||||
%54 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 48)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/equal.T" %52, ptr %54, align 8
|
||||
%55 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %53, 0
|
||||
%56 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %55, ptr %54, 1
|
||||
%57 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %19, %"github.com/goplus/llgo/runtime/internal/runtime.eface" %56)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %57)
|
||||
%58 = load %"github.com/goplus/llgo/cl/_testgo/equal.T", ptr %28, align 8
|
||||
%59 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/equal.T", align 8
|
||||
%60 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 48)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/equal.T" %58, ptr %60, align 8
|
||||
%61 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %59, 0
|
||||
%62 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %61, ptr %60, 1
|
||||
%63 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %19, %"github.com/goplus/llgo/runtime/internal/runtime.eface" %62)
|
||||
%64 = xor i1 %63, true
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %64)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.init#6"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewChan"(i64 8, i64 0)
|
||||
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewChan"(i64 8, i64 0)
|
||||
%2 = icmp eq ptr %0, %0
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %2)
|
||||
%3 = icmp ne ptr %0, %1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %3)
|
||||
%4 = icmp ne ptr %0, null
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %4)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.init#7"() {
|
||||
_llgo_0:
|
||||
%0 = load ptr, ptr @"map[_llgo_int]_llgo_string", align 8
|
||||
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.MakeMap"(ptr %0, i64 0)
|
||||
%2 = icmp ne ptr %1, null
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 %2)
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/equal.assert"(i1 true)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.main"() {
|
||||
_llgo_0:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.test"() {
|
||||
_llgo_0:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/equal.init$after"() {
|
||||
_llgo_0:
|
||||
%0 = load ptr, ptr @_llgo_string, align 8
|
||||
%1 = icmp eq ptr %0, null
|
||||
br i1 %1, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
||||
store ptr %2, ptr @_llgo_string, align 8
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
%3 = load ptr, ptr @_llgo_int, 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/runtime/internal/runtime.Basic"(i64 34)
|
||||
store ptr %5, ptr @_llgo_int, align 8
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_4: ; preds = %_llgo_3, %_llgo_2
|
||||
%6 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %6, 0
|
||||
%8 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %7, i64 0, 1
|
||||
%9 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %8, i64 0, 2
|
||||
%10 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 39 }, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %9)
|
||||
store ptr %10, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
%11 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 39 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 1 }, i64 25, i64 48, i64 0, i64 0)
|
||||
%12 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/equal.T", align 8
|
||||
%13 = icmp eq ptr %12, null
|
||||
br i1 %13, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4
|
||||
store ptr %11, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/equal.T", align 8
|
||||
br label %_llgo_6
|
||||
|
||||
_llgo_6: ; preds = %_llgo_5, %_llgo_4
|
||||
%14 = load ptr, ptr @_llgo_any, align 8
|
||||
%15 = icmp eq ptr %14, null
|
||||
br i1 %15, label %_llgo_7, label %_llgo_8
|
||||
|
||||
_llgo_7: ; preds = %_llgo_6
|
||||
%16 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%17 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %16, 0
|
||||
%18 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %17, i64 0, 1
|
||||
%19 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %18, i64 0, 2
|
||||
%20 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 39 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %19)
|
||||
store ptr %20, ptr @_llgo_any, align 8
|
||||
br label %_llgo_8
|
||||
|
||||
_llgo_8: ; preds = %_llgo_7, %_llgo_6
|
||||
%21 = load ptr, ptr @_llgo_any, align 8
|
||||
%22 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34)
|
||||
%23 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 1 }, ptr %22, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%24 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34)
|
||||
%25 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 1 }, ptr %24, i64 8, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%26 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
||||
%27 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 1 }, ptr %26, i64 16, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%28 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%29 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %28, 0
|
||||
%30 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %29, i64 0, 1
|
||||
%31 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %30, i64 0, 2
|
||||
%32 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 39 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %31)
|
||||
%33 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @8, i64 1 }, ptr %32, i64 32, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%34 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 224)
|
||||
%35 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %34, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %23, ptr %35, align 8
|
||||
%36 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %34, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %25, ptr %36, align 8
|
||||
%37 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %34, i64 2
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %27, ptr %37, align 8
|
||||
%38 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %34, i64 3
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %33, ptr %38, align 8
|
||||
%39 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %34, 0
|
||||
%40 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %39, i64 4, 1
|
||||
%41 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %40, i64 4, 2
|
||||
%42 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 39 }, i64 48, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %41)
|
||||
store ptr %42, ptr @"_llgo_struct$5D_KhR3tDEp-wpx9caTiVZca43wS-XW6slE9Bsr8rsk", align 8
|
||||
%43 = load ptr, ptr @"_llgo_struct$5D_KhR3tDEp-wpx9caTiVZca43wS-XW6slE9Bsr8rsk", align 8
|
||||
br i1 %13, label %_llgo_9, label %_llgo_10
|
||||
|
||||
_llgo_9: ; preds = %_llgo_8
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %11, ptr %43, { ptr, i64, i64 } zeroinitializer, { ptr, i64, i64 } zeroinitializer)
|
||||
br label %_llgo_10
|
||||
|
||||
_llgo_10: ; preds = %_llgo_9, %_llgo_8
|
||||
%44 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 39 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @9, i64 1 }, i64 25, i64 0, i64 0, i64 0)
|
||||
%45 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/equal.N", align 8
|
||||
%46 = icmp eq ptr %45, null
|
||||
br i1 %46, label %_llgo_11, label %_llgo_12
|
||||
|
||||
_llgo_11: ; preds = %_llgo_10
|
||||
store ptr %44, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/equal.N", align 8
|
||||
br label %_llgo_12
|
||||
|
||||
_llgo_12: ; preds = %_llgo_11, %_llgo_10
|
||||
%47 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
br i1 %46, label %_llgo_13, label %_llgo_14
|
||||
|
||||
_llgo_13: ; preds = %_llgo_12
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %44, ptr %47, { ptr, i64, i64 } zeroinitializer, { ptr, i64, i64 } zeroinitializer)
|
||||
br label %_llgo_14
|
||||
|
||||
_llgo_14: ; preds = %_llgo_13, %_llgo_12
|
||||
%48 = load ptr, ptr @"map[_llgo_int]_llgo_string", align 8
|
||||
%49 = icmp eq ptr %48, null
|
||||
br i1 %49, label %_llgo_15, label %_llgo_16
|
||||
|
||||
_llgo_15: ; preds = %_llgo_14
|
||||
%50 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34)
|
||||
%51 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
||||
%52 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
|
||||
%53 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.ArrayOf"(i64 8, ptr %52)
|
||||
%54 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @10, i64 7 }, ptr %53, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%55 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34)
|
||||
%56 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.ArrayOf"(i64 8, ptr %55)
|
||||
%57 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @11, i64 4 }, ptr %56, i64 8, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%58 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
||||
%59 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.ArrayOf"(i64 8, ptr %58)
|
||||
%60 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @12, i64 5 }, ptr %59, i64 72, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%61 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 58)
|
||||
%62 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @13, i64 8 }, ptr %61, i64 200, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%63 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 224)
|
||||
%64 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %63, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %54, ptr %64, align 8
|
||||
%65 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %63, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %57, ptr %65, align 8
|
||||
%66 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %63, i64 2
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %60, ptr %66, align 8
|
||||
%67 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %63, i64 3
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %62, ptr %67, align 8
|
||||
%68 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %63, 0
|
||||
%69 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %68, i64 4, 1
|
||||
%70 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %69, i64 4, 2
|
||||
%71 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 39 }, i64 208, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %70)
|
||||
%72 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.MapOf"(ptr %50, ptr %51, ptr %71, i64 4)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %72)
|
||||
store ptr %72, ptr @"map[_llgo_int]_llgo_string", align 8
|
||||
br label %_llgo_16
|
||||
|
||||
_llgo_16: ; preds = %_llgo_15, %_llgo_14
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
|
||||
declare void @llvm.memset(ptr nocapture writeonly, i8, i64, i1 immarg) #0
|
||||
|
||||
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface", %"github.com/goplus/llgo/runtime/internal/runtime.eface")
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.NewSlice3"(ptr, i64, i64, i64, i64, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String", i64, %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String", i64, i64, i64, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr, ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewChan"(i64, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.MapOf"(ptr, ptr, ptr, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.ArrayOf"(i64, ptr)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.MakeMap"(ptr, i64)
|
||||
|
||||
attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
|
||||
22
cl/_testgo/errors/in.go
Normal file
22
cl/_testgo/errors/in.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
// New returns an error that formats as the given text.
|
||||
// Each call to New returns a distinct error value even if the text is identical.
|
||||
func New(text string) error {
|
||||
return &errorString{text}
|
||||
}
|
||||
|
||||
// errorString is a trivial implementation of error.
|
||||
type errorString struct {
|
||||
s string
|
||||
}
|
||||
|
||||
func (e *errorString) Error() string {
|
||||
return e.s
|
||||
}
|
||||
|
||||
func main() {
|
||||
err := New("an error")
|
||||
println(err)
|
||||
println(err.Error())
|
||||
}
|
||||
194
cl/_testgo/errors/out.ll
Normal file
194
cl/_testgo/errors/out.ll
Normal file
@@ -0,0 +1,194 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/errors'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/errors"
|
||||
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.iface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/cl/_testgo/errors.errorString" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String" }
|
||||
%"github.com/goplus/llgo/runtime/abi.StructField" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"github.com/goplus/llgo/runtime/abi.Method" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/abi.Imethod" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/errors.init$guard" = global i1 false, align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/errors.errorString" = linkonce global ptr null, align 8
|
||||
@0 = private unnamed_addr constant [40 x i8] c"github.com/goplus/llgo/cl/_testgo/errors", align 1
|
||||
@1 = private unnamed_addr constant [11 x i8] c"errorString", align 1
|
||||
@_llgo_string = linkonce global ptr null, align 8
|
||||
@"github.com/goplus/llgo/cl/_testgo/errors.struct$QTufDJA9wEDzuzgkA-ZSrLqW-B6lWN8O25mTSglAoLQ" = linkonce global ptr null, align 8
|
||||
@2 = private unnamed_addr constant [1 x i8] c"s", align 1
|
||||
@3 = private unnamed_addr constant [5 x i8] c"Error", align 1
|
||||
@"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to" = linkonce global ptr null, align 8
|
||||
@"*_llgo_github.com/goplus/llgo/cl/_testgo/errors.errorString" = linkonce global ptr null, align 8
|
||||
@"_llgo_iface$Fh8eUJ-Gw4e6TYuajcFIOSCuqSPKAt5nS4ow7xeGXEU" = linkonce global ptr null, align 8
|
||||
@4 = private unnamed_addr constant [8 x i8] c"an error", align 1
|
||||
|
||||
define %"github.com/goplus/llgo/runtime/internal/runtime.iface" @"github.com/goplus/llgo/cl/_testgo/errors.New"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %0) {
|
||||
_llgo_0:
|
||||
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 16)
|
||||
%2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/errors.errorString", ptr %1, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" %0, ptr %2, align 8
|
||||
%3 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/errors.errorString", align 8
|
||||
%4 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/errors.errorString", align 8
|
||||
%5 = load ptr, ptr @"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to", align 8
|
||||
%6 = load ptr, ptr @"_llgo_iface$Fh8eUJ-Gw4e6TYuajcFIOSCuqSPKAt5nS4ow7xeGXEU", align 8
|
||||
%7 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %6, ptr %4)
|
||||
%8 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %7, 0
|
||||
%9 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %8, ptr %1, 1
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.iface" %9
|
||||
}
|
||||
|
||||
define %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/cl/_testgo/errors.(*errorString).Error"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/errors.errorString", ptr %0, i32 0, i32 0
|
||||
%2 = load %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr %1, align 8
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.String" %2
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/errors.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/errors.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/errors.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/errors.init$after"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/errors.main"() {
|
||||
_llgo_0:
|
||||
%0 = call %"github.com/goplus/llgo/runtime/internal/runtime.iface" @"github.com/goplus/llgo/cl/_testgo/errors.New"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 8 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintIface"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %0)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %0)
|
||||
%2 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %0, 0
|
||||
%3 = getelementptr ptr, ptr %2, i64 3
|
||||
%4 = load ptr, ptr %3, align 8
|
||||
%5 = insertvalue { ptr, ptr } undef, ptr %4, 0
|
||||
%6 = insertvalue { ptr, ptr } %5, ptr %1, 1
|
||||
%7 = extractvalue { ptr, ptr } %6, 1
|
||||
%8 = extractvalue { ptr, ptr } %6, 0
|
||||
%9 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" %8(ptr %7)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %9)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/errors.init$after"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 11 }, i64 25, i64 16, i64 0, i64 1)
|
||||
store ptr %0, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/errors.errorString", align 8
|
||||
%1 = load ptr, ptr @_llgo_string, align 8
|
||||
%2 = icmp eq ptr %1, null
|
||||
br i1 %2, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
||||
store ptr %3, ptr @_llgo_string, align 8
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
%4 = load ptr, ptr @_llgo_string, align 8
|
||||
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
||||
%6 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 1 }, ptr %5, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%7 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 56)
|
||||
%8 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %7, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %6, ptr %8, align 8
|
||||
%9 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %7, 0
|
||||
%10 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %9, i64 1, 1
|
||||
%11 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %10, i64 1, 2
|
||||
%12 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, i64 16, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %11)
|
||||
store ptr %12, ptr @"github.com/goplus/llgo/cl/_testgo/errors.struct$QTufDJA9wEDzuzgkA-ZSrLqW-B6lWN8O25mTSglAoLQ", align 8
|
||||
%13 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/errors.struct$QTufDJA9wEDzuzgkA-ZSrLqW-B6lWN8O25mTSglAoLQ", align 8
|
||||
%14 = load ptr, ptr @_llgo_string, align 8
|
||||
%15 = load ptr, ptr @"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to", align 8
|
||||
%16 = icmp eq ptr %15, null
|
||||
br i1 %16, label %_llgo_3, label %_llgo_4
|
||||
|
||||
_llgo_3: ; preds = %_llgo_2
|
||||
%17 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%18 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %17, 0
|
||||
%19 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %18, i64 0, 1
|
||||
%20 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %19, i64 0, 2
|
||||
%21 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
|
||||
%22 = getelementptr ptr, ptr %21, i64 0
|
||||
store ptr %14, ptr %22, align 8
|
||||
%23 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %21, 0
|
||||
%24 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %23, i64 1, 1
|
||||
%25 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %24, i64 1, 2
|
||||
%26 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %20, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %25, i1 false)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %26)
|
||||
store ptr %26, ptr @"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to", align 8
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_4: ; preds = %_llgo_3, %_llgo_2
|
||||
%27 = load ptr, ptr @"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to", align 8
|
||||
%28 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 5 }, ptr undef, ptr undef, ptr undef }, ptr %27, 1
|
||||
%29 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %28, ptr @"github.com/goplus/llgo/cl/_testgo/errors.(*errorString).Error", 2
|
||||
%30 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %29, ptr @"github.com/goplus/llgo/cl/_testgo/errors.(*errorString).Error", 3
|
||||
%31 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 40)
|
||||
%32 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %31, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %30, ptr %32, align 8
|
||||
%33 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %31, 0
|
||||
%34 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %33, i64 1, 1
|
||||
%35 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %34, i64 1, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %0, ptr %13, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %35)
|
||||
%36 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 11 }, i64 25, i64 16, i64 0, i64 1)
|
||||
%37 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %36)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %37)
|
||||
store ptr %37, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/errors.errorString", align 8
|
||||
%38 = load ptr, ptr @"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to", align 8
|
||||
%39 = load ptr, ptr @"_llgo_iface$Fh8eUJ-Gw4e6TYuajcFIOSCuqSPKAt5nS4ow7xeGXEU", align 8
|
||||
%40 = icmp eq ptr %39, null
|
||||
br i1 %40, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4
|
||||
%41 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 5 }, ptr undef }, ptr %38, 1
|
||||
%42 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 24)
|
||||
%43 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %42, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %41, ptr %43, align 8
|
||||
%44 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %42, 0
|
||||
%45 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %44, i64 1, 1
|
||||
%46 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %45, i64 1, 2
|
||||
%47 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %46)
|
||||
store ptr %47, ptr @"_llgo_iface$Fh8eUJ-Gw4e6TYuajcFIOSCuqSPKAt5nS4ow7xeGXEU", align 8
|
||||
br label %_llgo_6
|
||||
|
||||
_llgo_6: ; preds = %_llgo_5, %_llgo_4
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String", i64, i64, i64, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String", i64, %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr, ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr, ptr)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintIface"(%"github.com/goplus/llgo/runtime/internal/runtime.iface")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
57
cl/_testgo/goexit/in.go
Normal file
57
cl/_testgo/goexit/in.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func main() {
|
||||
demo1()
|
||||
demo2()
|
||||
demo3()
|
||||
}
|
||||
|
||||
func demo1() {
|
||||
ch := make(chan bool)
|
||||
go func() {
|
||||
defer func() {
|
||||
ch <- true
|
||||
}()
|
||||
runtime.Goexit()
|
||||
}()
|
||||
<-ch
|
||||
}
|
||||
|
||||
func demo2() {
|
||||
ch := make(chan bool)
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
panic("must nil")
|
||||
}
|
||||
ch <- true
|
||||
}()
|
||||
runtime.Goexit()
|
||||
}()
|
||||
<-ch
|
||||
}
|
||||
|
||||
func demo3() {
|
||||
ch := make(chan bool)
|
||||
go func() {
|
||||
defer func() {
|
||||
r := recover()
|
||||
if r != "error" {
|
||||
panic("must error")
|
||||
}
|
||||
ch <- true
|
||||
}()
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
panic("must nil")
|
||||
}
|
||||
panic("error")
|
||||
}()
|
||||
runtime.Goexit()
|
||||
}()
|
||||
<-ch
|
||||
}
|
||||
1
cl/_testgo/goexit/out.ll
Normal file
1
cl/_testgo/goexit/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
13
cl/_testgo/goroutine/in.go
Normal file
13
cl/_testgo/goroutine/in.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
done := false
|
||||
go println("hello")
|
||||
go func(s string) {
|
||||
println(s)
|
||||
done = true
|
||||
}("Hello, goroutine")
|
||||
for !done {
|
||||
print(".")
|
||||
}
|
||||
}
|
||||
102
cl/_testgo/goroutine/out.ll
Normal file
102
cl/_testgo/goroutine/out.ll
Normal file
@@ -0,0 +1,102 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/goroutine'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/goroutine"
|
||||
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/goroutine.init$guard" = global i1 false, align 1
|
||||
@0 = private unnamed_addr constant [5 x i8] c"hello", align 1
|
||||
@1 = private unnamed_addr constant [16 x i8] c"Hello, goroutine", align 1
|
||||
@2 = private unnamed_addr constant [1 x i8] c".", align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/goroutine.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/goroutine.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/goroutine.init$guard", align 1
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/goroutine.main"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 1)
|
||||
store i1 false, ptr %0, align 1
|
||||
%1 = call ptr @malloc(i64 16)
|
||||
%2 = getelementptr inbounds { %"github.com/goplus/llgo/runtime/internal/runtime.String" }, ptr %1, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %2, align 8
|
||||
%3 = alloca i8, i64 8, align 1
|
||||
%4 = call i32 @"github.com/goplus/llgo/runtime/internal/runtime.CreateThread"(ptr %3, ptr null, ptr @"github.com/goplus/llgo/cl/_testgo/goroutine._llgo_routine$1", ptr %1)
|
||||
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
|
||||
%6 = getelementptr inbounds { ptr }, ptr %5, i32 0, i32 0
|
||||
store ptr %0, ptr %6, align 8
|
||||
%7 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/cl/_testgo/goroutine.main$1", ptr undef }, ptr %5, 1
|
||||
%8 = call ptr @malloc(i64 32)
|
||||
%9 = getelementptr inbounds { { ptr, ptr }, %"github.com/goplus/llgo/runtime/internal/runtime.String" }, ptr %8, i32 0, i32 0
|
||||
store { ptr, ptr } %7, ptr %9, align 8
|
||||
%10 = getelementptr inbounds { { ptr, ptr }, %"github.com/goplus/llgo/runtime/internal/runtime.String" }, ptr %8, i32 0, i32 1
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 16 }, ptr %10, align 8
|
||||
%11 = alloca i8, i64 8, align 1
|
||||
%12 = call i32 @"github.com/goplus/llgo/runtime/internal/runtime.CreateThread"(ptr %11, ptr null, ptr @"github.com/goplus/llgo/cl/_testgo/goroutine._llgo_routine$2", ptr %8)
|
||||
br label %_llgo_3
|
||||
|
||||
_llgo_1: ; preds = %_llgo_3
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 1 })
|
||||
br label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_3
|
||||
ret void
|
||||
|
||||
_llgo_3: ; preds = %_llgo_1, %_llgo_0
|
||||
%13 = load i1, ptr %0, align 1
|
||||
br i1 %13, label %_llgo_2, label %_llgo_1
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/goroutine.main$1"(ptr %0, %"github.com/goplus/llgo/runtime/internal/runtime.String" %1) {
|
||||
_llgo_0:
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %1)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%2 = load { ptr }, ptr %0, align 8
|
||||
%3 = extractvalue { ptr } %2, 0
|
||||
store i1 true, ptr %3, align 1
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
define ptr @"github.com/goplus/llgo/cl/_testgo/goroutine._llgo_routine$1"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load { %"github.com/goplus/llgo/runtime/internal/runtime.String" }, ptr %0, align 8
|
||||
%2 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.String" } %1, 0
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %2)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
call void @free(ptr %0)
|
||||
ret ptr null
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @free(ptr)
|
||||
|
||||
declare i32 @"github.com/goplus/llgo/runtime/internal/runtime.CreateThread"(ptr, ptr, ptr, ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
define ptr @"github.com/goplus/llgo/cl/_testgo/goroutine._llgo_routine$2"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load { { ptr, ptr }, %"github.com/goplus/llgo/runtime/internal/runtime.String" }, ptr %0, align 8
|
||||
%2 = extractvalue { { ptr, ptr }, %"github.com/goplus/llgo/runtime/internal/runtime.String" } %1, 0
|
||||
%3 = extractvalue { { ptr, ptr }, %"github.com/goplus/llgo/runtime/internal/runtime.String" } %1, 1
|
||||
%4 = extractvalue { ptr, ptr } %2, 1
|
||||
%5 = extractvalue { ptr, ptr } %2, 0
|
||||
call void %5(ptr %4, %"github.com/goplus/llgo/runtime/internal/runtime.String" %3)
|
||||
call void @free(ptr %0)
|
||||
ret ptr null
|
||||
}
|
||||
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")
|
||||
}
|
||||
697
cl/_testgo/ifaceconv/out.ll
Normal file
697
cl/_testgo/ifaceconv/out.ll
Normal file
@@ -0,0 +1,697 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/ifaceconv'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/ifaceconv"
|
||||
|
||||
%"github.com/goplus/llgo/cl/_testgo/ifaceconv.C1" = type {}
|
||||
%"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2" = type {}
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.iface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"github.com/goplus/llgo/runtime/abi.Imethod" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr }
|
||||
%"github.com/goplus/llgo/runtime/abi.Method" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/abi.StructField" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1 }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/ifaceconv.init$guard" = global i1 false, align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I0" = linkonce global ptr null, align 8
|
||||
@0 = private unnamed_addr constant [43 x i8] c"github.com/goplus/llgo/cl/_testgo/ifaceconv", align 1
|
||||
@1 = private unnamed_addr constant [2 x i8] c"I0", align 1
|
||||
@2 = private unnamed_addr constant [21 x i8] c"nil i0.(I0) succeeded", align 1
|
||||
@_llgo_string = linkonce global ptr null, align 8
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I1" = linkonce global ptr null, align 8
|
||||
@3 = private unnamed_addr constant [2 x i8] c"I1", align 1
|
||||
@"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac" = linkonce global ptr null, align 8
|
||||
@4 = private unnamed_addr constant [45 x i8] c"github.com/goplus/llgo/cl/_testgo/ifaceconv.f", align 1
|
||||
@5 = private unnamed_addr constant [21 x i8] c"nil i1.(I1) succeeded", align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I2" = linkonce global ptr null, align 8
|
||||
@6 = private unnamed_addr constant [2 x i8] c"I2", align 1
|
||||
@7 = private unnamed_addr constant [45 x i8] c"github.com/goplus/llgo/cl/_testgo/ifaceconv.g", align 1
|
||||
@8 = private unnamed_addr constant [21 x i8] c"nil i2.(I2) succeeded", align 1
|
||||
@"github.com/goplus/llgo/cl/_testgo/ifaceconv.iface$brpgdLtIeRlPi8QUoTgPCXzlehUkncg7v9aITo-GsF4" = linkonce global ptr null, align 8
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.C1" = linkonce global ptr null, align 8
|
||||
@9 = private unnamed_addr constant [2 x i8] c"C1", align 1
|
||||
@"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw" = linkonce global ptr null, align 8
|
||||
@10 = private unnamed_addr constant [1 x i8] c"f", align 1
|
||||
@11 = private unnamed_addr constant [17 x i8] c"C1 i1.(I0) failed", align 1
|
||||
@"github.com/goplus/llgo/cl/_testgo/ifaceconv.iface$gZBF8fFlqIMZ9M6lT2VWPyc3eu5Co6j0WoKGIEgDPAw" = linkonce global ptr null, align 8
|
||||
@12 = private unnamed_addr constant [17 x i8] c"C1 i1.(I1) failed", align 1
|
||||
@13 = private unnamed_addr constant [20 x i8] c"C1 i1.(I2) succeeded", align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.C2" = linkonce global ptr null, align 8
|
||||
@14 = private unnamed_addr constant [2 x i8] c"C2", align 1
|
||||
@15 = private unnamed_addr constant [1 x i8] c"g", align 1
|
||||
@16 = private unnamed_addr constant [17 x i8] c"C2 i1.(I0) failed", align 1
|
||||
@17 = private unnamed_addr constant [17 x i8] c"C2 i1.(I1) failed", align 1
|
||||
@18 = private unnamed_addr constant [17 x i8] c"C2 i1.(I2) failed", align 1
|
||||
@19 = private unnamed_addr constant [17 x i8] c"C1 I0(i1) was nil", align 1
|
||||
@20 = private unnamed_addr constant [17 x i8] c"C1 I1(i1) was nil", align 1
|
||||
@21 = private unnamed_addr constant [4 x i8] c"pass", align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.C1.f"(%"github.com/goplus/llgo/cl/_testgo/ifaceconv.C1" %0) {
|
||||
_llgo_0:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C1).f"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load %"github.com/goplus/llgo/cl/_testgo/ifaceconv.C1", ptr %0, align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.C1.f"(%"github.com/goplus/llgo/cl/_testgo/ifaceconv.C1" %1)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2.f"(%"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2" %0) {
|
||||
_llgo_0:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2.g"(%"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2" %0) {
|
||||
_llgo_0:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C2).f"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load %"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2", ptr %0, align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2.f"(%"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2" %1)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C2).g"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load %"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2", ptr %0, align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2.g"(%"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2" %1)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.init$after"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.main"() {
|
||||
_llgo_0:
|
||||
%0 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I0", align 8
|
||||
br i1 true, label %_llgo_23, label %_llgo_24
|
||||
|
||||
_llgo_1: ; preds = %_llgo_25
|
||||
%1 = load ptr, ptr @_llgo_string, align 8
|
||||
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 21 }, ptr %2, align 8
|
||||
%3 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %1, 0
|
||||
%4 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %3, ptr %2, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %4)
|
||||
unreachable
|
||||
|
||||
_llgo_2: ; preds = %_llgo_25
|
||||
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" zeroinitializer)
|
||||
%6 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I1", align 8
|
||||
br i1 true, label %_llgo_26, label %_llgo_27
|
||||
|
||||
_llgo_3: ; preds = %_llgo_28
|
||||
%7 = load ptr, ptr @_llgo_string, align 8
|
||||
%8 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 21 }, ptr %8, align 8
|
||||
%9 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %7, 0
|
||||
%10 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %9, ptr %8, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %10)
|
||||
unreachable
|
||||
|
||||
_llgo_4: ; preds = %_llgo_28
|
||||
%11 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" zeroinitializer)
|
||||
%12 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I2", align 8
|
||||
br i1 true, label %_llgo_29, label %_llgo_30
|
||||
|
||||
_llgo_5: ; preds = %_llgo_31
|
||||
%13 = load ptr, ptr @_llgo_string, align 8
|
||||
%14 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @8, i64 21 }, ptr %14, align 8
|
||||
%15 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %13, 0
|
||||
%16 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %15, ptr %14, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %16)
|
||||
unreachable
|
||||
|
||||
_llgo_6: ; preds = %_llgo_31
|
||||
%17 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" zeroinitializer)
|
||||
%18 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %17, 0
|
||||
%19 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %18, ptr null, 1
|
||||
%20 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" zeroinitializer)
|
||||
%21 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %20, 0
|
||||
%22 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %21, ptr null, 1
|
||||
%23 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" zeroinitializer)
|
||||
%24 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.iface$brpgdLtIeRlPi8QUoTgPCXzlehUkncg7v9aITo-GsF4", align 8
|
||||
%25 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %24, ptr %23)
|
||||
%26 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %25, 0
|
||||
%27 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %26, ptr null, 1
|
||||
%28 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.C1", align 8
|
||||
%29 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/ifaceconv.C1" zeroinitializer, ptr %29, align 1
|
||||
%30 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.iface$brpgdLtIeRlPi8QUoTgPCXzlehUkncg7v9aITo-GsF4", align 8
|
||||
%31 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %30, ptr %28)
|
||||
%32 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %31, 0
|
||||
%33 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %32, ptr %29, 1
|
||||
%34 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %33)
|
||||
%35 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I0", align 8
|
||||
%36 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.Implements"(ptr %35, ptr %34)
|
||||
br i1 %36, label %_llgo_32, label %_llgo_33
|
||||
|
||||
_llgo_7: ; preds = %_llgo_34
|
||||
%37 = load ptr, ptr @_llgo_string, align 8
|
||||
%38 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @11, i64 17 }, ptr %38, align 8
|
||||
%39 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %37, 0
|
||||
%40 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %39, ptr %38, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %40)
|
||||
unreachable
|
||||
|
||||
_llgo_8: ; preds = %_llgo_34
|
||||
%41 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %33)
|
||||
%42 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I1", align 8
|
||||
br i1 true, label %_llgo_35, label %_llgo_36
|
||||
|
||||
_llgo_9: ; preds = %_llgo_37
|
||||
%43 = load ptr, ptr @_llgo_string, align 8
|
||||
%44 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @12, i64 17 }, ptr %44, align 8
|
||||
%45 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %43, 0
|
||||
%46 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %45, ptr %44, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %46)
|
||||
unreachable
|
||||
|
||||
_llgo_10: ; preds = %_llgo_37
|
||||
%47 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %33)
|
||||
%48 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I2", align 8
|
||||
%49 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.Implements"(ptr %48, ptr %47)
|
||||
br i1 %49, label %_llgo_38, label %_llgo_39
|
||||
|
||||
_llgo_11: ; preds = %_llgo_40
|
||||
%50 = load ptr, ptr @_llgo_string, align 8
|
||||
%51 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @13, i64 20 }, ptr %51, align 8
|
||||
%52 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %50, 0
|
||||
%53 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %52, ptr %51, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %53)
|
||||
unreachable
|
||||
|
||||
_llgo_12: ; preds = %_llgo_40
|
||||
%54 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.C2", align 8
|
||||
%55 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2" zeroinitializer, ptr %55, align 1
|
||||
%56 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.iface$brpgdLtIeRlPi8QUoTgPCXzlehUkncg7v9aITo-GsF4", align 8
|
||||
%57 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %56, ptr %54)
|
||||
%58 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %57, 0
|
||||
%59 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %58, ptr %55, 1
|
||||
%60 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %59)
|
||||
%61 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I0", align 8
|
||||
%62 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.Implements"(ptr %61, ptr %60)
|
||||
br i1 %62, label %_llgo_41, label %_llgo_42
|
||||
|
||||
_llgo_13: ; preds = %_llgo_43
|
||||
%63 = load ptr, ptr @_llgo_string, align 8
|
||||
%64 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @16, i64 17 }, ptr %64, align 8
|
||||
%65 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %63, 0
|
||||
%66 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %65, ptr %64, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %66)
|
||||
unreachable
|
||||
|
||||
_llgo_14: ; preds = %_llgo_43
|
||||
%67 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %59)
|
||||
%68 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I1", align 8
|
||||
br i1 true, label %_llgo_44, label %_llgo_45
|
||||
|
||||
_llgo_15: ; preds = %_llgo_46
|
||||
%69 = load ptr, ptr @_llgo_string, align 8
|
||||
%70 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @17, i64 17 }, ptr %70, align 8
|
||||
%71 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %69, 0
|
||||
%72 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %71, ptr %70, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %72)
|
||||
unreachable
|
||||
|
||||
_llgo_16: ; preds = %_llgo_46
|
||||
%73 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %59)
|
||||
%74 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I2", align 8
|
||||
%75 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.Implements"(ptr %74, ptr %73)
|
||||
br i1 %75, label %_llgo_47, label %_llgo_48
|
||||
|
||||
_llgo_17: ; preds = %_llgo_49
|
||||
%76 = load ptr, ptr @_llgo_string, align 8
|
||||
%77 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @18, i64 17 }, ptr %77, align 8
|
||||
%78 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %76, 0
|
||||
%79 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %78, ptr %77, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %79)
|
||||
unreachable
|
||||
|
||||
_llgo_18: ; preds = %_llgo_49
|
||||
%80 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.C1", align 8
|
||||
%81 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/ifaceconv.C1" zeroinitializer, ptr %81, align 1
|
||||
%82 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.iface$brpgdLtIeRlPi8QUoTgPCXzlehUkncg7v9aITo-GsF4", align 8
|
||||
%83 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %82, ptr %80)
|
||||
%84 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %83, 0
|
||||
%85 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %84, ptr %81, 1
|
||||
%86 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %85)
|
||||
%87 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %85, 1
|
||||
%88 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %86, 0
|
||||
%89 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %88, ptr %87, 1
|
||||
%90 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %89, %"github.com/goplus/llgo/runtime/internal/runtime.eface" zeroinitializer)
|
||||
br i1 %90, label %_llgo_19, label %_llgo_20
|
||||
|
||||
_llgo_19: ; preds = %_llgo_18
|
||||
%91 = load ptr, ptr @_llgo_string, align 8
|
||||
%92 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @19, i64 17 }, ptr %92, align 8
|
||||
%93 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %91, 0
|
||||
%94 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %93, ptr %92, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %94)
|
||||
unreachable
|
||||
|
||||
_llgo_20: ; preds = %_llgo_18
|
||||
%95 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %85)
|
||||
%96 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %85, 1
|
||||
%97 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %95, 0
|
||||
%98 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %97, ptr %96, 1
|
||||
%99 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" zeroinitializer)
|
||||
%100 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %99, 0
|
||||
%101 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %100, ptr null, 1
|
||||
%102 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %98, %"github.com/goplus/llgo/runtime/internal/runtime.eface" %101)
|
||||
br i1 %102, label %_llgo_21, label %_llgo_22
|
||||
|
||||
_llgo_21: ; preds = %_llgo_20
|
||||
%103 = load ptr, ptr @_llgo_string, align 8
|
||||
%104 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @20, i64 17 }, ptr %104, align 8
|
||||
%105 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %103, 0
|
||||
%106 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %105, ptr %104, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %106)
|
||||
unreachable
|
||||
|
||||
_llgo_22: ; preds = %_llgo_20
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @21, i64 4 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
|
||||
_llgo_23: ; preds = %_llgo_0
|
||||
br label %_llgo_25
|
||||
|
||||
_llgo_24: ; preds = %_llgo_0
|
||||
br label %_llgo_25
|
||||
|
||||
_llgo_25: ; preds = %_llgo_24, %_llgo_23
|
||||
%107 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } [ { %"github.com/goplus/llgo/runtime/internal/runtime.eface" zeroinitializer, i1 true }, %_llgo_23 ], [ zeroinitializer, %_llgo_24 ]
|
||||
%108 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } %107, 0
|
||||
%109 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } %107, 1
|
||||
br i1 %109, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_26: ; preds = %_llgo_2
|
||||
br label %_llgo_28
|
||||
|
||||
_llgo_27: ; preds = %_llgo_2
|
||||
br label %_llgo_28
|
||||
|
||||
_llgo_28: ; preds = %_llgo_27, %_llgo_26
|
||||
%110 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } [ { %"github.com/goplus/llgo/runtime/internal/runtime.iface" zeroinitializer, i1 true }, %_llgo_26 ], [ zeroinitializer, %_llgo_27 ]
|
||||
%111 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %110, 0
|
||||
%112 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %110, 1
|
||||
br i1 %112, label %_llgo_3, label %_llgo_4
|
||||
|
||||
_llgo_29: ; preds = %_llgo_4
|
||||
br label %_llgo_31
|
||||
|
||||
_llgo_30: ; preds = %_llgo_4
|
||||
br label %_llgo_31
|
||||
|
||||
_llgo_31: ; preds = %_llgo_30, %_llgo_29
|
||||
%113 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } [ { %"github.com/goplus/llgo/runtime/internal/runtime.iface" zeroinitializer, i1 true }, %_llgo_29 ], [ zeroinitializer, %_llgo_30 ]
|
||||
%114 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %113, 0
|
||||
%115 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %113, 1
|
||||
br i1 %115, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_32: ; preds = %_llgo_6
|
||||
%116 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %33, 1
|
||||
%117 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %34, 0
|
||||
%118 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %117, ptr %116, 1
|
||||
%119 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } undef, %"github.com/goplus/llgo/runtime/internal/runtime.eface" %118, 0
|
||||
%120 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } %119, i1 true, 1
|
||||
br label %_llgo_34
|
||||
|
||||
_llgo_33: ; preds = %_llgo_6
|
||||
br label %_llgo_34
|
||||
|
||||
_llgo_34: ; preds = %_llgo_33, %_llgo_32
|
||||
%121 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } [ %120, %_llgo_32 ], [ zeroinitializer, %_llgo_33 ]
|
||||
%122 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } %121, 0
|
||||
%123 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } %121, 1
|
||||
br i1 %123, label %_llgo_8, label %_llgo_7
|
||||
|
||||
_llgo_35: ; preds = %_llgo_8
|
||||
%124 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } undef, %"github.com/goplus/llgo/runtime/internal/runtime.iface" %33, 0
|
||||
%125 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %124, i1 true, 1
|
||||
br label %_llgo_37
|
||||
|
||||
_llgo_36: ; preds = %_llgo_8
|
||||
br label %_llgo_37
|
||||
|
||||
_llgo_37: ; preds = %_llgo_36, %_llgo_35
|
||||
%126 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } [ %125, %_llgo_35 ], [ zeroinitializer, %_llgo_36 ]
|
||||
%127 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %126, 0
|
||||
%128 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %126, 1
|
||||
br i1 %128, label %_llgo_10, label %_llgo_9
|
||||
|
||||
_llgo_38: ; preds = %_llgo_10
|
||||
%129 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %33, 1
|
||||
%130 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.iface$gZBF8fFlqIMZ9M6lT2VWPyc3eu5Co6j0WoKGIEgDPAw", align 8
|
||||
%131 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %130, ptr %47)
|
||||
%132 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %131, 0
|
||||
%133 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %132, ptr %129, 1
|
||||
%134 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } undef, %"github.com/goplus/llgo/runtime/internal/runtime.iface" %133, 0
|
||||
%135 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %134, i1 true, 1
|
||||
br label %_llgo_40
|
||||
|
||||
_llgo_39: ; preds = %_llgo_10
|
||||
br label %_llgo_40
|
||||
|
||||
_llgo_40: ; preds = %_llgo_39, %_llgo_38
|
||||
%136 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } [ %135, %_llgo_38 ], [ zeroinitializer, %_llgo_39 ]
|
||||
%137 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %136, 0
|
||||
%138 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %136, 1
|
||||
br i1 %138, label %_llgo_11, label %_llgo_12
|
||||
|
||||
_llgo_41: ; preds = %_llgo_12
|
||||
%139 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %59, 1
|
||||
%140 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %60, 0
|
||||
%141 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %140, ptr %139, 1
|
||||
%142 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } undef, %"github.com/goplus/llgo/runtime/internal/runtime.eface" %141, 0
|
||||
%143 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } %142, i1 true, 1
|
||||
br label %_llgo_43
|
||||
|
||||
_llgo_42: ; preds = %_llgo_12
|
||||
br label %_llgo_43
|
||||
|
||||
_llgo_43: ; preds = %_llgo_42, %_llgo_41
|
||||
%144 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } [ %143, %_llgo_41 ], [ zeroinitializer, %_llgo_42 ]
|
||||
%145 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } %144, 0
|
||||
%146 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.eface", i1 } %144, 1
|
||||
br i1 %146, label %_llgo_14, label %_llgo_13
|
||||
|
||||
_llgo_44: ; preds = %_llgo_14
|
||||
%147 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } undef, %"github.com/goplus/llgo/runtime/internal/runtime.iface" %59, 0
|
||||
%148 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %147, i1 true, 1
|
||||
br label %_llgo_46
|
||||
|
||||
_llgo_45: ; preds = %_llgo_14
|
||||
br label %_llgo_46
|
||||
|
||||
_llgo_46: ; preds = %_llgo_45, %_llgo_44
|
||||
%149 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } [ %148, %_llgo_44 ], [ zeroinitializer, %_llgo_45 ]
|
||||
%150 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %149, 0
|
||||
%151 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %149, 1
|
||||
br i1 %151, label %_llgo_16, label %_llgo_15
|
||||
|
||||
_llgo_47: ; preds = %_llgo_16
|
||||
%152 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %59, 1
|
||||
%153 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.iface$gZBF8fFlqIMZ9M6lT2VWPyc3eu5Co6j0WoKGIEgDPAw", align 8
|
||||
%154 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %153, ptr %73)
|
||||
%155 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %154, 0
|
||||
%156 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %155, ptr %152, 1
|
||||
%157 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } undef, %"github.com/goplus/llgo/runtime/internal/runtime.iface" %156, 0
|
||||
%158 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %157, i1 true, 1
|
||||
br label %_llgo_49
|
||||
|
||||
_llgo_48: ; preds = %_llgo_16
|
||||
br label %_llgo_49
|
||||
|
||||
_llgo_49: ; preds = %_llgo_48, %_llgo_47
|
||||
%159 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } [ %158, %_llgo_47 ], [ zeroinitializer, %_llgo_48 ]
|
||||
%160 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %159, 0
|
||||
%161 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %159, 1
|
||||
br i1 %161, label %_llgo_18, label %_llgo_17
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceconv.init$after"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamedInterface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 2 })
|
||||
%1 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I0", align 8
|
||||
%2 = icmp eq ptr %1, null
|
||||
br i1 %2, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store ptr %0, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I0", align 8
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
br i1 %2, label %_llgo_3, label %_llgo_4
|
||||
|
||||
_llgo_3: ; preds = %_llgo_2
|
||||
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%4 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %3, 0
|
||||
%5 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %4, i64 0, 1
|
||||
%6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %5, i64 0, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamedInterface"(ptr %0, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %6)
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_4: ; preds = %_llgo_3, %_llgo_2
|
||||
%7 = load ptr, ptr @_llgo_string, align 8
|
||||
%8 = icmp eq ptr %7, null
|
||||
br i1 %8, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4
|
||||
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
||||
store ptr %9, ptr @_llgo_string, align 8
|
||||
br label %_llgo_6
|
||||
|
||||
_llgo_6: ; preds = %_llgo_5, %_llgo_4
|
||||
%10 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamedInterface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 2 })
|
||||
%11 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I1", align 8
|
||||
%12 = icmp eq ptr %11, null
|
||||
br i1 %12, label %_llgo_7, label %_llgo_8
|
||||
|
||||
_llgo_7: ; preds = %_llgo_6
|
||||
store ptr %10, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I1", align 8
|
||||
br label %_llgo_8
|
||||
|
||||
_llgo_8: ; preds = %_llgo_7, %_llgo_6
|
||||
%13 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%14 = icmp eq ptr %13, null
|
||||
br i1 %14, label %_llgo_9, label %_llgo_10
|
||||
|
||||
_llgo_9: ; preds = %_llgo_8
|
||||
%15 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%16 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %15, 0
|
||||
%17 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %16, i64 0, 1
|
||||
%18 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %17, i64 0, 2
|
||||
%19 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%20 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %19, 0
|
||||
%21 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %20, i64 0, 1
|
||||
%22 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %21, i64 0, 2
|
||||
%23 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %18, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %22, i1 false)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %23)
|
||||
store ptr %23, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
br label %_llgo_10
|
||||
|
||||
_llgo_10: ; preds = %_llgo_9, %_llgo_8
|
||||
%24 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
br i1 %12, label %_llgo_11, label %_llgo_12
|
||||
|
||||
_llgo_11: ; preds = %_llgo_10
|
||||
%25 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 45 }, ptr undef }, ptr %24, 1
|
||||
%26 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 24)
|
||||
%27 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %26, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %25, ptr %27, align 8
|
||||
%28 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %26, 0
|
||||
%29 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %28, i64 1, 1
|
||||
%30 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %29, i64 1, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamedInterface"(ptr %10, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %30)
|
||||
br label %_llgo_12
|
||||
|
||||
_llgo_12: ; preds = %_llgo_11, %_llgo_10
|
||||
%31 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamedInterface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 2 })
|
||||
%32 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I2", align 8
|
||||
%33 = icmp eq ptr %32, null
|
||||
br i1 %33, label %_llgo_13, label %_llgo_14
|
||||
|
||||
_llgo_13: ; preds = %_llgo_12
|
||||
store ptr %31, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.I2", align 8
|
||||
br label %_llgo_14
|
||||
|
||||
_llgo_14: ; preds = %_llgo_13, %_llgo_12
|
||||
%34 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%35 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
br i1 %33, label %_llgo_15, label %_llgo_16
|
||||
|
||||
_llgo_15: ; preds = %_llgo_14
|
||||
%36 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 45 }, ptr undef }, ptr %34, 1
|
||||
%37 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 45 }, ptr undef }, ptr %35, 1
|
||||
%38 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 48)
|
||||
%39 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %38, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %36, ptr %39, align 8
|
||||
%40 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %38, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %37, ptr %40, align 8
|
||||
%41 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %38, 0
|
||||
%42 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %41, i64 2, 1
|
||||
%43 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %42, i64 2, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamedInterface"(ptr %31, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %43)
|
||||
br label %_llgo_16
|
||||
|
||||
_llgo_16: ; preds = %_llgo_15, %_llgo_14
|
||||
%44 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%45 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 45 }, ptr undef }, ptr %44, 1
|
||||
%46 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 24)
|
||||
%47 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %46, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %45, ptr %47, align 8
|
||||
%48 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %46, 0
|
||||
%49 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %48, i64 1, 1
|
||||
%50 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %49, i64 1, 2
|
||||
%51 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %50)
|
||||
store ptr %51, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.iface$brpgdLtIeRlPi8QUoTgPCXzlehUkncg7v9aITo-GsF4", align 8
|
||||
%52 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @9, i64 2 }, i64 25, i64 0, i64 1, i64 1)
|
||||
%53 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.C1", align 8
|
||||
%54 = icmp eq ptr %53, null
|
||||
br i1 %54, label %_llgo_17, label %_llgo_18
|
||||
|
||||
_llgo_17: ; preds = %_llgo_16
|
||||
store ptr %52, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.C1", align 8
|
||||
br label %_llgo_18
|
||||
|
||||
_llgo_18: ; preds = %_llgo_17, %_llgo_16
|
||||
%55 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%56 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %55, 0
|
||||
%57 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %56, i64 0, 1
|
||||
%58 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %57, i64 0, 2
|
||||
%59 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %58)
|
||||
store ptr %59, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
%60 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
br i1 %54, label %_llgo_19, label %_llgo_20
|
||||
|
||||
_llgo_19: ; preds = %_llgo_18
|
||||
%61 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%62 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 45 }, ptr undef, ptr undef, ptr undef }, ptr %61, 1
|
||||
%63 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %62, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C1).f", 2
|
||||
%64 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %63, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C1).f", 3
|
||||
%65 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 45 }, ptr undef, ptr undef, ptr undef }, ptr %61, 1
|
||||
%66 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %65, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C1).f", 2
|
||||
%67 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %66, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.C1.f", 3
|
||||
%68 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 40)
|
||||
%69 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %68, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %67, ptr %69, align 8
|
||||
%70 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %68, 0
|
||||
%71 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %70, i64 1, 1
|
||||
%72 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %71, i64 1, 2
|
||||
%73 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 40)
|
||||
%74 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %73, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %64, ptr %74, align 8
|
||||
%75 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %73, 0
|
||||
%76 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %75, i64 1, 1
|
||||
%77 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %76, i64 1, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %52, ptr %60, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %72, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %77)
|
||||
br label %_llgo_20
|
||||
|
||||
_llgo_20: ; preds = %_llgo_19, %_llgo_18
|
||||
%78 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%79 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%80 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 45 }, ptr undef }, ptr %78, 1
|
||||
%81 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 45 }, ptr undef }, ptr %79, 1
|
||||
%82 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 48)
|
||||
%83 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %82, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %80, ptr %83, align 8
|
||||
%84 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %82, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %81, ptr %84, align 8
|
||||
%85 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %82, 0
|
||||
%86 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %85, i64 2, 1
|
||||
%87 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %86, i64 2, 2
|
||||
%88 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %87)
|
||||
store ptr %88, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.iface$gZBF8fFlqIMZ9M6lT2VWPyc3eu5Co6j0WoKGIEgDPAw", align 8
|
||||
%89 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @14, i64 2 }, i64 25, i64 0, i64 2, i64 2)
|
||||
%90 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.C2", align 8
|
||||
%91 = icmp eq ptr %90, null
|
||||
br i1 %91, label %_llgo_21, label %_llgo_22
|
||||
|
||||
_llgo_21: ; preds = %_llgo_20
|
||||
store ptr %89, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceconv.C2", align 8
|
||||
br label %_llgo_22
|
||||
|
||||
_llgo_22: ; preds = %_llgo_21, %_llgo_20
|
||||
%92 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
br i1 %91, label %_llgo_23, label %_llgo_24
|
||||
|
||||
_llgo_23: ; preds = %_llgo_22
|
||||
%93 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%94 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 45 }, ptr undef, ptr undef, ptr undef }, ptr %93, 1
|
||||
%95 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %94, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C2).f", 2
|
||||
%96 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %95, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C2).f", 3
|
||||
%97 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 45 }, ptr undef, ptr undef, ptr undef }, ptr %93, 1
|
||||
%98 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %97, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C2).f", 2
|
||||
%99 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %98, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2.f", 3
|
||||
%100 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%101 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 45 }, ptr undef, ptr undef, ptr undef }, ptr %100, 1
|
||||
%102 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %101, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C2).g", 2
|
||||
%103 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %102, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C2).g", 3
|
||||
%104 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 45 }, ptr undef, ptr undef, ptr undef }, ptr %100, 1
|
||||
%105 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %104, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.(*C2).g", 2
|
||||
%106 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %105, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceconv.C2.g", 3
|
||||
%107 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 80)
|
||||
%108 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %107, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %99, ptr %108, align 8
|
||||
%109 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %107, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %106, ptr %109, align 8
|
||||
%110 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %107, 0
|
||||
%111 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %110, i64 2, 1
|
||||
%112 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %111, i64 2, 2
|
||||
%113 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 80)
|
||||
%114 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %113, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %96, ptr %114, align 8
|
||||
%115 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %113, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %103, ptr %115, align 8
|
||||
%116 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %113, 0
|
||||
%117 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %116, i64 2, 1
|
||||
%118 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %117, i64 2, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %89, ptr %92, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %112, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %118)
|
||||
br label %_llgo_24
|
||||
|
||||
_llgo_24: ; preds = %_llgo_23, %_llgo_22
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamedInterface"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamedInterface"(ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr, ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String", i64, i64, i64, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String", i64, %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr, ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.Implements"(ptr, ptr)
|
||||
|
||||
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.EfaceEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.eface", %"github.com/goplus/llgo/runtime/internal/runtime.eface")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
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")
|
||||
}
|
||||
626
cl/_testgo/ifaceprom/out.ll
Normal file
626
cl/_testgo/ifaceprom/out.ll
Normal file
@@ -0,0 +1,626 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/ifaceprom'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/ifaceprom"
|
||||
|
||||
%"github.com/goplus/llgo/cl/_testgo/ifaceprom.S" = type { %"github.com/goplus/llgo/runtime/internal/runtime.iface" }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.iface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl" = type {}
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"github.com/goplus/llgo/runtime/abi.Method" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/abi.Imethod" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr }
|
||||
%"github.com/goplus/llgo/runtime/abi.StructField" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1 }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/ifaceprom.init$guard" = global i1 false, align 1
|
||||
@0 = private unnamed_addr constant [3 x i8] c"two", align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceprom.impl" = linkonce global ptr null, align 8
|
||||
@1 = private unnamed_addr constant [43 x i8] c"github.com/goplus/llgo/cl/_testgo/ifaceprom", align 1
|
||||
@2 = private unnamed_addr constant [4 x i8] c"impl", align 1
|
||||
@"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw" = linkonce global ptr null, align 8
|
||||
@3 = private unnamed_addr constant [3 x i8] c"one", align 1
|
||||
@4 = private unnamed_addr constant [47 x i8] c"github.com/goplus/llgo/cl/_testgo/ifaceprom.one", align 1
|
||||
@_llgo_int = linkonce global ptr null, align 8
|
||||
@"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA" = linkonce global ptr null, align 8
|
||||
@5 = private unnamed_addr constant [47 x i8] c"github.com/goplus/llgo/cl/_testgo/ifaceprom.two", align 1
|
||||
@_llgo_string = linkonce global ptr null, align 8
|
||||
@"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to" = linkonce global ptr null, align 8
|
||||
@"github.com/goplus/llgo/cl/_testgo/ifaceprom.iface$zZ89tENb5h_KNjvpxf1TXPfaWFYn0IZrZwyVf42lRtA" = linkonce global ptr null, align 8
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceprom.I" = linkonce global ptr null, align 8
|
||||
@6 = private unnamed_addr constant [1 x i8] c"I", align 1
|
||||
@7 = private unnamed_addr constant [116 x i8] c"type assertion github.com/goplus/llgo/cl/_testgo/ifaceprom.I -> github.com/goplus/llgo/cl/_testgo/ifaceprom.I failed", align 1
|
||||
@8 = private unnamed_addr constant [4 x i8] c"pass", align 1
|
||||
|
||||
define i64 @"github.com/goplus/llgo/cl/_testgo/ifaceprom.S.one"(%"github.com/goplus/llgo/cl/_testgo/ifaceprom.S" %0) {
|
||||
_llgo_0:
|
||||
%1 = alloca %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", align 8
|
||||
call void @llvm.memset(ptr %1, i8 0, i64 16, i1 false)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S" %0, ptr %1, align 8
|
||||
%2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %1, i32 0, i32 0
|
||||
%3 = load %"github.com/goplus/llgo/runtime/internal/runtime.iface", ptr %2, align 8
|
||||
%4 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %3)
|
||||
%5 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %3, 0
|
||||
%6 = getelementptr ptr, ptr %5, i64 3
|
||||
%7 = load ptr, ptr %6, align 8
|
||||
%8 = insertvalue { ptr, ptr } undef, ptr %7, 0
|
||||
%9 = insertvalue { ptr, ptr } %8, ptr %4, 1
|
||||
%10 = extractvalue { ptr, ptr } %9, 1
|
||||
%11 = extractvalue { ptr, ptr } %9, 0
|
||||
%12 = call i64 %11(ptr %10)
|
||||
ret i64 %12
|
||||
}
|
||||
|
||||
define %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/cl/_testgo/ifaceprom.S.two"(%"github.com/goplus/llgo/cl/_testgo/ifaceprom.S" %0) {
|
||||
_llgo_0:
|
||||
%1 = alloca %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", align 8
|
||||
call void @llvm.memset(ptr %1, i8 0, i64 16, i1 false)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S" %0, ptr %1, align 8
|
||||
%2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %1, i32 0, i32 0
|
||||
%3 = load %"github.com/goplus/llgo/runtime/internal/runtime.iface", ptr %2, align 8
|
||||
%4 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %3)
|
||||
%5 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %3, 0
|
||||
%6 = getelementptr ptr, ptr %5, i64 4
|
||||
%7 = load ptr, ptr %6, align 8
|
||||
%8 = insertvalue { ptr, ptr } undef, ptr %7, 0
|
||||
%9 = insertvalue { ptr, ptr } %8, ptr %4, 1
|
||||
%10 = extractvalue { ptr, ptr } %9, 1
|
||||
%11 = extractvalue { ptr, ptr } %9, 0
|
||||
%12 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" %11(ptr %10)
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.String" %12
|
||||
}
|
||||
|
||||
define i64 @"github.com/goplus/llgo/cl/_testgo/ifaceprom.(*S).one"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %0, i32 0, i32 0
|
||||
%2 = load %"github.com/goplus/llgo/runtime/internal/runtime.iface", ptr %1, align 8
|
||||
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %2)
|
||||
%4 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %2, 0
|
||||
%5 = getelementptr ptr, ptr %4, i64 3
|
||||
%6 = load ptr, ptr %5, align 8
|
||||
%7 = insertvalue { ptr, ptr } undef, ptr %6, 0
|
||||
%8 = insertvalue { ptr, ptr } %7, ptr %3, 1
|
||||
%9 = extractvalue { ptr, ptr } %8, 1
|
||||
%10 = extractvalue { ptr, ptr } %8, 0
|
||||
%11 = call i64 %10(ptr %9)
|
||||
ret i64 %11
|
||||
}
|
||||
|
||||
define %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/cl/_testgo/ifaceprom.(*S).two"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %0, i32 0, i32 0
|
||||
%2 = load %"github.com/goplus/llgo/runtime/internal/runtime.iface", ptr %1, align 8
|
||||
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %2)
|
||||
%4 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %2, 0
|
||||
%5 = getelementptr ptr, ptr %4, i64 4
|
||||
%6 = load ptr, ptr %5, align 8
|
||||
%7 = insertvalue { ptr, ptr } undef, ptr %6, 0
|
||||
%8 = insertvalue { ptr, ptr } %7, ptr %3, 1
|
||||
%9 = extractvalue { ptr, ptr } %8, 1
|
||||
%10 = extractvalue { ptr, ptr } %8, 0
|
||||
%11 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" %10(ptr %9)
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.String" %11
|
||||
}
|
||||
|
||||
define i64 @"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl.one"(%"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl" %0) {
|
||||
_llgo_0:
|
||||
ret i64 1
|
||||
}
|
||||
|
||||
define %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl.two"(%"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl" %0) {
|
||||
_llgo_0:
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 3 }
|
||||
}
|
||||
|
||||
define i64 @"github.com/goplus/llgo/cl/_testgo/ifaceprom.(*impl).one"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load %"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl", ptr %0, align 1
|
||||
%2 = call i64 @"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl.one"(%"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl" %1)
|
||||
ret i64 %2
|
||||
}
|
||||
|
||||
define %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/cl/_testgo/ifaceprom.(*impl).two"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load %"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl", ptr %0, align 1
|
||||
%2 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl.two"(%"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl" %1)
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.String" %2
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceprom.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/ifaceprom.init$after"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceprom.main"() {
|
||||
_llgo_0:
|
||||
%0 = alloca %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", align 8
|
||||
call void @llvm.memset(ptr %0, i8 0, i64 16, i1 false)
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %0, i32 0, i32 0
|
||||
%2 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceprom.impl", align 8
|
||||
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl" zeroinitializer, ptr %3, align 1
|
||||
%4 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%5 = load ptr, ptr @"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to", align 8
|
||||
%6 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.iface$zZ89tENb5h_KNjvpxf1TXPfaWFYn0IZrZwyVf42lRtA", align 8
|
||||
%7 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %6, ptr %2)
|
||||
%8 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %7, 0
|
||||
%9 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %8, ptr %3, 1
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.iface" %9, ptr %1, align 8
|
||||
%10 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %0, i32 0, i32 0
|
||||
%11 = load %"github.com/goplus/llgo/runtime/internal/runtime.iface", ptr %10, align 8
|
||||
%12 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %11)
|
||||
%13 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %11, 0
|
||||
%14 = getelementptr ptr, ptr %13, i64 3
|
||||
%15 = load ptr, ptr %14, align 8
|
||||
%16 = insertvalue { ptr, ptr } undef, ptr %15, 0
|
||||
%17 = insertvalue { ptr, ptr } %16, ptr %12, 1
|
||||
%18 = extractvalue { ptr, ptr } %17, 1
|
||||
%19 = extractvalue { ptr, ptr } %17, 0
|
||||
%20 = call i64 %19(ptr %18)
|
||||
%21 = icmp ne i64 %20, 1
|
||||
br i1 %21, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%22 = load ptr, ptr @_llgo_int, align 8
|
||||
%23 = inttoptr i64 %20 to ptr
|
||||
%24 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %22, 0
|
||||
%25 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %24, ptr %23, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %25)
|
||||
unreachable
|
||||
|
||||
_llgo_2: ; preds = %_llgo_0
|
||||
%26 = load %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %0, align 8
|
||||
%27 = extractvalue %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S" %26, 0
|
||||
%28 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %27)
|
||||
%29 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %27, 0
|
||||
%30 = getelementptr ptr, ptr %29, i64 3
|
||||
%31 = load ptr, ptr %30, align 8
|
||||
%32 = insertvalue { ptr, ptr } undef, ptr %31, 0
|
||||
%33 = insertvalue { ptr, ptr } %32, ptr %28, 1
|
||||
%34 = extractvalue { ptr, ptr } %33, 1
|
||||
%35 = extractvalue { ptr, ptr } %33, 0
|
||||
%36 = call i64 %35(ptr %34)
|
||||
%37 = icmp ne i64 %36, 1
|
||||
br i1 %37, label %_llgo_3, label %_llgo_4
|
||||
|
||||
_llgo_3: ; preds = %_llgo_2
|
||||
%38 = load ptr, ptr @_llgo_int, align 8
|
||||
%39 = inttoptr i64 %36 to ptr
|
||||
%40 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %38, 0
|
||||
%41 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %40, ptr %39, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %41)
|
||||
unreachable
|
||||
|
||||
_llgo_4: ; preds = %_llgo_2
|
||||
%42 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %0, i32 0, i32 0
|
||||
%43 = load %"github.com/goplus/llgo/runtime/internal/runtime.iface", ptr %42, align 8
|
||||
%44 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %43)
|
||||
%45 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceprom.I", align 8
|
||||
br i1 true, label %_llgo_17, label %_llgo_18
|
||||
|
||||
_llgo_5: ; preds = %_llgo_17
|
||||
%46 = load ptr, ptr @_llgo_int, align 8
|
||||
%47 = inttoptr i64 %113 to ptr
|
||||
%48 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %46, 0
|
||||
%49 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %48, ptr %47, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %49)
|
||||
unreachable
|
||||
|
||||
_llgo_6: ; preds = %_llgo_17
|
||||
%50 = load %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %0, align 8
|
||||
%51 = extractvalue %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S" %50, 0
|
||||
%52 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %51)
|
||||
%53 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceprom.I", align 8
|
||||
br i1 true, label %_llgo_19, label %_llgo_20
|
||||
|
||||
_llgo_7: ; preds = %_llgo_19
|
||||
%54 = load ptr, ptr @_llgo_int, align 8
|
||||
%55 = inttoptr i64 %124 to ptr
|
||||
%56 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %54, 0
|
||||
%57 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %56, ptr %55, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %57)
|
||||
unreachable
|
||||
|
||||
_llgo_8: ; preds = %_llgo_19
|
||||
%58 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %0, i32 0, i32 0
|
||||
%59 = load %"github.com/goplus/llgo/runtime/internal/runtime.iface", ptr %58, align 8
|
||||
%60 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %59)
|
||||
%61 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %59, 0
|
||||
%62 = getelementptr ptr, ptr %61, i64 4
|
||||
%63 = load ptr, ptr %62, align 8
|
||||
%64 = insertvalue { ptr, ptr } undef, ptr %63, 0
|
||||
%65 = insertvalue { ptr, ptr } %64, ptr %60, 1
|
||||
%66 = extractvalue { ptr, ptr } %65, 1
|
||||
%67 = extractvalue { ptr, ptr } %65, 0
|
||||
%68 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" %67(ptr %66)
|
||||
%69 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %68, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 3 })
|
||||
%70 = xor i1 %69, true
|
||||
br i1 %70, label %_llgo_9, label %_llgo_10
|
||||
|
||||
_llgo_9: ; preds = %_llgo_8
|
||||
%71 = load ptr, ptr @_llgo_string, align 8
|
||||
%72 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" %68, ptr %72, align 8
|
||||
%73 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %71, 0
|
||||
%74 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %73, ptr %72, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %74)
|
||||
unreachable
|
||||
|
||||
_llgo_10: ; preds = %_llgo_8
|
||||
%75 = load %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %0, align 8
|
||||
%76 = extractvalue %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S" %75, 0
|
||||
%77 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %76)
|
||||
%78 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %76, 0
|
||||
%79 = getelementptr ptr, ptr %78, i64 4
|
||||
%80 = load ptr, ptr %79, align 8
|
||||
%81 = insertvalue { ptr, ptr } undef, ptr %80, 0
|
||||
%82 = insertvalue { ptr, ptr } %81, ptr %77, 1
|
||||
%83 = extractvalue { ptr, ptr } %82, 1
|
||||
%84 = extractvalue { ptr, ptr } %82, 0
|
||||
%85 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" %84(ptr %83)
|
||||
%86 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %85, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 3 })
|
||||
%87 = xor i1 %86, true
|
||||
br i1 %87, label %_llgo_11, label %_llgo_12
|
||||
|
||||
_llgo_11: ; preds = %_llgo_10
|
||||
%88 = load ptr, ptr @_llgo_string, align 8
|
||||
%89 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" %85, ptr %89, align 8
|
||||
%90 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %88, 0
|
||||
%91 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %90, ptr %89, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %91)
|
||||
unreachable
|
||||
|
||||
_llgo_12: ; preds = %_llgo_10
|
||||
%92 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %0, i32 0, i32 0
|
||||
%93 = load %"github.com/goplus/llgo/runtime/internal/runtime.iface", ptr %92, align 8
|
||||
%94 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %93)
|
||||
%95 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceprom.I", align 8
|
||||
br i1 true, label %_llgo_21, label %_llgo_22
|
||||
|
||||
_llgo_13: ; preds = %_llgo_21
|
||||
%96 = load ptr, ptr @_llgo_string, align 8
|
||||
%97 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" %135, ptr %97, align 8
|
||||
%98 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %96, 0
|
||||
%99 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %98, ptr %97, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %99)
|
||||
unreachable
|
||||
|
||||
_llgo_14: ; preds = %_llgo_21
|
||||
%100 = load %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S", ptr %0, align 8
|
||||
%101 = extractvalue %"github.com/goplus/llgo/cl/_testgo/ifaceprom.S" %100, 0
|
||||
%102 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %101)
|
||||
%103 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceprom.I", align 8
|
||||
br i1 true, label %_llgo_23, label %_llgo_24
|
||||
|
||||
_llgo_15: ; preds = %_llgo_23
|
||||
%104 = load ptr, ptr @_llgo_string, align 8
|
||||
%105 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" %147, ptr %105, align 8
|
||||
%106 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %104, 0
|
||||
%107 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %106, ptr %105, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %107)
|
||||
unreachable
|
||||
|
||||
_llgo_16: ; preds = %_llgo_23
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @8, i64 4 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
|
||||
_llgo_17: ; preds = %_llgo_4
|
||||
%108 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
%109 = getelementptr inbounds { %"github.com/goplus/llgo/runtime/internal/runtime.iface" }, ptr %108, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.iface" %43, ptr %109, align 8
|
||||
%110 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.one$bound", ptr undef }, ptr %108, 1
|
||||
%111 = extractvalue { ptr, ptr } %110, 1
|
||||
%112 = extractvalue { ptr, ptr } %110, 0
|
||||
%113 = call i64 %112(ptr %111)
|
||||
%114 = icmp ne i64 %113, 1
|
||||
br i1 %114, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_18: ; preds = %_llgo_4
|
||||
%115 = load ptr, ptr @_llgo_string, align 8
|
||||
%116 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 116 }, ptr %116, align 8
|
||||
%117 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %115, 0
|
||||
%118 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %117, ptr %116, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %118)
|
||||
unreachable
|
||||
|
||||
_llgo_19: ; preds = %_llgo_6
|
||||
%119 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
%120 = getelementptr inbounds { %"github.com/goplus/llgo/runtime/internal/runtime.iface" }, ptr %119, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.iface" %51, ptr %120, align 8
|
||||
%121 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.one$bound", ptr undef }, ptr %119, 1
|
||||
%122 = extractvalue { ptr, ptr } %121, 1
|
||||
%123 = extractvalue { ptr, ptr } %121, 0
|
||||
%124 = call i64 %123(ptr %122)
|
||||
%125 = icmp ne i64 %124, 1
|
||||
br i1 %125, label %_llgo_7, label %_llgo_8
|
||||
|
||||
_llgo_20: ; preds = %_llgo_6
|
||||
%126 = load ptr, ptr @_llgo_string, align 8
|
||||
%127 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 116 }, ptr %127, align 8
|
||||
%128 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %126, 0
|
||||
%129 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %128, ptr %127, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %129)
|
||||
unreachable
|
||||
|
||||
_llgo_21: ; preds = %_llgo_12
|
||||
%130 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
%131 = getelementptr inbounds { %"github.com/goplus/llgo/runtime/internal/runtime.iface" }, ptr %130, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.iface" %93, ptr %131, align 8
|
||||
%132 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.two$bound", ptr undef }, ptr %130, 1
|
||||
%133 = extractvalue { ptr, ptr } %132, 1
|
||||
%134 = extractvalue { ptr, ptr } %132, 0
|
||||
%135 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" %134(ptr %133)
|
||||
%136 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %135, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 3 })
|
||||
%137 = xor i1 %136, true
|
||||
br i1 %137, label %_llgo_13, label %_llgo_14
|
||||
|
||||
_llgo_22: ; preds = %_llgo_12
|
||||
%138 = load ptr, ptr @_llgo_string, align 8
|
||||
%139 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 116 }, ptr %139, align 8
|
||||
%140 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %138, 0
|
||||
%141 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %140, ptr %139, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %141)
|
||||
unreachable
|
||||
|
||||
_llgo_23: ; preds = %_llgo_14
|
||||
%142 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
%143 = getelementptr inbounds { %"github.com/goplus/llgo/runtime/internal/runtime.iface" }, ptr %142, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.iface" %101, ptr %143, align 8
|
||||
%144 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.two$bound", ptr undef }, ptr %142, 1
|
||||
%145 = extractvalue { ptr, ptr } %144, 1
|
||||
%146 = extractvalue { ptr, ptr } %144, 0
|
||||
%147 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" %146(ptr %145)
|
||||
%148 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %147, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 3 })
|
||||
%149 = xor i1 %148, true
|
||||
br i1 %149, label %_llgo_15, label %_llgo_16
|
||||
|
||||
_llgo_24: ; preds = %_llgo_14
|
||||
%150 = load ptr, ptr @_llgo_string, align 8
|
||||
%151 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 116 }, ptr %151, align 8
|
||||
%152 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %150, 0
|
||||
%153 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %152, ptr %151, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %153)
|
||||
unreachable
|
||||
}
|
||||
|
||||
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
|
||||
declare void @llvm.memset(ptr nocapture writeonly, i8, i64, i1 immarg) #0
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface")
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/ifaceprom.init$after"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 4 }, i64 25, i64 0, i64 2, i64 2)
|
||||
store ptr %0, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceprom.impl", align 8
|
||||
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%2 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %1, 0
|
||||
%3 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %2, i64 0, 1
|
||||
%4 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %3, i64 0, 2
|
||||
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 43 }, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %4)
|
||||
store ptr %5, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
%6 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
%7 = load ptr, ptr @_llgo_int, align 8
|
||||
%8 = icmp eq ptr %7, null
|
||||
br i1 %8, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34)
|
||||
store ptr %9, ptr @_llgo_int, align 8
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
%10 = load ptr, ptr @_llgo_int, align 8
|
||||
%11 = load ptr, ptr @_llgo_int, align 8
|
||||
%12 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%13 = icmp eq ptr %12, null
|
||||
br i1 %13, label %_llgo_3, label %_llgo_4
|
||||
|
||||
_llgo_3: ; preds = %_llgo_2
|
||||
%14 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%15 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %14, 0
|
||||
%16 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %15, i64 0, 1
|
||||
%17 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %16, i64 0, 2
|
||||
%18 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
|
||||
%19 = getelementptr ptr, ptr %18, i64 0
|
||||
store ptr %11, ptr %19, align 8
|
||||
%20 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %18, 0
|
||||
%21 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %20, i64 1, 1
|
||||
%22 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %21, i64 1, 2
|
||||
%23 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %17, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %22, i1 false)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %23)
|
||||
store ptr %23, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_4: ; preds = %_llgo_3, %_llgo_2
|
||||
%24 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%25 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 47 }, ptr undef, ptr undef, ptr undef }, ptr %24, 1
|
||||
%26 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %25, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.(*impl).one", 2
|
||||
%27 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %26, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.(*impl).one", 3
|
||||
%28 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 47 }, ptr undef, ptr undef, ptr undef }, ptr %24, 1
|
||||
%29 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %28, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.(*impl).one", 2
|
||||
%30 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %29, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl.one", 3
|
||||
%31 = load ptr, ptr @_llgo_string, align 8
|
||||
%32 = icmp eq ptr %31, null
|
||||
br i1 %32, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4
|
||||
%33 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
||||
store ptr %33, ptr @_llgo_string, align 8
|
||||
br label %_llgo_6
|
||||
|
||||
_llgo_6: ; preds = %_llgo_5, %_llgo_4
|
||||
%34 = load ptr, ptr @_llgo_string, align 8
|
||||
%35 = load ptr, ptr @_llgo_string, align 8
|
||||
%36 = load ptr, ptr @"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to", align 8
|
||||
%37 = icmp eq ptr %36, null
|
||||
br i1 %37, label %_llgo_7, label %_llgo_8
|
||||
|
||||
_llgo_7: ; preds = %_llgo_6
|
||||
%38 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%39 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %38, 0
|
||||
%40 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %39, i64 0, 1
|
||||
%41 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %40, i64 0, 2
|
||||
%42 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
|
||||
%43 = getelementptr ptr, ptr %42, i64 0
|
||||
store ptr %35, ptr %43, align 8
|
||||
%44 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %42, 0
|
||||
%45 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %44, i64 1, 1
|
||||
%46 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %45, i64 1, 2
|
||||
%47 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %41, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %46, i1 false)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %47)
|
||||
store ptr %47, ptr @"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to", align 8
|
||||
br label %_llgo_8
|
||||
|
||||
_llgo_8: ; preds = %_llgo_7, %_llgo_6
|
||||
%48 = load ptr, ptr @"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to", align 8
|
||||
%49 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 47 }, ptr undef, ptr undef, ptr undef }, ptr %48, 1
|
||||
%50 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %49, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.(*impl).two", 2
|
||||
%51 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %50, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.(*impl).two", 3
|
||||
%52 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 47 }, ptr undef, ptr undef, ptr undef }, ptr %48, 1
|
||||
%53 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %52, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.(*impl).two", 2
|
||||
%54 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %53, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.impl.two", 3
|
||||
%55 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 80)
|
||||
%56 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %55, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %30, ptr %56, align 8
|
||||
%57 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %55, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %54, ptr %57, align 8
|
||||
%58 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %55, 0
|
||||
%59 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %58, i64 2, 1
|
||||
%60 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %59, i64 2, 2
|
||||
%61 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 80)
|
||||
%62 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %61, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %27, ptr %62, align 8
|
||||
%63 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %61, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %51, ptr %63, align 8
|
||||
%64 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %61, 0
|
||||
%65 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %64, i64 2, 1
|
||||
%66 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %65, i64 2, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %0, ptr %6, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %60, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %66)
|
||||
%67 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%68 = load ptr, ptr @"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to", align 8
|
||||
%69 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 47 }, ptr undef }, ptr %67, 1
|
||||
%70 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 47 }, ptr undef }, ptr %68, 1
|
||||
%71 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 48)
|
||||
%72 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %71, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %69, ptr %72, align 8
|
||||
%73 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %71, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %70, ptr %73, align 8
|
||||
%74 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %71, 0
|
||||
%75 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %74, i64 2, 1
|
||||
%76 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %75, i64 2, 2
|
||||
%77 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %76)
|
||||
store ptr %77, ptr @"github.com/goplus/llgo/cl/_testgo/ifaceprom.iface$zZ89tENb5h_KNjvpxf1TXPfaWFYn0IZrZwyVf42lRtA", align 8
|
||||
%78 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamedInterface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 1 })
|
||||
%79 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceprom.I", align 8
|
||||
%80 = icmp eq ptr %79, null
|
||||
br i1 %80, label %_llgo_9, label %_llgo_10
|
||||
|
||||
_llgo_9: ; preds = %_llgo_8
|
||||
store ptr %78, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/ifaceprom.I", align 8
|
||||
br label %_llgo_10
|
||||
|
||||
_llgo_10: ; preds = %_llgo_9, %_llgo_8
|
||||
%81 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%82 = load ptr, ptr @"_llgo_func$zNDVRsWTIpUPKouNUS805RGX--IV9qVK8B31IZbg5to", align 8
|
||||
br i1 %80, label %_llgo_11, label %_llgo_12
|
||||
|
||||
_llgo_11: ; preds = %_llgo_10
|
||||
%83 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 47 }, ptr undef }, ptr %81, 1
|
||||
%84 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 47 }, ptr undef }, ptr %82, 1
|
||||
%85 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 48)
|
||||
%86 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %85, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %83, ptr %86, align 8
|
||||
%87 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %85, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %84, ptr %87, align 8
|
||||
%88 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %85, 0
|
||||
%89 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %88, i64 2, 1
|
||||
%90 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %89, i64 2, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamedInterface"(ptr %78, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %90)
|
||||
br label %_llgo_12
|
||||
|
||||
_llgo_12: ; preds = %_llgo_11, %_llgo_10
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String", i64, i64, i64, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String", i64, %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr, ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr, ptr)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamedInterface"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamedInterface"(ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
define i64 @"github.com/goplus/llgo/cl/_testgo/ifaceprom.one$bound"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load { %"github.com/goplus/llgo/runtime/internal/runtime.iface" }, ptr %0, align 8
|
||||
%2 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface" } %1, 0
|
||||
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %2)
|
||||
%4 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %2, 0
|
||||
%5 = getelementptr ptr, ptr %4, i64 3
|
||||
%6 = load ptr, ptr %5, align 8
|
||||
%7 = insertvalue { ptr, ptr } undef, ptr %6, 0
|
||||
%8 = insertvalue { ptr, ptr } %7, ptr %3, 1
|
||||
%9 = extractvalue { ptr, ptr } %8, 1
|
||||
%10 = extractvalue { ptr, ptr } %8, 0
|
||||
%11 = call i64 %10(ptr %9)
|
||||
ret i64 %11
|
||||
}
|
||||
|
||||
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.StringEqual"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
define %"github.com/goplus/llgo/runtime/internal/runtime.String" @"github.com/goplus/llgo/cl/_testgo/ifaceprom.two$bound"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load { %"github.com/goplus/llgo/runtime/internal/runtime.iface" }, ptr %0, align 8
|
||||
%2 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface" } %1, 0
|
||||
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %2)
|
||||
%4 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %2, 0
|
||||
%5 = getelementptr ptr, ptr %4, i64 4
|
||||
%6 = load ptr, ptr %5, align 8
|
||||
%7 = insertvalue { ptr, ptr } undef, ptr %6, 0
|
||||
%8 = insertvalue { ptr, ptr } %7, ptr %3, 1
|
||||
%9 = extractvalue { ptr, ptr } %8, 1
|
||||
%10 = extractvalue { ptr, ptr } %8, 0
|
||||
%11 = call %"github.com/goplus/llgo/runtime/internal/runtime.String" %10(ptr %9)
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.String" %11
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
|
||||
140
cl/_testgo/indexerr/in.go
Normal file
140
cl/_testgo/indexerr/in.go
Normal file
@@ -0,0 +1,140 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("array -1 must error")
|
||||
}
|
||||
}()
|
||||
array(-1)
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("array 2 must error")
|
||||
}
|
||||
}()
|
||||
array(2)
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("array2 must error")
|
||||
}
|
||||
}()
|
||||
array2(2)
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("slice -1 must error")
|
||||
}
|
||||
}()
|
||||
slice(-1)
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("slice 2 must error")
|
||||
}
|
||||
}()
|
||||
slice(2)
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("slice2 2 must error")
|
||||
}
|
||||
}()
|
||||
slice2(2)
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("2 must error")
|
||||
}
|
||||
}()
|
||||
a := [...]int{1, 2}
|
||||
var n = -1
|
||||
println(a[n])
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("-1 must error")
|
||||
}
|
||||
}()
|
||||
a := [...]int{1, 2}
|
||||
var n = 2
|
||||
println(a[n])
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("2 must error")
|
||||
}
|
||||
}()
|
||||
a := [...]int{1, 2}
|
||||
var n uint = 2
|
||||
println(a[n])
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("2 must error")
|
||||
}
|
||||
}()
|
||||
a := []int{1, 2}
|
||||
var n = -1
|
||||
println(a[n])
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("-1 must error")
|
||||
}
|
||||
}()
|
||||
a := []int{1, 2}
|
||||
var n = 2
|
||||
println(a[n])
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
if r := recover(); r == nil {
|
||||
panic("2 must error")
|
||||
}
|
||||
}()
|
||||
a := []int{1, 2}
|
||||
var n uint = 2
|
||||
println(a[n])
|
||||
}
|
||||
|
||||
func array(n int) {
|
||||
println([...]int{1, 2}[n])
|
||||
}
|
||||
|
||||
func array2(n uint) {
|
||||
println([...]int{1, 2}[n])
|
||||
}
|
||||
|
||||
func slice(n int) {
|
||||
println([]int{1, 2}[n])
|
||||
}
|
||||
|
||||
func slice2(n int) {
|
||||
println([]int{1, 2}[n])
|
||||
}
|
||||
1
cl/_testgo/indexerr/out.ll
Normal file
1
cl/_testgo/indexerr/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
27
cl/_testgo/interface/in.go
Normal file
27
cl/_testgo/interface/in.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/goplus/llgo/cl/_testdata/foo"
|
||||
)
|
||||
|
||||
type Game1 struct {
|
||||
*foo.Game
|
||||
}
|
||||
|
||||
type Game2 struct {
|
||||
}
|
||||
|
||||
func (p *Game2) initGame() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
var g1 any = &Game1{&foo.Game{}}
|
||||
var g2 any = &Game2{}
|
||||
v1, ok := g1.(foo.Gamer)
|
||||
println("OK", v1, ok)
|
||||
if ok {
|
||||
v1.Load()
|
||||
}
|
||||
v2, ok := g2.(foo.Gamer)
|
||||
println("FAIL", v2, ok)
|
||||
}
|
||||
461
cl/_testgo/interface/out.ll
Normal file
461
cl/_testgo/interface/out.ll
Normal file
@@ -0,0 +1,461 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/interface'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/interface"
|
||||
|
||||
%"github.com/goplus/llgo/cl/_testgo/interface.Game1" = type { ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.iface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"github.com/goplus/llgo/runtime/abi.Method" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/abi.StructField" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1 }
|
||||
%"github.com/goplus/llgo/runtime/abi.Imethod" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/interface.init$guard" = global i1 false, align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game1" = linkonce global ptr null, align 8
|
||||
@0 = private unnamed_addr constant [43 x i8] c"github.com/goplus/llgo/cl/_testgo/interface", align 1
|
||||
@1 = private unnamed_addr constant [5 x i8] c"Game1", align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Game" = linkonce global ptr null, align 8
|
||||
@2 = private unnamed_addr constant [39 x i8] c"github.com/goplus/llgo/cl/_testdata/foo", align 1
|
||||
@3 = private unnamed_addr constant [4 x i8] c"Game", align 1
|
||||
@"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw" = linkonce global ptr null, align 8
|
||||
@4 = private unnamed_addr constant [4 x i8] c"Load", align 1
|
||||
@"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac" = linkonce global ptr null, align 8
|
||||
@5 = private unnamed_addr constant [8 x i8] c"initGame", align 1
|
||||
@6 = private unnamed_addr constant [48 x i8] c"github.com/goplus/llgo/cl/_testdata/foo.initGame", align 1
|
||||
@"*_llgo_github.com/goplus/llgo/cl/_testdata/foo.Game" = linkonce global ptr null, align 8
|
||||
@"_llgo_struct$4-TjwxozfgwR2wiuWBRPbxjG2hQENVAzi2bsR9iH62Q" = linkonce global ptr null, align 8
|
||||
@"*_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game1" = linkonce global ptr null, align 8
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game2" = linkonce global ptr null, align 8
|
||||
@7 = private unnamed_addr constant [5 x i8] c"Game2", align 1
|
||||
@8 = private unnamed_addr constant [52 x i8] c"github.com/goplus/llgo/cl/_testgo/interface.initGame", align 1
|
||||
@"*_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game2" = linkonce global ptr null, align 8
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Gamer" = linkonce global ptr null, align 8
|
||||
@9 = private unnamed_addr constant [5 x i8] c"Gamer", align 1
|
||||
@"github.com/goplus/llgo/cl/_testgo/interface.iface$sO8a1LvuUsjXwiwaC6sR9-L4DiYgiOnZi7iosyShJXg" = linkonce global ptr null, align 8
|
||||
@10 = private unnamed_addr constant [2 x i8] c"OK", align 1
|
||||
@11 = private unnamed_addr constant [4 x i8] c"FAIL", align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/interface.Game1.Load"(%"github.com/goplus/llgo/cl/_testgo/interface.Game1" %0) {
|
||||
_llgo_0:
|
||||
%1 = alloca %"github.com/goplus/llgo/cl/_testgo/interface.Game1", align 8
|
||||
call void @llvm.memset(ptr %1, i8 0, i64 8, i1 false)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/interface.Game1" %0, ptr %1, align 8
|
||||
%2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/interface.Game1", ptr %1, i32 0, i32 0
|
||||
%3 = load ptr, ptr %2, align 8
|
||||
call void @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).Load"(ptr %3)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/interface.Game1.initGame"(%"github.com/goplus/llgo/cl/_testgo/interface.Game1" %0) {
|
||||
_llgo_0:
|
||||
%1 = alloca %"github.com/goplus/llgo/cl/_testgo/interface.Game1", align 8
|
||||
call void @llvm.memset(ptr %1, i8 0, i64 8, i1 false)
|
||||
store %"github.com/goplus/llgo/cl/_testgo/interface.Game1" %0, ptr %1, align 8
|
||||
%2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/interface.Game1", ptr %1, i32 0, i32 0
|
||||
%3 = load ptr, ptr %2, align 8
|
||||
call void @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).initGame"(ptr %3)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/interface.(*Game1).Load"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/interface.Game1", ptr %0, i32 0, i32 0
|
||||
%2 = load ptr, ptr %1, align 8
|
||||
call void @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).Load"(ptr %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/interface.(*Game1).initGame"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/interface.Game1", ptr %0, i32 0, i32 0
|
||||
%2 = load ptr, ptr %1, align 8
|
||||
call void @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).initGame"(ptr %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/interface.(*Game2).initGame"(ptr %0) {
|
||||
_llgo_0:
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/interface.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/interface.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/interface.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testdata/foo.init"()
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/interface.init$after"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/interface.main"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/interface.Game1", ptr %0, i32 0, i32 0
|
||||
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 0)
|
||||
store ptr %2, ptr %1, align 8
|
||||
%3 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game1", align 8
|
||||
%4 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game1", align 8
|
||||
%5 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
|
||||
%6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %5, ptr %0, 1
|
||||
%7 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 0)
|
||||
%8 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game2", align 8
|
||||
%9 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game2", align 8
|
||||
%10 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %9, 0
|
||||
%11 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %10, ptr %7, 1
|
||||
%12 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, 0
|
||||
%13 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Gamer", align 8
|
||||
%14 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.Implements"(ptr %13, ptr %12)
|
||||
br i1 %14, label %_llgo_3, label %_llgo_4
|
||||
|
||||
_llgo_1: ; preds = %_llgo_5
|
||||
%15 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %34)
|
||||
%16 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %34, 0
|
||||
%17 = getelementptr ptr, ptr %16, i64 3
|
||||
%18 = load ptr, ptr %17, align 8
|
||||
%19 = insertvalue { ptr, ptr } undef, ptr %18, 0
|
||||
%20 = insertvalue { ptr, ptr } %19, ptr %15, 1
|
||||
%21 = extractvalue { ptr, ptr } %20, 1
|
||||
%22 = extractvalue { ptr, ptr } %20, 0
|
||||
call void %22(ptr %21)
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_5
|
||||
%23 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %11, 0
|
||||
%24 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Gamer", align 8
|
||||
%25 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.Implements"(ptr %24, ptr %23)
|
||||
br i1 %25, label %_llgo_6, label %_llgo_7
|
||||
|
||||
_llgo_3: ; preds = %_llgo_0
|
||||
%26 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, 1
|
||||
%27 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/interface.iface$sO8a1LvuUsjXwiwaC6sR9-L4DiYgiOnZi7iosyShJXg", align 8
|
||||
%28 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %27, ptr %12)
|
||||
%29 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %28, 0
|
||||
%30 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %29, ptr %26, 1
|
||||
%31 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } undef, %"github.com/goplus/llgo/runtime/internal/runtime.iface" %30, 0
|
||||
%32 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %31, i1 true, 1
|
||||
br label %_llgo_5
|
||||
|
||||
_llgo_4: ; preds = %_llgo_0
|
||||
br label %_llgo_5
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4, %_llgo_3
|
||||
%33 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } [ %32, %_llgo_3 ], [ zeroinitializer, %_llgo_4 ]
|
||||
%34 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %33, 0
|
||||
%35 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %33, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @10, i64 2 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintIface"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %34)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %35)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
br i1 %35, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_6: ; preds = %_llgo_2
|
||||
%36 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %11, 1
|
||||
%37 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/interface.iface$sO8a1LvuUsjXwiwaC6sR9-L4DiYgiOnZi7iosyShJXg", align 8
|
||||
%38 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %37, ptr %23)
|
||||
%39 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %38, 0
|
||||
%40 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %39, ptr %36, 1
|
||||
%41 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } undef, %"github.com/goplus/llgo/runtime/internal/runtime.iface" %40, 0
|
||||
%42 = insertvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %41, i1 true, 1
|
||||
br label %_llgo_8
|
||||
|
||||
_llgo_7: ; preds = %_llgo_2
|
||||
br label %_llgo_8
|
||||
|
||||
_llgo_8: ; preds = %_llgo_7, %_llgo_6
|
||||
%43 = phi { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } [ %42, %_llgo_6 ], [ zeroinitializer, %_llgo_7 ]
|
||||
%44 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %43, 0
|
||||
%45 = extractvalue { %"github.com/goplus/llgo/runtime/internal/runtime.iface", i1 } %43, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @11, i64 4 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintIface"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %44)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %45)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
|
||||
declare void @llvm.memset(ptr nocapture writeonly, i8, i64, i1 immarg) #0
|
||||
|
||||
declare void @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).Load"(ptr)
|
||||
|
||||
declare void @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).initGame"(ptr)
|
||||
|
||||
declare void @"github.com/goplus/llgo/cl/_testdata/foo.init"()
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/interface.init$after"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 5 }, i64 25, i64 8, i64 2, i64 2)
|
||||
%1 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game1", align 8
|
||||
%2 = icmp eq ptr %1, null
|
||||
br i1 %2, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %0)
|
||||
store ptr %0, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game1", align 8
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 39 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 4 }, i64 25, i64 0, i64 0, i64 2)
|
||||
%4 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Game", align 8
|
||||
%5 = icmp eq ptr %4, null
|
||||
br i1 %5, label %_llgo_3, label %_llgo_4
|
||||
|
||||
_llgo_3: ; preds = %_llgo_2
|
||||
store ptr %3, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Game", align 8
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_4: ; preds = %_llgo_3, %_llgo_2
|
||||
%6 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %6, 0
|
||||
%8 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %7, i64 0, 1
|
||||
%9 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %8, i64 0, 2
|
||||
%10 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %9)
|
||||
store ptr %10, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
%11 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
br i1 %5, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4
|
||||
%12 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%13 = icmp eq ptr %12, null
|
||||
br i1 %13, label %_llgo_7, label %_llgo_8
|
||||
|
||||
_llgo_6: ; preds = %_llgo_8, %_llgo_4
|
||||
%14 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Game", align 8
|
||||
%15 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 39 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 4 }, i64 25, i64 0, i64 0, i64 2)
|
||||
%16 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testdata/foo.Game", align 8
|
||||
%17 = icmp eq ptr %16, null
|
||||
br i1 %17, label %_llgo_9, label %_llgo_10
|
||||
|
||||
_llgo_7: ; preds = %_llgo_5
|
||||
%18 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%19 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %18, 0
|
||||
%20 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %19, i64 0, 1
|
||||
%21 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %20, i64 0, 2
|
||||
%22 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%23 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %22, 0
|
||||
%24 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %23, i64 0, 1
|
||||
%25 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %24, i64 0, 2
|
||||
%26 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %21, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %25, i1 false)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %26)
|
||||
store ptr %26, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
br label %_llgo_8
|
||||
|
||||
_llgo_8: ; preds = %_llgo_7, %_llgo_5
|
||||
%27 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%28 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 4 }, ptr undef, ptr undef, ptr undef }, ptr %27, 1
|
||||
%29 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %28, ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).Load", 2
|
||||
%30 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %29, ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).Load", 3
|
||||
%31 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%32 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 48 }, ptr undef, ptr undef, ptr undef }, ptr %31, 1
|
||||
%33 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %32, ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).initGame", 2
|
||||
%34 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %33, ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).initGame", 3
|
||||
%35 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 80)
|
||||
%36 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %35, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %30, ptr %36, align 8
|
||||
%37 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %35, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %34, ptr %37, align 8
|
||||
%38 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %35, 0
|
||||
%39 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %38, i64 2, 1
|
||||
%40 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %39, i64 2, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %3, ptr %11, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %40)
|
||||
br label %_llgo_6
|
||||
|
||||
_llgo_9: ; preds = %_llgo_6
|
||||
%41 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %15)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %41)
|
||||
store ptr %41, ptr @"*_llgo_github.com/goplus/llgo/cl/_testdata/foo.Game", align 8
|
||||
br label %_llgo_10
|
||||
|
||||
_llgo_10: ; preds = %_llgo_9, %_llgo_6
|
||||
%42 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testdata/foo.Game", align 8
|
||||
%43 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 39 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 4 }, i64 25, i64 0, i64 0, i64 2)
|
||||
%44 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %43)
|
||||
%45 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 4 }, ptr %44, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 true)
|
||||
%46 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 56)
|
||||
%47 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %46, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %45, ptr %47, align 8
|
||||
%48 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %46, 0
|
||||
%49 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %48, i64 1, 1
|
||||
%50 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %49, i64 1, 2
|
||||
%51 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, i64 8, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %50)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %51)
|
||||
store ptr %51, ptr @"_llgo_struct$4-TjwxozfgwR2wiuWBRPbxjG2hQENVAzi2bsR9iH62Q", align 8
|
||||
%52 = load ptr, ptr @"_llgo_struct$4-TjwxozfgwR2wiuWBRPbxjG2hQENVAzi2bsR9iH62Q", align 8
|
||||
br i1 %2, label %_llgo_11, label %_llgo_12
|
||||
|
||||
_llgo_11: ; preds = %_llgo_10
|
||||
%53 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%54 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 4 }, ptr undef, ptr undef, ptr undef }, ptr %53, 1
|
||||
%55 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %54, ptr @"github.com/goplus/llgo/cl/_testgo/interface.(*Game1).Load", 2
|
||||
%56 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %55, ptr @"github.com/goplus/llgo/cl/_testgo/interface.(*Game1).Load", 3
|
||||
%57 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 4 }, ptr undef, ptr undef, ptr undef }, ptr %53, 1
|
||||
%58 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %57, ptr @"github.com/goplus/llgo/cl/_testgo/interface.(*Game1).Load", 2
|
||||
%59 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %58, ptr @"github.com/goplus/llgo/cl/_testgo/interface.Game1.Load", 3
|
||||
%60 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%61 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 48 }, ptr undef, ptr undef, ptr undef }, ptr %60, 1
|
||||
%62 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %61, ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).initGame", 2
|
||||
%63 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %62, ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Game).initGame", 3
|
||||
%64 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 40)
|
||||
%65 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %64, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %59, ptr %65, align 8
|
||||
%66 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %64, 0
|
||||
%67 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %66, i64 1, 1
|
||||
%68 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %67, i64 1, 2
|
||||
%69 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 80)
|
||||
%70 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %69, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %56, ptr %70, align 8
|
||||
%71 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %69, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %63, ptr %71, align 8
|
||||
%72 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %69, 0
|
||||
%73 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %72, i64 2, 1
|
||||
%74 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %73, i64 2, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %0, ptr %52, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %68, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %74)
|
||||
br label %_llgo_12
|
||||
|
||||
_llgo_12: ; preds = %_llgo_11, %_llgo_10
|
||||
%75 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 5 }, i64 25, i64 8, i64 2, i64 2)
|
||||
%76 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game1", align 8
|
||||
%77 = icmp eq ptr %76, null
|
||||
br i1 %77, label %_llgo_13, label %_llgo_14
|
||||
|
||||
_llgo_13: ; preds = %_llgo_12
|
||||
%78 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %75)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %78)
|
||||
store ptr %78, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game1", align 8
|
||||
br label %_llgo_14
|
||||
|
||||
_llgo_14: ; preds = %_llgo_13, %_llgo_12
|
||||
%79 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 5 }, i64 25, i64 0, i64 0, i64 1)
|
||||
%80 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game2", align 8
|
||||
%81 = icmp eq ptr %80, null
|
||||
br i1 %81, label %_llgo_15, label %_llgo_16
|
||||
|
||||
_llgo_15: ; preds = %_llgo_14
|
||||
store ptr %79, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game2", align 8
|
||||
br label %_llgo_16
|
||||
|
||||
_llgo_16: ; preds = %_llgo_15, %_llgo_14
|
||||
%82 = load ptr, ptr @"_llgo_struct$n1H8J_3prDN3firMwPxBLVTkE5hJ9Di-AqNvaC9jczw", align 8
|
||||
br i1 %81, label %_llgo_17, label %_llgo_18
|
||||
|
||||
_llgo_17: ; preds = %_llgo_16
|
||||
%83 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%84 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @8, i64 52 }, ptr undef, ptr undef, ptr undef }, ptr %83, 1
|
||||
%85 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %84, ptr @"github.com/goplus/llgo/cl/_testgo/interface.(*Game2).initGame", 2
|
||||
%86 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %85, ptr @"github.com/goplus/llgo/cl/_testgo/interface.(*Game2).initGame", 3
|
||||
%87 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 40)
|
||||
%88 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %87, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %86, ptr %88, align 8
|
||||
%89 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %87, 0
|
||||
%90 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %89, i64 1, 1
|
||||
%91 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %90, i64 1, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %79, ptr %82, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %91)
|
||||
br label %_llgo_18
|
||||
|
||||
_llgo_18: ; preds = %_llgo_17, %_llgo_16
|
||||
%92 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 5 }, i64 25, i64 0, i64 0, i64 1)
|
||||
%93 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game2", align 8
|
||||
%94 = icmp eq ptr %93, null
|
||||
br i1 %94, label %_llgo_19, label %_llgo_20
|
||||
|
||||
_llgo_19: ; preds = %_llgo_18
|
||||
%95 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %92)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %95)
|
||||
store ptr %95, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/interface.Game2", align 8
|
||||
br label %_llgo_20
|
||||
|
||||
_llgo_20: ; preds = %_llgo_19, %_llgo_18
|
||||
%96 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamedInterface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 39 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @9, i64 5 })
|
||||
%97 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Gamer", align 8
|
||||
%98 = icmp eq ptr %97, null
|
||||
br i1 %98, label %_llgo_21, label %_llgo_22
|
||||
|
||||
_llgo_21: ; preds = %_llgo_20
|
||||
store ptr %96, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Gamer", align 8
|
||||
br label %_llgo_22
|
||||
|
||||
_llgo_22: ; preds = %_llgo_21, %_llgo_20
|
||||
%99 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%100 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
br i1 %98, label %_llgo_23, label %_llgo_24
|
||||
|
||||
_llgo_23: ; preds = %_llgo_22
|
||||
%101 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 4 }, ptr undef }, ptr %99, 1
|
||||
%102 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 48 }, ptr undef }, ptr %100, 1
|
||||
%103 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 48)
|
||||
%104 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %103, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %101, ptr %104, align 8
|
||||
%105 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %103, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %102, ptr %105, align 8
|
||||
%106 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %103, 0
|
||||
%107 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %106, i64 2, 1
|
||||
%108 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %107, i64 2, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamedInterface"(ptr %96, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %108)
|
||||
br label %_llgo_24
|
||||
|
||||
_llgo_24: ; preds = %_llgo_23, %_llgo_22
|
||||
%109 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%110 = load ptr, ptr @"_llgo_func$2_iS07vIlF2_rZqWB5eU0IvP_9HviM4MYZNkXZDvbac", align 8
|
||||
%111 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 4 }, ptr undef }, ptr %109, 1
|
||||
%112 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 48 }, ptr undef }, ptr %110, 1
|
||||
%113 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 48)
|
||||
%114 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %113, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %111, ptr %114, align 8
|
||||
%115 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %113, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %112, ptr %115, align 8
|
||||
%116 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %113, 0
|
||||
%117 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %116, i64 2, 1
|
||||
%118 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %117, i64 2, 2
|
||||
%119 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %118)
|
||||
store ptr %119, ptr @"github.com/goplus/llgo/cl/_testgo/interface.iface$sO8a1LvuUsjXwiwaC6sR9-L4DiYgiOnZi7iosyShJXg", align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String", i64, i64, i64, i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String", i64, %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr, ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamedInterface"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamedInterface"(ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.Implements"(ptr, ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr, ptr)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintIface"(%"github.com/goplus/llgo/runtime/internal/runtime.iface")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface")
|
||||
|
||||
attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
|
||||
102
cl/_testgo/invoke/in.go
Normal file
102
cl/_testgo/invoke/in.go
Normal file
@@ -0,0 +1,102 @@
|
||||
package main
|
||||
|
||||
type T struct {
|
||||
s string
|
||||
}
|
||||
|
||||
func (t T) Invoke() int {
|
||||
println("invoke", t.s)
|
||||
return 0
|
||||
}
|
||||
|
||||
func (t *T) Method() {}
|
||||
|
||||
type T1 int
|
||||
|
||||
func (t T1) Invoke() int {
|
||||
println("invoke1", t)
|
||||
return 1
|
||||
}
|
||||
|
||||
type T2 float64
|
||||
|
||||
func (t T2) Invoke() int {
|
||||
println("invoke2", t)
|
||||
return 2
|
||||
}
|
||||
|
||||
type T3 int8
|
||||
|
||||
func (t *T3) Invoke() int {
|
||||
println("invoke3", *t)
|
||||
return 3
|
||||
}
|
||||
|
||||
type T4 [1]int
|
||||
|
||||
func (t T4) Invoke() int {
|
||||
println("invoke4", t[0])
|
||||
return 4
|
||||
}
|
||||
|
||||
type T5 struct {
|
||||
n int
|
||||
}
|
||||
|
||||
func (t T5) Invoke() int {
|
||||
println("invoke5", t.n)
|
||||
return 5
|
||||
}
|
||||
|
||||
type T6 func() int
|
||||
|
||||
func (t T6) Invoke() int {
|
||||
println("invoke6", t())
|
||||
return 6
|
||||
}
|
||||
|
||||
type I interface {
|
||||
Invoke() int
|
||||
}
|
||||
|
||||
func main() {
|
||||
var t = T{"hello"}
|
||||
var t1 = T1(100)
|
||||
var t2 = T2(100.1)
|
||||
var t3 = T3(127)
|
||||
var t4 = T4{200}
|
||||
var t5 = T5{300}
|
||||
var t6 = T6(func() int { return 400 })
|
||||
invoke(t)
|
||||
invoke(&t)
|
||||
invoke(t1)
|
||||
invoke(&t1)
|
||||
invoke(t2)
|
||||
invoke(&t2)
|
||||
invoke(&t3)
|
||||
invoke(t4)
|
||||
invoke(&t4)
|
||||
invoke(t5)
|
||||
invoke(&t5)
|
||||
invoke(t6)
|
||||
invoke(&t6)
|
||||
var m M
|
||||
var i I = m
|
||||
println(i, m)
|
||||
m = &t
|
||||
invoke(m)
|
||||
var a any = T{"world"}
|
||||
invoke(a.(I))
|
||||
invoke(a.(interface{}).(interface{ Invoke() int }))
|
||||
//panic
|
||||
//invoke(nil)
|
||||
}
|
||||
|
||||
func invoke(i I) {
|
||||
println(i.Invoke())
|
||||
}
|
||||
|
||||
type M interface {
|
||||
Invoke() int
|
||||
Method()
|
||||
}
|
||||
1079
cl/_testgo/invoke/out.ll
Normal file
1079
cl/_testgo/invoke/out.ll
Normal file
File diff suppressed because it is too large
Load Diff
56
cl/_testgo/makeslice/in.go
Normal file
56
cl/_testgo/makeslice/in.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
}
|
||||
|
||||
func init() {
|
||||
var n int = 2
|
||||
buf := make([]int, n, n*2)
|
||||
if len(buf) != 2 || cap(buf) != 4 {
|
||||
panic("error")
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
var n int32 = 2
|
||||
buf := make([]int, n, n*2)
|
||||
if len(buf) != 2 || cap(buf) != 4 {
|
||||
panic("error")
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
r := recover()
|
||||
if r == nil {
|
||||
println("must error")
|
||||
}
|
||||
}()
|
||||
var n int = -1
|
||||
buf := make([]int, n)
|
||||
_ = buf
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
r := recover()
|
||||
if r == nil {
|
||||
println("must error")
|
||||
}
|
||||
}()
|
||||
var n int = 2
|
||||
buf := make([]int, n, n-1)
|
||||
_ = buf
|
||||
}
|
||||
|
||||
func init() {
|
||||
defer func() {
|
||||
r := recover()
|
||||
if r == nil {
|
||||
println("must error")
|
||||
}
|
||||
}()
|
||||
var n int64 = 1<<63 - 1
|
||||
buf := make([]int, n)
|
||||
_ = buf
|
||||
}
|
||||
1
cl/_testgo/makeslice/out.ll
Normal file
1
cl/_testgo/makeslice/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
12
cl/_testgo/multiret/in.go
Normal file
12
cl/_testgo/multiret/in.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
var a int = 1
|
||||
|
||||
func foo(f float64) (int, float64) {
|
||||
return a, f
|
||||
}
|
||||
|
||||
func main() {
|
||||
i, f := foo(2.0)
|
||||
println(i, f)
|
||||
}
|
||||
45
cl/_testgo/multiret/out.ll
Normal file
45
cl/_testgo/multiret/out.ll
Normal file
@@ -0,0 +1,45 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/multiret'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/multiret"
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/multiret.a" = global i64 0, align 8
|
||||
@"github.com/goplus/llgo/cl/_testgo/multiret.init$guard" = global i1 false, align 1
|
||||
|
||||
define { i64, double } @"github.com/goplus/llgo/cl/_testgo/multiret.foo"(double %0) {
|
||||
_llgo_0:
|
||||
%1 = load i64, ptr @"github.com/goplus/llgo/cl/_testgo/multiret.a", align 4
|
||||
%2 = insertvalue { i64, double } undef, i64 %1, 0
|
||||
%3 = insertvalue { i64, double } %2, double %0, 1
|
||||
ret { i64, double } %3
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/multiret.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/multiret.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/multiret.init$guard", align 1
|
||||
store i64 1, ptr @"github.com/goplus/llgo/cl/_testgo/multiret.a", align 4
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/multiret.main"() {
|
||||
_llgo_0:
|
||||
%0 = call { i64, double } @"github.com/goplus/llgo/cl/_testgo/multiret.foo"(double 2.000000e+00)
|
||||
%1 = extractvalue { i64, double } %0, 0
|
||||
%2 = extractvalue { i64, double } %0, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %1)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double %2)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double)
|
||||
5
cl/_testgo/print/in.go
Normal file
5
cl/_testgo/print/in.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
println('.', byte('.'))
|
||||
}
|
||||
32
cl/_testgo/print/out.ll
Normal file
32
cl/_testgo/print/out.ll
Normal file
@@ -0,0 +1,32 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/print'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/print"
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/print.init$guard" = global i1 false, align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/print.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/print.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/print.init$guard", align 1
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/print.main"() {
|
||||
_llgo_0:
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 46)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64 46)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintUint"(i64)
|
||||
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)
|
||||
}
|
||||
1781
cl/_testgo/reader/out.ll
Normal file
1781
cl/_testgo/reader/out.ll
Normal file
File diff suppressed because it is too large
Load Diff
181
cl/_testgo/reflect/in.go
Normal file
181
cl/_testgo/reflect/in.go
Normal file
@@ -0,0 +1,181 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func main() {
|
||||
callSlice()
|
||||
callFunc()
|
||||
callClosure()
|
||||
callMethod()
|
||||
callIMethod()
|
||||
mapDemo1()
|
||||
mapDemo2()
|
||||
}
|
||||
|
||||
func demo(n1, n2, n3, n4, n5, n6, n7, n8, n9 int, a ...interface{}) (int, int) {
|
||||
var sum int
|
||||
for _, v := range a {
|
||||
sum += v.(int)
|
||||
}
|
||||
return n1 + n2 + n3 + n4 + n5 + n6 + n7 + n8 + n9, sum
|
||||
}
|
||||
|
||||
func callSlice() {
|
||||
v := reflect.ValueOf(demo)
|
||||
n := reflect.ValueOf(1)
|
||||
r := v.Call([]reflect.Value{n, n, n, n, n, n, n, n, n,
|
||||
reflect.ValueOf(1), reflect.ValueOf(2), reflect.ValueOf(3)})
|
||||
println("call.slice", r[0].Int(), r[1].Int())
|
||||
r = v.CallSlice([]reflect.Value{n, n, n, n, n, n, n, n, n,
|
||||
reflect.ValueOf([]interface{}{1, 2, 3})})
|
||||
println("call.slice", r[0].Int(), r[1].Int())
|
||||
}
|
||||
|
||||
func callFunc() {
|
||||
var f any = func(n int) int {
|
||||
println("call.func")
|
||||
return n + 1
|
||||
}
|
||||
fn := reflect.ValueOf(f)
|
||||
println("func", fn.Kind(), fn.Type().String())
|
||||
r := fn.Call([]reflect.Value{reflect.ValueOf(100)})
|
||||
println(r[0].Int())
|
||||
ifn, ok := fn.Interface().(func(int) int)
|
||||
if !ok {
|
||||
panic("error")
|
||||
}
|
||||
ifn(100)
|
||||
}
|
||||
|
||||
func callClosure() {
|
||||
m := 100
|
||||
var f any = func(n int) int {
|
||||
println("call.closure")
|
||||
return m + n + 1
|
||||
}
|
||||
fn := reflect.ValueOf(f)
|
||||
println("closure", fn.Kind(), fn.Type().String())
|
||||
r := fn.Call([]reflect.Value{reflect.ValueOf(100)})
|
||||
println(r[0].Int())
|
||||
ifn, ok := fn.Interface().(func(int) int)
|
||||
if !ok {
|
||||
panic("error")
|
||||
}
|
||||
ifn(100)
|
||||
}
|
||||
|
||||
type T struct {
|
||||
n int
|
||||
}
|
||||
|
||||
func (t *T) Add(n int) int {
|
||||
println("call.method")
|
||||
t.n += n
|
||||
return t.n
|
||||
}
|
||||
|
||||
type I interface {
|
||||
Add(n int) int
|
||||
}
|
||||
|
||||
type abi struct {
|
||||
typ unsafe.Pointer
|
||||
data unsafe.Pointer
|
||||
}
|
||||
|
||||
func callMethod() {
|
||||
t := &T{1}
|
||||
v := reflect.ValueOf(t)
|
||||
fn := v.Method(0)
|
||||
println("method", fn.Kind(), fn.Type().String())
|
||||
r := fn.Call([]reflect.Value{reflect.ValueOf(100)})
|
||||
println(r[0].Int())
|
||||
ifn, ok := fn.Interface().(func(int) int)
|
||||
if !ok {
|
||||
panic("error")
|
||||
}
|
||||
ifn(1)
|
||||
v2 := reflect.ValueOf(fn.Interface())
|
||||
r2 := v2.Call([]reflect.Value{reflect.ValueOf(100)})
|
||||
println(r2[0].Int())
|
||||
}
|
||||
|
||||
func callIMethod() {
|
||||
var i I = &T{1}
|
||||
v := reflect.ValueOf(i)
|
||||
fn := v.Method(0)
|
||||
println("imethod", fn.Kind(), fn.Type().String())
|
||||
r := fn.Call([]reflect.Value{reflect.ValueOf(100)})
|
||||
println(r[0].Int())
|
||||
ifn, ok := fn.Interface().(func(int) int)
|
||||
if !ok {
|
||||
panic("error")
|
||||
}
|
||||
ifn(1)
|
||||
v2 := reflect.ValueOf(fn.Interface())
|
||||
r2 := v2.Call([]reflect.Value{reflect.ValueOf(100)})
|
||||
println(r2[0].Int())
|
||||
}
|
||||
|
||||
func mapDemo1() {
|
||||
m := map[int]string{
|
||||
1: "hello",
|
||||
2: "world",
|
||||
}
|
||||
v := reflect.ValueOf(m)
|
||||
if v.Len() != 2 || len(v.MapKeys()) != 2 {
|
||||
panic("error")
|
||||
}
|
||||
if v.MapIndex(reflect.ValueOf(2)).String() != "world" {
|
||||
panic("MapIndex error")
|
||||
}
|
||||
v.SetMapIndex(reflect.ValueOf(2), reflect.ValueOf("todo"))
|
||||
if v.MapIndex(reflect.ValueOf(2)).String() != "todo" {
|
||||
panic("MapIndex error")
|
||||
}
|
||||
if v.MapIndex(reflect.ValueOf(0)).IsValid() {
|
||||
println("must invalid")
|
||||
}
|
||||
key := reflect.New(v.Type().Key()).Elem()
|
||||
value := reflect.New(v.Type().Elem()).Elem()
|
||||
iter := v.MapRange()
|
||||
for iter.Next() {
|
||||
key.SetIterKey(iter)
|
||||
value.SetIterValue(iter)
|
||||
if key.Int() != iter.Key().Int() || value.String() != iter.Value().String() {
|
||||
panic("MapIter error")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func mapDemo2() {
|
||||
v := reflect.MakeMap(reflect.MapOf(reflect.TypeOf(0), reflect.TypeOf("")))
|
||||
v.SetMapIndex(reflect.ValueOf(1), reflect.ValueOf("hello"))
|
||||
v.SetMapIndex(reflect.ValueOf(2), reflect.ValueOf("world"))
|
||||
if v.Len() != 2 || len(v.MapKeys()) != 2 {
|
||||
panic("error")
|
||||
}
|
||||
if v.MapIndex(reflect.ValueOf(2)).String() != "world" {
|
||||
panic("MapIndex error")
|
||||
}
|
||||
v.SetMapIndex(reflect.ValueOf(2), reflect.ValueOf("todo"))
|
||||
if v.MapIndex(reflect.ValueOf(2)).String() != "todo" {
|
||||
panic("MapIndex error")
|
||||
}
|
||||
if v.MapIndex(reflect.ValueOf(0)).IsValid() {
|
||||
println("must invalid")
|
||||
}
|
||||
key := reflect.New(v.Type().Key()).Elem()
|
||||
value := reflect.New(v.Type().Elem()).Elem()
|
||||
iter := v.MapRange()
|
||||
for iter.Next() {
|
||||
key.SetIterKey(iter)
|
||||
value.SetIterValue(iter)
|
||||
if key.Int() != iter.Key().Int() || value.String() != iter.Value().String() {
|
||||
panic("MapIter error")
|
||||
}
|
||||
}
|
||||
}
|
||||
1514
cl/_testgo/reflect/out.ll
Normal file
1514
cl/_testgo/reflect/out.ll
Normal file
File diff suppressed because it is too large
Load Diff
749
cl/_testgo/reflectconv/in.go
Normal file
749
cl/_testgo/reflectconv/in.go
Normal file
@@ -0,0 +1,749 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"reflect"
|
||||
"strings"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type Value struct {
|
||||
typ_ unsafe.Pointer
|
||||
ptr unsafe.Pointer
|
||||
flag uintptr
|
||||
}
|
||||
|
||||
const flagStickyRO uintptr = 1 << 5
|
||||
|
||||
// MakeRO returns a copy of v with the read-only flag set.
|
||||
func MakeRO(v reflect.Value) reflect.Value {
|
||||
(*Value)(unsafe.Pointer(&v)).flag |= flagStickyRO
|
||||
return v
|
||||
}
|
||||
|
||||
// IsRO reports whether v's read-only flag is set.
|
||||
func IsRO(v reflect.Value) bool {
|
||||
return (*Value)(unsafe.Pointer(&v)).flag&flagStickyRO != 0
|
||||
}
|
||||
|
||||
type testingT struct {
|
||||
}
|
||||
|
||||
func (t *testingT) Errorf(format string, a ...interface{}) {
|
||||
panic(fmt.Sprintf(format, a...))
|
||||
}
|
||||
|
||||
func (t *testingT) Fatalf(format string, a ...interface{}) {
|
||||
panic(fmt.Sprintf(format, a...))
|
||||
}
|
||||
|
||||
func main() {
|
||||
TestConvert(&testingT{})
|
||||
TestConvertPanic(&testingT{})
|
||||
TestConvertSlice2Array(&testingT{})
|
||||
TestConvertNaNs(&testingT{})
|
||||
}
|
||||
|
||||
var V = reflect.ValueOf
|
||||
|
||||
func EmptyInterfaceV(x any) reflect.Value {
|
||||
return V(&x).Elem()
|
||||
}
|
||||
|
||||
func ReaderV(x io.Reader) reflect.Value {
|
||||
return V(&x).Elem()
|
||||
}
|
||||
|
||||
func ReadWriterV(x io.ReadWriter) reflect.Value {
|
||||
return V(&x).Elem()
|
||||
}
|
||||
|
||||
type integer int
|
||||
type T struct {
|
||||
a int
|
||||
b float64
|
||||
c string
|
||||
d *int
|
||||
}
|
||||
|
||||
type Empty struct{}
|
||||
type MyStruct struct {
|
||||
x int `some:"tag"`
|
||||
}
|
||||
type MyStruct1 struct {
|
||||
x struct {
|
||||
int `some:"bar"`
|
||||
}
|
||||
}
|
||||
type MyStruct2 struct {
|
||||
x struct {
|
||||
int `some:"foo"`
|
||||
}
|
||||
}
|
||||
type MyString string
|
||||
type MyBytes []byte
|
||||
type MyBytesArrayPtr0 *[0]byte
|
||||
type MyBytesArrayPtr *[4]byte
|
||||
type MyBytesArray0 [0]byte
|
||||
type MyBytesArray [4]byte
|
||||
type MyRunes []int32
|
||||
type MyFunc func()
|
||||
type MyByte byte
|
||||
|
||||
type IntChan chan int
|
||||
type IntChanRecv <-chan int
|
||||
type IntChanSend chan<- int
|
||||
type BytesChan chan []byte
|
||||
type BytesChanRecv <-chan []byte
|
||||
type BytesChanSend chan<- []byte
|
||||
|
||||
var convertTests = []struct {
|
||||
in reflect.Value
|
||||
out reflect.Value
|
||||
}{
|
||||
// numbers
|
||||
/*
|
||||
Edit .+1,/\*\//-1>cat >/tmp/x.go && go run /tmp/x.go
|
||||
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
var numbers = []string{
|
||||
"int8", "uint8", "int16", "uint16",
|
||||
"int32", "uint32", "int64", "uint64",
|
||||
"int", "uint", "uintptr",
|
||||
"float32", "float64",
|
||||
}
|
||||
|
||||
func main() {
|
||||
// all pairs but in an unusual order,
|
||||
// to emit all the int8, uint8 cases
|
||||
// before n grows too big.
|
||||
n := 1
|
||||
for i, f := range numbers {
|
||||
for _, g := range numbers[i:] {
|
||||
fmt.Printf("\t{V(%s(%d)), V(%s(%d))},\n", f, n, g, n)
|
||||
n++
|
||||
if f != g {
|
||||
fmt.Printf("\t{V(%s(%d)), V(%s(%d))},\n", g, n, f, n)
|
||||
n++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
{V(byte(0)), V(byte(0))},
|
||||
{V(int8(1)), V(int8(1))},
|
||||
{V(int8(2)), V(uint8(2))},
|
||||
{V(uint8(3)), V(int8(3))},
|
||||
{V(int8(4)), V(int16(4))},
|
||||
{V(int16(5)), V(int8(5))},
|
||||
{V(int8(6)), V(uint16(6))},
|
||||
{V(uint16(7)), V(int8(7))},
|
||||
{V(int8(8)), V(int32(8))},
|
||||
{V(int32(9)), V(int8(9))},
|
||||
{V(int8(10)), V(uint32(10))},
|
||||
{V(uint32(11)), V(int8(11))},
|
||||
{V(int8(12)), V(int64(12))},
|
||||
{V(int64(13)), V(int8(13))},
|
||||
{V(int8(14)), V(uint64(14))},
|
||||
{V(uint64(15)), V(int8(15))},
|
||||
{V(int8(16)), V(int(16))},
|
||||
{V(int(17)), V(int8(17))},
|
||||
{V(int8(18)), V(uint(18))},
|
||||
{V(uint(19)), V(int8(19))},
|
||||
{V(int8(20)), V(uintptr(20))},
|
||||
{V(uintptr(21)), V(int8(21))},
|
||||
{V(int8(22)), V(float32(22))},
|
||||
{V(float32(23)), V(int8(23))},
|
||||
{V(int8(24)), V(float64(24))},
|
||||
{V(float64(25)), V(int8(25))},
|
||||
{V(uint8(26)), V(uint8(26))},
|
||||
{V(uint8(27)), V(int16(27))},
|
||||
{V(int16(28)), V(uint8(28))},
|
||||
{V(uint8(29)), V(uint16(29))},
|
||||
{V(uint16(30)), V(uint8(30))},
|
||||
{V(uint8(31)), V(int32(31))},
|
||||
{V(int32(32)), V(uint8(32))},
|
||||
{V(uint8(33)), V(uint32(33))},
|
||||
{V(uint32(34)), V(uint8(34))},
|
||||
{V(uint8(35)), V(int64(35))},
|
||||
{V(int64(36)), V(uint8(36))},
|
||||
{V(uint8(37)), V(uint64(37))},
|
||||
{V(uint64(38)), V(uint8(38))},
|
||||
{V(uint8(39)), V(int(39))},
|
||||
{V(int(40)), V(uint8(40))},
|
||||
{V(uint8(41)), V(uint(41))},
|
||||
{V(uint(42)), V(uint8(42))},
|
||||
{V(uint8(43)), V(uintptr(43))},
|
||||
{V(uintptr(44)), V(uint8(44))},
|
||||
{V(uint8(45)), V(float32(45))},
|
||||
{V(float32(46)), V(uint8(46))},
|
||||
{V(uint8(47)), V(float64(47))},
|
||||
{V(float64(48)), V(uint8(48))},
|
||||
{V(int16(49)), V(int16(49))},
|
||||
{V(int16(50)), V(uint16(50))},
|
||||
{V(uint16(51)), V(int16(51))},
|
||||
{V(int16(52)), V(int32(52))},
|
||||
{V(int32(53)), V(int16(53))},
|
||||
{V(int16(54)), V(uint32(54))},
|
||||
{V(uint32(55)), V(int16(55))},
|
||||
{V(int16(56)), V(int64(56))},
|
||||
{V(int64(57)), V(int16(57))},
|
||||
{V(int16(58)), V(uint64(58))},
|
||||
{V(uint64(59)), V(int16(59))},
|
||||
{V(int16(60)), V(int(60))},
|
||||
{V(int(61)), V(int16(61))},
|
||||
{V(int16(62)), V(uint(62))},
|
||||
{V(uint(63)), V(int16(63))},
|
||||
{V(int16(64)), V(uintptr(64))},
|
||||
{V(uintptr(65)), V(int16(65))},
|
||||
{V(int16(66)), V(float32(66))},
|
||||
{V(float32(67)), V(int16(67))},
|
||||
{V(int16(68)), V(float64(68))},
|
||||
{V(float64(69)), V(int16(69))},
|
||||
{V(uint16(70)), V(uint16(70))},
|
||||
{V(uint16(71)), V(int32(71))},
|
||||
{V(int32(72)), V(uint16(72))},
|
||||
{V(uint16(73)), V(uint32(73))},
|
||||
{V(uint32(74)), V(uint16(74))},
|
||||
{V(uint16(75)), V(int64(75))},
|
||||
{V(int64(76)), V(uint16(76))},
|
||||
{V(uint16(77)), V(uint64(77))},
|
||||
{V(uint64(78)), V(uint16(78))},
|
||||
{V(uint16(79)), V(int(79))},
|
||||
{V(int(80)), V(uint16(80))},
|
||||
{V(uint16(81)), V(uint(81))},
|
||||
{V(uint(82)), V(uint16(82))},
|
||||
{V(uint16(83)), V(uintptr(83))},
|
||||
{V(uintptr(84)), V(uint16(84))},
|
||||
{V(uint16(85)), V(float32(85))},
|
||||
{V(float32(86)), V(uint16(86))},
|
||||
{V(uint16(87)), V(float64(87))},
|
||||
{V(float64(88)), V(uint16(88))},
|
||||
{V(int32(89)), V(int32(89))},
|
||||
{V(int32(90)), V(uint32(90))},
|
||||
{V(uint32(91)), V(int32(91))},
|
||||
{V(int32(92)), V(int64(92))},
|
||||
{V(int64(93)), V(int32(93))},
|
||||
{V(int32(94)), V(uint64(94))},
|
||||
{V(uint64(95)), V(int32(95))},
|
||||
{V(int32(96)), V(int(96))},
|
||||
{V(int(97)), V(int32(97))},
|
||||
{V(int32(98)), V(uint(98))},
|
||||
{V(uint(99)), V(int32(99))},
|
||||
{V(int32(100)), V(uintptr(100))},
|
||||
{V(uintptr(101)), V(int32(101))},
|
||||
{V(int32(102)), V(float32(102))},
|
||||
{V(float32(103)), V(int32(103))},
|
||||
{V(int32(104)), V(float64(104))},
|
||||
{V(float64(105)), V(int32(105))},
|
||||
{V(uint32(106)), V(uint32(106))},
|
||||
{V(uint32(107)), V(int64(107))},
|
||||
{V(int64(108)), V(uint32(108))},
|
||||
{V(uint32(109)), V(uint64(109))},
|
||||
{V(uint64(110)), V(uint32(110))},
|
||||
{V(uint32(111)), V(int(111))},
|
||||
{V(int(112)), V(uint32(112))},
|
||||
{V(uint32(113)), V(uint(113))},
|
||||
{V(uint(114)), V(uint32(114))},
|
||||
{V(uint32(115)), V(uintptr(115))},
|
||||
{V(uintptr(116)), V(uint32(116))},
|
||||
{V(uint32(117)), V(float32(117))},
|
||||
{V(float32(118)), V(uint32(118))},
|
||||
{V(uint32(119)), V(float64(119))},
|
||||
{V(float64(120)), V(uint32(120))},
|
||||
{V(int64(121)), V(int64(121))},
|
||||
{V(int64(122)), V(uint64(122))},
|
||||
{V(uint64(123)), V(int64(123))},
|
||||
{V(int64(124)), V(int(124))},
|
||||
{V(int(125)), V(int64(125))},
|
||||
{V(int64(126)), V(uint(126))},
|
||||
{V(uint(127)), V(int64(127))},
|
||||
{V(int64(128)), V(uintptr(128))},
|
||||
{V(uintptr(129)), V(int64(129))},
|
||||
{V(int64(130)), V(float32(130))},
|
||||
{V(float32(131)), V(int64(131))},
|
||||
{V(int64(132)), V(float64(132))},
|
||||
{V(float64(133)), V(int64(133))},
|
||||
{V(uint64(134)), V(uint64(134))},
|
||||
{V(uint64(135)), V(int(135))},
|
||||
{V(int(136)), V(uint64(136))},
|
||||
{V(uint64(137)), V(uint(137))},
|
||||
{V(uint(138)), V(uint64(138))},
|
||||
{V(uint64(139)), V(uintptr(139))},
|
||||
{V(uintptr(140)), V(uint64(140))},
|
||||
{V(uint64(141)), V(float32(141))},
|
||||
{V(float32(142)), V(uint64(142))},
|
||||
{V(uint64(143)), V(float64(143))},
|
||||
{V(float64(144)), V(uint64(144))},
|
||||
{V(int(145)), V(int(145))},
|
||||
{V(int(146)), V(uint(146))},
|
||||
{V(uint(147)), V(int(147))},
|
||||
{V(int(148)), V(uintptr(148))},
|
||||
{V(uintptr(149)), V(int(149))},
|
||||
{V(int(150)), V(float32(150))},
|
||||
{V(float32(151)), V(int(151))},
|
||||
{V(int(152)), V(float64(152))},
|
||||
{V(float64(153)), V(int(153))},
|
||||
{V(uint(154)), V(uint(154))},
|
||||
{V(uint(155)), V(uintptr(155))},
|
||||
{V(uintptr(156)), V(uint(156))},
|
||||
{V(uint(157)), V(float32(157))},
|
||||
{V(float32(158)), V(uint(158))},
|
||||
{V(uint(159)), V(float64(159))},
|
||||
{V(float64(160)), V(uint(160))},
|
||||
{V(uintptr(161)), V(uintptr(161))},
|
||||
{V(uintptr(162)), V(float32(162))},
|
||||
{V(float32(163)), V(uintptr(163))},
|
||||
{V(uintptr(164)), V(float64(164))},
|
||||
{V(float64(165)), V(uintptr(165))},
|
||||
{V(float32(166)), V(float32(166))},
|
||||
{V(float32(167)), V(float64(167))},
|
||||
{V(float64(168)), V(float32(168))},
|
||||
{V(float64(169)), V(float64(169))},
|
||||
|
||||
// truncation
|
||||
{V(float64(1.5)), V(int(1))},
|
||||
|
||||
// complex
|
||||
{V(complex64(1i)), V(complex64(1i))},
|
||||
{V(complex64(2i)), V(complex128(2i))},
|
||||
{V(complex128(3i)), V(complex64(3i))},
|
||||
{V(complex128(4i)), V(complex128(4i))},
|
||||
|
||||
// string
|
||||
{V(string("hello")), V(string("hello"))},
|
||||
{V(string("bytes1")), V([]byte("bytes1"))},
|
||||
{V([]byte("bytes2")), V(string("bytes2"))},
|
||||
{V([]byte("bytes3")), V([]byte("bytes3"))},
|
||||
{V(string("runes♝")), V([]rune("runes♝"))},
|
||||
{V([]rune("runes♕")), V(string("runes♕"))},
|
||||
{V([]rune("runes🙈🙉🙊")), V([]rune("runes🙈🙉🙊"))},
|
||||
{V(int('a')), V(string("a"))},
|
||||
{V(int8('a')), V(string("a"))},
|
||||
{V(int16('a')), V(string("a"))},
|
||||
{V(int32('a')), V(string("a"))},
|
||||
{V(int64('a')), V(string("a"))},
|
||||
{V(uint('a')), V(string("a"))},
|
||||
{V(uint8('a')), V(string("a"))},
|
||||
{V(uint16('a')), V(string("a"))},
|
||||
{V(uint32('a')), V(string("a"))},
|
||||
{V(uint64('a')), V(string("a"))},
|
||||
{V(uintptr('a')), V(string("a"))},
|
||||
{V(int(-1)), V(string("\uFFFD"))},
|
||||
{V(int8(-2)), V(string("\uFFFD"))},
|
||||
{V(int16(-3)), V(string("\uFFFD"))},
|
||||
{V(int32(-4)), V(string("\uFFFD"))},
|
||||
{V(int64(-5)), V(string("\uFFFD"))},
|
||||
{V(int64(-1 << 32)), V(string("\uFFFD"))},
|
||||
{V(int64(1 << 32)), V(string("\uFFFD"))},
|
||||
{V(uint(0x110001)), V(string("\uFFFD"))},
|
||||
{V(uint32(0x110002)), V(string("\uFFFD"))},
|
||||
{V(uint64(0x110003)), V(string("\uFFFD"))},
|
||||
{V(uint64(1 << 32)), V(string("\uFFFD"))},
|
||||
{V(uintptr(0x110004)), V(string("\uFFFD"))},
|
||||
|
||||
// named string
|
||||
{V(MyString("hello")), V(string("hello"))},
|
||||
{V(string("hello")), V(MyString("hello"))},
|
||||
{V(string("hello")), V(string("hello"))},
|
||||
{V(MyString("hello")), V(MyString("hello"))},
|
||||
{V(MyString("bytes1")), V([]byte("bytes1"))},
|
||||
{V([]byte("bytes2")), V(MyString("bytes2"))},
|
||||
{V([]byte("bytes3")), V([]byte("bytes3"))},
|
||||
{V(MyString("runes♝")), V([]rune("runes♝"))},
|
||||
{V([]rune("runes♕")), V(MyString("runes♕"))},
|
||||
{V([]rune("runes🙈🙉🙊")), V([]rune("runes🙈🙉🙊"))},
|
||||
{V([]rune("runes🙈🙉🙊")), V(MyRunes("runes🙈🙉🙊"))},
|
||||
{V(MyRunes("runes🙈🙉🙊")), V([]rune("runes🙈🙉🙊"))},
|
||||
{V(int('a')), V(MyString("a"))},
|
||||
{V(int8('a')), V(MyString("a"))},
|
||||
{V(int16('a')), V(MyString("a"))},
|
||||
{V(int32('a')), V(MyString("a"))},
|
||||
{V(int64('a')), V(MyString("a"))},
|
||||
{V(uint('a')), V(MyString("a"))},
|
||||
{V(uint8('a')), V(MyString("a"))},
|
||||
{V(uint16('a')), V(MyString("a"))},
|
||||
{V(uint32('a')), V(MyString("a"))},
|
||||
{V(uint64('a')), V(MyString("a"))},
|
||||
{V(uintptr('a')), V(MyString("a"))},
|
||||
{V(int(-1)), V(MyString("\uFFFD"))},
|
||||
{V(int8(-2)), V(MyString("\uFFFD"))},
|
||||
{V(int16(-3)), V(MyString("\uFFFD"))},
|
||||
{V(int32(-4)), V(MyString("\uFFFD"))},
|
||||
{V(int64(-5)), V(MyString("\uFFFD"))},
|
||||
{V(uint(0x110001)), V(MyString("\uFFFD"))},
|
||||
{V(uint32(0x110002)), V(MyString("\uFFFD"))},
|
||||
{V(uint64(0x110003)), V(MyString("\uFFFD"))},
|
||||
{V(uintptr(0x110004)), V(MyString("\uFFFD"))},
|
||||
|
||||
// named []byte
|
||||
{V(string("bytes1")), V(MyBytes("bytes1"))},
|
||||
{V(MyBytes("bytes2")), V(string("bytes2"))},
|
||||
{V(MyBytes("bytes3")), V(MyBytes("bytes3"))},
|
||||
{V(MyString("bytes1")), V(MyBytes("bytes1"))},
|
||||
{V(MyBytes("bytes2")), V(MyString("bytes2"))},
|
||||
|
||||
// named []rune
|
||||
{V(string("runes♝")), V(MyRunes("runes♝"))},
|
||||
{V(MyRunes("runes♕")), V(string("runes♕"))},
|
||||
{V(MyRunes("runes🙈🙉🙊")), V(MyRunes("runes🙈🙉🙊"))},
|
||||
{V(MyString("runes♝")), V(MyRunes("runes♝"))},
|
||||
{V(MyRunes("runes♕")), V(MyString("runes♕"))},
|
||||
|
||||
// slice to array
|
||||
{V([]byte(nil)), V([0]byte{})},
|
||||
{V([]byte{}), V([0]byte{})},
|
||||
{V([]byte{1}), V([1]byte{1})},
|
||||
{V([]byte{1, 2}), V([2]byte{1, 2})},
|
||||
{V([]byte{1, 2, 3}), V([3]byte{1, 2, 3})},
|
||||
{V(MyBytes([]byte(nil))), V([0]byte{})},
|
||||
{V(MyBytes{}), V([0]byte{})},
|
||||
{V(MyBytes{1}), V([1]byte{1})},
|
||||
{V(MyBytes{1, 2}), V([2]byte{1, 2})},
|
||||
{V(MyBytes{1, 2, 3}), V([3]byte{1, 2, 3})},
|
||||
{V([]byte(nil)), V(MyBytesArray0{})},
|
||||
{V([]byte{}), V(MyBytesArray0([0]byte{}))},
|
||||
{V([]byte{1, 2, 3, 4}), V(MyBytesArray([4]byte{1, 2, 3, 4}))},
|
||||
{V(MyBytes{}), V(MyBytesArray0([0]byte{}))},
|
||||
{V(MyBytes{5, 6, 7, 8}), V(MyBytesArray([4]byte{5, 6, 7, 8}))},
|
||||
{V([]MyByte{}), V([0]MyByte{})},
|
||||
{V([]MyByte{1, 2}), V([2]MyByte{1, 2})},
|
||||
|
||||
// slice to array pointer
|
||||
{V([]byte(nil)), V((*[0]byte)(nil))},
|
||||
{V([]byte{}), V(new([0]byte))},
|
||||
{V([]byte{7}), V(&[1]byte{7})},
|
||||
{V(MyBytes([]byte(nil))), V((*[0]byte)(nil))},
|
||||
{V(MyBytes([]byte{})), V(new([0]byte))},
|
||||
{V(MyBytes([]byte{9})), V(&[1]byte{9})},
|
||||
{V([]byte(nil)), V(MyBytesArrayPtr0(nil))},
|
||||
{V([]byte{}), V(MyBytesArrayPtr0(new([0]byte)))},
|
||||
{V([]byte{1, 2, 3, 4}), V(MyBytesArrayPtr(&[4]byte{1, 2, 3, 4}))},
|
||||
{V(MyBytes([]byte{})), V(MyBytesArrayPtr0(new([0]byte)))},
|
||||
{V(MyBytes([]byte{5, 6, 7, 8})), V(MyBytesArrayPtr(&[4]byte{5, 6, 7, 8}))},
|
||||
|
||||
{V([]byte(nil)), V((*MyBytesArray0)(nil))},
|
||||
{V([]byte{}), V((*MyBytesArray0)(new([0]byte)))},
|
||||
{V([]byte{1, 2, 3, 4}), V(&MyBytesArray{1, 2, 3, 4})},
|
||||
{V(MyBytes([]byte(nil))), V((*MyBytesArray0)(nil))},
|
||||
{V(MyBytes([]byte{})), V((*MyBytesArray0)(new([0]byte)))},
|
||||
{V(MyBytes([]byte{5, 6, 7, 8})), V(&MyBytesArray{5, 6, 7, 8})},
|
||||
{V(new([0]byte)), V(new(MyBytesArray0))},
|
||||
{V(new(MyBytesArray0)), V(new([0]byte))},
|
||||
{V(MyBytesArrayPtr0(nil)), V((*[0]byte)(nil))},
|
||||
{V((*[0]byte)(nil)), V(MyBytesArrayPtr0(nil))},
|
||||
|
||||
// named types and equal underlying types
|
||||
{V(new(int)), V(new(integer))},
|
||||
{V(new(integer)), V(new(int))},
|
||||
{V(Empty{}), V(struct{}{})},
|
||||
{V(new(Empty)), V(new(struct{}))},
|
||||
{V(struct{}{}), V(Empty{})},
|
||||
{V(new(struct{})), V(new(Empty))},
|
||||
{V(Empty{}), V(Empty{})},
|
||||
{V(MyBytes{}), V([]byte{})},
|
||||
{V([]byte{}), V(MyBytes{})},
|
||||
{V((func())(nil)), V(MyFunc(nil))},
|
||||
{V((MyFunc)(nil)), V((func())(nil))},
|
||||
|
||||
// structs with different tags
|
||||
{V(struct {
|
||||
x int `some:"foo"`
|
||||
}{}), V(struct {
|
||||
x int `some:"bar"`
|
||||
}{})},
|
||||
|
||||
{V(struct {
|
||||
x int `some:"bar"`
|
||||
}{}), V(struct {
|
||||
x int `some:"foo"`
|
||||
}{})},
|
||||
|
||||
{V(MyStruct{}), V(struct {
|
||||
x int `some:"foo"`
|
||||
}{})},
|
||||
|
||||
{V(struct {
|
||||
x int `some:"foo"`
|
||||
}{}), V(MyStruct{})},
|
||||
|
||||
{V(MyStruct{}), V(struct {
|
||||
x int `some:"bar"`
|
||||
}{})},
|
||||
|
||||
{V(struct {
|
||||
x int `some:"bar"`
|
||||
}{}), V(MyStruct{})},
|
||||
|
||||
{V(MyStruct1{}), V(MyStruct2{})},
|
||||
{V(MyStruct2{}), V(MyStruct1{})},
|
||||
|
||||
// can convert *byte and *MyByte
|
||||
{V((*byte)(nil)), V((*MyByte)(nil))},
|
||||
{V((*MyByte)(nil)), V((*byte)(nil))},
|
||||
|
||||
// cannot convert mismatched array sizes
|
||||
{V([2]byte{}), V([2]byte{})},
|
||||
{V([3]byte{}), V([3]byte{})},
|
||||
{V(MyBytesArray0{}), V([0]byte{})},
|
||||
{V([0]byte{}), V(MyBytesArray0{})},
|
||||
|
||||
// cannot convert other instances
|
||||
{V((**byte)(nil)), V((**byte)(nil))},
|
||||
{V((**MyByte)(nil)), V((**MyByte)(nil))},
|
||||
{V((chan byte)(nil)), V((chan byte)(nil))},
|
||||
{V((chan MyByte)(nil)), V((chan MyByte)(nil))},
|
||||
{V(([]byte)(nil)), V(([]byte)(nil))},
|
||||
{V(([]MyByte)(nil)), V(([]MyByte)(nil))},
|
||||
{V((map[int]byte)(nil)), V((map[int]byte)(nil))},
|
||||
{V((map[int]MyByte)(nil)), V((map[int]MyByte)(nil))},
|
||||
{V((map[byte]int)(nil)), V((map[byte]int)(nil))},
|
||||
{V((map[MyByte]int)(nil)), V((map[MyByte]int)(nil))},
|
||||
{V([2]byte{}), V([2]byte{})},
|
||||
{V([2]MyByte{}), V([2]MyByte{})},
|
||||
|
||||
// other
|
||||
{V((***int)(nil)), V((***int)(nil))},
|
||||
{V((***byte)(nil)), V((***byte)(nil))},
|
||||
{V((***int32)(nil)), V((***int32)(nil))},
|
||||
{V((***int64)(nil)), V((***int64)(nil))},
|
||||
{V((chan byte)(nil)), V((chan byte)(nil))},
|
||||
{V((chan MyByte)(nil)), V((chan MyByte)(nil))},
|
||||
{V((map[int]bool)(nil)), V((map[int]bool)(nil))},
|
||||
{V((map[int]byte)(nil)), V((map[int]byte)(nil))},
|
||||
{V((map[uint]bool)(nil)), V((map[uint]bool)(nil))},
|
||||
{V([]uint(nil)), V([]uint(nil))},
|
||||
{V([]int(nil)), V([]int(nil))},
|
||||
{V(new(any)), V(new(any))},
|
||||
{V(new(io.Reader)), V(new(io.Reader))},
|
||||
{V(new(io.Writer)), V(new(io.Writer))},
|
||||
|
||||
// channels
|
||||
{V(IntChan(nil)), V((chan<- int)(nil))},
|
||||
{V(IntChan(nil)), V((<-chan int)(nil))},
|
||||
{V((chan int)(nil)), V(IntChanRecv(nil))},
|
||||
{V((chan int)(nil)), V(IntChanSend(nil))},
|
||||
{V(IntChanRecv(nil)), V((<-chan int)(nil))},
|
||||
{V((<-chan int)(nil)), V(IntChanRecv(nil))},
|
||||
{V(IntChanSend(nil)), V((chan<- int)(nil))},
|
||||
{V((chan<- int)(nil)), V(IntChanSend(nil))},
|
||||
{V(IntChan(nil)), V((chan int)(nil))},
|
||||
{V((chan int)(nil)), V(IntChan(nil))},
|
||||
{V((chan int)(nil)), V((<-chan int)(nil))},
|
||||
{V((chan int)(nil)), V((chan<- int)(nil))},
|
||||
{V(BytesChan(nil)), V((chan<- []byte)(nil))},
|
||||
{V(BytesChan(nil)), V((<-chan []byte)(nil))},
|
||||
{V((chan []byte)(nil)), V(BytesChanRecv(nil))},
|
||||
{V((chan []byte)(nil)), V(BytesChanSend(nil))},
|
||||
{V(BytesChanRecv(nil)), V((<-chan []byte)(nil))},
|
||||
{V((<-chan []byte)(nil)), V(BytesChanRecv(nil))},
|
||||
{V(BytesChanSend(nil)), V((chan<- []byte)(nil))},
|
||||
{V((chan<- []byte)(nil)), V(BytesChanSend(nil))},
|
||||
{V(BytesChan(nil)), V((chan []byte)(nil))},
|
||||
{V((chan []byte)(nil)), V(BytesChan(nil))},
|
||||
{V((chan []byte)(nil)), V((<-chan []byte)(nil))},
|
||||
{V((chan []byte)(nil)), V((chan<- []byte)(nil))},
|
||||
|
||||
// cannot convert other instances (channels)
|
||||
{V(IntChan(nil)), V(IntChan(nil))},
|
||||
{V(IntChanRecv(nil)), V(IntChanRecv(nil))},
|
||||
{V(IntChanSend(nil)), V(IntChanSend(nil))},
|
||||
{V(BytesChan(nil)), V(BytesChan(nil))},
|
||||
{V(BytesChanRecv(nil)), V(BytesChanRecv(nil))},
|
||||
{V(BytesChanSend(nil)), V(BytesChanSend(nil))},
|
||||
|
||||
// interfaces
|
||||
{V(int(1)), EmptyInterfaceV(int(1))},
|
||||
{V(string("hello")), EmptyInterfaceV(string("hello"))},
|
||||
{V(new(bytes.Buffer)), ReaderV(new(bytes.Buffer))},
|
||||
{ReadWriterV(new(bytes.Buffer)), ReaderV(new(bytes.Buffer))},
|
||||
{V(new(bytes.Buffer)), ReadWriterV(new(bytes.Buffer))},
|
||||
}
|
||||
|
||||
func TestConvert(t *testingT) {
|
||||
canConvert := map[[2]reflect.Type]bool{}
|
||||
all := map[reflect.Type]bool{}
|
||||
|
||||
for _, tt := range convertTests {
|
||||
t1 := tt.in.Type()
|
||||
if !t1.ConvertibleTo(t1) {
|
||||
t.Errorf("(%s).ConvertibleTo(%s) = false, want true", t1, t1)
|
||||
continue
|
||||
}
|
||||
|
||||
t2 := tt.out.Type()
|
||||
if !t1.ConvertibleTo(t2) {
|
||||
t.Errorf("(%s).ConvertibleTo(%s) = false, want true", t1, t2)
|
||||
continue
|
||||
}
|
||||
|
||||
all[t1] = true
|
||||
all[t2] = true
|
||||
canConvert[[2]reflect.Type{t1, t2}] = true
|
||||
|
||||
// vout1 represents the in value converted to the in type.
|
||||
v1 := tt.in
|
||||
if !v1.CanConvert(t1) {
|
||||
t.Errorf("ValueOf(%T(%[1]v)).CanConvert(%s) = false, want true", tt.in.Interface(), t1)
|
||||
}
|
||||
vout1 := v1.Convert(t1)
|
||||
out1 := vout1.Interface()
|
||||
if vout1.Type() != tt.in.Type() || !reflect.DeepEqual(out1, tt.in.Interface()) {
|
||||
t.Errorf("ValueOf(%T(%[1]v)).Convert(%s) = %T(%[3]v), want %T(%[4]v)", tt.in.Interface(), t1, out1, tt.in.Interface())
|
||||
}
|
||||
|
||||
// vout2 represents the in value converted to the out type.
|
||||
if !v1.CanConvert(t2) {
|
||||
t.Errorf(" ValueOf(%T(%[1]v)).CanConvert(%s) = false, want true", tt.in.Interface(), t2)
|
||||
}
|
||||
vout2 := v1.Convert(t2)
|
||||
out2 := vout2.Interface()
|
||||
if vout2.Type() != tt.out.Type() || !reflect.DeepEqual(out2, tt.out.Interface()) {
|
||||
t.Errorf("ValueOf(%T(%[1]v)).Convert(%s) = %T(%[3]v), want %T(%[4]v)", tt.in.Interface(), t2, out2, tt.out.Interface())
|
||||
}
|
||||
if got, want := vout2.Kind(), vout2.Type().Kind(); got != want {
|
||||
t.Errorf("ValueOf(%T(%[1]v)).Convert(%s) has internal kind %v want %v", tt.in.Interface(), t1, got, want)
|
||||
}
|
||||
|
||||
// vout3 represents a new value of the out type, set to vout2. This makes
|
||||
// sure the converted value vout2 is really usable as a regular value.
|
||||
vout3 := reflect.New(t2).Elem()
|
||||
vout3.Set(vout2)
|
||||
out3 := vout3.Interface()
|
||||
if vout3.Type() != tt.out.Type() || !reflect.DeepEqual(out3, tt.out.Interface()) {
|
||||
t.Errorf("Set(ValueOf(%T(%[1]v)).Convert(%s)) = %T(%[3]v), want %T(%[4]v)", tt.in.Interface(), t2, out3, tt.out.Interface())
|
||||
}
|
||||
|
||||
if IsRO(v1) {
|
||||
t.Errorf("table entry %v is RO, should not be", v1)
|
||||
}
|
||||
if IsRO(vout1) {
|
||||
t.Errorf("self-conversion output %v is RO, should not be", vout1)
|
||||
}
|
||||
if IsRO(vout2) {
|
||||
t.Errorf("conversion output %v is RO, should not be", vout2)
|
||||
}
|
||||
if IsRO(vout3) {
|
||||
t.Errorf("set(conversion output) %v is RO, should not be", vout3)
|
||||
}
|
||||
if !IsRO(MakeRO(v1).Convert(t1)) {
|
||||
t.Errorf("RO self-conversion output %v is not RO, should be", v1)
|
||||
}
|
||||
if !IsRO(MakeRO(v1).Convert(t2)) {
|
||||
t.Errorf("RO conversion output %v is not RO, should be", v1)
|
||||
}
|
||||
}
|
||||
|
||||
// Assume that of all the types we saw during the tests,
|
||||
// if there wasn't an explicit entry for a conversion between
|
||||
// a pair of types, then it's not to be allowed. This checks for
|
||||
// things like 'int64' converting to '*int'.
|
||||
for t1 := range all {
|
||||
for t2 := range all {
|
||||
expectOK := t1 == t2 || canConvert[[2]reflect.Type{t1, t2}] || t2.Kind() == reflect.Interface && t2.NumMethod() == 0
|
||||
ok := t1.ConvertibleTo(t2)
|
||||
if ok != expectOK {
|
||||
t.Errorf("@(%s).ConvertibleTo(%s) = %v, want %v: %v", t1, t2, ok, expectOK, canConvert[[2]reflect.Type{t1, t2}])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertPanic(t *testingT) {
|
||||
s := make([]byte, 4)
|
||||
p := new([8]byte)
|
||||
v := reflect.ValueOf(s)
|
||||
pt := reflect.TypeOf(p)
|
||||
if !v.Type().ConvertibleTo(pt) {
|
||||
t.Errorf("[]byte should be convertible to *[8]byte")
|
||||
}
|
||||
if v.CanConvert(pt) {
|
||||
t.Errorf("slice with length 4 should not be convertible to *[8]byte")
|
||||
}
|
||||
shouldPanic("reflect: cannot convert slice with length 4 to pointer to array with length 8", func() {
|
||||
_ = v.Convert(pt)
|
||||
})
|
||||
|
||||
if v.CanConvert(pt.Elem()) {
|
||||
t.Errorf("slice with length 4 should not be convertible to [8]byte")
|
||||
}
|
||||
shouldPanic("reflect: cannot convert slice with length 4 to array with length 8", func() {
|
||||
_ = v.Convert(pt.Elem())
|
||||
})
|
||||
}
|
||||
|
||||
func TestConvertSlice2Array(t *testingT) {
|
||||
s := make([]int, 4)
|
||||
p := [4]int{}
|
||||
pt := reflect.TypeOf(p)
|
||||
ov := reflect.ValueOf(s)
|
||||
v := ov.Convert(pt)
|
||||
// Converting a slice to non-empty array needs to return
|
||||
// a non-addressable copy of the original memory.
|
||||
if v.CanAddr() {
|
||||
t.Fatalf("convert slice to non-empty array returns a addressable copy array")
|
||||
}
|
||||
for i := range s {
|
||||
ov.Index(i).Set(reflect.ValueOf(i + 1))
|
||||
}
|
||||
for i := range s {
|
||||
if v.Index(i).Int() != 0 {
|
||||
t.Fatalf("slice (%v) mutation visible in converted result (%v)", ov, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var gFloat32 float32
|
||||
|
||||
const snan uint32 = 0x7f800001
|
||||
|
||||
func TestConvertNaNs(t *testingT) {
|
||||
// Test to see if a store followed by a load of a signaling NaN
|
||||
// maintains the signaling bit. (This used to fail on the 387 port.)
|
||||
gFloat32 = math.Float32frombits(snan)
|
||||
// runtime.Gosched() // make sure we don't optimize the store/load away
|
||||
if got := math.Float32bits(gFloat32); got != snan {
|
||||
t.Errorf("store/load of sNaN not faithful, got %x want %x", got, snan)
|
||||
}
|
||||
// Test reflect's conversion between float32s. See issue 36400.
|
||||
type myFloat32 float32
|
||||
x := V(myFloat32(math.Float32frombits(snan)))
|
||||
y := x.Convert(reflect.TypeOf(float32(0)))
|
||||
z := y.Interface().(float32)
|
||||
if got := math.Float32bits(z); got != snan {
|
||||
t.Errorf("signaling nan conversion got %x, want %x", got, snan)
|
||||
}
|
||||
}
|
||||
|
||||
func shouldPanic(expect string, f func()) {
|
||||
defer func() {
|
||||
r := recover()
|
||||
if r == nil {
|
||||
panic("did not panic")
|
||||
}
|
||||
if expect != "" {
|
||||
var s string
|
||||
switch r := r.(type) {
|
||||
case string:
|
||||
s = r
|
||||
case *reflect.ValueError:
|
||||
s = r.Error()
|
||||
default:
|
||||
panic(fmt.Sprintf("panicked with unexpected type %T", r))
|
||||
}
|
||||
if !strings.HasPrefix(s, "reflect") {
|
||||
panic(`panic string does not start with "reflect": ` + s)
|
||||
}
|
||||
if !strings.Contains(s, expect) {
|
||||
panic(`panic string does not contain "` + expect + `": ` + s)
|
||||
}
|
||||
}
|
||||
}()
|
||||
f()
|
||||
}
|
||||
1
cl/_testgo/reflectconv/out.ll
Normal file
1
cl/_testgo/reflectconv/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
45
cl/_testgo/select/in.go
Normal file
45
cl/_testgo/select/in.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
send()
|
||||
recv()
|
||||
}
|
||||
|
||||
func send() {
|
||||
ch1 := make(chan int)
|
||||
ch2 := make(chan int)
|
||||
|
||||
go func() {
|
||||
println(<-ch1)
|
||||
}()
|
||||
go func() {
|
||||
println(<-ch2)
|
||||
}()
|
||||
|
||||
select {
|
||||
case ch1 <- 100:
|
||||
case ch2 <- 200:
|
||||
}
|
||||
}
|
||||
|
||||
func recv() {
|
||||
c1 := make(chan string)
|
||||
c2 := make(chan string)
|
||||
go func() {
|
||||
c1 <- "ch1"
|
||||
}()
|
||||
go func() {
|
||||
c2 <- "ch2"
|
||||
}()
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
select {
|
||||
case msg1 := <-c1:
|
||||
println(msg1)
|
||||
case msg2 := <-c2:
|
||||
println(msg2)
|
||||
default:
|
||||
println("exit")
|
||||
}
|
||||
}
|
||||
}
|
||||
1
cl/_testgo/select/out.ll
Normal file
1
cl/_testgo/select/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
30
cl/_testgo/selects/in.go
Normal file
30
cl/_testgo/selects/in.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
c1 := make(chan struct{}, 1)
|
||||
c2 := make(chan struct{}, 1)
|
||||
c3 := make(chan struct{}, 1)
|
||||
c4 := make(chan struct{}, 1)
|
||||
|
||||
go func() {
|
||||
<-c1
|
||||
println("<-c1")
|
||||
|
||||
select {
|
||||
case c2 <- struct{}{}:
|
||||
println("c2<-")
|
||||
case <-c3:
|
||||
println("<-c3")
|
||||
}
|
||||
}()
|
||||
|
||||
c1 <- struct{}{}
|
||||
println("c1<-")
|
||||
|
||||
select {
|
||||
case <-c2:
|
||||
println("<-c2")
|
||||
case <-c4:
|
||||
println("<-c4")
|
||||
}
|
||||
}
|
||||
258
cl/_testgo/selects/out.ll
Normal file
258
cl/_testgo/selects/out.ll
Normal file
@@ -0,0 +1,258 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/selects'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/selects"
|
||||
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" = type { ptr, ptr, i32, i1 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/selects.init$guard" = global i1 false, align 1
|
||||
@0 = private unnamed_addr constant [4 x i8] c"c1<-", align 1
|
||||
@1 = private unnamed_addr constant [4 x i8] c"<-c2", align 1
|
||||
@2 = private unnamed_addr constant [4 x i8] c"<-c4", align 1
|
||||
@3 = private unnamed_addr constant [31 x i8] c"blocking select matched no case", align 1
|
||||
@_llgo_string = linkonce global ptr null, align 8
|
||||
@4 = private unnamed_addr constant [4 x i8] c"<-c1", align 1
|
||||
@5 = private unnamed_addr constant [4 x i8] c"c2<-", align 1
|
||||
@6 = private unnamed_addr constant [4 x i8] c"<-c3", align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/selects.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/selects.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/selects.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/selects.init$after"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/selects.main"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
|
||||
%1 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewChan"(i64 0, i64 1)
|
||||
store ptr %1, ptr %0, align 8
|
||||
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
|
||||
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewChan"(i64 0, i64 1)
|
||||
store ptr %3, ptr %2, align 8
|
||||
%4 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
|
||||
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewChan"(i64 0, i64 1)
|
||||
store ptr %5, ptr %4, align 8
|
||||
%6 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewChan"(i64 0, i64 1)
|
||||
%7 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 24)
|
||||
%8 = getelementptr inbounds { ptr, ptr, ptr }, ptr %7, i32 0, i32 0
|
||||
store ptr %0, ptr %8, align 8
|
||||
%9 = getelementptr inbounds { ptr, ptr, ptr }, ptr %7, i32 0, i32 1
|
||||
store ptr %2, ptr %9, align 8
|
||||
%10 = getelementptr inbounds { ptr, ptr, ptr }, ptr %7, i32 0, i32 2
|
||||
store ptr %4, ptr %10, align 8
|
||||
%11 = insertvalue { ptr, ptr } { ptr @"github.com/goplus/llgo/cl/_testgo/selects.main$1", ptr undef }, ptr %7, 1
|
||||
%12 = call ptr @malloc(i64 16)
|
||||
%13 = getelementptr inbounds { { ptr, ptr } }, ptr %12, i32 0, i32 0
|
||||
store { ptr, ptr } %11, ptr %13, align 8
|
||||
%14 = alloca i8, i64 8, align 1
|
||||
%15 = call i32 @"github.com/goplus/llgo/runtime/internal/runtime.CreateThread"(ptr %14, ptr null, ptr @"github.com/goplus/llgo/cl/_testgo/selects._llgo_routine$1", ptr %12)
|
||||
%16 = load ptr, ptr %0, align 8
|
||||
%17 = alloca {}, align 8
|
||||
call void @llvm.memset(ptr %17, i8 0, i64 0, i1 false)
|
||||
store {} zeroinitializer, ptr %17, align 1
|
||||
%18 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.ChanSend"(ptr %16, ptr %17, i64 0)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 4 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%19 = load ptr, ptr %2, align 8
|
||||
%20 = alloca {}, align 8
|
||||
call void @llvm.memset(ptr %20, i8 0, i64 0, i1 false)
|
||||
%21 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" undef, ptr %19, 0
|
||||
%22 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %21, ptr %20, 1
|
||||
%23 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %22, i32 0, 2
|
||||
%24 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %23, i1 false, 3
|
||||
%25 = alloca {}, align 8
|
||||
call void @llvm.memset(ptr %25, i8 0, i64 0, i1 false)
|
||||
%26 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" undef, ptr %6, 0
|
||||
%27 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %26, ptr %25, 1
|
||||
%28 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %27, i32 0, 2
|
||||
%29 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %28, i1 false, 3
|
||||
%30 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 48)
|
||||
%31 = getelementptr %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp", ptr %30, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %24, ptr %31, align 8
|
||||
%32 = getelementptr %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp", ptr %30, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %29, ptr %32, align 8
|
||||
%33 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %30, 0
|
||||
%34 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %33, i64 2, 1
|
||||
%35 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %34, i64 2, 2
|
||||
%36 = call { i64, i1 } @"github.com/goplus/llgo/runtime/internal/runtime.Select"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %35)
|
||||
%37 = extractvalue { i64, i1 } %36, 0
|
||||
%38 = extractvalue { i64, i1 } %36, 1
|
||||
%39 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %24, 1
|
||||
%40 = load {}, ptr %39, align 1
|
||||
%41 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %29, 1
|
||||
%42 = load {}, ptr %41, align 1
|
||||
%43 = insertvalue { i64, i1, {}, {} } undef, i64 %37, 0
|
||||
%44 = insertvalue { i64, i1, {}, {} } %43, i1 %38, 1
|
||||
%45 = insertvalue { i64, i1, {}, {} } %44, {} %40, 2
|
||||
%46 = insertvalue { i64, i1, {}, {} } %45, {} %42, 3
|
||||
%47 = extractvalue { i64, i1, {}, {} } %46, 0
|
||||
%48 = icmp eq i64 %47, 0
|
||||
br i1 %48, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_1: ; preds = %_llgo_4, %_llgo_2
|
||||
ret void
|
||||
|
||||
_llgo_2: ; preds = %_llgo_0
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 4 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_3: ; preds = %_llgo_0
|
||||
%49 = icmp eq i64 %47, 1
|
||||
br i1 %49, label %_llgo_4, label %_llgo_5
|
||||
|
||||
_llgo_4: ; preds = %_llgo_3
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 4 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_5: ; preds = %_llgo_3
|
||||
%50 = load ptr, ptr @_llgo_string, align 8
|
||||
%51 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 31 }, ptr %51, align 8
|
||||
%52 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %50, 0
|
||||
%53 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %52, ptr %51, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %53)
|
||||
unreachable
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/selects.main$1"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load { ptr, ptr, ptr }, ptr %0, align 8
|
||||
%2 = extractvalue { ptr, ptr, ptr } %1, 0
|
||||
%3 = load ptr, ptr %2, align 8
|
||||
%4 = alloca {}, align 8
|
||||
call void @llvm.memset(ptr %4, i8 0, i64 0, i1 false)
|
||||
%5 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.ChanRecv"(ptr %3, ptr %4, i64 0)
|
||||
%6 = load {}, ptr %4, align 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 4 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%7 = extractvalue { ptr, ptr, ptr } %1, 1
|
||||
%8 = load ptr, ptr %7, align 8
|
||||
%9 = extractvalue { ptr, ptr, ptr } %1, 2
|
||||
%10 = load ptr, ptr %9, align 8
|
||||
%11 = alloca {}, align 8
|
||||
call void @llvm.memset(ptr %11, i8 0, i64 0, i1 false)
|
||||
store {} zeroinitializer, ptr %11, align 1
|
||||
%12 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" undef, ptr %8, 0
|
||||
%13 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %12, ptr %11, 1
|
||||
%14 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %13, i32 0, 2
|
||||
%15 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %14, i1 true, 3
|
||||
%16 = alloca {}, align 8
|
||||
call void @llvm.memset(ptr %16, i8 0, i64 0, i1 false)
|
||||
%17 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" undef, ptr %10, 0
|
||||
%18 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %17, ptr %16, 1
|
||||
%19 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %18, i32 0, 2
|
||||
%20 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %19, i1 false, 3
|
||||
%21 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 48)
|
||||
%22 = getelementptr %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp", ptr %21, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %15, ptr %22, align 8
|
||||
%23 = getelementptr %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp", ptr %21, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %20, ptr %23, align 8
|
||||
%24 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %21, 0
|
||||
%25 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %24, i64 2, 1
|
||||
%26 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %25, i64 2, 2
|
||||
%27 = call { i64, i1 } @"github.com/goplus/llgo/runtime/internal/runtime.Select"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %26)
|
||||
%28 = extractvalue { i64, i1 } %27, 0
|
||||
%29 = extractvalue { i64, i1 } %27, 1
|
||||
%30 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.ChanOp" %20, 1
|
||||
%31 = load {}, ptr %30, align 1
|
||||
%32 = insertvalue { i64, i1, {} } undef, i64 %28, 0
|
||||
%33 = insertvalue { i64, i1, {} } %32, i1 %29, 1
|
||||
%34 = insertvalue { i64, i1, {} } %33, {} %31, 2
|
||||
%35 = extractvalue { i64, i1, {} } %34, 0
|
||||
%36 = icmp eq i64 %35, 0
|
||||
br i1 %36, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_1: ; preds = %_llgo_4, %_llgo_2
|
||||
ret void
|
||||
|
||||
_llgo_2: ; preds = %_llgo_0
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 4 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_3: ; preds = %_llgo_0
|
||||
%37 = icmp eq i64 %35, 1
|
||||
br i1 %37, label %_llgo_4, label %_llgo_5
|
||||
|
||||
_llgo_4: ; preds = %_llgo_3
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 4 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_5: ; preds = %_llgo_3
|
||||
%38 = load ptr, ptr @_llgo_string, align 8
|
||||
%39 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 31 }, ptr %39, align 8
|
||||
%40 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %38, 0
|
||||
%41 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %40, ptr %39, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %41)
|
||||
unreachable
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewChan"(i64, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
define ptr @"github.com/goplus/llgo/cl/_testgo/selects._llgo_routine$1"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load { { ptr, ptr } }, ptr %0, align 8
|
||||
%2 = extractvalue { { ptr, ptr } } %1, 0
|
||||
%3 = extractvalue { ptr, ptr } %2, 1
|
||||
%4 = extractvalue { ptr, ptr } %2, 0
|
||||
call void %4(ptr %3)
|
||||
call void @free(ptr %0)
|
||||
ret ptr null
|
||||
}
|
||||
|
||||
declare void @free(ptr)
|
||||
|
||||
declare i32 @"github.com/goplus/llgo/runtime/internal/runtime.CreateThread"(ptr, ptr, ptr, ptr)
|
||||
|
||||
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.ChanSend"(ptr, ptr, i64)
|
||||
|
||||
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
|
||||
declare void @llvm.memset(ptr nocapture writeonly, i8, i64, i1 immarg) #0
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare { i64, i1 } @"github.com/goplus/llgo/runtime/internal/runtime.Select"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/selects.init$after"() {
|
||||
_llgo_0:
|
||||
%0 = load ptr, ptr @_llgo_string, align 8
|
||||
%1 = icmp eq ptr %0, null
|
||||
br i1 %1, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
||||
store ptr %2, ptr @_llgo_string, align 8
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
|
||||
|
||||
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.ChanRecv"(ptr, ptr, i64)
|
||||
|
||||
attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
|
||||
24
cl/_testgo/sigsegv/in.go
Normal file
24
cl/_testgo/sigsegv/in.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
type T struct {
|
||||
s int
|
||||
}
|
||||
|
||||
func f() *T {
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
println("init")
|
||||
defer func() {
|
||||
r := recover()
|
||||
if e, ok := r.(error); ok {
|
||||
println("recover", e.Error())
|
||||
}
|
||||
}()
|
||||
println(f().s)
|
||||
}
|
||||
|
||||
func main() {
|
||||
println("main")
|
||||
}
|
||||
1
cl/_testgo/sigsegv/out.ll
Normal file
1
cl/_testgo/sigsegv/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
27
cl/_testgo/strucintf/in.go
Normal file
27
cl/_testgo/strucintf/in.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import "github.com/goplus/llgo/cl/_testdata/foo"
|
||||
|
||||
func Foo() any {
|
||||
return struct{ v int }{1}
|
||||
}
|
||||
|
||||
func main() {
|
||||
v := Foo()
|
||||
if x, ok := v.(struct{ v int }); ok {
|
||||
println(x.v)
|
||||
} else {
|
||||
println("Foo: not ok")
|
||||
}
|
||||
bar := foo.Bar()
|
||||
if x, ok := bar.(struct{ V int }); ok {
|
||||
println(x.V)
|
||||
} else {
|
||||
println("Bar: not ok")
|
||||
}
|
||||
if x, ok := foo.F().(struct{ v int }); ok {
|
||||
println(x.v)
|
||||
} else {
|
||||
println("F: not ok")
|
||||
}
|
||||
}
|
||||
231
cl/_testgo/strucintf/out.ll
Normal file
231
cl/_testgo/strucintf/out.ll
Normal file
@@ -0,0 +1,231 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/strucintf'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/strucintf"
|
||||
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/runtime/abi.StructField" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/strucintf.init$guard" = global i1 false, align 1
|
||||
@_llgo_int = linkonce global ptr null, align 8
|
||||
@"github.com/goplus/llgo/cl/_testgo/strucintf.struct$MYpsoM99ZwFY087IpUOkIw1zjBA_sgFXVodmn1m-G88" = linkonce global ptr null, align 8
|
||||
@0 = private unnamed_addr constant [1 x i8] c"v", align 1
|
||||
@1 = private unnamed_addr constant [43 x i8] c"github.com/goplus/llgo/cl/_testgo/strucintf", align 1
|
||||
@2 = private unnamed_addr constant [11 x i8] c"Foo: not ok", align 1
|
||||
@"_llgo_struct$K-dZ9QotZfVPz2a0YdRa9vmZUuDXPTqZOlMShKEDJtk" = linkonce global ptr null, align 8
|
||||
@3 = private unnamed_addr constant [1 x i8] c"V", align 1
|
||||
@4 = private unnamed_addr constant [11 x i8] c"Bar: not ok", align 1
|
||||
@5 = private unnamed_addr constant [9 x i8] c"F: not ok", align 1
|
||||
|
||||
define %"github.com/goplus/llgo/runtime/internal/runtime.eface" @"github.com/goplus/llgo/cl/_testgo/strucintf.Foo"() {
|
||||
_llgo_0:
|
||||
%0 = alloca { i64 }, align 8
|
||||
call void @llvm.memset(ptr %0, i8 0, i64 8, i1 false)
|
||||
%1 = getelementptr inbounds { i64 }, ptr %0, i32 0, i32 0
|
||||
store i64 1, ptr %1, align 4
|
||||
%2 = load { i64 }, ptr %0, align 4
|
||||
%3 = load ptr, ptr @_llgo_int, align 8
|
||||
%4 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/strucintf.struct$MYpsoM99ZwFY087IpUOkIw1zjBA_sgFXVodmn1m-G88", align 8
|
||||
%5 = extractvalue { i64 } %2, 0
|
||||
%6 = inttoptr i64 %5 to ptr
|
||||
%7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
|
||||
%8 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %7, ptr %6, 1
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.eface" %8
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/strucintf.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/strucintf.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/strucintf.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testdata/foo.init"()
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/strucintf.init$after"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/strucintf.main"() {
|
||||
_llgo_0:
|
||||
%0 = call %"github.com/goplus/llgo/runtime/internal/runtime.eface" @"github.com/goplus/llgo/cl/_testgo/strucintf.Foo"()
|
||||
%1 = alloca { i64 }, align 8
|
||||
call void @llvm.memset(ptr %1, i8 0, i64 8, i1 false)
|
||||
%2 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %0, 0
|
||||
%3 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/strucintf.struct$MYpsoM99ZwFY087IpUOkIw1zjBA_sgFXVodmn1m-G88", align 8
|
||||
%4 = icmp eq ptr %2, %3
|
||||
br i1 %4, label %_llgo_10, label %_llgo_11
|
||||
|
||||
_llgo_1: ; preds = %_llgo_12
|
||||
%5 = getelementptr inbounds { i64 }, ptr %1, i32 0, i32 0
|
||||
%6 = load i64, ptr %5, align 4
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %6)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_3, %_llgo_1
|
||||
%7 = call %"github.com/goplus/llgo/runtime/internal/runtime.eface" @"github.com/goplus/llgo/cl/_testdata/foo.Bar"()
|
||||
%8 = alloca { i64 }, align 8
|
||||
call void @llvm.memset(ptr %8, i8 0, i64 8, i1 false)
|
||||
%9 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %7, 0
|
||||
%10 = load ptr, ptr @"_llgo_struct$K-dZ9QotZfVPz2a0YdRa9vmZUuDXPTqZOlMShKEDJtk", align 8
|
||||
%11 = icmp eq ptr %9, %10
|
||||
br i1 %11, label %_llgo_13, label %_llgo_14
|
||||
|
||||
_llgo_3: ; preds = %_llgo_12
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 11 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_4: ; preds = %_llgo_15
|
||||
%12 = getelementptr inbounds { i64 }, ptr %8, i32 0, i32 0
|
||||
%13 = load i64, ptr %12, align 4
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %13)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
br label %_llgo_5
|
||||
|
||||
_llgo_5: ; preds = %_llgo_6, %_llgo_4
|
||||
%14 = alloca { i64 }, align 8
|
||||
call void @llvm.memset(ptr %14, i8 0, i64 8, i1 false)
|
||||
%15 = call %"github.com/goplus/llgo/runtime/internal/runtime.eface" @"github.com/goplus/llgo/cl/_testdata/foo.F"()
|
||||
%16 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %15, 0
|
||||
%17 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/strucintf.struct$MYpsoM99ZwFY087IpUOkIw1zjBA_sgFXVodmn1m-G88", align 8
|
||||
%18 = icmp eq ptr %16, %17
|
||||
br i1 %18, label %_llgo_16, label %_llgo_17
|
||||
|
||||
_llgo_6: ; preds = %_llgo_15
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 11 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
br label %_llgo_5
|
||||
|
||||
_llgo_7: ; preds = %_llgo_18
|
||||
%19 = getelementptr inbounds { i64 }, ptr %14, i32 0, i32 0
|
||||
%20 = load i64, ptr %19, align 4
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %20)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
br label %_llgo_8
|
||||
|
||||
_llgo_8: ; preds = %_llgo_9, %_llgo_7
|
||||
ret void
|
||||
|
||||
_llgo_9: ; preds = %_llgo_18
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 9 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
br label %_llgo_8
|
||||
|
||||
_llgo_10: ; preds = %_llgo_0
|
||||
%21 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %0, 1
|
||||
%22 = ptrtoint ptr %21 to i64
|
||||
%23 = insertvalue { i64 } undef, i64 %22, 0
|
||||
%24 = insertvalue { { i64 }, i1 } undef, { i64 } %23, 0
|
||||
%25 = insertvalue { { i64 }, i1 } %24, i1 true, 1
|
||||
br label %_llgo_12
|
||||
|
||||
_llgo_11: ; preds = %_llgo_0
|
||||
br label %_llgo_12
|
||||
|
||||
_llgo_12: ; preds = %_llgo_11, %_llgo_10
|
||||
%26 = phi { { i64 }, i1 } [ %25, %_llgo_10 ], [ zeroinitializer, %_llgo_11 ]
|
||||
%27 = extractvalue { { i64 }, i1 } %26, 0
|
||||
store { i64 } %27, ptr %1, align 4
|
||||
%28 = extractvalue { { i64 }, i1 } %26, 1
|
||||
br i1 %28, label %_llgo_1, label %_llgo_3
|
||||
|
||||
_llgo_13: ; preds = %_llgo_2
|
||||
%29 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %7, 1
|
||||
%30 = ptrtoint ptr %29 to i64
|
||||
%31 = insertvalue { i64 } undef, i64 %30, 0
|
||||
%32 = insertvalue { { i64 }, i1 } undef, { i64 } %31, 0
|
||||
%33 = insertvalue { { i64 }, i1 } %32, i1 true, 1
|
||||
br label %_llgo_15
|
||||
|
||||
_llgo_14: ; preds = %_llgo_2
|
||||
br label %_llgo_15
|
||||
|
||||
_llgo_15: ; preds = %_llgo_14, %_llgo_13
|
||||
%34 = phi { { i64 }, i1 } [ %33, %_llgo_13 ], [ zeroinitializer, %_llgo_14 ]
|
||||
%35 = extractvalue { { i64 }, i1 } %34, 0
|
||||
store { i64 } %35, ptr %8, align 4
|
||||
%36 = extractvalue { { i64 }, i1 } %34, 1
|
||||
br i1 %36, label %_llgo_4, label %_llgo_6
|
||||
|
||||
_llgo_16: ; preds = %_llgo_5
|
||||
%37 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %15, 1
|
||||
%38 = ptrtoint ptr %37 to i64
|
||||
%39 = insertvalue { i64 } undef, i64 %38, 0
|
||||
%40 = insertvalue { { i64 }, i1 } undef, { i64 } %39, 0
|
||||
%41 = insertvalue { { i64 }, i1 } %40, i1 true, 1
|
||||
br label %_llgo_18
|
||||
|
||||
_llgo_17: ; preds = %_llgo_5
|
||||
br label %_llgo_18
|
||||
|
||||
_llgo_18: ; preds = %_llgo_17, %_llgo_16
|
||||
%42 = phi { { i64 }, i1 } [ %41, %_llgo_16 ], [ zeroinitializer, %_llgo_17 ]
|
||||
%43 = extractvalue { { i64 }, i1 } %42, 0
|
||||
store { i64 } %43, ptr %14, align 4
|
||||
%44 = extractvalue { { i64 }, i1 } %42, 1
|
||||
br i1 %44, label %_llgo_7, label %_llgo_9
|
||||
}
|
||||
|
||||
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
|
||||
declare void @llvm.memset(ptr nocapture writeonly, i8, i64, i1 immarg) #0
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/strucintf.init$after"() {
|
||||
_llgo_0:
|
||||
%0 = load ptr, ptr @_llgo_int, align 8
|
||||
%1 = icmp eq ptr %0, null
|
||||
br i1 %1, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34)
|
||||
store ptr %2, ptr @_llgo_int, align 8
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34)
|
||||
%4 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 1 }, ptr %3, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 56)
|
||||
%6 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %5, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %4, ptr %6, align 8
|
||||
%7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %5, 0
|
||||
%8 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %7, i64 1, 1
|
||||
%9 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %8, i64 1, 2
|
||||
%10 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 43 }, i64 8, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %9)
|
||||
store ptr %10, ptr @"github.com/goplus/llgo/cl/_testgo/strucintf.struct$MYpsoM99ZwFY087IpUOkIw1zjBA_sgFXVodmn1m-G88", align 8
|
||||
%11 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34)
|
||||
%12 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 1 }, ptr %11, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%13 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 56)
|
||||
%14 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %13, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %12, ptr %14, align 8
|
||||
%15 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %13, 0
|
||||
%16 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %15, i64 1, 1
|
||||
%17 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %16, i64 1, 2
|
||||
%18 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 43 }, i64 8, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %17)
|
||||
store ptr %18, ptr @"_llgo_struct$K-dZ9QotZfVPz2a0YdRa9vmZUuDXPTqZOlMShKEDJtk", align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String", i64, %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/cl/_testdata/foo.init"()
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/internal/runtime.eface" @"github.com/goplus/llgo/cl/_testdata/foo.Bar"()
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/internal/runtime.eface" @"github.com/goplus/llgo/cl/_testdata/foo.F"()
|
||||
|
||||
attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
|
||||
26
cl/_testgo/struczero/in.go
Normal file
26
cl/_testgo/struczero/in.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import "github.com/goplus/llgo/cl/_testdata/foo"
|
||||
|
||||
type bar struct {
|
||||
pb *byte
|
||||
f float32
|
||||
}
|
||||
|
||||
func Foo(v any) (ret bar, ok bool) {
|
||||
ret, ok = v.(bar)
|
||||
return
|
||||
}
|
||||
|
||||
func Bar(v any) (ret foo.Foo, ok bool) {
|
||||
ret, ok = v.(foo.Foo)
|
||||
return
|
||||
}
|
||||
|
||||
func main() {
|
||||
ret, ok := Foo(nil)
|
||||
println(ret.pb, ret.f, "notOk:", !ok)
|
||||
|
||||
ret2, ok2 := Bar(foo.Foo{})
|
||||
println(ret2.Pb(), ret2.F, ok2)
|
||||
}
|
||||
317
cl/_testgo/struczero/out.ll
Normal file
317
cl/_testgo/struczero/out.ll
Normal file
@@ -0,0 +1,317 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/struczero'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/struczero"
|
||||
|
||||
%"github.com/goplus/llgo/cl/_testdata/foo.Foo" = type { ptr, float }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/cl/_testgo/struczero.bar" = type { ptr, float }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/runtime/abi.StructField" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"github.com/goplus/llgo/runtime/abi.Method" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, ptr, ptr }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/struczero.init$guard" = global i1 false, align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Foo" = linkonce global ptr null, align 8
|
||||
@0 = private unnamed_addr constant [39 x i8] c"github.com/goplus/llgo/cl/_testdata/foo", align 1
|
||||
@1 = private unnamed_addr constant [3 x i8] c"Foo", align 1
|
||||
@_llgo_uint8 = linkonce global ptr null, align 8
|
||||
@"*_llgo_uint8" = linkonce global ptr null, align 8
|
||||
@_llgo_float32 = linkonce global ptr null, align 8
|
||||
@"github.com/goplus/llgo/cl/_testgo/struczero.struct$gB-6lDCpZ0V7ma2GTPMARivfSutm75zh84uE5OqxsI4" = linkonce global ptr null, align 8
|
||||
@2 = private unnamed_addr constant [2 x i8] c"pb", align 1
|
||||
@3 = private unnamed_addr constant [1 x i8] c"F", align 1
|
||||
@4 = private unnamed_addr constant [43 x i8] c"github.com/goplus/llgo/cl/_testgo/struczero", align 1
|
||||
@5 = private unnamed_addr constant [2 x i8] c"Pb", align 1
|
||||
@"_llgo_func$bbS9EKnYgxbrRntc_6WJN6WLF9IKQADblvN_cLtKCqY" = linkonce global ptr null, align 8
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/struczero.bar" = linkonce global ptr null, align 8
|
||||
@6 = private unnamed_addr constant [3 x i8] c"bar", align 1
|
||||
@"github.com/goplus/llgo/cl/_testgo/struczero.struct$2215Oa2lkpk-YZ2pdVVs2mMqzhx1jppOCrAxbrX70ko" = linkonce global ptr null, align 8
|
||||
@7 = private unnamed_addr constant [1 x i8] c"f", align 1
|
||||
@8 = private unnamed_addr constant [6 x i8] c"notOk:", align 1
|
||||
|
||||
define { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } @"github.com/goplus/llgo/cl/_testgo/struczero.Bar"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %0) {
|
||||
_llgo_0:
|
||||
%1 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %0, 0
|
||||
%2 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Foo", align 8
|
||||
%3 = icmp eq ptr %1, %2
|
||||
br i1 %3, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%4 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %0, 1
|
||||
%5 = load %"github.com/goplus/llgo/cl/_testdata/foo.Foo", ptr %4, align 8
|
||||
%6 = insertvalue { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } undef, %"github.com/goplus/llgo/cl/_testdata/foo.Foo" %5, 0
|
||||
%7 = insertvalue { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } %6, i1 true, 1
|
||||
br label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_0
|
||||
br label %_llgo_3
|
||||
|
||||
_llgo_3: ; preds = %_llgo_2, %_llgo_1
|
||||
%8 = phi { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } [ %7, %_llgo_1 ], [ zeroinitializer, %_llgo_2 ]
|
||||
%9 = extractvalue { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } %8, 0
|
||||
%10 = extractvalue { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } %8, 1
|
||||
%11 = insertvalue { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } undef, %"github.com/goplus/llgo/cl/_testdata/foo.Foo" %9, 0
|
||||
%12 = insertvalue { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } %11, i1 %10, 1
|
||||
ret { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } %12
|
||||
}
|
||||
|
||||
define { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } @"github.com/goplus/llgo/cl/_testgo/struczero.Foo"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %0) {
|
||||
_llgo_0:
|
||||
%1 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %0, 0
|
||||
%2 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/struczero.bar", align 8
|
||||
%3 = icmp eq ptr %1, %2
|
||||
br i1 %3, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%4 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %0, 1
|
||||
%5 = load %"github.com/goplus/llgo/cl/_testgo/struczero.bar", ptr %4, align 8
|
||||
%6 = insertvalue { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } undef, %"github.com/goplus/llgo/cl/_testgo/struczero.bar" %5, 0
|
||||
%7 = insertvalue { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } %6, i1 true, 1
|
||||
br label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_0
|
||||
br label %_llgo_3
|
||||
|
||||
_llgo_3: ; preds = %_llgo_2, %_llgo_1
|
||||
%8 = phi { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } [ %7, %_llgo_1 ], [ zeroinitializer, %_llgo_2 ]
|
||||
%9 = extractvalue { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } %8, 0
|
||||
%10 = extractvalue { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } %8, 1
|
||||
%11 = insertvalue { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } undef, %"github.com/goplus/llgo/cl/_testgo/struczero.bar" %9, 0
|
||||
%12 = insertvalue { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } %11, i1 %10, 1
|
||||
ret { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } %12
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/struczero.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/struczero.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/struczero.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testdata/foo.init"()
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/struczero.init$after"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/struczero.main"() {
|
||||
_llgo_0:
|
||||
%0 = alloca %"github.com/goplus/llgo/cl/_testgo/struczero.bar", align 8
|
||||
call void @llvm.memset(ptr %0, i8 0, i64 16, i1 false)
|
||||
%1 = call { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } @"github.com/goplus/llgo/cl/_testgo/struczero.Foo"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" zeroinitializer)
|
||||
%2 = extractvalue { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } %1, 0
|
||||
store %"github.com/goplus/llgo/cl/_testgo/struczero.bar" %2, ptr %0, align 8
|
||||
%3 = extractvalue { %"github.com/goplus/llgo/cl/_testgo/struczero.bar", i1 } %1, 1
|
||||
%4 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/struczero.bar", ptr %0, i32 0, i32 0
|
||||
%5 = load ptr, ptr %4, align 8
|
||||
%6 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/struczero.bar", ptr %0, i32 0, i32 1
|
||||
%7 = load float, ptr %6, align 4
|
||||
%8 = xor i1 %3, true
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr %5)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
%9 = fpext float %7 to double
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double %9)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @8, i64 6 })
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %8)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%10 = alloca %"github.com/goplus/llgo/cl/_testdata/foo.Foo", align 8
|
||||
call void @llvm.memset(ptr %10, i8 0, i64 16, i1 false)
|
||||
%11 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Foo", align 8
|
||||
%12 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/cl/_testdata/foo.Foo" zeroinitializer, ptr %12, align 8
|
||||
%13 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %11, 0
|
||||
%14 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %13, ptr %12, 1
|
||||
%15 = call { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } @"github.com/goplus/llgo/cl/_testgo/struczero.Bar"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %14)
|
||||
%16 = extractvalue { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } %15, 0
|
||||
store %"github.com/goplus/llgo/cl/_testdata/foo.Foo" %16, ptr %10, align 8
|
||||
%17 = extractvalue { %"github.com/goplus/llgo/cl/_testdata/foo.Foo", i1 } %15, 1
|
||||
%18 = load %"github.com/goplus/llgo/cl/_testdata/foo.Foo", ptr %10, align 8
|
||||
%19 = call ptr @"github.com/goplus/llgo/cl/_testdata/foo.Foo.Pb"(%"github.com/goplus/llgo/cl/_testdata/foo.Foo" %18)
|
||||
%20 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testdata/foo.Foo", ptr %10, i32 0, i32 1
|
||||
%21 = load float, ptr %20, align 4
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr %19)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
%22 = fpext float %21 to double
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double %22)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1 %17)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/struczero.init$after"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 39 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 3 }, i64 25, i64 16, i64 1, i64 1)
|
||||
%1 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Foo", align 8
|
||||
%2 = icmp eq ptr %1, null
|
||||
br i1 %2, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store ptr %0, ptr @"_llgo_github.com/goplus/llgo/cl/_testdata/foo.Foo", align 8
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
%3 = load ptr, ptr @_llgo_uint8, 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/runtime/internal/runtime.Basic"(i64 40)
|
||||
store ptr %5, ptr @_llgo_uint8, align 8
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_4: ; preds = %_llgo_3, %_llgo_2
|
||||
%6 = load ptr, ptr @_llgo_uint8, align 8
|
||||
%7 = load ptr, ptr @"*_llgo_uint8", align 8
|
||||
%8 = icmp eq ptr %7, null
|
||||
br i1 %8, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4
|
||||
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
|
||||
%10 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %9)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %10)
|
||||
store ptr %10, ptr @"*_llgo_uint8", align 8
|
||||
br label %_llgo_6
|
||||
|
||||
_llgo_6: ; preds = %_llgo_5, %_llgo_4
|
||||
%11 = load ptr, ptr @"*_llgo_uint8", align 8
|
||||
%12 = load ptr, ptr @_llgo_float32, align 8
|
||||
%13 = icmp eq ptr %12, null
|
||||
br i1 %13, label %_llgo_7, label %_llgo_8
|
||||
|
||||
_llgo_7: ; preds = %_llgo_6
|
||||
%14 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 45)
|
||||
store ptr %14, ptr @_llgo_float32, align 8
|
||||
br label %_llgo_8
|
||||
|
||||
_llgo_8: ; preds = %_llgo_7, %_llgo_6
|
||||
%15 = load ptr, ptr @_llgo_float32, align 8
|
||||
%16 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
|
||||
%17 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %16)
|
||||
%18 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 2 }, ptr %17, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%19 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 45)
|
||||
%20 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 1 }, ptr %19, i64 8, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%21 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 112)
|
||||
%22 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %21, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %18, ptr %22, align 8
|
||||
%23 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %21, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %20, ptr %23, align 8
|
||||
%24 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %21, 0
|
||||
%25 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %24, i64 2, 1
|
||||
%26 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %25, i64 2, 2
|
||||
%27 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 43 }, i64 16, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %26)
|
||||
store ptr %27, ptr @"github.com/goplus/llgo/cl/_testgo/struczero.struct$gB-6lDCpZ0V7ma2GTPMARivfSutm75zh84uE5OqxsI4", align 8
|
||||
%28 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/struczero.struct$gB-6lDCpZ0V7ma2GTPMARivfSutm75zh84uE5OqxsI4", align 8
|
||||
br i1 %2, label %_llgo_9, label %_llgo_10
|
||||
|
||||
_llgo_9: ; preds = %_llgo_8
|
||||
%29 = load ptr, ptr @"*_llgo_uint8", align 8
|
||||
%30 = load ptr, ptr @"*_llgo_uint8", align 8
|
||||
%31 = load ptr, ptr @"_llgo_func$bbS9EKnYgxbrRntc_6WJN6WLF9IKQADblvN_cLtKCqY", align 8
|
||||
%32 = icmp eq ptr %31, null
|
||||
br i1 %32, label %_llgo_11, label %_llgo_12
|
||||
|
||||
_llgo_10: ; preds = %_llgo_12, %_llgo_8
|
||||
%33 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 43 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 3 }, i64 25, i64 16, i64 0, i64 0)
|
||||
store ptr %33, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/struczero.bar", align 8
|
||||
%34 = load ptr, ptr @"*_llgo_uint8", align 8
|
||||
%35 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 40)
|
||||
%36 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %35)
|
||||
%37 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 2 }, ptr %36, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%38 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 45)
|
||||
%39 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 1 }, ptr %38, i64 8, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%40 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 112)
|
||||
%41 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %40, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %37, ptr %41, align 8
|
||||
%42 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %40, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %39, ptr %42, align 8
|
||||
%43 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %40, 0
|
||||
%44 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %43, i64 2, 1
|
||||
%45 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %44, i64 2, 2
|
||||
%46 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @4, i64 43 }, i64 16, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %45)
|
||||
store ptr %46, ptr @"github.com/goplus/llgo/cl/_testgo/struczero.struct$2215Oa2lkpk-YZ2pdVVs2mMqzhx1jppOCrAxbrX70ko", align 8
|
||||
%47 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/struczero.struct$2215Oa2lkpk-YZ2pdVVs2mMqzhx1jppOCrAxbrX70ko", align 8
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %33, ptr %47, { ptr, i64, i64 } zeroinitializer, { ptr, i64, i64 } zeroinitializer)
|
||||
ret void
|
||||
|
||||
_llgo_11: ; preds = %_llgo_9
|
||||
%48 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%49 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %48, 0
|
||||
%50 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %49, i64 0, 1
|
||||
%51 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %50, i64 0, 2
|
||||
%52 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
|
||||
%53 = getelementptr ptr, ptr %52, i64 0
|
||||
store ptr %30, ptr %53, align 8
|
||||
%54 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %52, 0
|
||||
%55 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %54, i64 1, 1
|
||||
%56 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %55, i64 1, 2
|
||||
%57 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %51, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %56, i1 false)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %57)
|
||||
store ptr %57, ptr @"_llgo_func$bbS9EKnYgxbrRntc_6WJN6WLF9IKQADblvN_cLtKCqY", align 8
|
||||
br label %_llgo_12
|
||||
|
||||
_llgo_12: ; preds = %_llgo_11, %_llgo_9
|
||||
%58 = load ptr, ptr @"_llgo_func$bbS9EKnYgxbrRntc_6WJN6WLF9IKQADblvN_cLtKCqY", align 8
|
||||
%59 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 2 }, ptr undef, ptr undef, ptr undef }, ptr %58, 1
|
||||
%60 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %59, ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Foo).Pb", 2
|
||||
%61 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %60, ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Foo).Pb", 3
|
||||
%62 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 2 }, ptr undef, ptr undef, ptr undef }, ptr %58, 1
|
||||
%63 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %62, ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Foo).Pb", 2
|
||||
%64 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %63, ptr @"github.com/goplus/llgo/cl/_testdata/foo.Foo.Pb", 3
|
||||
%65 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 40)
|
||||
%66 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %65, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %64, ptr %66, align 8
|
||||
%67 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %65, 0
|
||||
%68 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %67, i64 1, 1
|
||||
%69 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %68, i64 1, 2
|
||||
%70 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 40)
|
||||
%71 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %70, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %61, ptr %71, align 8
|
||||
%72 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %70, 0
|
||||
%73 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %72, i64 1, 1
|
||||
%74 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %73, i64 1, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %0, ptr %28, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %69, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %74)
|
||||
br label %_llgo_10
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String", i64, i64, i64, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String", i64, %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr, ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/cl/_testdata/foo.(*Foo).Pb"(ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/cl/_testdata/foo.Foo.Pb"(%"github.com/goplus/llgo/cl/_testdata/foo.Foo")
|
||||
|
||||
declare void @"github.com/goplus/llgo/cl/_testdata/foo.init"()
|
||||
|
||||
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
|
||||
declare void @llvm.memset(ptr nocapture writeonly, i8, i64, i1 immarg) #0
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintPointer"(ptr)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintFloat"(double)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintBool"(i1)
|
||||
|
||||
attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
|
||||
18
cl/_testgo/syncmap/in.go
Normal file
18
cl/_testgo/syncmap/in.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var m sync.Map
|
||||
m.Store(1, "hello")
|
||||
m.Store("1", 100)
|
||||
v, ok := m.Load("1")
|
||||
fmt.Println(v, ok)
|
||||
m.Range(func(k, v interface{}) bool {
|
||||
fmt.Printf("%#v %v\n", k, v)
|
||||
return true
|
||||
})
|
||||
}
|
||||
1
cl/_testgo/syncmap/out.ll
Normal file
1
cl/_testgo/syncmap/out.ll
Normal file
@@ -0,0 +1 @@
|
||||
;
|
||||
18
cl/_testgo/tpindex/in.go
Normal file
18
cl/_testgo/tpindex/in.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
// The index function returns the index of the first occurrence of v in s,
|
||||
// or -1 if not present.
|
||||
func index[E comparable](s []E, v E) int {
|
||||
for i, vs := range s {
|
||||
if v == vs {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func main() {
|
||||
s := []int{1, 3, 5, 2, 4}
|
||||
println(index(s, 3))
|
||||
println(index(s, 6))
|
||||
}
|
||||
82
cl/_testgo/tpindex/out.ll
Normal file
82
cl/_testgo/tpindex/out.ll
Normal file
@@ -0,0 +1,82 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/tpindex'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/tpindex"
|
||||
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/tpindex.init$guard" = global i1 false, align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tpindex.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/tpindex.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/tpindex.init$guard", align 1
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tpindex.main"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 40)
|
||||
%1 = getelementptr inbounds i64, ptr %0, i64 0
|
||||
store i64 1, ptr %1, align 4
|
||||
%2 = getelementptr inbounds i64, ptr %0, i64 1
|
||||
store i64 3, ptr %2, align 4
|
||||
%3 = getelementptr inbounds i64, ptr %0, i64 2
|
||||
store i64 5, ptr %3, align 4
|
||||
%4 = getelementptr inbounds i64, ptr %0, i64 3
|
||||
store i64 2, ptr %4, align 4
|
||||
%5 = getelementptr inbounds i64, ptr %0, i64 4
|
||||
store i64 4, ptr %5, align 4
|
||||
%6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %0, 0
|
||||
%7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %6, i64 5, 1
|
||||
%8 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %7, i64 5, 2
|
||||
%9 = call i64 @"github.com/goplus/llgo/cl/_testgo/tpindex.index[int]"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %8, i64 3)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %9)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%10 = call i64 @"github.com/goplus/llgo/cl/_testgo/tpindex.index[int]"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %8, i64 6)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %10)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
||||
|
||||
define linkonce i64 @"github.com/goplus/llgo/cl/_testgo/tpindex.index[int]"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %0, i64 %1) {
|
||||
_llgo_0:
|
||||
%2 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %0, 1
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
%3 = phi i64 [ -1, %_llgo_0 ], [ %4, %_llgo_2 ]
|
||||
%4 = add i64 %3, 1
|
||||
%5 = icmp slt i64 %4, %2
|
||||
br i1 %5, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1
|
||||
%6 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %0, 0
|
||||
%7 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %0, 1
|
||||
%8 = icmp slt i64 %4, 0
|
||||
%9 = icmp sge i64 %4, %7
|
||||
%10 = or i1 %9, %8
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %10)
|
||||
%11 = getelementptr inbounds i64, ptr %6, i64 %4
|
||||
%12 = load i64, ptr %11, align 4
|
||||
%13 = icmp eq i64 %1, %12
|
||||
br i1 %13, label %_llgo_4, label %_llgo_1
|
||||
|
||||
_llgo_3: ; preds = %_llgo_1
|
||||
ret i64 -1
|
||||
|
||||
_llgo_4: ; preds = %_llgo_2
|
||||
ret i64 %4
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1)
|
||||
37
cl/_testgo/tpinst/main.go
Normal file
37
cl/_testgo/tpinst/main.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package main
|
||||
|
||||
type M[T interface{}] struct {
|
||||
v T
|
||||
}
|
||||
|
||||
func (pt *M[T]) Value() T {
|
||||
return pt.v
|
||||
}
|
||||
|
||||
func (pt *M[T]) value() T {
|
||||
return pt.v
|
||||
}
|
||||
|
||||
type I[T interface{}] interface {
|
||||
Value() T
|
||||
}
|
||||
|
||||
func demo() {
|
||||
var v1 I[int] = &M[int]{100}
|
||||
if v1.Value() != 100 {
|
||||
panic("error")
|
||||
}
|
||||
|
||||
var v2 I[float64] = &M[float64]{100.1}
|
||||
if v2.Value() != 100.1 {
|
||||
panic("error")
|
||||
}
|
||||
|
||||
if v1.(interface{ value() int }).value() != 100 {
|
||||
panic("error")
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
demo()
|
||||
}
|
||||
468
cl/_testgo/tpinst/out.ll
Normal file
468
cl/_testgo/tpinst/out.ll
Normal file
@@ -0,0 +1,468 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/tpinst'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/tpinst"
|
||||
|
||||
%"github.com/goplus/llgo/cl/_testgo/tpinst.M[int]" = type { i64 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.iface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]" = type { double }
|
||||
%"github.com/goplus/llgo/runtime/abi.StructField" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"github.com/goplus/llgo/runtime/abi.Method" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/abi.Imethod" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/tpinst.init$guard" = global i1 false, align 1
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[int]" = linkonce global ptr null, align 8
|
||||
@0 = private unnamed_addr constant [40 x i8] c"github.com/goplus/llgo/cl/_testgo/tpinst", align 1
|
||||
@1 = private unnamed_addr constant [6 x i8] c"M[int]", align 1
|
||||
@_llgo_int = linkonce global ptr null, align 8
|
||||
@"github.com/goplus/llgo/cl/_testgo/tpinst.struct$MYpsoM99ZwFY087IpUOkIw1zjBA_sgFXVodmn1m-G88" = linkonce global ptr null, align 8
|
||||
@2 = private unnamed_addr constant [1 x i8] c"v", align 1
|
||||
@3 = private unnamed_addr constant [5 x i8] c"Value", align 1
|
||||
@"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA" = linkonce global ptr null, align 8
|
||||
@4 = private unnamed_addr constant [5 x i8] c"value", align 1
|
||||
@5 = private unnamed_addr constant [46 x i8] c"github.com/goplus/llgo/cl/_testgo/tpinst.value", align 1
|
||||
@"*_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[int]" = linkonce global ptr null, align 8
|
||||
@"_llgo_iface$Jvxc0PCI_drlfK7S5npMGdZkQLeRkQ_x2e2CifPE6w8" = linkonce global ptr null, align 8
|
||||
@6 = private unnamed_addr constant [5 x i8] c"error", align 1
|
||||
@_llgo_string = linkonce global ptr null, align 8
|
||||
@"_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]" = linkonce global ptr null, align 8
|
||||
@7 = private unnamed_addr constant [10 x i8] c"M[float64]", align 1
|
||||
@_llgo_float64 = linkonce global ptr null, align 8
|
||||
@"github.com/goplus/llgo/cl/_testgo/tpinst.struct$7SZ-TjG6e68olyGxlMRRIOYuZz2LaKIpOrZH-w4GiTU" = linkonce global ptr null, align 8
|
||||
@"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8" = linkonce global ptr null, align 8
|
||||
@"*_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]" = linkonce global ptr null, align 8
|
||||
@"_llgo_iface$2dxw6yZ6V86Spb7J0dTDIoWqg7ba7UDXlAlpJv3-HLk" = linkonce global ptr null, align 8
|
||||
@"github.com/goplus/llgo/cl/_testgo/tpinst.iface$2sV9fFeqOv1SzesvwIdhTqCFzDT8ZX5buKUSAoHNSww" = linkonce global ptr null, align 8
|
||||
@8 = private unnamed_addr constant [95 x i8] c"type assertion github.com/goplus/llgo/cl/_testgo/tpinst.I[int] -> interface{value() int} failed", align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tpinst.demo"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tpinst.M[int]", ptr %0, i32 0, i32 0
|
||||
store i64 100, ptr %1, align 4
|
||||
%2 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[int]", align 8
|
||||
%3 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[int]", align 8
|
||||
%4 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%5 = load ptr, ptr @"_llgo_iface$Jvxc0PCI_drlfK7S5npMGdZkQLeRkQ_x2e2CifPE6w8", align 8
|
||||
%6 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %5, ptr %3)
|
||||
%7 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %6, 0
|
||||
%8 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %7, ptr %0, 1
|
||||
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %8)
|
||||
%10 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %8, 0
|
||||
%11 = getelementptr ptr, ptr %10, i64 3
|
||||
%12 = load ptr, ptr %11, align 8
|
||||
%13 = insertvalue { ptr, ptr } undef, ptr %12, 0
|
||||
%14 = insertvalue { ptr, ptr } %13, ptr %9, 1
|
||||
%15 = extractvalue { ptr, ptr } %14, 1
|
||||
%16 = extractvalue { ptr, ptr } %14, 0
|
||||
%17 = call i64 %16(ptr %15)
|
||||
%18 = icmp ne i64 %17, 100
|
||||
br i1 %18, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%19 = load ptr, ptr @_llgo_string, align 8
|
||||
%20 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 5 }, ptr %20, align 8
|
||||
%21 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %19, 0
|
||||
%22 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %21, ptr %20, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %22)
|
||||
unreachable
|
||||
|
||||
_llgo_2: ; preds = %_llgo_0
|
||||
%23 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
|
||||
%24 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]", ptr %23, i32 0, i32 0
|
||||
store double 1.001000e+02, ptr %24, align 8
|
||||
%25 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]", align 8
|
||||
%26 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]", align 8
|
||||
%27 = load ptr, ptr @"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8", align 8
|
||||
%28 = load ptr, ptr @"_llgo_iface$2dxw6yZ6V86Spb7J0dTDIoWqg7ba7UDXlAlpJv3-HLk", align 8
|
||||
%29 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %28, ptr %26)
|
||||
%30 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %29, 0
|
||||
%31 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %30, ptr %23, 1
|
||||
%32 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %31)
|
||||
%33 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %31, 0
|
||||
%34 = getelementptr ptr, ptr %33, i64 3
|
||||
%35 = load ptr, ptr %34, align 8
|
||||
%36 = insertvalue { ptr, ptr } undef, ptr %35, 0
|
||||
%37 = insertvalue { ptr, ptr } %36, ptr %32, 1
|
||||
%38 = extractvalue { ptr, ptr } %37, 1
|
||||
%39 = extractvalue { ptr, ptr } %37, 0
|
||||
%40 = call double %39(ptr %38)
|
||||
%41 = fcmp une double %40, 1.001000e+02
|
||||
br i1 %41, label %_llgo_3, label %_llgo_4
|
||||
|
||||
_llgo_3: ; preds = %_llgo_2
|
||||
%42 = load ptr, ptr @_llgo_string, align 8
|
||||
%43 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 5 }, ptr %43, align 8
|
||||
%44 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %42, 0
|
||||
%45 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %44, ptr %43, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %45)
|
||||
unreachable
|
||||
|
||||
_llgo_4: ; preds = %_llgo_2
|
||||
%46 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %8)
|
||||
%47 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%48 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.iface$2sV9fFeqOv1SzesvwIdhTqCFzDT8ZX5buKUSAoHNSww", align 8
|
||||
%49 = call i1 @"github.com/goplus/llgo/runtime/internal/runtime.Implements"(ptr %48, ptr %46)
|
||||
br i1 %49, label %_llgo_7, label %_llgo_8
|
||||
|
||||
_llgo_5: ; preds = %_llgo_7
|
||||
%50 = load ptr, ptr @_llgo_string, align 8
|
||||
%51 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @6, i64 5 }, ptr %51, align 8
|
||||
%52 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %50, 0
|
||||
%53 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %52, ptr %51, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %53)
|
||||
unreachable
|
||||
|
||||
_llgo_6: ; preds = %_llgo_7
|
||||
ret void
|
||||
|
||||
_llgo_7: ; preds = %_llgo_4
|
||||
%54 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %8, 1
|
||||
%55 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.iface$2sV9fFeqOv1SzesvwIdhTqCFzDT8ZX5buKUSAoHNSww", align 8
|
||||
%56 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr %55, ptr %46)
|
||||
%57 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" undef, ptr %56, 0
|
||||
%58 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %57, ptr %54, 1
|
||||
%59 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface" %58)
|
||||
%60 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.iface" %58, 0
|
||||
%61 = getelementptr ptr, ptr %60, i64 3
|
||||
%62 = load ptr, ptr %61, align 8
|
||||
%63 = insertvalue { ptr, ptr } undef, ptr %62, 0
|
||||
%64 = insertvalue { ptr, ptr } %63, ptr %59, 1
|
||||
%65 = extractvalue { ptr, ptr } %64, 1
|
||||
%66 = extractvalue { ptr, ptr } %64, 0
|
||||
%67 = call i64 %66(ptr %65)
|
||||
%68 = icmp ne i64 %67, 100
|
||||
br i1 %68, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_8: ; preds = %_llgo_4
|
||||
%69 = load ptr, ptr @_llgo_string, align 8
|
||||
%70 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @8, i64 95 }, ptr %70, align 8
|
||||
%71 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %69, 0
|
||||
%72 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %71, ptr %70, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %72)
|
||||
unreachable
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tpinst.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/tpinst.init$after"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tpinst.main"() {
|
||||
_llgo_0:
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/tpinst.demo"()
|
||||
ret void
|
||||
}
|
||||
|
||||
define linkonce double @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[float64]).Value"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]", ptr %0, i32 0, i32 0
|
||||
%2 = load double, ptr %1, align 8
|
||||
ret double %2
|
||||
}
|
||||
|
||||
define linkonce double @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[float64]).value"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]", ptr %0, i32 0, i32 0
|
||||
%2 = load double, ptr %1, align 8
|
||||
ret double %2
|
||||
}
|
||||
|
||||
define linkonce i64 @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[int]).Value"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tpinst.M[int]", ptr %0, i32 0, i32 0
|
||||
%2 = load i64, ptr %1, align 4
|
||||
ret i64 %2
|
||||
}
|
||||
|
||||
define linkonce i64 @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[int]).value"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tpinst.M[int]", ptr %0, i32 0, i32 0
|
||||
%2 = load i64, ptr %1, align 4
|
||||
ret i64 %2
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tpinst.init$after"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 6 }, i64 25, i64 8, i64 0, i64 2)
|
||||
%1 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[int]", align 8
|
||||
%2 = icmp eq ptr %1, null
|
||||
br i1 %2, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store ptr %0, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[int]", align 8
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
%3 = load ptr, ptr @_llgo_int, 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/runtime/internal/runtime.Basic"(i64 34)
|
||||
store ptr %5, ptr @_llgo_int, align 8
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_4: ; preds = %_llgo_3, %_llgo_2
|
||||
%6 = load ptr, ptr @_llgo_int, align 8
|
||||
%7 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34)
|
||||
%8 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 1 }, ptr %7, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%9 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 56)
|
||||
%10 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %9, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %8, ptr %10, align 8
|
||||
%11 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %9, 0
|
||||
%12 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %11, i64 1, 1
|
||||
%13 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %12, i64 1, 2
|
||||
%14 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, i64 8, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %13)
|
||||
store ptr %14, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.struct$MYpsoM99ZwFY087IpUOkIw1zjBA_sgFXVodmn1m-G88", align 8
|
||||
%15 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.struct$MYpsoM99ZwFY087IpUOkIw1zjBA_sgFXVodmn1m-G88", align 8
|
||||
br i1 %2, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4
|
||||
%16 = load ptr, ptr @_llgo_int, align 8
|
||||
%17 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%18 = icmp eq ptr %17, null
|
||||
br i1 %18, label %_llgo_7, label %_llgo_8
|
||||
|
||||
_llgo_6: ; preds = %_llgo_8, %_llgo_4
|
||||
%19 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 6 }, i64 25, i64 8, i64 0, i64 2)
|
||||
%20 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[int]", align 8
|
||||
%21 = icmp eq ptr %20, null
|
||||
br i1 %21, label %_llgo_9, label %_llgo_10
|
||||
|
||||
_llgo_7: ; preds = %_llgo_5
|
||||
%22 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%23 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %22, 0
|
||||
%24 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %23, i64 0, 1
|
||||
%25 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %24, i64 0, 2
|
||||
%26 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
|
||||
%27 = getelementptr ptr, ptr %26, i64 0
|
||||
store ptr %16, ptr %27, align 8
|
||||
%28 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %26, 0
|
||||
%29 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %28, i64 1, 1
|
||||
%30 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %29, i64 1, 2
|
||||
%31 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %25, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %30, i1 false)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %31)
|
||||
store ptr %31, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
br label %_llgo_8
|
||||
|
||||
_llgo_8: ; preds = %_llgo_7, %_llgo_5
|
||||
%32 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%33 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 5 }, ptr undef, ptr undef, ptr undef }, ptr %32, 1
|
||||
%34 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %33, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[int]).Value", 2
|
||||
%35 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %34, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[int]).Value", 3
|
||||
%36 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%37 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 46 }, ptr undef, ptr undef, ptr undef }, ptr %36, 1
|
||||
%38 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %37, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[int]).value", 2
|
||||
%39 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %38, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[int]).value", 3
|
||||
%40 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 80)
|
||||
%41 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %40, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %35, ptr %41, align 8
|
||||
%42 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %40, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %39, ptr %42, align 8
|
||||
%43 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %40, 0
|
||||
%44 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %43, i64 2, 1
|
||||
%45 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %44, i64 2, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %0, ptr %15, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %45)
|
||||
br label %_llgo_6
|
||||
|
||||
_llgo_9: ; preds = %_llgo_6
|
||||
%46 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %19)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %46)
|
||||
store ptr %46, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[int]", align 8
|
||||
br label %_llgo_10
|
||||
|
||||
_llgo_10: ; preds = %_llgo_9, %_llgo_6
|
||||
%47 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%48 = load ptr, ptr @"_llgo_iface$Jvxc0PCI_drlfK7S5npMGdZkQLeRkQ_x2e2CifPE6w8", align 8
|
||||
%49 = icmp eq ptr %48, null
|
||||
br i1 %49, label %_llgo_11, label %_llgo_12
|
||||
|
||||
_llgo_11: ; preds = %_llgo_10
|
||||
%50 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 5 }, ptr undef }, ptr %47, 1
|
||||
%51 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 24)
|
||||
%52 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %51, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %50, ptr %52, align 8
|
||||
%53 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %51, 0
|
||||
%54 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %53, i64 1, 1
|
||||
%55 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %54, i64 1, 2
|
||||
%56 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %55)
|
||||
store ptr %56, ptr @"_llgo_iface$Jvxc0PCI_drlfK7S5npMGdZkQLeRkQ_x2e2CifPE6w8", align 8
|
||||
br label %_llgo_12
|
||||
|
||||
_llgo_12: ; preds = %_llgo_11, %_llgo_10
|
||||
%57 = load ptr, ptr @_llgo_string, align 8
|
||||
%58 = icmp eq ptr %57, null
|
||||
br i1 %58, label %_llgo_13, label %_llgo_14
|
||||
|
||||
_llgo_13: ; preds = %_llgo_12
|
||||
%59 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
||||
store ptr %59, ptr @_llgo_string, align 8
|
||||
br label %_llgo_14
|
||||
|
||||
_llgo_14: ; preds = %_llgo_13, %_llgo_12
|
||||
%60 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 10 }, i64 25, i64 8, i64 0, i64 2)
|
||||
%61 = load ptr, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]", align 8
|
||||
%62 = icmp eq ptr %61, null
|
||||
br i1 %62, label %_llgo_15, label %_llgo_16
|
||||
|
||||
_llgo_15: ; preds = %_llgo_14
|
||||
store ptr %60, ptr @"_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]", align 8
|
||||
br label %_llgo_16
|
||||
|
||||
_llgo_16: ; preds = %_llgo_15, %_llgo_14
|
||||
%63 = load ptr, ptr @_llgo_float64, align 8
|
||||
%64 = icmp eq ptr %63, null
|
||||
br i1 %64, label %_llgo_17, label %_llgo_18
|
||||
|
||||
_llgo_17: ; preds = %_llgo_16
|
||||
%65 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 46)
|
||||
store ptr %65, ptr @_llgo_float64, align 8
|
||||
br label %_llgo_18
|
||||
|
||||
_llgo_18: ; preds = %_llgo_17, %_llgo_16
|
||||
%66 = load ptr, ptr @_llgo_float64, align 8
|
||||
%67 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 46)
|
||||
%68 = call %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @2, i64 1 }, ptr %67, i64 0, %"github.com/goplus/llgo/runtime/internal/runtime.String" zeroinitializer, i1 false)
|
||||
%69 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 56)
|
||||
%70 = getelementptr %"github.com/goplus/llgo/runtime/abi.StructField", ptr %69, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.StructField" %68, ptr %70, align 8
|
||||
%71 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %69, 0
|
||||
%72 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %71, i64 1, 1
|
||||
%73 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %72, i64 1, 2
|
||||
%74 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, i64 8, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %73)
|
||||
store ptr %74, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.struct$7SZ-TjG6e68olyGxlMRRIOYuZz2LaKIpOrZH-w4GiTU", align 8
|
||||
%75 = load ptr, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.struct$7SZ-TjG6e68olyGxlMRRIOYuZz2LaKIpOrZH-w4GiTU", align 8
|
||||
br i1 %62, label %_llgo_19, label %_llgo_20
|
||||
|
||||
_llgo_19: ; preds = %_llgo_18
|
||||
%76 = load ptr, ptr @_llgo_float64, align 8
|
||||
%77 = load ptr, ptr @"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8", align 8
|
||||
%78 = icmp eq ptr %77, null
|
||||
br i1 %78, label %_llgo_21, label %_llgo_22
|
||||
|
||||
_llgo_20: ; preds = %_llgo_22, %_llgo_18
|
||||
%79 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @7, i64 10 }, i64 25, i64 8, i64 0, i64 2)
|
||||
%80 = load ptr, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]", align 8
|
||||
%81 = icmp eq ptr %80, null
|
||||
br i1 %81, label %_llgo_23, label %_llgo_24
|
||||
|
||||
_llgo_21: ; preds = %_llgo_19
|
||||
%82 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 0)
|
||||
%83 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %82, 0
|
||||
%84 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %83, i64 0, 1
|
||||
%85 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %84, i64 0, 2
|
||||
%86 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 8)
|
||||
%87 = getelementptr ptr, ptr %86, i64 0
|
||||
store ptr %76, ptr %87, align 8
|
||||
%88 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %86, 0
|
||||
%89 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %88, i64 1, 1
|
||||
%90 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %89, i64 1, 2
|
||||
%91 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %85, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %90, i1 false)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %91)
|
||||
store ptr %91, ptr @"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8", align 8
|
||||
br label %_llgo_22
|
||||
|
||||
_llgo_22: ; preds = %_llgo_21, %_llgo_19
|
||||
%92 = load ptr, ptr @"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8", align 8
|
||||
%93 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 5 }, ptr undef, ptr undef, ptr undef }, ptr %92, 1
|
||||
%94 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %93, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[float64]).Value", 2
|
||||
%95 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %94, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[float64]).Value", 3
|
||||
%96 = load ptr, ptr @"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8", align 8
|
||||
%97 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 46 }, ptr undef, ptr undef, ptr undef }, ptr %96, 1
|
||||
%98 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %97, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[float64]).value", 2
|
||||
%99 = insertvalue %"github.com/goplus/llgo/runtime/abi.Method" %98, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.(*M[float64]).value", 3
|
||||
%100 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 80)
|
||||
%101 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %100, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %95, ptr %101, align 8
|
||||
%102 = getelementptr %"github.com/goplus/llgo/runtime/abi.Method", ptr %100, i64 1
|
||||
store %"github.com/goplus/llgo/runtime/abi.Method" %99, ptr %102, align 8
|
||||
%103 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %100, 0
|
||||
%104 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %103, i64 2, 1
|
||||
%105 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %104, i64 2, 2
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr %60, ptr %75, { ptr, i64, i64 } zeroinitializer, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %105)
|
||||
br label %_llgo_20
|
||||
|
||||
_llgo_23: ; preds = %_llgo_20
|
||||
%106 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr %79)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr %106)
|
||||
store ptr %106, ptr @"*_llgo_github.com/goplus/llgo/cl/_testgo/tpinst.M[float64]", align 8
|
||||
br label %_llgo_24
|
||||
|
||||
_llgo_24: ; preds = %_llgo_23, %_llgo_20
|
||||
%107 = load ptr, ptr @"_llgo_func$UYiLlmcWxoOKZPPzvR4LByitNeKoVGoTrB_5ubdOWW8", align 8
|
||||
%108 = load ptr, ptr @"_llgo_iface$2dxw6yZ6V86Spb7J0dTDIoWqg7ba7UDXlAlpJv3-HLk", align 8
|
||||
%109 = icmp eq ptr %108, null
|
||||
br i1 %109, label %_llgo_25, label %_llgo_26
|
||||
|
||||
_llgo_25: ; preds = %_llgo_24
|
||||
%110 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @3, i64 5 }, ptr undef }, ptr %107, 1
|
||||
%111 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 24)
|
||||
%112 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %111, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %110, ptr %112, align 8
|
||||
%113 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %111, 0
|
||||
%114 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %113, i64 1, 1
|
||||
%115 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %114, i64 1, 2
|
||||
%116 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %115)
|
||||
store ptr %116, ptr @"_llgo_iface$2dxw6yZ6V86Spb7J0dTDIoWqg7ba7UDXlAlpJv3-HLk", align 8
|
||||
br label %_llgo_26
|
||||
|
||||
_llgo_26: ; preds = %_llgo_25, %_llgo_24
|
||||
%117 = load ptr, ptr @"_llgo_func$ETeB8WwW04JEq0ztcm-XPTJtuYvtpkjIsAc0-2NT9zA", align 8
|
||||
%118 = insertvalue %"github.com/goplus/llgo/runtime/abi.Imethod" { %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @5, i64 46 }, ptr undef }, ptr %117, 1
|
||||
%119 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 24)
|
||||
%120 = getelementptr %"github.com/goplus/llgo/runtime/abi.Imethod", ptr %119, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/abi.Imethod" %118, ptr %120, align 8
|
||||
%121 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %119, 0
|
||||
%122 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %121, i64 1, 1
|
||||
%123 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %122, i64 1, 2
|
||||
%124 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 40 }, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %123)
|
||||
store ptr %124, ptr @"github.com/goplus/llgo/cl/_testgo/tpinst.iface$2sV9fFeqOv1SzesvwIdhTqCFzDT8ZX5buKUSAoHNSww", align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewNamed"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.String", i64, i64, i64, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Struct"(%"github.com/goplus/llgo/runtime/internal/runtime.String", i64, %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/abi.StructField" @"github.com/goplus/llgo/runtime/internal/runtime.StructField"(%"github.com/goplus/llgo/runtime/internal/runtime.String", ptr, i64, %"github.com/goplus/llgo/runtime/internal/runtime.String", i1)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.InitNamed"(ptr, ptr, %"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Func"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice", %"github.com/goplus/llgo/runtime/internal/runtime.Slice", i1)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.SetDirectIface"(ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.PointerTo"(ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Interface"(%"github.com/goplus/llgo/runtime/internal/runtime.String", %"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.NewItab"(ptr, ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfacePtrData"(%"github.com/goplus/llgo/runtime/internal/runtime.iface")
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.IfaceType"(%"github.com/goplus/llgo/runtime/internal/runtime.iface")
|
||||
|
||||
declare i1 @"github.com/goplus/llgo/runtime/internal/runtime.Implements"(ptr, ptr)
|
||||
26
cl/_testgo/tpnamed/in.go
Normal file
26
cl/_testgo/tpnamed/in.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
type Void = [0]byte
|
||||
type Future[T any] func() T
|
||||
|
||||
type IO[T any] func() Future[T]
|
||||
|
||||
func WriteFile(fileName string) IO[error] {
|
||||
return func() Future[error] {
|
||||
return func() error {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func RunIO[T any](call IO[T]) T {
|
||||
return call()()
|
||||
}
|
||||
|
||||
func main() {
|
||||
RunIO[Void](func() Future[Void] {
|
||||
return func() (ret Void) {
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
90
cl/_testgo/tpnamed/out.ll
Normal file
90
cl/_testgo/tpnamed/out.ll
Normal file
@@ -0,0 +1,90 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/tpnamed'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/tpnamed"
|
||||
|
||||
%"github.com/goplus/llgo/cl/_testgo/tpnamed.IO[error]" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[error]" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.iface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/cl/_testgo/tpnamed.IO[[0]byte]" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[[0]byte]" = type { ptr, ptr }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/tpnamed.init$guard" = global i1 false, align 1
|
||||
|
||||
define %"github.com/goplus/llgo/cl/_testgo/tpnamed.IO[error]" @"github.com/goplus/llgo/cl/_testgo/tpnamed.WriteFile"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %0) {
|
||||
_llgo_0:
|
||||
ret %"github.com/goplus/llgo/cl/_testgo/tpnamed.IO[error]" { ptr @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/tpnamed.WriteFile$1", ptr null }
|
||||
}
|
||||
|
||||
define %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[error]" @"github.com/goplus/llgo/cl/_testgo/tpnamed.WriteFile$1"() {
|
||||
_llgo_0:
|
||||
ret %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[error]" { ptr @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/tpnamed.WriteFile$1$1", ptr null }
|
||||
}
|
||||
|
||||
define %"github.com/goplus/llgo/runtime/internal/runtime.iface" @"github.com/goplus/llgo/cl/_testgo/tpnamed.WriteFile$1$1"() {
|
||||
_llgo_0:
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.iface" zeroinitializer
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tpnamed.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/tpnamed.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/tpnamed.init$guard", align 1
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tpnamed.main"() {
|
||||
_llgo_0:
|
||||
%0 = call [0 x i8] @"github.com/goplus/llgo/cl/_testgo/tpnamed.RunIO[[0]byte]"(%"github.com/goplus/llgo/cl/_testgo/tpnamed.IO[[0]byte]" { ptr @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/tpnamed.main$1", ptr null })
|
||||
ret void
|
||||
}
|
||||
|
||||
define %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[[0]byte]" @"github.com/goplus/llgo/cl/_testgo/tpnamed.main$1"() {
|
||||
_llgo_0:
|
||||
ret %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[[0]byte]" { ptr @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/tpnamed.main$1$1", ptr null }
|
||||
}
|
||||
|
||||
define [0 x i8] @"github.com/goplus/llgo/cl/_testgo/tpnamed.main$1$1"() {
|
||||
_llgo_0:
|
||||
ret [0 x i8] zeroinitializer
|
||||
}
|
||||
|
||||
define linkonce %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[error]" @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/tpnamed.WriteFile$1"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = tail call %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[error]" @"github.com/goplus/llgo/cl/_testgo/tpnamed.WriteFile$1"()
|
||||
ret %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[error]" %1
|
||||
}
|
||||
|
||||
define linkonce %"github.com/goplus/llgo/runtime/internal/runtime.iface" @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/tpnamed.WriteFile$1$1"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = tail call %"github.com/goplus/llgo/runtime/internal/runtime.iface" @"github.com/goplus/llgo/cl/_testgo/tpnamed.WriteFile$1$1"()
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.iface" %1
|
||||
}
|
||||
|
||||
define linkonce %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[[0]byte]" @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/tpnamed.main$1"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = tail call %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[[0]byte]" @"github.com/goplus/llgo/cl/_testgo/tpnamed.main$1"()
|
||||
ret %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[[0]byte]" %1
|
||||
}
|
||||
|
||||
define linkonce [0 x i8] @"github.com/goplus/llgo/cl/_testgo/tpnamed.RunIO[[0]byte]"(%"github.com/goplus/llgo/cl/_testgo/tpnamed.IO[[0]byte]" %0) {
|
||||
_llgo_0:
|
||||
%1 = extractvalue %"github.com/goplus/llgo/cl/_testgo/tpnamed.IO[[0]byte]" %0, 1
|
||||
%2 = extractvalue %"github.com/goplus/llgo/cl/_testgo/tpnamed.IO[[0]byte]" %0, 0
|
||||
%3 = call %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[[0]byte]" %2(ptr %1)
|
||||
%4 = extractvalue %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[[0]byte]" %3, 1
|
||||
%5 = extractvalue %"github.com/goplus/llgo/cl/_testgo/tpnamed.Future[[0]byte]" %3, 0
|
||||
%6 = call [0 x i8] %5(ptr %4)
|
||||
ret [0 x i8] %6
|
||||
}
|
||||
|
||||
define linkonce [0 x i8] @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/tpnamed.main$1$1"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = tail call [0 x i8] @"github.com/goplus/llgo/cl/_testgo/tpnamed.main$1$1"()
|
||||
ret [0 x i8] %1
|
||||
}
|
||||
36
cl/_testgo/tprecur/in.go
Normal file
36
cl/_testgo/tprecur/in.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
recursive()
|
||||
}
|
||||
|
||||
func recursive() {
|
||||
type T int
|
||||
if got, want := recur1[T](5), T(110); got != want {
|
||||
panic("error")
|
||||
}
|
||||
}
|
||||
|
||||
type Integer interface {
|
||||
~int | ~int32 | ~int64
|
||||
}
|
||||
|
||||
func recur1[T Integer](n T) T {
|
||||
if n == 0 || n == 1 {
|
||||
return T(1)
|
||||
} else {
|
||||
return n * recur2(n-1)
|
||||
}
|
||||
}
|
||||
|
||||
func recur2[T Integer](n T) T {
|
||||
list := make([]T, n)
|
||||
for i, _ := range list {
|
||||
list[i] = T(i + 1)
|
||||
}
|
||||
var sum T
|
||||
for _, elt := range list {
|
||||
sum += elt
|
||||
}
|
||||
return sum + recur1(n-1)
|
||||
}
|
||||
147
cl/_testgo/tprecur/out.ll
Normal file
147
cl/_testgo/tprecur/out.ll
Normal file
@@ -0,0 +1,147 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/tprecur'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/tprecur"
|
||||
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/tprecur.init$guard" = global i1 false, align 1
|
||||
@0 = private unnamed_addr constant [5 x i8] c"error", align 1
|
||||
@_llgo_string = linkonce global ptr null, align 8
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tprecur.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/tprecur.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/tprecur.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/tprecur.init$after"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tprecur.main"() {
|
||||
_llgo_0:
|
||||
call void @"github.com/goplus/llgo/cl/_testgo/tprecur.recursive"()
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tprecur.recursive"() {
|
||||
_llgo_0:
|
||||
%0 = call i64 @"github.com/goplus/llgo/cl/_testgo/tprecur.recur1[github.com/goplus/llgo/cl/_testgo/tprecur.T]"(i64 5)
|
||||
%1 = icmp ne i64 %0, 110
|
||||
br i1 %1, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%2 = load ptr, ptr @_llgo_string, align 8
|
||||
%3 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %3, align 8
|
||||
%4 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %2, 0
|
||||
%5 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %4, ptr %3, 1
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %5)
|
||||
unreachable
|
||||
|
||||
_llgo_2: ; preds = %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define linkonce i64 @"github.com/goplus/llgo/cl/_testgo/tprecur.recur1[github.com/goplus/llgo/cl/_testgo/tprecur.T]"(i64 %0) {
|
||||
_llgo_0:
|
||||
%1 = icmp eq i64 %0, 0
|
||||
br i1 %1, label %_llgo_1, label %_llgo_3
|
||||
|
||||
_llgo_1: ; preds = %_llgo_3, %_llgo_0
|
||||
ret i64 1
|
||||
|
||||
_llgo_2: ; preds = %_llgo_3
|
||||
%2 = sub i64 %0, 1
|
||||
%3 = call i64 @"github.com/goplus/llgo/cl/_testgo/tprecur.recur2[github.com/goplus/llgo/cl/_testgo/tprecur.T]"(i64 %2)
|
||||
%4 = mul i64 %0, %3
|
||||
ret i64 %4
|
||||
|
||||
_llgo_3: ; preds = %_llgo_0
|
||||
%5 = icmp eq i64 %0, 1
|
||||
br i1 %5, label %_llgo_1, label %_llgo_2
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tprecur.init$after"() {
|
||||
_llgo_0:
|
||||
%0 = load ptr, ptr @_llgo_string, align 8
|
||||
%1 = icmp eq ptr %0, null
|
||||
br i1 %1, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
||||
store ptr %2, ptr @_llgo_string, align 8
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
|
||||
|
||||
define linkonce i64 @"github.com/goplus/llgo/cl/_testgo/tprecur.recur2[github.com/goplus/llgo/cl/_testgo/tprecur.T]"(i64 %0) {
|
||||
_llgo_0:
|
||||
%1 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.MakeSlice"(i64 %0, i64 %0, i64 8)
|
||||
%2 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 1
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
%3 = phi i64 [ -1, %_llgo_0 ], [ %4, %_llgo_2 ]
|
||||
%4 = add i64 %3, 1
|
||||
%5 = icmp slt i64 %4, %2
|
||||
br i1 %5, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1
|
||||
%6 = add i64 %4, 1
|
||||
%7 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 0
|
||||
%8 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 1
|
||||
%9 = icmp slt i64 %4, 0
|
||||
%10 = icmp sge i64 %4, %8
|
||||
%11 = or i1 %10, %9
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %11)
|
||||
%12 = getelementptr inbounds i64, ptr %7, i64 %4
|
||||
store i64 %6, ptr %12, align 4
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_3: ; preds = %_llgo_1
|
||||
%13 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 1
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_4: ; preds = %_llgo_5, %_llgo_3
|
||||
%14 = phi i64 [ 0, %_llgo_3 ], [ %25, %_llgo_5 ]
|
||||
%15 = phi i64 [ -1, %_llgo_3 ], [ %16, %_llgo_5 ]
|
||||
%16 = add i64 %15, 1
|
||||
%17 = icmp slt i64 %16, %13
|
||||
br i1 %17, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4
|
||||
%18 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 0
|
||||
%19 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 1
|
||||
%20 = icmp slt i64 %16, 0
|
||||
%21 = icmp sge i64 %16, %19
|
||||
%22 = or i1 %21, %20
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %22)
|
||||
%23 = getelementptr inbounds i64, ptr %18, i64 %16
|
||||
%24 = load i64, ptr %23, align 4
|
||||
%25 = add i64 %14, %24
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_6: ; preds = %_llgo_4
|
||||
%26 = sub i64 %0, 1
|
||||
%27 = call i64 @"github.com/goplus/llgo/cl/_testgo/tprecur.recur1[github.com/goplus/llgo/cl/_testgo/tprecur.T]"(i64 %26)
|
||||
%28 = add i64 %14, %27
|
||||
ret i64 %28
|
||||
}
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.MakeSlice"(i64, i64, i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1)
|
||||
11
cl/_testgo/tprecurfn/in.go
Normal file
11
cl/_testgo/tprecurfn/in.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
type My[T any] struct {
|
||||
fn func(n T)
|
||||
next *My[T]
|
||||
}
|
||||
|
||||
func main() {
|
||||
m := &My[int]{next: &My[int]{fn: func(n int) { println(n) }}}
|
||||
m.next.fn(100)
|
||||
}
|
||||
56
cl/_testgo/tprecurfn/out.ll
Normal file
56
cl/_testgo/tprecurfn/out.ll
Normal file
@@ -0,0 +1,56 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/tprecurfn'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/tprecurfn"
|
||||
|
||||
%"github.com/goplus/llgo/cl/_testgo/tprecurfn.My[int]" = type { { ptr, ptr }, ptr }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/tprecurfn.init$guard" = global i1 false, align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tprecurfn.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/tprecurfn.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/tprecurfn.init$guard", align 1
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tprecurfn.main"() {
|
||||
_llgo_0:
|
||||
%0 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 24)
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tprecurfn.My[int]", ptr %0, i32 0, i32 1
|
||||
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 24)
|
||||
%3 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tprecurfn.My[int]", ptr %2, i32 0, i32 0
|
||||
store { ptr, ptr } { ptr @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/tprecurfn.main$1", ptr null }, ptr %3, align 8
|
||||
store ptr %2, ptr %1, align 8
|
||||
%4 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tprecurfn.My[int]", ptr %0, i32 0, i32 1
|
||||
%5 = load ptr, ptr %4, align 8
|
||||
%6 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tprecurfn.My[int]", ptr %5, i32 0, i32 0
|
||||
%7 = load { ptr, ptr }, ptr %6, align 8
|
||||
%8 = extractvalue { ptr, ptr } %7, 1
|
||||
%9 = extractvalue { ptr, ptr } %7, 0
|
||||
call void %9(ptr %8, i64 100)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tprecurfn.main$1"(i64 %0) {
|
||||
_llgo_0:
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %0)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
||||
|
||||
define linkonce void @"__llgo_stub.github.com/goplus/llgo/cl/_testgo/tprecurfn.main$1"(ptr %0, i64 %1) {
|
||||
_llgo_0:
|
||||
tail call void @"github.com/goplus/llgo/cl/_testgo/tprecurfn.main$1"(i64 %1)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
63
cl/_testgo/tptypes/in.go
Normal file
63
cl/_testgo/tptypes/in.go
Normal file
@@ -0,0 +1,63 @@
|
||||
package main
|
||||
|
||||
type Data[T any] struct {
|
||||
v T
|
||||
}
|
||||
|
||||
func (p *Data[T]) Set(v T) {
|
||||
p.v = v
|
||||
}
|
||||
|
||||
func (p *(Data[T1])) Set2(v T1) {
|
||||
p.v = v
|
||||
}
|
||||
|
||||
type sliceOf[E any] interface {
|
||||
~[]E
|
||||
}
|
||||
|
||||
type Slice[S sliceOf[T], T any] struct {
|
||||
Data S
|
||||
}
|
||||
|
||||
func (p *Slice[S, T]) Append(t ...T) S {
|
||||
p.Data = append(p.Data, t...)
|
||||
return p.Data
|
||||
}
|
||||
|
||||
func (p *Slice[S1, T1]) Append2(t ...T1) S1 {
|
||||
p.Data = append(p.Data, t...)
|
||||
return p.Data
|
||||
}
|
||||
|
||||
type (
|
||||
DataInt = Data[int]
|
||||
SliceInt = Slice[[]int, int]
|
||||
DataString = Data[string]
|
||||
SliceString = Slice[[]string, string]
|
||||
)
|
||||
|
||||
func main() {
|
||||
println(DataInt{1}.v)
|
||||
println(DataString{"hello"}.v)
|
||||
println(Data[int]{100}.v)
|
||||
println(Data[string]{"hello"}.v)
|
||||
|
||||
// TODO
|
||||
println(Data[struct {
|
||||
X int
|
||||
Y int
|
||||
}]{}.v.X)
|
||||
|
||||
v1 := SliceInt{}
|
||||
v1.Append(100)
|
||||
v2 := SliceString{}
|
||||
v2.Append("hello")
|
||||
v3 := Slice[[]int, int]{}
|
||||
v3.Append([]int{1, 2, 3, 4}...)
|
||||
v3.Append2([]int{1, 2, 3, 4}...)
|
||||
|
||||
println(v1.Data, v1.Data[0])
|
||||
println(v2.Data, v2.Data[0])
|
||||
println(v3.Data, v3.Data[0])
|
||||
}
|
||||
210
cl/_testgo/tptypes/out.ll
Normal file
210
cl/_testgo/tptypes/out.ll
Normal file
@@ -0,0 +1,210 @@
|
||||
; ModuleID = 'github.com/goplus/llgo/cl/_testgo/tptypes'
|
||||
source_filename = "github.com/goplus/llgo/cl/_testgo/tptypes"
|
||||
|
||||
%"github.com/goplus/llgo/cl/_testgo/tptypes.Data[int]" = type { i64 }
|
||||
%"github.com/goplus/llgo/cl/_testgo/tptypes.Data[string]" = type { %"github.com/goplus/llgo/runtime/internal/runtime.String" }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]int,int]" = type { %"github.com/goplus/llgo/runtime/internal/runtime.Slice" }
|
||||
%"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]string,string]" = type { %"github.com/goplus/llgo/runtime/internal/runtime.Slice" }
|
||||
|
||||
@"github.com/goplus/llgo/cl/_testgo/tptypes.init$guard" = global i1 false, align 1
|
||||
@0 = private unnamed_addr constant [5 x i8] c"hello", align 1
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tptypes.init"() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testgo/tptypes.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"github.com/goplus/llgo/cl/_testgo/tptypes.init$guard", align 1
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @"github.com/goplus/llgo/cl/_testgo/tptypes.main"() {
|
||||
_llgo_0:
|
||||
%0 = alloca %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[int]", align 8
|
||||
call void @llvm.memset(ptr %0, i8 0, i64 8, i1 false)
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[int]", ptr %0, i32 0, i32 0
|
||||
store i64 1, ptr %1, align 4
|
||||
%2 = load %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[int]", ptr %0, align 4
|
||||
%3 = extractvalue %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[int]" %2, 0
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %3)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%4 = alloca %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[string]", align 8
|
||||
call void @llvm.memset(ptr %4, i8 0, i64 16, i1 false)
|
||||
%5 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[string]", ptr %4, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %5, align 8
|
||||
%6 = load %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[string]", ptr %4, align 8
|
||||
%7 = extractvalue %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[string]" %6, 0
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %7)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%8 = alloca %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[int]", align 8
|
||||
call void @llvm.memset(ptr %8, i8 0, i64 8, i1 false)
|
||||
%9 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[int]", ptr %8, i32 0, i32 0
|
||||
store i64 100, ptr %9, align 4
|
||||
%10 = load %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[int]", ptr %8, align 4
|
||||
%11 = extractvalue %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[int]" %10, 0
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %11)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%12 = alloca %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[string]", align 8
|
||||
call void @llvm.memset(ptr %12, i8 0, i64 16, i1 false)
|
||||
%13 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[string]", ptr %12, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %13, align 8
|
||||
%14 = load %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[string]", ptr %12, align 8
|
||||
%15 = extractvalue %"github.com/goplus/llgo/cl/_testgo/tptypes.Data[string]" %14, 0
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %15)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 0)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%16 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 24)
|
||||
%17 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 8)
|
||||
%18 = getelementptr inbounds i64, ptr %17, i64 0
|
||||
store i64 100, ptr %18, align 4
|
||||
%19 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %17, 0
|
||||
%20 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %19, i64 1, 1
|
||||
%21 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %20, i64 1, 2
|
||||
%22 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/cl/_testgo/tptypes.(*Slice[[]int,int]).Append"(ptr %16, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %21)
|
||||
%23 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 24)
|
||||
%24 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 16)
|
||||
%25 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr %24, i64 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @0, i64 5 }, ptr %25, align 8
|
||||
%26 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %24, 0
|
||||
%27 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %26, i64 1, 1
|
||||
%28 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %27, i64 1, 2
|
||||
%29 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/cl/_testgo/tptypes.(*Slice[[]string,string]).Append"(ptr %23, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %28)
|
||||
%30 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 24)
|
||||
%31 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 32)
|
||||
%32 = getelementptr inbounds i64, ptr %31, i64 0
|
||||
store i64 1, ptr %32, align 4
|
||||
%33 = getelementptr inbounds i64, ptr %31, i64 1
|
||||
store i64 2, ptr %33, align 4
|
||||
%34 = getelementptr inbounds i64, ptr %31, i64 2
|
||||
store i64 3, ptr %34, align 4
|
||||
%35 = getelementptr inbounds i64, ptr %31, i64 3
|
||||
store i64 4, ptr %35, align 4
|
||||
%36 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %31, 0
|
||||
%37 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %36, i64 4, 1
|
||||
%38 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %37, i64 4, 2
|
||||
%39 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/cl/_testgo/tptypes.(*Slice[[]int,int]).Append"(ptr %30, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %38)
|
||||
%40 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 32)
|
||||
%41 = getelementptr inbounds i64, ptr %40, i64 0
|
||||
store i64 1, ptr %41, align 4
|
||||
%42 = getelementptr inbounds i64, ptr %40, i64 1
|
||||
store i64 2, ptr %42, align 4
|
||||
%43 = getelementptr inbounds i64, ptr %40, i64 2
|
||||
store i64 3, ptr %43, align 4
|
||||
%44 = getelementptr inbounds i64, ptr %40, i64 3
|
||||
store i64 4, ptr %44, align 4
|
||||
%45 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %40, 0
|
||||
%46 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %45, i64 4, 1
|
||||
%47 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %46, i64 4, 2
|
||||
%48 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/cl/_testgo/tptypes.(*Slice[[]int,int]).Append2"(ptr %30, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %47)
|
||||
%49 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]int,int]", ptr %16, i32 0, i32 0
|
||||
%50 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %49, align 8
|
||||
%51 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]int,int]", ptr %16, i32 0, i32 0
|
||||
%52 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %51, align 8
|
||||
%53 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %52, 0
|
||||
%54 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %52, 1
|
||||
%55 = icmp sge i64 0, %54
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %55)
|
||||
%56 = getelementptr inbounds i64, ptr %53, i64 0
|
||||
%57 = load i64, ptr %56, align 4
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %50)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %57)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%58 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]string,string]", ptr %23, i32 0, i32 0
|
||||
%59 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %58, align 8
|
||||
%60 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]string,string]", ptr %23, i32 0, i32 0
|
||||
%61 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %60, align 8
|
||||
%62 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %61, 0
|
||||
%63 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %61, 1
|
||||
%64 = icmp sge i64 0, %63
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %64)
|
||||
%65 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr %62, i64 0
|
||||
%66 = load %"github.com/goplus/llgo/runtime/internal/runtime.String", ptr %65, align 8
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %59)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String" %66)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
%67 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]int,int]", ptr %30, i32 0, i32 0
|
||||
%68 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %67, align 8
|
||||
%69 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]int,int]", ptr %30, i32 0, i32 0
|
||||
%70 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %69, align 8
|
||||
%71 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %70, 0
|
||||
%72 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %70, 1
|
||||
%73 = icmp sge i64 0, %72
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %73)
|
||||
%74 = getelementptr inbounds i64, ptr %71, i64 0
|
||||
%75 = load i64, ptr %74, align 4
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %68)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 32)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64 %75)
|
||||
call void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8 10)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
|
||||
declare void @llvm.memset(ptr nocapture writeonly, i8, i64, i1 immarg) #0
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintInt"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintString"(%"github.com/goplus/llgo/runtime/internal/runtime.String")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
||||
|
||||
define linkonce %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/cl/_testgo/tptypes.(*Slice[[]int,int]).Append"(ptr %0, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1) {
|
||||
_llgo_0:
|
||||
%2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]int,int]", ptr %0, i32 0, i32 0
|
||||
%3 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %2, align 8
|
||||
%4 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 0
|
||||
%5 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 1
|
||||
%6 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %3, ptr %4, i64 %5, i64 8)
|
||||
%7 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]int,int]", ptr %0, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %6, ptr %7, align 8
|
||||
%8 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]int,int]", ptr %0, i32 0, i32 0
|
||||
%9 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %8, align 8
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %9
|
||||
}
|
||||
|
||||
define linkonce %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/cl/_testgo/tptypes.(*Slice[[]string,string]).Append"(ptr %0, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1) {
|
||||
_llgo_0:
|
||||
%2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]string,string]", ptr %0, i32 0, i32 0
|
||||
%3 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %2, align 8
|
||||
%4 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 0
|
||||
%5 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 1
|
||||
%6 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %3, ptr %4, i64 %5, i64 16)
|
||||
%7 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]string,string]", ptr %0, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %6, ptr %7, align 8
|
||||
%8 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]string,string]", ptr %0, i32 0, i32 0
|
||||
%9 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %8, align 8
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %9
|
||||
}
|
||||
|
||||
define linkonce %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/cl/_testgo/tptypes.(*Slice[[]int,int]).Append2"(ptr %0, %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1) {
|
||||
_llgo_0:
|
||||
%2 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]int,int]", ptr %0, i32 0, i32 0
|
||||
%3 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %2, align 8
|
||||
%4 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 0
|
||||
%5 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %1, 1
|
||||
%6 = call %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %3, ptr %4, i64 %5, i64 8)
|
||||
%7 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]int,int]", ptr %0, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %6, ptr %7, align 8
|
||||
%8 = getelementptr inbounds %"github.com/goplus/llgo/cl/_testgo/tptypes.Slice[[]int,int]", ptr %0, i32 0, i32 0
|
||||
%9 = load %"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr %8, align 8
|
||||
ret %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %9
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1)
|
||||
|
||||
declare void @"github.com/goplus/llgo/runtime/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice")
|
||||
|
||||
declare %"github.com/goplus/llgo/runtime/internal/runtime.Slice" @"github.com/goplus/llgo/runtime/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/runtime/internal/runtime.Slice", ptr, i64, i64)
|
||||
|
||||
attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
|
||||
Reference in New Issue
Block a user