| 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 |
| 11 /// This file declares the registers and their encodings for ARM32. | 11 /// This file declares the registers and their encodings for ARM32. |
| 12 /// | 12 /// |
| 13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
| 14 | 14 |
| 15 #ifndef SUBZERO_SRC_ICEREGISTERSARM32_H | 15 #ifndef SUBZERO_SRC_ICEREGISTERSARM32_H |
| 16 #define SUBZERO_SRC_ICEREGISTERSARM32_H | 16 #define SUBZERO_SRC_ICEREGISTERSARM32_H |
| 17 | 17 |
| 18 #include "IceDefs.h" | 18 #include "IceDefs.h" |
| 19 #include "IceInstARM32.def" | 19 #include "IceInstARM32.def" |
| 20 #include "IceTypes.h" | 20 #include "IceTypes.h" |
| 21 | 21 |
| 22 namespace Ice { | 22 namespace Ice { |
| 23 | 23 |
| 24 class RegARM32 { | 24 class RegARM32 { |
| 25 public: | 25 public: |
| 26 /// An enum of every register. The enum value may not match the encoding used | 26 /// An enum of every register. The enum value may not match the encoding used |
| 27 /// to binary encode register operands in instructions. | 27 /// to binary encode register operands in instructions. |
| 28 enum AllRegisters { | 28 enum AllRegisters { |
| 29 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ | 29 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ |
| 30 isFP32, isFP64, isVec128, alias_init) \ | 30 isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
| 31 val, | 31 val, |
| 32 REGARM32_TABLE | 32 REGARM32_TABLE |
| 33 #undef X | 33 #undef X |
| 34 Reg_NUM, | 34 Reg_NUM, |
| 35 #define X(val, init) val init, | 35 #define X(val, init) val init, |
| 36 REGARM32_TABLE_BOUNDS | 36 REGARM32_TABLE_BOUNDS |
| 37 #undef X | 37 #undef X |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 /// An enum of GPR Registers. The enum value does match the encoding used to | 40 /// An enum of GPR Registers. The enum value does match the encoding used to |
| 41 /// binary encode register operands in instructions. | 41 /// binary encode register operands in instructions. |
| 42 enum GPRRegister { | 42 enum GPRRegister { |
| 43 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ | 43 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ |
| 44 isFP32, isFP64, isVec128, alias_init) \ | 44 isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
| 45 Encoded_##val = encode, | 45 Encoded_##val = encode, |
| 46 REGARM32_GPR_TABLE | 46 REGARM32_GPR_TABLE |
| 47 #undef X | 47 #undef X |
| 48 Encoded_Not_GPR = -1 | 48 Encoded_Not_GPR = -1 |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 /// An enum of FP32 S-Registers. The enum value does match the encoding used | 51 /// An enum of FP32 S-Registers. The enum value does match the encoding used |
| 52 /// to binary encode register operands in instructions. | 52 /// to binary encode register operands in instructions. |
| 53 enum SRegister { | 53 enum SRegister { |
| 54 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ | 54 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ |
| 55 isFP32, isFP64, isVec128, alias_init) \ | 55 isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
| 56 Encoded_##val = encode, | 56 Encoded_##val = encode, |
| 57 REGARM32_FP32_TABLE | 57 REGARM32_FP32_TABLE |
| 58 #undef X | 58 #undef X |
| 59 Encoded_Not_SReg = -1 | 59 Encoded_Not_SReg = -1 |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 /// An enum of FP64 D-Registers. The enum value does match the encoding used | 62 /// An enum of FP64 D-Registers. The enum value does match the encoding used |
| 63 /// to binary encode register operands in instructions. | 63 /// to binary encode register operands in instructions. |
| 64 enum DRegister { | 64 enum DRegister { |
| 65 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ | 65 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ |
| 66 isFP32, isFP64, isVec128, alias_init) \ | 66 isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
| 67 Encoded_##val = encode, | 67 Encoded_##val = encode, |
| 68 REGARM32_FP64_TABLE | 68 REGARM32_FP64_TABLE |
| 69 #undef X | 69 #undef X |
| 70 Encoded_Not_DReg = -1 | 70 Encoded_Not_DReg = -1 |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 /// An enum of 128-bit Q-Registers. The enum value does match the encoding | 73 /// An enum of 128-bit Q-Registers. The enum value does match the encoding |
| 74 /// used to binary encode register operands in instructions. | 74 /// used to binary encode register operands in instructions. |
| 75 enum QRegister { | 75 enum QRegister { |
| 76 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ | 76 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ |
| 77 isFP32, isFP64, isVec128, alias_init) \ | 77 isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
| 78 Encoded_##val = encode, | 78 Encoded_##val = encode, |
| 79 REGARM32_VEC128_TABLE | 79 REGARM32_VEC128_TABLE |
| 80 #undef X | 80 #undef X |
| 81 Encoded_Not_QReg = -1 | 81 Encoded_Not_QReg = -1 |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 static inline GPRRegister getEncodedGPR(int32_t RegNum) { | 84 static inline GPRRegister getEncodedGPR(int32_t RegNum) { |
| 85 assert(Reg_GPR_First <= RegNum); | 85 assert(Reg_GPR_First <= RegNum); |
| 86 assert(RegNum <= Reg_GPR_Last); | 86 assert(RegNum <= Reg_GPR_Last); |
| 87 return GPRRegister(RegNum - Reg_GPR_First); | 87 return GPRRegister(RegNum - Reg_GPR_First); |
| 88 } | 88 } |
| 89 | 89 |
| 90 static inline GPRRegister getI64PairFirstGPRNum(int32_t RegNum) { |
| 91 assert(Reg_I64PAIR_First <= RegNum); |
| 92 assert(RegNum <= Reg_I64PAIR_Last); |
| 93 return GPRRegister(2 * (RegNum - Reg_I64PAIR_First + Reg_GPR_First)); |
| 94 } |
| 95 |
| 96 static inline bool isI64RegisterPair(int32_t RegNum) { |
| 97 return Reg_I64PAIR_First <= RegNum && RegNum <= Reg_I64PAIR_Last; |
| 98 } |
| 99 |
| 90 static inline SRegister getEncodedSReg(int32_t RegNum) { | 100 static inline SRegister getEncodedSReg(int32_t RegNum) { |
| 91 assert(Reg_SREG_First <= RegNum); | 101 assert(Reg_SREG_First <= RegNum); |
| 92 assert(RegNum <= Reg_SREG_Last); | 102 assert(RegNum <= Reg_SREG_Last); |
| 93 return SRegister(RegNum - Reg_SREG_First); | 103 return SRegister(RegNum - Reg_SREG_First); |
| 94 } | 104 } |
| 95 | 105 |
| 96 static inline DRegister getEncodedDReg(int32_t RegNum) { | 106 static inline DRegister getEncodedDReg(int32_t RegNum) { |
| 97 assert(Reg_DREG_First <= RegNum); | 107 assert(Reg_DREG_First <= RegNum); |
| 98 assert(RegNum <= Reg_DREG_Last); | 108 assert(RegNum <= Reg_DREG_Last); |
| 99 return DRegister(RegNum - Reg_DREG_First); | 109 return DRegister(RegNum - Reg_DREG_First); |
| 100 } | 110 } |
| 101 | 111 |
| 102 static inline QRegister getEncodedQReg(int32_t RegNum) { | 112 static inline QRegister getEncodedQReg(int32_t RegNum) { |
| 103 assert(Reg_QREG_First <= RegNum); | 113 assert(Reg_QREG_First <= RegNum); |
| 104 assert(RegNum <= Reg_QREG_Last); | 114 assert(RegNum <= Reg_QREG_Last); |
| 105 return QRegister(RegNum - Reg_QREG_First); | 115 return QRegister(RegNum - Reg_QREG_First); |
| 106 } | 116 } |
| 107 }; | 117 }; |
| 108 | 118 |
| 109 } // end of namespace Ice | 119 } // end of namespace Ice |
| 110 | 120 |
| 111 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H | 121 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H |
| OLD | NEW |