Skip to content

Commit 0d8c89b

Browse files
committed
ssa: fix abiType && abiMethoOf
1 parent 24d345a commit 0d8c89b

File tree

17 files changed

+3762
-3904
lines changed

17 files changed

+3762
-3904
lines changed

cl/_testdata/print/out.ll

Lines changed: 237 additions & 317 deletions
Large diffs are not rendered by default.

cl/_testdata/vargs/out.ll

Lines changed: 32 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
source_filename = "main"
33

44
%"github.com/goplus/llgo/internal/runtime.eface" = type { ptr, ptr }
5-
%"github.com/goplus/llgo/internal/abi.Type" = type { i64, i64, i32, i8, i8, i8, i8, { ptr, ptr }, ptr, %"github.com/goplus/llgo/internal/runtime.String", ptr }
6-
%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 }
75
%"github.com/goplus/llgo/internal/runtime.Slice" = type { ptr, i64, i64 }
6+
%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 }
7+
%"github.com/goplus/llgo/internal/abi.Type" = type { i64, i64, i32, i8, i8, i8, i8, { ptr, ptr }, ptr, %"github.com/goplus/llgo/internal/runtime.String", ptr }
88

99
@"main.init$guard" = global i1 false, align 1
1010
@__llgo_argc = global i32 0, align 4
@@ -37,52 +37,40 @@ _llgo_0:
3737
%2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 48)
3838
%3 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %2, i64 0
3939
%4 = load ptr, ptr @_llgo_int, align 8
40-
%5 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %4, i32 0, i32 6
41-
%6 = load i8, ptr %5, align 1
42-
%7 = or i8 %6, 32
43-
store i8 %7, ptr %5, align 1
44-
%8 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
45-
%9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %8, i32 0, i32 0
46-
store ptr %4, ptr %9, align 8
47-
%10 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %8, i32 0, i32 1
48-
store ptr inttoptr (i64 1 to ptr), ptr %10, align 8
49-
%11 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %8, align 8
50-
store %"github.com/goplus/llgo/internal/runtime.eface" %11, ptr %3, align 8
51-
%12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %2, i64 1
52-
%13 = load ptr, ptr @_llgo_int, align 8
53-
%14 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %13, i32 0, i32 6
54-
%15 = load i8, ptr %14, align 1
55-
%16 = or i8 %15, 32
56-
store i8 %16, ptr %14, align 1
40+
%5 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
41+
%6 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %5, i32 0, i32 0
42+
store ptr %4, ptr %6, align 8
43+
%7 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %5, i32 0, i32 1
44+
store ptr inttoptr (i64 1 to ptr), ptr %7, align 8
45+
%8 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %5, align 8
46+
store %"github.com/goplus/llgo/internal/runtime.eface" %8, ptr %3, align 8
47+
%9 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %2, i64 1
48+
%10 = load ptr, ptr @_llgo_int, align 8
49+
%11 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
50+
%12 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %11, i32 0, i32 0
51+
store ptr %10, ptr %12, align 8
52+
%13 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %11, i32 0, i32 1
53+
store ptr inttoptr (i64 2 to ptr), ptr %13, align 8
54+
%14 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %11, align 8
55+
store %"github.com/goplus/llgo/internal/runtime.eface" %14, ptr %9, align 8
56+
%15 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %2, i64 2
57+
%16 = load ptr, ptr @_llgo_int, align 8
5758
%17 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
5859
%18 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %17, i32 0, i32 0
59-
store ptr %13, ptr %18, align 8
60+
store ptr %16, ptr %18, align 8
6061
%19 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %17, i32 0, i32 1
61-
store ptr inttoptr (i64 2 to ptr), ptr %19, align 8
62+
store ptr inttoptr (i64 3 to ptr), ptr %19, align 8
6263
%20 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %17, align 8
63-
store %"github.com/goplus/llgo/internal/runtime.eface" %20, ptr %12, align 8
64-
%21 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %2, i64 2
65-
%22 = load ptr, ptr @_llgo_int, align 8
66-
%23 = getelementptr inbounds %"github.com/goplus/llgo/internal/abi.Type", ptr %22, i32 0, i32 6
67-
%24 = load i8, ptr %23, align 1
68-
%25 = or i8 %24, 32
69-
store i8 %25, ptr %23, align 1
70-
%26 = alloca %"github.com/goplus/llgo/internal/runtime.eface", align 8
71-
%27 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %26, i32 0, i32 0
72-
store ptr %22, ptr %27, align 8
73-
%28 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.eface", ptr %26, i32 0, i32 1
74-
store ptr inttoptr (i64 3 to ptr), ptr %28, align 8
75-
%29 = load %"github.com/goplus/llgo/internal/runtime.eface", ptr %26, align 8
76-
store %"github.com/goplus/llgo/internal/runtime.eface" %29, ptr %21, align 8
77-
%30 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
78-
%31 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %30, i32 0, i32 0
79-
store ptr %2, ptr %31, align 8
80-
%32 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %30, i32 0, i32 1
81-
store i64 3, ptr %32, align 4
82-
%33 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %30, i32 0, i32 2
83-
store i64 3, ptr %33, align 4
84-
%34 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %30, align 8
85-
call void @main.test(%"github.com/goplus/llgo/internal/runtime.Slice" %34)
64+
store %"github.com/goplus/llgo/internal/runtime.eface" %20, ptr %15, align 8
65+
%21 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
66+
%22 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %21, i32 0, i32 0
67+
store ptr %2, ptr %22, align 8
68+
%23 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %21, i32 0, i32 1
69+
store i64 3, ptr %23, align 4
70+
%24 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %21, i32 0, i32 2
71+
store i64 3, ptr %24, align 4
72+
%25 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %21, align 8
73+
call void @main.test(%"github.com/goplus/llgo/internal/runtime.Slice" %25)
8674
ret i32 0
8775
}
8876

0 commit comments

Comments
 (0)