abiTypes: abiTypeInit fix

This commit is contained in:
xushiwei
2024-05-31 08:12:27 +08:00
parent 3b2f01e974
commit 76c1800a53
16 changed files with 1290 additions and 918 deletions

View File

@@ -6,7 +6,9 @@ source_filename = "main"
@"main.init$guard" = global ptr null
@"*_llgo_int8" = linkonce global ptr null
@_llgo_int8 = linkonce global ptr null
@0 = private unnamed_addr constant [22 x i8] c"type assertion failed\00", align 1
@_llgo_int = linkonce global ptr null
@1 = private unnamed_addr constant [22 x i8] c"type assertion failed\00", align 1
@__llgo_argc = global ptr null
@__llgo_argv = global ptr null
@@ -38,7 +40,7 @@ _llgo_2: ; preds = %_llgo_0
define i64 @main.incVal(%"github.com/goplus/llgo/internal/runtime.eface" %0) {
_llgo_0:
%1 = extractvalue %"github.com/goplus/llgo/internal/runtime.eface" %0, 0
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
%2 = load ptr, ptr @_llgo_int, align 8
%3 = icmp eq ptr %1, %2
br i1 %3, label %_llgo_1, label %_llgo_2
@@ -87,7 +89,7 @@ _llgo_0:
store ptr @3, ptr %5, align 8
%6 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %3, align 8
%7 = call ptr @main.hi(%"github.com/goplus/llgo/internal/runtime.eface" %6)
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
%8 = load ptr, ptr @_llgo_int, align 8
%9 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
%10 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %9, i32 0, i32 0
store ptr %8, ptr %10, align 8
@@ -99,28 +101,48 @@ _llgo_0:
ret i32 0
}
declare void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface")
declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64)
declare void @"github.com/goplus/llgo/internal/runtime.init"()
declare i32 @printf(ptr, ...)
define void @"main.init$abi"() {
_llgo_0:
%0 = load ptr, ptr @"*_llgo_int8", align 8
%0 = load ptr, ptr @_llgo_int8, align 8
%1 = icmp eq ptr %0, null
br i1 %1, label %_llgo_1, label %_llgo_2
_llgo_1: ; preds = %_llgo_0
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 3)
%3 = call ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr %2)
store ptr %3, ptr @"*_llgo_int8", align 8
store ptr %2, ptr @_llgo_int8, align 8
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
%3 = load ptr, ptr @_llgo_int8, align 8
%4 = load ptr, ptr @"*_llgo_int8", align 8
%5 = icmp eq ptr %4, null
br i1 %5, label %_llgo_3, label %_llgo_4
_llgo_3: ; preds = %_llgo_2
%6 = call ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr %3)
store ptr %6, ptr @"*_llgo_int8", align 8
br label %_llgo_4
_llgo_4: ; preds = %_llgo_3, %_llgo_2
%7 = load ptr, ptr @_llgo_int, align 8
%8 = icmp eq ptr %7, null
br i1 %8, label %_llgo_5, label %_llgo_6
_llgo_5: ; preds = %_llgo_4
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
store ptr %9, ptr @_llgo_int, align 8
br label %_llgo_6
_llgo_6: ; preds = %_llgo_5, %_llgo_4
ret void
}
declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64)
declare ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr)
declare void @"github.com/goplus/llgo/internal/runtime.TracePanic"(%"github.com/goplus/llgo/internal/runtime.eface")
declare void @"github.com/goplus/llgo/internal/runtime.init"()
declare i32 @printf(ptr, ...)

View File

