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 #ifndef MAPLEBE_INCLUDE_CG_AARCH64_AARCH64_ARGS_H 17 #define MAPLEBE_INCLUDE_CG_AARCH64_AARCH64_ARGS_H 18 19 #include "args.h" 20 #include "aarch64_cgfunc.h" 21 22 namespace maplebe { 23 using namespace maple; 24 25 class AArch64MoveRegArgs : public MoveRegArgs { 26 public: AArch64MoveRegArgs(CGFunc & func)27 explicit AArch64MoveRegArgs(CGFunc &func) : MoveRegArgs(func) 28 { 29 aarFunc = static_cast<AArch64CGFunc *>(&func); 30 } ~AArch64MoveRegArgs()31 ~AArch64MoveRegArgs() override 32 { 33 aarFunc = nullptr; 34 } 35 void Run() override; 36 37 private: 38 // gen param to stack 39 // call foo(var $a) -> str X0, [memOpnd] 40 void MoveRegisterArgs() const; 41 // gen param to preg 42 // call foo(%1) -> mov V201, X0 43 void MoveVRegisterArgs(); 44 void MoveLocalRefVarToRefLocals(MIRSymbol &mirSym) const; 45 void LoadStackArgsToVReg(MIRSymbol &mirSym) const; 46 void MoveArgsToVReg(const CCLocInfo &ploc, MIRSymbol &mirSym) const; 47 Insn &CreateMoveArgsToVRegInsn(MOperator mOp, RegOperand &destOpnd, RegOperand &srcOpnd, PrimType primType) const; 48 49 AArch64CGFunc *aarFunc = nullptr; 50 }; 51 } /* namespace maplebe */ 52 53 #endif /* MAPLEBE_INCLUDE_CG_AARCH64_AARCH64_ARGS_H */ 54