ssa: fix ssa.go for builtin
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
func main() {
|
||||
done := false
|
||||
go println("hello")
|
||||
go func(s string) {
|
||||
println(s)
|
||||
done = true
|
||||
|
||||
@@ -6,8 +6,9 @@ source_filename = "main"
|
||||
@"main.init$guard" = global i1 false, align 1
|
||||
@__llgo_argc = global i32 0, align 4
|
||||
@__llgo_argv = global ptr null, align 8
|
||||
@0 = private unnamed_addr constant [16 x i8] c"Hello, goroutine", align 1
|
||||
@1 = private unnamed_addr constant [1 x i8] c".", align 1
|
||||
@0 = private unnamed_addr constant [5 x i8] c"hello", align 1
|
||||
@1 = private unnamed_addr constant [16 x i8] c"Hello, goroutine", align 1
|
||||
@2 = private unnamed_addr constant [1 x i8] c".", align 1
|
||||
|
||||
define void @main.init() {
|
||||
_llgo_0:
|
||||
@@ -30,29 +31,34 @@ _llgo_0:
|
||||
call void @main.init()
|
||||
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 1)
|
||||
store i1 false, ptr %2, align 1
|
||||
%3 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 8)
|
||||
%4 = getelementptr inbounds { ptr }, ptr %3, i32 0, i32 0
|
||||
store ptr %2, ptr %4, align 8
|
||||
%5 = insertvalue { ptr, ptr } { ptr @"main.main$1", ptr undef }, ptr %3, 1
|
||||
%6 = call ptr @malloc(i64 32)
|
||||
%7 = getelementptr inbounds { { ptr, ptr }, %"github.com/goplus/llgo/internal/runtime.String" }, ptr %6, i32 0, i32 0
|
||||
store { ptr, ptr } %5, ptr %7, align 8
|
||||
%8 = getelementptr inbounds { { ptr, ptr }, %"github.com/goplus/llgo/internal/runtime.String" }, ptr %6, i32 0, i32 1
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" { ptr @0, i64 16 }, ptr %8, align 8
|
||||
%9 = alloca i8, i64 8, align 1
|
||||
%10 = call i32 @"github.com/goplus/llgo/internal/runtime.CreateThread"(ptr %9, ptr null, ptr @"main._llgo_routine$1", ptr %6)
|
||||
%3 = call ptr @malloc(i64 16)
|
||||
%4 = getelementptr inbounds { %"github.com/goplus/llgo/internal/runtime.String" }, ptr %3, i32 0, i32 0
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" { ptr @0, i64 5 }, ptr %4, align 8
|
||||
%5 = alloca i8, i64 8, align 1
|
||||
%6 = call i32 @"github.com/goplus/llgo/internal/runtime.CreateThread"(ptr %5, ptr null, ptr @"main._llgo_routine$1", ptr %3)
|
||||
%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 = insertvalue { ptr, ptr } { ptr @"main.main$1", ptr undef }, ptr %7, 1
|
||||
%10 = call ptr @malloc(i64 32)
|
||||
%11 = getelementptr inbounds { { ptr, ptr }, %"github.com/goplus/llgo/internal/runtime.String" }, ptr %10, i32 0, i32 0
|
||||
store { ptr, ptr } %9, ptr %11, align 8
|
||||
%12 = getelementptr inbounds { { ptr, ptr }, %"github.com/goplus/llgo/internal/runtime.String" }, ptr %10, i32 0, i32 1
|
||||
store %"github.com/goplus/llgo/internal/runtime.String" { ptr @1, i64 16 }, ptr %12, align 8
|
||||
%13 = alloca i8, i64 8, align 1
|
||||
%14 = call i32 @"github.com/goplus/llgo/internal/runtime.CreateThread"(ptr %13, ptr null, ptr @"main._llgo_routine$2", ptr %10)
|
||||
br label %_llgo_3
|
||||
|
||||
_llgo_1: ; preds = %_llgo_3
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" { ptr @1, i64 1 })
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" { ptr @2, i64 1 })
|
||||
br label %_llgo_3
|
||||
|
||||
_llgo_2: ; preds = %_llgo_3
|
||||
ret i32 0
|
||||
|
||||
_llgo_3: ; preds = %_llgo_1, %_llgo_0
|
||||
%11 = load i1, ptr %2, align 1
|
||||
br i1 %11, label %_llgo_2, label %_llgo_1
|
||||
%15 = load i1, ptr %2, align 1
|
||||
br i1 %15, label %_llgo_2, label %_llgo_1
|
||||
}
|
||||
|
||||
define void @"main.main$1"(ptr %0, %"github.com/goplus/llgo/internal/runtime.String" %1) {
|
||||
@@ -69,11 +75,29 @@ declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64)
|
||||
|
||||
declare ptr @malloc(i64)
|
||||
|
||||
define ptr @"main._llgo_routine$1"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load { %"github.com/goplus/llgo/internal/runtime.String" }, ptr %0, align 8
|
||||
%2 = extractvalue { %"github.com/goplus/llgo/internal/runtime.String" } %1, 0
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %2)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
||||
call void @free(ptr %0)
|
||||
ret ptr null
|
||||
}
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8)
|
||||
|
||||
declare void @free(ptr)
|
||||
|
||||
declare i32 @"github.com/goplus/llgo/internal/runtime.CreateThread"(ptr, ptr, ptr, ptr)
|
||||
|
||||
declare ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64)
|
||||
|
||||
define ptr @"main._llgo_routine$2"(ptr %0) {
|
||||
_llgo_0:
|
||||
%1 = load { { ptr, ptr }, %"github.com/goplus/llgo/internal/runtime.String" }, ptr %0, align 8
|
||||
%2 = extractvalue { { ptr, ptr }, %"github.com/goplus/llgo/internal/runtime.String" } %1, 0
|
||||
@@ -84,11 +108,3 @@ _llgo_0:
|
||||
call void @free(ptr %0)
|
||||
ret ptr null
|
||||
}
|
||||
|
||||
declare void @free(ptr)
|
||||
|
||||
declare i32 @"github.com/goplus/llgo/internal/runtime.CreateThread"(ptr, ptr, ptr, ptr)
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String")
|
||||
|
||||
declare void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8)
|
||||
|
||||
Reference in New Issue
Block a user