@@ -16,6 +16,7 @@ source_filename = "main"
@2 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
@3 = private unnamed_addr constant [6 x i8] c"hello\00", align 1
@4 = private unnamed_addr constant [4 x i8] c"def\00", align 1
@_llgo_int = linkonce global ptr null
@5 = private unnamed_addr constant [5 x i8] c"ABCD\00", align 1
@6 = private unnamed_addr constant [8 x i8] c"\E4\B8\ADabcd\00", align 1
@7 = private unnamed_addr constant [8 x i8] c"\E4\B8\ADabcd\00", align 1
@@ -85,6 +86,7 @@ _llgo_0:
_llgo_1: ; preds = %_llgo_0
store i1 true, ptr @"main.init$guard", align 1
call void @"main.init$abi"()
store i64 9223372036854775807, ptr @main.a, align 4
store i64 -9223372036854775808, ptr @main.b, align 4
store i64 -1, ptr @main.n, align 4
@@ -323,7 +325,7 @@ _llgo_0:
call void @"github.com/goplus/llgo/internal/runtime.PrintSlice"(%"github.com/goplus/llgo/internal/runtime.Slice" %122)
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
%123 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 16)
%124 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
%124 = load ptr, ptr @_llgo_int, align 8
%125 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
%126 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %125, i32 0, i32 0
store ptr %124, ptr %126, align 8
@@ -641,6 +643,21 @@ declare void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com
declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.SliceAppend"(%"github.com/goplus/llgo/internal/runtime.Slice", ptr, i64, i64)
define void @"main.init$abi"() {
_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
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
store ptr %2, ptr @_llgo_int, align 8
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}
declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64)
declare void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1)

View File

@@ -6,6 +6,7 @@ source_filename = "main"
@"main.init$guard" = global ptr null
@0 = private unnamed_addr constant [6 x i8] c"error\00", align 1
@_llgo_string = linkonce global ptr null
@1 = private unnamed_addr constant [6 x i8] c"error\00", align 1
@2 = private unnamed_addr constant [6 x i8] c"error\00", align 1
@3 = private unnamed_addr constant [6 x i8] c"error\00", align 1
@@ -34,7 +35,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -63,7 +64,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -92,7 +93,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -121,7 +122,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -150,7 +151,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -179,7 +180,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -208,7 +209,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -237,7 +238,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -266,7 +267,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -295,7 +296,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -324,7 +325,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -353,7 +354,7 @@ _llgo_1: ; preds = %_llgo_0
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %4, i32 0, i32 1
store i64 5, ptr %6, align 4
%7 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %4, align 8
%8 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%8 = load ptr, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %7, ptr %9, align 8
%10 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -377,7 +378,7 @@ _llgo_3: ; preds = %_llgo_2
%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 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%20 = load ptr, ptr @_llgo_string, align 8
%21 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %19, ptr %21, align 8
%22 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -400,6 +401,7 @@ _llgo_0:
_llgo_1: ; preds = %_llgo_0
store i1 true, ptr @"main.init$guard", align 1
call void @"main.init$abi"()
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
@@ -470,6 +472,21 @@ _llgo_0:
ret i32 0
}
define void @"main.init$abi"() {
_llgo_0:
%0 = load ptr, ptr @_llgo_string, align 8
%1 = icmp eq ptr %0, null
br i1 %1, label %_llgo_1, label %_llgo_2
_llgo_1: ; preds = %_llgo_0
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
store ptr %2, ptr @_llgo_string, align 8
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}
declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64)
declare ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64)

View File

@@ -8,6 +8,7 @@ source_filename = "main"
@__llgo_argc = global ptr null
@__llgo_argv = global ptr null
@0 = private unnamed_addr constant [14 x i8] c"panic message\00", align 1
@_llgo_string = linkonce global ptr null
define void @main.init() {
_llgo_0:
@@ -16,6 +17,7 @@ _llgo_0:
_llgo_1: ; preds = %_llgo_0
store i1 true, ptr @"main.init$guard", align 1
call void @"main.init$abi"()
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
@@ -34,7 +36,7 @@ _llgo_0:
%4 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %2, i32 0, i32 1
store i64 13, ptr %4, align 4
%5 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %2, align 8
%6 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
%6 = load ptr, ptr @_llgo_string, align 8
%7 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64 16)
store %"github.com/goplus/llgo/internal/runtime.String" %5, ptr %7, align 8
%8 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
@@ -49,6 +51,21 @@ _llgo_0:
declare void @"github.com/goplus/llgo/internal/runtime.init"()
define void @"main.init$abi"() {
_llgo_0:
%0 = load ptr, ptr @_llgo_string, align 8
%1 = icmp eq ptr %0, null
br i1 %1, label %_llgo_1, label %_llgo_2
_llgo_1: ; preds = %_llgo_0
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
store ptr %2, ptr @_llgo_string, align 8
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}
declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64)
declare ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64)