github.com/goplus/llgo@v0.8.3/cl/_testrt/sum/out.ll (about)

     1  ; ModuleID = 'main'
     2  source_filename = "main"
     3  
     4  %"github.com/goplus/llgo/internal/runtime.Slice" = type { ptr, i64, i64 }
     5  
     6  @"main.init$guard" = global ptr null
     7  @__llgo_argc = global ptr null
     8  @__llgo_argv = global ptr null
     9  @0 = private unnamed_addr constant [10 x i8] c"Hello %d\0A\00", align 1
    10  
    11  define void @main.init() {
    12  _llgo_0:
    13    %0 = load i1, ptr @"main.init$guard", align 1
    14    br i1 %0, label %_llgo_2, label %_llgo_1
    15  
    16  _llgo_1:                                          ; preds = %_llgo_0
    17    store i1 true, ptr @"main.init$guard", align 1
    18    br label %_llgo_2
    19  
    20  _llgo_2:                                          ; preds = %_llgo_1, %_llgo_0
    21    ret void
    22  }
    23  
    24  define i32 @main(i32 %0, ptr %1) {
    25  _llgo_0:
    26    store i32 %0, ptr @__llgo_argc, align 4
    27    store ptr %1, ptr @__llgo_argv, align 8
    28    call void @"github.com/goplus/llgo/internal/runtime.init"()
    29    call void @main.init()
    30    %2 = call ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64 32)
    31    %3 = getelementptr inbounds i64, ptr %2, i64 0
    32    store i64 1, ptr %3, align 4
    33    %4 = getelementptr inbounds i64, ptr %2, i64 1
    34    store i64 2, ptr %4, align 4
    35    %5 = getelementptr inbounds i64, ptr %2, i64 2
    36    store i64 3, ptr %5, align 4
    37    %6 = getelementptr inbounds i64, ptr %2, i64 3
    38    store i64 4, ptr %6, align 4
    39    %7 = call %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr %2, i64 8, i64 4, i64 0, i64 4, i64 4)
    40    %8 = call i64 @main.sum(%"github.com/goplus/llgo/internal/runtime.Slice" %7)
    41    %9 = call i32 (ptr, ...) @printf(ptr @0, i64 %8)
    42    ret i32 0
    43  }
    44  
    45  define i64 @main.sum(%"github.com/goplus/llgo/internal/runtime.Slice" %0) {
    46  _llgo_0:
    47    %1 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 1
    48    br label %_llgo_1
    49  
    50  _llgo_1:                                          ; preds = %_llgo_2, %_llgo_0
    51    %2 = phi i64 [ 0, %_llgo_0 ], [ %10, %_llgo_2 ]
    52    %3 = phi i64 [ -1, %_llgo_0 ], [ %4, %_llgo_2 ]
    53    %4 = add i64 %3, 1
    54    %5 = icmp slt i64 %4, %1
    55    br i1 %5, label %_llgo_2, label %_llgo_3
    56  
    57  _llgo_2:                                          ; preds = %_llgo_1
    58    %6 = icmp slt i64 %4, 0
    59    call void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1 %6)
    60    %7 = extractvalue %"github.com/goplus/llgo/internal/runtime.Slice" %0, 0
    61    %8 = getelementptr inbounds i64, ptr %7, i64 %4
    62    %9 = load i64, ptr %8, align 4
    63    %10 = add i64 %2, %9
    64    br label %_llgo_1
    65  
    66  _llgo_3:                                          ; preds = %_llgo_1
    67    ret i64 %2
    68  }
    69  
    70  declare void @"github.com/goplus/llgo/internal/runtime.init"()
    71  
    72  declare ptr @"github.com/goplus/llgo/internal/runtime.AllocZ"(i64)
    73  
    74  declare %"github.com/goplus/llgo/internal/runtime.Slice" @"github.com/goplus/llgo/internal/runtime.NewSlice3"(ptr, i64, i64, i64, i64, i64)
    75  
    76  declare i32 @printf(ptr, ...)
    77  
    78  declare void @"github.com/goplus/llgo/internal/runtime.AssertIndexRange"(i1)