ssa: compile go string constant without alloca
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
; ModuleID = 'main'
|
||||
source_filename = "main"
|
||||
|
||||
%"github.com/goplus/llgo/internal/runtime.Slice" = type { ptr, i64, i64 }
|
||||
%"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 }
|
||||
|
||||
@"main.init$guard" = global i1 false, align 1
|
||||
@@ -28,28 +27,12 @@ _llgo_0:
|
||||
store ptr %1, ptr @__llgo_argv, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.init"()
|
||||
call void @main.init()
|
||||
%2 = alloca %"github.com/goplus/llgo/internal/runtime.Slice", align 8
|
||||
%3 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %2, i32 0, i32 0
|
||||
store ptr null, ptr %3, align 8
|
||||
%4 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %2, i32 0, i32 1
|
||||
store i64 0, ptr %4, align 4
|
||||
%5 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.Slice", ptr %2, i32 0, i32 2
|
||||
store i64 0, ptr %5, align 4
|
||||
%6 = load %"github.com/goplus/llgo/internal/runtime.Slice", ptr %2, align 8
|
||||
%7 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %6, 1
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %7)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 0)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
||||
%8 = icmp sgt i64 %7, 0
|
||||
br i1 %8, label %_llgo_1, label %_llgo_2
|
||||
br i1 false, label %_llgo_1, label %_llgo_2
|
||||
|
||||
_llgo_1: ; preds = %_llgo_0
|
||||
%9 = alloca %"github.com/goplus/llgo/internal/runtime.String", align 8
|
||||
%10 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %9, i32 0, i32 0
|
||||
store ptr @0, ptr %10, align 8
|
||||
%11 = getelementptr inbounds %"github.com/goplus/llgo/internal/runtime.String", ptr %9, i32 0, i32 1
|
||||
store i64 7, ptr %11, align 4
|
||||
%12 = load %"github.com/goplus/llgo/internal/runtime.String", ptr %9, align 8
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %12)
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" { ptr @0, i64 7 })
|
||||
call void @"github.com/goplus/llgo/internal/runtime.PrintByte"(i8 10)
|
||||
br label %_llgo_2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user