github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/interp/testdata/revert.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 @foo.knownAtRuntime = local_unnamed_addr global i64 0 5 @bar.knownAtRuntime = local_unnamed_addr global i64 0 6 @baz.someGlobal = external local_unnamed_addr global [3 x { i64, i32 }] 7 @baz.someInt = local_unnamed_addr global i32 0 8 @x.atomicNum = local_unnamed_addr global i32 0 9 @x.volatileNum = global i32 0 10 @y.ready = local_unnamed_addr global i32 0 11 @z.bloom = global i64 0 12 @z.arr = global [32 x i8] zeroinitializer 13 14 declare void @externalCall(i64) local_unnamed_addr 15 16 declare i64 @ptrHash(ptr nocapture) local_unnamed_addr 17 18 define void @runtime.initAll() unnamed_addr { 19 entry: 20 call fastcc void @baz.init(ptr undef) 21 call fastcc void @foo.init(ptr undef) 22 %val = load i64, ptr @foo.knownAtRuntime, align 8 23 store i64 %val, ptr @bar.knownAtRuntime, align 8 24 call void @externalCall(i64 3) 25 store atomic i32 1, ptr @x.atomicNum seq_cst, align 4 26 %x = load atomic i32, ptr @x.atomicNum seq_cst, align 4 27 store i32 %x, ptr @x.atomicNum, align 4 28 %y = load volatile i32, ptr @x.volatileNum, align 4 29 store volatile i32 %y, ptr @x.volatileNum, align 4 30 call fastcc void @y.init(ptr undef) 31 call fastcc void @z.set(ptr @z.bloom, ptr @z.bloom) 32 call fastcc void @z.setArr(ptr @z.arr, i64 32, ptr @z.bloom) 33 ret void 34 } 35 36 define internal fastcc void @foo.init(ptr %context) unnamed_addr { 37 store i64 5, ptr @foo.knownAtRuntime, align 8 38 unreachable 39 } 40 41 define internal fastcc void @baz.init(ptr %context) unnamed_addr { 42 unreachable 43 } 44 45 define internal fastcc void @y.init(ptr %context) unnamed_addr { 46 entry: 47 br label %loop 48 49 loop: ; preds = %loop, %entry 50 %val = load atomic i32, ptr @y.ready seq_cst, align 4 51 %ready = icmp eq i32 %val, 1 52 br i1 %ready, label %end, label %loop 53 54 end: ; preds = %loop 55 ret void 56 } 57 58 define internal fastcc void @z.setArr(ptr %arr, i64 %n, ptr %context) unnamed_addr { 59 entry: 60 br label %loop 61 62 loop: ; preds = %loop, %entry 63 %prev = phi i64 [ %n, %entry ], [ %idx, %loop ] 64 %idx = sub i64 %prev, 1 65 %elem = getelementptr i8, ptr %arr, i64 %idx 66 call fastcc void @z.set(ptr %elem, ptr %context) 67 %done = icmp eq i64 %idx, 0 68 br i1 %done, label %end, label %loop 69 70 end: ; preds = %loop 71 ret void 72 } 73 74 define internal fastcc void @z.set(ptr %ptr, ptr %context) unnamed_addr { 75 %hash = call i64 @ptrHash(ptr %ptr) 76 %index = lshr i64 %hash, 58 77 %bit = shl i64 1, %index 78 %old = load i64, ptr %context, align 8 79 %new = or i64 %old, %bit 80 store i64 %new, ptr %context, align 8 81 ret void 82 }