1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Calling Convention Implementation Fragment *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9#ifndef GET_CC_REGISTER_LISTS
10
11static bool CC_Hexagon(unsigned ValNo, MVT ValVT,
12 MVT LocVT, CCValAssign::LocInfo LocInfo,
13 ISD::ArgFlagsTy ArgFlags, CCState &State);
14static bool CC_HexagonStack(unsigned ValNo, MVT ValVT,
15 MVT LocVT, CCValAssign::LocInfo LocInfo,
16 ISD::ArgFlagsTy ArgFlags, CCState &State);
17static bool CC_Hexagon_HVX(unsigned ValNo, MVT ValVT,
18 MVT LocVT, CCValAssign::LocInfo LocInfo,
19 ISD::ArgFlagsTy ArgFlags, CCState &State);
20static bool CC_Hexagon_Legacy(unsigned ValNo, MVT ValVT,
21 MVT LocVT, CCValAssign::LocInfo LocInfo,
22 ISD::ArgFlagsTy ArgFlags, CCState &State);
23static bool RetCC_Hexagon(unsigned ValNo, MVT ValVT,
24 MVT LocVT, CCValAssign::LocInfo LocInfo,
25 ISD::ArgFlagsTy ArgFlags, CCState &State);
26static bool RetCC_Hexagon_HVX(unsigned ValNo, MVT ValVT,
27 MVT LocVT, CCValAssign::LocInfo LocInfo,
28 ISD::ArgFlagsTy ArgFlags, CCState &State);
29
30
31static bool CC_Hexagon(unsigned ValNo, MVT ValVT,
32 MVT LocVT, CCValAssign::LocInfo LocInfo,
33 ISD::ArgFlagsTy ArgFlags, CCState &State) {
34
35 if (LocVT == MVT::i1 ||
36 LocVT == MVT::i8 ||
37 LocVT == MVT::i16) {
38 LocVT = MVT::i32;
39 if (ArgFlags.isSExt())
40 LocInfo = CCValAssign::SExt;
41 else if (ArgFlags.isZExt())
42 LocInfo = CCValAssign::ZExt;
43 else
44 LocInfo = CCValAssign::AExt;
45 }
46
47 if (LocVT == MVT::f32) {
48 LocVT = MVT::i32;
49 LocInfo = CCValAssign::BCvt;
50 }
51
52 if (LocVT == MVT::f64) {
53 LocVT = MVT::i64;
54 LocInfo = CCValAssign::BCvt;
55 }
56
57 if (ArgFlags.isByVal()) {
58 State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, MinSize: 8, MinAlign: Align(1), ArgFlags);
59 return false;
60 }
61
62 if (State.isVarArg() && ValNo >= static_cast<HexagonCCState&>(State).getNumNamedVarArgParams()) {
63 if (!CC_HexagonStack(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
64 return false;
65 }
66
67 if (LocVT == MVT::i32) {
68 if (ArgFlags.isSplit()) {
69 if (CC_SkipOdd(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
70 return false;
71 }
72 }
73
74 if (LocVT == MVT::i32 ||
75 LocVT == MVT::v2i16 ||
76 LocVT == MVT::v4i8) {
77 static const MCPhysReg RegList1[] = {
78 Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3, Hexagon::R4, Hexagon::R5
79 };
80 if (unsigned Reg = State.AllocateReg(Regs: RegList1)) {
81 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
82 return false;
83 }
84 }
85
86 if (LocVT == MVT::i64 ||
87 LocVT == MVT::v2i32 ||
88 LocVT == MVT::v4i16 ||
89 LocVT == MVT::v8i8) {
90 if (CC_SkipOdd(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
91 return false;
92 }
93
94 if (LocVT == MVT::i64 ||
95 LocVT == MVT::v2i32 ||
96 LocVT == MVT::v4i16 ||
97 LocVT == MVT::v8i8) {
98 static const MCPhysReg RegList2[] = {
99 Hexagon::D0, Hexagon::D1, Hexagon::D2
100 };
101 if (unsigned Reg = State.AllocateReg(Regs: RegList2)) {
102 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
103 return false;
104 }
105 }
106
107 if (!CC_HexagonStack(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
108 return false;
109
110 return true; // CC didn't match.
111}
112
113
114static bool CC_HexagonStack(unsigned ValNo, MVT ValVT,
115 MVT LocVT, CCValAssign::LocInfo LocInfo,
116 ISD::ArgFlagsTy ArgFlags, CCState &State) {
117
118 if (LocVT == MVT::i32 ||
119 LocVT == MVT::v2i16 ||
120 LocVT == MVT::v4i8) {
121 int64_t Offset1 = State.AllocateStack(Size: 4, Alignment: Align(4));
122 State.addLoc(V: CCValAssign::getMem(ValNo, ValVT, Offset: Offset1, LocVT, HTP: LocInfo));
123 return false;
124 }
125
126 if (LocVT == MVT::i64 ||
127 LocVT == MVT::v2i32 ||
128 LocVT == MVT::v4i16 ||
129 LocVT == MVT::v8i8) {
130 int64_t Offset2 = State.AllocateStack(Size: 8, Alignment: Align(8));
131 State.addLoc(V: CCValAssign::getMem(ValNo, ValVT, Offset: Offset2, LocVT, HTP: LocInfo));
132 return false;
133 }
134
135 return true; // CC didn't match.
136}
137
138
139static bool CC_Hexagon_HVX(unsigned ValNo, MVT ValVT,
140 MVT LocVT, CCValAssign::LocInfo LocInfo,
141 ISD::ArgFlagsTy ArgFlags, CCState &State) {
142
143 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX64BOps()) {
144 if (LocVT == MVT::v16i32 ||
145 LocVT == MVT::v32i16 ||
146 LocVT == MVT::v64i8) {
147 static const MCPhysReg RegList1[] = {
148 Hexagon::V0, Hexagon::V1, Hexagon::V2, Hexagon::V3, Hexagon::V4, Hexagon::V5, Hexagon::V6, Hexagon::V7, Hexagon::V8, Hexagon::V9, Hexagon::V10, Hexagon::V11, Hexagon::V12, Hexagon::V13, Hexagon::V14, Hexagon::V15
149 };
150 if (unsigned Reg = State.AllocateReg(Regs: RegList1)) {
151 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
152 return false;
153 }
154 }
155 }
156
157 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX64BOps()) {
158 if (LocVT == MVT::v32i32 ||
159 LocVT == MVT::v64i16 ||
160 LocVT == MVT::v128i8) {
161 static const MCPhysReg RegList2[] = {
162 Hexagon::W0, Hexagon::W1, Hexagon::W2, Hexagon::W3, Hexagon::W4, Hexagon::W5, Hexagon::W6, Hexagon::W7
163 };
164 if (unsigned Reg = State.AllocateReg(Regs: RegList2)) {
165 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
166 return false;
167 }
168 }
169 }
170
171 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX64BOps()) {
172 if (LocVT == MVT::v16i32 ||
173 LocVT == MVT::v32i16 ||
174 LocVT == MVT::v64i8) {
175 int64_t Offset3 = State.AllocateStack(Size: 64, Alignment: Align(64));
176 State.addLoc(V: CCValAssign::getMem(ValNo, ValVT, Offset: Offset3, LocVT, HTP: LocInfo));
177 return false;
178 }
179 }
180
181 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX64BOps()) {
182 if (LocVT == MVT::v32i32 ||
183 LocVT == MVT::v64i16 ||
184 LocVT == MVT::v128i8) {
185 int64_t Offset4 = State.AllocateStack(Size: 128, Alignment: Align(64));
186 State.addLoc(V: CCValAssign::getMem(ValNo, ValVT, Offset: Offset4, LocVT, HTP: LocInfo));
187 return false;
188 }
189 }
190
191 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX128BOps()) {
192 if (LocVT == MVT::v32i32 ||
193 LocVT == MVT::v64i16 ||
194 LocVT == MVT::v128i8 ||
195 LocVT == MVT::v32f32 ||
196 LocVT == MVT::v64f16) {
197 static const MCPhysReg RegList5[] = {
198 Hexagon::V0, Hexagon::V1, Hexagon::V2, Hexagon::V3, Hexagon::V4, Hexagon::V5, Hexagon::V6, Hexagon::V7, Hexagon::V8, Hexagon::V9, Hexagon::V10, Hexagon::V11, Hexagon::V12, Hexagon::V13, Hexagon::V14, Hexagon::V15
199 };
200 if (unsigned Reg = State.AllocateReg(Regs: RegList5)) {
201 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
202 return false;
203 }
204 }
205 }
206
207 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX128BOps()) {
208 if (LocVT == MVT::v64i32 ||
209 LocVT == MVT::v128i16 ||
210 LocVT == MVT::v256i8 ||
211 LocVT == MVT::v64f32 ||
212 LocVT == MVT::v128f16) {
213 static const MCPhysReg RegList6[] = {
214 Hexagon::W0, Hexagon::W1, Hexagon::W2, Hexagon::W3, Hexagon::W4, Hexagon::W5, Hexagon::W6, Hexagon::W7
215 };
216 if (unsigned Reg = State.AllocateReg(Regs: RegList6)) {
217 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
218 return false;
219 }
220 }
221 }
222
223 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX128BOps()) {
224 if (LocVT == MVT::v32i32 ||
225 LocVT == MVT::v64i16 ||
226 LocVT == MVT::v128i8 ||
227 LocVT == MVT::v32f32 ||
228 LocVT == MVT::v64f16) {
229 int64_t Offset7 = State.AllocateStack(Size: 128, Alignment: Align(128));
230 State.addLoc(V: CCValAssign::getMem(ValNo, ValVT, Offset: Offset7, LocVT, HTP: LocInfo));
231 return false;
232 }
233 }
234
235 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX128BOps()) {
236 if (LocVT == MVT::v64i32 ||
237 LocVT == MVT::v128i16 ||
238 LocVT == MVT::v256i8 ||
239 LocVT == MVT::v64f32 ||
240 LocVT == MVT::v128f16) {
241 int64_t Offset8 = State.AllocateStack(Size: 256, Alignment: Align(128));
242 State.addLoc(V: CCValAssign::getMem(ValNo, ValVT, Offset: Offset8, LocVT, HTP: LocInfo));
243 return false;
244 }
245 }
246
247 if (!CC_Hexagon(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
248 return false;
249
250 return true; // CC didn't match.
251}
252
253
254static bool CC_Hexagon_Legacy(unsigned ValNo, MVT ValVT,
255 MVT LocVT, CCValAssign::LocInfo LocInfo,
256 ISD::ArgFlagsTy ArgFlags, CCState &State) {
257
258 if (LocVT == MVT::i1 ||
259 LocVT == MVT::i8 ||
260 LocVT == MVT::i16) {
261 LocVT = MVT::i32;
262 if (ArgFlags.isSExt())
263 LocInfo = CCValAssign::SExt;
264 else if (ArgFlags.isZExt())
265 LocInfo = CCValAssign::ZExt;
266 else
267 LocInfo = CCValAssign::AExt;
268 }
269
270 if (LocVT == MVT::f32) {
271 LocVT = MVT::i32;
272 LocInfo = CCValAssign::BCvt;
273 }
274
275 if (LocVT == MVT::f64) {
276 LocVT = MVT::i64;
277 LocInfo = CCValAssign::BCvt;
278 }
279
280 if (ArgFlags.isByVal()) {
281 State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, MinSize: 8, MinAlign: Align(8), ArgFlags);
282 return false;
283 }
284
285 if (State.isVarArg() && ValNo >= static_cast<HexagonCCState&>(State).getNumNamedVarArgParams()) {
286 if (!CC_HexagonStack(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
287 return false;
288 }
289
290 if (LocVT == MVT::i32) {
291 if (ArgFlags.isSplit()) {
292 if (CC_SkipOdd(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
293 return false;
294 }
295 }
296
297 if (LocVT == MVT::i32 ||
298 LocVT == MVT::v2i16 ||
299 LocVT == MVT::v4i8) {
300 static const MCPhysReg RegList1[] = {
301 Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3, Hexagon::R4, Hexagon::R5
302 };
303 if (unsigned Reg = State.AllocateReg(Regs: RegList1)) {
304 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
305 return false;
306 }
307 }
308
309 if (LocVT == MVT::i64 ||
310 LocVT == MVT::v2i32 ||
311 LocVT == MVT::v4i16 ||
312 LocVT == MVT::v8i8) {
313 if (CC_SkipOdd(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
314 return false;
315 }
316
317 if (LocVT == MVT::i64 ||
318 LocVT == MVT::v2i32 ||
319 LocVT == MVT::v4i16 ||
320 LocVT == MVT::v8i8) {
321 static const MCPhysReg RegList2[] = {
322 Hexagon::D0, Hexagon::D1, Hexagon::D2
323 };
324 if (unsigned Reg = State.AllocateReg(Regs: RegList2)) {
325 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
326 return false;
327 }
328 }
329
330 if (!CC_HexagonStack(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
331 return false;
332
333 return true; // CC didn't match.
334}
335
336
337static bool RetCC_Hexagon(unsigned ValNo, MVT ValVT,
338 MVT LocVT, CCValAssign::LocInfo LocInfo,
339 ISD::ArgFlagsTy ArgFlags, CCState &State) {
340
341 if (LocVT == MVT::i1 ||
342 LocVT == MVT::i8 ||
343 LocVT == MVT::i16) {
344 LocVT = MVT::i32;
345 if (ArgFlags.isSExt())
346 LocInfo = CCValAssign::SExt;
347 else if (ArgFlags.isZExt())
348 LocInfo = CCValAssign::ZExt;
349 else
350 LocInfo = CCValAssign::AExt;
351 }
352
353 if (LocVT == MVT::f32) {
354 LocVT = MVT::i32;
355 LocInfo = CCValAssign::BCvt;
356 }
357
358 if (LocVT == MVT::f64) {
359 LocVT = MVT::i64;
360 LocInfo = CCValAssign::BCvt;
361 }
362
363 if (ArgFlags.isSplit()) {
364 static const MCPhysReg RegList1[] = {
365 Hexagon::R0, Hexagon::R1
366 };
367 if (unsigned Reg = State.AllocateReg(Regs: RegList1)) {
368 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
369 return false;
370 }
371 }
372
373 if (LocVT == MVT::i32 ||
374 LocVT == MVT::v2i16 ||
375 LocVT == MVT::v4i8) {
376 static const MCPhysReg RegList2[] = {
377 Hexagon::R0, Hexagon::R1
378 };
379 if (unsigned Reg = State.AllocateReg(Regs: RegList2)) {
380 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
381 return false;
382 }
383 }
384
385 if (LocVT == MVT::i64 ||
386 LocVT == MVT::v2i32 ||
387 LocVT == MVT::v4i16 ||
388 LocVT == MVT::v8i8) {
389 if (unsigned Reg = State.AllocateReg(Reg: Hexagon::D0)) {
390 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
391 return false;
392 }
393 }
394
395 return true; // CC didn't match.
396}
397
398
399static bool RetCC_Hexagon_HVX(unsigned ValNo, MVT ValVT,
400 MVT LocVT, CCValAssign::LocInfo LocInfo,
401 ISD::ArgFlagsTy ArgFlags, CCState &State) {
402
403 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX64BOps()) {
404 if (LocVT == MVT::v16i32 ||
405 LocVT == MVT::v32i16 ||
406 LocVT == MVT::v64i8) {
407 if (unsigned Reg = State.AllocateReg(Reg: Hexagon::V0)) {
408 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
409 return false;
410 }
411 }
412 }
413
414 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX64BOps()) {
415 if (LocVT == MVT::v32i32 ||
416 LocVT == MVT::v64i16 ||
417 LocVT == MVT::v128i8) {
418 if (unsigned Reg = State.AllocateReg(Reg: Hexagon::W0)) {
419 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
420 return false;
421 }
422 }
423 }
424
425 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX128BOps()) {
426 if (LocVT == MVT::v32i32 ||
427 LocVT == MVT::v64i16 ||
428 LocVT == MVT::v128i8 ||
429 LocVT == MVT::v32f32 ||
430 LocVT == MVT::v64f16) {
431 if (unsigned Reg = State.AllocateReg(Reg: Hexagon::V0)) {
432 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
433 return false;
434 }
435 }
436 }
437
438 if (State.getMachineFunction().getSubtarget<HexagonSubtarget>().useHVX128BOps()) {
439 if (LocVT == MVT::v64i32 ||
440 LocVT == MVT::v128i16 ||
441 LocVT == MVT::v256i8 ||
442 LocVT == MVT::v64f32 ||
443 LocVT == MVT::v128f16) {
444 if (unsigned Reg = State.AllocateReg(Reg: Hexagon::W0)) {
445 State.addLoc(V: CCValAssign::getReg(ValNo, ValVT, RegNo: Reg, LocVT, HTP: LocInfo));
446 return false;
447 }
448 }
449 }
450
451 if (!RetCC_Hexagon(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
452 return false;
453
454 return true; // CC didn't match.
455}
456
457#else
458
459const MCRegister CC_Hexagon_ArgRegs[] = { Hexagon::D0, Hexagon::D1, Hexagon::D2, Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3, Hexagon::R4, Hexagon::R5 };
460const MCRegister CC_HexagonStack_ArgRegs[] = { 0 };
461const MCRegister CC_Hexagon_HVX_ArgRegs[] = { Hexagon::V0, Hexagon::V1, Hexagon::V10, Hexagon::V11, Hexagon::V12, Hexagon::V13, Hexagon::V14, Hexagon::V15, Hexagon::V2, Hexagon::V3, Hexagon::V4, Hexagon::V5, Hexagon::V6, Hexagon::V7, Hexagon::V8, Hexagon::V9, Hexagon::W0, Hexagon::W1, Hexagon::W2, Hexagon::W3, Hexagon::W4, Hexagon::W5, Hexagon::W6, Hexagon::W7 };
462const MCRegister CC_Hexagon_Legacy_ArgRegs[] = { Hexagon::D0, Hexagon::D1, Hexagon::D2, Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3, Hexagon::R4, Hexagon::R5 };
463const MCRegister RetCC_Hexagon_ArgRegs[] = { Hexagon::D0, Hexagon::R0, Hexagon::R1 };
464const MCRegister RetCC_Hexagon_HVX_ArgRegs[] = { Hexagon::V0, Hexagon::W0 };
465
466#endif // CC_REGISTER_LIST
467