summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SplitKit.h
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Add EdgeBundles to SplitKit.Jakob Stoklund Olesen2010-12-211-1/+38
| | | | | | | | | Edge bundles is an annotation on the CFG that turns it into a bipartite directed graph where each basic block is connected to an outgoing and an ingoing bundle. These bundles are useful for identifying regions of the CFG for live range splitting. llvm-svn: 122301
* Detect and enumerate bypass loops.Jakob Stoklund Olesen2010-12-151-0/+9
| | | | | | | | Bypass loops have the current live range live through, but contain no uses or defs. Splitting around a bypass loop can free registers for other uses inside the loop by spilling the split range. llvm-svn: 121871
* Separate SplitAnalysis::getSplitLoops().Jakob Stoklund Olesen2010-12-151-0/+4
| | | | | | | This method returns the set of loops with uses that are candidates for splitting. llvm-svn: 121870
* Basic rematerialization during splitting.Jakob Stoklund Olesen2010-11-101-8/+10
| | | | | | | | | | | Whenever splitting wants to insert a copy, it checks if the value can be rematerialized cheaply instead. Missing features: - Delete instructions when all uses have been rematerialized. - Truncate live ranges to the remaining uses after rematerialization. llvm-svn: 118702
* When inserting copies during splitting, always use the parent register as theJakob Stoklund Olesen2010-11-011-6/+6
| | | | | | | | | | | | source, and let rewrite() clean it up. This way, kill flags on the inserted copies are fixed as well during rewrite(). We can't just assume that all the copies we insert are going to be kills since critical edges into loop headers sometimes require both source and dest to be live out of a block. llvm-svn: 117980
* Replace SplitKit SSA update with an iterative algorithm very similar to the oneJakob Stoklund Olesen2010-10-281-1/+23
| | | | | | | | | | | | | | | | in SSAUpdaterImpl.h Verifying live intervals revealed that the old method was completely wrong, and we need an iterative approach to calculating PHI placemant. Fortunately, we have MachineDominators available, so we don't have to compute that over and over like SSAUpdaterImpl.h must. Live-out values are cached between calls to mapValue() and computed in a greedy way, so most calls will be working with very small block sets. Thanks to Bob for explaining how this should work. llvm-svn: 117599
* Make MachineDominators available for SplitEditor. We are going to need it forJakob Stoklund Olesen2010-10-281-2/+6
| | | | | | | | | proper SSA updating. This doesn't cause MachineDominators to be recomputed since we are already requiring MachineLoopInfo which uses dominators as well. llvm-svn: 117598
* Handle critical loop predecessors by making both inside and outside registersJakob Stoklund Olesen2010-10-271-1/+5
| | | | | | | | | live out. This doesn't prevent us from inserting a loop preheader later on, if that is better. llvm-svn: 117424
* Compute critical loop predecessors in the same way as critical loop exits.Jakob Stoklund Olesen2010-10-271-0/+5
| | | | | | | | Critical edges going into a loop are not as bad as critical exits. We can handle them by splitting the critical edge, or by having both inside and outside registers live out of the predecessor. llvm-svn: 117423
* This is a prototype of an experimental register allocationAndrew Trick2010-10-221-1/+1
| | | | | | | | | | | | | | | | framework. It's purpose is not to improve register allocation per se, but to make it easier to develop powerful live range splitting. I call it the basic allocator because it is as simple as a global allocator can be but provides the building blocks for sophisticated register allocation with live range splitting. A minimal implementation is provided that trivially spills whenever it runs out of registers. I'm checking in now to get high-level design and style feedback. I've only done minimal testing. The next step is implementing a "greedy" allocation algorithm that does some register reassignment and makes better splitting decisions. llvm-svn: 117174
* Add print methodsJakob Stoklund Olesen2010-10-221-0/+7
| | | | llvm-svn: 117143
* Remove unused accessor.Jakob Stoklund Olesen2010-10-151-2/+0
| | | | llvm-svn: 116580
* Eliminate curli from SplitEditor. Use the LiveRangeEdit reference instead.Jakob Stoklund Olesen2010-10-151-3/+0
| | | | llvm-svn: 116547
* Create a new LiveRangeEdit class to keep track of the new registers created whenJakob Stoklund Olesen2010-10-141-13/+5
| | | | | | | | | splitting or spillling, and to help with rematerialization. Use LiveRangeEdit in InlineSpiller and SplitKit. This will eventually make it possible to share remat code between InlineSpiller and SplitKit. llvm-svn: 116543
* Rename SplitEditor::rewrite to finish() and break it out into a couple of newJakob Stoklund Olesen2010-10-081-4/+11
| | | | | | | | | functions: computeRemainder and rewrite. When the remainder breaks up into multiple components, remember to rewrite those uses as well. llvm-svn: 116121
* Remove SplitAnalysis::removeUse. It was only used to make SplitAnalysisJakob Stoklund Olesen2010-10-051-3/+0
| | | | | | | reusable, but that is no longer relevant since a split will always replace the original. llvm-svn: 115709
* Update SplitEditor API to reflect the fact that the original live interval isJakob Stoklund Olesen2010-10-051-14/+8
| | | | | | | | | | never kept after splitting. Keeping the original interval made sense when the split region doesn't modify the register, and the original is spilled. We can get the same effect by detecting reloaded values when spilling around copies. llvm-svn: 115695
* Don't use nextIndex to check for live out of instruction.Jakob Stoklund Olesen2010-10-051-5/+5
| | | | | | | | | | | Insert copy after defining instruction. Fix LiveIntervalMap::extendTo to properly handle live segments starting before the current basic block. Make sure the open live range is extended to the inserted copy's use slot. llvm-svn: 115665
* Build the complement interval dupli after the split intervals instead ofJakob Stoklund Olesen2010-09-211-10/+27
| | | | | | | | | | | | | creating it before and subtracting split ranges. This way, the SSA update code in LiveIntervalMap can properly create and use new phi values in dupli. Now it is possible to create split regions where a value escapes along two different CFG edges, creating phi values outside the split region. This is a work in progress and probably quite broken. llvm-svn: 114492
OpenPOWER on IntegriCloud