summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SplitKit.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r132245, "Create two BlockInfo entries when a live range is ↵Jakob Stoklund Olesen2011-05-291-15/+6
| | | | | | | | discontinuous through a block." This commit seems to have broken a darwin 9 tester. llvm-svn: 132299
* Create two BlockInfo entries when a live range is discontinuous through a block.Jakob Stoklund Olesen2011-05-281-6/+15
| | | | | | | | | | | | | | | | | | | Delete the Kill and Def markers in BlockInfo. They are no longer necessary when BlockInfo describes a continuous live range. This only affects the relatively rare kind of basic block where a live range looks like this: |---x o---| Now live range splitting can pretend that it is looking at two blocks: |---x o---| This allows the code to be simplified a bit. llvm-svn: 132245
* Add SplitAnalysis::getNumLiveBlocks().Jakob Stoklund Olesen2011-05-281-4/+9
| | | | | | | | | | | It is important that this function returns the same number of live blocks as countLiveBlocks(CurLI) because live range splitting uses the number of live blocks to ensure it is making progress. This is in preparation of supporting duplicate UseBlock entries for basic blocks that have a virtual register live-in and live-out, but not live-though. llvm-svn: 132244
* Gracefully handle invalid live ranges. Fix PR9831.Jakob Stoklund Olesen2011-05-031-0/+8
| | | | | | | | | | | | | | | | Register coalescing can sometimes create live ranges that end in the middle of a basic block without any killing instruction. When SplitKit detects this, it will repair the live range by shrinking it to its uses. Live range splitting also needs to know about this. When the range shrinks so much that it becomes allocatable, live range splitting fails because it can't find a good split point. It is paranoid about making progress, so an allocatable range is considered an error. The coalescer should really not be creating these bad live ranges. They appear when coalescing dead copies. llvm-svn: 130787
* Add a safe-guard against repeated splitting for some rare cases.Jakob Stoklund Olesen2011-04-261-0/+5
| | | | | | | The number of blocks covered by a live range must be strictly decreasing when splitting, otherwise we can't allow repeated splitting. llvm-svn: 130249
* Give SplitKit.h a header guard.Sebastian Redl2011-04-241-0/+5
| | | | llvm-svn: 130095
* Allow allocatable ranges from global live range splitting to be split again.Jakob Stoklund Olesen2011-04-211-1/+4
| | | | | | | | | | | | | | | | | | | | | These intervals are allocatable immediately after splitting, but they may be evicted because of later splitting. This is rare, but when it happens they should be split again. The remainder intervals that cannot be allocated after splitting still move directly to spilling. SplitEditor::finish can optionally provide a mapping from new live intervals back to the original interval indexes returned by openIntv(). Each original interval index can map to multiple new intervals after connected components have been separated. Dead code elimination may also add existing intervals to the list. The reverse mapping allows the SplitEditor client to treat the new intervals differently depending on the split region they came from. llvm-svn: 129925
* Teach the SplitKit blitter to handle multiply defined values as well.Jakob Stoklund Olesen2011-04-151-11/+40
| | | | | | | | | | | | | | The transferValues() function can now handle both singly and multiply defined values, as long as the resulting live range is known. Only rematerialized values have their live range recomputed by extendRange(). The updateSSA() function can now insert PHI values in bulk across multiple values in multiple target registers in one pass. The list of blocks received from transferValues() is in layout order which seems to work well for the iterative algorithm. Blocks from extendRange() are still in reverse BFS order, but this function is used so rarely now that it doesn't matter. llvm-svn: 129580
* Stop using dead function.Jakob Stoklund Olesen2011-04-131-4/+0
| | | | llvm-svn: 129442
* SparseBitVector is SLOW.Jakob Stoklund Olesen2011-04-121-0/+3
| | | | | | | Use a Bitvector instead, we didn't need the smaller memory footprint anyway. This makes the greedy register allocator 10% faster. llvm-svn: 129390
* Create new intervals for isolated blocks during region splitting.Jakob Stoklund Olesen2011-04-121-0/+5
| | | | | | | | | This merges the behavior of splitSingleBlocks into splitAroundRegion, so the RS_Region and RS_Block register stages can be coalesced. That means the leftover intervals after region splitting go directly to spilling instead of a second pass of per-block splitting. llvm-svn: 129379
* Add SplitKit API to query and select the current interval being worked on.Jakob Stoklund Olesen2011-04-121-1/+9
| | | | | | This makes it possible to target multiple registers in one pass. llvm-svn: 129374
* Build the Hopfield network incrementally when splitting global live ranges.Jakob Stoklund Olesen2011-04-091-4/+9
| | | | | | | | | It is common for large live ranges to have few basic blocks with register uses and many live-through blocks without any uses. This approach grows the Hopfield network incrementally around the use blocks, completely avoiding checking interference for some through blocks. llvm-svn: 129188
* Analyze blocks with uses separately from live-through blocks without uses.Jakob Stoklund Olesen2011-04-061-5/+15
| | | | | | | | About 90% of the relevant blocks are live-through without uses, and the only information required about them is their number. This saves memory and enables later optimizations that need to look at only the use-blocks. llvm-svn: 128985
* Use std::unique instead of a SmallPtrSet to ensure unique instructions in ↵Jakob Stoklund Olesen2011-04-051-16/+0
| | | | | | | | | | | UseSlots. This allows us to always keep the smaller slot for an instruction which is what we want when a register has early clobber defines. Drop the UsingInstrs set and the UsingBlocks map. They are no longer needed. llvm-svn: 128886
* Stop precomputing last split points, query the SplitAnalysis cache on demand.Jakob Stoklund Olesen2011-04-051-2/+0
| | | | llvm-svn: 128875
* Cache the fairly expensive last split point computation and provide a fastJakob Stoklund Olesen2011-04-051-4/+18
| | | | | | | | | inlined path for the common case. Most basic blocks don't contain a call that may throw, so the last split point os simply the first terminator. llvm-svn: 128874
* Stop caching basic block index ranges now that SlotIndexes can keep up.Jakob Stoklund Olesen2011-04-041-2/+0
| | | | llvm-svn: 128821
* Delete leftover data members.Jakob Stoklund Olesen2011-04-041-4/+0
| | | | llvm-svn: 128820
* Rewrite instructions as part of ConnectedVNInfoEqClasses::Distribute.Jakob Stoklund Olesen2011-03-171-7/+0
| | | | llvm-svn: 127779
* Delete dead code after rematerializing.Jakob Stoklund Olesen2011-03-081-0/+3
| | | | | | | | LiveRangeEdit::eliminateDeadDefs() will eventually be used by coalescing, splitting, and spilling for dead code elimination. It can delete chains of dead instructions as long as there are no dependency loops. llvm-svn: 127287
* Work around a coalescer bug.Jakob Stoklund Olesen2011-03-051-1/+1
| | | | | | | | | | | | The coalescer can in very rare cases leave too large live intervals around after rematerializing cheap-as-a-move instructions. Linear scan doesn't really care, but live range splitting gets very confused when a live range is killed by a ghost instruction. I will fix this properly in the coalescer after 2.9 branches. llvm-svn: 127096
* Use an IndexedMap instead of a DenseMap for the live-out cache.Jakob Stoklund Olesen2011-03-041-1/+7
| | | | | | | This speeds up updateSSA() so it only accounts for 5% of the live range splitting time. llvm-svn: 126972
* Cache basic block bounds instead of asking SlotIndexes::getMBBRange all the ↵Jakob Stoklund Olesen2011-03-031-0/+2
| | | | | | | | | time. This speeds up the greedy register allocator by 15%. DenseMap is not as fast as one might hope. llvm-svn: 126921
* Change the SplitEditor interface to a single instance can be shared for ↵Jakob Stoklund Olesen2011-03-031-3/+3
| | | | | | multiple splits. llvm-svn: 126912
* Turn the Edit member into a pointer so it can change dynamically.Jakob Stoklund Olesen2011-03-021-1/+1
| | | | | | No functional change. llvm-svn: 126898
* Transfer simply defined values directly without recomputing liveness and SSA.Jakob Stoklund Olesen2011-03-021-1/+5
| | | | | | | | Values that map to a single new value in a new interval after splitting don't need new PHIDefs, and if the parent value was never rematerialized the live range will be the same. llvm-svn: 126894
* Extract a method. No functional change.Jakob Stoklund Olesen2011-03-021-0/+4
| | | | llvm-svn: 126893
* Move extendRange() into SplitEditor and delete the LiveRangeMap class.Jakob Stoklund Olesen2011-03-021-60/+32
| | | | | | | | | Extract the updateSSA() method from the too long extendRange(). LiveOutCache can be shared among all the new intervals since there is at most one of the new ranges live out from each basic block. llvm-svn: 126818
* Rename mapValue to extendRange because that is its function now.Jakob Stoklund Olesen2011-03-021-10/+3
| | | | | | Simplify the signature - The return value and ParentVNI are no longer needed. llvm-svn: 126809
* Move LiveIntervalMap::extendTo into LiveInterval itself.Jakob Stoklund Olesen2011-03-021-5/+0
| | | | | | | This method could probably be used by LiveIntervalAnalysis::shrinkToUses, and now it can use extendIntervalEndTo() which coalesces ranges. llvm-svn: 126803
* Delete dead code.Jakob Stoklund Olesen2011-03-011-9/+0
| | | | llvm-svn: 126801
* Move the value map from LiveIntervalMap to SplitEditor.Jakob Stoklund Olesen2011-03-011-28/+23
| | | | | | | | | | | The value map is currently not used, all values are 'complex mapped' and LiveIntervalMap::mapValue is used to dig them out. This is the first step in a series changes leading to the removal of LiveIntervalMap. Its data structures can be shared among all the live intervals created by a split, so it is wasteful to create a copy for each. llvm-svn: 126800
* Delete dead code.Jakob Stoklund Olesen2011-03-011-9/+0
| | | | | | | Local live range splitting is better driven by interference. This code was just guessing. llvm-svn: 126799
* Add SplitKit::isOriginalEndpoint and use it to force live range splitting to ↵Jakob Stoklund Olesen2011-02-211-0/+7
| | | | | | | | | | | | | | terminate. An original endpoint is an instruction that killed or defined the original live range before any live ranges were split. When splitting global live ranges, avoid creating local live ranges without any original endpoints. We may still create global live ranges without original endpoints, but such a range won't be split again, and live range splitting still terminates. llvm-svn: 126151
* Give SplitAnalysis a VRM member to access VirtRegMap::getOriginal().Jakob Stoklund Olesen2011-02-191-1/+2
| | | | llvm-svn: 126005
* Missed member rename for naming convention.Jakob Stoklund Olesen2011-02-191-2/+2
| | | | llvm-svn: 126003
* Split local live ranges.Jakob Stoklund Olesen2011-02-171-0/+3
| | | | | | | | A local live range is live in a single basic block. If such a range fails to allocate, try to find a sub-range that would get a larger spill weight than its interference. llvm-svn: 125764
* Delete unused code for analyzing and splitting around loops.Jakob Stoklund Olesen2011-02-091-74/+0
| | | | | | | Loop splitting is better handled by the more generic global region splitting based on the edge bundle graph. llvm-svn: 125243
* Use the LiveBLocks array for SplitEditor::splitSingleBlocks() as well.Jakob Stoklund Olesen2011-02-091-0/+4
| | | | | | | This fixes a bug where splitSingleBlocks() could split a live range after a terminator instruction. llvm-svn: 125237
* Move calcLiveBlockInfo() and the BlockInfo struct into SplitAnalysis.Jakob Stoklund Olesen2011-02-091-0/+35
| | | | | | No functional changes intended. llvm-svn: 125231
* Add SplitEditor::overlapIntv() to create small ranges where both registers ↵Jakob Stoklund Olesen2011-02-081-0/+12
| | | | | | | | | | | | | | | | | | | | | | are live. If a live range is used by a terminator instruction, and that live range needs to leave the block on the stack or in a different register, it can be necessary to have both sides of the split live at the terminator instruction. Example: %vreg2 = COPY %vreg1 JMP %vreg1 Becomes after spilling %vreg2: SPILL %vreg1 JMP %vreg1 The spill doesn't kill the register as is normally the case. llvm-svn: 125102
* Return live range end points from SplitEditor::enter*/leave*.Jakob Stoklund Olesen2011-02-031-9/+14
| | | | | | | These end points come from the inserted copies, and can be passed directly to useIntv. This simplifies the coloring code. llvm-svn: 124799
* Reapply this.Eric Christopher2011-02-031-27/+36
| | | | llvm-svn: 124779
* Temporarily revert 124765 in an attempt to find the cycle breaking bootstrap.Eric Christopher2011-02-031-36/+27
| | | | llvm-svn: 124778
* Defer SplitKit value mapping until all defs are available.Jakob Stoklund Olesen2011-02-031-27/+36
| | | | | | | | | | | | | | | | | | | The greedy register allocator revealed some problems with the value mapping in SplitKit. We would sometimes start mapping values before all defs were known, and that could change a value from a simple 1-1 mapping to a multi-def mapping that requires ssa update. The new approach collects all defs and register assignments first without filling in any live intervals. Only when finish() is called, do we compute liveness and mapped values. At this time we know with certainty which values map to multiple values in a split range. This also has the advantage that we can compute live ranges based on the remaining uses after rematerializing at split points. The current implementation has many opportunities for compile time optimization. llvm-svn: 124765
* Rename member variables to follow the rest of LLVM.Jakob Stoklund Olesen2011-01-261-76/+76
| | | | | | No functional change. llvm-svn: 124257
* Add LiveIntervalMap::dumpCache() to print out the cache used by the ssa ↵Jakob Stoklund Olesen2011-01-201-0/+3
| | | | | | update algorithm. llvm-svn: 123925
* Add RAGreedy methods for splitting live ranges around regions.Jakob Stoklund Olesen2011-01-181-0/+8
| | | | | | | | | | Analyze the live range's behavior entering and leaving basic blocks. Compute an interference pattern for each allocation candidate, and use SpillPlacement to find an optimal region where that register can be live. This code is still not enabled. llvm-svn: 123774
* Turn the EdgeBundles class into a stand-alone machine CFG analysis pass.Jakob Stoklund Olesen2011-01-041-37/+1
| | | | | | | | | | The analysis will be needed by both the greedy register allocator and the X86FloatingPoint pass. It only needs to be computed once when the CFG doesn't change. This pass is very fast, usually showing up as 0.0% wall time. llvm-svn: 122832
OpenPOWER on IntegriCloud