| OLD | NEW |
| 1 //===- subzero/src/IceRegistersARM32.h - Register information ---*- C++ -*-===// | 1 //===- subzero/src/IceRegistersARM32.h - Register information ---*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 unsigned IsI64Pair : 1; | 95 unsigned IsI64Pair : 1; |
| 96 unsigned IsFP32 : 1; | 96 unsigned IsFP32 : 1; |
| 97 unsigned IsFP64 : 1; | 97 unsigned IsFP64 : 1; |
| 98 unsigned IsVec128 : 1; | 98 unsigned IsVec128 : 1; |
| 99 #define NUM_ALIASES_BITS 3 | 99 #define NUM_ALIASES_BITS 3 |
| 100 SizeT NumAliases : (NUM_ALIASES_BITS + 1); | 100 SizeT NumAliases : (NUM_ALIASES_BITS + 1); |
| 101 uint16_t Aliases[1 << NUM_ALIASES_BITS]; | 101 uint16_t Aliases[1 << NUM_ALIASES_BITS]; |
| 102 #undef NUM_ALIASES_BITS | 102 #undef NUM_ALIASES_BITS |
| 103 } RegTable[Reg_NUM]; | 103 } RegTable[Reg_NUM]; |
| 104 | 104 |
| 105 static inline bool isGPRegister(int32_t RegNum) { | 105 static inline void assertValidRegNum(RegNumT RegNum) { |
| 106 assert(RegNum >= 0); | 106 (void)RegNum; |
| 107 assert(RegNum < Reg_NUM); | 107 assert(RegNum != RegNumT::NoRegister); |
| 108 } |
| 109 |
| 110 static inline bool isGPRegister(RegNumT RegNum) { |
| 111 RegNum.assertIsValid(); |
| 108 return RegTable[RegNum].IsGPR; | 112 return RegTable[RegNum].IsGPR; |
| 109 } | 113 } |
| 110 | 114 |
| 111 static constexpr inline SizeT getNumGPRegs() { | 115 static constexpr inline SizeT getNumGPRegs() { |
| 112 return 0 | 116 return 0 |
| 113 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ | 117 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ |
| 114 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | 118 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
| 115 +(isGPR) | 119 +(isGPR) |
| 116 REGARM32_TABLE | 120 REGARM32_TABLE |
| 117 #undef X | 121 #undef X |
| 118 ; | 122 ; |
| 119 } | 123 } |
| 120 | 124 |
| 121 static inline GPRRegister getEncodedGPR(int32_t RegNum) { | 125 static inline GPRRegister getEncodedGPR(RegNumT RegNum) { |
| 122 assert(RegNum >= 0); | 126 RegNum.assertIsValid(); |
| 123 assert(RegNum < Reg_NUM); | |
| 124 return GPRRegister(RegTable[RegNum].Encoding); | 127 return GPRRegister(RegTable[RegNum].Encoding); |
| 125 } | 128 } |
| 126 | 129 |
| 127 static constexpr inline SizeT getNumGPRs() { | 130 static constexpr inline SizeT getNumGPRs() { |
| 128 return 0 | 131 return 0 |
| 129 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ | 132 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ |
| 130 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | 133 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
| 131 +(isGPR) | 134 +(isGPR) |
| 132 REGARM32_TABLE | 135 REGARM32_TABLE |
| 133 #undef X | 136 #undef X |
| 134 ; | 137 ; |
| 135 } | 138 } |
| 136 | 139 |
| 137 static inline bool isGPR(int32_t RegNum) { | 140 static inline bool isGPR(RegNumT RegNum) { |
| 138 assert(RegNum >= 0); | 141 RegNum.assertIsValid(); |
| 139 assert(RegNum < Reg_NUM); | |
| 140 return RegTable[RegNum].IsGPR; | 142 return RegTable[RegNum].IsGPR; |
| 141 } | 143 } |
| 142 | 144 |
| 143 static inline GPRRegister getI64PairFirstGPRNum(int32_t RegNum) { | 145 static inline GPRRegister getI64PairFirstGPRNum(RegNumT RegNum) { |
| 144 assert(RegNum >= 0); | 146 RegNum.assertIsValid(); |
| 145 assert(RegNum < Reg_NUM); | |
| 146 return GPRRegister(RegTable[RegNum].Encoding); | 147 return GPRRegister(RegTable[RegNum].Encoding); |
| 147 } | 148 } |
| 148 | 149 |
| 149 static inline GPRRegister getI64PairSecondGPRNum(int32_t RegNum) { | 150 static inline GPRRegister getI64PairSecondGPRNum(RegNumT RegNum) { |
| 150 assert(RegNum >= 0); | 151 RegNum.assertIsValid(); |
| 151 assert(RegNum < Reg_NUM); | |
| 152 return GPRRegister(RegTable[RegNum].Encoding + 1); | 152 return GPRRegister(RegTable[RegNum].Encoding + 1); |
| 153 } | 153 } |
| 154 | 154 |
| 155 static inline bool isI64RegisterPair(int32_t RegNum) { | 155 static inline bool isI64RegisterPair(RegNumT RegNum) { |
| 156 assert(RegNum >= 0); | 156 RegNum.assertIsValid(); |
| 157 assert(RegNum < Reg_NUM); | |
| 158 return RegTable[RegNum].IsI64Pair; | 157 return RegTable[RegNum].IsI64Pair; |
| 159 } | 158 } |
| 160 | 159 |
| 161 static inline bool isEncodedSReg(int32_t RegNum) { | 160 static inline bool isEncodedSReg(RegNumT RegNum) { |
| 162 assert(RegNum >= 0); | 161 RegNum.assertIsValid(); |
| 163 assert(RegNum < Reg_NUM); | |
| 164 return RegTable[RegNum].IsFP32; | 162 return RegTable[RegNum].IsFP32; |
| 165 } | 163 } |
| 166 | 164 |
| 167 static constexpr inline SizeT getNumSRegs() { | 165 static constexpr inline SizeT getNumSRegs() { |
| 168 return 0 | 166 return 0 |
| 169 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ | 167 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ |
| 170 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | 168 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
| 171 +(isFP32) | 169 +(isFP32) |
| 172 REGARM32_TABLE | 170 REGARM32_TABLE |
| 173 #undef X | 171 #undef X |
| 174 ; | 172 ; |
| 175 } | 173 } |
| 176 | 174 |
| 177 static inline SRegister getEncodedSReg(int32_t RegNum) { | 175 static inline SRegister getEncodedSReg(RegNumT RegNum) { |
| 178 assert(RegNum >= 0); | 176 RegNum.assertIsValid(); |
| 179 assert(RegNum < Reg_NUM); | |
| 180 return SRegister(RegTable[RegNum].Encoding); | 177 return SRegister(RegTable[RegNum].Encoding); |
| 181 } | 178 } |
| 182 | 179 |
| 183 static inline bool isEncodedDReg(int32_t RegNum) { | 180 static inline bool isEncodedDReg(RegNumT RegNum) { |
| 184 assert(RegNum >= 0); | 181 RegNum.assertIsValid(); |
| 185 assert(RegNum < Reg_NUM); | |
| 186 return RegTable[RegNum].IsFP64; | 182 return RegTable[RegNum].IsFP64; |
| 187 } | 183 } |
| 188 | 184 |
| 189 static constexpr inline SizeT getNumDRegs() { | 185 static constexpr inline SizeT getNumDRegs() { |
| 190 return 0 | 186 return 0 |
| 191 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ | 187 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ |
| 192 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | 188 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
| 193 +(isFP64) | 189 +(isFP64) |
| 194 REGARM32_TABLE | 190 REGARM32_TABLE |
| 195 #undef X | 191 #undef X |
| 196 ; | 192 ; |
| 197 } | 193 } |
| 198 | 194 |
| 199 static inline DRegister getEncodedDReg(int32_t RegNum) { | 195 static inline DRegister getEncodedDReg(RegNumT RegNum) { |
| 200 assert(RegNum >= 0); | 196 RegNum.assertIsValid(); |
| 201 assert(RegNum < Reg_NUM); | |
| 202 return DRegister(RegTable[RegNum].Encoding); | 197 return DRegister(RegTable[RegNum].Encoding); |
| 203 } | 198 } |
| 204 | 199 |
| 205 static inline bool isEncodedQReg(int32_t RegNum) { | 200 static inline bool isEncodedQReg(RegNumT RegNum) { |
| 206 assert(RegNum >= 0); | 201 RegNum.assertIsValid(); |
| 207 assert(RegNum < Reg_NUM); | |
| 208 return RegTable[RegNum].IsVec128; | 202 return RegTable[RegNum].IsVec128; |
| 209 } | 203 } |
| 210 | 204 |
| 211 static inline QRegister getEncodedQReg(int32_t RegNum) { | 205 static inline QRegister getEncodedQReg(RegNumT RegNum) { |
| 212 assert(isEncodedQReg(RegNum)); | 206 assert(isEncodedQReg(RegNum)); |
| 213 return QRegister(RegTable[RegNum].Encoding); | 207 return QRegister(RegTable[RegNum].Encoding); |
| 214 } | 208 } |
| 215 | 209 |
| 216 static inline IceString getRegName(int32_t RegNum) { | 210 static inline IceString getRegName(RegNumT RegNum) { |
| 217 assert(RegNum >= 0); | 211 RegNum.assertIsValid(); |
| 218 assert(RegNum < Reg_NUM); | |
| 219 return RegTable[RegNum].Name; | 212 return RegTable[RegNum].Name; |
| 220 } | 213 } |
| 221 | 214 |
| 222 // Extend enum RegClass with ARM32-specific register classes. | 215 // Extend enum RegClass with ARM32-specific register classes. |
| 223 enum RegClassARM32 : uint8_t { | 216 enum RegClassARM32 : uint8_t { |
| 224 RCARM32_QtoS = RC_Target, // Denotes Q registers that are aliased by S | 217 RCARM32_QtoS = RC_Target, // Denotes Q registers that are aliased by S |
| 225 // registers. | 218 // registers. |
| 226 RCARM32_NUM | 219 RCARM32_NUM |
| 227 }; | 220 }; |
| 228 | 221 |
| 229 } // end of namespace RegARM32 | 222 } // end of namespace RegARM32 |
| 230 } // end of namespace ARM32 | 223 } // end of namespace ARM32 |
| 231 } // end of namespace Ice | 224 } // end of namespace Ice |
| 232 | 225 |
| 233 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H | 226 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H |
| OLD | NEW |