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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // Define a temporary set of enum values based on low-level table | 177 // Define a temporary set of enum values based on low-level table |
178 // entries. | 178 // entries. |
179 enum _tmp_enum { | 179 enum _tmp_enum { |
180 #define X(val, dflt, swapS, C1, C2, swapV, pred) _tmp_##val, | 180 #define X(val, dflt, swapS, C1, C2, swapV, pred) _tmp_##val, |
181 FCMPX8632_TABLE | 181 FCMPX8632_TABLE |
182 #undef X | 182 #undef X |
183 _num | 183 _num |
184 }; | 184 }; |
185 // Define a set of constants based on high-level table entries. | 185 // Define a set of constants based on high-level table entries. |
186 #define X(tag, str) static const int _table1_##tag = InstFcmp::tag; | 186 #define X(tag, str) static const int _table1_##tag = InstFcmp::tag; |
187 ICEINSTFCMP_TABLE; | 187 ICEINSTFCMP_TABLE |
188 #undef X | 188 #undef X |
189 // Define a set of constants based on low-level table entries, and | 189 // Define a set of constants based on low-level table entries, and |
190 // ensure the table entry keys are consistent. | 190 // ensure the table entry keys are consistent. |
191 #define X(val, dflt, swapS, C1, C2, swapV, pred) \ | 191 #define X(val, dflt, swapS, C1, C2, swapV, pred) \ |
192 static const int _table2_##val = _tmp_##val; \ | 192 static const int _table2_##val = _tmp_##val; \ |
193 static_assert( \ | 193 static_assert( \ |
194 _table1_##val == _table2_##val, \ | 194 _table1_##val == _table2_##val, \ |
195 "Inconsistency between FCMPX8632_TABLE and ICEINSTFCMP_TABLE"); | 195 "Inconsistency between FCMPX8632_TABLE and ICEINSTFCMP_TABLE"); |
196 FCMPX8632_TABLE; | 196 FCMPX8632_TABLE |
197 #undef X | 197 #undef X |
198 // Repeat the static asserts with respect to the high-level table | 198 // Repeat the static asserts with respect to the high-level table |
199 // entries in case the high-level table has extra entries. | 199 // entries in case the high-level table has extra entries. |
200 #define X(tag, str) \ | 200 #define X(tag, str) \ |
201 static_assert( \ | 201 static_assert( \ |
202 _table1_##tag == _table2_##tag, \ | 202 _table1_##tag == _table2_##tag, \ |
203 "Inconsistency between FCMPX8632_TABLE and ICEINSTFCMP_TABLE"); | 203 "Inconsistency between FCMPX8632_TABLE and ICEINSTFCMP_TABLE"); |
204 ICEINSTFCMP_TABLE; | 204 ICEINSTFCMP_TABLE |
205 #undef X | 205 #undef X |
206 } // end of namespace dummy1 | 206 } // end of namespace dummy1 |
207 | 207 |
208 // Validate the enum values in ICMPX8632_TABLE. | 208 // Validate the enum values in ICMPX8632_TABLE. |
209 namespace dummy2 { | 209 namespace dummy2 { |
210 // Define a temporary set of enum values based on low-level table | 210 // Define a temporary set of enum values based on low-level table |
211 // entries. | 211 // entries. |
212 enum _tmp_enum { | 212 enum _tmp_enum { |
213 #define X(val, C_32, C1_64, C2_64, C3_64) _tmp_##val, | 213 #define X(val, C_32, C1_64, C2_64, C3_64) _tmp_##val, |
214 ICMPX8632_TABLE | 214 ICMPX8632_TABLE |
215 #undef X | 215 #undef X |
216 _num | 216 _num |
217 }; | 217 }; |
218 // Define a set of constants based on high-level table entries. | 218 // Define a set of constants based on high-level table entries. |
219 #define X(tag, str) static const int _table1_##tag = InstIcmp::tag; | 219 #define X(tag, str) static const int _table1_##tag = InstIcmp::tag; |
220 ICEINSTICMP_TABLE; | 220 ICEINSTICMP_TABLE |
221 #undef X | 221 #undef X |
222 // Define a set of constants based on low-level table entries, and | 222 // Define a set of constants based on low-level table entries, and |
223 // ensure the table entry keys are consistent. | 223 // ensure the table entry keys are consistent. |
224 #define X(val, C_32, C1_64, C2_64, C3_64) \ | 224 #define X(val, C_32, C1_64, C2_64, C3_64) \ |
225 static const int _table2_##val = _tmp_##val; \ | 225 static const int _table2_##val = _tmp_##val; \ |
226 static_assert( \ | 226 static_assert( \ |
227 _table1_##val == _table2_##val, \ | 227 _table1_##val == _table2_##val, \ |
228 "Inconsistency between ICMPX8632_TABLE and ICEINSTICMP_TABLE"); | 228 "Inconsistency between ICMPX8632_TABLE and ICEINSTICMP_TABLE"); |
229 ICMPX8632_TABLE; | 229 ICMPX8632_TABLE |
230 #undef X | 230 #undef X |
231 // Repeat the static asserts with respect to the high-level table | 231 // Repeat the static asserts with respect to the high-level table |
232 // entries in case the high-level table has extra entries. | 232 // entries in case the high-level table has extra entries. |
233 #define X(tag, str) \ | 233 #define X(tag, str) \ |
234 static_assert( \ | 234 static_assert( \ |
235 _table1_##tag == _table2_##tag, \ | 235 _table1_##tag == _table2_##tag, \ |
236 "Inconsistency between ICMPX8632_TABLE and ICEINSTICMP_TABLE"); | 236 "Inconsistency between ICMPX8632_TABLE and ICEINSTICMP_TABLE"); |
237 ICEINSTICMP_TABLE; | 237 ICEINSTICMP_TABLE |
238 #undef X | 238 #undef X |
239 } // end of namespace dummy2 | 239 } // end of namespace dummy2 |
240 | 240 |
241 // Validate the enum values in ICETYPEX8632_TABLE. | 241 // Validate the enum values in ICETYPEX8632_TABLE. |
242 namespace dummy3 { | 242 namespace dummy3 { |
243 // Define a temporary set of enum values based on low-level table | 243 // Define a temporary set of enum values based on low-level table |
244 // entries. | 244 // entries. |
245 enum _tmp_enum { | 245 enum _tmp_enum { |
246 #define X(tag, elementty, cvt, sdss, pack, width, fld) _tmp_##tag, | 246 #define X(tag, elementty, cvt, sdss, pack, width, fld) _tmp_##tag, |
247 ICETYPEX8632_TABLE | 247 ICETYPEX8632_TABLE |
248 #undef X | 248 #undef X |
249 _num | 249 _num |
250 }; | 250 }; |
251 // Define a set of constants based on high-level table entries. | 251 // Define a set of constants based on high-level table entries. |
252 #define X(tag, size, align, elts, elty, str) \ | 252 #define X(tag, size, align, elts, elty, str) \ |
253 static const int _table1_##tag = tag; | 253 static const int _table1_##tag = tag; |
254 ICETYPE_TABLE; | 254 ICETYPE_TABLE |
255 #undef X | 255 #undef X |
256 // Define a set of constants based on low-level table entries, and | 256 // Define a set of constants based on low-level table entries, and |
257 // ensure the table entry keys are consistent. | 257 // ensure the table entry keys are consistent. |
258 #define X(tag, elementty, cvt, sdss, pack, width, fld) \ | 258 #define X(tag, elementty, cvt, sdss, pack, width, fld) \ |
259 static const int _table2_##tag = _tmp_##tag; \ | 259 static const int _table2_##tag = _tmp_##tag; \ |
260 static_assert(_table1_##tag == _table2_##tag, \ | 260 static_assert(_table1_##tag == _table2_##tag, \ |
261 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); | 261 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); |
262 ICETYPEX8632_TABLE; | 262 ICETYPEX8632_TABLE |
263 #undef X | 263 #undef X |
264 // Repeat the static asserts with respect to the high-level table | 264 // Repeat the static asserts with respect to the high-level table |
265 // entries in case the high-level table has extra entries. | 265 // entries in case the high-level table has extra entries. |
266 #define X(tag, size, align, elts, elty, str) \ | 266 #define X(tag, size, align, elts, elty, str) \ |
267 static_assert(_table1_##tag == _table2_##tag, \ | 267 static_assert(_table1_##tag == _table2_##tag, \ |
268 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); | 268 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); |
269 ICETYPE_TABLE; | 269 ICETYPE_TABLE |
270 #undef X | 270 #undef X |
271 } // end of namespace dummy3 | 271 } // end of namespace dummy3 |
272 | 272 |
273 } // end of anonymous namespace | 273 } // end of anonymous namespace |
274 | 274 |
275 TargetX8632::TargetX8632(Cfg *Func) | 275 TargetX8632::TargetX8632(Cfg *Func) |
276 : TargetLowering(Func), InstructionSet(CLInstructionSet), | 276 : TargetLowering(Func), InstructionSet(CLInstructionSet), |
277 IsEbpBasedFrame(false), NeedsStackAlignment(false), FrameSizeLocals(0), | 277 IsEbpBasedFrame(false), NeedsStackAlignment(false), FrameSizeLocals(0), |
278 SpillAreaSizeBytes(0), NextLabelNumber(0) { | 278 SpillAreaSizeBytes(0), NextLabelNumber(0) { |
279 // TODO: Don't initialize IntegerRegisters and friends every time. | 279 // TODO: Don't initialize IntegerRegisters and friends every time. |
(...skipping 4431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4711 Writer->writeConstantPool<ConstantFloat>(IceType_f32); | 4711 Writer->writeConstantPool<ConstantFloat>(IceType_f32); |
4712 Writer->writeConstantPool<ConstantDouble>(IceType_f64); | 4712 Writer->writeConstantPool<ConstantDouble>(IceType_f64); |
4713 } else { | 4713 } else { |
4714 OstreamLocker L(Ctx); | 4714 OstreamLocker L(Ctx); |
4715 emitConstantPool<PoolTypeConverter<float>>(Ctx); | 4715 emitConstantPool<PoolTypeConverter<float>>(Ctx); |
4716 emitConstantPool<PoolTypeConverter<double>>(Ctx); | 4716 emitConstantPool<PoolTypeConverter<double>>(Ctx); |
4717 } | 4717 } |
4718 } | 4718 } |
4719 | 4719 |
4720 } // end of namespace Ice | 4720 } // end of namespace Ice |
OLD | NEW |