OLD | NEW |
1 //===- subzero/src/IceInstMIPS32.def - X-Macros for MIPS insts --*- C++ -*-===// | 1 //===- subzero/src/IceInstMIPS32.def - X-Macros for MIPS insts --*- 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 // This file defines properties of MIPS32 instructions in the form of x-macros. | 10 // This file defines properties of MIPS32 instructions in the form of x-macros. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 X(Reg_GP, 28, "gp", 0, 0, 0, 0, 0, 0, 0, 0, 0, \ | 98 X(Reg_GP, 28, "gp", 0, 0, 0, 0, 0, 0, 0, 0, 0, \ |
99 ALIASES1(Reg_GP)) \ | 99 ALIASES1(Reg_GP)) \ |
100 X(Reg_SP, 29, "sp", 0, 0, 1, 0, 0, 0, 0, 0, 0, \ | 100 X(Reg_SP, 29, "sp", 0, 0, 1, 0, 0, 0, 0, 0, 0, \ |
101 ALIASES1(Reg_SP)) \ | 101 ALIASES1(Reg_SP)) \ |
102 X(Reg_FP, 30, "fp", 0, 0, 0, 1, 0, 0, 0, 0, 0, \ | 102 X(Reg_FP, 30, "fp", 0, 0, 0, 1, 0, 0, 0, 0, 0, \ |
103 ALIASES1(Reg_FP)) \ | 103 ALIASES1(Reg_FP)) \ |
104 X(Reg_RA, 31, "ra", 0, 1, 0, 0, 0, 0, 0, 0, 0, \ | 104 X(Reg_RA, 31, "ra", 0, 1, 0, 0, 0, 0, 0, 0, 0, \ |
105 ALIASES1(Reg_RA)) \ | 105 ALIASES1(Reg_RA)) \ |
106 X(Reg_LO, 0, "lo", 0, 0, 0, 0, 0, 0, 0, 0, 0, \ | 106 X(Reg_LO, 0, "lo", 0, 0, 0, 0, 0, 0, 0, 0, 0, \ |
107 ALIASES2(Reg_LO, Reg_LOHI)) \ | 107 ALIASES2(Reg_LO, Reg_LOHI)) \ |
108 X(Reg_HI, 0, "hi", 0, 0, 0, 0, 0, 0, 0, 0, 0, \ | 108 X(Reg_HI, 0, "hi", 0, 0, 0, 0, 0, 0, 0, 0, 0, \ |
109 ALIASES2(Reg_HI, Reg_LOHI)) | 109 ALIASES2(Reg_HI, Reg_LOHI)) |
110 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, | 110 |
111 // isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) | 111 #define REGMIPS32_FPR_TABLE \ |
112 // TODO(reed kotler): List FP registers etc. | 112 /* val, encode, name, scratch, preserved, stackptr, frameptr, \ |
113 // Be able to grab even registers, and the corresponding odd register | 113 isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init */ \ |
114 // for each even register. | 114 X(Reg_F0, 0, "f0", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F0)) \ |
| 115 X(Reg_F1, 1, "f1", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F1)) \ |
| 116 X(Reg_F2, 2, "f2", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F2)) \ |
| 117 X(Reg_F3, 3, "f3", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F3)) \ |
| 118 X(Reg_F4, 4, "f4", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F4)) \ |
| 119 X(Reg_F5, 5, "f5", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F5)) \ |
| 120 X(Reg_F6, 6, "f6", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F6)) \ |
| 121 X(Reg_F7, 7, "f7", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F7)) \ |
| 122 X(Reg_F8, 8, "f8", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F8)) \ |
| 123 X(Reg_F9, 9, "f9", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F9)) \ |
| 124 X(Reg_F10, 10, "f10", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F10)) \ |
| 125 X(Reg_F11, 11, "f11", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F11)) \ |
| 126 X(Reg_F12, 12, "f12", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F12)) \ |
| 127 X(Reg_F13, 13, "f13", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F13)) \ |
| 128 X(Reg_F14, 14, "f14", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F14)) \ |
| 129 X(Reg_F15, 15, "f15", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F15)) \ |
| 130 X(Reg_F16, 16, "f16", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F16)) \ |
| 131 X(Reg_F17, 17, "f17", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F17)) \ |
| 132 X(Reg_F18, 18, "f18", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F18)) \ |
| 133 X(Reg_F19, 19, "f19", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F19)) \ |
| 134 X(Reg_F20, 20, "f20", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F20)) \ |
| 135 X(Reg_F21, 21, "f21", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F21)) \ |
| 136 X(Reg_F22, 22, "f22", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F22)) \ |
| 137 X(Reg_F23, 23, "f23", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F23)) \ |
| 138 X(Reg_F24, 24, "f24", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F24)) \ |
| 139 X(Reg_F25, 25, "f25", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F25)) \ |
| 140 X(Reg_F26, 26, "f26", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F26)) \ |
| 141 X(Reg_F27, 27, "f27", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F27)) \ |
| 142 X(Reg_F28, 28, "f28", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F28)) \ |
| 143 X(Reg_F29, 29, "f29", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F29)) \ |
| 144 X(Reg_F30, 30, "f30", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F30)) \ |
| 145 X(Reg_F31, 31, "f31", 1,0,0,0, 0,0,1,0,0, ALIASES1(Reg_F31)) |
| 146 |
115 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, | 147 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, |
116 // isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) | 148 // isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) |
117 // The following defines a table with the available pairs of consecutive i32 | 149 // The following defines a table with the available pairs of consecutive i32 |
118 // GPRs starting at an even GPR that is not r14. Those are used to hold i64 | 150 // GPRs starting at an even GPR that is not r14. Those are used to hold i64 |
119 // variables for atomic memory operations. If one of the registers in the pair | 151 // variables for atomic memory operations. If one of the registers in the pair |
120 // is preserved, then we mark the whole pair as preserved to help the register | 152 // is preserved, then we mark the whole pair as preserved to help the register |
121 // allocator. | 153 // allocator. |
122 #define REGMIPS32_I64PAIR_TABLE \ | 154 #define REGMIPS32_I64PAIR_TABLE \ |
123 /* val, encode, name, scratch, preserved, stackptr, frameptr, \ | 155 /* val, encode, name, scratch, preserved, stackptr, frameptr, \ |
124 isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init */ \ | 156 isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init */ \ |
(...skipping 19 matching lines...) Expand all Loading... |
144 ALIASES3(Reg_S4, Reg_S5, Reg_S4S5)) \ | 176 ALIASES3(Reg_S4, Reg_S5, Reg_S4S5)) \ |
145 X(Reg_S6S7, 22, "s6, s7", 0, 1, 0, 0, 0, 1, 0, 0, 0, \ | 177 X(Reg_S6S7, 22, "s6, s7", 0, 1, 0, 0, 0, 1, 0, 0, 0, \ |
146 ALIASES3(Reg_S6, Reg_S7, Reg_S6S7)) \ | 178 ALIASES3(Reg_S6, Reg_S7, Reg_S6S7)) \ |
147 X(Reg_T8T9, 26, "t8, t9", 1, 0, 0, 0, 0, 1, 0, 0, 0, \ | 179 X(Reg_T8T9, 26, "t8, t9", 1, 0, 0, 0, 0, 1, 0, 0, 0, \ |
148 ALIASES3(Reg_T8, Reg_T9, Reg_T8T9)) \ | 180 ALIASES3(Reg_T8, Reg_T9, Reg_T8T9)) \ |
149 X(Reg_LOHI, 0, "lo, hi", 0, 0, 0, 0, 0, 0, 0, 0, 0, \ | 181 X(Reg_LOHI, 0, "lo, hi", 0, 0, 0, 0, 0, 0, 0, 0, 0, \ |
150 ALIASES3(Reg_LO, Reg_HI, Reg_LOHI)) \ | 182 ALIASES3(Reg_LO, Reg_HI, Reg_LOHI)) \ |
151 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, | 183 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, |
152 // isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) | 184 // isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) |
153 | 185 |
| 186 #define REGMIPS32_F64PAIR_TABLE \ |
| 187 /* val, encode, name, scratch, preserved, stackptr, frameptr, \ |
| 188 isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init */ \ |
| 189 X(Reg_F0F1, 0, "f0, f1", 1,0,0,0, 0,0,0,1,0, \ |
| 190 ALIASES3(Reg_F0, Reg_F1, Reg_F0F1)) \ |
| 191 X(Reg_F2F3, 2, "f2, f3", 1,0,0,0, 0,0,0,1,0, \ |
| 192 ALIASES3(Reg_F2, Reg_F3, Reg_F2F3)) \ |
| 193 X(Reg_F4F5, 4, "f4, f5", 1,0,0,0, 0,0,0,1,0, \ |
| 194 ALIASES3(Reg_F4, Reg_F5, Reg_F4F5)) \ |
| 195 X(Reg_F6F7, 6, "f6, f7", 1,0,0,0, 0,0,0,1,0, \ |
| 196 ALIASES3(Reg_F6, Reg_F7, Reg_F6F7)) \ |
| 197 X(Reg_F8F9, 8, "f8, f9", 1,0,0,0, 0,0,0,1,0, \ |
| 198 ALIASES3(Reg_F8, Reg_F9, Reg_F8F9)) \ |
| 199 X(Reg_F10F11, 10, "f10, f11", 1,0,0,0, 0,0,0,1,0, \ |
| 200 ALIASES3(Reg_F10, Reg_F11, Reg_F10F11)) \ |
| 201 X(Reg_F12F13, 12, "f12, f13", 1,0,0,0, 0,0,0,1,0, \ |
| 202 ALIASES3(Reg_F12, Reg_F13, Reg_F12F13)) \ |
| 203 X(Reg_F14F15, 14, "f14, f15", 1,0,0,0, 0,0,0,1,0, \ |
| 204 ALIASES3(Reg_F14, Reg_F15, Reg_F14F15)) \ |
| 205 X(Reg_F16F17, 16, "f16, f17", 1,0,0,0, 0,0,0,1,0, \ |
| 206 ALIASES3(Reg_F16, Reg_F17, Reg_F16F17)) \ |
| 207 X(Reg_F18F19, 18, "f18, f19", 1,0,0,0, 0,0,0,1,0, \ |
| 208 ALIASES3(Reg_F18, Reg_F19, Reg_F18F19)) \ |
| 209 X(Reg_F20F21, 20, "f20, f21", 1,0,0,0, 0,0,0,1,0, \ |
| 210 ALIASES3(Reg_F20, Reg_F21, Reg_F20F21)) \ |
| 211 X(Reg_F22F23, 22, "f22, f23", 1,0,0,0, 0,0,0,1,0, \ |
| 212 ALIASES3(Reg_F22, Reg_F23, Reg_F22F23)) \ |
| 213 X(Reg_F24F25, 24, "f24, f25", 1,0,0,0, 0,0,0,1,0, \ |
| 214 ALIASES3(Reg_F24, Reg_F25, Reg_F24F25)) \ |
| 215 X(Reg_F26F27, 26, "f26, f27", 1,0,0,0, 0,0,0,1,0, \ |
| 216 ALIASES3(Reg_F26, Reg_F27, Reg_F26F27)) \ |
| 217 X(Reg_F28F29, 28, "f28, f29", 1,0,0,0, 0,0,0,1,0, \ |
| 218 ALIASES3(Reg_F28, Reg_F29, Reg_F28F29)) \ |
| 219 X(Reg_F30F31, 30, "f30, f31", 1,0,0,0, 0,0,0,1,0, \ |
| 220 ALIASES3(Reg_F30, Reg_F31, Reg_F30F31)) |
| 221 |
154 // We also provide a combined table, so that there is a namespace where | 222 // We also provide a combined table, so that there is a namespace where |
155 // all of the registers are considered and have distinct numberings. | 223 // all of the registers are considered and have distinct numberings. |
156 // This is in contrast to the above, where the "encode" is based on how | 224 // This is in contrast to the above, where the "encode" is based on how |
157 // the register numbers will be encoded in binaries and values can overlap. | 225 // the register numbers will be encoded in binaries and values can overlap. |
158 #define REGMIPS32_TABLE \ | 226 #define REGMIPS32_TABLE \ |
159 /* val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ | 227 /* val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \ |
160 isFP32, isFP64, isVec128, alias_init */ \ | 228 isFP32, isFP64, isVec128, alias_init */ \ |
161 REGMIPS32_GPR_TABLE \ | 229 REGMIPS32_GPR_TABLE \ |
162 REGMIPS32_I64PAIR_TABLE | 230 REGMIPS32_FPR_TABLE \ |
| 231 REGMIPS32_I64PAIR_TABLE \ |
| 232 REGMIPS32_F64PAIR_TABLE |
163 | 233 |
164 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, | 234 //#define X(val, encode, name, scratch, preserved, stackptr, frameptr, |
165 // isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) | 235 // isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) |
166 #define REGMIPS32_TABLE_BOUNDS \ | 236 #define REGMIPS32_TABLE_BOUNDS \ |
167 /* val, init */ \ | 237 /* val, init */ \ |
168 X(Reg_GPR_First, = Reg_ZERO) \ | 238 X(Reg_GPR_First, = Reg_ZERO) \ |
169 X(Reg_GPR_Last, = Reg_HI) \ | 239 X(Reg_GPR_Last, = Reg_HI) \ |
| 240 X(Reg_FPR_First, = Reg_F0) \ |
| 241 X(Reg_FPR_Last, = Reg_F31) \ |
170 X(Reg_I64PAIR_First, = Reg_V0V1) \ | 242 X(Reg_I64PAIR_First, = Reg_V0V1) \ |
171 X(Reg_I64PAIR_Last, = Reg_LOHI) \ | 243 X(Reg_I64PAIR_Last, = Reg_LOHI) \ |
| 244 X(Reg_F64PAIR_First, = Reg_F0F1) \ |
| 245 X(Reg_F64PAIR_Last, = Reg_F30F31) \ |
172 //define X(val, init) | 246 //define X(val, init) |
173 | 247 |
174 #define ICEINSTMIPS32COND_TABLE \ | 248 #define ICEINSTMIPS32COND_TABLE \ |
175 /* enum value, opposite, emit */ \ | 249 /* enum value, opposite, emit */ \ |
176 X(EQ, NE, "eq") /* equal */ \ | 250 X(EQ, NE, "eq") /* equal */ \ |
177 X(NE, EQ, "ne") /* not equal */ \ | 251 X(NE, EQ, "ne") /* not equal */ \ |
178 X(EQZ, NEZ, "eqz") /* signed equal to zero */ \ | 252 X(EQZ, NEZ, "eqz") /* signed equal to zero */ \ |
179 X(NEZ, EQZ, "nez") /* signed not equal to zero */ \ | 253 X(NEZ, EQZ, "nez") /* signed not equal to zero */ \ |
180 X(GEZ, LTZ, "gez") /* signed greater than or equal to zero */ \ | 254 X(GEZ, LTZ, "gez") /* signed greater than or equal to zero */ \ |
181 X(LTZ, GEZ, "ltz") /* signed less than to zero */ \ | 255 X(LTZ, GEZ, "ltz") /* signed less than to zero */ \ |
182 X(GTZ, LEZ, "gtz") /* signed greater than to zero */ \ | 256 X(GTZ, LEZ, "gtz") /* signed greater than to zero */ \ |
183 X(LEZ, GTZ, "lez") /* signed less than or equal to zero */ \ | 257 X(LEZ, GTZ, "lez") /* signed less than or equal to zero */ \ |
184 X(AL, kNone, "") /* always (unconditional) */ \ | 258 X(AL, kNone, "") /* always (unconditional) */ \ |
185 X(kNone, kNone, "??") /* special condition / none */ | 259 X(kNone, kNone, "??") /* special condition / none */ |
186 //#define X(tag, opp, emit) | 260 //#define X(tag, opp, emit) |
187 | 261 |
188 #endif // SUBZERO_SRC_ICEINSTMIPS32_DEF | 262 #endif // SUBZERO_SRC_ICEINSTMIPS32_DEF |
OLD | NEW |