runtime: c.Argc, c.Argv, c.Getopt
This commit is contained in:
@@ -29,6 +29,23 @@ func main() {
|
||||
var steps c.Int = 256
|
||||
var rngSeed uint64 = uint64(c.Time(nil))
|
||||
|
||||
loop: // parse command line arguments
|
||||
for {
|
||||
switch c.Getopt(c.Argc, c.Argv, c.Str("m:")) {
|
||||
case 'm':
|
||||
checkpointPath = c.Optarg
|
||||
c.Fprintf(c.Stderr, c.Str("use model: %s\n"), checkpointPath)
|
||||
case -1:
|
||||
break loop
|
||||
}
|
||||
}
|
||||
/*
|
||||
if c.Optind < c.Argc {
|
||||
prompt = c.Index(c.Argv, c.Optind)
|
||||
c.Fprintf(c.Stderr, c.Str("prompt: %s\n"), prompt)
|
||||
}
|
||||
*/
|
||||
|
||||
// build the Transformer via the model .bin file
|
||||
var transformer llama2.Transformer
|
||||
llama2.BuildTransformer(&transformer, checkpointPath)
|
||||
|
||||
77
c/c.go
77
c/c.go
@@ -33,14 +33,9 @@ type (
|
||||
FilePtr = unsafe.Pointer
|
||||
)
|
||||
|
||||
//go:linkname Stdin __stdinp
|
||||
var Stdin FilePtr
|
||||
|
||||
//go:linkname Stdout __stdoutp
|
||||
var Stdout FilePtr
|
||||
|
||||
//go:linkname Stderr __stderrp
|
||||
var Stderr FilePtr
|
||||
type integer interface {
|
||||
~int | ~uint | ~uintptr | ~int32 | ~uint32 | ~int64 | ~uint64
|
||||
}
|
||||
|
||||
//go:linkname Str llgo.cstr
|
||||
func Str(string) *Char
|
||||
@@ -48,6 +43,9 @@ func Str(string) *Char
|
||||
//go:linkname Advance llgo.advance
|
||||
func Advance(ptr Pointer, offset int) Pointer
|
||||
|
||||
// llgo:link Index llgo.index
|
||||
// func Index[T any, I integer](ptr *T, offset I) T { return *ptr }
|
||||
|
||||
//go:linkname Alloca llgo.alloca
|
||||
func Alloca(size uintptr) Pointer
|
||||
|
||||
@@ -57,9 +55,6 @@ func AllocaCStr(s string) *Char
|
||||
//go:linkname Unreachable llgo.unreachable
|
||||
func Unreachable()
|
||||
|
||||
//go:linkname Rand C.rand
|
||||
func Rand() Int
|
||||
|
||||
//go:linkname Malloc C.malloc
|
||||
func Malloc(size uintptr) Pointer
|
||||
|
||||
@@ -69,14 +64,70 @@ func Memcpy(dst, src Pointer, n uintptr) Pointer
|
||||
//go:linkname Memset C.memset
|
||||
func Memset(s Pointer, c Int, n uintptr) Pointer
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
//go:linkname Rand C.rand
|
||||
func Rand() Int
|
||||
|
||||
//go:linkname Qsort C.qsort
|
||||
func Qsort(base Pointer, count, elem uintptr, compar func(a, b Pointer) Int)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
//go:linkname Stdin __stdinp
|
||||
var Stdin FilePtr
|
||||
|
||||
//go:linkname Stdout __stdoutp
|
||||
var Stdout FilePtr
|
||||
|
||||
//go:linkname Stderr __stderrp
|
||||
var Stderr FilePtr
|
||||
|
||||
//go:linkname Printf C.printf
|
||||
func Printf(format *Char, __llgo_va_list ...any) Int
|
||||
|
||||
//go:linkname Fprintf C.fprintf
|
||||
func Fprintf(fp FilePtr, format *Char, __llgo_va_list ...any) Int
|
||||
|
||||
//go:linkname Qsort C.qsort
|
||||
func Qsort(base Pointer, count, elem uintptr, compar func(a, b Pointer) Int)
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
//go:linkname Time C.time
|
||||
func Time(*int32) int32
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
type Option struct {
|
||||
Name *Char
|
||||
HasArg Int
|
||||
Flag *Int
|
||||
Val Int
|
||||
}
|
||||
|
||||
//go:linkname Argc __llgo_argc
|
||||
var Argc Int
|
||||
|
||||
//go:linkname Argv __llgo_argv
|
||||
var Argv **Char
|
||||
|
||||
//go:linkname Optarg optarg
|
||||
var Optarg *Char
|
||||
|
||||
//go:linkname Optind optind
|
||||
var Optind Int
|
||||
|
||||
//go:linkname Opterr opterr
|
||||
var Opterr Int
|
||||
|
||||
//go:linkname Optopt optopt
|
||||
var Optopt Int
|
||||
|
||||
//go:linkname Getopt C.getopt
|
||||
func Getopt(argc Int, argv **Char, optstring *Char) Int
|
||||
|
||||
//go:linkname GetoptLong C.getopt_long
|
||||
func GetoptLong(argc Int, argv **Char, optstring *Char, longopts *Option, longindex *Int) Int
|
||||
|
||||
//go:linkname GetoptLongOnly C.getopt_long_only
|
||||
func GetoptLongOnly(argc Int, argv **Char, optstring *Char, longopts *Option, longindex *Int) Int
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
@@ -16,11 +18,13 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call i64 @main.max(i64 1, i64 2)
|
||||
%2 = call i64 @main.max(i64 1, i64 2)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ source_filename = "main"
|
||||
|
||||
@main.hello = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
@@ -25,11 +27,13 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call i64 @"github.com/goplus/llgo/cl/internal/stdio.Max"(i64 2, i64 100)
|
||||
%2 = call i64 @"github.com/goplus/llgo/cl/internal/stdio.Max"(i64 2, i64 100)
|
||||
call void (ptr, ...) @printf(ptr @main.hello)
|
||||
ret void
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ source_filename = "main"
|
||||
|
||||
@main.format = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define i64 @"(main.T).Add"(i64 %0, i64 %1) {
|
||||
_llgo_0:
|
||||
@@ -40,12 +42,14 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call i64 @"(main.T).Add"(i64 1, i64 2)
|
||||
call void (ptr, ...) @printf(ptr @main.format, i64 %0)
|
||||
%2 = call i64 @"(main.T).Add"(i64 1, i64 2)
|
||||
call void (ptr, ...) @printf(ptr @main.format, i64 %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ source_filename = "main"
|
||||
@"main.init$guard" = global ptr null
|
||||
@main.minhexdigits = global ptr null
|
||||
@0 = private unnamed_addr constant [3 x i8] c"%c\00", align 1
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@1 = private unnamed_addr constant [5 x i8] c"llgo\00", align 1
|
||||
@2 = private unnamed_addr constant [17 x i8] c"0123456789abcdef\00", align 1
|
||||
@3 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
|
||||
@@ -80,12 +82,14 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @1, i64 4)
|
||||
call void @main.printstring(%"github.com/goplus/llgo/internal/runtime.String" %0)
|
||||
%2 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @1, i64 4)
|
||||
call void @main.printstring(%"github.com/goplus/llgo/internal/runtime.String" %2)
|
||||
call void @main.printnl()
|
||||
call void @main.printuint(i64 1024)
|
||||
call void @main.printnl()
|
||||
|
||||
@@ -3,6 +3,8 @@ source_filename = "main"
|
||||
|
||||
@main.hello = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
@@ -24,8 +26,10 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
call void (ptr, ...) @printf(ptr @main.hello)
|
||||
|
||||
@@ -3,6 +3,8 @@ source_filename = "main"
|
||||
|
||||
@main.format = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
@@ -27,8 +29,10 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
call void (ptr, ...) @printf(ptr @main.format, i64 100)
|
||||
|
||||
@@ -3,6 +3,8 @@ source_filename = "main"
|
||||
|
||||
@main.format = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @"(*main.T).Print"(ptr %0, i64 %1) {
|
||||
_llgo_0:
|
||||
@@ -33,8 +35,10 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
call void @"(*main.T).Print"(ptr @main.format, i64 100)
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
; 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 [11 x i8] c"Hello, %u\0A\00", align 1
|
||||
|
||||
define i32 @main.f(i32 %0) {
|
||||
@@ -23,15 +27,23 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call i32 @main.f(i32 100)
|
||||
%1 = call i32 (ptr, ...) @printf(ptr @0, i32 %0)
|
||||
%2 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 10)
|
||||
%3 = call ptr @"github.com/goplus/llgo/c.Str"(%"github.com/goplus/llgo/internal/runtime.String" %2)
|
||||
%4 = call i32 @main.f(i32 100)
|
||||
%5 = call i32 (ptr, ...) @printf(ptr %3, i32 %4)
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/c.Str"(%"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 i32 @printf(ptr, ...)
|
||||
|
||||
@@ -3,6 +3,8 @@ source_filename = "main"
|
||||
|
||||
@main.a = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
@@ -18,8 +20,10 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
br i1 false, label %_llgo_1, label %_llgo_2
|
||||
|
||||
@@ -3,6 +3,8 @@ source_filename = "main"
|
||||
|
||||
@main.a = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
@@ -18,14 +20,16 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = load i64, ptr @main.a, align 4
|
||||
%1 = add i64 %0, 1
|
||||
store i64 %1, ptr @main.a, align 4
|
||||
%2 = load i64, ptr @main.a, align 4
|
||||
%3 = add i64 %2, 1
|
||||
store i64 %3, ptr @main.a, align 4
|
||||
%4 = load i64, ptr @main.a, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [4 x i8] c"Hi\0A\00", align 1
|
||||
@1 = private unnamed_addr constant [3 x i8] c"%s\00", align 1
|
||||
|
||||
@@ -18,13 +20,15 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = alloca i8, i64 4, align 1
|
||||
%1 = call ptr @memcpy(ptr %0, ptr @0, i64 4)
|
||||
%2 = call i32 (ptr, ...) @printf(ptr @1, ptr %0)
|
||||
%2 = alloca i8, i64 4, align 1
|
||||
%3 = call ptr @memcpy(ptr %2, ptr @0, i64 4)
|
||||
%4 = call i32 (ptr, ...) @printf(ptr @1, ptr %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@0 = private unnamed_addr constant [13 x i8] c"Hello world\0A\00", align 1
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define %"github.com/goplus/llgo/internal/runtime.String" @main.hello() {
|
||||
_llgo_0:
|
||||
@@ -25,16 +27,18 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call %"github.com/goplus/llgo/internal/runtime.String" @main.hello()
|
||||
%1 = call i64 @"github.com/goplus/llgo/internal/runtime.StringLen"(%"github.com/goplus/llgo/internal/runtime.String" %0)
|
||||
%2 = add i64 %1, 1
|
||||
%3 = alloca i8, i64 %2, align 1
|
||||
%4 = call ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr %3, %"github.com/goplus/llgo/internal/runtime.String" %0)
|
||||
%5 = call i32 (ptr, ...) @printf(ptr %4)
|
||||
%2 = call %"github.com/goplus/llgo/internal/runtime.String" @main.hello()
|
||||
%3 = call i64 @"github.com/goplus/llgo/internal/runtime.StringLen"(%"github.com/goplus/llgo/internal/runtime.String" %2)
|
||||
%4 = add i64 %3, 1
|
||||
%5 = alloca i8, i64 %4, align 1
|
||||
%6 = call ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr %5, %"github.com/goplus/llgo/internal/runtime.String" %2)
|
||||
%7 = call i32 (ptr, ...) @printf(ptr %6)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ source_filename = "main"
|
||||
%"github.com/goplus/llgo/internal/runtime.iface" = type { ptr, ptr }
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [10 x i8] c"Hello %d\0A\00", align 1
|
||||
|
||||
define i64 @main.incVal(%"github.com/goplus/llgo/internal/runtime.iface" %0) {
|
||||
@@ -27,14 +29,16 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
|
||||
%1 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyInt"(ptr %0, i64 100)
|
||||
%2 = call i64 @main.incVal(%"github.com/goplus/llgo/internal/runtime.iface" %1)
|
||||
%3 = call i32 (ptr, ...) @printf(ptr @0, i64 %2)
|
||||
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
|
||||
%3 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyInt"(ptr %2, i64 100)
|
||||
%4 = call i64 @main.incVal(%"github.com/goplus/llgo/internal/runtime.iface" %3)
|
||||
%5 = call i32 (ptr, ...) @printf(ptr @0, i64 %4)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ source_filename = "main"
|
||||
@main.b = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@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
|
||||
@@ -30,113 +32,115 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
||||
%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 = getelementptr inbounds i64, ptr %0, i64 3
|
||||
store i64 4, ptr %4, align 4
|
||||
%5 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %0, i64 8, i64 4, i64 0, i64 4, i64 4)
|
||||
%6 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
||||
%7 = getelementptr inbounds i64, ptr %6, i64 0
|
||||
%8 = getelementptr inbounds i64, ptr %6, i64 1
|
||||
%9 = getelementptr inbounds i64, ptr %6, i64 2
|
||||
%10 = getelementptr inbounds i64, ptr %6, i64 3
|
||||
store i64 1, ptr %7, align 4
|
||||
store i64 2, ptr %8, align 4
|
||||
store i64 3, ptr %9, align 4
|
||||
store i64 4, ptr %10, align 4
|
||||
%11 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
call void @main.out(i64 %11)
|
||||
%12 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
||||
%13 = getelementptr inbounds i64, ptr %12, i64 0
|
||||
store i64 1, ptr %13, align 4
|
||||
%14 = getelementptr inbounds i64, ptr %12, i64 1
|
||||
store i64 2, ptr %14, align 4
|
||||
%15 = getelementptr inbounds i64, ptr %12, i64 2
|
||||
store i64 3, ptr %15, align 4
|
||||
%16 = getelementptr inbounds i64, ptr %12, i64 3
|
||||
store i64 4, ptr %16, align 4
|
||||
%17 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %12, i64 8, i64 4, i64 0, i64 4, i64 4)
|
||||
%18 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %17)
|
||||
call void @main.out(i64 %18)
|
||||
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
||||
%3 = getelementptr inbounds i64, ptr %2, i64 0
|
||||
store i64 1, ptr %3, align 4
|
||||
%4 = getelementptr inbounds i64, ptr %2, i64 1
|
||||
store i64 2, ptr %4, align 4
|
||||
%5 = getelementptr inbounds i64, ptr %2, i64 2
|
||||
store i64 3, ptr %5, align 4
|
||||
%6 = getelementptr inbounds i64, ptr %2, i64 3
|
||||
store i64 4, ptr %6, align 4
|
||||
%7 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %2, i64 8, i64 4, i64 0, i64 4, i64 4)
|
||||
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
||||
%9 = getelementptr inbounds i64, ptr %8, i64 0
|
||||
%10 = getelementptr inbounds i64, ptr %8, i64 1
|
||||
%11 = getelementptr inbounds i64, ptr %8, i64 2
|
||||
%12 = getelementptr inbounds i64, ptr %8, i64 3
|
||||
store i64 1, ptr %9, align 4
|
||||
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)
|
||||
%19 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
call void @main.out(i64 %19)
|
||||
%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)
|
||||
%20 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%21 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%22 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%23 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %22, i64 8, i64 %20, i64 1, i64 %21, i64 %20)
|
||||
%24 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %23)
|
||||
call void @main.out(i64 %24)
|
||||
%25 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%26 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%27 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%28 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %27, i64 8, i64 %25, i64 1, i64 %26, i64 %25)
|
||||
%29 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %28)
|
||||
call void @main.out(i64 %29)
|
||||
%30 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%31 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%32 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %31, i64 8, i64 %30, i64 1, i64 2, i64 %30)
|
||||
%33 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %32)
|
||||
call void @main.out(i64 %33)
|
||||
%34 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%35 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%36 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %35, i64 8, i64 %34, i64 1, i64 2, i64 %34)
|
||||
%37 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %36)
|
||||
call void @main.out(i64 %37)
|
||||
%38 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%39 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%40 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %39, i64 8, i64 %38, i64 1, i64 2, i64 2)
|
||||
%41 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %40)
|
||||
call void @main.out(i64 %41)
|
||||
%42 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%43 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%44 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %43, i64 8, i64 %42, i64 1, i64 2, i64 2)
|
||||
%45 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %44)
|
||||
call void @main.out(i64 %45)
|
||||
%46 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %6, i64 8, i64 4, i64 1, i64 4, i64 4)
|
||||
%47 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %46)
|
||||
%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 %6, i64 8, i64 4, i64 1, i64 4, i64 4)
|
||||
%49 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %48)
|
||||
%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 %6, i64 8, i64 4, i64 1, i64 2, i64 4)
|
||||
%51 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %50)
|
||||
%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 %6, i64 8, i64 4, i64 1, i64 2, i64 4)
|
||||
%53 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %52)
|
||||
%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 %6, i64 8, i64 4, i64 1, i64 2, i64 2)
|
||||
%55 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %54)
|
||||
%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 %6, i64 8, i64 4, i64 1, i64 2, i64 2)
|
||||
%57 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceCap"(%"github.com/goplus/llgo/internal/runtime.Slice" %56)
|
||||
%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.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 5)
|
||||
call void @main.string_len(%"github.com/goplus/llgo/internal/runtime.String" %58)
|
||||
%59 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @1, i64 5)
|
||||
%60 = call i64 @"github.com/goplus/llgo/internal/runtime.StringLen"(%"github.com/goplus/llgo/internal/runtime.String" %59)
|
||||
%61 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %59, i64 1, i64 %60)
|
||||
call void @main.string_len(%"github.com/goplus/llgo/internal/runtime.String" %61)
|
||||
%62 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @2, i64 5)
|
||||
%63 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %62, i64 1, i64 2)
|
||||
%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 = call i64 @"github.com/goplus/llgo/internal/runtime.StringLen"(%"github.com/goplus/llgo/internal/runtime.String" %61)
|
||||
%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 @3, i64 5)
|
||||
%65 = call i64 @"github.com/goplus/llgo/internal/runtime.StringLen"(%"github.com/goplus/llgo/internal/runtime.String" %64)
|
||||
%66 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %64, i64 5, i64 %65)
|
||||
call void @main.string_len(%"github.com/goplus/llgo/internal/runtime.String" %66)
|
||||
%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 = call i64 @"github.com/goplus/llgo/internal/runtime.StringLen"(%"github.com/goplus/llgo/internal/runtime.String" %66)
|
||||
%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
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [7 x i8] c"Hello\0A\00", align 1
|
||||
@1 = private unnamed_addr constant [10 x i8] c"callback\0A\00", align 1
|
||||
|
||||
@@ -26,24 +28,26 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = alloca { ptr, ptr }, align 8
|
||||
%1 = getelementptr inbounds { ptr, ptr }, ptr %0, i32 0, i32 0
|
||||
store ptr @__llgo_stub.main.print, ptr %1, align 8
|
||||
%2 = getelementptr inbounds { ptr, ptr }, ptr %0, i32 0, i32 1
|
||||
store ptr null, ptr %2, align 8
|
||||
%3 = load { ptr, ptr }, ptr %0, align 8
|
||||
call void @main.callback(ptr @0, { ptr, ptr } %3)
|
||||
%4 = alloca { ptr, ptr }, align 8
|
||||
%5 = getelementptr inbounds { ptr, ptr }, ptr %4, i32 0, i32 0
|
||||
store ptr @__llgo_stub.main.print, ptr %5, align 8
|
||||
%6 = getelementptr inbounds { ptr, ptr }, ptr %4, i32 0, i32 1
|
||||
store ptr null, ptr %6, align 8
|
||||
%7 = load { ptr, ptr }, ptr %4, align 8
|
||||
call void @main.callback(ptr @1, { ptr, ptr } %7)
|
||||
%2 = alloca { ptr, ptr }, align 8
|
||||
%3 = getelementptr inbounds { ptr, ptr }, ptr %2, i32 0, i32 0
|
||||
store ptr @__llgo_stub.main.print, ptr %3, align 8
|
||||
%4 = getelementptr inbounds { ptr, ptr }, ptr %2, i32 0, i32 1
|
||||
store ptr null, ptr %4, align 8
|
||||
%5 = load { ptr, ptr }, ptr %2, align 8
|
||||
call void @main.callback(ptr @0, { ptr, ptr } %5)
|
||||
%6 = alloca { ptr, ptr }, align 8
|
||||
%7 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 0
|
||||
store ptr @__llgo_stub.main.print, ptr %7, align 8
|
||||
%8 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 1
|
||||
store ptr null, ptr %8, align 8
|
||||
%9 = load { ptr, ptr }, ptr %6, align 8
|
||||
call void @main.callback(ptr @1, { ptr, ptr } %9)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
|
||||
@1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
|
||||
|
||||
@@ -18,31 +20,33 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
call void @"main.main$1"(i64 100, i64 200)
|
||||
%0 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 16)
|
||||
%1 = alloca { ptr, ptr }, align 8
|
||||
%2 = getelementptr inbounds { ptr, ptr }, ptr %1, i32 0, i32 0
|
||||
store ptr @"__llgo_stub.main.main$2", ptr %2, align 8
|
||||
%3 = getelementptr inbounds { ptr, ptr }, ptr %1, i32 0, i32 1
|
||||
store ptr null, ptr %3, align 8
|
||||
%4 = load { ptr, ptr }, ptr %1, align 8
|
||||
store { ptr, ptr } %4, ptr %0, align 8
|
||||
%5 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8)
|
||||
%6 = getelementptr inbounds { ptr }, ptr %5, i32 0, i32 0
|
||||
store ptr %0, ptr %6, align 8
|
||||
%7 = alloca { ptr, ptr }, align 8
|
||||
%8 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 0
|
||||
store ptr @"main.main$3", ptr %8, align 8
|
||||
%9 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 1
|
||||
store ptr %5, ptr %9, align 8
|
||||
%10 = load { ptr, ptr }, ptr %7, align 8
|
||||
%11 = extractvalue { ptr, ptr } %10, 1
|
||||
%12 = extractvalue { ptr, ptr } %10, 0
|
||||
call void %12(ptr %11)
|
||||
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 16)
|
||||
%3 = alloca { ptr, ptr }, align 8
|
||||
%4 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 0
|
||||
store ptr @"__llgo_stub.main.main$2", ptr %4, align 8
|
||||
%5 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 1
|
||||
store ptr null, ptr %5, align 8
|
||||
%6 = load { ptr, ptr }, ptr %3, align 8
|
||||
store { ptr, ptr } %6, ptr %2, align 8
|
||||
%7 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8)
|
||||
%8 = getelementptr inbounds { ptr }, ptr %7, i32 0, i32 0
|
||||
store ptr %2, ptr %8, align 8
|
||||
%9 = alloca { ptr, ptr }, align 8
|
||||
%10 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 0
|
||||
store ptr @"main.main$3", ptr %10, align 8
|
||||
%11 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 1
|
||||
store ptr %7, ptr %11, align 8
|
||||
%12 = load { ptr, ptr }, ptr %9, align 8
|
||||
%13 = extractvalue { ptr, ptr } %12, 1
|
||||
%14 = extractvalue { ptr, ptr } %12, 0
|
||||
call void %14(ptr %13)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@0 = private unnamed_addr constant [1 x i8] zeroinitializer, 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
|
||||
@@ -60,28 +62,30 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 48)
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %0, i64 0
|
||||
%2 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @1, i64 5)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %2, ptr %1, align 8
|
||||
%3 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %0, i64 1
|
||||
%4 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @2, i64 1)
|
||||
%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)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %4, ptr %3, align 8
|
||||
%5 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %0, i64 2
|
||||
%6 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @3, i64 5)
|
||||
%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)
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" %6, ptr %5, align 8
|
||||
%7 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %0, i64 16, i64 3, i64 0, i64 3, i64 3)
|
||||
%8 = call %"github.com/goplus/llgo/internal/runtime.String" @main.concat(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%9 = load ptr, ptr @__stderrp, align 8
|
||||
%10 = call i64 @"github.com/goplus/llgo/internal/runtime.StringLen"(%"github.com/goplus/llgo/internal/runtime.String" %8)
|
||||
%11 = add i64 %10, 1
|
||||
%12 = alloca i8, i64 %11, align 1
|
||||
%13 = call ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr %12, %"github.com/goplus/llgo/internal/runtime.String" %8)
|
||||
%14 = call i32 (ptr, ptr, ...) @fprintf(ptr %9, ptr @4, ptr %13)
|
||||
%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)
|
||||
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)
|
||||
%11 = load ptr, ptr @__stderrp, align 8
|
||||
%12 = call i64 @"github.com/goplus/llgo/internal/runtime.StringLen"(%"github.com/goplus/llgo/internal/runtime.String" %10)
|
||||
%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)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [14 x i8] c"Hello, world\0A\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
@@ -17,8 +19,10 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
call void (ptr, ...) @printf(ptr @0)
|
||||
|
||||
@@ -4,6 +4,8 @@ source_filename = "main"
|
||||
@_bar_x = external global ptr
|
||||
@_bar_y = external global ptr
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
@@ -18,12 +20,14 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = load { [16 x i8], [2 x ptr] }, ptr @_bar_x, align 8
|
||||
%1 = load { [16 x i8] }, ptr @_bar_y, align 1
|
||||
%2 = load { [16 x i8], [2 x ptr] }, ptr @_bar_x, align 8
|
||||
%3 = load { [16 x i8] }, ptr @_bar_y, align 1
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__stderrp = external global ptr
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [10 x i8] c"Hello %d\0A\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
@@ -18,12 +20,14 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = load ptr, ptr @__stderrp, align 8
|
||||
call void (ptr, ptr, ...) @fprintf(ptr %0, ptr @0, i64 100)
|
||||
%2 = load ptr, ptr @__stderrp, align 8
|
||||
call void (ptr, ptr, ...) @fprintf(ptr %2, ptr @0, i64 100)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ source_filename = "main"
|
||||
@main.basicTypes = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@main.sizeBasicTypes = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [20 x i8] c"Kind: %d, Size: %d\0A\00", align 1
|
||||
|
||||
define ptr @main.Basic(i64 %0) {
|
||||
@@ -48,17 +50,19 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call ptr @main.Basic(i64 24)
|
||||
%1 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %0, i32 0, i32 6
|
||||
%2 = load i8, ptr %1, align 1
|
||||
%3 = sext i8 %2 to i64
|
||||
%4 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %0, i32 0, i32 0
|
||||
%5 = load i64, ptr %4, align 4
|
||||
%6 = call i32 (ptr, ...) @printf(ptr @0, i64 %3, i64 %5)
|
||||
%2 = call ptr @main.Basic(i64 24)
|
||||
%3 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %2, i32 0, i32 6
|
||||
%4 = load i8, ptr %3, align 1
|
||||
%5 = sext i8 %4 to i64
|
||||
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %2, i32 0, i32 0
|
||||
%7 = load i64, ptr %6, align 4
|
||||
%8 = call i32 (ptr, ...) @printf(ptr @0, i64 %5, i64 %7)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ source_filename = "main"
|
||||
%"github.com/goplus/llgo/internal/runtime.iface" = type { ptr, ptr }
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @main.foo(%"github.com/goplus/llgo/internal/runtime.iface" %0) {
|
||||
_llgo_0:
|
||||
@@ -23,8 +25,10 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
call void @main.foo(%"github.com/goplus/llgo/internal/runtime.iface" zeroinitializer)
|
||||
|
||||
@@ -3,6 +3,8 @@ source_filename = "main"
|
||||
|
||||
@main.format = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
@@ -27,12 +29,14 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call i32 @strlen(ptr @main.format)
|
||||
call void (ptr, ...) @printf(ptr @main.format, i32 %0)
|
||||
%2 = call i32 @strlen(ptr @main.format)
|
||||
call void (ptr, ...) @printf(ptr @main.format, i32 %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ 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 [7 x i8] c"%d %d\0A\00", align 1
|
||||
@1 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
|
||||
@2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
|
||||
@@ -27,103 +29,105 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = alloca %main.point, align 8
|
||||
%1 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %0, i64 16)
|
||||
%2 = alloca [3 x %main.point], align 8
|
||||
%3 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %2, i64 48)
|
||||
%4 = getelementptr inbounds %main.point, ptr %3, i64 0
|
||||
%5 = getelementptr inbounds %main.point, ptr %4, i32 0, i32 0
|
||||
%6 = getelementptr inbounds %main.point, ptr %4, i32 0, i32 1
|
||||
%7 = getelementptr inbounds %main.point, ptr %3, i64 1
|
||||
%8 = getelementptr inbounds %main.point, ptr %7, i32 0, i32 0
|
||||
%9 = getelementptr inbounds %main.point, ptr %7, i32 0, i32 1
|
||||
%10 = getelementptr inbounds %main.point, ptr %3, i64 2
|
||||
%11 = getelementptr inbounds %main.point, ptr %10, i32 0, i32 0
|
||||
%12 = getelementptr inbounds %main.point, ptr %10, i32 0, i32 1
|
||||
store i64 1, ptr %5, align 4
|
||||
store i64 2, ptr %6, align 4
|
||||
store i64 3, ptr %8, align 4
|
||||
store i64 4, ptr %9, align 4
|
||||
store i64 5, ptr %11, align 4
|
||||
store i64 6, ptr %12, align 4
|
||||
%13 = load [3 x %main.point], ptr %3, align 4
|
||||
%14 = getelementptr inbounds %main.point, ptr %3, i64 2
|
||||
%15 = load %main.point, ptr %14, align 4
|
||||
store %main.point %15, ptr %1, align 4
|
||||
%16 = getelementptr inbounds %main.point, ptr %1, i32 0, i32 0
|
||||
%17 = load i64, ptr %16, align 4
|
||||
%18 = getelementptr inbounds %main.point, ptr %1, i32 0, i32 1
|
||||
%2 = alloca %main.point, align 8
|
||||
%3 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %2, i64 16)
|
||||
%4 = alloca [3 x %main.point], align 8
|
||||
%5 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %4, i64 48)
|
||||
%6 = getelementptr inbounds %main.point, ptr %5, i64 0
|
||||
%7 = getelementptr inbounds %main.point, ptr %6, i32 0, i32 0
|
||||
%8 = getelementptr inbounds %main.point, ptr %6, i32 0, i32 1
|
||||
%9 = getelementptr inbounds %main.point, ptr %5, i64 1
|
||||
%10 = getelementptr inbounds %main.point, ptr %9, i32 0, i32 0
|
||||
%11 = getelementptr inbounds %main.point, ptr %9, i32 0, i32 1
|
||||
%12 = getelementptr inbounds %main.point, ptr %5, i64 2
|
||||
%13 = getelementptr inbounds %main.point, ptr %12, i32 0, i32 0
|
||||
%14 = getelementptr inbounds %main.point, ptr %12, i32 0, i32 1
|
||||
store i64 1, ptr %7, align 4
|
||||
store i64 2, ptr %8, align 4
|
||||
store i64 3, ptr %10, align 4
|
||||
store i64 4, ptr %11, align 4
|
||||
store i64 5, ptr %13, align 4
|
||||
store i64 6, ptr %14, align 4
|
||||
%15 = load [3 x %main.point], ptr %5, align 4
|
||||
%16 = getelementptr inbounds %main.point, ptr %5, i64 2
|
||||
%17 = load %main.point, ptr %16, align 4
|
||||
store %main.point %17, ptr %3, align 4
|
||||
%18 = getelementptr inbounds %main.point, ptr %3, i32 0, i32 0
|
||||
%19 = load i64, ptr %18, align 4
|
||||
%20 = call i32 (ptr, ...) @printf(ptr @0, i64 %17, i64 %19)
|
||||
%21 = alloca [2 x i64], align 8
|
||||
%22 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %21, i64 16)
|
||||
%23 = alloca [2 x [2 x i64]], align 8
|
||||
%24 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %23, i64 32)
|
||||
%25 = getelementptr inbounds [2 x i64], ptr %24, i64 0
|
||||
%26 = getelementptr inbounds i64, ptr %25, i64 0
|
||||
%27 = getelementptr inbounds i64, ptr %25, i64 1
|
||||
%28 = getelementptr inbounds [2 x i64], ptr %24, i64 1
|
||||
%29 = getelementptr inbounds i64, ptr %28, i64 0
|
||||
%30 = getelementptr inbounds i64, ptr %28, i64 1
|
||||
store i64 1, ptr %26, align 4
|
||||
store i64 2, ptr %27, align 4
|
||||
store i64 3, ptr %29, align 4
|
||||
store i64 4, ptr %30, align 4
|
||||
%31 = load [2 x [2 x i64]], ptr %24, align 4
|
||||
%32 = getelementptr inbounds [2 x i64], ptr %24, i64 1
|
||||
%33 = load [2 x i64], ptr %32, align 4
|
||||
store [2 x i64] %33, ptr %22, align 4
|
||||
%34 = getelementptr inbounds i64, ptr %22, i64 0
|
||||
%35 = load i64, ptr %34, align 4
|
||||
%36 = getelementptr inbounds i64, ptr %22, i64 1
|
||||
%20 = getelementptr inbounds %main.point, ptr %3, i32 0, i32 1
|
||||
%21 = load i64, ptr %20, align 4
|
||||
%22 = call i32 (ptr, ...) @printf(ptr @0, i64 %19, i64 %21)
|
||||
%23 = alloca [2 x i64], align 8
|
||||
%24 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %23, i64 16)
|
||||
%25 = alloca [2 x [2 x i64]], align 8
|
||||
%26 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %25, i64 32)
|
||||
%27 = getelementptr inbounds [2 x i64], ptr %26, i64 0
|
||||
%28 = getelementptr inbounds i64, ptr %27, i64 0
|
||||
%29 = getelementptr inbounds i64, ptr %27, i64 1
|
||||
%30 = getelementptr inbounds [2 x i64], ptr %26, i64 1
|
||||
%31 = getelementptr inbounds i64, ptr %30, i64 0
|
||||
%32 = getelementptr inbounds i64, ptr %30, i64 1
|
||||
store i64 1, ptr %28, align 4
|
||||
store i64 2, ptr %29, align 4
|
||||
store i64 3, ptr %31, align 4
|
||||
store i64 4, ptr %32, align 4
|
||||
%33 = load [2 x [2 x i64]], ptr %26, align 4
|
||||
%34 = getelementptr inbounds [2 x i64], ptr %26, i64 1
|
||||
%35 = load [2 x i64], ptr %34, align 4
|
||||
store [2 x i64] %35, ptr %24, align 4
|
||||
%36 = getelementptr inbounds i64, ptr %24, i64 0
|
||||
%37 = load i64, ptr %36, align 4
|
||||
%38 = call i32 (ptr, ...) @printf(ptr @1, i64 %35, i64 %37)
|
||||
%39 = alloca [5 x i64], align 8
|
||||
%40 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %39, i64 40)
|
||||
%41 = getelementptr inbounds i64, ptr %40, i64 0
|
||||
%42 = getelementptr inbounds i64, ptr %40, i64 1
|
||||
%43 = getelementptr inbounds i64, ptr %40, i64 2
|
||||
%44 = getelementptr inbounds i64, ptr %40, i64 3
|
||||
%45 = getelementptr inbounds i64, ptr %40, i64 4
|
||||
store i64 1, ptr %41, align 4
|
||||
store i64 2, ptr %42, align 4
|
||||
store i64 3, ptr %43, align 4
|
||||
store i64 4, ptr %44, align 4
|
||||
store i64 5, ptr %45, align 4
|
||||
%46 = load [5 x i64], ptr %40, align 4
|
||||
%47 = getelementptr inbounds i64, ptr %40, i64 2
|
||||
%48 = load i64, ptr %47, align 4
|
||||
%49 = call i32 (ptr, ...) @printf(ptr @2, i64 %48)
|
||||
%50 = alloca [5 x i64], align 8
|
||||
%51 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %50, i64 40)
|
||||
%52 = getelementptr inbounds i64, ptr %51, i64 0
|
||||
%53 = getelementptr inbounds i64, ptr %51, i64 1
|
||||
%54 = getelementptr inbounds i64, ptr %51, i64 2
|
||||
%55 = getelementptr inbounds i64, ptr %51, i64 3
|
||||
%56 = getelementptr inbounds i64, ptr %51, i64 4
|
||||
store i64 1, ptr %52, align 4
|
||||
store i64 2, ptr %53, align 4
|
||||
store i64 3, ptr %54, align 4
|
||||
store i64 4, ptr %55, align 4
|
||||
store i64 5, ptr %56, align 4
|
||||
%57 = load [5 x i64], ptr %51, align 4
|
||||
%58 = getelementptr inbounds i64, ptr %51, i64 2
|
||||
%59 = load i64, ptr %58, align 4
|
||||
%60 = call i32 (ptr, ...) @printf(ptr @3, i64 %59)
|
||||
%61 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @5, i64 6)
|
||||
%62 = call ptr @"github.com/goplus/llgo/internal/runtime.StringData"(%"github.com/goplus/llgo/internal/runtime.String" %61)
|
||||
%63 = getelementptr inbounds i8, ptr %62, i64 2
|
||||
%64 = load i8, ptr %63, align 1
|
||||
%65 = call i32 (ptr, ...) @printf(ptr @4, i8 %64)
|
||||
%66 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @7, i64 6)
|
||||
%67 = call ptr @"github.com/goplus/llgo/internal/runtime.StringData"(%"github.com/goplus/llgo/internal/runtime.String" %66)
|
||||
%68 = getelementptr inbounds i8, ptr %67, i64 1
|
||||
%69 = load i8, ptr %68, align 1
|
||||
%70 = call i32 (ptr, ...) @printf(ptr @6, i8 %69)
|
||||
%38 = getelementptr inbounds i64, ptr %24, i64 1
|
||||
%39 = load i64, ptr %38, align 4
|
||||
%40 = call i32 (ptr, ...) @printf(ptr @1, i64 %37, i64 %39)
|
||||
%41 = alloca [5 x i64], align 8
|
||||
%42 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %41, i64 40)
|
||||
%43 = getelementptr inbounds i64, ptr %42, i64 0
|
||||
%44 = getelementptr inbounds i64, ptr %42, i64 1
|
||||
%45 = getelementptr inbounds i64, ptr %42, i64 2
|
||||
%46 = getelementptr inbounds i64, ptr %42, i64 3
|
||||
%47 = getelementptr inbounds i64, ptr %42, i64 4
|
||||
store i64 1, ptr %43, align 4
|
||||
store i64 2, ptr %44, align 4
|
||||
store i64 3, ptr %45, align 4
|
||||
store i64 4, ptr %46, align 4
|
||||
store i64 5, ptr %47, align 4
|
||||
%48 = load [5 x i64], ptr %42, align 4
|
||||
%49 = getelementptr inbounds i64, ptr %42, i64 2
|
||||
%50 = load i64, ptr %49, align 4
|
||||
%51 = call i32 (ptr, ...) @printf(ptr @2, i64 %50)
|
||||
%52 = alloca [5 x i64], align 8
|
||||
%53 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %52, i64 40)
|
||||
%54 = getelementptr inbounds i64, ptr %53, i64 0
|
||||
%55 = getelementptr inbounds i64, ptr %53, i64 1
|
||||
%56 = getelementptr inbounds i64, ptr %53, i64 2
|
||||
%57 = getelementptr inbounds i64, ptr %53, i64 3
|
||||
%58 = getelementptr inbounds i64, ptr %53, i64 4
|
||||
store i64 1, ptr %54, align 4
|
||||
store i64 2, ptr %55, align 4
|
||||
store i64 3, ptr %56, align 4
|
||||
store i64 4, ptr %57, align 4
|
||||
store i64 5, ptr %58, align 4
|
||||
%59 = load [5 x i64], ptr %53, align 4
|
||||
%60 = getelementptr inbounds i64, ptr %53, i64 2
|
||||
%61 = load i64, ptr %60, align 4
|
||||
%62 = call i32 (ptr, ...) @printf(ptr @3, i64 %61)
|
||||
%63 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @5, i64 6)
|
||||
%64 = call ptr @"github.com/goplus/llgo/internal/runtime.StringData"(%"github.com/goplus/llgo/internal/runtime.String" %63)
|
||||
%65 = getelementptr inbounds i8, ptr %64, i64 2
|
||||
%66 = load i8, ptr %65, align 1
|
||||
%67 = call i32 (ptr, ...) @printf(ptr @4, i8 %66)
|
||||
%68 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @7, i64 6)
|
||||
%69 = call ptr @"github.com/goplus/llgo/internal/runtime.StringData"(%"github.com/goplus/llgo/internal/runtime.String" %68)
|
||||
%70 = getelementptr inbounds i8, ptr %69, i64 1
|
||||
%71 = load i8, ptr %70, align 1
|
||||
%72 = call i32 (ptr, ...) @printf(ptr @6, i8 %71)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ source_filename = "main"
|
||||
%main.generator = type { i32 }
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
|
||||
@1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
|
||||
@2 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
|
||||
@@ -61,90 +63,92 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = alloca { ptr, ptr }, align 8
|
||||
%1 = getelementptr inbounds { ptr, ptr }, ptr %0, i32 0, i32 0
|
||||
store ptr @__llgo_stub.rand, ptr %1, align 8
|
||||
%2 = getelementptr inbounds { ptr, ptr }, ptr %0, i32 0, i32 1
|
||||
store ptr null, ptr %2, align 8
|
||||
%3 = load { ptr, ptr }, ptr %0, align 8
|
||||
%4 = call %"github.com/goplus/llgo/internal/runtime.Slice" @main.genInts(i64 5, { ptr, ptr } %3)
|
||||
%5 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %4)
|
||||
%2 = alloca { ptr, ptr }, align 8
|
||||
%3 = getelementptr inbounds { ptr, ptr }, ptr %2, i32 0, i32 0
|
||||
store ptr @__llgo_stub.rand, ptr %3, align 8
|
||||
%4 = getelementptr inbounds { ptr, ptr }, ptr %2, i32 0, i32 1
|
||||
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)
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
%6 = phi i64 [ -1, %_llgo_0 ], [ %7, %_llgo_2 ]
|
||||
%7 = add i64 %6, 1
|
||||
%8 = icmp slt i64 %7, %5
|
||||
br i1 %8, label %_llgo_2, label %_llgo_3
|
||||
%8 = phi i64 [ -1, %_llgo_0 ], [ %9, %_llgo_2 ]
|
||||
%9 = add i64 %8, 1
|
||||
%10 = icmp slt i64 %9, %7
|
||||
br i1 %10, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1
|
||||
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %4)
|
||||
%10 = getelementptr inbounds i32, ptr %9, i64 %7
|
||||
%11 = load i32, ptr %10, align 4
|
||||
%12 = call i32 (ptr, ...) @printf(ptr @0, i32 %11)
|
||||
%11 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %6)
|
||||
%12 = getelementptr inbounds i32, ptr %11, i64 %9
|
||||
%13 = load i32, ptr %12, align 4
|
||||
%14 = call i32 (ptr, ...) @printf(ptr @0, i32 %13)
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_3: ; preds = %_llgo_1
|
||||
%13 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 4)
|
||||
store i32 1, ptr %13, align 4
|
||||
%14 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8)
|
||||
%15 = getelementptr inbounds { ptr }, ptr %14, i32 0, i32 0
|
||||
store ptr %13, ptr %15, align 8
|
||||
%16 = alloca { ptr, ptr }, align 8
|
||||
%17 = getelementptr inbounds { ptr, ptr }, ptr %16, i32 0, i32 0
|
||||
store ptr @"main.main$1", ptr %17, align 8
|
||||
%18 = getelementptr inbounds { ptr, ptr }, ptr %16, i32 0, i32 1
|
||||
store ptr %14, ptr %18, align 8
|
||||
%19 = load { ptr, ptr }, ptr %16, align 8
|
||||
%20 = call %"github.com/goplus/llgo/internal/runtime.Slice" @main.genInts(i64 5, { ptr, ptr } %19)
|
||||
%21 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %20)
|
||||
%15 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 4)
|
||||
store i32 1, ptr %15, align 4
|
||||
%16 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8)
|
||||
%17 = getelementptr inbounds { ptr }, ptr %16, i32 0, i32 0
|
||||
store ptr %15, ptr %17, align 8
|
||||
%18 = alloca { ptr, ptr }, align 8
|
||||
%19 = getelementptr inbounds { ptr, ptr }, ptr %18, i32 0, i32 0
|
||||
store ptr @"main.main$1", ptr %19, align 8
|
||||
%20 = getelementptr inbounds { ptr, ptr }, ptr %18, i32 0, i32 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)
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_4: ; preds = %_llgo_5, %_llgo_3
|
||||
%22 = phi i64 [ -1, %_llgo_3 ], [ %23, %_llgo_5 ]
|
||||
%23 = add i64 %22, 1
|
||||
%24 = icmp slt i64 %23, %21
|
||||
br i1 %24, label %_llgo_5, label %_llgo_6
|
||||
%24 = phi i64 [ -1, %_llgo_3 ], [ %25, %_llgo_5 ]
|
||||
%25 = add i64 %24, 1
|
||||
%26 = icmp slt i64 %25, %23
|
||||
br i1 %26, label %_llgo_5, label %_llgo_6
|
||||
|
||||
_llgo_5: ; preds = %_llgo_4
|
||||
%25 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %20)
|
||||
%26 = getelementptr inbounds i32, ptr %25, i64 %23
|
||||
%27 = load i32, ptr %26, align 4
|
||||
%28 = call i32 (ptr, ...) @printf(ptr @1, i32 %27)
|
||||
%27 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %22)
|
||||
%28 = getelementptr inbounds i32, ptr %27, i64 %25
|
||||
%29 = load i32, ptr %28, align 4
|
||||
%30 = call i32 (ptr, ...) @printf(ptr @1, i32 %29)
|
||||
br label %_llgo_4
|
||||
|
||||
_llgo_6: ; preds = %_llgo_4
|
||||
%29 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 4)
|
||||
%30 = getelementptr inbounds %main.generator, ptr %29, i32 0, i32 0
|
||||
store i32 1, ptr %30, align 4
|
||||
%31 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8)
|
||||
%32 = getelementptr inbounds { ptr }, ptr %31, i32 0, i32 0
|
||||
store ptr %29, ptr %32, align 8
|
||||
%33 = alloca { ptr, ptr }, align 8
|
||||
%34 = getelementptr inbounds { ptr, ptr }, ptr %33, i32 0, i32 0
|
||||
store ptr @"main.next$bound", ptr %34, align 8
|
||||
%35 = getelementptr inbounds { ptr, ptr }, ptr %33, i32 0, i32 1
|
||||
store ptr %31, ptr %35, align 8
|
||||
%36 = load { ptr, ptr }, ptr %33, align 8
|
||||
%37 = call %"github.com/goplus/llgo/internal/runtime.Slice" @main.genInts(i64 5, { ptr, ptr } %36)
|
||||
%38 = call i64 @"github.com/goplus/llgo/internal/runtime.SliceLen"(%"github.com/goplus/llgo/internal/runtime.Slice" %37)
|
||||
%31 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 4)
|
||||
%32 = getelementptr inbounds %main.generator, ptr %31, i32 0, i32 0
|
||||
store i32 1, ptr %32, align 4
|
||||
%33 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8)
|
||||
%34 = getelementptr inbounds { ptr }, ptr %33, i32 0, i32 0
|
||||
store ptr %31, ptr %34, align 8
|
||||
%35 = alloca { ptr, ptr }, align 8
|
||||
%36 = getelementptr inbounds { ptr, ptr }, ptr %35, i32 0, i32 0
|
||||
store ptr @"main.next$bound", ptr %36, align 8
|
||||
%37 = getelementptr inbounds { ptr, ptr }, ptr %35, i32 0, i32 1
|
||||
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)
|
||||
br label %_llgo_7
|
||||
|
||||
_llgo_7: ; preds = %_llgo_8, %_llgo_6
|
||||
%39 = phi i64 [ -1, %_llgo_6 ], [ %40, %_llgo_8 ]
|
||||
%40 = add i64 %39, 1
|
||||
%41 = icmp slt i64 %40, %38
|
||||
br i1 %41, label %_llgo_8, label %_llgo_9
|
||||
%41 = phi i64 [ -1, %_llgo_6 ], [ %42, %_llgo_8 ]
|
||||
%42 = add i64 %41, 1
|
||||
%43 = icmp slt i64 %42, %40
|
||||
br i1 %43, label %_llgo_8, label %_llgo_9
|
||||
|
||||
_llgo_8: ; preds = %_llgo_7
|
||||
%42 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %37)
|
||||
%43 = getelementptr inbounds i32, ptr %42, i64 %40
|
||||
%44 = load i32, ptr %43, align 4
|
||||
%45 = call i32 (ptr, ...) @printf(ptr @2, i32 %44)
|
||||
%44 = call ptr @"github.com/goplus/llgo/internal/runtime.SliceData"(%"github.com/goplus/llgo/internal/runtime.Slice" %39)
|
||||
%45 = getelementptr inbounds i32, ptr %44, i64 %42
|
||||
%46 = load i32, ptr %45, align 4
|
||||
%47 = call i32 (ptr, ...) @printf(ptr @2, i32 %46)
|
||||
br label %_llgo_7
|
||||
|
||||
_llgo_9: ; preds = %_llgo_7
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
source_filename = "main"
|
||||
|
||||
@"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"a\00", align 1
|
||||
@1 = private unnamed_addr constant [2 x i8] c"b\00", align 1
|
||||
@2 = private unnamed_addr constant [2 x i8] c"c\00", align 1
|
||||
@@ -24,8 +26,10 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
call void @"github.com/goplus/llgo/cl/internal/linktarget.F"(ptr @0, ptr @1, ptr @2, ptr @3)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [10 x i8] c"Hello %d\0A\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
@@ -17,12 +19,14 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call ptr @"github.com/goplus/llgo/internal/runtime.MakeSmallMap"()
|
||||
%1 = call i32 (ptr, ...) @printf(ptr @0, <null operand!>)
|
||||
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.MakeSmallMap"()
|
||||
%3 = call i32 (ptr, ...) @printf(ptr @0, <null operand!>)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ source_filename = "main"
|
||||
%"github.com/goplus/llgo/internal/runtime.iface" = type { ptr, ptr }
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [14 x i8] c"panic message\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
@@ -20,13 +22,15 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 13)
|
||||
%1 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %0)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %1)
|
||||
%2 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 13)
|
||||
%3 = call %"github.com/goplus/llgo/internal/runtime.iface" @"github.com/goplus/llgo/internal/runtime.MakeAnyString"(%"github.com/goplus/llgo/internal/runtime.String" %2)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.iface" %3)
|
||||
unreachable
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
@@ -17,36 +19,38 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 40)
|
||||
%1 = getelementptr inbounds i64, ptr %0, i64 0
|
||||
%2 = getelementptr inbounds i64, ptr %0, i64 1
|
||||
%3 = getelementptr inbounds i64, ptr %0, i64 2
|
||||
%4 = getelementptr inbounds i64, ptr %0, i64 3
|
||||
%5 = getelementptr inbounds i64, ptr %0, i64 4
|
||||
store i64 100, ptr %1, align 4
|
||||
store i64 8, ptr %2, align 4
|
||||
store i64 23, ptr %3, align 4
|
||||
store i64 2, ptr %4, align 4
|
||||
store i64 7, ptr %5, align 4
|
||||
%6 = getelementptr inbounds i64, ptr %0, i64 0
|
||||
call void @qsort(ptr %6, i64 5, i64 8, ptr @"main.main$1")
|
||||
%7 = load [5 x i64], ptr %0, align 4
|
||||
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 40)
|
||||
%3 = getelementptr inbounds i64, ptr %2, i64 0
|
||||
%4 = getelementptr inbounds i64, ptr %2, i64 1
|
||||
%5 = getelementptr inbounds i64, ptr %2, i64 2
|
||||
%6 = getelementptr inbounds i64, ptr %2, i64 3
|
||||
%7 = getelementptr inbounds i64, ptr %2, i64 4
|
||||
store i64 100, ptr %3, align 4
|
||||
store i64 8, ptr %4, align 4
|
||||
store i64 23, ptr %5, align 4
|
||||
store i64 2, ptr %6, align 4
|
||||
store i64 7, ptr %7, align 4
|
||||
%8 = getelementptr inbounds i64, ptr %2, i64 0
|
||||
call void @qsort(ptr %8, i64 5, i64 8, ptr @"main.main$1")
|
||||
%9 = load [5 x i64], ptr %2, align 4
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_1: ; preds = %_llgo_2, %_llgo_0
|
||||
%8 = phi i64 [ -1, %_llgo_0 ], [ %9, %_llgo_2 ]
|
||||
%9 = add i64 %8, 1
|
||||
%10 = icmp slt i64 %9, 5
|
||||
br i1 %10, label %_llgo_2, label %_llgo_3
|
||||
%10 = phi i64 [ -1, %_llgo_0 ], [ %11, %_llgo_2 ]
|
||||
%11 = add i64 %10, 1
|
||||
%12 = icmp slt i64 %11, 5
|
||||
br i1 %12, label %_llgo_2, label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_1
|
||||
%11 = getelementptr inbounds i64, ptr %0, i64 %9
|
||||
%12 = load i64, ptr %11, align 4
|
||||
%13 = call i32 (ptr, ...) @printf(ptr @0, i64 %12)
|
||||
%13 = getelementptr inbounds i64, ptr %2, i64 %11
|
||||
%14 = load i64, ptr %13, align 4
|
||||
%15 = call i32 (ptr, ...) @printf(ptr @0, i64 %14)
|
||||
br label %_llgo_1
|
||||
|
||||
_llgo_3: ; preds = %_llgo_1
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
|
||||
@1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
|
||||
@2 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1
|
||||
@@ -43,28 +45,30 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call { ptr, ptr } @"main.main$1"()
|
||||
%1 = extractvalue { ptr, ptr } %0, 1
|
||||
%2 = extractvalue { ptr, ptr } %0, 0
|
||||
%3 = call i64 %2(ptr %1, i64 100, i64 200)
|
||||
%4 = call i32 (ptr, ...) @printf(ptr @0, i64 %3)
|
||||
%5 = call { ptr, ptr } @main.add()
|
||||
%6 = extractvalue { ptr, ptr } %5, 1
|
||||
%7 = extractvalue { ptr, ptr } %5, 0
|
||||
%8 = call i64 %7(ptr %6, i64 100, i64 200)
|
||||
%9 = call i32 (ptr, ...) @printf(ptr @1, i64 %8)
|
||||
%10 = call { { ptr, ptr }, i64 } @main.add2()
|
||||
%11 = extractvalue { { ptr, ptr }, i64 } %10, 0
|
||||
%12 = extractvalue { { ptr, ptr }, i64 } %10, 1
|
||||
%13 = call { ptr, ptr } @main.add()
|
||||
%14 = extractvalue { ptr, ptr } %13, 1
|
||||
%15 = extractvalue { ptr, ptr } %13, 0
|
||||
%16 = call i64 %15(ptr %14, i64 100, i64 200)
|
||||
%17 = call i32 (ptr, ...) @printf(ptr @2, i64 %16, i64 %12)
|
||||
%2 = call { ptr, ptr } @"main.main$1"()
|
||||
%3 = extractvalue { ptr, ptr } %2, 1
|
||||
%4 = extractvalue { ptr, ptr } %2, 0
|
||||
%5 = call i64 %4(ptr %3, i64 100, i64 200)
|
||||
%6 = call i32 (ptr, ...) @printf(ptr @0, i64 %5)
|
||||
%7 = call { ptr, ptr } @main.add()
|
||||
%8 = extractvalue { ptr, ptr } %7, 1
|
||||
%9 = extractvalue { ptr, ptr } %7, 0
|
||||
%10 = call i64 %9(ptr %8, i64 100, i64 200)
|
||||
%11 = call i32 (ptr, ...) @printf(ptr @1, i64 %10)
|
||||
%12 = call { { ptr, ptr }, i64 } @main.add2()
|
||||
%13 = extractvalue { { ptr, ptr }, i64 } %12, 0
|
||||
%14 = extractvalue { { ptr, ptr }, i64 } %12, 1
|
||||
%15 = call { ptr, ptr } @main.add()
|
||||
%16 = extractvalue { ptr, ptr } %15, 1
|
||||
%17 = extractvalue { ptr, ptr } %15, 0
|
||||
%18 = call i64 %17(ptr %16, i64 100, i64 200)
|
||||
%19 = call i32 (ptr, ...) @printf(ptr @2, i64 %18, i64 %14)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ source_filename = "main"
|
||||
|
||||
@main.format = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
@@ -27,12 +29,14 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call i32 @strlen(ptr @main.format)
|
||||
call void (ptr, ...) @printf(ptr @main.format, i32 %0)
|
||||
%2 = call i32 @strlen(ptr @main.format)
|
||||
call void (ptr, ...) @printf(ptr @main.format, i32 %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ source_filename = "main"
|
||||
|
||||
@main.format = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @"(main.Foo).Print"(%main.Foo %0) {
|
||||
_llgo_0:
|
||||
@@ -55,18 +57,20 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = alloca %main.Foo, align 8
|
||||
%1 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %0, i64 8)
|
||||
%2 = getelementptr inbounds %main.Foo, ptr %1, i32 0, i32 0
|
||||
%3 = getelementptr inbounds %main.Foo, ptr %1, i32 0, i32 1
|
||||
store i32 100, ptr %2, align 4
|
||||
store i1 true, ptr %3, align 1
|
||||
%4 = load %main.Foo, ptr %1, align 4
|
||||
call void @"(main.Foo).Print"(%main.Foo %4)
|
||||
%2 = alloca %main.Foo, align 8
|
||||
%3 = call ptr @"github.com/goplus/llgo/internal/runtime.Zeroinit"(ptr %2, i64 8)
|
||||
%4 = getelementptr inbounds %main.Foo, ptr %3, i32 0, i32 0
|
||||
%5 = getelementptr inbounds %main.Foo, ptr %3, i32 0, i32 1
|
||||
store i32 100, ptr %4, align 4
|
||||
store i1 true, ptr %5, align 1
|
||||
%6 = load %main.Foo, ptr %3, align 4
|
||||
call void @"(main.Foo).Print"(%main.Foo %6)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ source_filename = "main"
|
||||
%"github.com/goplus/llgo/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [10 x i8] c"Hello %d\0A\00", align 1
|
||||
|
||||
define void @main.init() {
|
||||
@@ -19,22 +21,24 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
||||
%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 = getelementptr inbounds i64, ptr %0, i64 3
|
||||
store i64 4, ptr %4, align 4
|
||||
%5 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %0, i64 8, i64 4, i64 0, i64 4, i64 4)
|
||||
%6 = call i64 @main.sum(%"github.com/goplus/llgo/internal/runtime.Slice" %5)
|
||||
%7 = call i32 (ptr, ...) @printf(ptr @0, i64 %6)
|
||||
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
|
||||
%3 = getelementptr inbounds i64, ptr %2, i64 0
|
||||
store i64 1, ptr %3, align 4
|
||||
%4 = getelementptr inbounds i64, ptr %2, i64 1
|
||||
store i64 2, ptr %4, align 4
|
||||
%5 = getelementptr inbounds i64, ptr %2, i64 2
|
||||
store i64 3, ptr %5, align 4
|
||||
%6 = getelementptr inbounds i64, ptr %2, i64 3
|
||||
store i64 4, ptr %6, align 4
|
||||
%7 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %2, i64 8, i64 4, i64 0, i64 4, i64 4)
|
||||
%8 = call i64 @main.sum(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
|
||||
%9 = call i32 (ptr, ...) @printf(ptr @0, i64 %8)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ source_filename = "main"
|
||||
|
||||
@main.format = global ptr null
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
|
||||
define void @main.Print(ptr %0) {
|
||||
_llgo_0:
|
||||
@@ -43,16 +45,18 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
%0 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 8)
|
||||
%1 = getelementptr inbounds { i32, i1 }, ptr %0, i32 0, i32 0
|
||||
%2 = getelementptr inbounds { i32, i1 }, ptr %0, i32 0, i32 1
|
||||
store i32 100, ptr %1, align 4
|
||||
store i1 true, ptr %2, align 1
|
||||
call void @main.Print(ptr %0)
|
||||
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 8)
|
||||
%3 = getelementptr inbounds { i32, i1 }, ptr %2, i32 0, i32 0
|
||||
%4 = getelementptr inbounds { i32, i1 }, ptr %2, i32 0, i32 1
|
||||
store i32 100, ptr %3, align 4
|
||||
store i1 true, ptr %4, align 1
|
||||
call void @main.Print(ptr %2)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
source_filename = "main"
|
||||
|
||||
@"main.init$guard" = global ptr null
|
||||
@__llgo_argc = global ptr null
|
||||
@__llgo_argv = global ptr null
|
||||
@0 = private unnamed_addr constant [7 x i8] c"Hello\0A\00", align 1
|
||||
|
||||
define void @main.foo() {
|
||||
@@ -23,12 +25,14 @@ _llgo_2: ; preds = %_llgo_1, %_llgo_0
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @main() {
|
||||
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()
|
||||
call void @main.foo()
|
||||
%0 = call i32 (ptr, ...) @printf(ptr @0)
|
||||
%2 = call i32 (ptr, ...) @printf(ptr @0)
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
@@ -201,6 +201,10 @@ func makeClosureCtx(pkg *types.Package, vars []*ssa.FreeVar) *types.Var {
|
||||
return types.NewParam(token.NoPos, pkg, "__llgo_ctx", t)
|
||||
}
|
||||
|
||||
var (
|
||||
argvTy = types.NewPointer(types.NewPointer(types.Typ[types.Int8]))
|
||||
)
|
||||
|
||||
func (p *context) compileFuncDecl(pkg llssa.Package, pkgTypes *types.Package, f *ssa.Function) llssa.Function {
|
||||
name, ftype := p.funcName(pkgTypes, f, true)
|
||||
if ftype != goFunc {
|
||||
@@ -225,6 +229,12 @@ func (p *context) compileFuncDecl(pkg llssa.Package, pkgTypes *types.Package, f
|
||||
}
|
||||
}
|
||||
if fn == nil {
|
||||
if name == "main" {
|
||||
argc := types.NewParam(token.NoPos, pkgTypes, "", types.Typ[types.Int32])
|
||||
argv := types.NewParam(token.NoPos, pkgTypes, "", argvTy)
|
||||
params := types.NewTuple(argc, argv)
|
||||
sig = types.NewSignatureType(nil, nil, nil, params, nil, false)
|
||||
}
|
||||
fn = pkg.NewFuncEx(name, sig, llssa.Background(ftype), hasCtx)
|
||||
}
|
||||
if nblk := len(f.Blocks); nblk > 0 {
|
||||
@@ -290,7 +300,15 @@ func (p *context) compileBlock(b llssa.Builder, block *ssa.BasicBlock, n int, do
|
||||
ret := p.fn.Block(block.Index)
|
||||
b.SetBlock(ret)
|
||||
if doInit {
|
||||
prog := p.prog
|
||||
pkg := p.pkg
|
||||
fn := p.fn
|
||||
argc := pkg.NewVar("__llgo_argc", types.NewPointer(types.Typ[types.Int32]), llssa.InC)
|
||||
argv := pkg.NewVar("__llgo_argv", types.NewPointer(argvTy), llssa.InC)
|
||||
argc.Init(prog.Null(argc.Type))
|
||||
argv.Init(prog.Null(argv.Type))
|
||||
b.Store(argc.Expr, fn.Param(0))
|
||||
b.Store(argv.Expr, fn.Param(1))
|
||||
callRuntimeInit(b, pkg)
|
||||
b.Call(pkg.FuncOf("main.init").Expr)
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ type Transformer struct {
|
||||
}
|
||||
|
||||
//go:linkname BuildTransformer C.build_transformer
|
||||
func BuildTransformer(t *Transformer, checkpoint_path *Char)
|
||||
func BuildTransformer(t *Transformer, checkpointPath *Char)
|
||||
|
||||
//go:linkname FreeTransformer C.free_transformer
|
||||
func FreeTransformer(t *Transformer)
|
||||
|
||||
Reference in New Issue
Block a user