1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <x86_64/x64_cg.h>
17 #include "x64_cgfunc.h"
18 #include "x64_memlayout.h"
19 #include "x64_isa.h"
20 #include "assembler/operand.h"
21
22 namespace maplebe {
23 /* null implementation yet */
GenSaveMethodInfoCode(BB & bb)24 void X64CGFunc::GenSaveMethodInfoCode(BB &bb)
25 {
26 CHECK_FATAL(false, "NIY");
27 }
GenerateCleanupCode(BB & bb)28 void X64CGFunc::GenerateCleanupCode(BB &bb)
29 {
30 CHECK_FATAL(false, "NIY");
31 }
NeedCleanup()32 bool X64CGFunc::NeedCleanup()
33 {
34 CHECK_FATAL(false, "NIY");
35 return false;
36 }
GenerateCleanupCodeForExtEpilog(BB & bb)37 void X64CGFunc::GenerateCleanupCodeForExtEpilog(BB &bb)
38 {
39 CHECK_FATAL(false, "NIY");
40 }
FloatParamRegRequired(MIRStructType * structType,uint32 & fpSize)41 uint32 X64CGFunc::FloatParamRegRequired(MIRStructType *structType, uint32 &fpSize)
42 {
43 CHECK_FATAL(false, "NIY");
44 return 0;
45 }
AssignLmbcFormalParams()46 void X64CGFunc::AssignLmbcFormalParams()
47 {
48 CHECK_FATAL(false, "NIY");
49 }
LmbcGenSaveSpForAlloca()50 void X64CGFunc::LmbcGenSaveSpForAlloca()
51 {
52 CHECK_FATAL(false, "NIY");
53 }
MergeReturn()54 void X64CGFunc::MergeReturn()
55 {
56 CHECK_FATAL(false, "NIY");
57 }
DetermineReturnTypeofCall()58 void X64CGFunc::DetermineReturnTypeofCall()
59 {
60 CHECK_FATAL(false, "NIY");
61 }
HandleRCCall(bool begin,const MIRSymbol * retRef)62 void X64CGFunc::HandleRCCall(bool begin, const MIRSymbol *retRef)
63 {
64 CHECK_FATAL(false, "NIY");
65 }
HandleRetCleanup(NaryStmtNode & retNode)66 void X64CGFunc::HandleRetCleanup(NaryStmtNode &retNode)
67 {
68 CHECK_FATAL(false, "NIY");
69 }
SelectDassign(DassignNode & stmt,Operand & opnd0)70 void X64CGFunc::SelectDassign(DassignNode &stmt, Operand &opnd0)
71 {
72 CHECK_FATAL(false, "NIY");
73 }
SelectDassignoff(DassignoffNode & stmt,Operand & opnd0)74 void X64CGFunc::SelectDassignoff(DassignoffNode &stmt, Operand &opnd0)
75 {
76 CHECK_FATAL(false, "NIY");
77 }
SelectRegassign(RegassignNode & stmt,Operand & opnd0)78 void X64CGFunc::SelectRegassign(RegassignNode &stmt, Operand &opnd0)
79 {
80 CHECK_FATAL(false, "NIY");
81 }
SelectAbort()82 void X64CGFunc::SelectAbort()
83 {
84 CHECK_FATAL(false, "NIY");
85 }
SelectAssertNull(UnaryStmtNode & stmt)86 void X64CGFunc::SelectAssertNull(UnaryStmtNode &stmt)
87 {
88 CHECK_FATAL(false, "NIY");
89 }
SelectAsm(AsmNode & node)90 void X64CGFunc::SelectAsm(AsmNode &node)
91 {
92 CHECK_FATAL(false, "NIY");
93 }
SelectAggDassign(DassignNode & stmt)94 void X64CGFunc::SelectAggDassign(DassignNode &stmt)
95 {
96 CHECK_FATAL(false, "NIY");
97 }
SelectIassign(IassignNode & stmt)98 void X64CGFunc::SelectIassign(IassignNode &stmt)
99 {
100 CHECK_FATAL(false, "NIY");
101 }
SelectIassignoff(IassignoffNode & stmt)102 void X64CGFunc::SelectIassignoff(IassignoffNode &stmt)
103 {
104 CHECK_FATAL(false, "NIY");
105 }
SelectIassignfpoff(IassignFPoffNode & stmt,Operand & opnd)106 void X64CGFunc::SelectIassignfpoff(IassignFPoffNode &stmt, Operand &opnd)
107 {
108 CHECK_FATAL(false, "NIY");
109 }
SelectIassignspoff(PrimType pTy,int32 offset,Operand & opnd)110 void X64CGFunc::SelectIassignspoff(PrimType pTy, int32 offset, Operand &opnd)
111 {
112 CHECK_FATAL(false, "NIY");
113 }
SelectBlkassignoff(BlkassignoffNode & bNode,Operand * src)114 void X64CGFunc::SelectBlkassignoff(BlkassignoffNode &bNode, Operand *src)
115 {
116 CHECK_FATAL(false, "NIY");
117 }
SelectAggIassign(IassignNode & stmt,Operand & lhsAddrOpnd)118 void X64CGFunc::SelectAggIassign(IassignNode &stmt, Operand &lhsAddrOpnd)
119 {
120 CHECK_FATAL(false, "NIY");
121 }
SelectReturnSendOfStructInRegs(BaseNode * x)122 void X64CGFunc::SelectReturnSendOfStructInRegs(BaseNode *x)
123 {
124 CHECK_FATAL(false, "NIY");
125 }
SelectReturn(Operand * opnd)126 void X64CGFunc::SelectReturn(Operand *opnd)
127 {
128 CHECK_FATAL(false, "NIY");
129 }
SelectIgoto(Operand * opnd0)130 void X64CGFunc::SelectIgoto(Operand *opnd0)
131 {
132 CHECK_FATAL(false, "NIY");
133 }
SelectCondGoto(CondGotoNode & stmt,Operand & opnd0,Operand & opnd1)134 void X64CGFunc::SelectCondGoto(CondGotoNode &stmt, Operand &opnd0, Operand &opnd1)
135 {
136 CHECK_FATAL(false, "NIY");
137 }
SelectCondSpecialCase1(CondGotoNode & stmt,BaseNode & opnd0)138 void X64CGFunc::SelectCondSpecialCase1(CondGotoNode &stmt, BaseNode &opnd0)
139 {
140 CHECK_FATAL(false, "NIY");
141 }
SelectCondSpecialCase2(const CondGotoNode & stmt,BaseNode & opnd0)142 void X64CGFunc::SelectCondSpecialCase2(const CondGotoNode &stmt, BaseNode &opnd0)
143 {
144 CHECK_FATAL(false, "NIY");
145 }
SelectGoto(GotoNode & stmt)146 void X64CGFunc::SelectGoto(GotoNode &stmt)
147 {
148 CHECK_FATAL(false, "NIY");
149 }
SelectCall(CallNode & callNode)150 void X64CGFunc::SelectCall(CallNode &callNode)
151 {
152 CHECK_FATAL(false, "NIY");
153 }
SelectIcall(IcallNode & icallNode,Operand & fptrOpnd)154 void X64CGFunc::SelectIcall(IcallNode &icallNode, Operand &fptrOpnd)
155 {
156 CHECK_FATAL(false, "NIY");
157 }
SelectIntrinCall(IntrinsiccallNode & intrinsiccallNode)158 void X64CGFunc::SelectIntrinCall(IntrinsiccallNode &intrinsiccallNode)
159 {
160 CHECK_FATAL(false, "NIY");
161 }
SelectIntrinsicOpWithOneParam(IntrinsicopNode & intrinopNode,std::string name)162 Operand *X64CGFunc::SelectIntrinsicOpWithOneParam(IntrinsicopNode &intrinopNode, std::string name)
163 {
164 CHECK_FATAL(false, "NIY");
165 return nullptr;
166 }
SelectCclz(IntrinsicopNode & intrinopNode)167 Operand *X64CGFunc::SelectCclz(IntrinsicopNode &intrinopNode)
168 {
169 CHECK_FATAL(false, "NIY");
170 return nullptr;
171 }
SelectCctz(IntrinsicopNode & intrinopNode)172 Operand *X64CGFunc::SelectCctz(IntrinsicopNode &intrinopNode)
173 {
174 CHECK_FATAL(false, "NIY");
175 return nullptr;
176 }
SelectCpopcount(IntrinsicopNode & intrinopNode)177 Operand *X64CGFunc::SelectCpopcount(IntrinsicopNode &intrinopNode)
178 {
179 CHECK_FATAL(false, "NIY");
180 return nullptr;
181 }
SelectCparity(IntrinsicopNode & intrinopNode)182 Operand *X64CGFunc::SelectCparity(IntrinsicopNode &intrinopNode)
183 {
184 CHECK_FATAL(false, "NIY");
185 return nullptr;
186 }
SelectCclrsb(IntrinsicopNode & intrinopNode)187 Operand *X64CGFunc::SelectCclrsb(IntrinsicopNode &intrinopNode)
188 {
189 CHECK_FATAL(false, "NIY");
190 return nullptr;
191 }
SelectCisaligned(IntrinsicopNode & intrinopNode)192 Operand *X64CGFunc::SelectCisaligned(IntrinsicopNode &intrinopNode)
193 {
194 CHECK_FATAL(false, "NIY");
195 return nullptr;
196 }
SelectCalignup(IntrinsicopNode & intrinopNode)197 Operand *X64CGFunc::SelectCalignup(IntrinsicopNode &intrinopNode)
198 {
199 CHECK_FATAL(false, "NIY");
200 return nullptr;
201 }
SelectCaligndown(IntrinsicopNode & intrinopNode)202 Operand *X64CGFunc::SelectCaligndown(IntrinsicopNode &intrinopNode)
203 {
204 CHECK_FATAL(false, "NIY");
205 return nullptr;
206 }
SelectCSyncBoolCmpSwap(IntrinsicopNode & intrinopNode)207 Operand *X64CGFunc::SelectCSyncBoolCmpSwap(IntrinsicopNode &intrinopNode)
208 {
209 CHECK_FATAL(false, "NIY");
210 return nullptr;
211 }
SelectCSyncValCmpSwap(IntrinsicopNode & intrinopNode)212 Operand *X64CGFunc::SelectCSyncValCmpSwap(IntrinsicopNode &intrinopNode)
213 {
214 CHECK_FATAL(false, "NIY");
215 return nullptr;
216 }
SelectCSyncLockTestSet(IntrinsicopNode & intrinopNode,PrimType pty)217 Operand *X64CGFunc::SelectCSyncLockTestSet(IntrinsicopNode &intrinopNode, PrimType pty)
218 {
219 CHECK_FATAL(false, "NIY");
220 return nullptr;
221 }
SelectBswap(IntrinsicopNode & node,Operand & opnd0,const BaseNode & parent)222 Operand *X64CGFunc::SelectBswap(IntrinsicopNode &node, Operand &opnd0, const BaseNode &parent)
223 {
224 CHECK_FATAL(false, "NIY");
225 return nullptr;
226 }
SelectCSyncFetch(IntrinsicopNode & intrinsicopNode,Opcode op,bool fetchBefore)227 Operand *X64CGFunc::SelectCSyncFetch(IntrinsicopNode &intrinsicopNode, Opcode op, bool fetchBefore)
228 {
229 CHECK_FATAL(false, "NIY");
230 return nullptr;
231 }
SelectCSyncSynchronize(IntrinsicopNode & intrinsicopNode)232 Operand *X64CGFunc::SelectCSyncSynchronize(IntrinsicopNode &intrinsicopNode)
233 {
234 CHECK_FATAL(false, "NIY");
235 return nullptr;
236 }
SelectCAtomicLoadN(IntrinsicopNode & intrinsicopNode)237 Operand *X64CGFunc::SelectCAtomicLoadN(IntrinsicopNode &intrinsicopNode)
238 {
239 CHECK_FATAL(false, "NIY");
240 return nullptr;
241 }
SelectCAtomicExchangeN(IntrinsicopNode & intrinsicopNode)242 Operand *X64CGFunc::SelectCAtomicExchangeN(IntrinsicopNode &intrinsicopNode)
243 {
244 CHECK_FATAL(false, "NIY");
245 return nullptr;
246 }
SelectCReturnAddress(IntrinsicopNode & intrinopNode)247 Operand *X64CGFunc::SelectCReturnAddress(IntrinsicopNode &intrinopNode)
248 {
249 CHECK_FATAL(false, "NIY");
250 return nullptr;
251 }
SelectMembar(StmtNode & membar)252 void X64CGFunc::SelectMembar(StmtNode &membar)
253 {
254 CHECK_FATAL(false, "NIY");
255 }
SelectComment(CommentNode & comment)256 void X64CGFunc::SelectComment(CommentNode &comment)
257 {
258 CHECK_FATAL(false, "NIY");
259 }
HandleCatch()260 void X64CGFunc::HandleCatch()
261 {
262 CHECK_FATAL(false, "NIY");
263 }
SelectDread(const BaseNode & parent,AddrofNode & expr)264 Operand *X64CGFunc::SelectDread(const BaseNode &parent, AddrofNode &expr)
265 {
266 CHECK_FATAL(false, "NIY");
267 return nullptr;
268 }
SelectRegread(RegreadNode & expr)269 RegOperand *X64CGFunc::SelectRegread(RegreadNode &expr)
270 {
271 CHECK_FATAL(false, "NIY");
272 return nullptr;
273 }
SelectAddrof(AddrofNode & expr,const BaseNode & parent,bool isAddrofoff)274 Operand *X64CGFunc::SelectAddrof(AddrofNode &expr, const BaseNode &parent, bool isAddrofoff)
275 {
276 CHECK_FATAL(false, "NIY");
277 return nullptr;
278 }
SelectAddrofoff(AddrofoffNode & expr,const BaseNode & parent)279 Operand *X64CGFunc::SelectAddrofoff(AddrofoffNode &expr, const BaseNode &parent)
280 {
281 CHECK_FATAL(false, "NIY");
282 return nullptr;
283 }
284
SelectAddrofFunc(AddroffuncNode & expr,const BaseNode & parent)285 Operand &X64CGFunc::SelectAddrofFunc(AddroffuncNode &expr, const BaseNode &parent)
286 {
287 CHECK_FATAL(false, "NIY");
288 Operand *a;
289 return *a;
290 }
SelectAddrofLabel(AddroflabelNode & expr,const BaseNode & parent)291 Operand &X64CGFunc::SelectAddrofLabel(AddroflabelNode &expr, const BaseNode &parent)
292 {
293 CHECK_FATAL(false, "NIY");
294 Operand *a;
295 return *a;
296 }
SelectIread(const BaseNode & parent,IreadNode & expr,int extraOffset,PrimType finalBitFieldDestType)297 Operand *X64CGFunc::SelectIread(const BaseNode &parent, IreadNode &expr, int extraOffset,
298 PrimType finalBitFieldDestType)
299 {
300 CHECK_FATAL(false, "NIY");
301 return nullptr;
302 }
SelectIreadoff(const BaseNode & parent,IreadoffNode & ireadoff)303 Operand *X64CGFunc::SelectIreadoff(const BaseNode &parent, IreadoffNode &ireadoff)
304 {
305 CHECK_FATAL(false, "NIY");
306 return nullptr;
307 }
SelectIreadfpoff(const BaseNode & parent,IreadFPoffNode & ireadoff)308 Operand *X64CGFunc::SelectIreadfpoff(const BaseNode &parent, IreadFPoffNode &ireadoff)
309 {
310 CHECK_FATAL(false, "NIY");
311 return nullptr;
312 }
SelectIntConst(const MIRIntConst & intConst)313 Operand *X64CGFunc::SelectIntConst(const MIRIntConst &intConst)
314 {
315 CHECK_FATAL(false, "NIY");
316 return nullptr;
317 }
SelectFloatConst(MIRFloatConst & floatConst,const BaseNode & parent)318 Operand *X64CGFunc::SelectFloatConst(MIRFloatConst &floatConst, const BaseNode &parent)
319 {
320 CHECK_FATAL(false, "NIY");
321 return nullptr;
322 }
SelectDoubleConst(MIRDoubleConst & doubleConst,const BaseNode & parent)323 Operand *X64CGFunc::SelectDoubleConst(MIRDoubleConst &doubleConst, const BaseNode &parent)
324 {
325 CHECK_FATAL(false, "NIY");
326 return nullptr;
327 }
SelectStrConst(MIRStrConst & strConst)328 Operand *X64CGFunc::SelectStrConst(MIRStrConst &strConst)
329 {
330 CHECK_FATAL(false, "NIY");
331 return nullptr;
332 }
SelectStr16Const(MIRStr16Const & strConst)333 Operand *X64CGFunc::SelectStr16Const(MIRStr16Const &strConst)
334 {
335 CHECK_FATAL(false, "NIY");
336 return nullptr;
337 }
SelectAdd(Operand & resOpnd,Operand & opnd0,Operand & opnd1,PrimType primType)338 void X64CGFunc::SelectAdd(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType)
339 {
340 CHECK_FATAL(false, "NIY");
341 }
SelectAdd(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)342 Operand *X64CGFunc::SelectAdd(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
343 {
344 CHECK_FATAL(false, "NIY");
345 return nullptr;
346 }
SelectMadd(Operand & resOpnd,Operand & opndM0,Operand & opndM1,Operand & opnd1,PrimType primType)347 void X64CGFunc::SelectMadd(Operand &resOpnd, Operand &opndM0, Operand &opndM1, Operand &opnd1, PrimType primType)
348 {
349 CHECK_FATAL(false, "NIY");
350 }
SelectMadd(BinaryNode & node,Operand & opndM0,Operand & opndM1,Operand & opnd1,const BaseNode & parent)351 Operand *X64CGFunc::SelectMadd(BinaryNode &node, Operand &opndM0, Operand &opndM1, Operand &opnd1,
352 const BaseNode &parent)
353 {
354 CHECK_FATAL(false, "NIY");
355 return nullptr;
356 }
SelectRor(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)357 Operand *X64CGFunc::SelectRor(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
358 {
359 CHECK_FATAL(false, "NIY");
360 return nullptr;
361 }
SelectCGArrayElemAdd(BinaryNode & node,const BaseNode & parent)362 Operand &X64CGFunc::SelectCGArrayElemAdd(BinaryNode &node, const BaseNode &parent)
363 {
364 CHECK_FATAL(false, "NIY");
365 Operand *a;
366 return *a;
367 }
SelectShift(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)368 Operand *X64CGFunc::SelectShift(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
369 {
370 CHECK_FATAL(false, "NIY");
371 return nullptr;
372 }
SelectMpy(Operand & resOpnd,Operand & opnd0,Operand & opnd1,PrimType primType)373 void X64CGFunc::SelectMpy(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType)
374 {
375 CHECK_FATAL(false, "NIY");
376 }
SelectMpy(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)377 Operand *X64CGFunc::SelectMpy(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
378 {
379 CHECK_FATAL(false, "NIY");
380 return nullptr;
381 }
SelectRem(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)382 Operand *X64CGFunc::SelectRem(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
383 {
384 CHECK_FATAL(false, "NIY");
385 return nullptr;
386 }
SelectDiv(Operand & resOpnd,Operand & opnd0,Operand & opnd1,PrimType primType)387 void X64CGFunc::SelectDiv(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType)
388 {
389 CHECK_FATAL(false, "NIY");
390 }
SelectDiv(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)391 Operand *X64CGFunc::SelectDiv(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
392 {
393 CHECK_FATAL(false, "NIY");
394 return nullptr;
395 }
SelectSub(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)396 Operand *X64CGFunc::SelectSub(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
397 {
398 CHECK_FATAL(false, "NIY");
399 return nullptr;
400 }
SelectSub(Operand & resOpnd,Operand & opnd0,Operand & opnd1,PrimType primType)401 void X64CGFunc::SelectSub(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType)
402 {
403 CHECK_FATAL(false, "NIY");
404 }
SelectBand(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)405 Operand *X64CGFunc::SelectBand(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
406 {
407 CHECK_FATAL(false, "NIY");
408 return nullptr;
409 }
SelectBand(Operand & resOpnd,Operand & opnd0,Operand & opnd1,PrimType primType)410 void X64CGFunc::SelectBand(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType)
411 {
412 CHECK_FATAL(false, "NIY");
413 }
SelectLand(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)414 Operand *X64CGFunc::SelectLand(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
415 {
416 CHECK_FATAL(false, "NIY");
417 return nullptr;
418 }
SelectLor(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent,bool parentIsBr)419 Operand *X64CGFunc::SelectLor(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent, bool parentIsBr)
420 {
421 CHECK_FATAL(false, "NIY");
422 return nullptr;
423 }
SelectMin(Operand & resOpnd,Operand & opnd0,Operand & opnd1,PrimType primType)424 void X64CGFunc::SelectMin(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType)
425 {
426 CHECK_FATAL(false, "NIY");
427 }
SelectMin(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)428 Operand *X64CGFunc::SelectMin(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
429 {
430 CHECK_FATAL(false, "NIY");
431 return nullptr;
432 }
SelectMax(Operand & resOpnd,Operand & opnd0,Operand & opnd1,PrimType primType)433 void X64CGFunc::SelectMax(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType)
434 {
435 CHECK_FATAL(false, "NIY");
436 }
SelectMax(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)437 Operand *X64CGFunc::SelectMax(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
438 {
439 CHECK_FATAL(false, "NIY");
440 return nullptr;
441 }
SelectCmpOp(CompareNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)442 Operand *X64CGFunc::SelectCmpOp(CompareNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
443 {
444 CHECK_FATAL(false, "NIY");
445 return nullptr;
446 }
SelectBior(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)447 Operand *X64CGFunc::SelectBior(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
448 {
449 CHECK_FATAL(false, "NIY");
450 return nullptr;
451 }
SelectBior(Operand & resOpnd,Operand & opnd0,Operand & opnd1,PrimType primType)452 void X64CGFunc::SelectBior(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType)
453 {
454 CHECK_FATAL(false, "NIY");
455 }
SelectBxor(BinaryNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)456 Operand *X64CGFunc::SelectBxor(BinaryNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
457 {
458 CHECK_FATAL(false, "NIY");
459 return nullptr;
460 }
SelectBxor(Operand & resOpnd,Operand & opnd0,Operand & opnd1,PrimType primType)461 void X64CGFunc::SelectBxor(Operand &resOpnd, Operand &opnd0, Operand &opnd1, PrimType primType)
462 {
463 CHECK_FATAL(false, "NIY");
464 }
SelectAbs(UnaryNode & node,Operand & opnd0)465 Operand *X64CGFunc::SelectAbs(UnaryNode &node, Operand &opnd0)
466 {
467 CHECK_FATAL(false, "NIY");
468 return nullptr;
469 }
SelectBnot(UnaryNode & node,Operand & opnd0,const BaseNode & parent)470 Operand *X64CGFunc::SelectBnot(UnaryNode &node, Operand &opnd0, const BaseNode &parent)
471 {
472 CHECK_FATAL(false, "NIY");
473 return nullptr;
474 }
SelectExtractbits(ExtractbitsNode & node,Operand & opnd0,const BaseNode & parent)475 Operand *X64CGFunc::SelectExtractbits(ExtractbitsNode &node, Operand &opnd0, const BaseNode &parent)
476 {
477 CHECK_FATAL(false, "NIY");
478 return nullptr;
479 }
SelectDepositBits(DepositbitsNode & node,Operand & opnd0,Operand & opnd1,const BaseNode & parent)480 Operand *X64CGFunc::SelectDepositBits(DepositbitsNode &node, Operand &opnd0, Operand &opnd1, const BaseNode &parent)
481 {
482 CHECK_FATAL(false, "NIY");
483 return nullptr;
484 }
SelectRegularBitFieldLoad(ExtractbitsNode & node,const BaseNode & parent)485 Operand *X64CGFunc::SelectRegularBitFieldLoad(ExtractbitsNode &node, const BaseNode &parent)
486 {
487 CHECK_FATAL(false, "NIY");
488 return nullptr;
489 }
SelectLnot(UnaryNode & node,Operand & opnd0,const BaseNode & parent)490 Operand *X64CGFunc::SelectLnot(UnaryNode &node, Operand &opnd0, const BaseNode &parent)
491 {
492 CHECK_FATAL(false, "NIY");
493 return nullptr;
494 }
SelectNeg(UnaryNode & node,Operand & opnd0,const BaseNode & parent)495 Operand *X64CGFunc::SelectNeg(UnaryNode &node, Operand &opnd0, const BaseNode &parent)
496 {
497 CHECK_FATAL(false, "NIY");
498 return nullptr;
499 }
SelectRecip(UnaryNode & node,Operand & opnd0,const BaseNode & parent)500 Operand *X64CGFunc::SelectRecip(UnaryNode &node, Operand &opnd0, const BaseNode &parent)
501 {
502 CHECK_FATAL(false, "NIY");
503 return nullptr;
504 }
SelectSqrt(UnaryNode & node,Operand & opnd0,const BaseNode & parent)505 Operand *X64CGFunc::SelectSqrt(UnaryNode &node, Operand &opnd0, const BaseNode &parent)
506 {
507 CHECK_FATAL(false, "NIY");
508 return nullptr;
509 }
SelectCeil(TypeCvtNode & node,Operand & opnd0,const BaseNode & parent)510 Operand *X64CGFunc::SelectCeil(TypeCvtNode &node, Operand &opnd0, const BaseNode &parent)
511 {
512 CHECK_FATAL(false, "NIY");
513 return nullptr;
514 }
SelectFloor(TypeCvtNode & node,Operand & opnd0,const BaseNode & parent)515 Operand *X64CGFunc::SelectFloor(TypeCvtNode &node, Operand &opnd0, const BaseNode &parent)
516 {
517 CHECK_FATAL(false, "NIY");
518 return nullptr;
519 }
SelectRetype(TypeCvtNode & node,Operand & opnd0)520 Operand *X64CGFunc::SelectRetype(TypeCvtNode &node, Operand &opnd0)
521 {
522 CHECK_FATAL(false, "NIY");
523 return nullptr;
524 }
SelectRound(TypeCvtNode & node,Operand & opnd0,const BaseNode & parent)525 Operand *X64CGFunc::SelectRound(TypeCvtNode &node, Operand &opnd0, const BaseNode &parent)
526 {
527 CHECK_FATAL(false, "NIY");
528 return nullptr;
529 }
SelectCvt(const BaseNode & parent,TypeCvtNode & node,Operand & opnd0)530 Operand *X64CGFunc::SelectCvt(const BaseNode &parent, TypeCvtNode &node, Operand &opnd0)
531 {
532 CHECK_FATAL(false, "NIY");
533 return nullptr;
534 }
SelectTrunc(TypeCvtNode & node,Operand & opnd0,const BaseNode & parent)535 Operand *X64CGFunc::SelectTrunc(TypeCvtNode &node, Operand &opnd0, const BaseNode &parent)
536 {
537 CHECK_FATAL(false, "NIY");
538 return nullptr;
539 }
SelectSelect(TernaryNode & node,Operand & cond,Operand & opnd0,Operand & opnd1,const BaseNode & parent,bool hasCompare)540 Operand *X64CGFunc::SelectSelect(TernaryNode &node, Operand &cond, Operand &opnd0, Operand &opnd1,
541 const BaseNode &parent, bool hasCompare)
542 {
543 CHECK_FATAL(false, "NIY");
544 return nullptr;
545 }
SelectMalloc(UnaryNode & call,Operand & opnd0)546 Operand *X64CGFunc::SelectMalloc(UnaryNode &call, Operand &opnd0)
547 {
548 CHECK_FATAL(false, "NIY");
549 return nullptr;
550 }
SelectCopy(Operand & src,PrimType srcType,PrimType dstType)551 RegOperand &X64CGFunc::SelectCopy(Operand &src, PrimType srcType, PrimType dstType)
552 {
553 CHECK_FATAL(false, "NIY");
554 RegOperand *a;
555 return *a;
556 }
SelectAlloca(UnaryNode & call,Operand & opnd0)557 Operand *X64CGFunc::SelectAlloca(UnaryNode &call, Operand &opnd0)
558 {
559 CHECK_FATAL(false, "NIY");
560 return nullptr;
561 }
SelectGCMalloc(GCMallocNode & call)562 Operand *X64CGFunc::SelectGCMalloc(GCMallocNode &call)
563 {
564 CHECK_FATAL(false, "NIY");
565 return nullptr;
566 }
SelectJarrayMalloc(JarrayMallocNode & call,Operand & opnd0)567 Operand *X64CGFunc::SelectJarrayMalloc(JarrayMallocNode &call, Operand &opnd0)
568 {
569 CHECK_FATAL(false, "NIY");
570 return nullptr;
571 }
SelectRangeGoto(RangeGotoNode & rangeGotoNode,Operand & opnd0)572 void X64CGFunc::SelectRangeGoto(RangeGotoNode &rangeGotoNode, Operand &opnd0)
573 {
574 CHECK_FATAL(false, "NIY");
575 }
SelectLazyLoad(Operand & opnd0,PrimType primType)576 Operand *X64CGFunc::SelectLazyLoad(Operand &opnd0, PrimType primType)
577 {
578 CHECK_FATAL(false, "NIY");
579 return nullptr;
580 }
SelectLazyLoadStatic(MIRSymbol & st,int64 offset,PrimType primType)581 Operand *X64CGFunc::SelectLazyLoadStatic(MIRSymbol &st, int64 offset, PrimType primType)
582 {
583 CHECK_FATAL(false, "NIY");
584 return nullptr;
585 }
SelectLoadArrayClassCache(MIRSymbol & st,int64 offset,PrimType primType)586 Operand *X64CGFunc::SelectLoadArrayClassCache(MIRSymbol &st, int64 offset, PrimType primType)
587 {
588 CHECK_FATAL(false, "NIY");
589 return nullptr;
590 }
GenerateYieldpoint(BB & bb)591 void X64CGFunc::GenerateYieldpoint(BB &bb)
592 {
593 CHECK_FATAL(false, "NIY");
594 }
ProcessReturnReg(PrimType primType,int32 sReg)595 Operand &X64CGFunc::ProcessReturnReg(PrimType primType, int32 sReg)
596 {
597 CHECK_FATAL(false, "NIY");
598 Operand *a;
599 return *a;
600 }
GetOrCreateRflag()601 Operand &X64CGFunc::GetOrCreateRflag()
602 {
603 CHECK_FATAL(false, "NIY");
604 Operand *a;
605 return *a;
606 }
GetRflag() const607 const Operand *X64CGFunc::GetRflag() const
608 {
609 CHECK_FATAL(false, "NIY");
610 return nullptr;
611 }
GetFloatRflag() const612 const Operand *X64CGFunc::GetFloatRflag() const
613 {
614 CHECK_FATAL(false, "NIY");
615 return nullptr;
616 }
GetLabelOperand(LabelIdx labIdx) const617 const LabelOperand *X64CGFunc::GetLabelOperand(LabelIdx labIdx) const
618 {
619 CHECK_FATAL(false, "NIY");
620 return nullptr;
621 }
GetOrCreateLabelOperand(LabelIdx labIdx)622 LabelOperand &X64CGFunc::GetOrCreateLabelOperand(LabelIdx labIdx)
623 {
624 std::string lableName = ".L." + std::to_string(GetUniqueID()) + "__" + std::to_string(labIdx);
625 return GetOpndBuilder()->CreateLabel(lableName.c_str(), labIdx);
626 }
GetOrCreateLabelOperand(BB & bb)627 LabelOperand &X64CGFunc::GetOrCreateLabelOperand(BB &bb)
628 {
629 CHECK_FATAL(false, "NIY");
630 LabelOperand *a;
631 return *a;
632 }
CreateVirtualRegisterOperand(regno_t vRegNO)633 RegOperand &X64CGFunc::CreateVirtualRegisterOperand(regno_t vRegNO)
634 {
635 CHECK_FATAL(false, "NIY");
636 RegOperand *a;
637 return *a;
638 }
GetOrCreateVirtualRegisterOperand(regno_t vRegNO)639 RegOperand &X64CGFunc::GetOrCreateVirtualRegisterOperand(regno_t vRegNO)
640 {
641 CHECK_FATAL(false, "NIY");
642 RegOperand *a;
643 return *a;
644 }
GetOrCreateVirtualRegisterOperand(RegOperand & regOpnd)645 RegOperand &X64CGFunc::GetOrCreateVirtualRegisterOperand(RegOperand ®Opnd)
646 {
647 CHECK_FATAL(false, "NIY");
648 RegOperand *a;
649 return *a;
650 }
GetOrCreateFramePointerRegOperand()651 RegOperand &X64CGFunc::GetOrCreateFramePointerRegOperand()
652 {
653 CHECK_FATAL(false, "NIY");
654 RegOperand *a;
655 return *a;
656 }
GetOrCreateStackBaseRegOperand()657 RegOperand &X64CGFunc::GetOrCreateStackBaseRegOperand()
658 {
659 return GetOpndBuilder()->CreatePReg(x64::RBP, GetPointerSize() * kBitsPerByte, kRegTyInt);
660 }
GetZeroOpnd(uint32 size)661 RegOperand &X64CGFunc::GetZeroOpnd(uint32 size)
662 {
663 CHECK_FATAL(false, "NIY");
664 RegOperand *a;
665 return *a;
666 }
CreateCfiRegOperand(uint32 reg,uint32 size)667 Operand &X64CGFunc::CreateCfiRegOperand(uint32 reg, uint32 size)
668 {
669 CHECK_FATAL(false, "NIY");
670 Operand *a;
671 return *a;
672 }
GetTargetRetOperand(PrimType primType,int32 sReg)673 Operand &X64CGFunc::GetTargetRetOperand(PrimType primType, int32 sReg)
674 {
675 CHECK_FATAL(false, "NIY");
676 Operand *a;
677 return *a;
678 }
CreateImmOperand(PrimType primType,int64 val)679 Operand &X64CGFunc::CreateImmOperand(PrimType primType, int64 val)
680 {
681 CHECK_FATAL(false, "NIY");
682 Operand *a;
683 return *a;
684 }
ReplaceOpndInInsn(RegOperand & regDest,RegOperand & regSrc,Insn & insn,regno_t regno)685 void X64CGFunc::ReplaceOpndInInsn(RegOperand ®Dest, RegOperand ®Src, Insn &insn, regno_t regno)
686 {
687 CHECK_FATAL(false, "NIY");
688 }
CleanupDeadMov(bool dump)689 void X64CGFunc::CleanupDeadMov(bool dump)
690 {
691 CHECK_FATAL(false, "NIY");
692 }
GetRealCallerSaveRegs(const Insn & insn,std::set<regno_t> & realCallerSave)693 void X64CGFunc::GetRealCallerSaveRegs(const Insn &insn, std::set<regno_t> &realCallerSave)
694 {
695 CHECK_FATAL(false, "NIY");
696 }
IsFrameReg(const RegOperand & opnd) const697 bool X64CGFunc::IsFrameReg(const RegOperand &opnd) const
698 {
699 CHECK_FATAL(false, "NIY");
700 return false;
701 }
SelectVectorAddLong(PrimType rTy,Operand * o1,Operand * o2,PrimType oty,bool isLow)702 RegOperand *X64CGFunc::SelectVectorAddLong(PrimType rTy, Operand *o1, Operand *o2, PrimType oty, bool isLow)
703 {
704 CHECK_FATAL(false, "NIY");
705 return nullptr;
706 }
SelectVectorAddWiden(Operand * o1,PrimType oty1,Operand * o2,PrimType oty2,bool isLow)707 RegOperand *X64CGFunc::SelectVectorAddWiden(Operand *o1, PrimType oty1, Operand *o2, PrimType oty2, bool isLow)
708 {
709 CHECK_FATAL(false, "NIY");
710 return nullptr;
711 }
SelectVectorAbs(PrimType rType,Operand * o1)712 RegOperand *X64CGFunc::SelectVectorAbs(PrimType rType, Operand *o1)
713 {
714 CHECK_FATAL(false, "NIY");
715 return nullptr;
716 }
SelectVectorBinOp(PrimType rType,Operand * o1,PrimType oTyp1,Operand * o2,PrimType oTyp2,Opcode opc)717 RegOperand *X64CGFunc::SelectVectorBinOp(PrimType rType, Operand *o1, PrimType oTyp1, Operand *o2, PrimType oTyp2,
718 Opcode opc)
719 {
720 CHECK_FATAL(false, "NIY");
721 return nullptr;
722 }
SelectVectorBitwiseOp(PrimType rType,Operand * o1,PrimType oty1,Operand * o2,PrimType oty2,Opcode opc)723 RegOperand *X64CGFunc::SelectVectorBitwiseOp(PrimType rType, Operand *o1, PrimType oty1, Operand *o2, PrimType oty2,
724 Opcode opc)
725 {
726 CHECK_FATAL(false, "NIY");
727 return nullptr;
728 }
SelectVectorCompareZero(Operand * o1,PrimType oty1,Operand * o2,Opcode opc)729 RegOperand *X64CGFunc::SelectVectorCompareZero(Operand *o1, PrimType oty1, Operand *o2, Opcode opc)
730 {
731 CHECK_FATAL(false, "NIY");
732 return nullptr;
733 }
SelectVectorCompare(Operand * o1,PrimType oty1,Operand * o2,PrimType oty2,Opcode opc)734 RegOperand *X64CGFunc::SelectVectorCompare(Operand *o1, PrimType oty1, Operand *o2, PrimType oty2, Opcode opc)
735 {
736 CHECK_FATAL(false, "NIY");
737 return nullptr;
738 }
SelectVectorFromScalar(PrimType pType,Operand * opnd,PrimType sType)739 RegOperand *X64CGFunc::SelectVectorFromScalar(PrimType pType, Operand *opnd, PrimType sType)
740 {
741 CHECK_FATAL(false, "NIY");
742 return nullptr;
743 }
SelectVectorDup(PrimType rType,Operand * src,bool getLow)744 RegOperand *X64CGFunc::SelectVectorDup(PrimType rType, Operand *src, bool getLow)
745 {
746 CHECK_FATAL(false, "NIY");
747 return nullptr;
748 }
SelectVectorGetElement(PrimType rType,Operand * src,PrimType sType,int32 lane)749 RegOperand *X64CGFunc::SelectVectorGetElement(PrimType rType, Operand *src, PrimType sType, int32 lane)
750 {
751 CHECK_FATAL(false, "NIY");
752 return nullptr;
753 }
SelectVectorAbsSubL(PrimType rType,Operand * o1,Operand * o2,PrimType oTy,bool isLow)754 RegOperand *X64CGFunc::SelectVectorAbsSubL(PrimType rType, Operand *o1, Operand *o2, PrimType oTy, bool isLow)
755 {
756 CHECK_FATAL(false, "NIY");
757 return nullptr;
758 }
SelectVectorMadd(Operand * o1,PrimType oTyp1,Operand * o2,PrimType oTyp2,Operand * o3,PrimType oTyp3)759 RegOperand *X64CGFunc::SelectVectorMadd(Operand *o1, PrimType oTyp1, Operand *o2, PrimType oTyp2, Operand *o3,
760 PrimType oTyp3)
761 {
762 CHECK_FATAL(false, "NIY");
763 return nullptr;
764 }
SelectVectorMerge(PrimType rTyp,Operand * o1,Operand * o2,int32 iNum)765 RegOperand *X64CGFunc::SelectVectorMerge(PrimType rTyp, Operand *o1, Operand *o2, int32 iNum)
766 {
767 CHECK_FATAL(false, "NIY");
768 return nullptr;
769 }
SelectVectorMull(PrimType rType,Operand * o1,PrimType oTyp1,Operand * o2,PrimType oTyp2,bool isLow)770 RegOperand *X64CGFunc::SelectVectorMull(PrimType rType, Operand *o1, PrimType oTyp1, Operand *o2, PrimType oTyp2,
771 bool isLow)
772 {
773 CHECK_FATAL(false, "NIY");
774 return nullptr;
775 }
SelectVectorNarrow(PrimType rType,Operand * o1,PrimType otyp)776 RegOperand *X64CGFunc::SelectVectorNarrow(PrimType rType, Operand *o1, PrimType otyp)
777 {
778 CHECK_FATAL(false, "NIY");
779 return nullptr;
780 }
SelectVectorNarrow2(PrimType rType,Operand * o1,PrimType oty1,Operand * o2,PrimType oty2)781 RegOperand *X64CGFunc::SelectVectorNarrow2(PrimType rType, Operand *o1, PrimType oty1, Operand *o2, PrimType oty2)
782 {
783 CHECK_FATAL(false, "NIY");
784 return nullptr;
785 }
SelectVectorNeg(PrimType rType,Operand * o1)786 RegOperand *X64CGFunc::SelectVectorNeg(PrimType rType, Operand *o1)
787 {
788 CHECK_FATAL(false, "NIY");
789 return nullptr;
790 }
SelectVectorNot(PrimType rType,Operand * o1)791 RegOperand *X64CGFunc::SelectVectorNot(PrimType rType, Operand *o1)
792 {
793 CHECK_FATAL(false, "NIY");
794 return nullptr;
795 }
SelectVectorPairwiseAdalp(Operand * src1,PrimType sty1,Operand * src2,PrimType sty2)796 RegOperand *X64CGFunc::SelectVectorPairwiseAdalp(Operand *src1, PrimType sty1, Operand *src2, PrimType sty2)
797 {
798 CHECK_FATAL(false, "NIY");
799 return nullptr;
800 }
SelectVectorPairwiseAdd(PrimType rType,Operand * src,PrimType sType)801 RegOperand *X64CGFunc::SelectVectorPairwiseAdd(PrimType rType, Operand *src, PrimType sType)
802 {
803 CHECK_FATAL(false, "NIY");
804 return nullptr;
805 }
SelectVectorReverse(PrimType rtype,Operand * src,PrimType stype,uint32 size)806 RegOperand *X64CGFunc::SelectVectorReverse(PrimType rtype, Operand *src, PrimType stype, uint32 size)
807 {
808 CHECK_FATAL(false, "NIY");
809 return nullptr;
810 }
SelectVectorSetElement(Operand * eOp,PrimType eTyp,Operand * vOpd,PrimType vTyp,int32 lane)811 RegOperand *X64CGFunc::SelectVectorSetElement(Operand *eOp, PrimType eTyp, Operand *vOpd, PrimType vTyp, int32 lane)
812 {
813 CHECK_FATAL(false, "NIY");
814 return nullptr;
815 }
SelectVectorShift(PrimType rType,Operand * o1,PrimType oty1,Operand * o2,PrimType oty2,Opcode opc)816 RegOperand *X64CGFunc::SelectVectorShift(PrimType rType, Operand *o1, PrimType oty1, Operand *o2, PrimType oty2,
817 Opcode opc)
818 {
819 CHECK_FATAL(false, "NIY");
820 return nullptr;
821 }
SelectVectorShiftImm(PrimType rType,Operand * o1,Operand * imm,int32 sVal,Opcode opc)822 RegOperand *X64CGFunc::SelectVectorShiftImm(PrimType rType, Operand *o1, Operand *imm, int32 sVal, Opcode opc)
823 {
824 CHECK_FATAL(false, "NIY");
825 return nullptr;
826 }
SelectVectorShiftRNarrow(PrimType rType,Operand * o1,PrimType oType,Operand * o2,bool isLow)827 RegOperand *X64CGFunc::SelectVectorShiftRNarrow(PrimType rType, Operand *o1, PrimType oType, Operand *o2, bool isLow)
828 {
829 CHECK_FATAL(false, "NIY");
830 return nullptr;
831 }
SelectVectorSubWiden(PrimType resType,Operand * o1,PrimType otyp1,Operand * o2,PrimType otyp2,bool isLow,bool isWide)832 RegOperand *X64CGFunc::SelectVectorSubWiden(PrimType resType, Operand *o1, PrimType otyp1, Operand *o2, PrimType otyp2,
833 bool isLow, bool isWide)
834 {
835 CHECK_FATAL(false, "NIY");
836 return nullptr;
837 }
SelectVectorSum(PrimType rtype,Operand * o1,PrimType oType)838 RegOperand *X64CGFunc::SelectVectorSum(PrimType rtype, Operand *o1, PrimType oType)
839 {
840 CHECK_FATAL(false, "NIY");
841 return nullptr;
842 }
SelectVectorTableLookup(PrimType rType,Operand * o1,Operand * o2)843 RegOperand *X64CGFunc::SelectVectorTableLookup(PrimType rType, Operand *o1, Operand *o2)
844 {
845 CHECK_FATAL(false, "NIY");
846 return nullptr;
847 }
SelectVectorWiden(PrimType rType,Operand * o1,PrimType otyp,bool isLow)848 RegOperand *X64CGFunc::SelectVectorWiden(PrimType rType, Operand *o1, PrimType otyp, bool isLow)
849 {
850 CHECK_FATAL(false, "NIY");
851 return nullptr;
852 }
SelectIntrinsicOpWithNParams(IntrinsicopNode & intrinopNode,PrimType retType,const std::string & name)853 Operand *X64CGFunc::SelectIntrinsicOpWithNParams(IntrinsicopNode &intrinopNode, PrimType retType,
854 const std::string &name)
855 {
856 CHECK_FATAL(false, "NIY");
857 return nullptr;
858 }
ProcessLazyBinding()859 void X64CGFunc::ProcessLazyBinding()
860 {
861 CHECK_FATAL(false, "NIY");
862 }
DBGFixCallFrameLocationOffsets()863 void X64CGFunc::DBGFixCallFrameLocationOffsets()
864 {
865 CHECK_FATAL(false, "NIY");
866 }
GetPseudoRegisterSpillMemoryOperand(PregIdx idx)867 MemOperand *X64CGFunc::GetPseudoRegisterSpillMemoryOperand(PregIdx idx)
868 {
869 CHECK_FATAL(false, "NIY");
870 return nullptr;
871 }
GetBaseOffset(const SymbolAlloc & symbolAlloc)872 int32 X64CGFunc::GetBaseOffset(const SymbolAlloc &symbolAlloc)
873 {
874 const auto *symAlloc = static_cast<const X64SymbolAlloc *>(&symbolAlloc);
875 /* Call Frame layout of X64
876 * Refer to layout in x64_memlayout.h.
877 * Do Not change this unless you know what you do
878 * memlayout like this
879 * rbp position
880 * prologue slots --
881 * ArgsReg |
882 * Locals | -- FrameSize
883 * Spill |
884 * ArgsStk --
885 */
886 constexpr const int32 sizeofFplr = 2 * kIntregBytelen;
887 // baseOffset is the offset of this symbol based on the rbp position.
888 int32 baseOffset = symAlloc->GetOffset();
889 MemSegmentKind sgKind = symAlloc->GetMemSegment()->GetMemSegmentKind();
890 auto *memLayout = static_cast<X64MemLayout *>(this->GetMemlayout());
891 if (sgKind == kMsSpillReg) {
892 /* spill = -(Locals + ArgsReg + baseOffset + ReseverdSlot + kSizeOfPtr) */
893 return -(memLayout->GetSizeOfLocals() + memLayout->SizeOfArgsRegisterPassed() + baseOffset +
894 GetFunction().GetFrameReseverdSlot() + GetPointerSize());
895 } else if (sgKind == kMsLocals) {
896 /* Locals = baseOffset - (ReseverdSlot + Locals + ArgsReg) */
897 return baseOffset - (GetFunction().GetFrameReseverdSlot() + memLayout->GetSizeOfLocals() +
898 memLayout->SizeOfArgsRegisterPassed());
899 } else if (sgKind == kMsArgsRegPassed) {
900 /* ArgsReg = baseOffset - ReseverdSlot - ArgsReg */
901 return baseOffset - GetFunction().GetFrameReseverdSlot() - memLayout->SizeOfArgsRegisterPassed();
902 } else if (sgKind == kMsArgsStkPassed) {
903 return baseOffset + sizeofFplr;
904 } else {
905 CHECK_FATAL(false, "sgKind check");
906 }
907 return 0;
908 }
909
GetBaseReg(const maplebe::SymbolAlloc & symAlloc)910 RegOperand *X64CGFunc::GetBaseReg(const maplebe::SymbolAlloc &symAlloc)
911 {
912 MemSegmentKind sgKind = symAlloc.GetMemSegment()->GetMemSegmentKind();
913 DEBUG_ASSERT(((sgKind == kMsArgsRegPassed) || (sgKind == kMsLocals) || (sgKind == kMsRefLocals) ||
914 (sgKind == kMsArgsToStkPass) || (sgKind == kMsArgsStkPassed)),
915 "NIY");
916 if (sgKind == kMsLocals || sgKind == kMsArgsRegPassed || sgKind == kMsArgsStkPassed) {
917 return &GetOpndBuilder()->CreatePReg(x64::RBP, GetPointerSize() * kBitsPerByte, kRegTyInt);
918 } else {
919 CHECK_FATAL(false, "NIY sgKind");
920 }
921 return nullptr;
922 }
923
FreeSpillRegMem(regno_t vrNum)924 void X64CGFunc::FreeSpillRegMem(regno_t vrNum)
925 {
926 MemOperand *memOpnd = nullptr;
927
928 auto p = spillRegMemOperands.find(vrNum);
929 if (p != spillRegMemOperands.end()) {
930 memOpnd = p->second;
931 }
932
933 if ((memOpnd == nullptr) && IsVRegNOForPseudoRegister(vrNum)) {
934 auto pSecond = pRegSpillMemOperands.find(GetPseudoRegIdxFromVirtualRegNO(vrNum));
935 if (pSecond != pRegSpillMemOperands.end()) {
936 memOpnd = pSecond->second;
937 }
938 }
939
940 if (memOpnd == nullptr) {
941 DEBUG_ASSERT(false, "free spillreg have no mem");
942 return;
943 }
944
945 uint32 size = memOpnd->GetSize();
946 MapleUnorderedMap<uint32, SpillMemOperandSet *>::iterator iter;
947 if ((iter = reuseSpillLocMem.find(size)) != reuseSpillLocMem.end()) {
948 iter->second->Add(*memOpnd);
949 } else {
950 reuseSpillLocMem[size] = memPool->New<SpillMemOperandSet>(*GetFuncScopeAllocator());
951 reuseSpillLocMem[size]->Add(*memOpnd);
952 }
953 }
954
GetOrCreatSpillMem(regno_t vrNum,uint32 memSize)955 MemOperand *X64CGFunc::GetOrCreatSpillMem(regno_t vrNum, uint32 memSize)
956 {
957 /* NOTES: must used in RA, not used in other place. */
958 if (IsVRegNOForPseudoRegister(vrNum)) {
959 auto p = pRegSpillMemOperands.find(GetPseudoRegIdxFromVirtualRegNO(vrNum));
960 if (p != pRegSpillMemOperands.end()) {
961 return p->second;
962 }
963 }
964
965 auto p = spillRegMemOperands.find(vrNum);
966 if (p == spillRegMemOperands.end()) {
967 uint32 memBitSize = k64BitSize;
968 auto it = reuseSpillLocMem.find(memBitSize);
969 if (it != reuseSpillLocMem.end()) {
970 MemOperand *memOpnd = it->second->GetOne();
971 if (memOpnd != nullptr) {
972 spillRegMemOperands.emplace(std::pair<regno_t, MemOperand*>(vrNum, memOpnd));
973 return memOpnd;
974 }
975 }
976
977 RegOperand &baseOpnd = GetOrCreateStackBaseRegOperand();
978 int32 offset = GetOrCreatSpillRegLocation(vrNum, memBitSize / kBitsPerByte);
979 MemOperand *memOpnd = &GetOpndBuilder()->CreateMem(baseOpnd, offset, memBitSize);
980 spillRegMemOperands.emplace(std::pair<regno_t, MemOperand*>(vrNum, memOpnd));
981 return memOpnd;
982 } else {
983 return p->second;
984 }
985 }
986
Visit(maplebe::RegOperand * v)987 void X64OpndDumpVisitor::Visit(maplebe::RegOperand *v)
988 {
989 DumpOpndPrefix();
990 LogInfo::MapleLogger() << "reg ";
991 DumpRegInfo(*v);
992 DumpSize(*v);
993 DumpReferenceInfo(*v);
994 const OpndDesc *regDesc = GetOpndDesc();
995 LogInfo::MapleLogger() << " [";
996 if (regDesc->IsRegDef()) {
997 LogInfo::MapleLogger() << "DEF,";
998 }
999 if (regDesc->IsRegUse()) {
1000 LogInfo::MapleLogger() << "USE,";
1001 }
1002 LogInfo::MapleLogger() << "]";
1003 DumpOpndSuffix();
1004 }
1005
Visit(CommentOperand * v)1006 void X64OpndDumpVisitor::Visit(CommentOperand *v)
1007 {
1008 LogInfo::MapleLogger() << ":#" << v->GetComment();
1009 }
1010
Visit(maplebe::ImmOperand * v)1011 void X64OpndDumpVisitor::Visit(maplebe::ImmOperand *v)
1012 {
1013 DumpOpndPrefix();
1014 LogInfo::MapleLogger() << "imm ";
1015 LogInfo::MapleLogger() << v->GetValue();
1016 DumpSize(*v);
1017 DumpReferenceInfo(*v);
1018 DumpOpndSuffix();
1019 }
1020
Visit(maplebe::MemOperand * v)1021 void X64OpndDumpVisitor::Visit(maplebe::MemOperand *v)
1022 {
1023 DumpOpndPrefix();
1024 LogInfo::MapleLogger() << "mem ";
1025 if (v->GetBaseRegister() != nullptr) {
1026 DumpRegInfo(*v->GetBaseRegister());
1027 if (v->GetOffsetOperand() != nullptr) {
1028 LogInfo::MapleLogger() << " + " << v->GetOffsetOperand()->GetValue();
1029 }
1030 }
1031 DumpSize(*v);
1032 DumpReferenceInfo(*v);
1033 DumpOpndSuffix();
1034 }
DumpRegInfo(maplebe::RegOperand & v)1035 void X64OpndDumpVisitor::DumpRegInfo(maplebe::RegOperand &v)
1036 {
1037 if (v.GetRegisterNumber() > baseVirtualRegNO) {
1038 LogInfo::MapleLogger() << "V" << v.GetRegisterNumber();
1039 } else {
1040 uint8 regType = -1;
1041 switch (v.GetSize()) {
1042 case k8BitSize:
1043 /* use lower 8-bits */
1044 regType = X64CG::kR8LowList;
1045 break;
1046 case k16BitSize:
1047 regType = X64CG::kR16List;
1048 break;
1049 case k32BitSize:
1050 regType = X64CG::kR32List;
1051 break;
1052 case k64BitSize:
1053 regType = X64CG::kR64List;
1054 break;
1055 default:
1056 CHECK_FATAL(false, "unkown reg size");
1057 break;
1058 }
1059 assembler::Reg reg = assembler::kRegArray[regType][v.GetRegisterNumber()];
1060 LogInfo::MapleLogger() << "%" << assembler::kRegStrMap.at(reg);
1061 }
1062 }
1063
Visit(maplebe::FuncNameOperand * v)1064 void X64OpndDumpVisitor::Visit(maplebe::FuncNameOperand *v)
1065 {
1066 DumpOpndPrefix();
1067 LogInfo::MapleLogger() << "funcname ";
1068 LogInfo::MapleLogger() << v->GetName();
1069 DumpSize(*v);
1070 DumpReferenceInfo(*v);
1071 DumpOpndSuffix();
1072 }
1073
Visit(maplebe::ListOperand * v)1074 void X64OpndDumpVisitor::Visit(maplebe::ListOperand *v)
1075 {
1076 DumpOpndPrefix();
1077 LogInfo::MapleLogger() << "list ";
1078
1079 MapleList<RegOperand *> opndList = v->GetOperands();
1080 for (auto it = opndList.begin(); it != opndList.end();) {
1081 (*it)->Dump();
1082 LogInfo::MapleLogger() << (++it == opndList.end() ? "" : " ,");
1083 }
1084 DumpSize(*v);
1085 DumpOpndSuffix();
1086 }
1087
Visit(maplebe::LabelOperand * v)1088 void X64OpndDumpVisitor::Visit(maplebe::LabelOperand *v)
1089 {
1090 DumpOpndPrefix();
1091 LogInfo::MapleLogger() << "label ";
1092 LogInfo::MapleLogger() << v->GetLabelIndex();
1093 DumpSize(*v);
1094 DumpOpndSuffix();
1095 }
1096
Visit(PhiOperand * v)1097 void X64OpndDumpVisitor::Visit(PhiOperand *v)
1098 {
1099 CHECK_FATAL(false, "NIY");
1100 }
1101
Visit(CondOperand * v)1102 void X64OpndDumpVisitor::Visit(CondOperand *v)
1103 {
1104 CHECK_FATAL(false, "do not use this operand, it will be eliminated soon");
1105 }
Visit(StImmOperand * v)1106 void X64OpndDumpVisitor::Visit(StImmOperand *v)
1107 {
1108 CHECK_FATAL(false, "do not use this operand, it will be eliminated soon");
1109 }
Visit(BitShiftOperand * v)1110 void X64OpndDumpVisitor::Visit(BitShiftOperand *v)
1111 {
1112 CHECK_FATAL(false, "do not use this operand, it will be eliminated soon");
1113 }
Visit(ExtendShiftOperand * v)1114 void X64OpndDumpVisitor::Visit(ExtendShiftOperand *v)
1115 {
1116 CHECK_FATAL(false, "do not use this operand, it will be eliminated soon");
1117 }
1118 } // namespace maplebe
1119