aboutsummaryrefslogtreecommitdiffhomepage
path: root/interp/testdata/basic.out.ll
blob: 2685850eb25934431721fca3055c2f366ae22c72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64--linux"

@main.nonConst1 = local_unnamed_addr global [4 x i64] zeroinitializer
@main.nonConst2 = local_unnamed_addr global i64 0
@main.someArray = global [8 x { i16, i32 }] zeroinitializer
@main.exportedValue = global [1 x ptr] [ptr @main.exposedValue1]
@main.exportedConst = constant i64 42
@main.exposedValue1 = global i16 0
@main.exposedValue2 = local_unnamed_addr global i16 0
@main.insertedValue = local_unnamed_addr global { i8, i32, { float, { i64, i16 } } } zeroinitializer
@main.gepArray = local_unnamed_addr global [8 x i8] zeroinitializer
@main.negativeGEP = global ptr getelementptr inbounds (i8, ptr @main.negativeGEP, i64 2)

declare void @runtime.printint64(i64) unnamed_addr

declare void @runtime.printnl() unnamed_addr

define void @runtime.initAll() unnamed_addr {
entry:
  call void @runtime.printint64(i64 5)
  call void @runtime.printnl()
  %value1 = call i64 @someValue()
  store i64 %value1, ptr @main.nonConst1, align 8
  %value2 = load i64, ptr @main.nonConst1, align 8
  store i64 %value2, ptr @main.nonConst2, align 8
  call void @modifyExternal(ptr getelementptr inbounds (i8, ptr @main.someArray, i32 28))
  call void @modifyExternal(ptr @main.exportedValue)
  store i16 5, ptr @main.exposedValue1, align 2
  call void @readExternal(ptr @main.exportedConst)
  call void @runtime.printint64(i64 42)
  call void @modifyExternal(ptr @willModifyGlobal)
  store i16 7, ptr @main.exposedValue2, align 2
  call void @modifyExternal(ptr @hasInlineAsm)
  call void @runtime.printint64(i64 6)
  call void @runtime.printint64(i64 -1)
  %agg = call { i8, i32, { float, { i64, i16 } } } @nestedStruct()
  %elt.agg = extractvalue { i8, i32, { float, { i64, i16 } } } %agg, 2
  %elt.agg1 = extractvalue { float, { i64, i16 } } %elt.agg, 1
  %elt = extractvalue { i64, i16 } %elt.agg1, 0
  call void @runtime.printint64(i64 %elt)
  %agg2.agg0 = extractvalue { i8, i32, { float, { i64, i16 } } } %agg, 2
  %agg2.agg1 = extractvalue { float, { i64, i16 } } %agg2.agg0, 1
  %agg2.insertvalue2 = insertvalue { i64, i16 } %agg2.agg1, i64 5, 0
  %agg2.insertvalue1 = insertvalue { float, { i64, i16 } } %agg2.agg0, { i64, i16 } %agg2.insertvalue2, 1
  %agg2.insertvalue0 = insertvalue { i8, i32, { float, { i64, i16 } } } %agg, { float, { i64, i16 } } %agg2.insertvalue1, 2
  store { i8, i32, { float, { i64, i16 } } } %agg2.insertvalue0, ptr @main.insertedValue, align 8
  ret void
}

define void @main() unnamed_addr {
entry:
  call void @runtime.printint64(i64 3)
  call void @runtime.printnl()
  ret void
}

declare i64 @someValue() local_unnamed_addr

declare void @modifyExternal(ptr) local_unnamed_addr

declare void @readExternal(ptr) local_unnamed_addr

define void @willModifyGlobal() {
entry:
  store i16 8, ptr @main.exposedValue2, align 2
  ret void
}

define void @hasInlineAsm() {
entry:
  call void asm sideeffect "", ""()
  ret void
}

define i64 @testSwitch(i64 %val) local_unnamed_addr {
entry:
  switch i64 %val, label %otherwise [
    i64 0, label %zero
    i64 1, label %one
    i64 2, label %two
  ]

zero:                                             ; preds = %entry
  ret i64 5

one:                                              ; preds = %entry
  ret i64 6

two:                                              ; preds = %entry
  ret i64 7

otherwise:                                        ; preds = %entry
  ret i64 -1
}

declare { i8, i32, { float, { i64, i16 } } } @nestedStruct() local_unnamed_addr