diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-08-05 22:20:45 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-08-05 22:20:45 +0000 |
commit | 8627ea91cb097f45894fa80fa04a3fb0100530db (patch) | |
tree | 68486659a8ae93dc2b80e5503ec787eb43a9f1e8 /llvm/lib/CodeGen/SplitKit.cpp | |
parent | 0248f57d59a493124b378604cb084fde7b67adc7 (diff) | |
download | llvm-8627ea91cb097f45894fa80fa04a3fb0100530db.zip llvm-8627ea91cb097f45894fa80fa04a3fb0100530db.tar.gz llvm-8627ea91cb097f45894fa80fa04a3fb0100530db.tar.bz2 |
Split around single instructions to enable register class inflation.
Normally, we don't create a live range for a single instruction in a
basic block, the spiller does that anyway. However, when splitting a
live range that belongs to a proper register sub-class, inserting these
extra COPY instructions completely remove the constraints from the
remainder interval, and it may be allocated from the larger super-class.
The spiller will mop up these small live ranges if we end up spilling
anyway. It calls them snippets.
llvm-svn: 136989
Diffstat (limited to 'llvm/lib/CodeGen/SplitKit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SplitKit.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp index e6bcfcd..cc85771 100644 --- a/llvm/lib/CodeGen/SplitKit.cpp +++ b/llvm/lib/CodeGen/SplitKit.cpp @@ -1087,6 +1087,24 @@ void SplitEditor::finish(SmallVectorImpl<unsigned> *LRMap) { // Single Block Splitting //===----------------------------------------------------------------------===// +bool SplitAnalysis::shouldSplitSingleBlock(const BlockInfo &BI, + bool SingleInstrs) const { + // Always split for multiple instructions. + if (!BI.isOneInstr()) + return true; + // Don't split for single instructions unless explicitly requested. + if (!SingleInstrs) + return false; + // Splitting a live-through range always makes progress. + if (BI.LiveIn && BI.LiveOut) + return true; + // No point in isolating a copy. It has no register class constraints. + if (LIS.getInstructionFromIndex(BI.FirstInstr)->isCopyLike()) + return false; + // Finally, don't isolate an end point that was created by earlier splits. + return isOriginalEndpoint(BI.FirstInstr); +} + /// getMultiUseBlocks - if CurLI has more than one use in a basic block, it /// may be an advantage to split CurLI for the duration of the block. bool SplitAnalysis::getMultiUseBlocks(BlockPtrSet &Blocks) { |