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 /// \file | 10 /// \file |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 uint32_t SpillAreaPaddingBytes = 0; | 490 uint32_t SpillAreaPaddingBytes = 0; |
491 uint32_t LocalsSlotsPaddingBytes = 0; | 491 uint32_t LocalsSlotsPaddingBytes = 0; |
492 alignStackSpillAreas(Traits::X86_RET_IP_SIZE_BYTES + PreservedRegsSizeBytes, | 492 alignStackSpillAreas(Traits::X86_RET_IP_SIZE_BYTES + PreservedRegsSizeBytes, |
493 SpillAreaAlignmentBytes, GlobalsSize, | 493 SpillAreaAlignmentBytes, GlobalsSize, |
494 LocalsSlotsAlignmentBytes, &SpillAreaPaddingBytes, | 494 LocalsSlotsAlignmentBytes, &SpillAreaPaddingBytes, |
495 &LocalsSlotsPaddingBytes); | 495 &LocalsSlotsPaddingBytes); |
496 SpillAreaSizeBytes += SpillAreaPaddingBytes + LocalsSlotsPaddingBytes; | 496 SpillAreaSizeBytes += SpillAreaPaddingBytes + LocalsSlotsPaddingBytes; |
497 uint32_t GlobalsAndSubsequentPaddingSize = | 497 uint32_t GlobalsAndSubsequentPaddingSize = |
498 GlobalsSize + LocalsSlotsPaddingBytes; | 498 GlobalsSize + LocalsSlotsPaddingBytes; |
499 | 499 |
| 500 // Functions returning scalar floating point types may need to convert values |
| 501 // from an in-register xmm value to the top of the x87 floating point stack. |
| 502 // This is done by a movp[sd] and an fld[sd]. Ensure there is enough scratch |
| 503 // space on the stack for this. |
| 504 const Type ReturnType = Func->getReturnType(); |
| 505 if (isScalarFloatingType(ReturnType)) { |
| 506 // Avoid misaligned double-precicion load/store. |
| 507 NeedsStackAlignment = true; |
| 508 SpillAreaSizeBytes = |
| 509 std::max(typeWidthInBytesOnStack(ReturnType), SpillAreaSizeBytes); |
| 510 } |
| 511 |
500 // Align esp if necessary. | 512 // Align esp if necessary. |
501 if (NeedsStackAlignment) { | 513 if (NeedsStackAlignment) { |
502 uint32_t StackOffset = | 514 uint32_t StackOffset = |
503 Traits::X86_RET_IP_SIZE_BYTES + PreservedRegsSizeBytes; | 515 Traits::X86_RET_IP_SIZE_BYTES + PreservedRegsSizeBytes; |
504 uint32_t StackSize = | 516 uint32_t StackSize = |
505 Traits::applyStackAlignment(StackOffset + SpillAreaSizeBytes); | 517 Traits::applyStackAlignment(StackOffset + SpillAreaSizeBytes); |
506 SpillAreaSizeBytes = StackSize - StackOffset; | 518 SpillAreaSizeBytes = StackSize - StackOffset; |
507 } | 519 } |
508 | 520 |
509 // Combine fixed allocations into SpillAreaSizeBytes if we are emitting the | 521 // Combine fixed allocations into SpillAreaSizeBytes if we are emitting the |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 // case the high-level table has extra entries. | 1006 // case the high-level table has extra entries. |
995 #define X(tag, sizeLog2, align, elts, elty, str) \ | 1007 #define X(tag, sizeLog2, align, elts, elty, str) \ |
996 static_assert(_table1_##tag == _table2_##tag, \ | 1008 static_assert(_table1_##tag == _table2_##tag, \ |
997 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); | 1009 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); |
998 ICETYPE_TABLE | 1010 ICETYPE_TABLE |
999 #undef X | 1011 #undef X |
1000 } // end of namespace dummy3 | 1012 } // end of namespace dummy3 |
1001 } // end of anonymous namespace | 1013 } // end of anonymous namespace |
1002 | 1014 |
1003 } // end of namespace Ice | 1015 } // end of namespace Ice |
OLD | NEW |