github.com/goplus/llgo@v0.8.3/cl/_testpy/callpy/out.ll (about)

     1  ; ModuleID = 'main'
     2  source_filename = "main"
     3  
     4  @"main.init$guard" = global ptr null
     5  @__llgo_argc = global ptr null
     6  @__llgo_argv = global ptr null
     7  @__llgo_py.math.sqrt = linkonce global ptr null
     8  @__llgo_py.os.getcwd = linkonce global ptr null
     9  @0 = private unnamed_addr constant [14 x i8] c"sqrt(2) = %f\0A\00", align 1
    10  @1 = private unnamed_addr constant [10 x i8] c"cwd = %s\0A\00", align 1
    11  @__llgo_py.math = external global ptr
    12  @2 = private unnamed_addr constant [5 x i8] c"sqrt\00", align 1
    13  @__llgo_py.os = external global ptr
    14  @3 = private unnamed_addr constant [7 x i8] c"getcwd\00", align 1
    15  
    16  define void @main.init() {
    17  _llgo_0:
    18    %0 = load i1, ptr @"main.init$guard", align 1
    19    br i1 %0, label %_llgo_2, label %_llgo_1
    20  
    21  _llgo_1:                                          ; preds = %_llgo_0
    22    store i1 true, ptr @"main.init$guard", align 1
    23    call void @"github.com/goplus/llgo/py/math.init"()
    24    call void @"github.com/goplus/llgo/py/os.init"()
    25    %1 = load ptr, ptr @__llgo_py.math, align 8
    26    call void (ptr, ...) @llgoLoadPyModSyms(ptr %1, ptr @2, ptr @__llgo_py.math.sqrt, ptr null)
    27    %2 = load ptr, ptr @__llgo_py.os, align 8
    28    call void (ptr, ...) @llgoLoadPyModSyms(ptr %2, ptr @3, ptr @__llgo_py.os.getcwd, ptr null)
    29    br label %_llgo_2
    30  
    31  _llgo_2:                                          ; preds = %_llgo_1, %_llgo_0
    32    ret void
    33  }
    34  
    35  define i32 @main(i32 %0, ptr %1) {
    36  _llgo_0:
    37    call void @Py_Initialize()
    38    store i32 %0, ptr @__llgo_argc, align 4
    39    store ptr %1, ptr @__llgo_argv, align 8
    40    call void @"github.com/goplus/llgo/internal/runtime.init"()
    41    call void @main.init()
    42    %2 = call ptr @PyFloat_FromDouble(double 2.000000e+00)
    43    %3 = load ptr, ptr @__llgo_py.math.sqrt, align 8
    44    %4 = call ptr @PyObject_CallOneArg(ptr %3, ptr %2)
    45    %5 = load ptr, ptr @__llgo_py.os.getcwd, align 8
    46    %6 = call ptr @PyObject_CallNoArgs(ptr %5)
    47    %7 = call double @PyFloat_AsDouble(ptr %4)
    48    %8 = call i32 (ptr, ...) @printf(ptr @0, double %7)
    49    %9 = call ptr @PyUnicode_AsUTF8(ptr %6)
    50    %10 = call i32 (ptr, ...) @printf(ptr @1, ptr %9)
    51    ret i32 0
    52  }
    53  
    54  declare void @"github.com/goplus/llgo/py/math.init"()
    55  
    56  declare void @"github.com/goplus/llgo/py/os.init"()
    57  
    58  declare void @"github.com/goplus/llgo/internal/runtime.init"()
    59  
    60  declare ptr @PyFloat_FromDouble(double)
    61  
    62  declare ptr @PyObject_CallOneArg(ptr, ptr)
    63  
    64  declare ptr @PyObject_CallNoArgs(ptr)
    65  
    66  declare double @PyFloat_AsDouble(ptr)
    67  
    68  declare i32 @printf(ptr, ...)
    69  
    70  declare ptr @PyUnicode_AsUTF8(ptr)
    71  
    72  declare void @llgoLoadPyModSyms(ptr, ...)
    73  
    74  declare void @Py_Initialize()