Chromium Code Reviews| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 REGARM32_TABLE | 145 REGARM32_TABLE |
| 146 #undef X | 146 #undef X |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 static inline GPRRegister getEncodedGPR(int32_t RegNum) { | 149 static inline GPRRegister getEncodedGPR(int32_t RegNum) { |
| 150 assert(Reg_GPR_First <= RegNum); | 150 assert(Reg_GPR_First <= RegNum); |
| 151 assert(RegNum <= Reg_GPR_Last); | 151 assert(RegNum <= Reg_GPR_Last); |
| 152 return GPRRegister(Table[RegNum].Encoding); | 152 return GPRRegister(Table[RegNum].Encoding); |
| 153 } | 153 } |
| 154 | 154 |
| 155 static inline SizeT getNumGPRs() { | |
|
John
2016/01/11 13:40:36
You don't need this method if you use Table[] -- s
Karl
2016/01/11 17:59:44
This form is used because it allows it to be a con
| |
| 156 return 0 | |
| 157 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ | |
| 158 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | |
| 159 +(isGPR) | |
| 160 REGARM32_TABLE | |
| 161 #undef X | |
| 162 ; | |
| 163 } | |
| 164 | |
| 165 static inline IceString getGPRName(SizeT RegNum) { | |
| 166 assert(RegNum <= getNumGPRs()); | |
|
Jim Stichnoth
2016/01/10 18:22:00
Should this be "<" instead of "<=" ?
(same commen
John
2016/01/11 13:40:36
Now that we have RegARM32::Table[], this should be
Karl
2016/01/11 17:59:44
As far as John's comment, I was making too many as
Karl
2016/01/11 17:59:44
Done.
| |
| 167 return getRegName(Reg_GPR_First + RegNum); | |
| 168 } | |
| 169 | |
| 155 static inline GPRRegister getI64PairFirstGPRNum(int32_t RegNum) { | 170 static inline GPRRegister getI64PairFirstGPRNum(int32_t RegNum) { |
| 156 assert(Reg_I64PAIR_First <= RegNum); | 171 assert(Reg_I64PAIR_First <= RegNum); |
| 157 assert(RegNum <= Reg_I64PAIR_Last); | 172 assert(RegNum <= Reg_I64PAIR_Last); |
| 158 return GPRRegister(Table[RegNum].Encoding); | 173 return GPRRegister(Table[RegNum].Encoding); |
| 159 } | 174 } |
| 160 | 175 |
| 161 static inline GPRRegister getI64PairSecondGPRNum(int32_t RegNum) { | 176 static inline GPRRegister getI64PairSecondGPRNum(int32_t RegNum) { |
| 162 assert(Reg_I64PAIR_First <= RegNum); | 177 assert(Reg_I64PAIR_First <= RegNum); |
| 163 assert(RegNum <= Reg_I64PAIR_Last); | 178 assert(RegNum <= Reg_I64PAIR_Last); |
| 164 return GPRRegister(Table[RegNum].Encoding + 1); | 179 return GPRRegister(Table[RegNum].Encoding + 1); |
| 165 } | 180 } |
| 166 | 181 |
| 167 static inline bool isI64RegisterPair(int32_t RegNum) { | 182 static inline bool isI64RegisterPair(int32_t RegNum) { |
| 168 return Table[RegNum].IsI64Pair; | 183 return Table[RegNum].IsI64Pair; |
| 169 } | 184 } |
| 170 | 185 |
| 171 static inline bool isEncodedSReg(int32_t RegNum) { | 186 static inline bool isEncodedSReg(int32_t RegNum) { |
| 172 return Table[RegNum].IsFP32; | 187 return Table[RegNum].IsFP32; |
| 173 } | 188 } |
| 174 | 189 |
| 175 static inline SizeT getNumSRegs() { | 190 static inline SizeT getNumSRegs() { |
|
John
2016/01/11 13:40:36
can you remove inline here, and add constexpr?
st
Karl
2016/01/11 17:59:44
Done.
| |
| 176 return Reg_SREG_Last + 1 - Reg_SREG_First; | 191 return 0 |
| 192 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ | |
| 193 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | |
| 194 +(isFP32) | |
| 195 REGARM32_TABLE | |
| 196 #undef X | |
| 197 ; | |
| 198 } | |
| 199 | |
| 200 static inline IceString getSRegName(SizeT RegNum) { | |
| 201 assert(RegNum <= getNumSRegs()); | |
|
John
2016/01/11 13:40:36
Please use Table[].
assert(RegNum < Reg_NUM);
Karl
2016/01/11 17:59:44
Done.
| |
| 202 return getRegName(Reg_SREG_First + RegNum); | |
| 177 } | 203 } |
| 178 | 204 |
| 179 static inline SRegister getEncodedSReg(int32_t RegNum) { | 205 static inline SRegister getEncodedSReg(int32_t RegNum) { |
| 180 assert(Reg_SREG_First <= RegNum); | 206 assert(Reg_SREG_First <= RegNum); |
| 181 assert(RegNum <= Reg_SREG_Last); | 207 assert(RegNum <= Reg_SREG_Last); |
| 182 return SRegister(Table[RegNum].Encoding); | 208 return SRegister(Table[RegNum].Encoding); |
| 183 } | 209 } |
| 184 | 210 |
| 185 static inline DRegister getEncodedDReg(int32_t RegNum) { | 211 static inline DRegister getEncodedDReg(int32_t RegNum) { |
| 186 assert(Reg_DREG_First <= RegNum); | 212 assert(Reg_DREG_First <= RegNum); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 200 } | 226 } |
| 201 }; | 227 }; |
| 202 | 228 |
| 203 // Extend enum RegClass with ARM32-specific register classes (if any). | 229 // Extend enum RegClass with ARM32-specific register classes (if any). |
| 204 enum RegClassARM32 : uint8_t { RCARM32_NUM = RC_Target }; | 230 enum RegClassARM32 : uint8_t { RCARM32_NUM = RC_Target }; |
| 205 | 231 |
| 206 } // end of namespace ARM32 | 232 } // end of namespace ARM32 |
| 207 } // end of namespace Ice | 233 } // end of namespace Ice |
| 208 | 234 |
| 209 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H | 235 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H |
| OLD | NEW |