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_X64_X64_ABI_H 17 #define MAPLEBE_INCLUDE_CG_X64_X64_ABI_H 18 19 #include "x64_isa.h" 20 #include "types_def.h" 21 #include "becommon.h" 22 23 namespace maplebe { 24 using namespace maple; 25 26 namespace x64 { 27 28 constexpr int32 kNumFloatParmRegs = 8; 29 constexpr int32 kNumFloatReturnRegs = 2; 30 31 constexpr X64reg kFloatParmRegs[kNumFloatParmRegs] = { V0, V1, V2, V3, V4, V5, V6, V7 }; 32 constexpr X64reg kFloatReturnRegs[kNumFloatReturnRegs] = { V0, V1 }; 33 34 /* 35 * Refer to: 36 * x64-bit Architecture. 37 */ 38 bool IsAvailableReg(X64reg reg); 39 bool IsCalleeSavedReg(X64reg reg); 40 bool IsParamReg(X64reg reg); 41 bool IsSpillReg(X64reg reg); 42 bool IsExtraSpillReg(X64reg reg); 43 bool IsSpillRegInRA(X64reg regNO, bool has3RegOpnd); 44 } /* namespace x64 */ 45 46 /* 47 * X64-bit Architecture. 48 * After the argument values have been computed, they are placed either in registers 49 * or pushed on the stack. The way how values are passed is described in the 50 * following sections. 51 * - INTEGER This class consists of integral types that fit into one of the general 52 purpose registers. 53 - SSE The class consists of types that fit into a vector register. 54 - SSEUP The class consists of types that fit into a vector register and can be passed 55 and returned in the upper bytes of it. 56 - X87, X87UP These classes consists of types that will be returned via the x87 FPU. 57 - COMPLEX_X87 This class consists of types that will be returned via the x87 FPU. 58 - NO_CLASS This class is used as initializer in the algorithms. It will be used for 59 padding and empty structures and unions. 60 - MEMORY This class consists of types that will be passed and returned in memory via the stack. 61 * 62 */ 63 } /* namespace maplebe */ 64 65 #endif /* MAPLEBE_INCLUDE_CG_X64_X64_ABI_H */ 66