• 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 #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 kMaxInstrForTbnz = 8000;      // approximately less than (2^13);
32 constexpr uint32 kMaxInstrForCondBr = 260000;  // approximately less than (2^18);
33 constexpr uint32 kMaxInstrForLdr = 260000;     // approximately less than (2^18);
34 
35 extern std::vector<AArch64reg> intReturnRegs;
36 extern std::vector<AArch64reg> floatReturnRegs;
37 extern std::vector<AArch64reg> intParmRegs;
38 extern std::vector<AArch64reg> floatParmRegs;
39 
40 /*
41  * Refer to ARM IHI 0055C_beta: Procedure Call Standard  for
42  * ARM 64-bit Architecture. Section 5.5
43  */
44 bool IsAvailableReg(AArch64reg reg);
45 bool IsCalleeSavedReg(AArch64reg reg);
46 bool IsCallerSaveReg(AArch64reg reg);
47 bool IsSpillReg(AArch64reg reg);
48 bool IsExtraSpillReg(AArch64reg reg);
49 bool IsSpillRegInRA(AArch64reg regNO, bool has3RegOpnd);
50 } /* namespace AArch64Abi */
51 
52 } /* namespace maplebe */
53 
54 #endif /* MAPLEBE_INCLUDE_CG_AARCH64_AARCH64_ABI_H */
55