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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 // * GlobalsSize: area 4 | 640 // * GlobalsSize: area 4 |
641 // * GlobalsAndSubsequentPaddingSize: areas 4 - 5 | 641 // * GlobalsAndSubsequentPaddingSize: areas 4 - 5 |
642 // * LocalsSpillAreaSize: area 6 | 642 // * LocalsSpillAreaSize: area 6 |
643 // * SpillAreaSizeBytes: areas 3 - 7 | 643 // * SpillAreaSizeBytes: areas 3 - 7 |
644 | 644 |
645 // If SimpleCoalescing is false, each variable without a register | 645 // If SimpleCoalescing is false, each variable without a register |
646 // gets its own unique stack slot, which leads to large stack | 646 // gets its own unique stack slot, which leads to large stack |
647 // frames. If SimpleCoalescing is true, then each "global" variable | 647 // frames. If SimpleCoalescing is true, then each "global" variable |
648 // without a register gets its own slot, but "local" variable slots | 648 // without a register gets its own slot, but "local" variable slots |
649 // are reused across basic blocks. E.g., if A and B are local to | 649 // are reused across basic blocks. E.g., if A and B are local to |
650 // block 1 and C is local to block 2, then C may share a slot with A | 650 // block 1 and C is local to block 2, then C may share a slot with A or B. |
651 // or B. | 651 // |
652 const bool SimpleCoalescing = true; | 652 // We cannot coalesce stack slots if this function calls a "returns twice" |
| 653 // function. In that case, basic blocks may be revisited, and variables |
| 654 // local to those basic blocks are actually live until after the |
| 655 // called function returns a second time. |
| 656 const bool SimpleCoalescing = !callsReturnsTwice(); |
653 size_t InArgsSizeBytes = 0; | 657 size_t InArgsSizeBytes = 0; |
654 size_t PreservedRegsSizeBytes = 0; | 658 size_t PreservedRegsSizeBytes = 0; |
655 SpillAreaSizeBytes = 0; | 659 SpillAreaSizeBytes = 0; |
656 Context.init(Node); | 660 Context.init(Node); |
657 Context.setInsertPoint(Context.getCur()); | 661 Context.setInsertPoint(Context.getCur()); |
658 | 662 |
659 // Determine stack frame offsets for each Variable without a | 663 // Determine stack frame offsets for each Variable without a |
660 // register assignment. This can be done as one variable per stack | 664 // register assignment. This can be done as one variable per stack |
661 // slot. Or, do coalescing by running the register allocator again | 665 // slot. Or, do coalescing by running the register allocator again |
662 // with an infinite set of registers (as a side effect, this gives | 666 // with an infinite set of registers (as a side effect, this gives |
(...skipping 3794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4457 Str << "\t.align\t" << Align << "\n"; | 4461 Str << "\t.align\t" << Align << "\n"; |
4458 Str << MangledName << ":\n"; | 4462 Str << MangledName << ":\n"; |
4459 for (SizeT i = 0; i < Size; ++i) { | 4463 for (SizeT i = 0; i < Size; ++i) { |
4460 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; | 4464 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; |
4461 } | 4465 } |
4462 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; | 4466 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; |
4463 } | 4467 } |
4464 } | 4468 } |
4465 | 4469 |
4466 } // end of namespace Ice | 4470 } // end of namespace Ice |
OLD | NEW |