LLVM: llvm::SplitEditor Class Reference (original) (raw)
SplitEditor - Edit machine code and LiveIntervals for live range splitting. More...
#include "[CodeGen/SplitKit.h](SplitKit%5F8h%5Fsource.html)"
| Public Types | |
|---|---|
| enum | ComplementSpillMode { SM_Partition, SM_Size, SM_Speed } |
| ComplementSpillMode - Select how the complement live range should be created. More... |
| Public Member Functions | |
|---|---|
| SplitEditor (SplitAnalysis &SA, LiveIntervals &LIS, VirtRegMap &VRM, MachineDominatorTree &MDT, MachineBlockFrequencyInfo &MBFI, VirtRegAuxInfo &VRAI) | |
| Create a new SplitEditor for editing the LiveInterval analyzed by SA. | |
| void | reset (LiveRangeEdit &, ComplementSpillMode=SM_Partition) |
| reset - Prepare for a new split. | |
| unsigned | openIntv () |
| Create a new virtual register and live interval. | |
| unsigned | currentIntv () const |
| currentIntv - Return the current interval index. | |
| void | selectIntv (unsigned Idx) |
| selectIntv - Select a previously opened interval index. | |
| SlotIndex | enterIntvBefore (SlotIndex Idx) |
| enterIntvBefore - Enter the open interval before the instruction at Idx. | |
| SlotIndex | enterIntvAfter (SlotIndex Idx) |
| enterIntvAfter - Enter the open interval after the instruction at Idx. | |
| SlotIndex | enterIntvAtEnd (MachineBasicBlock &MBB) |
| enterIntvAtEnd - Enter the open interval at the end of MBB. | |
| void | useIntv (const MachineBasicBlock &MBB) |
| useIntv - indicate that all instructions in MBB should use OpenLI. | |
| void | useIntv (SlotIndex Start, SlotIndex End) |
| useIntv - indicate that all instructions in range should use OpenLI. | |
| SlotIndex | leaveIntvAfter (SlotIndex Idx) |
| leaveIntvAfter - Leave the open interval after the instruction at Idx. | |
| SlotIndex | leaveIntvBefore (SlotIndex Idx) |
| leaveIntvBefore - Leave the open interval before the instruction at Idx. | |
| SlotIndex | leaveIntvAtTop (MachineBasicBlock &MBB) |
| leaveIntvAtTop - Leave the interval at the top of MBB. | |
| void | overlapIntv (SlotIndex Start, SlotIndex End) |
| overlapIntv - Indicate that all instructions in range should use the open interval if End does not have tied-def usage of the register and in this case complement interval is used. | |
| void | finish (SmallVectorImpl< unsigned > *LRMap=nullptr) |
| finish - after all the new live ranges have been created, compute the remaining live range, and rewrite instructions to use the new registers. | |
| void | dump () const |
| dump - print the current interval mapping to dbgs(). | |
| void | splitSingleBlock (const SplitAnalysis::BlockInfo &BI) |
| splitSingleBlock - Split CurLI into a separate live interval around the uses in a single block. | |
| void | splitLiveThroughBlock (unsigned MBBNum, unsigned IntvIn, SlotIndex LeaveBefore, unsigned IntvOut, SlotIndex EnterAfter) |
| splitLiveThroughBlock - Split CurLI in the given block such that it enters the block in IntvIn and leaves it in IntvOut. | |
| void | splitRegInBlock (const SplitAnalysis::BlockInfo &BI, unsigned IntvIn, SlotIndex LeaveBefore) |
| splitRegInBlock - Split CurLI in the given block such that it enters the block in IntvIn and leaves it on the stack (or not at all). | |
| void | splitRegOutBlock (const SplitAnalysis::BlockInfo &BI, unsigned IntvOut, SlotIndex EnterAfter) |
| splitRegOutBlock - Split CurLI in the given block such that it enters the block on the stack (or isn't live-in at all) and leaves it in IntvOut. |
SplitEditor - Edit machine code and LiveIntervals for live range splitting.
- Create a SplitEditor from a SplitAnalysis.
- Start a new live interval with openIntv.
- Mark the places where the new interval is entered using enterIntv*
- Mark the ranges where the new interval is used with useIntv*
- Mark the places where the interval is exited with exitIntv*.
- Finish the current interval with closeIntv and repeat from 2.
- Rewrite instructions with finish().
Definition at line 263 of file SplitKit.h.
◆ ComplementSpillMode
ComplementSpillMode - Select how the complement live range should be created.
SplitEditor automatically creates interval 0 to contain anything that isn't added to another interval. This complement interval can get quite complicated, and it can sometimes be an advantage to allow it to overlap the other intervals. If it is going to spill anyway, no registers are wasted by keeping a value in two places at the same time.
| Enumerator | |
|---|---|
| SM_Partition | SM_Partition(Default) - Try to create the complement interval so it doesn't overlap any other intervals, and the original interval is partitioned. This may require a large number of back copies and extra PHI-defs. Only segments marked with overlapIntv will be overlapping. |
| SM_Size | SM_Size - Overlap intervals to minimize the number of inserted COPY instructions. Copies to the complement interval are hoisted to their common dominator, so only one COPY is required per value in the complement interval. This also means that no extra PHI-defs need to be inserted in the complement interval. |
| SM_Speed | SM_Speed - Overlap intervals to minimize the expected execution frequency of the inserted copies. This is very similar to SM_Size, but the complement interval may get some extra PHI-defs. |
Definition at line 281 of file SplitKit.h.
◆ currentIntv()
| unsigned llvm::SplitEditor::currentIntv ( ) const | inline |
|---|
currentIntv - Return the current interval index.
Definition at line 465 of file SplitKit.h.
◆ dump()
◆ enterIntvAfter()
◆ enterIntvAtEnd()
◆ enterIntvBefore()
enterIntvBefore - Enter the open interval before the instruction at Idx.
If the parent interval is not live before Idx, a COPY is not inserted. Return the beginning of the new live range.
Definition at line 698 of file SplitKit.cpp.
References assert(), llvm::dbgs(), llvm::VNInfo::def, llvm::SlotIndex::getBaseIndex(), llvm::VNInfo::id, LLVM_DEBUG, and MI.
Referenced by splitLiveThroughBlock(), splitRegInBlock(), splitRegOutBlock(), and splitSingleBlock().
◆ finish()
finish - after all the new live ranges have been created, compute the remaining live range, and rewrite instructions to use the new registers.
Parameters
| LRMap | When not null, this vector will map each live range in Edit back to the indices returned by openIntv. There may be extra indices created by dead code elimination. |
|---|
Definition at line 1536 of file SplitKit.cpp.
References assert(), llvm::SmallVectorImpl< T >::assign(), llvm::VNInfo::def, llvm::VNInfo::isUnused(), llvm::LiveInterval::removeEmptySubRanges(), llvm::LiveRange::RenumberValues(), llvm::SmallVectorImpl< T >::resize(), llvm::seq(), llvm::SmallVectorTemplateCommon< T, typename >::size(), SM_Partition, SM_Size, and SM_Speed.
◆ leaveIntvAfter()
◆ leaveIntvAtTop()
◆ leaveIntvBefore()
◆ openIntv()
◆ overlapIntv()
overlapIntv - Indicate that all instructions in range should use the open interval if End does not have tied-def usage of the register and in this case complement interval is used.
Let the complement interval be live.
This doubles the register pressure, but is sometimes required to deal with register uses after the last valid split point.
The Start index should be a return value from a leaveIntv* call, and End should be in the same basic block. The parent interval must have the same value across the range.
Definition at line 858 of file SplitKit.cpp.
References assert(), llvm::dbgs(), dump(), hasTiedUseOf(), LLVM_DEBUG, and MI.
Referenced by splitRegInBlock(), and splitSingleBlock().
◆ reset()
reset - Prepare for a new split.
Definition at line 366 of file SplitKit.cpp.
◆ selectIntv()
| void SplitEditor::selectIntv | ( | unsigned | Idx | ) |
|---|
◆ splitLiveThroughBlock()
splitLiveThroughBlock - Split CurLI in the given block such that it enters the block in IntvIn and leaves it in IntvOut.
There may be uses in the block, but they will be ignored when placing split points.
Parameters
| MBBNum | Block number. |
|---|---|
| IntvIn | Interval index entering the block. |
| LeaveBefore | When set, leave IntvIn before this point. |
| IntvOut | Interval index leaving the block. |
| EnterAfter | When set, enter IntvOut after this point. |
Definition at line 1667 of file SplitKit.cpp.
References assert(), llvm::dbgs(), enterIntvAfter(), enterIntvAtEnd(), enterIntvBefore(), llvm::SlotIndex::getBaseIndex(), llvm::SlotIndex::getBoundaryIndex(), leaveIntvAtTop(), leaveIntvBefore(), LLVM_DEBUG, MBB, selectIntv(), and useIntv().
◆ splitRegInBlock()
splitRegInBlock - Split CurLI in the given block such that it enters the block in IntvIn and leaves it on the stack (or not at all).
Split points are placed in a way that avoids putting uses in the stack interval. This may require creating a local interval when there is interference.
Parameters
| BI | Block descriptor. |
|---|---|
| IntvIn | Interval index entering the block. Not 0. |
| LeaveBefore | When set, leave IntvIn before this point. |
Definition at line 1770 of file SplitKit.cpp.
References assert(), llvm::dbgs(), enterIntvBefore(), llvm::SplitAnalysis::BlockInfo::FirstInstr, llvm::SlotIndex::getBoundaryIndex(), llvm::SplitAnalysis::BlockInfo::LastInstr, leaveIntvAfter(), leaveIntvBefore(), llvm::SplitAnalysis::BlockInfo::LiveIn, llvm::SplitAnalysis::BlockInfo::LiveOut, LLVM_DEBUG, llvm::SplitAnalysis::BlockInfo::MBB, openIntv(), overlapIntv(), llvm::printMBBReference(), selectIntv(), and useIntv().
◆ splitRegOutBlock()
splitRegOutBlock - Split CurLI in the given block such that it enters the block on the stack (or isn't live-in at all) and leaves it in IntvOut.
Split points are placed to avoid interference and such that the uses are not in the stack interval. This may require creating a local interval when there is interference.
Parameters
| BI | Block descriptor. |
|---|---|
| IntvOut | Interval index leaving the block. |
| EnterAfter | When set, enter IntvOut after this point. |
Definition at line 1863 of file SplitKit.cpp.
References assert(), llvm::dbgs(), enterIntvAfter(), enterIntvBefore(), llvm::SplitAnalysis::BlockInfo::FirstInstr, llvm::SlotIndex::getBaseIndex(), llvm::SplitAnalysis::BlockInfo::LastInstr, llvm::SplitAnalysis::BlockInfo::LiveIn, llvm::SplitAnalysis::BlockInfo::LiveOut, LLVM_DEBUG, llvm::SplitAnalysis::BlockInfo::MBB, openIntv(), llvm::printMBBReference(), selectIntv(), and useIntv().
◆ splitSingleBlock()
splitSingleBlock - Split CurLI into a separate live interval around the uses in a single block.
This is intended to be used as part of a larger split, and doesn't call finish().
Definition at line 1641 of file SplitKit.cpp.
References enterIntvBefore(), llvm::SplitAnalysis::BlockInfo::FirstInstr, llvm::SplitAnalysis::BlockInfo::LastInstr, leaveIntvAfter(), leaveIntvBefore(), llvm::SplitAnalysis::BlockInfo::LiveOut, llvm::SplitAnalysis::BlockInfo::MBB, openIntv(), overlapIntv(), and useIntv().
◆ useIntv() [1/2]
◆ useIntv() [2/2]
The documentation for this class was generated from the following files:
- lib/CodeGen/SplitKit.h
- lib/CodeGen/SplitKit.cpp