annotate clang/test/CodeGen/arm64-microsoft-arguments.cpp @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 0572611fdcc8
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -triple aarch64-windows -ffreestanding -emit-llvm -O0 \
anatofuz
parents:
diff changeset
2 // RUN: -x c++ -o - %s | FileCheck %s
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 // Pass and return for type size <= 8 bytes.
anatofuz
parents:
diff changeset
5 // CHECK: define {{.*}} i64 @{{.*}}f1{{.*}}()
anatofuz
parents:
diff changeset
6 // CHECK: call i64 {{.*}}func1{{.*}}(i64 %3)
anatofuz
parents:
diff changeset
7 struct S1 {
anatofuz
parents:
diff changeset
8 int a[2];
anatofuz
parents:
diff changeset
9 };
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 S1 func1(S1 x);
anatofuz
parents:
diff changeset
12 S1 f1() {
anatofuz
parents:
diff changeset
13 S1 x;
anatofuz
parents:
diff changeset
14 return func1(x);
anatofuz
parents:
diff changeset
15 }
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 // Pass and return type size <= 16 bytes.
anatofuz
parents:
diff changeset
18 // CHECK: define {{.*}} [2 x i64] @{{.*}}f2{{.*}}()
anatofuz
parents:
diff changeset
19 // CHECK: call [2 x i64] {{.*}}func2{{.*}}([2 x i64] %3)
anatofuz
parents:
diff changeset
20 struct S2 {
anatofuz
parents:
diff changeset
21 int a[4];
anatofuz
parents:
diff changeset
22 };
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 S2 func2(S2 x);
anatofuz
parents:
diff changeset
25 S2 f2() {
anatofuz
parents:
diff changeset
26 S2 x;
anatofuz
parents:
diff changeset
27 return func2(x);
anatofuz
parents:
diff changeset
28 }
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 // Pass and return for type size > 16 bytes.
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
31 // CHECK: define {{.*}} void @{{.*}}f3{{.*}}(%struct.S3* noalias sret(%struct.S3) align 4 %agg.result)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
32 // CHECK: call void {{.*}}func3{{.*}}(%struct.S3* sret(%struct.S3) align 4 %agg.result, %struct.S3* %agg.tmp)
150
anatofuz
parents:
diff changeset
33 struct S3 {
anatofuz
parents:
diff changeset
34 int a[5];
anatofuz
parents:
diff changeset
35 };
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 S3 func3(S3 x);
anatofuz
parents:
diff changeset
38 S3 f3() {
anatofuz
parents:
diff changeset
39 S3 x;
anatofuz
parents:
diff changeset
40 return func3(x);
anatofuz
parents:
diff changeset
41 }
anatofuz
parents:
diff changeset
42
anatofuz
parents:
diff changeset
43 // Pass and return aggregate (of size < 16 bytes) with non-trivial destructor.
anatofuz
parents:
diff changeset
44 // Passed directly but returned indirectly.
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
45 // CHECK: define {{.*}} void {{.*}}f4{{.*}}(%struct.S4* inreg noalias sret(%struct.S4) align 4 %agg.result)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
46 // CHECK: call void {{.*}}func4{{.*}}(%struct.S4* inreg sret(%struct.S4) align 4 %agg.result, [2 x i64] %5)
150
anatofuz
parents:
diff changeset
47 struct S4 {
anatofuz
parents:
diff changeset
48 int a[3];
anatofuz
parents:
diff changeset
49 ~S4();
anatofuz
parents:
diff changeset
50 };
anatofuz
parents:
diff changeset
51
anatofuz
parents:
diff changeset
52 S4 func4(S4 x);
anatofuz
parents:
diff changeset
53 S4 f4() {
anatofuz
parents:
diff changeset
54 S4 x;
anatofuz
parents:
diff changeset
55 return func4(x);
anatofuz
parents:
diff changeset
56 }
anatofuz
parents:
diff changeset
57
anatofuz
parents:
diff changeset
58 // Pass and return from instance method called from instance method.
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
59 // CHECK: define {{.*}} void @{{.*}}bar@Q1{{.*}}(%class.Q1* {{[^,]*}} %this, %class.P1* inreg noalias sret(%class.P1) align 1 %agg.result)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
60 // CHECK: call void {{.*}}foo@P1{{.*}}(%class.P1* {{[^,]*}} %ref.tmp, %class.P1* inreg sret(%class.P1) align 1 %agg.result, i8 %1)
150
anatofuz
parents:
diff changeset
61
anatofuz
parents:
diff changeset
62 class P1 {
anatofuz
parents:
diff changeset
63 public:
anatofuz
parents:
diff changeset
64 P1 foo(P1 x);
anatofuz
parents:
diff changeset
65 };
anatofuz
parents:
diff changeset
66
anatofuz
parents:
diff changeset
67 class Q1 {
anatofuz
parents:
diff changeset
68 public:
anatofuz
parents:
diff changeset
69 P1 bar();
anatofuz
parents:
diff changeset
70 };
anatofuz
parents:
diff changeset
71
anatofuz
parents:
diff changeset
72 P1 Q1::bar() {
anatofuz
parents:
diff changeset
73 P1 p1;
anatofuz
parents:
diff changeset
74 return P1().foo(p1);
anatofuz
parents:
diff changeset
75 }
anatofuz
parents:
diff changeset
76
anatofuz
parents:
diff changeset
77 // Pass and return from instance method called from free function.
anatofuz
parents:
diff changeset
78 // CHECK: define {{.*}} void {{.*}}bar{{.*}}()
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
79 // CHECK: call void {{.*}}foo@P2{{.*}}(%class.P2* {{[^,]*}} %ref.tmp, %class.P2* inreg sret(%class.P2) align 1 %retval, i8 %0)
150
anatofuz
parents:
diff changeset
80 class P2 {
anatofuz
parents:
diff changeset
81 public:
anatofuz
parents:
diff changeset
82 P2 foo(P2 x);
anatofuz
parents:
diff changeset
83 };
anatofuz
parents:
diff changeset
84
anatofuz
parents:
diff changeset
85 P2 bar() {
anatofuz
parents:
diff changeset
86 P2 p2;
anatofuz
parents:
diff changeset
87 return P2().foo(p2);
anatofuz
parents:
diff changeset
88 }
anatofuz
parents:
diff changeset
89
anatofuz
parents:
diff changeset
90 // Pass and return an object with a user-provided constructor (passed directly,
anatofuz
parents:
diff changeset
91 // returned indirectly)
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
92 // CHECK: define {{.*}} void @{{.*}}f5{{.*}}(%struct.S5* inreg noalias sret(%struct.S5) align 4 %agg.result)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
93 // CHECK: call void {{.*}}func5{{.*}}(%struct.S5* inreg sret(%struct.S5) align 4 %agg.result, i64 {{.*}})
150
anatofuz
parents:
diff changeset
94 struct S5 {
anatofuz
parents:
diff changeset
95 S5();
anatofuz
parents:
diff changeset
96 int x;
anatofuz
parents:
diff changeset
97 };
anatofuz
parents:
diff changeset
98
anatofuz
parents:
diff changeset
99 S5 func5(S5 x);
anatofuz
parents:
diff changeset
100 S5 f5() {
anatofuz
parents:
diff changeset
101 S5 x;
anatofuz
parents:
diff changeset
102 return func5(x);
anatofuz
parents:
diff changeset
103 }
anatofuz
parents:
diff changeset
104
anatofuz
parents:
diff changeset
105 // Pass and return an object with a non-trivial explicitly defaulted constructor
anatofuz
parents:
diff changeset
106 // (passed directly, returned directly)
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
107 // CHECK: define {{.*}} i8 @"?f6@@YA?AUS6@@XZ"()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
108 // CHECK: call i8 {{.*}}func6{{.*}}(i64 {{.*}})
150
anatofuz
parents:
diff changeset
109 struct S6a {
anatofuz
parents:
diff changeset
110 S6a();
anatofuz
parents:
diff changeset
111 };
anatofuz
parents:
diff changeset
112
anatofuz
parents:
diff changeset
113 struct S6 {
anatofuz
parents:
diff changeset
114 S6() = default;
anatofuz
parents:
diff changeset
115 S6a x;
anatofuz
parents:
diff changeset
116 };
anatofuz
parents:
diff changeset
117
anatofuz
parents:
diff changeset
118 S6 func6(S6 x);
anatofuz
parents:
diff changeset
119 S6 f6() {
anatofuz
parents:
diff changeset
120 S6 x;
anatofuz
parents:
diff changeset
121 return func6(x);
anatofuz
parents:
diff changeset
122 }
anatofuz
parents:
diff changeset
123
anatofuz
parents:
diff changeset
124 // Pass and return an object with a non-trivial implicitly defaulted constructor
anatofuz
parents:
diff changeset
125 // (passed directly, returned directly)
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
126 // CHECK: define {{.*}} i8 @"?f7@@YA?AUS7@@XZ"()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
127 // CHECK: call i8 {{.*}}func7{{.*}}(i64 {{.*}})
150
anatofuz
parents:
diff changeset
128 struct S7 {
anatofuz
parents:
diff changeset
129 S6a x;
anatofuz
parents:
diff changeset
130 };
anatofuz
parents:
diff changeset
131
anatofuz
parents:
diff changeset
132 S7 func7(S7 x);
anatofuz
parents:
diff changeset
133 S7 f7() {
anatofuz
parents:
diff changeset
134 S7 x;
anatofuz
parents:
diff changeset
135 return func7(x);
anatofuz
parents:
diff changeset
136 }
anatofuz
parents:
diff changeset
137
anatofuz
parents:
diff changeset
138 struct S8a {
anatofuz
parents:
diff changeset
139 ~S8a();
anatofuz
parents:
diff changeset
140 };
anatofuz
parents:
diff changeset
141
anatofuz
parents:
diff changeset
142 // Pass and return an object with a non-trivial default destructor (passed
anatofuz
parents:
diff changeset
143 // directly, returne indirectly)
anatofuz
parents:
diff changeset
144 struct S8 {
anatofuz
parents:
diff changeset
145 S8a x;
anatofuz
parents:
diff changeset
146 int y;
anatofuz
parents:
diff changeset
147 };
anatofuz
parents:
diff changeset
148
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
149 // CHECK: define {{.*}} void {{.*}}?f8{{.*}}(%struct.S8* inreg noalias sret(%struct.S8) align 4 {{.*}})
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
150 // CHECK: call void {{.*}}func8{{.*}}(%struct.S8* inreg sret(%struct.S8) align 4 {{.*}}, i64 {{.*}})
150
anatofuz
parents:
diff changeset
151 S8 func8(S8 x);
anatofuz
parents:
diff changeset
152 S8 f8() {
anatofuz
parents:
diff changeset
153 S8 x;
anatofuz
parents:
diff changeset
154 return func8(x);
anatofuz
parents:
diff changeset
155 }
anatofuz
parents:
diff changeset
156
anatofuz
parents:
diff changeset
157
anatofuz
parents:
diff changeset
158 // Pass and return an object with a non-trivial copy-assignment operator and
anatofuz
parents:
diff changeset
159 // a trivial copy constructor (passed directly, returned indirectly)
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
160 // CHECK: define {{.*}} void @"?f9@@YA?AUS9@@XZ"(%struct.S9* inreg noalias sret(%struct.S9) align 4 {{.*}})
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
161 // CHECK: call void {{.*}}func9{{.*}}(%struct.S9* inreg sret(%struct.S9) align 4 {{.*}}, i64 {{.*}})
150
anatofuz
parents:
diff changeset
162 struct S9 {
anatofuz
parents:
diff changeset
163 S9& operator=(const S9&);
anatofuz
parents:
diff changeset
164 int x;
anatofuz
parents:
diff changeset
165 };
anatofuz
parents:
diff changeset
166
anatofuz
parents:
diff changeset
167 S9 func9(S9 x);
anatofuz
parents:
diff changeset
168 S9 f9() {
anatofuz
parents:
diff changeset
169 S9 x;
anatofuz
parents:
diff changeset
170 S9 y = x;
anatofuz
parents:
diff changeset
171 x = y;
anatofuz
parents:
diff changeset
172 return func9(x);
anatofuz
parents:
diff changeset
173 }
anatofuz
parents:
diff changeset
174
anatofuz
parents:
diff changeset
175 // Pass and return an object with a base class (passed directly, returned
anatofuz
parents:
diff changeset
176 // indirectly).
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
177 // CHECK: define dso_local void {{.*}}f10{{.*}}(%struct.S10* inreg noalias sret(%struct.S10) align 4 {{.*}})
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
178 // CHECK: call void {{.*}}func10{{.*}}(%struct.S10* inreg sret(%struct.S10) align 4 {{.*}}, [2 x i64] {{.*}})
150
anatofuz
parents:
diff changeset
179 struct S10 : public S1 {
anatofuz
parents:
diff changeset
180 int x;
anatofuz
parents:
diff changeset
181 };
anatofuz
parents:
diff changeset
182
anatofuz
parents:
diff changeset
183 S10 func10(S10 x);
anatofuz
parents:
diff changeset
184 S10 f10() {
anatofuz
parents:
diff changeset
185 S10 x;
anatofuz
parents:
diff changeset
186 return func10(x);
anatofuz
parents:
diff changeset
187 }
anatofuz
parents:
diff changeset
188
anatofuz
parents:
diff changeset
189
anatofuz
parents:
diff changeset
190 // Pass and return a non aggregate object exceeding > 128 bits (passed
anatofuz
parents:
diff changeset
191 // indirectly, returned indirectly)
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
192 // CHECK: define dso_local void {{.*}}f11{{.*}}(%struct.S11* inreg noalias sret(%struct.S11) align 8 {{.*}})
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 173
diff changeset
193 // CHECK: call void {{.*}}func11{{.*}}(%struct.S11* inreg sret(%struct.S11) align 8 {{.*}}, %struct.S11* {{.*}})
150
anatofuz
parents:
diff changeset
194 struct S11 {
anatofuz
parents:
diff changeset
195 virtual void f();
anatofuz
parents:
diff changeset
196 int a[5];
anatofuz
parents:
diff changeset
197 };
anatofuz
parents:
diff changeset
198
anatofuz
parents:
diff changeset
199 S11 func11(S11 x);
anatofuz
parents:
diff changeset
200 S11 f11() {
anatofuz
parents:
diff changeset
201 S11 x;
anatofuz
parents:
diff changeset
202 return func11(x);
anatofuz
parents:
diff changeset
203 }