github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/compiler/testdata/goroutine-cortex-m-qemu-tasks.ll (about)

     1  ; ModuleID = 'goroutine.go'
     2  source_filename = "goroutine.go"
     3  target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
     4  target triple = "thumbv7m-unknown-unknown-eabi"
     5  
     6  %runtime._string = type { ptr, i32 }
     7  
     8  @"main$string" = internal unnamed_addr constant [4 x i8] c"test", align 1
     9  
    10  ; Function Attrs: allockind("alloc,zeroed") allocsize(0)
    11  declare noalias nonnull ptr @runtime.alloc(i32, ptr, ptr) #0
    12  
    13  ; Function Attrs: nounwind
    14  define hidden void @main.init(ptr %context) unnamed_addr #1 {
    15  entry:
    16    ret void
    17  }
    18  
    19  ; Function Attrs: nounwind
    20  define hidden void @main.regularFunctionGoroutine(ptr %context) unnamed_addr #1 {
    21  entry:
    22    %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (ptr @"main.regularFunction$gowrapper" to i32), ptr undef) #9
    23    call void @"internal/task.start"(i32 ptrtoint (ptr @"main.regularFunction$gowrapper" to i32), ptr nonnull inttoptr (i32 5 to ptr), i32 %stacksize, ptr undef) #9
    24    ret void
    25  }
    26  
    27  declare void @main.regularFunction(i32, ptr) #2
    28  
    29  ; Function Attrs: nounwind
    30  define linkonce_odr void @"main.regularFunction$gowrapper"(ptr %0) unnamed_addr #3 {
    31  entry:
    32    %unpack.int = ptrtoint ptr %0 to i32
    33    call void @main.regularFunction(i32 %unpack.int, ptr undef) #9
    34    ret void
    35  }
    36  
    37  declare i32 @"internal/task.getGoroutineStackSize"(i32, ptr) #2
    38  
    39  declare void @"internal/task.start"(i32, ptr, i32, ptr) #2
    40  
    41  ; Function Attrs: nounwind
    42  define hidden void @main.inlineFunctionGoroutine(ptr %context) unnamed_addr #1 {
    43  entry:
    44    %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (ptr @"main.inlineFunctionGoroutine$1$gowrapper" to i32), ptr undef) #9
    45    call void @"internal/task.start"(i32 ptrtoint (ptr @"main.inlineFunctionGoroutine$1$gowrapper" to i32), ptr nonnull inttoptr (i32 5 to ptr), i32 %stacksize, ptr undef) #9
    46    ret void
    47  }
    48  
    49  ; Function Attrs: nounwind
    50  define internal void @"main.inlineFunctionGoroutine$1"(i32 %x, ptr %context) unnamed_addr #1 {
    51  entry:
    52    ret void
    53  }
    54  
    55  ; Function Attrs: nounwind
    56  define linkonce_odr void @"main.inlineFunctionGoroutine$1$gowrapper"(ptr %0) unnamed_addr #4 {
    57  entry:
    58    %unpack.int = ptrtoint ptr %0 to i32
    59    call void @"main.inlineFunctionGoroutine$1"(i32 %unpack.int, ptr undef)
    60    ret void
    61  }
    62  
    63  ; Function Attrs: nounwind
    64  define hidden void @main.closureFunctionGoroutine(ptr %context) unnamed_addr #1 {
    65  entry:
    66    %n = call dereferenceable(4) ptr @runtime.alloc(i32 4, ptr nonnull inttoptr (i32 3 to ptr), ptr undef) #9
    67    store i32 3, ptr %n, align 4
    68    %0 = call dereferenceable(8) ptr @runtime.alloc(i32 8, ptr null, ptr undef) #9
    69    store i32 5, ptr %0, align 4
    70    %1 = getelementptr inbounds { i32, ptr }, ptr %0, i32 0, i32 1
    71    store ptr %n, ptr %1, align 4
    72    %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (ptr @"main.closureFunctionGoroutine$1$gowrapper" to i32), ptr undef) #9
    73    call void @"internal/task.start"(i32 ptrtoint (ptr @"main.closureFunctionGoroutine$1$gowrapper" to i32), ptr nonnull %0, i32 %stacksize, ptr undef) #9
    74    %2 = load i32, ptr %n, align 4
    75    call void @runtime.printint32(i32 %2, ptr undef) #9
    76    ret void
    77  }
    78  
    79  ; Function Attrs: nounwind
    80  define internal void @"main.closureFunctionGoroutine$1"(i32 %x, ptr %context) unnamed_addr #1 {
    81  entry:
    82    store i32 7, ptr %context, align 4
    83    ret void
    84  }
    85  
    86  ; Function Attrs: nounwind
    87  define linkonce_odr void @"main.closureFunctionGoroutine$1$gowrapper"(ptr %0) unnamed_addr #5 {
    88  entry:
    89    %1 = load i32, ptr %0, align 4
    90    %2 = getelementptr inbounds { i32, ptr }, ptr %0, i32 0, i32 1
    91    %3 = load ptr, ptr %2, align 4
    92    call void @"main.closureFunctionGoroutine$1"(i32 %1, ptr %3)
    93    ret void
    94  }
    95  
    96  declare void @runtime.printint32(i32, ptr) #2
    97  
    98  ; Function Attrs: nounwind
    99  define hidden void @main.funcGoroutine(ptr %fn.context, ptr %fn.funcptr, ptr %context) unnamed_addr #1 {
   100  entry:
   101    %0 = call dereferenceable(12) ptr @runtime.alloc(i32 12, ptr null, ptr undef) #9
   102    store i32 5, ptr %0, align 4
   103    %1 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 1
   104    store ptr %fn.context, ptr %1, align 4
   105    %2 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 2
   106    store ptr %fn.funcptr, ptr %2, align 4
   107    %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (ptr @main.funcGoroutine.gowrapper to i32), ptr undef) #9
   108    call void @"internal/task.start"(i32 ptrtoint (ptr @main.funcGoroutine.gowrapper to i32), ptr nonnull %0, i32 %stacksize, ptr undef) #9
   109    ret void
   110  }
   111  
   112  ; Function Attrs: nounwind
   113  define linkonce_odr void @main.funcGoroutine.gowrapper(ptr %0) unnamed_addr #6 {
   114  entry:
   115    %1 = load i32, ptr %0, align 4
   116    %2 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 1
   117    %3 = load ptr, ptr %2, align 4
   118    %4 = getelementptr inbounds { i32, ptr, ptr }, ptr %0, i32 0, i32 2
   119    %5 = load ptr, ptr %4, align 4
   120    call void %5(i32 %1, ptr %3) #9
   121    ret void
   122  }
   123  
   124  ; Function Attrs: nounwind
   125  define hidden void @main.recoverBuiltinGoroutine(ptr %context) unnamed_addr #1 {
   126  entry:
   127    ret void
   128  }
   129  
   130  ; Function Attrs: nounwind
   131  define hidden void @main.copyBuiltinGoroutine(ptr %dst.data, i32 %dst.len, i32 %dst.cap, ptr %src.data, i32 %src.len, i32 %src.cap, ptr %context) unnamed_addr #1 {
   132  entry:
   133    %copy.n = call i32 @runtime.sliceCopy(ptr %dst.data, ptr %src.data, i32 %dst.len, i32 %src.len, i32 1, ptr undef) #9
   134    ret void
   135  }
   136  
   137  declare i32 @runtime.sliceCopy(ptr nocapture writeonly, ptr nocapture readonly, i32, i32, i32, ptr) #2
   138  
   139  ; Function Attrs: nounwind
   140  define hidden void @main.closeBuiltinGoroutine(ptr dereferenceable_or_null(32) %ch, ptr %context) unnamed_addr #1 {
   141  entry:
   142    call void @runtime.chanClose(ptr %ch, ptr undef) #9
   143    ret void
   144  }
   145  
   146  declare void @runtime.chanClose(ptr dereferenceable_or_null(32), ptr) #2
   147  
   148  ; Function Attrs: nounwind
   149  define hidden void @main.startInterfaceMethod(ptr %itf.typecode, ptr %itf.value, ptr %context) unnamed_addr #1 {
   150  entry:
   151    %0 = call dereferenceable(16) ptr @runtime.alloc(i32 16, ptr null, ptr undef) #9
   152    store ptr %itf.value, ptr %0, align 4
   153    %1 = getelementptr inbounds { ptr, %runtime._string, ptr }, ptr %0, i32 0, i32 1
   154    store ptr @"main$string", ptr %1, align 4
   155    %.repack1 = getelementptr inbounds { ptr, %runtime._string, ptr }, ptr %0, i32 0, i32 1, i32 1
   156    store i32 4, ptr %.repack1, align 4
   157    %2 = getelementptr inbounds { ptr, %runtime._string, ptr }, ptr %0, i32 0, i32 2
   158    store ptr %itf.typecode, ptr %2, align 4
   159    %stacksize = call i32 @"internal/task.getGoroutineStackSize"(i32 ptrtoint (ptr @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), ptr undef) #9
   160    call void @"internal/task.start"(i32 ptrtoint (ptr @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper" to i32), ptr nonnull %0, i32 %stacksize, ptr undef) #9
   161    ret void
   162  }
   163  
   164  declare void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(ptr, ptr, i32, ptr, ptr) #7
   165  
   166  ; Function Attrs: nounwind
   167  define linkonce_odr void @"interface:{Print:func:{basic:string}{}}.Print$invoke$gowrapper"(ptr %0) unnamed_addr #8 {
   168  entry:
   169    %1 = load ptr, ptr %0, align 4
   170    %2 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 1
   171    %3 = load ptr, ptr %2, align 4
   172    %4 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 2
   173    %5 = load i32, ptr %4, align 4
   174    %6 = getelementptr inbounds { ptr, ptr, i32, ptr }, ptr %0, i32 0, i32 3
   175    %7 = load ptr, ptr %6, align 4
   176    call void @"interface:{Print:func:{basic:string}{}}.Print$invoke"(ptr %1, ptr %3, i32 %5, ptr %7, ptr undef) #9
   177    ret void
   178  }
   179  
   180  attributes #0 = { allockind("alloc,zeroed") allocsize(0) "alloc-family"="runtime.alloc" "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
   181  attributes #1 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
   182  attributes #2 = { "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" }
   183  attributes #3 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="main.regularFunction" }
   184  attributes #4 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="main.inlineFunctionGoroutine$1" }
   185  attributes #5 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="main.closureFunctionGoroutine$1" }
   186  attributes #6 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper" }
   187  attributes #7 = { "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-invoke"="reflect/methods.Print(string)" "tinygo-methods"="reflect/methods.Print(string)" }
   188  attributes #8 = { nounwind "target-features"="+armv7-m,+hwdiv,+soft-float,+strict-align,+thumb-mode,-aes,-bf16,-cdecp0,-cdecp1,-cdecp2,-cdecp3,-cdecp4,-cdecp5,-cdecp6,-cdecp7,-crc,-crypto,-d32,-dotprod,-dsp,-fp-armv8,-fp-armv8d16,-fp-armv8d16sp,-fp-armv8sp,-fp16,-fp16fml,-fp64,-fpregs,-fullfp16,-hwdiv-arm,-i8mm,-lob,-mve,-mve.fp,-neon,-pacbti,-ras,-sb,-sha2,-vfp2,-vfp2sp,-vfp3,-vfp3d16,-vfp3d16sp,-vfp3sp,-vfp4,-vfp4d16,-vfp4d16sp,-vfp4sp" "tinygo-gowrapper"="interface:{Print:func:{basic:string}{}}.Print$invoke" }
   189  attributes #9 = { nounwind }