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 /// \brief Declares the registers and their encodings for ARM32. | 11 /// \brief 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 "IceOperand.h" // RC_Target | 20 #include "IceOperand.h" // RC_Target |
21 #include "IceTypes.h" | 21 #include "IceTypes.h" |
22 | 22 |
23 namespace Ice { | 23 namespace Ice { |
24 | 24 |
25 class RegARM32 { | 25 class RegARM32 { |
26 public: | 26 public: |
27 /// An enum of every register. The enum value may not match the encoding used | 27 /// An enum of every register. The enum value may not match the encoding used |
28 /// to binary encode register operands in instructions. | 28 /// to binary encode register operands in instructions. |
29 enum AllRegisters { | 29 enum AllRegisters { |
30 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ | 30 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ |
31 isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | 31 isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
32 val, | 32 val, |
33 REGARM32_TABLE | 33 REGARM32_TABLE |
34 #undef X | 34 #undef X |
35 Reg_NUM, | 35 Reg_NUM, |
36 #define X(val, init) val init, | 36 #define X(val, init) val init, |
37 REGARM32_TABLE_BOUNDS | 37 REGARM32_TABLE_BOUNDS |
38 #undef X | 38 #undef X |
39 }; | 39 }; |
40 | 40 |
41 /// An enum of GPR Registers. The enum value does match the encoding used to | 41 /// An enum of GPR Registers. The enum value does match the encoding used to |
42 /// binary encode register operands in instructions. | 42 /// binary encode register operands in instructions. |
43 enum GPRRegister { | 43 enum GPRRegister { |
44 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ | 44 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ |
45 isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | 45 isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
46 Encoded_##val = encode, | 46 Encoded_##val = encode, |
47 REGARM32_GPR_TABLE | 47 REGARM32_GPR_TABLE |
48 #undef X | 48 #undef X |
49 Encoded_Not_GPR = -1 | 49 Encoded_Not_GPR = -1 |
50 }; | 50 }; |
51 | 51 |
52 /// An enum of FP32 S-Registers. The enum value does match the encoding used | 52 /// An enum of FP32 S-Registers. The enum value does match the encoding used |
53 /// to binary encode register operands in instructions. | 53 /// to binary encode register operands in instructions. |
54 enum SRegister { | 54 enum SRegister { |
55 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ | 55 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ |
56 isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | 56 isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
57 Encoded_##val = encode, | 57 Encoded_##val = encode, |
58 REGARM32_FP32_TABLE | 58 REGARM32_FP32_TABLE |
59 #undef X | 59 #undef X |
60 Encoded_Not_SReg = -1 | 60 Encoded_Not_SReg = -1 |
61 }; | 61 }; |
62 | 62 |
63 /// An enum of FP64 D-Registers. The enum value does match the encoding used | 63 /// An enum of FP64 D-Registers. The enum value does match the encoding used |
64 /// to binary encode register operands in instructions. | 64 /// to binary encode register operands in instructions. |
65 enum DRegister { | 65 enum DRegister { |
66 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ | 66 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ |
67 isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | 67 isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
68 Encoded_##val = encode, | 68 Encoded_##val = encode, |
69 REGARM32_FP64_TABLE | 69 REGARM32_FP64_TABLE |
70 #undef X | 70 #undef X |
71 Encoded_Not_DReg = -1 | 71 Encoded_Not_DReg = -1 |
72 }; | 72 }; |
73 | 73 |
74 /// An enum of 128-bit Q-Registers. The enum value does match the encoding | 74 /// An enum of 128-bit Q-Registers. The enum value does match the encoding |
75 /// used to binary encode register operands in instructions. | 75 /// used to binary encode register operands in instructions. |
76 enum QRegister { | 76 enum QRegister { |
77 #define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ | 77 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ |
78 isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | 78 isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
79 Encoded_##val = encode, | 79 Encoded_##val = encode, |
80 REGARM32_VEC128_TABLE | 80 REGARM32_VEC128_TABLE |
81 #undef X | 81 #undef X |
82 Encoded_Not_QReg = -1 | 82 Encoded_Not_QReg = -1 |
83 }; | 83 }; |
84 | 84 |
85 static inline GPRRegister getEncodedGPR(int32_t RegNum) { | 85 static inline GPRRegister getEncodedGPR(int32_t RegNum) { |
86 assert(Reg_GPR_First <= RegNum); | 86 assert(Reg_GPR_First <= RegNum); |
87 assert(RegNum <= Reg_GPR_Last); | 87 assert(RegNum <= Reg_GPR_Last); |
88 return GPRRegister(RegNum - Reg_GPR_First); | 88 return GPRRegister(RegNum - Reg_GPR_First); |
89 } | 89 } |
90 | 90 |
91 static inline GPRRegister getI64PairFirstGPRNum(int32_t RegNum) { | 91 static inline GPRRegister getI64PairFirstGPRNum(int32_t RegNum) { |
92 assert(Reg_I64PAIR_First <= RegNum); | 92 assert(Reg_I64PAIR_First <= RegNum); |
93 assert(RegNum <= Reg_I64PAIR_Last); | 93 assert(RegNum <= Reg_I64PAIR_Last); |
94 return GPRRegister(2 * (RegNum - Reg_I64PAIR_First + Reg_GPR_First)); | 94 return GPRRegister(2 * (RegNum - Reg_I64PAIR_First + Reg_GPR_First)); |
95 } | 95 } |
96 | 96 |
| 97 static inline GPRRegister getI64PairSecondGPRNum(int32_t RegNum) { |
| 98 assert(Reg_I64PAIR_First <= RegNum); |
| 99 assert(RegNum <= Reg_I64PAIR_Last); |
| 100 return GPRRegister(2 * (RegNum - Reg_I64PAIR_First + Reg_GPR_First) + 1); |
| 101 } |
| 102 |
97 static inline bool isI64RegisterPair(int32_t RegNum) { | 103 static inline bool isI64RegisterPair(int32_t RegNum) { |
98 return Reg_I64PAIR_First <= RegNum && RegNum <= Reg_I64PAIR_Last; | 104 return Reg_I64PAIR_First <= RegNum && RegNum <= Reg_I64PAIR_Last; |
99 } | 105 } |
100 | 106 |
101 static inline SRegister getEncodedSReg(int32_t RegNum) { | 107 static inline SRegister getEncodedSReg(int32_t RegNum) { |
102 assert(Reg_SREG_First <= RegNum); | 108 assert(Reg_SREG_First <= RegNum); |
103 assert(RegNum <= Reg_SREG_Last); | 109 assert(RegNum <= Reg_SREG_Last); |
104 return SRegister(RegNum - Reg_SREG_First); | 110 return SRegister(RegNum - Reg_SREG_First); |
105 } | 111 } |
106 | 112 |
(...skipping 11 matching lines...) Expand all Loading... |
118 | 124 |
119 static const char *RegNames[]; | 125 static const char *RegNames[]; |
120 }; | 126 }; |
121 | 127 |
122 // Extend enum RegClass with ARM32-specific register classes (if any). | 128 // Extend enum RegClass with ARM32-specific register classes (if any). |
123 enum RegClassARM32 : uint8_t { RCARM32_NUM = RC_Target }; | 129 enum RegClassARM32 : uint8_t { RCARM32_NUM = RC_Target }; |
124 | 130 |
125 } // end of namespace Ice | 131 } // end of namespace Ice |
126 | 132 |
127 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H | 133 #endif // SUBZERO_SRC_ICEREGISTERSARM32_H |
OLD | NEW |