• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "x64_cg.h"
17 namespace maplebe {
18 
19 using namespace x64;
20 
21 #define DEFINE_MOP(...) {__VA_ARGS__},
22 const InsnDesc X64CG::kMd[kMopLast] = {
23 #include "abstract_mmir.def"
24 #include "x64_md.def"
25 };
26 #undef DEFINE_MOP
27 
EnrollTargetPhases(maple::MaplePhaseManager * pm) const28 void X64CG::EnrollTargetPhases(maple::MaplePhaseManager *pm) const {
29 #include "x64_phases.def"
30 }
31 
CreateCGFunc(MIRModule & mod,MIRFunction & mirFunc,BECommon & bec,MemPool & memPool,StackMemPool & stackMp,MapleAllocator & mallocator,uint32 funcId)32 CGFunc *X64CG::CreateCGFunc(MIRModule &mod, MIRFunction &mirFunc, BECommon &bec, MemPool &memPool,
33                             StackMemPool &stackMp, MapleAllocator &mallocator, uint32 funcId)
34 {
35     return memPool.New<X64CGFunc>(mod, *this, mirFunc, bec, memPool, stackMp, mallocator, funcId);
36 }
37 
IsEffectiveCopy(Insn & insn) const38 bool X64CG::IsEffectiveCopy(Insn &insn) const
39 {
40     return false;
41 }
IsTargetInsn(MOperator mOp) const42 bool X64CG::IsTargetInsn(MOperator mOp) const
43 {
44     return (mOp >= MOP_movb_r_r && mOp <= MOP_pseudo_ret_int);
45 }
IsClinitInsn(MOperator mOp) const46 bool X64CG::IsClinitInsn(MOperator mOp) const
47 {
48     return false;
49 }
IsPseudoInsn(MOperator mOp) const50 bool X64CG::IsPseudoInsn(MOperator mOp) const
51 {
52     return false;
53 }
54 
CreatePhiOperand(MemPool & mp,MapleAllocator & mAllocator)55 PhiOperand &X64CG::CreatePhiOperand(MemPool &mp, MapleAllocator &mAllocator)
56 {
57     CHECK_FATAL(false, "NIY");
58     PhiOperand *a = nullptr;
59     return *a;
60 }
61 
DumpTargetOperand(Operand & opnd,const OpndDesc & opndDesc) const62 void X64CG::DumpTargetOperand(Operand &opnd, const OpndDesc &opndDesc) const
63 {
64     X64OpndDumpVisitor visitor(opndDesc);
65     opnd.Accept(visitor);
66 }
67 
IsExclusiveFunc(MIRFunction & mirFunc)68 bool X64CG::IsExclusiveFunc(MIRFunction &mirFunc)
69 {
70     return false;
71 }
72 
73 #ifdef ARK_LITECG_DEBUG
74 /* Used for GCTIB pattern merging */
FindGCTIBPatternName(const std::string & name) const75 std::string X64CG::FindGCTIBPatternName(const std::string &name) const
76 {
77     return "";
78 }
79 #endif
80 }  // namespace maplebe
81