89 lines
3.4 KiB
LLVM
89 lines
3.4 KiB
LLVM
; ModuleID = 'main'
|
|
source_filename = "main"
|
|
|
|
%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 }
|
|
%main.T = type { ptr, ptr }
|
|
|
|
@"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 [3 x i8] c"env", align 1
|
|
@1 = private unnamed_addr constant [4 x i8] c"func", align 1
|
|
@2 = private unnamed_addr constant [7 x i8] c"closure", align 1
|
|
|
|
define void @main.init() {
|
|
_llgo_0:
|
|
%0 = load i1, ptr @"main.init$guard", align 1
|
|
br i1 %0, label %_llgo_2, label %_llgo_1
|
|
|
|
_llgo_1: ; preds = %_llgo_0
|
|
store i1 true, ptr @"main.init$guard", align 1
|
|
br label %_llgo_2
|
|
|
|
_llgo_2: ; preds = %_llgo_1, %_llgo_0
|
|
ret void
|
|
}
|
|
|
|
define i32 @main(i32 %0, ptr %1) {
|
|
_llgo_0:
|
|
store i32 %0, ptr @__llgo_argc, align 4
|
|
store ptr %1, ptr @__llgo_argv, align 8
|
|
call void @"github.com/goplus/llgo/internal/runtime.init"()
|
|
call void @main.init()
|
|
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 16)
|
|
store %"github.com/goplus/llgo/internal/runtime.String" { ptr @0, i64 3 }, ptr %2, align 8
|
|
%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$2", ptr undef }, ptr %3, 1
|
|
%6 = alloca %main.T, align 8
|
|
store { ptr, ptr } %5, ptr %6, align 8
|
|
%7 = load %main.T, ptr %6, align 8
|
|
call void @"__llgo_stub.main.main$1"(ptr null, i64 100)
|
|
%8 = extractvalue %main.T %7, 1
|
|
%9 = extractvalue %main.T %7, 0
|
|
call void %9(ptr %8, i64 200)
|
|
ret i32 0
|
|
}
|
|
|
|
define void @"main.main$1"(i64 %0) {
|
|
_llgo_0:
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" { ptr @1, i64 4 })
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %0)
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
|
ret void
|
|
}
|
|
|
|
define void @"main.main$2"(ptr %0, i64 %1) {
|
|
_llgo_0:
|
|
%2 = load { ptr }, ptr %0, align 8
|
|
%3 = extractvalue { ptr } %2, 0
|
|
%4 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %3, align 8
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" { ptr @2, i64 7 })
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %1)
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 32)
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %4)
|
|
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
|
ret void
|
|
}
|
|
|
|
declare void @"github.com/goplus/llgo/internal/runtime.init"()
|
|
|
|
declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64)
|
|
|
|
define linkonce void @"__llgo_stub.main.main$1"(ptr %0, i64 %1) {
|
|
_llgo_0:
|
|
tail call void @"main.main$1"(i64 %1)
|
|
ret void
|
|
}
|
|
|
|
declare ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64)
|
|
|
|
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 @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64)
|