github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/interp/testdata/basic.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 @main.nonConst1 = local_unnamed_addr global [4 x i64] zeroinitializer 5 @main.nonConst2 = local_unnamed_addr global i64 0 6 @main.someArray = global [8 x { i16, i32 }] zeroinitializer 7 @main.exportedValue = global [1 x ptr] [ptr @main.exposedValue1] 8 @main.exportedConst = constant i64 42 9 @main.exposedValue1 = global i16 0 10 @main.exposedValue2 = local_unnamed_addr global i16 0 11 @main.insertedValue = local_unnamed_addr global { i8, i32, { float, { i64, i16 } } } zeroinitializer 12 @main.gepArray = local_unnamed_addr global [8 x i8] zeroinitializer 13 @main.negativeGEP = global ptr getelementptr inbounds (i8, ptr @main.negativeGEP, i64 2) 14 15 declare void @runtime.printint64(i64) unnamed_addr 16 17 declare void @runtime.printnl() unnamed_addr 18 19 define void @runtime.initAll() unnamed_addr { 20 entry: 21 call void @runtime.printint64(i64 5) 22 call void @runtime.printnl() 23 %value1 = call i64 @someValue() 24 store i64 %value1, ptr @main.nonConst1, align 8 25 %value2 = load i64, ptr @main.nonConst1, align 8 26 store i64 %value2, ptr @main.nonConst2, align 8 27 call void @modifyExternal(ptr getelementptr inbounds (i8, ptr @main.someArray, i32 28)) 28 call void @modifyExternal(ptr @main.exportedValue) 29 store i16 5, ptr @main.exposedValue1, align 2 30 call void @readExternal(ptr @main.exportedConst) 31 call void @runtime.printint64(i64 42) 32 call void @modifyExternal(ptr @willModifyGlobal) 33 store i16 7, ptr @main.exposedValue2, align 2 34 call void @modifyExternal(ptr @hasInlineAsm) 35 call void @runtime.printint64(i64 6) 36 call void @runtime.printint64(i64 -1) 37 %agg = call { i8, i32, { float, { i64, i16 } } } @nestedStruct() 38 %elt.agg = extractvalue { i8, i32, { float, { i64, i16 } } } %agg, 2 39 %elt.agg1 = extractvalue { float, { i64, i16 } } %elt.agg, 1 40 %elt = extractvalue { i64, i16 } %elt.agg1, 0 41 call void @runtime.printint64(i64 %elt) 42 %agg2.agg0 = extractvalue { i8, i32, { float, { i64, i16 } } } %agg, 2 43 %agg2.agg1 = extractvalue { float, { i64, i16 } } %agg2.agg0, 1 44 %agg2.insertvalue2 = insertvalue { i64, i16 } %agg2.agg1, i64 5, 0 45 %agg2.insertvalue1 = insertvalue { float, { i64, i16 } } %agg2.agg0, { i64, i16 } %agg2.insertvalue2, 1 46 %agg2.insertvalue0 = insertvalue { i8, i32, { float, { i64, i16 } } } %agg, { float, { i64, i16 } } %agg2.insertvalue1, 2 47 store { i8, i32, { float, { i64, i16 } } } %agg2.insertvalue0, ptr @main.insertedValue, align 8 48 ret void 49 } 50 51 define void @main() unnamed_addr { 52 entry: 53 call void @runtime.printint64(i64 3) 54 call void @runtime.printnl() 55 ret void 56 } 57 58 declare i64 @someValue() local_unnamed_addr 59 60 declare void @modifyExternal(ptr) local_unnamed_addr 61 62 declare void @readExternal(ptr) local_unnamed_addr 63 64 define void @willModifyGlobal() { 65 entry: 66 store i16 8, ptr @main.exposedValue2, align 2 67 ret void 68 } 69 70 define void @hasInlineAsm() { 71 entry: 72 call void asm sideeffect "", ""() 73 ret void 74 } 75 76 define i64 @testSwitch(i64 %val) local_unnamed_addr { 77 entry: 78 switch i64 %val, label %otherwise [ 79 i64 0, label %zero 80 i64 1, label %one 81 i64 2, label %two 82 ] 83 84 zero: ; preds = %entry 85 ret i64 5 86 87 one: ; preds = %entry 88 ret i64 6 89 90 two: ; preds = %entry 91 ret i64 7 92 93 otherwise: ; preds = %entry 94 ret i64 -1 95 } 96 97 declare { i8, i32, { float, { i64, i16 } } } @nestedStruct() local_unnamed_addr