2024-05-09 06:48:16 +08:00
|
|
|
; ModuleID = 'main'
|
|
|
|
|
source_filename = "main"
|
|
|
|
|
|
2025-01-08 15:19:38 +08:00
|
|
|
%"github.com/goplus/llgo/runtime/internal/runtime.eface" = type { ptr, ptr }
|
|
|
|
|
%"github.com/goplus/llgo/runtime/internal/runtime.Slice" = type { ptr, i64, i64 }
|
|
|
|
|
%"github.com/goplus/llgo/runtime/internal/runtime.String" = type { ptr, i64 }
|
2024-05-09 06:48:16 +08:00
|
|
|
|
2024-06-14 09:57:23 +08:00
|
|
|
@"main.init$guard" = global i1 false, align 1
|
|
|
|
|
@__llgo_argc = global i32 0, align 4
|
|
|
|
|
@__llgo_argv = global ptr null, align 8
|
|
|
|
|
@_llgo_int = linkonce global ptr null, align 8
|
2024-05-09 06:48:16 +08:00
|
|
|
@0 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
|
2024-06-13 09:40:41 +08:00
|
|
|
@1 = private unnamed_addr constant [21 x i8] c"type assertion failed", align 1
|
2024-06-14 09:57:23 +08:00
|
|
|
@_llgo_string = linkonce global ptr null, align 8
|
2024-05-09 06:48:16 +08:00
|
|
|
|
|
|
|
|
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-03 01:06:01 +08:00
|
|
|
call void @"main.init$after"()
|
2024-05-09 06:48:16 +08:00
|
|
|
br label %_llgo_2
|
|
|
|
|
|
|
|
|
|
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
|
|
|
|
ret void
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-17 09:48:21 +08:00
|
|
|
define i32 @main(i32 %0, ptr %1) {
|
2024-05-09 06:48:16 +08:00
|
|
|
_llgo_0:
|
|
|
|
|
store i32 %0, ptr @__llgo_argc, align 4
|
|
|
|
|
store ptr %1, ptr @__llgo_argv, align 8
|
2025-01-08 15:19:38 +08:00
|
|
|
call void @"github.com/goplus/llgo/runtime/internal/runtime.init"()
|
2024-05-09 06:48:16 +08:00
|
|
|
call void @main.init()
|
2025-01-08 15:19:38 +08:00
|
|
|
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64 48)
|
|
|
|
|
%3 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %2, i64 0
|
2024-05-31 08:12:27 +08:00
|
|
|
%4 = load ptr, ptr @_llgo_int, align 8
|
2025-01-08 15:19:38 +08:00
|
|
|
%5 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %4, 0
|
|
|
|
|
%6 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %5, ptr inttoptr (i64 1 to ptr), 1
|
|
|
|
|
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %6, ptr %3, align 8
|
|
|
|
|
%7 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %2, i64 1
|
2024-11-24 15:19:16 +08:00
|
|
|
%8 = load ptr, ptr @_llgo_int, align 8
|
2025-01-08 15:19:38 +08:00
|
|
|
%9 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %8, 0
|
|
|
|
|
%10 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %9, ptr inttoptr (i64 2 to ptr), 1
|
|
|
|
|
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %10, ptr %7, align 8
|
|
|
|
|
%11 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %2, i64 2
|
2024-11-24 15:19:16 +08:00
|
|
|
%12 = load ptr, ptr @_llgo_int, align 8
|
2025-01-08 15:19:38 +08:00
|
|
|
%13 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %12, 0
|
|
|
|
|
%14 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %13, ptr inttoptr (i64 3 to ptr), 1
|
|
|
|
|
store %"github.com/goplus/llgo/runtime/internal/runtime.eface" %14, ptr %11, align 8
|
|
|
|
|
%15 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" undef, ptr %2, 0
|
|
|
|
|
%16 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %15, i64 3, 1
|
|
|
|
|
%17 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %16, i64 3, 2
|
|
|
|
|
call void @main.test(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %17)
|
2024-05-17 09:48:21 +08:00
|
|
|
ret i32 0
|
2024-05-09 06:48:16 +08:00
|
|
|
}
|
|
|
|
|
|
2025-01-08 15:19:38 +08:00
|
|
|
define void @main.test(%"github.com/goplus/llgo/runtime/internal/runtime.Slice" %0) {
|
2024-05-09 06:48:16 +08:00
|
|
|
_llgo_0:
|
2025-01-08 15:19:38 +08:00
|
|
|
%1 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %0, 1
|
2024-05-09 06:48:16 +08:00
|
|
|
br label %_llgo_1
|
|
|
|
|
|
2024-05-24 07:51:41 +08:00
|
|
|
_llgo_1: ; preds = %_llgo_4, %_llgo_0
|
2024-05-24 09:20:58 +08:00
|
|
|
%2 = phi i64 [ -1, %_llgo_0 ], [ %3, %_llgo_4 ]
|
2024-05-09 06:48:16 +08:00
|
|
|
%3 = add i64 %2, 1
|
|
|
|
|
%4 = icmp slt i64 %3, %1
|
|
|
|
|
br i1 %4, label %_llgo_2, label %_llgo_3
|
|
|
|
|
|
|
|
|
|
_llgo_2: ; preds = %_llgo_1
|
2025-01-08 15:19:38 +08:00
|
|
|
%5 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %0, 0
|
|
|
|
|
%6 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.Slice" %0, 1
|
2024-06-17 21:00:05 +08:00
|
|
|
%7 = icmp slt i64 %3, 0
|
|
|
|
|
%8 = icmp sge i64 %3, %6
|
|
|
|
|
%9 = or i1 %8, %7
|
2025-01-08 15:19:38 +08:00
|
|
|
call void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1 %9)
|
|
|
|
|
%10 = getelementptr inbounds %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %5, i64 %3
|
|
|
|
|
%11 = load %"github.com/goplus/llgo/runtime/internal/runtime.eface", ptr %10, align 8
|
|
|
|
|
%12 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %11, 0
|
2024-06-17 21:00:05 +08:00
|
|
|
%13 = load ptr, ptr @_llgo_int, align 8
|
|
|
|
|
%14 = icmp eq ptr %12, %13
|
|
|
|
|
br i1 %14, label %_llgo_4, label %_llgo_5
|
2024-05-09 06:48:16 +08:00
|
|
|
|
|
|
|
|
_llgo_3: ; preds = %_llgo_1
|
|
|
|
|
ret void
|
2024-05-24 07:51:41 +08:00
|
|
|
|
|
|
|
|
_llgo_4: ; preds = %_llgo_2
|
2025-01-08 15:19:38 +08:00
|
|
|
%15 = extractvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %11, 1
|
2024-06-17 21:00:05 +08:00
|
|
|
%16 = ptrtoint ptr %15 to i64
|
|
|
|
|
%17 = call i32 (ptr, ...) @printf(ptr @0, i64 %16)
|
2024-05-24 07:51:41 +08:00
|
|
|
br label %_llgo_1
|
|
|
|
|
|
|
|
|
|
_llgo_5: ; preds = %_llgo_2
|
2024-11-24 15:19:16 +08:00
|
|
|
%18 = load ptr, ptr @_llgo_string, align 8
|
2025-01-08 15:19:38 +08:00
|
|
|
%19 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64 16)
|
|
|
|
|
store %"github.com/goplus/llgo/runtime/internal/runtime.String" { ptr @1, i64 21 }, ptr %19, align 8
|
|
|
|
|
%20 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" undef, ptr %18, 0
|
|
|
|
|
%21 = insertvalue %"github.com/goplus/llgo/runtime/internal/runtime.eface" %20, ptr %19, 1
|
|
|
|
|
call void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface" %21)
|
2024-05-24 07:51:41 +08:00
|
|
|
unreachable
|
2024-05-09 06:48:16 +08:00
|
|
|
}
|
|
|
|
|
|
2025-01-08 15:19:38 +08:00
|
|
|
declare void @"github.com/goplus/llgo/runtime/internal/runtime.init"()
|
2024-05-09 06:48:16 +08:00
|
|
|
|
2025-01-08 15:19:38 +08:00
|
|
|
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocZ"(i64)
|
2024-05-09 06:48:16 +08:00
|
|
|
|
2024-06-03 01:06:01 +08:00
|
|
|
define void @"main.init$after"() {
|
2024-05-31 08:12:27 +08:00
|
|
|
_llgo_0:
|
|
|
|
|
%0 = load ptr, ptr @_llgo_int, align 8
|
|
|
|
|
%1 = icmp eq ptr %0, null
|
|
|
|
|
br i1 %1, label %_llgo_1, label %_llgo_2
|
|
|
|
|
|
|
|
|
|
_llgo_1: ; preds = %_llgo_0
|
2025-01-08 15:19:38 +08:00
|
|
|
%2 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 34)
|
2024-05-31 08:12:27 +08:00
|
|
|
store ptr %2, ptr @_llgo_int, align 8
|
|
|
|
|
br label %_llgo_2
|
|
|
|
|
|
|
|
|
|
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
2024-07-04 08:23:57 +08:00
|
|
|
%3 = load ptr, ptr @_llgo_string, align 8
|
|
|
|
|
%4 = icmp eq ptr %3, null
|
|
|
|
|
br i1 %4, label %_llgo_3, label %_llgo_4
|
2024-06-05 22:24:51 +08:00
|
|
|
|
|
|
|
|
_llgo_3: ; preds = %_llgo_2
|
2025-01-08 15:19:38 +08:00
|
|
|
%5 = call ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64 24)
|
2024-07-04 08:23:57 +08:00
|
|
|
store ptr %5, ptr @_llgo_string, align 8
|
2024-06-05 22:24:51 +08:00
|
|
|
br label %_llgo_4
|
|
|
|
|
|
|
|
|
|
_llgo_4: ; preds = %_llgo_3, %_llgo_2
|
2024-05-31 08:12:27 +08:00
|
|
|
ret void
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-08 15:19:38 +08:00
|
|
|
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.Basic"(i64)
|
2024-05-09 06:48:16 +08:00
|
|
|
|
2025-01-08 15:19:38 +08:00
|
|
|
declare void @"github.com/goplus/llgo/runtime/internal/runtime.AssertIndexRange"(i1)
|
2024-05-18 11:08:39 +08:00
|
|
|
|
2025-01-08 15:19:38 +08:00
|
|
|
declare ptr @"github.com/goplus/llgo/runtime/internal/runtime.AllocU"(i64)
|
2024-06-05 22:24:51 +08:00
|
|
|
|
2025-01-08 15:19:38 +08:00
|
|
|
declare void @"github.com/goplus/llgo/runtime/internal/runtime.Panic"(%"github.com/goplus/llgo/runtime/internal/runtime.eface")
|
2024-05-09 06:48:16 +08:00
|
|
|
|
|
|
|
|
declare i32 @printf(ptr, ...)
|