OLD | NEW |
1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// | 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// |
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 implements the TargetLoweringX8632 class, which | 10 // This file implements the TargetLoweringX8632 class, which |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 _num | 182 _num |
183 }; | 183 }; |
184 // Define a set of constants based on high-level table entries. | 184 // Define a set of constants based on high-level table entries. |
185 #define X(tag, str) static const int _table1_##tag = InstFcmp::tag; | 185 #define X(tag, str) static const int _table1_##tag = InstFcmp::tag; |
186 ICEINSTFCMP_TABLE; | 186 ICEINSTFCMP_TABLE; |
187 #undef X | 187 #undef X |
188 // Define a set of constants based on low-level table entries, | 188 // Define a set of constants based on low-level table entries, |
189 // and ensure the table entry keys are consistent. | 189 // and ensure the table entry keys are consistent. |
190 #define X(val, dflt, swapS, C1, C2, swapV, pred) \ | 190 #define X(val, dflt, swapS, C1, C2, swapV, pred) \ |
191 static const int _table2_##val = _tmp_##val; \ | 191 static const int _table2_##val = _tmp_##val; \ |
192 STATIC_ASSERT(_table1_##val == _table2_##val); | 192 static_assert( \ |
| 193 _table1_##val == _table2_##val, \ |
| 194 "Inconsistency between FCMPX8632_TABLE and ICEINSTFCMP_TABLE"); |
193 FCMPX8632_TABLE; | 195 FCMPX8632_TABLE; |
194 #undef X | 196 #undef X |
195 // Repeat the static asserts with respect to the high-level | 197 // Repeat the static asserts with respect to the high-level |
196 // table entries in case the high-level table has extra entries. | 198 // table entries in case the high-level table has extra entries. |
197 #define X(tag, str) STATIC_ASSERT(_table1_##tag == _table2_##tag); | 199 #define X(tag, str) \ |
| 200 static_assert( \ |
| 201 _table1_##tag == _table2_##tag, \ |
| 202 "Inconsistency between FCMPX8632_TABLE and ICEINSTFCMP_TABLE"); |
198 ICEINSTFCMP_TABLE; | 203 ICEINSTFCMP_TABLE; |
199 #undef X | 204 #undef X |
200 } | 205 } |
201 | 206 |
202 // Validate the enum values in ICMPX8632_TABLE. | 207 // Validate the enum values in ICMPX8632_TABLE. |
203 { | 208 { |
204 // Define a temporary set of enum values based on low-level | 209 // Define a temporary set of enum values based on low-level |
205 // table entries. | 210 // table entries. |
206 enum _tmp_enum { | 211 enum _tmp_enum { |
207 #define X(val, C_32, C1_64, C2_64, C3_64) _tmp_##val, | 212 #define X(val, C_32, C1_64, C2_64, C3_64) _tmp_##val, |
208 ICMPX8632_TABLE | 213 ICMPX8632_TABLE |
209 #undef X | 214 #undef X |
210 _num | 215 _num |
211 }; | 216 }; |
212 // Define a set of constants based on high-level table entries. | 217 // Define a set of constants based on high-level table entries. |
213 #define X(tag, str) static const int _table1_##tag = InstIcmp::tag; | 218 #define X(tag, str) static const int _table1_##tag = InstIcmp::tag; |
214 ICEINSTICMP_TABLE; | 219 ICEINSTICMP_TABLE; |
215 #undef X | 220 #undef X |
216 // Define a set of constants based on low-level table entries, | 221 // Define a set of constants based on low-level table entries, |
217 // and ensure the table entry keys are consistent. | 222 // and ensure the table entry keys are consistent. |
218 #define X(val, C_32, C1_64, C2_64, C3_64) \ | 223 #define X(val, C_32, C1_64, C2_64, C3_64) \ |
219 static const int _table2_##val = _tmp_##val; \ | 224 static const int _table2_##val = _tmp_##val; \ |
220 STATIC_ASSERT(_table1_##val == _table2_##val); | 225 static_assert( \ |
| 226 _table1_##val == _table2_##val, \ |
| 227 "Inconsistency between ICMPX8632_TABLE and ICEINSTICMP_TABLE"); |
221 ICMPX8632_TABLE; | 228 ICMPX8632_TABLE; |
222 #undef X | 229 #undef X |
223 // Repeat the static asserts with respect to the high-level | 230 // Repeat the static asserts with respect to the high-level |
224 // table entries in case the high-level table has extra entries. | 231 // table entries in case the high-level table has extra entries. |
225 #define X(tag, str) STATIC_ASSERT(_table1_##tag == _table2_##tag); | 232 #define X(tag, str) \ |
| 233 static_assert( \ |
| 234 _table1_##tag == _table2_##tag, \ |
| 235 "Inconsistency between ICMPX8632_TABLE and ICEINSTICMP_TABLE"); |
226 ICEINSTICMP_TABLE; | 236 ICEINSTICMP_TABLE; |
227 #undef X | 237 #undef X |
228 } | 238 } |
229 | 239 |
230 // Validate the enum values in ICETYPEX8632_TABLE. | 240 // Validate the enum values in ICETYPEX8632_TABLE. |
231 { | 241 { |
232 // Define a temporary set of enum values based on low-level | 242 // Define a temporary set of enum values based on low-level |
233 // table entries. | 243 // table entries. |
234 enum _tmp_enum { | 244 enum _tmp_enum { |
235 #define X(tag, elementty, cvt, sdss, pack, width) _tmp_##tag, | 245 #define X(tag, elementty, cvt, sdss, pack, width) _tmp_##tag, |
236 ICETYPEX8632_TABLE | 246 ICETYPEX8632_TABLE |
237 #undef X | 247 #undef X |
238 _num | 248 _num |
239 }; | 249 }; |
240 // Define a set of constants based on high-level table entries. | 250 // Define a set of constants based on high-level table entries. |
241 #define X(tag, size, align, elts, elty, str) \ | 251 #define X(tag, size, align, elts, elty, str) \ |
242 static const int _table1_##tag = tag; | 252 static const int _table1_##tag = tag; |
243 ICETYPE_TABLE; | 253 ICETYPE_TABLE; |
244 #undef X | 254 #undef X |
245 // Define a set of constants based on low-level table entries, | 255 // Define a set of constants based on low-level table entries, |
246 // and ensure the table entry keys are consistent. | 256 // and ensure the table entry keys are consistent. |
247 #define X(tag, elementty, cvt, sdss, pack, width) \ | 257 #define X(tag, elementty, cvt, sdss, pack, width) \ |
248 static const int _table2_##tag = _tmp_##tag; \ | 258 static const int _table2_##tag = _tmp_##tag; \ |
249 STATIC_ASSERT(_table1_##tag == _table2_##tag); | 259 static_assert(_table1_##tag == _table2_##tag, \ |
| 260 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); |
250 ICETYPEX8632_TABLE; | 261 ICETYPEX8632_TABLE; |
251 #undef X | 262 #undef X |
252 // Repeat the static asserts with respect to the high-level | 263 // Repeat the static asserts with respect to the high-level |
253 // table entries in case the high-level table has extra entries. | 264 // table entries in case the high-level table has extra entries. |
254 #define X(tag, size, align, elts, elty, str) \ | 265 #define X(tag, size, align, elts, elty, str) \ |
255 STATIC_ASSERT(_table1_##tag == _table2_##tag); | 266 static_assert(_table1_##tag == _table2_##tag, \ |
| 267 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); |
256 ICETYPE_TABLE; | 268 ICETYPE_TABLE; |
257 #undef X | 269 #undef X |
258 } | 270 } |
259 } | 271 } |
260 | 272 |
261 } // end of anonymous namespace | 273 } // end of anonymous namespace |
262 | 274 |
263 TargetX8632::TargetX8632(Cfg *Func) | 275 TargetX8632::TargetX8632(Cfg *Func) |
264 : TargetLowering(Func), InstructionSet(CLInstructionSet), | 276 : TargetLowering(Func), InstructionSet(CLInstructionSet), |
265 IsEbpBasedFrame(false), NeedsStackAlignment(false), FrameSizeLocals(0), | 277 IsEbpBasedFrame(false), NeedsStackAlignment(false), FrameSizeLocals(0), |
(...skipping 4260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4526 Str << "\t.align\t" << Align << "\n"; | 4538 Str << "\t.align\t" << Align << "\n"; |
4527 Str << MangledName << ":\n"; | 4539 Str << MangledName << ":\n"; |
4528 for (SizeT i = 0; i < Size; ++i) { | 4540 for (SizeT i = 0; i < Size; ++i) { |
4529 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; | 4541 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; |
4530 } | 4542 } |
4531 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; | 4543 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; |
4532 } | 4544 } |
4533 } | 4545 } |
4534 | 4546 |
4535 } // end of namespace Ice | 4547 } // end of namespace Ice |
OLD | NEW |