github.com/goplus/llgo@v0.8.3/cl/_testrt/allocstr/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.init$guard" = global ptr null
     7  @0 = private unnamed_addr constant [13 x i8] c"Hello world\0A\00", align 1
     8  @__llgo_argc = global ptr null
     9  @__llgo_argv = global ptr null
    10  
    11  define %"github.com/goplus/llgo/internal/runtime.String" @main.hello() {
    12  _llgo_0:
    13    %0 = call %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr @0, i64 12)
    14    ret %"github.com/goplus/llgo/internal/runtime.String" %0
    15  }
    16  
    17  define void @main.init() {
    18  _llgo_0:
    19    %0 = load i1, ptr @"main.init$guard", align 1
    20    br i1 %0, label %_llgo_2, label %_llgo_1
    21  
    22  _llgo_1:                                          ; preds = %_llgo_0
    23    store i1 true, ptr @"main.init$guard", align 1
    24    br label %_llgo_2
    25  
    26  _llgo_2:                                          ; preds = %_llgo_1, %_llgo_0
    27    ret void
    28  }
    29  
    30  define i32 @main(i32 %0, ptr %1) {
    31  _llgo_0:
    32    store i32 %0, ptr @__llgo_argc, align 4
    33    store ptr %1, ptr @__llgo_argv, align 8
    34    call void @"github.com/goplus/llgo/internal/runtime.init"()
    35    call void @main.init()
    36    %2 = call %"github.com/goplus/llgo/internal/runtime.String" @main.hello()
    37    %3 = extractvalue %"github.com/goplus/llgo/internal/runtime.String" %2, 1
    38    %4 = add i64 %3, 1
    39    %5 = alloca i8, i64 %4, align 1
    40    %6 = call ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr %5, %"github.com/goplus/llgo/internal/runtime.String" %2)
    41    %7 = call i32 (ptr, ...) @printf(ptr %6)
    42    ret i32 0
    43  }
    44  
    45  declare %"github.com/goplus/llgo/internal/runtime.String" @"github.com/goplus/llgo/internal/runtime.NewString"(ptr, i64)
    46  
    47  declare void @"github.com/goplus/llgo/internal/runtime.init"()
    48  
    49  declare ptr @"github.com/goplus/llgo/internal/runtime.CStrCopy"(ptr, %"github.com/goplus/llgo/internal/runtime.String")
    50  
    51  declare i32 @printf(ptr, ...)