github.com/goplus/llgo@v0.8.3/cl/_testdata/utf8/out.ll (about) 1 ; ModuleID = 'main' 2 source_filename = "main" 3 4 %"github.com/goplus/llgo/internal/runtime.String" = type { ptr, i64 } 5 6 @main.array = global [8 x i8] undef 7 @"main.init$guard" = global ptr null 8 @__llgo_argc = global ptr null 9 @__llgo_argv = global ptr null 10 @0 = private unnamed_addr constant [8 x i8] c"\E4\B8\ADabcd\00", align 1 11 @1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 12 @2 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 13 @3 = private unnamed_addr constant [8 x i8] c"\E4\B8\ADabcd\00", align 1 14 15 define i8 @main.index(i8 %0) { 16 _llgo_0: 17 %1 = icmp slt i8 %0, 0 18 call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %1) 19 %2 = zext i8 %0 to i64 20 %3 = getelementptr inbounds i8, ptr @main.array, i64 %2 21 %4 = load i8, ptr %3, align 1 22 ret i8 %4 23 } 24 25 define void @main.init() { 26 _llgo_0: 27 %0 = load i1, ptr @"main.init$guard", align 1 28 br i1 %0, label %_llgo_2, label %_llgo_1 29 30 _llgo_1: ; preds = %_llgo_0 31 store i1 true, ptr @"main.init$guard", align 1 32 call void @"unicode/utf8.init"() 33 store i8 1, ptr @main.array, align 1 34 store i8 2, ptr getelementptr inbounds (i8, ptr @main.array, i64 1), align 1 35 store i8 3, ptr getelementptr inbounds (i8, ptr @main.array, i64 2), align 1 36 store i8 4, ptr getelementptr inbounds (i8, ptr @main.array, i64 3), align 1 37 store i8 5, ptr getelementptr inbounds (i8, ptr @main.array, i64 4), align 1 38 store i8 6, ptr getelementptr inbounds (i8, ptr @main.array, i64 5), align 1 39 store i8 7, ptr getelementptr inbounds (i8, ptr @main.array, i64 6), align 1 40 store i8 8, ptr getelementptr inbounds (i8, ptr @main.array, i64 7), align 1 41 br label %_llgo_2 42 43 _llgo_2: ; preds = %_llgo_1, %_llgo_0 44 ret void 45 } 46 47 define i32 @main(i32 %0, ptr %1) { 48 _llgo_0: 49 store i32 %0, ptr @__llgo_argc, align 4 50 store ptr %1, ptr @__llgo_argv, align 8 51 call void @"github.com/goplus/llgo/internal/runtime.init"() 52 call void @main.init() 53 br label %_llgo_3 54 55 _llgo_1: ; preds = %_llgo_3 56 %2 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 7) 57 %3 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %2, 1 58 %4 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String" %2, i64 %14, i64 %3) 59 %5 = call { i32, i64 } @"unicode/utf8.DecodeRuneInString"(%"github.com/goplus/llgo/internal/runtime.String" %4) 60 %6 = extractvalue { i32, i64 } %5, 0 61 %7 = extractvalue { i32, i64 } %5, 1 62 %8 = add i64 %14, %7 63 %9 = sext i32 %6 to i64 64 call void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64 %9) 65 %10 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @1, i64 1) 66 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %10) 67 br label %_llgo_3 68 69 _llgo_2: ; preds = %_llgo_3 70 %11 = call i8 @main.index(i8 2) 71 %12 = icmp eq i8 %11, 3 72 call void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1 %12) 73 %13 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @2, i64 1) 74 call void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String" %13) 75 ret i32 0 76 77 _llgo_3: ; preds = %_llgo_1, %_llgo_0 78 %14 = phi i64 [ 0, %_llgo_0 ], [ %8, %_llgo_1 ] 79 %15 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @3, i64 7) 80 %16 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %15, 1 81 %17 = icmp slt i64 %14, %16 82 br i1 %17, label %_llgo_1, label %_llgo_2 83 } 84 85 declare void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1) 86 87 declare void @"unicode/utf8.init"() 88 89 declare void @"github.com/goplus/llgo/internal/runtime.init"() 90 91 declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr, i64) 92 93 declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewStringSlice"(%"github.com/goplus/llgo/internal/runtime.String", i64, i64) 94 95 declare { i32, i64 } @"unicode/utf8.DecodeRuneInString"(%"github.com/goplus/llgo/internal/runtime.String") 96 97 declare void @"github.com/goplus/llgo/internal/runtime.PrintInt"(i64) 98 99 declare void @"github.com/goplus/llgo/internal/runtime.PrintString"(%"github.com/goplus/llgo/internal/runtime.String") 100 101 declare void @"github.com/goplus/llgo/internal/runtime.PrintBool"(i1)