• 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 #include "x64_cgfunc.h"
18 #include "x64_isa.h"
19 namespace maplebe {
20 
21 using namespace x64;
22 
23 #define DEFINE_MOP(...) {__VA_ARGS__},
24 const InsnDesc X64CG::kMd[kMopLast] = {
25 #include "abstract_mmir.def"
26 #include "x64_md.def"
27 };
28 #undef DEFINE_MOP
29 
EnrollTargetPhases(maple::MaplePhaseManager * pm) const30 void X64CG::EnrollTargetPhases(maple::MaplePhaseManager *pm) const {
31 #include "x64_phases.def"
32 }
33 
CreateCGFunc(MIRModule & mod,MIRFunction & mirFunc,BECommon & bec,MemPool & memPool,StackMemPool & stackMp,MapleAllocator & mallocator,uint32 funcId)34 CGFunc *X64CG::CreateCGFunc(MIRModule &mod, MIRFunction &mirFunc, BECommon &bec, MemPool &memPool,
35                             StackMemPool &stackMp, MapleAllocator &mallocator, uint32 funcId)
36 {
37     return memPool.New<X64CGFunc>(mod, *this, mirFunc, bec, memPool, stackMp, mallocator, funcId);
38 }
39 
IsEffectiveCopy(Insn & insn) const40 bool X64CG::IsEffectiveCopy(Insn &insn) const
41 {
42     return false;
43 }
IsTargetInsn(MOperator mOp) const44 bool X64CG::IsTargetInsn(MOperator mOp) const
45 {
46     return (mOp >= MOP_movb_r_r && mOp <= MOP_pseudo_ret_int);
47 }
IsClinitInsn(MOperator mOp) const48 bool X64CG::IsClinitInsn(MOperator mOp) const
49 {
50     return false;
51 }
IsPseudoInsn(MOperator mOp) const52 bool X64CG::IsPseudoInsn(MOperator mOp) const
53 {
54     return false;
55 }
56 
BuildPhiInsn(RegOperand & defOpnd,Operand & listParam)57 Insn &X64CG::BuildPhiInsn(RegOperand &defOpnd, Operand &listParam)
58 {
59     CHECK_FATAL(false, "NIY");
60     Insn *a = nullptr;
61     return *a;
62 }
63 
CreatePhiOperand(MemPool & mp,MapleAllocator & mAllocator)64 PhiOperand &X64CG::CreatePhiOperand(MemPool &mp, MapleAllocator &mAllocator)
65 {
66     CHECK_FATAL(false, "NIY");
67     PhiOperand *a = nullptr;
68     return *a;
69 }
70 
DumpTargetOperand(Operand & opnd,const OpndDesc & opndDesc) const71 void X64CG::DumpTargetOperand(Operand &opnd, const OpndDesc &opndDesc) const
72 {
73     X64OpndDumpVisitor visitor(opndDesc);
74     opnd.Accept(visitor);
75 }
76 
IsExclusiveFunc(MIRFunction & mirFunc)77 bool X64CG::IsExclusiveFunc(MIRFunction &mirFunc)
78 {
79     return false;
80 }
81 
82 /* NOTE: Consider making be_common a field of CG. */
GenerateObjectMaps(BECommon & beCommon)83 void X64CG::GenerateObjectMaps(BECommon &beCommon) {}
84 
85 /* Used for GCTIB pattern merging */
FindGCTIBPatternName(const std::string & name) const86 std::string X64CG::FindGCTIBPatternName(const std::string &name) const
87 {
88     return "";
89 }
90 }  // namespace maplebe
91