github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/transform/testdata/stringtobytes.out.ll (about)

     1  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
     2  target triple = "x86_64--linux"
     3  
     4  @str = constant [6 x i8] c"foobar"
     5  
     6  declare { ptr, i64, i64 } @runtime.stringToBytes(ptr, i64)
     7  
     8  declare void @printSlice(ptr nocapture readonly, i64, i64)
     9  
    10  declare void @writeToSlice(ptr nocapture, i64, i64)
    11  
    12  define void @testReadOnly() {
    13  entry:
    14    call fastcc void @printSlice(ptr @str, i64 6, i64 6)
    15    ret void
    16  }
    17  
    18  define void @testReadWrite() {
    19  entry:
    20    %0 = call fastcc { ptr, i64, i64 } @runtime.stringToBytes(ptr @str, i64 6)
    21    %1 = extractvalue { ptr, i64, i64 } %0, 0
    22    call fastcc void @writeToSlice(ptr %1, i64 6, i64 6)
    23    ret void
    24  }
    25  
    26  define void @testReadSome() {
    27  entry:
    28    %s = call fastcc { ptr, i64, i64 } @runtime.stringToBytes(ptr @str, i64 6)
    29    %s.ptr = extractvalue { ptr, i64, i64 } %s, 0
    30    call fastcc void @writeToSlice(ptr %s.ptr, i64 6, i64 6)
    31    %s.ptr2 = extractvalue { ptr, i64, i64 } %s, 0
    32    call fastcc void @printSlice(ptr %s.ptr2, i64 6, i64 6)
    33    ret void
    34  }