2024-06-02 15:24:42 +08:00
|
|
|
; ModuleID = 'main'
|
|
|
|
|
source_filename = "main"
|
|
|
|
|
|
|
|
|
|
%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 }
|
2024-06-03 01:06:01 +08:00
|
|
|
%"github.com/goplus/llgo/internal/runtime.Defer" = type { { ptr, ptr }, i64, ptr, i64 }
|
2024-06-02 15:24:42 +08:00
|
|
|
|
|
|
|
|
@"main.init$guard" = global ptr null
|
|
|
|
|
@__llgo_argc = global ptr null
|
|
|
|
|
@__llgo_argv = global ptr null
|
|
|
|
|
@__llgo_defer = linkonce global ptr null
|
2024-06-03 01:32:25 +08:00
|
|
|
@0 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
2024-06-02 15:24:42 +08:00
|
|
|
@1 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
2024-06-03 01:32:25 +08:00
|
|
|
@2 = private unnamed_addr constant [4 x i8] c"bye\00", align 1
|
|
|
|
|
@3 = private unnamed_addr constant [6 x i8] c"world\00", align 1
|
|
|
|
|
@4 = private unnamed_addr constant [3 x i8] c"hi\00", align 1
|
2024-06-02 15:24:42 +08:00
|
|
|
|
|
|
|
|
define i1 @main.f(%"github.com/goplus/llgo/internal/runtime.String" %0) {
|
|
|
|
|
_llgo_0:
|
|
|
|
|
%1 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %0, 1
|
|
|
|
|
%2 = icmp sgt i64 %1, 2
|
|
|
|
|
ret i1 %2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
define void @main.init() {
|
|
|
|
|
_llgo_0:
|
|
|
|
|
%0 = load i1, ptr @"main.init$guard", align 1
|
|
|
|
|
br i1 %0, label %_llgo_2, label %_llgo_1
|
|
|
|
|
|
|
|
|
|
_llgo_1: ; preds = %_llgo_0
|
|
|
|
|
store i1 true, ptr @"main.init$guard", align 1
|
2024-06-02 21:54:51 +08:00
|
|
|
call void @"main.init$after"()
|
2024-06-02 15:24:42 +08:00
|
|
|
br label %_llgo_2
|
|
|
|
|
|
|
|
|
|
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
|
|
|
|
ret void
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
define i32 @main(i32 %0, ptr %1) {
|
|
|
|
|
_llgo_0:
|
2024-06-02 21:54:51 +08:00
|
|
|
%2 = load ptr, ptr @__llgo_defer, align 8
|
|
|
|
|
%3 = call ptr @pthread_getspecific(ptr %2)
|
2024-06-03 01:06:01 +08:00
|
|
|
%4 = alloca i8, i64 40, align 1
|
2024-06-02 15:24:42 +08:00
|
|
|
%5 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Defer", ptr %4, i32 0, i32 0
|
2024-06-03 01:06:01 +08:00
|
|
|
store ptr null, ptr %5, align 8
|
2024-06-02 15:24:42 +08:00
|
|
|
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Defer", ptr %4, i32 0, i32 1
|
|
|
|
|
store i64 0, ptr %6, align 4
|
|
|
|
|
%7 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Defer", ptr %4, i32 0, i32 2
|
|
|
|
|
store ptr %3, ptr %7, align 8
|
2024-06-02 21:54:51 +08:00
|
|
|
%8 = call i32 @pthread_setspecific(ptr %2, ptr %4)
|
2024-06-03 09:56:39 +08:00
|
|
|
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()
|
2024-06-02 15:24:42 +08:00
|
|
|
%9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Defer", ptr %4, i32 0, i32 1
|
2024-06-03 01:06:01 +08:00
|
|
|
%10 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Defer", ptr %4, i32 0, i32 3
|
2024-06-05 15:10:35 +08:00
|
|
|
%11 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
|
|
|
|
%12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %11, i32 0, i32 0
|
|
|
|
|
store ptr @0, ptr %12, align 8
|
|
|
|
|
%13 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %11, i32 0, i32 1
|
|
|
|
|
store i64 5, ptr %13, align 4
|
|
|
|
|
%14 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %11, align 8
|
|
|
|
|
%15 = call i1 @main.f(%"github.com/goplus/llgo/internal/runtime.String" %14)
|
|
|
|
|
br i1 %15, label %_llgo_2, label %_llgo_3
|
2024-06-02 15:24:42 +08:00
|
|
|
|
|
|
|
|
_llgo_1: ; No predecessors!
|
|
|
|
|
ret i32 0
|
|
|
|
|
|
|
|
|
|
_llgo_2: ; preds = %_llgo_0
|
2024-06-05 15:10:35 +08:00
|
|
|
%16 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
|
|
|
|
%17 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %16, i32 0, i32 0
|
|
|
|
|
store ptr @1, ptr %17, align 8
|
|
|
|
|
%18 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %16, i32 0, i32 1
|
|
|
|
|
store i64 5, ptr %18, align 4
|
|
|
|
|
%19 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %16, align 8
|
|
|
|
|
%20 = load i64, ptr %9, align 4
|
|
|
|
|
%21 = or i64 %20, 1
|
|
|
|
|
store i64 %21, ptr %9, align 4
|
|
|
|
|
%22 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
|
|
|
|
%23 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %22, i32 0, i32 0
|
|
|
|
|
store ptr @2, ptr %23, align 8
|
|
|
|
|
%24 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %22, i32 0, i32 1
|
|
|
|
|
store i64 3, ptr %24, align 4
|
|
|
|
|
%25 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %22, align 8
|
|
|
|
|
%26 = load i64, ptr %9, align 4
|
|
|
|
|
%27 = or i64 %26, 2
|
|
|
|
|
store i64 %27, ptr %9, align 4
|
2024-06-03 01:06:01 +08:00
|
|
|
store i64 0, ptr %10, align 4
|
2024-06-03 01:32:25 +08:00
|
|
|
br label %_llgo_4
|
2024-06-02 15:24:42 +08:00
|
|
|
|
2024-06-03 01:32:25 +08:00
|
|
|
_llgo_3: ; preds = %_llgo_0
|
2024-06-05 15:10:35 +08:00
|
|
|
%28 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
|
|
|
|
%29 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %28, i32 0, i32 0
|
|
|
|
|
store ptr @3, ptr %29, align 8
|
|
|
|
|
%30 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %28, i32 0, i32 1
|
|
|
|
|
store i64 5, ptr %30, align 4
|
|
|
|
|
%31 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %28, align 8
|
|
|
|
|
%32 = load i64, ptr %9, align 4
|
|
|
|
|
%33 = or i64 %32, 4
|
|
|
|
|
store i64 %33, ptr %9, align 4
|
2024-06-03 01:32:25 +08:00
|
|
|
store i64 1, ptr %10, align 4
|
|
|
|
|
br label %_llgo_4
|
2024-06-03 01:06:01 +08:00
|
|
|
|
2024-06-03 01:32:25 +08:00
|
|
|
_llgo_4: ; preds = %_llgo_3, %_llgo_2
|
2024-06-05 15:10:35 +08:00
|
|
|
%34 = load i64, ptr %9, align 4
|
|
|
|
|
%35 = and i64 %34, 4
|
|
|
|
|
%36 = icmp ne i64 %35, 0
|
|
|
|
|
br i1 %36, label %_llgo_7, label %_llgo_8
|
2024-06-03 01:06:01 +08:00
|
|
|
|
2024-06-05 15:10:35 +08:00
|
|
|
_llgo_5: ; preds = %_llgo_12
|
2024-06-03 01:32:25 +08:00
|
|
|
ret i32 0
|
|
|
|
|
|
2024-06-05 15:10:35 +08:00
|
|
|
_llgo_6: ; preds = %_llgo_12
|
2024-06-03 01:06:01 +08:00
|
|
|
ret i32 0
|
|
|
|
|
|
2024-06-03 01:32:25 +08:00
|
|
|
_llgo_7: ; preds = %_llgo_4
|
2024-06-05 15:10:35 +08:00
|
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %31)
|
2024-06-03 01:06:01 +08:00
|
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
|
|
|
|
br label %_llgo_8
|
|
|
|
|
|
2024-06-03 01:32:25 +08:00
|
|
|
_llgo_8: ; preds = %_llgo_7, %_llgo_4
|
2024-06-05 15:10:35 +08:00
|
|
|
%37 = and i64 %34, 2
|
|
|
|
|
%38 = icmp ne i64 %37, 0
|
|
|
|
|
br i1 %38, label %_llgo_9, label %_llgo_10
|
2024-06-03 01:06:01 +08:00
|
|
|
|
|
|
|
|
_llgo_9: ; preds = %_llgo_8
|
2024-06-05 15:10:35 +08:00
|
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %25)
|
2024-06-03 01:06:01 +08:00
|
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
|
|
|
|
br label %_llgo_10
|
|
|
|
|
|
|
|
|
|
_llgo_10: ; preds = %_llgo_9, %_llgo_8
|
2024-06-05 15:10:35 +08:00
|
|
|
%39 = and i64 %34, 1
|
|
|
|
|
%40 = icmp ne i64 %39, 0
|
|
|
|
|
br i1 %40, label %_llgo_11, label %_llgo_12
|
2024-06-03 01:06:01 +08:00
|
|
|
|
|
|
|
|
_llgo_11: ; preds = %_llgo_10
|
2024-06-05 15:10:35 +08:00
|
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %19)
|
2024-06-03 01:06:01 +08:00
|
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
|
|
|
|
br label %_llgo_12
|
|
|
|
|
|
|
|
|
|
_llgo_12: ; preds = %_llgo_11, %_llgo_10
|
|
|
|
|
call void @"main.main$1"()
|
2024-06-05 15:10:35 +08:00
|
|
|
%41 = load %"github.com/goplus/llgo/internal/runtime.Defer", ptr %4, align 8
|
|
|
|
|
%42 = extractvalue %"github.com/goplus/llgo/internal/runtime.Defer" %41, 2
|
|
|
|
|
%43 = call i32 @pthread_setspecific(ptr %2, ptr %42)
|
|
|
|
|
%44 = load i64, ptr %10, align 4
|
|
|
|
|
switch i64 %44, label %_llgo_5 [
|
2024-06-03 01:32:25 +08:00
|
|
|
i64 1, label %_llgo_6
|
2024-06-03 01:06:01 +08:00
|
|
|
]
|
2024-06-02 15:24:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
|
|
|
|
|
|
|
|
|
define void @"main.main$1"() {
|
|
|
|
|
_llgo_0:
|
|
|
|
|
%0 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
|
|
|
|
%1 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %0, i32 0, i32 0
|
2024-06-03 01:32:25 +08:00
|
|
|
store ptr @4, ptr %1, align 8
|
2024-06-02 15:24:42 +08:00
|
|
|
%2 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %0, i32 0, i32 1
|
|
|
|
|
store i64 2, ptr %2, align 4
|
|
|
|
|
%3 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %0, align 8
|
|
|
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %3)
|
|
|
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
|
|
|
|
ret void
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare ptr @pthread_getspecific(i32)
|
|
|
|
|
|
|
|
|
|
declare i32 @pthread_setspecific(i32, 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)
|
|
|
|
|
|
2024-06-03 01:32:25 +08:00
|
|
|
define void @"main.init$after"() {
|
|
|
|
|
_llgo_0:
|
|
|
|
|
%0 = load ptr, ptr @__llgo_defer, align 8
|
|
|
|
|
%1 = icmp eq ptr %0, null
|
|
|
|
|
br i1 %1, label %_llgo_1, label %_llgo_2
|
|
|
|
|
|
|
|
|
|
_llgo_1: ; preds = %_llgo_0
|
|
|
|
|
%2 = call i32 @pthread_key_create(ptr @__llgo_defer, ptr null)
|
|
|
|
|
br label %_llgo_2
|
|
|
|
|
|
|
|
|
|
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
|
|
|
|
ret void
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-02 15:24:42 +08:00
|
|
|
declare i32 @pthread_key_create(ptr, ptr)
|