ssa: fix abiType && abiMethoOf

This commit is contained in:
visualfc
2024-06-23 06:51:09 +08:00
parent 5238c2457d
commit 16352df5b1
17 changed files with 3064 additions and 4409 deletions

View File

@@ -7,7 +7,6 @@ source_filename = "main"
@"main.init$guard" = global i1 false, align 1
@"*_llgo_int8" = linkonce global ptr null, align 8
@_llgo_int8 = linkonce global ptr null, align 8
@0 = private unnamed_addr constant [21 x i8] c"type assertion failed", align 1
@_llgo_string = linkonce global ptr null, align 8
@_llgo_int = linkonce global ptr null, align 8
@@ -109,79 +108,61 @@ _llgo_0:
%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 = load ptr, ptr @_llgo_int, align 8
%9 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %8, i32 0, i32 6
%10 = load i8, ptr %9, align 1
%11 = or i8 %10, 32
store i8 %11, ptr %9, align 1
%12 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
%13 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %12, i32 0, i32 0
store ptr %8, ptr %13, align 8
%14 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %12, i32 0, i32 1
store ptr inttoptr (i64 100 to ptr), ptr %14, align 8
%15 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %12, align 8
%16 = call i64 @main.incVal(%"github.com/goplus/llgo/internal/runtime.eface" %15)
%17 = call i32 (ptr, ...) @printf(ptr @1, ptr %7, i64 %16)
%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
%11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %9, i32 0, i32 1
store ptr inttoptr (i64 100 to ptr), ptr %11, align 8
%12 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %9, align 8
%13 = call i64 @main.incVal(%"github.com/goplus/llgo/internal/runtime.eface" %12)
%14 = call i32 (ptr, ...) @printf(ptr @1, ptr %7, i64 %13)
ret i32 0
}
define void @"main.init$after"() {
_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 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %2, i32 0, i32 6
%4 = load i8, ptr %3, align 1
%5 = or i8 %4, 32
store i8 %5, ptr %3, align 1
store ptr %2, ptr @_llgo_int8, align 8
%3 = call ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr %2)
store ptr %3, ptr @"*_llgo_int8", align 8
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
%6 = load ptr, ptr @_llgo_int8, align 8
%7 = load ptr, ptr @"*_llgo_int8", align 8
%8 = icmp eq ptr %7, null
br i1 %8, label %_llgo_3, label %_llgo_4
%4 = load ptr, ptr @_llgo_string, align 8
%5 = icmp eq ptr %4, null
br i1 %5, label %_llgo_3, label %_llgo_4
_llgo_3: ; preds = %_llgo_2
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr %6)
store ptr %9, ptr @"*_llgo_int8", align 8
%6 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
store ptr %6, ptr @_llgo_string, align 8
br label %_llgo_4
_llgo_4: ; preds = %_llgo_3, %_llgo_2
%10 = load ptr, ptr @_llgo_string, align 8
%11 = icmp eq ptr %10, null
br i1 %11, label %_llgo_5, label %_llgo_6
%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
%12 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 24)
store ptr %12, ptr @_llgo_string, align 8
%9 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
%10 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %9, i32 0, i32 6
%11 = load i8, ptr %10, align 1
%12 = or i8 %11, 32
store i8 %12, ptr %10, align 1
store ptr %9, ptr @_llgo_int, align 8
br label %_llgo_6
_llgo_6: ; preds = %_llgo_5, %_llgo_4
%13 = load ptr, ptr @_llgo_int, align 8
%14 = icmp eq ptr %13, null
br i1 %14, label %_llgo_7, label %_llgo_8
_llgo_7: ; preds = %_llgo_6
%15 = call ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64 2)
%16 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %15, i32 0, i32 6
%17 = load i8, ptr %16, align 1
%18 = or i8 %17, 32
store i8 %18, ptr %16, align 1
store ptr %15, ptr @_llgo_int, align 8
br label %_llgo_8
_llgo_8: ; preds = %_llgo_7, %_llgo_6
ret void
}
declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64)
declare ptr @"github.com/goplus/llgo/internal/runtime.PointerTo"(ptr)
declare ptr @"github.com/goplus/llgo/internal/runtime.Basic"(i64)
declare ptr @"github.com/goplus/llgo/internal/runtime.AllocU"(i64)
declare void @"github.com/goplus/llgo/internal/runtime.Panic"(%"github.com/goplus/llgo/internal/runtime.eface")