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_ABI_H 17 #define MAPLEBE_INCLUDE_CG_AARCH64_AARCH64_ABI_H 18 19 #include "aarch64_isa.h" 20 #include "types_def.h" 21 #include "becommon.h" 22 23 namespace maplebe { 24 using namespace maple; 25 26 namespace AArch64Abi { 27 constexpr int32 kNumIntParmRegs = 8; 28 constexpr int32 kNumFloatParmRegs = 8; 29 constexpr int32 kYieldPointReservedReg = 19; 30 constexpr uint32 kNormalUseOperandNum = 3; 31 constexpr uint32 kMaxInstrForCondBr = 260000; // approximately less than (2^18); 32 33 constexpr AArch64reg intReturnRegs[kNumIntParmRegs] = {R0, R1, R2, R3, R4, R5, R6, R7}; 34 constexpr AArch64reg floatReturnRegs[kNumFloatParmRegs] = {V0, V1, V2, V3, V4, V5, V6, V7}; 35 constexpr AArch64reg intParmRegs[kNumIntParmRegs] = {R0, R1, R2, R3, R4, R5, R6, R7}; 36 constexpr AArch64reg floatParmRegs[kNumFloatParmRegs] = {V0, V1, V2, V3, V4, V5, V6, V7}; 37 38 /* 39 * Refer to ARM IHI 0055C_beta: Procedure Call Standard for 40 * ARM 64-bit Architecture. Section 5.5 41 */ 42 bool IsAvailableReg(AArch64reg reg); 43 bool IsCalleeSavedReg(AArch64reg reg); 44 bool IsCallerSaveReg(AArch64reg reg); 45 bool IsParamReg(AArch64reg reg); 46 bool IsSpillReg(AArch64reg reg); 47 bool IsExtraSpillReg(AArch64reg reg); 48 bool IsSpillRegInRA(AArch64reg regNO, bool has3RegOpnd); 49 PrimType IsVectorArrayType(MIRType *ty, uint32 &arraySize); 50 } /* namespace AArch64Abi */ 51 52 } /* namespace maplebe */ 53 54 #endif /* MAPLEBE_INCLUDE_CG_AARCH64_AARCH64_ABI_H */ 55