Line data Source code
1 : /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2 : |* *|
3 : |* Calling Convention Implementation Fragment *|
4 : |* *|
5 : |* Automatically generated file, do not edit! *|
6 : |* *|
7 : \*===----------------------------------------------------------------------===*/
8 :
9 : static bool CC_Mips(unsigned ValNo, MVT ValVT,
10 : MVT LocVT, CCValAssign::LocInfo LocInfo,
11 : ISD::ArgFlagsTy ArgFlags, CCState &State);
12 : static bool CC_Mips16RetHelper(unsigned ValNo, MVT ValVT,
13 : MVT LocVT, CCValAssign::LocInfo LocInfo,
14 : ISD::ArgFlagsTy ArgFlags, CCState &State);
15 : static bool CC_MipsN(unsigned ValNo, MVT ValVT,
16 : MVT LocVT, CCValAssign::LocInfo LocInfo,
17 : ISD::ArgFlagsTy ArgFlags, CCState &State);
18 : static bool CC_MipsN_FastCC(unsigned ValNo, MVT ValVT,
19 : MVT LocVT, CCValAssign::LocInfo LocInfo,
20 : ISD::ArgFlagsTy ArgFlags, CCState &State);
21 : static bool CC_MipsN_SoftFloat(unsigned ValNo, MVT ValVT,
22 : MVT LocVT, CCValAssign::LocInfo LocInfo,
23 : ISD::ArgFlagsTy ArgFlags, CCState &State);
24 : static bool CC_MipsN_VarArg(unsigned ValNo, MVT ValVT,
25 : MVT LocVT, CCValAssign::LocInfo LocInfo,
26 : ISD::ArgFlagsTy ArgFlags, CCState &State);
27 : static bool CC_MipsO32(unsigned ValNo, MVT ValVT,
28 : MVT LocVT, CCValAssign::LocInfo LocInfo,
29 : ISD::ArgFlagsTy ArgFlags, CCState &State);
30 : static bool CC_MipsO32_FP(unsigned ValNo, MVT ValVT,
31 : MVT LocVT, CCValAssign::LocInfo LocInfo,
32 : ISD::ArgFlagsTy ArgFlags, CCState &State);
33 : static bool CC_MipsO32_FastCC(unsigned ValNo, MVT ValVT,
34 : MVT LocVT, CCValAssign::LocInfo LocInfo,
35 : ISD::ArgFlagsTy ArgFlags, CCState &State);
36 : static bool CC_Mips_ByVal(unsigned ValNo, MVT ValVT,
37 : MVT LocVT, CCValAssign::LocInfo LocInfo,
38 : ISD::ArgFlagsTy ArgFlags, CCState &State);
39 : static bool CC_Mips_FastCC(unsigned ValNo, MVT ValVT,
40 : MVT LocVT, CCValAssign::LocInfo LocInfo,
41 : ISD::ArgFlagsTy ArgFlags, CCState &State);
42 : static bool CC_Mips_FixedArg(unsigned ValNo, MVT ValVT,
43 : MVT LocVT, CCValAssign::LocInfo LocInfo,
44 : ISD::ArgFlagsTy ArgFlags, CCState &State);
45 : static bool CC_Mips_VarArg(unsigned ValNo, MVT ValVT,
46 : MVT LocVT, CCValAssign::LocInfo LocInfo,
47 : ISD::ArgFlagsTy ArgFlags, CCState &State);
48 : static bool RetCC_F128(unsigned ValNo, MVT ValVT,
49 : MVT LocVT, CCValAssign::LocInfo LocInfo,
50 : ISD::ArgFlagsTy ArgFlags, CCState &State);
51 : static bool RetCC_F128HardFloat(unsigned ValNo, MVT ValVT,
52 : MVT LocVT, CCValAssign::LocInfo LocInfo,
53 : ISD::ArgFlagsTy ArgFlags, CCState &State);
54 : static bool RetCC_F128SoftFloat(unsigned ValNo, MVT ValVT,
55 : MVT LocVT, CCValAssign::LocInfo LocInfo,
56 : ISD::ArgFlagsTy ArgFlags, CCState &State);
57 : static bool RetCC_Mips(unsigned ValNo, MVT ValVT,
58 : MVT LocVT, CCValAssign::LocInfo LocInfo,
59 : ISD::ArgFlagsTy ArgFlags, CCState &State);
60 : static bool RetCC_MipsN(unsigned ValNo, MVT ValVT,
61 : MVT LocVT, CCValAssign::LocInfo LocInfo,
62 : ISD::ArgFlagsTy ArgFlags, CCState &State);
63 : static bool RetCC_MipsO32(unsigned ValNo, MVT ValVT,
64 : MVT LocVT, CCValAssign::LocInfo LocInfo,
65 : ISD::ArgFlagsTy ArgFlags, CCState &State);
66 :
67 :
68 6018 : static bool CC_Mips(unsigned ValNo, MVT ValVT,
69 : MVT LocVT, CCValAssign::LocInfo LocInfo,
70 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
71 :
72 6018 : if (State.isVarArg()) {
73 516 : if (!static_cast<MipsCCState *>(&State)->IsCallOperandFixed(ValNo)) {
74 381 : if (!CC_Mips_VarArg(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
75 : return false;
76 : }
77 : }
78 :
79 5637 : if (!CC_Mips_FixedArg(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
80 5637 : return false;
81 :
82 : return true; // CC didn't match.
83 : }
84 :
85 :
86 56 : static bool CC_Mips16RetHelper(unsigned ValNo, MVT ValVT,
87 : MVT LocVT, CCValAssign::LocInfo LocInfo,
88 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
89 :
90 56 : if (ArgFlags.isByVal()) {
91 0 : if (!CC_Mips_ByVal(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
92 : return false;
93 : }
94 :
95 56 : if (LocVT == MVT::i32) {
96 : static const MCPhysReg RegList1[] = {
97 : Mips::V0, Mips::V1, Mips::A0, Mips::A1
98 : };
99 56 : if (unsigned Reg = State.AllocateReg(RegList1)) {
100 56 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
101 56 : return false;
102 : }
103 : }
104 :
105 : return true; // CC didn't match.
106 : }
107 :
108 :
109 8226 : static bool CC_MipsN(unsigned ValNo, MVT ValVT,
110 : MVT LocVT, CCValAssign::LocInfo LocInfo,
111 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
112 :
113 8226 : if (LocVT == MVT::i8 ||
114 8226 : LocVT == MVT::i16 ||
115 13072 : LocVT == MVT::i32 ||
116 : LocVT == MVT::i64) {
117 6736 : if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
118 4415 : if (ArgFlags.isInReg()) {
119 : LocVT = MVT::i64;
120 10 : if (ArgFlags.isSExt())
121 : LocInfo = CCValAssign::SExtUpper;
122 10 : else if (ArgFlags.isZExt())
123 : LocInfo = CCValAssign::ZExtUpper;
124 : else
125 : LocInfo = CCValAssign::AExtUpper;
126 : }
127 : }
128 : }
129 :
130 8226 : if (LocVT == MVT::i8 ||
131 16452 : LocVT == MVT::i16 ||
132 : LocVT == MVT::i32) {
133 3378 : if (!static_cast<MipsCCState *>(&State)->WasOriginalArgFloat(ValNo)) {
134 : LocVT = MVT::i64;
135 3319 : if (ArgFlags.isSExt())
136 : LocInfo = CCValAssign::SExt;
137 1428 : else if (ArgFlags.isZExt())
138 : LocInfo = CCValAssign::ZExt;
139 : else
140 : LocInfo = CCValAssign::AExt;
141 : }
142 : }
143 :
144 8226 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useSoftFloat()) {
145 953 : if (LocVT == MVT::i32) {
146 59 : if (!CC_MipsN_SoftFloat(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
147 : return false;
148 : }
149 : }
150 :
151 8167 : if (LocVT == MVT::i64) {
152 : static const MCPhysReg RegList1[] = {
153 : Mips::A0_64, Mips::A1_64, Mips::A2_64, Mips::A3_64, Mips::T0_64, Mips::T1_64, Mips::T2_64, Mips::T3_64
154 : };
155 : static const MCPhysReg RegList2[] = {
156 : Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64, Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
157 : };
158 6677 : if (unsigned Reg = State.AllocateReg(RegList1, RegList2)) {
159 6592 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
160 6592 : return false;
161 : }
162 : }
163 :
164 1575 : if (LocVT == MVT::f32) {
165 : static const MCPhysReg RegList3[] = {
166 : Mips::F12, Mips::F13, Mips::F14, Mips::F15, Mips::F16, Mips::F17, Mips::F18, Mips::F19
167 : };
168 : static const MCPhysReg RegList4[] = {
169 : Mips::A0_64, Mips::A1_64, Mips::A2_64, Mips::A3_64, Mips::T0_64, Mips::T1_64, Mips::T2_64, Mips::T3_64
170 : };
171 760 : if (unsigned Reg = State.AllocateReg(RegList3, RegList4)) {
172 756 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
173 756 : return false;
174 : }
175 : }
176 :
177 819 : if (LocVT == MVT::f64) {
178 : static const MCPhysReg RegList5[] = {
179 : Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64, Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
180 : };
181 : static const MCPhysReg RegList6[] = {
182 : Mips::A0_64, Mips::A1_64, Mips::A2_64, Mips::A3_64, Mips::T0_64, Mips::T1_64, Mips::T2_64, Mips::T3_64
183 : };
184 730 : if (unsigned Reg = State.AllocateReg(RegList5, RegList6)) {
185 718 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
186 718 : return false;
187 : }
188 : }
189 :
190 101 : if (LocVT == MVT::f32) {
191 4 : unsigned Offset7 = State.AllocateStack(4, 8);
192 4 : State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset7, LocVT, LocInfo));
193 4 : return false;
194 : }
195 :
196 97 : if (LocVT == MVT::i64 ||
197 : LocVT == MVT::f64) {
198 97 : unsigned Offset8 = State.AllocateStack(8, 8);
199 97 : State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset8, LocVT, LocInfo));
200 97 : return false;
201 : }
202 :
203 : return true; // CC didn't match.
204 : }
205 :
206 :
207 0 : static bool CC_MipsN_FastCC(unsigned ValNo, MVT ValVT,
208 : MVT LocVT, CCValAssign::LocInfo LocInfo,
209 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
210 :
211 0 : if (LocVT == MVT::i64) {
212 : static const MCPhysReg RegList1[] = {
213 : Mips::A0_64, Mips::A1_64, Mips::A2_64, Mips::A3_64, Mips::T0_64, Mips::T1_64, Mips::T2_64, Mips::T3_64, Mips::T4_64, Mips::T5_64, Mips::T6_64, Mips::T7_64, Mips::T8_64, Mips::V1_64
214 : };
215 0 : if (unsigned Reg = State.AllocateReg(RegList1)) {
216 0 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
217 0 : return false;
218 : }
219 : }
220 :
221 0 : if (LocVT == MVT::f64) {
222 : static const MCPhysReg RegList2[] = {
223 : Mips::D0_64, Mips::D1_64, Mips::D2_64, Mips::D3_64, Mips::D4_64, Mips::D5_64, Mips::D6_64, Mips::D7_64, Mips::D8_64, Mips::D9_64, Mips::D10_64, Mips::D11_64, Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64, Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
224 : };
225 0 : if (unsigned Reg = State.AllocateReg(RegList2)) {
226 0 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
227 0 : return false;
228 : }
229 : }
230 :
231 0 : if (LocVT == MVT::i64 ||
232 : LocVT == MVT::f64) {
233 0 : unsigned Offset3 = State.AllocateStack(8, 8);
234 0 : State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset3, LocVT, LocInfo));
235 0 : return false;
236 : }
237 :
238 : return true; // CC didn't match.
239 : }
240 :
241 :
242 0 : static bool CC_MipsN_SoftFloat(unsigned ValNo, MVT ValVT,
243 : MVT LocVT, CCValAssign::LocInfo LocInfo,
244 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
245 :
246 : static const MCPhysReg RegList1[] = {
247 : Mips::A0, Mips::A1, Mips::A2, Mips::A3, Mips::T0, Mips::T1, Mips::T2, Mips::T3
248 : };
249 : static const MCPhysReg RegList2[] = {
250 : Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64, Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
251 : };
252 0 : if (unsigned Reg = State.AllocateReg(RegList1, RegList2)) {
253 0 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
254 0 : return false;
255 : }
256 :
257 0 : unsigned Offset3 = State.AllocateStack(4, 8);
258 0 : State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset3, LocVT, LocInfo));
259 0 : return false;
260 :
261 : return true; // CC didn't match.
262 : }
263 :
264 :
265 32 : static bool CC_MipsN_VarArg(unsigned ValNo, MVT ValVT,
266 : MVT LocVT, CCValAssign::LocInfo LocInfo,
267 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
268 :
269 32 : if (LocVT == MVT::i8 ||
270 32 : LocVT == MVT::i16 ||
271 41 : LocVT == MVT::i32 ||
272 : LocVT == MVT::i64) {
273 32 : if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
274 24 : if (ArgFlags.isInReg()) {
275 : LocVT = MVT::i64;
276 24 : if (ArgFlags.isSExt())
277 : LocInfo = CCValAssign::SExtUpper;
278 24 : else if (ArgFlags.isZExt())
279 : LocInfo = CCValAssign::ZExtUpper;
280 : else
281 : LocInfo = CCValAssign::AExtUpper;
282 : }
283 : }
284 : }
285 :
286 32 : if (LocVT == MVT::i8 ||
287 64 : LocVT == MVT::i16 ||
288 : LocVT == MVT::i32) {
289 : LocVT = MVT::i64;
290 8 : if (ArgFlags.isSExt())
291 : LocInfo = CCValAssign::SExt;
292 8 : else if (ArgFlags.isZExt())
293 : LocInfo = CCValAssign::ZExt;
294 : else
295 : LocInfo = CCValAssign::AExt;
296 : }
297 :
298 32 : if (LocVT == MVT::f32) {
299 : static const MCPhysReg RegList1[] = {
300 : Mips::A0, Mips::A1, Mips::A2, Mips::A3, Mips::T0, Mips::T1, Mips::T2, Mips::T3
301 : };
302 0 : if (unsigned Reg = State.AllocateReg(RegList1)) {
303 0 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
304 0 : return false;
305 : }
306 : }
307 :
308 32 : if (LocVT == MVT::i64 ||
309 : LocVT == MVT::f64) {
310 : static const MCPhysReg RegList2[] = {
311 : Mips::A0_64, Mips::A1_64, Mips::A2_64, Mips::A3_64, Mips::T0_64, Mips::T1_64, Mips::T2_64, Mips::T3_64
312 : };
313 32 : if (unsigned Reg = State.AllocateReg(RegList2)) {
314 30 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
315 30 : return false;
316 : }
317 : }
318 :
319 2 : if (LocVT == MVT::f32) {
320 0 : unsigned Offset3 = State.AllocateStack(4, 8);
321 0 : State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset3, LocVT, LocInfo));
322 0 : return false;
323 : }
324 :
325 2 : if (LocVT == MVT::i64 ||
326 : LocVT == MVT::f64) {
327 2 : unsigned Offset4 = State.AllocateStack(8, 8);
328 2 : State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset4, LocVT, LocInfo));
329 2 : return false;
330 : }
331 :
332 : return true; // CC didn't match.
333 : }
334 :
335 :
336 156 : static bool CC_MipsO32(unsigned ValNo, MVT ValVT,
337 : MVT LocVT, CCValAssign::LocInfo LocInfo,
338 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
339 :
340 156 : if (LocVT == MVT::i1 ||
341 290 : LocVT == MVT::i8 ||
342 : LocVT == MVT::i16) {
343 : LocVT = MVT::i32;
344 42 : if (ArgFlags.isSExt())
345 : LocInfo = CCValAssign::SExt;
346 42 : else if (ArgFlags.isZExt())
347 : LocInfo = CCValAssign::ZExt;
348 : else
349 : LocInfo = CCValAssign::AExt;
350 : }
351 :
352 156 : if (LocVT == MVT::i32 ||
353 : LocVT == MVT::f32) {
354 150 : unsigned Offset1 = State.AllocateStack(4, 4);
355 150 : State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset1, LocVT, LocInfo));
356 150 : return false;
357 : }
358 :
359 6 : if (LocVT == MVT::f64) {
360 6 : unsigned Offset2 = State.AllocateStack(8, 8);
361 6 : State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset2, LocVT, LocInfo));
362 6 : return false;
363 : }
364 :
365 : return true; // CC didn't match.
366 : }
367 :
368 :
369 16009 : static bool CC_MipsO32_FP(unsigned ValNo, MVT ValVT,
370 : MVT LocVT, CCValAssign::LocInfo LocInfo,
371 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
372 :
373 16009 : if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
374 10007 : if (!CC_MipsO32_FP32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
375 : return false;
376 : }
377 :
378 6002 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
379 6002 : if (!CC_MipsO32_FP64(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
380 6002 : return false;
381 : }
382 :
383 : return true; // CC didn't match.
384 : }
385 :
386 :
387 0 : static bool CC_MipsO32_FastCC(unsigned ValNo, MVT ValVT,
388 : MVT LocVT, CCValAssign::LocInfo LocInfo,
389 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
390 :
391 0 : if (LocVT == MVT::f64) {
392 0 : if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
393 : static const MCPhysReg RegList1[] = {
394 : Mips::D0, Mips::D1, Mips::D2, Mips::D3, Mips::D4, Mips::D5, Mips::D6, Mips::D7, Mips::D8, Mips::D9
395 : };
396 0 : if (unsigned Reg = State.AllocateReg(RegList1)) {
397 0 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
398 0 : return false;
399 : }
400 : }
401 : }
402 :
403 0 : if (LocVT == MVT::f64) {
404 0 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
405 0 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useOddSPReg()) {
406 : static const MCPhysReg RegList2[] = {
407 : Mips::D0_64, Mips::D1_64, Mips::D2_64, Mips::D3_64, Mips::D4_64, Mips::D5_64, Mips::D6_64, Mips::D7_64, Mips::D8_64, Mips::D9_64, Mips::D10_64, Mips::D11_64, Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64, Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
408 : };
409 0 : if (unsigned Reg = State.AllocateReg(RegList2)) {
410 0 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
411 0 : return false;
412 : }
413 : }
414 : }
415 : }
416 :
417 0 : if (LocVT == MVT::f64) {
418 0 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
419 0 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).noOddSPReg()) {
420 : static const MCPhysReg RegList3[] = {
421 : Mips::D0_64, Mips::D2_64, Mips::D4_64, Mips::D6_64, Mips::D8_64, Mips::D10_64, Mips::D12_64, Mips::D14_64, Mips::D16_64, Mips::D18_64
422 : };
423 0 : if (unsigned Reg = State.AllocateReg(RegList3)) {
424 0 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
425 0 : return false;
426 : }
427 : }
428 : }
429 : }
430 :
431 0 : if (LocVT == MVT::f64) {
432 0 : unsigned Offset4 = State.AllocateStack(8, 8);
433 0 : State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset4, LocVT, LocInfo));
434 0 : return false;
435 : }
436 :
437 : return true; // CC didn't match.
438 : }
439 :
440 :
441 80 : static bool CC_Mips_ByVal(unsigned ValNo, MVT ValVT,
442 : MVT LocVT, CCValAssign::LocInfo LocInfo,
443 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
444 :
445 80 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_O32()) {
446 58 : if (ArgFlags.isByVal()) {
447 58 : State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, 4, 4, ArgFlags);
448 58 : return false;
449 : }
450 : }
451 :
452 22 : if (ArgFlags.isByVal()) {
453 22 : State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, 8, 8, ArgFlags);
454 22 : return false;
455 : }
456 :
457 : return true; // CC didn't match.
458 : }
459 :
460 :
461 744 : static bool CC_Mips_FastCC(unsigned ValNo, MVT ValVT,
462 : MVT LocVT, CCValAssign::LocInfo LocInfo,
463 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
464 :
465 744 : if (ArgFlags.isByVal()) {
466 0 : State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, 4, 4, ArgFlags);
467 0 : return false;
468 : }
469 :
470 744 : if (LocVT == MVT::i8 ||
471 : LocVT == MVT::i16) {
472 : LocVT = MVT::i32;
473 0 : if (ArgFlags.isSExt())
474 : LocInfo = CCValAssign::SExt;
475 0 : else if (ArgFlags.isZExt())
476 : LocInfo = CCValAssign::ZExt;
477 : else
478 : LocInfo = CCValAssign::AExt;
479 : }
480 :
481 744 : if (LocVT == MVT::i32) {
482 800 : if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isTargetNaCl()) {
483 : static const MCPhysReg RegList1[] = {
484 : Mips::A0, Mips::A1, Mips::A2, Mips::A3, Mips::T0, Mips::T1, Mips::T2, Mips::T3, Mips::T4, Mips::T5, Mips::T6, Mips::T7, Mips::T8, Mips::V1
485 : };
486 366 : if (unsigned Reg = State.AllocateReg(RegList1)) {
487 348 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
488 348 : return false;
489 : }
490 : }
491 : }
492 :
493 396 : if (LocVT == MVT::i32) {
494 104 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isTargetNaCl()) {
495 : static const MCPhysReg RegList2[] = {
496 : Mips::A0, Mips::A1, Mips::A2, Mips::A3, Mips::T0, Mips::T1, Mips::T2, Mips::T3, Mips::T4, Mips::T5, Mips::V1
497 : };
498 34 : if (unsigned Reg = State.AllocateReg(RegList2)) {
499 22 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
500 22 : return false;
501 : }
502 : }
503 : }
504 :
505 374 : if (LocVT == MVT::f32) {
506 256 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useOddSPReg()) {
507 : static const MCPhysReg RegList3[] = {
508 : Mips::F0, Mips::F1, Mips::F2, Mips::F3, Mips::F4, Mips::F5, Mips::F6, Mips::F7, Mips::F8, Mips::F9, Mips::F10, Mips::F11, Mips::F12, Mips::F13, Mips::F14, Mips::F15, Mips::F16, Mips::F17, Mips::F18, Mips::F19
509 : };
510 128 : if (unsigned Reg = State.AllocateReg(RegList3)) {
511 124 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
512 124 : return false;
513 : }
514 : }
515 : }
516 :
517 250 : if (LocVT == MVT::f32) {
518 132 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).noOddSPReg()) {
519 : static const MCPhysReg RegList4[] = {
520 : Mips::F0, Mips::F2, Mips::F4, Mips::F6, Mips::F8, Mips::F10, Mips::F12, Mips::F14, Mips::F16, Mips::F18
521 : };
522 128 : if (unsigned Reg = State.AllocateReg(RegList4)) {
523 80 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
524 80 : return false;
525 : }
526 : }
527 : }
528 :
529 170 : if (LocVT == MVT::i32 ||
530 : LocVT == MVT::f32) {
531 82 : unsigned Offset5 = State.AllocateStack(4, 4);
532 82 : State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset5, LocVT, LocInfo));
533 82 : return false;
534 : }
535 :
536 88 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_O32()) {
537 88 : if (!CC_MipsO32_FastCC(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
538 : return false;
539 : }
540 :
541 0 : if (!CC_MipsN_FastCC(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
542 0 : return false;
543 :
544 : return true; // CC didn't match.
545 : }
546 :
547 :
548 24766 : static bool CC_Mips_FixedArg(unsigned ValNo, MVT ValVT,
549 : MVT LocVT, CCValAssign::LocInfo LocInfo,
550 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
551 :
552 24766 : if (State.getCallingConv() != CallingConv::Fast) {
553 24021 : if (static_cast<MipsCCState *>(&State)->getSpecialCallingConv() == MipsCCState::Mips16RetHelperConv) {
554 56 : if (!CC_Mips16RetHelper(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
555 : return false;
556 : }
557 : }
558 :
559 24710 : if (ArgFlags.isByVal()) {
560 80 : if (!CC_Mips_ByVal(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
561 : return false;
562 : }
563 :
564 24630 : if (LocVT == MVT::i64) {
565 3426 : if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useSoftFloat()) {
566 2613 : if (static_cast<MipsCCState *>(&State)->WasOriginalArgF128(ValNo)) {
567 : LocVT = MVT::f64;
568 : LocInfo = CCValAssign::BCvt;
569 : }
570 : }
571 : }
572 :
573 24630 : if (State.getCallingConv() == CallingConv::Fast) {
574 744 : if (!CC_Mips_FastCC(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
575 : return false;
576 : }
577 :
578 23886 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_O32()) {
579 15660 : if (!CC_MipsO32_FP(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
580 : return false;
581 : }
582 :
583 8226 : if (!CC_MipsN(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
584 8226 : return false;
585 :
586 : return true; // CC didn't match.
587 : }
588 :
589 :
590 381 : static bool CC_Mips_VarArg(unsigned ValNo, MVT ValVT,
591 : MVT LocVT, CCValAssign::LocInfo LocInfo,
592 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
593 :
594 381 : if (ArgFlags.isByVal()) {
595 0 : if (!CC_Mips_ByVal(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
596 : return false;
597 : }
598 :
599 381 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_O32()) {
600 349 : if (!CC_MipsO32_FP(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
601 : return false;
602 : }
603 :
604 32 : if (!CC_MipsN_VarArg(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
605 32 : return false;
606 :
607 : return true; // CC didn't match.
608 : }
609 :
610 :
611 1172 : static bool RetCC_F128(unsigned ValNo, MVT ValVT,
612 : MVT LocVT, CCValAssign::LocInfo LocInfo,
613 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
614 :
615 1172 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useSoftFloat()) {
616 1112 : if (LocVT == MVT::i64) {
617 1112 : if (!RetCC_F128SoftFloat(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
618 : return false;
619 : }
620 : }
621 :
622 60 : if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).useSoftFloat()) {
623 60 : if (LocVT == MVT::i64) {
624 60 : if (!RetCC_F128HardFloat(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
625 60 : return false;
626 : }
627 : }
628 :
629 : return true; // CC didn't match.
630 : }
631 :
632 :
633 0 : static bool RetCC_F128HardFloat(unsigned ValNo, MVT ValVT,
634 : MVT LocVT, CCValAssign::LocInfo LocInfo,
635 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
636 :
637 : LocVT = MVT::f64;
638 : LocInfo = CCValAssign::BCvt;
639 :
640 0 : if (ArgFlags.isInReg()) {
641 : static const MCPhysReg RegList1[] = {
642 : Mips::D0_64, Mips::D1_64
643 : };
644 0 : if (unsigned Reg = State.AllocateReg(RegList1)) {
645 0 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
646 0 : return false;
647 : }
648 : }
649 :
650 : static const MCPhysReg RegList2[] = {
651 : Mips::D0_64, Mips::D2_64
652 : };
653 0 : if (unsigned Reg = State.AllocateReg(RegList2)) {
654 0 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
655 0 : return false;
656 : }
657 :
658 : return true; // CC didn't match.
659 : }
660 :
661 :
662 0 : static bool RetCC_F128SoftFloat(unsigned ValNo, MVT ValVT,
663 : MVT LocVT, CCValAssign::LocInfo LocInfo,
664 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
665 :
666 : static const MCPhysReg RegList1[] = {
667 : Mips::V0_64, Mips::A0_64
668 : };
669 0 : if (unsigned Reg = State.AllocateReg(RegList1)) {
670 0 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
671 0 : return false;
672 : }
673 :
674 : return true; // CC didn't match.
675 : }
676 :
677 :
678 23956 : static bool RetCC_Mips(unsigned ValNo, MVT ValVT,
679 : MVT LocVT, CCValAssign::LocInfo LocInfo,
680 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
681 :
682 23956 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_N32()) {
683 375 : if (!RetCC_MipsN(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
684 : return false;
685 : }
686 :
687 23710 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isABI_N64()) {
688 9030 : if (!RetCC_MipsN(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
689 : return false;
690 : }
691 :
692 18183 : if (!RetCC_MipsO32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
693 18128 : return false;
694 :
695 : return true; // CC didn't match.
696 : }
697 :
698 :
699 9405 : static bool RetCC_MipsN(unsigned ValNo, MVT ValVT,
700 : MVT LocVT, CCValAssign::LocInfo LocInfo,
701 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
702 :
703 9405 : if (LocVT == MVT::i64) {
704 4547 : if (static_cast<MipsCCState *>(&State)->WasOriginalArgF128(ValNo)) {
705 1172 : if (!RetCC_F128(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State))
706 : return false;
707 : }
708 : }
709 :
710 8233 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
711 2701 : if (LocVT == MVT::i8 ||
712 2701 : LocVT == MVT::i16 ||
713 4360 : LocVT == MVT::i32 ||
714 : LocVT == MVT::i64) {
715 2071 : if (ArgFlags.isInReg()) {
716 : LocVT = MVT::i64;
717 12 : if (ArgFlags.isSExt())
718 : LocInfo = CCValAssign::SExt;
719 12 : else if (ArgFlags.isZExt())
720 : LocInfo = CCValAssign::ZExt;
721 : else
722 : LocInfo = CCValAssign::AExt;
723 : }
724 : }
725 : }
726 :
727 8233 : if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isLittle()) {
728 5532 : if (LocVT == MVT::i8 ||
729 5532 : LocVT == MVT::i16 ||
730 8458 : LocVT == MVT::i32 ||
731 : LocVT == MVT::i64) {
732 4952 : if (ArgFlags.isInReg()) {
733 : LocVT = MVT::i64;
734 12 : if (ArgFlags.isSExt())
735 : LocInfo = CCValAssign::SExtUpper;
736 12 : else if (ArgFlags.isZExt())
737 : LocInfo = CCValAssign::ZExtUpper;
738 : else
739 : LocInfo = CCValAssign::AExtUpper;
740 : }
741 : }
742 : }
743 :
744 8233 : if (LocVT == MVT::i64) {
745 : static const MCPhysReg RegList1[] = {
746 : Mips::V0_64, Mips::V1_64
747 : };
748 3391 : if (unsigned Reg = State.AllocateReg(RegList1)) {
749 3391 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
750 3391 : return false;
751 : }
752 : }
753 :
754 4842 : if (LocVT == MVT::f32) {
755 : static const MCPhysReg RegList2[] = {
756 : Mips::F0, Mips::F2
757 : };
758 706 : if (unsigned Reg = State.AllocateReg(RegList2)) {
759 706 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
760 706 : return false;
761 : }
762 : }
763 :
764 4136 : if (LocVT == MVT::f64) {
765 : static const MCPhysReg RegList3[] = {
766 : Mips::D0_64, Mips::D2_64
767 : };
768 504 : if (unsigned Reg = State.AllocateReg(RegList3)) {
769 504 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
770 504 : return false;
771 : }
772 : }
773 :
774 : return true; // CC didn't match.
775 : }
776 :
777 :
778 18183 : static bool RetCC_MipsO32(unsigned ValNo, MVT ValVT,
779 : MVT LocVT, CCValAssign::LocInfo LocInfo,
780 : ISD::ArgFlagsTy ArgFlags, CCState &State) {
781 :
782 18183 : if (LocVT == MVT::i1 ||
783 36366 : LocVT == MVT::i8 ||
784 : LocVT == MVT::i16) {
785 : LocVT = MVT::i32;
786 0 : if (ArgFlags.isSExt())
787 : LocInfo = CCValAssign::SExt;
788 0 : else if (ArgFlags.isZExt())
789 : LocInfo = CCValAssign::ZExt;
790 : else
791 : LocInfo = CCValAssign::AExt;
792 : }
793 :
794 18183 : if (!static_cast<MipsCCState *>(&State)->WasOriginalRetVectorFloat(ValNo)) {
795 18136 : if (LocVT == MVT::i32) {
796 : static const MCPhysReg RegList1[] = {
797 : Mips::V0, Mips::V1, Mips::A0, Mips::A1
798 : };
799 16557 : if (unsigned Reg = State.AllocateReg(RegList1)) {
800 16549 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
801 16549 : return false;
802 : }
803 : }
804 : }
805 :
806 1634 : if (LocVT == MVT::f32) {
807 : static const MCPhysReg RegList2[] = {
808 : Mips::F0, Mips::F2
809 : };
810 765 : if (unsigned Reg = State.AllocateReg(RegList2)) {
811 765 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
812 765 : return false;
813 : }
814 : }
815 :
816 869 : if (LocVT == MVT::f64) {
817 814 : if (static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
818 : static const MCPhysReg RegList3[] = {
819 : Mips::D0_64, Mips::D2_64
820 : };
821 282 : if (unsigned Reg = State.AllocateReg(RegList3)) {
822 282 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
823 282 : return false;
824 : }
825 : }
826 : }
827 :
828 587 : if (LocVT == MVT::f64) {
829 532 : if (!static_cast<const MipsSubtarget&>(State.getMachineFunction().getSubtarget()).isFP64bit()) {
830 : static const MCPhysReg RegList4[] = {
831 : Mips::D0, Mips::D1
832 : };
833 532 : if (unsigned Reg = State.AllocateReg(RegList4)) {
834 532 : State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
835 532 : return false;
836 : }
837 : }
838 : }
839 :
840 : return true; // CC didn't match.
841 : }
|