Merge branch 'main' of https://github.com/goplus/llgo into main_return_0
This commit is contained in:
@@ -51,7 +51,7 @@ _llgo_0:
|
||||
|
||||
define void @main.gwrite(%"github.com/goplus/llgo/internal/runtime.Slice" %0) {
|
||||
_llgo_0:
|
||||
%1 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %0)
|
||||
%1 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 1
|
||||
%2 = icmp eq i64 %1, 0
|
||||
br i1 %2, label %_llgo_1, label %_llgo_2
|
||||
|
||||
@@ -680,7 +680,7 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
|
||||
define void @main.println(%"github.com/goplus/llgo/internal/runtime.Slice" %0) {
|
||||
_llgo_0:
|
||||
%1 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %0)
|
||||
%1 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 1
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_5, %_llgo_0
|
||||
@@ -690,7 +690,7 @@ _llgo_1: ; preds = %_llgo_5, %_llgo_0
|
||||
br i1 %4, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1
|
||||
%5 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %0)
|
||||
%5 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
||||
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %5, i64 %3
|
||||
%7 = load %"github.com/goplus/llgo/internal/runtime.iface", ptr %6, align 8
|
||||
%8 = icmp ne i64 %3, 0
|
||||
@@ -783,8 +783,6 @@ _llgo_0:
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64)
|
||||
|
||||
declare i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
declare i32 @printf(ptr, ...)
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
@@ -802,5 +800,3 @@ declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llg
|
||||
declare { i64, i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2Int"(%"github.com/goplus/llgo/internal/runtime.iface", ptr)
|
||||
|
||||
declare { %"github.com/goplus/llgo/internal/runtime.String", i1 } @"github.com/goplus/llgo/internal/runtime.CheckI2String"(%"github.com/goplus/llgo/internal/runtime.iface", ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
@@ -48,7 +48,7 @@ _llgo_0:
|
||||
|
||||
define void @main.test(%"github.com/goplus/llgo/internal/runtime.Slice" %0) {
|
||||
_llgo_0:
|
||||
%1 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %0)
|
||||
%1 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 1
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
@@ -58,7 +58,7 @@ _llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
br i1 %4, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1
|
||||
%5 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %0)
|
||||
%5 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
||||
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.iface", ptr %5, i64 %3
|
||||
%7 = load %"github.com/goplus/llgo/internal/runtime.iface", ptr %6, align 8
|
||||
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
|
||||
@@ -80,10 +80,6 @@ declare %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llg
|
||||
|
||||
declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr, i64, i64, i64, i64, i64)
|
||||
|
||||
declare i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
declare i64 @"github.com/goplus/llgo/internal/runtime.I2Int"(%"github.com/goplus/llgo/internal/runtime.iface", ptr)
|
||||
|
||||
declare i32 @printf(ptr, ...)
|
||||
|
||||
12
cl/_testpy/gcd/in.go
Normal file
12
cl/_testpy/gcd/in.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/goplus/llgo/c"
|
||||
"github.com/goplus/llgo/py"
|
||||
"github.com/goplus/llgo/py/math"
|
||||
)
|
||||
|
||||
func main() {
|
||||
x := math.Gcd(py.Long(60), py.Long(20), py.Long(25))
|
||||
c.Printf(c.Str("gcd(60, 20, 25) = %d\n"), x.Long())
|
||||
}
|
||||
59
cl/_testpy/gcd/out.ll
Normal file
59
cl/_testpy/gcd/out.ll
Normal file
@@ -0,0 +1,59 @@
|
||||
; ModuleID = 'main'
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@__llgo_py.math.gcd = linkonce global ptr null
|
||||
@0 = private unnamed_addr constant [22 x i8] c"gcd(60, 20, 25) = %d\0A\00", align 1
|
||||
@__llgo_py.math = external global ptr
|
||||
@1 = private unnamed_addr constant [4 x i8] c"gcd\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"main.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"main.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/py/math.init"()
|
||||
%1 = load ptr, ptr @__llgo_py.math, align 8
|
||||
call void (ptr, ...) @llgoLoadPyModSyms(ptr %1, ptr @1, ptr @__llgo_py.math.gcd, ptr null)
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main(i32 %0, ptr %1) {
|
||||
_llgo_0:
|
||||
call void @Py_Initialize()
|
||||
store i32 %0, ptr @__llgo_argc, align 4
|
||||
store ptr %1, ptr @__llgo_argv, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
call void @main.init()
|
||||
%2 = call ptr @PyLong_FromLong(i32 60)
|
||||
%3 = call ptr @PyLong_FromLong(i32 20)
|
||||
%4 = call ptr @PyLong_FromLong(i32 25)
|
||||
%5 = load ptr, ptr @__llgo_py.math.gcd, align 8
|
||||
%6 = call ptr (ptr, ...) @PyObject_CallFunctionObjArgs(ptr %5, ptr %2, ptr %3, ptr %4, ptr null)
|
||||
%7 = call i32 @PyLong_AsLong(ptr %6)
|
||||
%8 = call i32 (ptr, ...) @printf(ptr @0, i32 %7)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/py/math.init"()
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
|
||||
declare ptr @PyLong_FromLong(i32)
|
||||
|
||||
declare ptr @PyObject_CallFunctionObjArgs(ptr, ...)
|
||||
|
||||
declare i32 @PyLong_AsLong(ptr)
|
||||
|
||||
declare i32 @printf(ptr, ...)
|
||||
|
||||
declare void @llgoLoadPyModSyms(ptr, ...)
|
||||
|
||||
declare void @Py_Initialize()
|
||||
@@ -1,7 +1,6 @@
|
||||
; ModuleID = 'math'
|
||||
source_filename = "math"
|
||||
|
||||
@__llgo_py.math.sqrt = external global ptr
|
||||
@"math.init$guard" = global ptr null
|
||||
@__llgo_py.math = linkonce global ptr null
|
||||
@0 = private unnamed_addr constant [5 x i8] c"math\00", align 1
|
||||
|
||||
24
cl/_testpy/matrix/in.go
Normal file
24
cl/_testpy/matrix/in.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/goplus/llgo/c"
|
||||
"github.com/goplus/llgo/py"
|
||||
"github.com/goplus/llgo/py/numpy"
|
||||
)
|
||||
|
||||
func main() {
|
||||
a := py.List(
|
||||
py.List(1.0, 2.0, 3.0),
|
||||
py.List(4.0, 5.0, 6.0),
|
||||
py.List(7.0, 8.0, 9.0),
|
||||
)
|
||||
b := py.List(
|
||||
py.List(9.0, 8.0, 7.0),
|
||||
py.List(6.0, 5.0, 4.0),
|
||||
py.List(3.0, 2.0, 1.0),
|
||||
)
|
||||
x := numpy.Add(a, b)
|
||||
c.Printf(c.Str("a = %s\n"), a.Str().CStr())
|
||||
c.Printf(c.Str("a = %s\n"), b.Str().CStr())
|
||||
c.Printf(c.Str("a+b = %s\n"), x.Str().CStr())
|
||||
}
|
||||
121
cl/_testpy/matrix/out.ll
Normal file
121
cl/_testpy/matrix/out.ll
Normal file
@@ -0,0 +1,121 @@
|
||||
; ModuleID = 'main'
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@__llgo_py.numpy.add = linkonce global ptr null
|
||||
@0 = private unnamed_addr constant [8 x i8] c"a = %s\0A\00", align 1
|
||||
@1 = private unnamed_addr constant [8 x i8] c"a = %s\0A\00", align 1
|
||||
@2 = private unnamed_addr constant [10 x i8] c"a+b = %s\0A\00", align 1
|
||||
@__llgo_py.numpy = external global ptr
|
||||
@3 = private unnamed_addr constant [4 x i8] c"add\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"main.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"main.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/py/numpy.init"()
|
||||
%1 = load ptr, ptr @__llgo_py.numpy, align 8
|
||||
call void (ptr, ...) @llgoLoadPyModSyms(ptr %1, ptr @3, ptr @__llgo_py.numpy.add, ptr null)
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main(i32 %0, ptr %1) {
|
||||
_llgo_0:
|
||||
call void @Py_Initialize()
|
||||
store i32 %0, ptr @__llgo_argc, align 4
|
||||
store ptr %1, ptr @__llgo_argv, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
call void @main.init()
|
||||
%2 = call ptr @PyList_New(i64 3)
|
||||
%3 = call ptr @PyFloat_FromDouble(double 1.000000e+00)
|
||||
%4 = call i32 @PyList_SetItem(ptr %2, i64 0, ptr %3)
|
||||
%5 = call ptr @PyFloat_FromDouble(double 2.000000e+00)
|
||||
%6 = call i32 @PyList_SetItem(ptr %2, i64 1, ptr %5)
|
||||
%7 = call ptr @PyFloat_FromDouble(double 3.000000e+00)
|
||||
%8 = call i32 @PyList_SetItem(ptr %2, i64 2, ptr %7)
|
||||
%9 = call ptr @PyList_New(i64 3)
|
||||
%10 = call ptr @PyFloat_FromDouble(double 4.000000e+00)
|
||||
%11 = call i32 @PyList_SetItem(ptr %9, i64 0, ptr %10)
|
||||
%12 = call ptr @PyFloat_FromDouble(double 5.000000e+00)
|
||||
%13 = call i32 @PyList_SetItem(ptr %9, i64 1, ptr %12)
|
||||
%14 = call ptr @PyFloat_FromDouble(double 6.000000e+00)
|
||||
%15 = call i32 @PyList_SetItem(ptr %9, i64 2, ptr %14)
|
||||
%16 = call ptr @PyList_New(i64 3)
|
||||
%17 = call ptr @PyFloat_FromDouble(double 7.000000e+00)
|
||||
%18 = call i32 @PyList_SetItem(ptr %16, i64 0, ptr %17)
|
||||
%19 = call ptr @PyFloat_FromDouble(double 8.000000e+00)
|
||||
%20 = call i32 @PyList_SetItem(ptr %16, i64 1, ptr %19)
|
||||
%21 = call ptr @PyFloat_FromDouble(double 9.000000e+00)
|
||||
%22 = call i32 @PyList_SetItem(ptr %16, i64 2, ptr %21)
|
||||
%23 = call ptr @PyList_New(i64 3)
|
||||
%24 = call i32 @PyList_SetItem(ptr %23, i64 0, ptr %2)
|
||||
%25 = call i32 @PyList_SetItem(ptr %23, i64 1, ptr %9)
|
||||
%26 = call i32 @PyList_SetItem(ptr %23, i64 2, ptr %16)
|
||||
%27 = call ptr @PyList_New(i64 3)
|
||||
%28 = call ptr @PyFloat_FromDouble(double 9.000000e+00)
|
||||
%29 = call i32 @PyList_SetItem(ptr %27, i64 0, ptr %28)
|
||||
%30 = call ptr @PyFloat_FromDouble(double 8.000000e+00)
|
||||
%31 = call i32 @PyList_SetItem(ptr %27, i64 1, ptr %30)
|
||||
%32 = call ptr @PyFloat_FromDouble(double 7.000000e+00)
|
||||
%33 = call i32 @PyList_SetItem(ptr %27, i64 2, ptr %32)
|
||||
%34 = call ptr @PyList_New(i64 3)
|
||||
%35 = call ptr @PyFloat_FromDouble(double 6.000000e+00)
|
||||
%36 = call i32 @PyList_SetItem(ptr %34, i64 0, ptr %35)
|
||||
%37 = call ptr @PyFloat_FromDouble(double 5.000000e+00)
|
||||
%38 = call i32 @PyList_SetItem(ptr %34, i64 1, ptr %37)
|
||||
%39 = call ptr @PyFloat_FromDouble(double 4.000000e+00)
|
||||
%40 = call i32 @PyList_SetItem(ptr %34, i64 2, ptr %39)
|
||||
%41 = call ptr @PyList_New(i64 3)
|
||||
%42 = call ptr @PyFloat_FromDouble(double 3.000000e+00)
|
||||
%43 = call i32 @PyList_SetItem(ptr %41, i64 0, ptr %42)
|
||||
%44 = call ptr @PyFloat_FromDouble(double 2.000000e+00)
|
||||
%45 = call i32 @PyList_SetItem(ptr %41, i64 1, ptr %44)
|
||||
%46 = call ptr @PyFloat_FromDouble(double 1.000000e+00)
|
||||
%47 = call i32 @PyList_SetItem(ptr %41, i64 2, ptr %46)
|
||||
%48 = call ptr @PyList_New(i64 3)
|
||||
%49 = call i32 @PyList_SetItem(ptr %48, i64 0, ptr %27)
|
||||
%50 = call i32 @PyList_SetItem(ptr %48, i64 1, ptr %34)
|
||||
%51 = call i32 @PyList_SetItem(ptr %48, i64 2, ptr %41)
|
||||
%52 = load ptr, ptr @__llgo_py.numpy.add, align 8
|
||||
%53 = call ptr (ptr, ...) @PyObject_CallFunctionObjArgs(ptr %52, ptr %23, ptr %48, ptr null)
|
||||
%54 = call ptr @PyObject_Str(ptr %23)
|
||||
%55 = call ptr @PyUnicode_AsUTF8(ptr %54)
|
||||
%56 = call i32 (ptr, ...) @printf(ptr @0, ptr %55)
|
||||
%57 = call ptr @PyObject_Str(ptr %48)
|
||||
%58 = call ptr @PyUnicode_AsUTF8(ptr %57)
|
||||
%59 = call i32 (ptr, ...) @printf(ptr @1, ptr %58)
|
||||
%60 = call ptr @PyObject_Str(ptr %53)
|
||||
%61 = call ptr @PyUnicode_AsUTF8(ptr %60)
|
||||
%62 = call i32 (ptr, ...) @printf(ptr @2, ptr %61)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/py/numpy.init"()
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
|
||||
declare ptr @PyList_New(i64)
|
||||
|
||||
declare ptr @PyFloat_FromDouble(double)
|
||||
|
||||
declare i32 @PyList_SetItem(ptr, i64, ptr)
|
||||
|
||||
declare ptr @PyObject_CallFunctionObjArgs(ptr, ...)
|
||||
|
||||
declare ptr @PyObject_Str(ptr)
|
||||
|
||||
declare ptr @PyUnicode_AsUTF8(ptr)
|
||||
|
||||
declare i32 @printf(ptr, ...)
|
||||
|
||||
declare void @llgoLoadPyModSyms(ptr, ...)
|
||||
|
||||
declare void @Py_Initialize()
|
||||
10
cl/_testpy/pi/in.go
Normal file
10
cl/_testpy/pi/in.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/goplus/llgo/c"
|
||||
"github.com/goplus/llgo/py/math"
|
||||
)
|
||||
|
||||
func main() {
|
||||
c.Printf(c.Str("pi = %f\n"), math.Pi.Float64())
|
||||
}
|
||||
49
cl/_testpy/pi/out.ll
Normal file
49
cl/_testpy/pi/out.ll
Normal file
@@ -0,0 +1,49 @@
|
||||
; ModuleID = 'main'
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [9 x i8] c"pi = %f\0A\00", align 1
|
||||
@__llgo_py.math = external global ptr
|
||||
@1 = private unnamed_addr constant [3 x i8] c"pi\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"main.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"main.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/py/math.init"()
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main(i32 %0, ptr %1) {
|
||||
_llgo_0:
|
||||
call void @Py_Initialize()
|
||||
store i32 %0, ptr @__llgo_argc, align 4
|
||||
store ptr %1, ptr @__llgo_argv, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
call void @main.init()
|
||||
%2 = load ptr, ptr @__llgo_py.math, align 8
|
||||
%3 = call ptr @PyObject_GetAttrString(ptr %2, ptr @1)
|
||||
%4 = call double @PyFloat_AsDouble(ptr %3)
|
||||
%5 = call i32 (ptr, ...) @printf(ptr @0, double %4)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/py/math.init"()
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
|
||||
declare ptr @PyObject_GetAttrString(ptr, ptr)
|
||||
|
||||
declare double @PyFloat_AsDouble(ptr)
|
||||
|
||||
declare i32 @printf(ptr, ...)
|
||||
|
||||
declare void @Py_Initialize()
|
||||
12
cl/_testpy/pow/in.go
Normal file
12
cl/_testpy/pow/in.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/goplus/llgo/c"
|
||||
"github.com/goplus/llgo/py"
|
||||
"github.com/goplus/llgo/py/math"
|
||||
)
|
||||
|
||||
func main() {
|
||||
x := math.Pow(py.Float(2), py.Float(3))
|
||||
c.Printf(c.Str("pow(2, 3) = %f\n"), x.Float64())
|
||||
}
|
||||
58
cl/_testpy/pow/out.ll
Normal file
58
cl/_testpy/pow/out.ll
Normal file
@@ -0,0 +1,58 @@
|
||||
; ModuleID = 'main'
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@__llgo_py.math.pow = linkonce global ptr null
|
||||
@0 = private unnamed_addr constant [16 x i8] c"pow(2, 3) = %f\0A\00", align 1
|
||||
@__llgo_py.math = external global ptr
|
||||
@1 = private unnamed_addr constant [4 x i8] c"pow\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"main.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"main.init$guard", align 1
|
||||
call void @"github.com/goplus/llgo/py/math.init"()
|
||||
%1 = load ptr, ptr @__llgo_py.math, align 8
|
||||
call void (ptr, ...) @llgoLoadPyModSyms(ptr %1, ptr @1, ptr @__llgo_py.math.pow, ptr null)
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main(i32 %0, ptr %1) {
|
||||
_llgo_0:
|
||||
call void @Py_Initialize()
|
||||
store i32 %0, ptr @__llgo_argc, align 4
|
||||
store ptr %1, ptr @__llgo_argv, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
call void @main.init()
|
||||
%2 = call ptr @PyFloat_FromDouble(double 2.000000e+00)
|
||||
%3 = call ptr @PyFloat_FromDouble(double 3.000000e+00)
|
||||
%4 = load ptr, ptr @__llgo_py.math.pow, align 8
|
||||
%5 = call ptr (ptr, ...) @PyObject_CallFunctionObjArgs(ptr %4, ptr %2, ptr %3, ptr null)
|
||||
%6 = call double @PyFloat_AsDouble(ptr %5)
|
||||
%7 = call i32 (ptr, ...) @printf(ptr @0, double %6)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/py/math.init"()
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
|
||||
declare ptr @PyFloat_FromDouble(double)
|
||||
|
||||
declare ptr @PyObject_CallFunctionObjArgs(ptr, ...)
|
||||
|
||||
declare double @PyFloat_AsDouble(ptr)
|
||||
|
||||
declare i32 @printf(ptr, ...)
|
||||
|
||||
declare void @llgoLoadPyModSyms(ptr, ...)
|
||||
|
||||
declare void @Py_Initialize()
|
||||
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/goplus/llgo/internal/runtime/c"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var a int64 = 1<<63 - 1
|
||||
@@ -11,41 +11,19 @@ var n uint64 = 1<<64 - 1
|
||||
func main() {
|
||||
var s = []int{1, 2, 3, 4}
|
||||
var a = [...]int{1, 2, 3, 4}
|
||||
d := make([]byte, 4, 10)
|
||||
println(s, len(s), cap(s))
|
||||
println(d, len(d), cap(d))
|
||||
println(len(a), cap(a), cap(&a), len(&a))
|
||||
println(len([]int{1, 2, 3, 4}), len([4]int{1, 2, 3, 4}))
|
||||
println(len(s[1:]), cap(s[1:]), len(s[1:2]), cap(s[1:2]), len(s[1:2:2]), cap(s[1:2:2]))
|
||||
println(len(a[1:]), cap(a[1:]), len(a[1:2]), cap(a[1:2]), len(a[1:2:2]), cap(a[1:2:2]))
|
||||
|
||||
out(len(s))
|
||||
out(len([]int{1, 2, 3, 4}))
|
||||
out(len(a))
|
||||
out(len(&a))
|
||||
out(len([4]int{1, 2, 3, 4}))
|
||||
|
||||
out(cap(s))
|
||||
out(cap(a))
|
||||
out(cap(&a))
|
||||
|
||||
out(len(s[1:]))
|
||||
out(cap(s[1:]))
|
||||
out(len(s[1:2]))
|
||||
out(cap(s[1:2]))
|
||||
out(len(s[1:2:2]))
|
||||
out(cap(s[1:2:2]))
|
||||
|
||||
out(len(a[1:]))
|
||||
out(cap(a[1:]))
|
||||
out(len(a[1:2]))
|
||||
out(cap(a[1:2]))
|
||||
out(len(a[1:2:2]))
|
||||
out(cap(a[1:2:2]))
|
||||
|
||||
string_len("hello")
|
||||
string_len("hello"[1:])
|
||||
string_len("hello"[1:2])
|
||||
string_len("hello"[5:])
|
||||
}
|
||||
|
||||
func string_len(s string) {
|
||||
out(len(s))
|
||||
}
|
||||
|
||||
func out(n int) {
|
||||
c.Printf(c.Str("%d\n"), n)
|
||||
println("hello", "hello"[1:], "hello"[1:2], len("hello"[5:]))
|
||||
println(append(s, 5, 6, 7, 8))
|
||||
data := []byte{'a', 'b', 'c'}
|
||||
data = append(data, "def"...)
|
||||
println(data)
|
||||
var i any = 100
|
||||
println(true, 100, -100, uint(100), int32(-100), 100.5, i, &i, uintptr(unsafe.Pointer(&i)))
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ source_filename = "main"
|
||||
|
||||
%"github.com/goplus/llgo/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 }
|
||||
%"github.com/goplus/llgo/internal/runtime.iface" = type { ptr, ptr }
|
||||
|
||||
@main.a = global ptr null
|
||||
@main.b = global ptr null
|
||||
@@ -10,11 +11,50 @@ source_filename = "main"
|
||||
@main.n = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
||||
@1 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
||||
@2 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
||||
@3 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
||||
@4 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
|
||||
@0 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@1 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@2 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
@3 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@4 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@5 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
@6 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@7 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@8 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@9 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
@10 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@11 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
@12 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@13 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@14 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@15 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@16 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@17 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
@18 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@19 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@20 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@21 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@22 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@23 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
@24 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
||||
@25 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
||||
@26 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
||||
@27 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
||||
@28 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@29 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@30 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@31 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
@32 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
@33 = private unnamed_addr constant [4 x i8] c"def\00", align 1
|
||||
@34 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
@35 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@36 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@37 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@38 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@39 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@40 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@41 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@42 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@43 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
@@ -57,103 +97,219 @@ _llgo_0:
|
||||
store i64 2, ptr %10, align 4
|
||||
store i64 3, ptr %11, align 4
|
||||
store i64 4, ptr %12, align 4
|
||||
%13 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
call void @main.out(i64 %13)
|
||||
%14 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
||||
%15 = getelementptr inbounds i64, ptr %14, i64 0
|
||||
store i64 1, ptr %15, align 4
|
||||
%16 = getelementptr inbounds i64, ptr %14, i64 1
|
||||
store i64 2, ptr %16, align 4
|
||||
%17 = getelementptr inbounds i64, ptr %14, i64 2
|
||||
store i64 3, ptr %17, align 4
|
||||
%18 = getelementptr inbounds i64, ptr %14, i64 3
|
||||
store i64 4, ptr %18, align 4
|
||||
%19 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %14, i64 8, i64 4, i64 0, i64 4, i64 4)
|
||||
%20 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %19)
|
||||
call void @main.out(i64 %20)
|
||||
call void @main.out(i64 4)
|
||||
call void @main.out(i64 4)
|
||||
call void @main.out(i64 4)
|
||||
%21 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
call void @main.out(i64 %21)
|
||||
call void @main.out(i64 4)
|
||||
call void @main.out(i64 4)
|
||||
%22 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%23 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%24 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%25 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %24, i64 8, i64 %22, i64 1, i64 %23, i64 %22)
|
||||
%26 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %25)
|
||||
call void @main.out(i64 %26)
|
||||
%27 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%28 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%29 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%30 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %29, i64 8, i64 %27, i64 1, i64 %28, i64 %27)
|
||||
%31 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %30)
|
||||
call void @main.out(i64 %31)
|
||||
%32 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%33 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%34 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %33, i64 8, i64 %32, i64 1, i64 2, i64 %32)
|
||||
%35 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %34)
|
||||
call void @main.out(i64 %35)
|
||||
%36 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%37 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%38 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %37, i64 8, i64 %36, i64 1, i64 2, i64 %36)
|
||||
%39 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %38)
|
||||
call void @main.out(i64 %39)
|
||||
%40 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%41 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%42 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %41, i64 8, i64 %40, i64 1, i64 2, i64 2)
|
||||
%43 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %42)
|
||||
call void @main.out(i64 %43)
|
||||
%44 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%45 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%46 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %45, i64 8, i64 %44, i64 1, i64 2, i64 2)
|
||||
%47 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %46)
|
||||
call void @main.out(i64 %47)
|
||||
%48 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 4, i64 4)
|
||||
%49 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %48)
|
||||
call void @main.out(i64 %49)
|
||||
%50 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 4, i64 4)
|
||||
%51 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %50)
|
||||
call void @main.out(i64 %51)
|
||||
%52 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 4)
|
||||
%53 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %52)
|
||||
call void @main.out(i64 %53)
|
||||
%54 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 4)
|
||||
%55 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %54)
|
||||
call void @main.out(i64 %55)
|
||||
%56 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 2)
|
||||
%57 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %56)
|
||||
call void @main.out(i64 %57)
|
||||
%58 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 2)
|
||||
%59 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %58)
|
||||
call void @main.out(i64 %59)
|
||||
%60 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 5)
|
||||
call void @main.string_len(%"github.com/goplus/llgo/internal/runtime.String" %60)
|
||||
%61 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @1, i64 5)
|
||||
%62 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %61, 1
|
||||
%63 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %61, i64 1, i64 %62)
|
||||
call void @main.string_len(%"github.com/goplus/llgo/internal/runtime.String" %63)
|
||||
%64 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @2, i64 5)
|
||||
%65 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %64, i64 1, i64 2)
|
||||
call void @main.string_len(%"github.com/goplus/llgo/internal/runtime.String" %65)
|
||||
%66 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @3, i64 5)
|
||||
%67 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %66, 1
|
||||
%68 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %66, i64 5, i64 %67)
|
||||
call void @main.string_len(%"github.com/goplus/llgo/internal/runtime.String" %68)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main.out(i64 %0) {
|
||||
_llgo_0:
|
||||
%1 = call i32 (ptr, ...) @printf(ptr @4, i64 %0)
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main.string_len(%"github.com/goplus/llgo/internal/runtime.String" %0) {
|
||||
_llgo_0:
|
||||
%1 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %0, 1
|
||||
call void @main.out(i64 %1)
|
||||
%13 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 10)
|
||||
%14 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %13, i64 1, i64 10, i64 0, i64 4, i64 10)
|
||||
%15 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 1
|
||||
%16 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%17 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %17)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %15)
|
||||
%18 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @1, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %18)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %16)
|
||||
%19 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @2, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %19)
|
||||
%20 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %14, 1
|
||||
%21 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %14, 2
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %14)
|
||||
%22 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @3, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %22)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %20)
|
||||
%23 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @4, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %23)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %21)
|
||||
%24 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @5, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %24)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 4)
|
||||
%25 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @6, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %25)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 4)
|
||||
%26 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @7, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %26)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 4)
|
||||
%27 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @8, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %27)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 4)
|
||||
%28 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @9, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %28)
|
||||
%29 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
||||
%30 = getelementptr inbounds i64, ptr %29, i64 0
|
||||
store i64 1, ptr %30, align 4
|
||||
%31 = getelementptr inbounds i64, ptr %29, i64 1
|
||||
store i64 2, ptr %31, align 4
|
||||
%32 = getelementptr inbounds i64, ptr %29, i64 2
|
||||
store i64 3, ptr %32, align 4
|
||||
%33 = getelementptr inbounds i64, ptr %29, i64 3
|
||||
store i64 4, ptr %33, align 4
|
||||
%34 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %29, i64 8, i64 4, i64 0, i64 4, i64 4)
|
||||
%35 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %34, 1
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %35)
|
||||
%36 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @10, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %36)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 4)
|
||||
%37 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @11, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %37)
|
||||
%38 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2
|
||||
%39 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2
|
||||
%40 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0
|
||||
%41 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %40, i64 8, i64 %38, i64 1, i64 %39, i64 %38)
|
||||
%42 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %41, 1
|
||||
%43 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2
|
||||
%44 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2
|
||||
%45 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0
|
||||
%46 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %45, i64 8, i64 %43, i64 1, i64 %44, i64 %43)
|
||||
%47 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %46, 2
|
||||
%48 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2
|
||||
%49 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0
|
||||
%50 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %49, i64 8, i64 %48, i64 1, i64 2, i64 %48)
|
||||
%51 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %50, 1
|
||||
%52 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2
|
||||
%53 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0
|
||||
%54 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %53, i64 8, i64 %52, i64 1, i64 2, i64 %52)
|
||||
%55 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %54, 2
|
||||
%56 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2
|
||||
%57 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0
|
||||
%58 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %57, i64 8, i64 %56, i64 1, i64 2, i64 2)
|
||||
%59 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %58, 1
|
||||
%60 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 2
|
||||
%61 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %7, 0
|
||||
%62 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %61, i64 8, i64 %60, i64 1, i64 2, i64 2)
|
||||
%63 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %62, 2
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %42)
|
||||
%64 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @12, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %64)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %47)
|
||||
%65 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @13, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %65)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %51)
|
||||
%66 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @14, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %66)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %55)
|
||||
%67 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @15, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %67)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %59)
|
||||
%68 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @16, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %68)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %63)
|
||||
%69 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @17, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %69)
|
||||
%70 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 4, i64 4)
|
||||
%71 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %70, 1
|
||||
%72 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 4, i64 4)
|
||||
%73 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %72, 2
|
||||
%74 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 4)
|
||||
%75 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %74, 1
|
||||
%76 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 4)
|
||||
%77 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %76, 2
|
||||
%78 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 2)
|
||||
%79 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %78, 1
|
||||
%80 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %8, i64 8, i64 4, i64 1, i64 2, i64 2)
|
||||
%81 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %80, 2
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %71)
|
||||
%82 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @18, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %82)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %73)
|
||||
%83 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @19, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %83)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %75)
|
||||
%84 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @20, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %84)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %77)
|
||||
%85 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @21, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %85)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %79)
|
||||
%86 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @22, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %86)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %81)
|
||||
%87 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @23, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %87)
|
||||
%88 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @24, i64 5)
|
||||
%89 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %88, 1
|
||||
%90 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %88, i64 1, i64 %89)
|
||||
%91 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @25, i64 5)
|
||||
%92 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %91, i64 1, i64 2)
|
||||
%93 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @26, i64 5)
|
||||
%94 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %93, 1
|
||||
%95 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %93, i64 5, i64 %94)
|
||||
%96 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %95, 1
|
||||
%97 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @27, i64 5)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %97)
|
||||
%98 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @28, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %98)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %90)
|
||||
%99 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @29, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %99)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %92)
|
||||
%100 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @30, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %100)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %96)
|
||||
%101 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @31, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %101)
|
||||
%102 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
||||
%103 = getelementptr inbounds i64, ptr %102, i64 0
|
||||
store i64 5, ptr %103, align 4
|
||||
%104 = getelementptr inbounds i64, ptr %102, i64 1
|
||||
store i64 6, ptr %104, align 4
|
||||
%105 = getelementptr inbounds i64, ptr %102, i64 2
|
||||
store i64 7, ptr %105, align 4
|
||||
%106 = getelementptr inbounds i64, ptr %102, i64 3
|
||||
store i64 8, ptr %106, align 4
|
||||
%107 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %102, i64 8, i64 4, i64 0, i64 4, i64 4)
|
||||
%108 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %107, 0
|
||||
%109 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %107, 1
|
||||
%110 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/internal/runtime.Slice" %7, ptr %108, i64 %109, i64 8)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %110)
|
||||
%111 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @32, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %111)
|
||||
%112 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 3)
|
||||
%113 = getelementptr inbounds i8, ptr %112, i64 0
|
||||
store i8 97, ptr %113, align 1
|
||||
%114 = getelementptr inbounds i8, ptr %112, i64 1
|
||||
store i8 98, ptr %114, align 1
|
||||
%115 = getelementptr inbounds i8, ptr %112, i64 2
|
||||
store i8 99, ptr %115, align 1
|
||||
%116 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %112, i64 1, i64 3, i64 0, i64 3, i64 3)
|
||||
%117 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @33, i64 3)
|
||||
%118 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %117, 0
|
||||
%119 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %117, 1
|
||||
%120 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/internal/runtime.Slice" %116, ptr %118, i64 %119, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %120)
|
||||
%121 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @34, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %121)
|
||||
%122 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 16)
|
||||
%123 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
|
||||
%124 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyInt"(ptr %123, i64 100)
|
||||
store %"github.com/goplus/llgo/internal/runtime.iface" %124, ptr %122, align 8
|
||||
%125 = load %"github.com/goplus/llgo/internal/runtime.iface", ptr %122, align 8
|
||||
%126 = ptrtoint ptr %122 to i64
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 true)
|
||||
%127 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @35, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %127)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 100)
|
||||
%128 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @36, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %128)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 -100)
|
||||
%129 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @37, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %129)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 100)
|
||||
%130 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @38, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %130)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 -100)
|
||||
%131 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @39, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %131)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintFloat"(double 1.005000e+02)
|
||||
%132 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @40, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %132)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintIface"(%"github.com/goplus/llgo/internal/runtime.iface" %125)
|
||||
%133 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @41, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %133)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintPointer"(ptr %122)
|
||||
%134 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @42, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %134)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64 %126)
|
||||
%135 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @43, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %135)
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -163,14 +319,28 @@ declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64)
|
||||
|
||||
declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr, i64, i64, i64, i64, i64)
|
||||
|
||||
declare i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
declare i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String")
|
||||
|
||||
declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr, i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64)
|
||||
|
||||
declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String", i64, i64)
|
||||
|
||||
declare i32 @printf(ptr, ...)
|
||||
declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/internal/runtime.Slice", ptr, i64, i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64)
|
||||
|
||||
declare %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyInt"(ptr, i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1)
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintUint"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintFloat"(double)
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintIface"(%"github.com/goplus/llgo/internal/runtime.iface")
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintPointer"(ptr)
|
||||
|
||||
@@ -11,6 +11,10 @@ func concat(args ...string) (ret string) {
|
||||
return
|
||||
}
|
||||
|
||||
func info(s string) string {
|
||||
return "" + s + "..."
|
||||
}
|
||||
|
||||
func main() {
|
||||
result := concat("Hello", " ", "World")
|
||||
c.Fprintf(c.Stderr, c.Str("Hi, %s\n"), c.AllocaCStr(result))
|
||||
|
||||
@@ -6,17 +6,19 @@ source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@0 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@1 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
||||
@2 = private unnamed_addr constant [4 x i8] c"...\00", align 1
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@1 = private unnamed_addr constant [6 x i8] c"Hello\00", align 1
|
||||
@2 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@3 = private unnamed_addr constant [6 x i8] c"World\00", align 1
|
||||
@3 = private unnamed_addr constant [6 x i8] c"Hello\00", align 1
|
||||
@4 = private unnamed_addr constant [2 x i8] c" \00", align 1
|
||||
@5 = private unnamed_addr constant [6 x i8] c"World\00", align 1
|
||||
@__stderrp = external global ptr
|
||||
@4 = private unnamed_addr constant [8 x i8] c"Hi, %s\0A\00", align 1
|
||||
@6 = private unnamed_addr constant [8 x i8] c"Hi, %s\0A\00", align 1
|
||||
|
||||
define %"github.com/goplus/llgo/internal/runtime.String" @main.concat(%"github.com/goplus/llgo/internal/runtime.Slice" %0) {
|
||||
_llgo_0:
|
||||
%1 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %0)
|
||||
%1 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 1
|
||||
%2 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 0)
|
||||
%3 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %2, 0
|
||||
%4 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %2, 1
|
||||
@@ -37,7 +39,7 @@ _llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
br i1 %13, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1
|
||||
%14 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %0)
|
||||
%14 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
||||
%15 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %14, i64 %12
|
||||
%16 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %15, align 8
|
||||
%17 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringCat"(%"github.com/goplus/llgo/internal/runtime.String" %11, %"github.com/goplus/llgo/internal/runtime.String" %16)
|
||||
@@ -49,6 +51,15 @@ _llgo_3: ; preds = %_llgo_1
|
||||
ret %"github.com/goplus/llgo/internal/runtime.String" %11
|
||||
}
|
||||
|
||||
define %"github.com/goplus/llgo/internal/runtime.String" @main.info(%"github.com/goplus/llgo/internal/runtime.String" %0) {
|
||||
_llgo_0:
|
||||
%1 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @1, i64 0)
|
||||
%2 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringCat"(%"github.com/goplus/llgo/internal/runtime.String" %1, %"github.com/goplus/llgo/internal/runtime.String" %0)
|
||||
%3 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @2, i64 3)
|
||||
%4 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringCat"(%"github.com/goplus/llgo/internal/runtime.String" %2, %"github.com/goplus/llgo/internal/runtime.String" %3)
|
||||
ret %"github.com/goplus/llgo/internal/runtime.String" %4
|
||||
}
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"main.init$guard", align 1
|
||||
@@ -70,13 +81,13 @@ _llgo_0:
|
||||
call void @main.init()
|
||||
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 48)
|
||||
%3 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %2, i64 0
|
||||
%4 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @1, i64 5)
|
||||
%4 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @3, i64 5)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %4, ptr %3, align 8
|
||||
%5 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %2, i64 1
|
||||
%6 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @2, i64 1)
|
||||
%6 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @4, i64 1)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %6, ptr %5, align 8
|
||||
%7 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %2, i64 2
|
||||
%8 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @3, i64 5)
|
||||
%8 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @5, i64 5)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %8, ptr %7, align 8
|
||||
%9 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %2, i64 16, i64 3, i64 0, i64 3, i64 3)
|
||||
%10 = call %"github.com/goplus/llgo/internal/runtime.String" @main.concat(%"github.com/goplus/llgo/internal/runtime.Slice" %9)
|
||||
@@ -85,14 +96,10 @@ _llgo_0:
|
||||
%13 = add i64 %12, 1
|
||||
%14 = alloca i8, i64 %13, align 1
|
||||
%15 = call ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr %14, %"github.com/goplus/llgo/internal/runtime.String" %10)
|
||||
%16 = call i32 (ptr, ptr, ...) @fprintf(ptr %11, ptr @4, ptr %15)
|
||||
%16 = call i32 (ptr, ptr, ...) @fprintf(ptr %11, ptr @6, ptr %15)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.StringCat"(%"github.com/goplus/llgo/internal/runtime.String", %"github.com/goplus/llgo/internal/runtime.String")
|
||||
|
||||
declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr, i64)
|
||||
|
||||
@@ -16,7 +16,7 @@ _llgo_0:
|
||||
%2 = mul i64 %0, 4
|
||||
%3 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 %2)
|
||||
%4 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice"(ptr %3, i64 %0, i64 %0)
|
||||
%5 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %4)
|
||||
%5 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %4, 1
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
@@ -29,7 +29,7 @@ _llgo_2: ; preds = %_llgo_1
|
||||
%9 = extractvalue { ptr, ptr } %1, 1
|
||||
%10 = extractvalue { ptr, ptr } %1, 0
|
||||
%11 = call i32 %10(ptr %9)
|
||||
%12 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %4)
|
||||
%12 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %4, 0
|
||||
%13 = getelementptr inbounds i32, ptr %12, i64 %7
|
||||
store i32 %11, ptr %13, align 4
|
||||
br label %_llgo_1
|
||||
@@ -76,7 +76,7 @@ _llgo_0:
|
||||
store ptr null, ptr %4, align 8
|
||||
%5 = load { ptr, ptr }, ptr %2, align 8
|
||||
%6 = call %"github.com/goplus/llgo/internal/runtime.Slice" @main.genInts(i64 5, { ptr, ptr } %5)
|
||||
%7 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %6)
|
||||
%7 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %6, 1
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
@@ -86,7 +86,7 @@ _llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
br i1 %10, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1
|
||||
%11 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %6)
|
||||
%11 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %6, 0
|
||||
%12 = getelementptr inbounds i32, ptr %11, i64 %9
|
||||
%13 = load i32, ptr %12, align 4
|
||||
%14 = call i32 (ptr, ...) @printf(ptr @0, i32 %13)
|
||||
@@ -105,7 +105,7 @@ _llgo_3: ; preds = %_llgo_1
|
||||
store ptr %16, ptr %20, align 8
|
||||
%21 = load { ptr, ptr }, ptr %18, align 8
|
||||
%22 = call %"github.com/goplus/llgo/internal/runtime.Slice" @main.genInts(i64 5, { ptr, ptr } %21)
|
||||
%23 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %22)
|
||||
%23 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %22, 1
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_4: ; preds = %_llgo_5, %_llgo_3
|
||||
@@ -115,7 +115,7 @@ _llgo_4: ; preds = %_llgo_5, %_llgo_3
|
||||
br i1 %26, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4
|
||||
%27 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %22)
|
||||
%27 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %22, 0
|
||||
%28 = getelementptr inbounds i32, ptr %27, i64 %25
|
||||
%29 = load i32, ptr %28, align 4
|
||||
%30 = call i32 (ptr, ...) @printf(ptr @1, i32 %29)
|
||||
@@ -135,7 +135,7 @@ _llgo_6: ; preds = %_llgo_4
|
||||
store ptr %33, ptr %37, align 8
|
||||
%38 = load { ptr, ptr }, ptr %35, align 8
|
||||
%39 = call %"github.com/goplus/llgo/internal/runtime.Slice" @main.genInts(i64 5, { ptr, ptr } %38)
|
||||
%40 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %39)
|
||||
%40 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %39, 1
|
||||
br label %_llgo_7
|
||||
|
||||
_llgo_7: ; preds = %_llgo_8, %_llgo_6
|
||||
@@ -145,7 +145,7 @@ _llgo_7: ; preds = %_llgo_8, %_llgo_6
|
||||
br i1 %43, label %_llgo_8, label %_llgo_9
|
||||
|
||||
_llgo_8: ; preds = %_llgo_7
|
||||
%44 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %39)
|
||||
%44 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %39, 0
|
||||
%45 = getelementptr inbounds i32, ptr %44, i64 %42
|
||||
%46 = load i32, ptr %45, align 4
|
||||
%47 = call i32 (ptr, ...) @printf(ptr @2, i32 %46)
|
||||
@@ -159,10 +159,6 @@ declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64)
|
||||
|
||||
declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice"(ptr, i64, i64)
|
||||
|
||||
declare i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
|
||||
declare i32 @rand()
|
||||
|
||||
8
cl/_testrt/mask/in.go
Normal file
8
cl/_testrt/mask/in.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
println(mask(1))
|
||||
}
|
||||
func mask(x int8) int32 {
|
||||
return int32(x) << 31 >> 31
|
||||
}
|
||||
52
cl/_testrt/mask/out.ll
Normal file
52
cl/_testrt/mask/out.ll
Normal file
@@ -0,0 +1,52 @@
|
||||
; ModuleID = 'main'
|
||||
source_filename = "main"
|
||||
|
||||
%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 }
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
%0 = load i1, ptr @"main.init$guard", align 1
|
||||
br i1 %0, label %_llgo_2, label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
store i1 true, ptr @"main.init$guard", align 1
|
||||
br label %_llgo_2
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main(i32 %0, ptr %1) {
|
||||
_llgo_0:
|
||||
store i32 %0, ptr @__llgo_argc, align 4
|
||||
store ptr %1, ptr @__llgo_argv, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
call void @main.init()
|
||||
%2 = call i32 @main.mask(i8 1)
|
||||
%3 = sext i32 %2 to i64
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %3)
|
||||
%4 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 1)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %4)
|
||||
ret void
|
||||
}
|
||||
|
||||
define i32 @main.mask(i8 %0) {
|
||||
_llgo_0:
|
||||
%1 = sext i8 %0 to i32
|
||||
%2 = shl i32 %1, 31
|
||||
%3 = ashr i32 %2, 31
|
||||
ret i32 %3
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64)
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String")
|
||||
|
||||
declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr, i64)
|
||||
@@ -44,7 +44,7 @@ _llgo_0:
|
||||
|
||||
define i64 @main.sum(%"github.com/goplus/llgo/internal/runtime.Slice" %0) {
|
||||
_llgo_0:
|
||||
%1 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %0)
|
||||
%1 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 1
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
@@ -55,7 +55,7 @@ _llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
br i1 %5, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1
|
||||
%6 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %0)
|
||||
%6 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
|
||||
%7 = getelementptr inbounds i64, ptr %6, i64 %4
|
||||
%8 = load i64, ptr %7, align 4
|
||||
%9 = add i64 %2, %8
|
||||
@@ -72,7 +72,3 @@ declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64)
|
||||
declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr, i64, i64, i64, i64, i64)
|
||||
|
||||
declare i32 @printf(ptr, ...)
|
||||
|
||||
declare i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice")
|
||||
|
||||
@@ -226,5 +226,5 @@ func TestErrVarOf(t *testing.T) {
|
||||
}
|
||||
ssaPkg := &ssa.Package{Pkg: pkgTypes}
|
||||
g := &ssa.Global{Pkg: ssaPkg}
|
||||
ctx.varOf(g)
|
||||
ctx.varOf(nil, g)
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ func (p *context) compileMethods(pkg llssa.Package, typ types.Type) {
|
||||
for i, n := 0, mthds.Len(); i < n; i++ {
|
||||
mthd := mthds.At(i)
|
||||
if ssaMthd := prog.MethodValue(mthd); ssaMthd != nil {
|
||||
p.compileFuncDecl(pkg, ssaMthd, false)
|
||||
p.compileFuncDecl(pkg, ssaMthd)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ func (p *context) compileMethods(pkg llssa.Package, typ types.Type) {
|
||||
func (p *context) compileGlobal(pkg llssa.Package, gbl *ssa.Global) {
|
||||
typ := gbl.Type()
|
||||
name, vtype := p.varName(gbl.Pkg.Pkg, gbl)
|
||||
if ignoreName(name) || checkCgo(gbl.Name()) {
|
||||
if vtype == pyVar || ignoreName(name) || checkCgo(gbl.Name()) {
|
||||
return
|
||||
}
|
||||
if debugInstr {
|
||||
@@ -215,14 +215,16 @@ var (
|
||||
argvTy = types.NewPointer(types.NewPointer(types.Typ[types.Int8]))
|
||||
)
|
||||
|
||||
func (p *context) compileFuncDecl(pkg llssa.Package, f *ssa.Function, call bool) (llssa.Function, llssa.PyObjRef, int) {
|
||||
func (p *context) compileFuncDecl(pkg llssa.Package, f *ssa.Function) (llssa.Function, llssa.PyObjRef, int) {
|
||||
pkgTypes, name, ftype := p.funcName(f, true)
|
||||
if ftype != goFunc {
|
||||
if ftype == pyFunc {
|
||||
// TODO(xsw): pyMod == ""
|
||||
fnName := pysymPrefix + p.pyMod + "." + name
|
||||
return nil, pkg.NewPyFunc(fnName, f.Signature, call), pyFunc
|
||||
}
|
||||
/*
|
||||
if ftype == pyFunc {
|
||||
// TODO(xsw): pyMod == ""
|
||||
fnName := pysymPrefix + p.pyMod + "." + name
|
||||
return nil, pkg.NewPyFunc(fnName, f.Signature, call), pyFunc
|
||||
}
|
||||
*/
|
||||
return nil, nil, ignoredFunc
|
||||
}
|
||||
fn := pkg.FuncOf(name)
|
||||
@@ -239,8 +241,8 @@ func (p *context) compileFuncDecl(pkg llssa.Package, f *ssa.Function, call bool)
|
||||
ctx := makeClosureCtx(pkgTypes, f.FreeVars)
|
||||
sig = llssa.FuncAddCtx(ctx, sig)
|
||||
} else {
|
||||
if debugInstr && sig != nil && sig.Recv() != nil {
|
||||
log.Println("==> NewFunc", name, "type:", sig.Recv(), sig)
|
||||
if debugInstr {
|
||||
log.Println("==> NewFunc", name, "type:", sig.Recv(), sig, "ftype:", ftype)
|
||||
}
|
||||
}
|
||||
if fn == nil {
|
||||
@@ -298,7 +300,7 @@ func (p *context) funcOf(fn *ssa.Function) (aFn llssa.Function, pyFn llssa.PyObj
|
||||
pkg := p.pkg
|
||||
fnName := pysymPrefix + mod + "." + name
|
||||
if pyFn = pkg.PyObjOf(fnName); pyFn == nil {
|
||||
pyFn = pkg.NewPyFunc(fnName, fn.Signature, true)
|
||||
pyFn = pkg.PyNewFunc(fnName, fn.Signature, true)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -317,6 +319,8 @@ func (p *context) funcOf(fn *ssa.Function) (aFn llssa.Function, pyFn llssa.PyObj
|
||||
ftype = llgoAllocaCStr
|
||||
case "stringData":
|
||||
ftype = llgoStringData
|
||||
case "pyList":
|
||||
ftype = llgoPyList
|
||||
case "unreachable":
|
||||
ftype = llgoUnreachable
|
||||
default:
|
||||
@@ -374,7 +378,7 @@ func (p *context) compileBlock(b llssa.Builder, block *ssa.BasicBlock, n int, do
|
||||
b.SetBlockEx(ret, llssa.AfterInit)
|
||||
for _, modName := range modNames {
|
||||
objs := mods[modName]
|
||||
b.LoadPyModSyms(modName, objs...)
|
||||
b.PyLoadModSyms(modName, objs...)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -398,13 +402,13 @@ func (p *context) compileBlock(b llssa.Builder, block *ssa.BasicBlock, n int, do
|
||||
jumpTo := p.jumpTo(jump)
|
||||
modPath := p.pyMod
|
||||
modName := pysymPrefix + modPath
|
||||
modPtr := pkg.NewPyModVar(modName, true).Expr
|
||||
modPtr := pkg.PyNewModVar(modName, true).Expr
|
||||
mod := b.Load(modPtr)
|
||||
cond := b.BinOp(token.NEQ, mod, prog.Null(mod.Type))
|
||||
newBlk := p.fn.MakeBlock()
|
||||
b.If(cond, jumpTo, newBlk)
|
||||
b.SetBlock(newBlk)
|
||||
b.Store(modPtr, b.ImportPyMod(modPath))
|
||||
b.Store(modPtr, b.PyImportMod(modPath))
|
||||
b.Jump(jumpTo)
|
||||
}
|
||||
return ret
|
||||
@@ -607,6 +611,9 @@ func (p *context) compileInstrOrValue(b llssa.Builder, iv instrOrValue, asValue
|
||||
case pyFunc:
|
||||
args := p.compileValues(b, args, kind)
|
||||
ret = b.Call(pyFn.Expr, args...)
|
||||
case llgoPyList:
|
||||
args := p.compileValues(b, args, fnHasVArg)
|
||||
ret = b.PyList(args...)
|
||||
case llgoCstr:
|
||||
ret = cstr(b, args)
|
||||
case llgoAdvance:
|
||||
@@ -808,7 +815,7 @@ func (p *context) compileFunction(v *ssa.Function) (goFn llssa.Function, pyFn ll
|
||||
// v.Pkg == nil: means auto generated function?
|
||||
if v.Pkg == p.goPkg || v.Pkg == nil {
|
||||
// function in this package
|
||||
goFn, pyFn, kind = p.compileFuncDecl(p.pkg, v, true)
|
||||
goFn, pyFn, kind = p.compileFuncDecl(p.pkg, v)
|
||||
if kind != ignoredFunc {
|
||||
return
|
||||
}
|
||||
@@ -835,8 +842,7 @@ func (p *context) compileValue(b llssa.Builder, v ssa.Value) llssa.Expr {
|
||||
}
|
||||
return pyFn.Expr
|
||||
case *ssa.Global:
|
||||
g := p.varOf(v)
|
||||
return g.Expr
|
||||
return p.varOf(b, v)
|
||||
case *ssa.Const:
|
||||
t := types.Default(v.Type())
|
||||
return b.Const(v.Value, p.prog.Type(t, llssa.InGo))
|
||||
@@ -927,7 +933,7 @@ func NewPackage(prog llssa.Program, pkg *ssa.Package, files []*ast.File) (ret ll
|
||||
// Do not try to build generic (non-instantiated) functions.
|
||||
continue
|
||||
}
|
||||
ctx.compileFuncDecl(ret, member, false)
|
||||
ctx.compileFuncDecl(ret, member)
|
||||
case *ssa.Type:
|
||||
ctx.compileType(ret, member)
|
||||
case *ssa.Global:
|
||||
|
||||
@@ -45,7 +45,7 @@ func TestFromTestdata(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSqlite(t *testing.T) {
|
||||
cltest.Pkg(t, "github.com/goplus/llgo/x/sqlite", "../x/sqlite/sqlite.ll")
|
||||
cltest.Pkg(t, "github.com/goplus/llgo/x/sqlite", "../x/sqlite/llgo_autogen.ll")
|
||||
}
|
||||
|
||||
func TestFromTestpymath(t *testing.T) {
|
||||
|
||||
18
cl/import.go
18
cl/import.go
@@ -318,6 +318,7 @@ const (
|
||||
llgoAdvance = llgoInstrBase + 4
|
||||
llgoIndex = llgoInstrBase + 5
|
||||
llgoStringData = llgoInstrBase + 6
|
||||
llgoPyList = llgoInstrBase + 7
|
||||
)
|
||||
|
||||
func (p *context) funcName(fn *ssa.Function, ignore bool) (*types.Package, string, int) {
|
||||
@@ -358,24 +359,35 @@ const (
|
||||
ignoredVar = iota
|
||||
goVar = int(llssa.InGo)
|
||||
cVar = int(llssa.InC)
|
||||
pyVar = int(llssa.InPython)
|
||||
)
|
||||
|
||||
func (p *context) varName(pkg *types.Package, v *ssa.Global) (vName string, vtype int) {
|
||||
name := llssa.FullName(pkg, v.Name())
|
||||
if v, ok := p.link[name]; ok {
|
||||
if strings.HasPrefix(v, "py.") {
|
||||
return v[3:], pyVar
|
||||
}
|
||||
return v, cVar
|
||||
}
|
||||
return name, goVar
|
||||
}
|
||||
|
||||
func (p *context) varOf(v *ssa.Global) (ret llssa.Global) {
|
||||
func (p *context) varOf(b llssa.Builder, v *ssa.Global) llssa.Expr {
|
||||
pkgTypes := p.ensureLoaded(v.Pkg.Pkg)
|
||||
pkg := p.pkg
|
||||
name, vtype := p.varName(pkgTypes, v)
|
||||
if ret = pkg.VarOf(name); ret == nil {
|
||||
if vtype == pyVar {
|
||||
if kind, mod := pkgKindByScope(pkgTypes.Scope()); kind == PkgPyModule {
|
||||
return b.PyNewVar(pysymPrefix+mod, name).Expr
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
ret := pkg.VarOf(name)
|
||||
if ret == nil {
|
||||
ret = pkg.NewVar(name, v.Type(), llssa.Background(vtype))
|
||||
}
|
||||
return
|
||||
return ret.Expr
|
||||
}
|
||||
|
||||
func (p *context) ensureLoaded(pkgTypes *types.Package) *types.Package {
|
||||
|
||||
Reference in New Issue
Block a user