summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocBasic.cpp
Commit message (Collapse)AuthorAge
* Privatize an unused part of the LiveIntervalUnion::Query interface.Jakob Stoklund Olesen2011-08-11
| | | | | | No clients are iterating over interference overlaps. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137350 91177308-0d34-0410-b5e6-96231b3b80d8
* Refer to the RegisterCoalescer pass by ID.Jakob Stoklund Olesen2011-08-09
| | | | | | | A public interface is no longer needed since RegisterCoalescer is not an analysis any more. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137082 91177308-0d34-0410-b5e6-96231b3b80d8
* Print out the MBB live-in registers.Jakob Stoklund Olesen2011-07-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136178 91177308-0d34-0410-b5e6-96231b3b80d8
* Better diagnostics when inline asm fails to allocate.Jakob Stoklund Olesen2011-07-02
| | | | | | | | asm.c:2:7: error: ran out of registers during register allocation asm(""::"r"(0), "r"(1), "r"(2), "r"(3), "r"(4), "r"(5), "r"(6), "r"(7), "r"(8), "r"(9)); ^ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134310 91177308-0d34-0410-b5e6-96231b3b80d8
* There is only one register coalescer. Merge it into the base class andRafael Espindola2011-06-26
| | | | | | remove the analysis group. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133899 91177308-0d34-0410-b5e6-96231b3b80d8
* Move RegisterCoalescer.h to lib/CodeGen.Rafael Espindola2011-06-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133895 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch AllocationOrder to using RegisterClassInfo instead of a BitVectorJakob Stoklund Olesen2011-06-03
| | | | | | | | | of reserved registers. Use RegisterClassInfo in RABasic as well. This slightly changes som allocation orders because RegisterClassInfo puts CSR aliases last. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132581 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR9883. Make sure all caches are invalidated when a live range is repaired.Jakob Stoklund Olesen2011-05-10
| | | | | | | | The previous invalidation missed the alias interference caches. Also add a stats counter for the number of repaired ranges. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131133 91177308-0d34-0410-b5e6-96231b3b80d8
* Emit a proper error message when register allocators run out of registers.Jakob Stoklund Olesen2011-05-06
| | | | | | | This can't be just an assertion, users can always write impossible inline assembly. Such an assembly statement should be included in the error message. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131024 91177308-0d34-0410-b5e6-96231b3b80d8
* Prefer cheap registers for busy live ranges.Jakob Stoklund Olesen2011-04-20
| | | | | | | | | | | | | | On the x86-64 and thumb2 targets, some registers are more expensive to encode than others in the same register class. Add a CostPerUse field to the TableGen register description, and make it available from TRI->getCostPerUse. This represents the cost of a REX prefix or a 32-bit instruction encoding required by choosing a high register. Teach the greedy register allocator to prefer cheap registers for busy live ranges (as indicated by spill weight). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129864 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug in RegAllocBase::addMBBLiveIns() where a basic block could ↵Jakob Stoklund Olesen2011-04-12
| | | | | | accidentally be skipped. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129373 91177308-0d34-0410-b5e6-96231b3b80d8
* Reuse live interval union between functions. This saves a bit of compile timeJakob Stoklund Olesen2011-04-11
| | | | | | when compiling many small functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129321 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a faster algorithm for computing MBB live-in registers after register ↵Jakob Stoklund Olesen2011-04-11
| | | | | | | | allocation. LiveIntervals::findLiveInMBBs has to do a full binary search for each segment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129292 91177308-0d34-0410-b5e6-96231b3b80d8
* Time the initial seeding of live registersJakob Stoklund Olesen2011-04-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129276 91177308-0d34-0410-b5e6-96231b3b80d8
* Run LiveDebugVariables in RegAllocBasic and RegAllocGreedy.Jakob Stoklund Olesen2011-04-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128935 91177308-0d34-0410-b5e6-96231b3b80d8
* The basic register allocator must also use the inline spiller.Jakob Stoklund Olesen2011-03-31
| | | | | | | It is using a trivial rewriter that doesn't know how to insert spill code requested by the standard spiller. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128688 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow the allocation of empty live ranges that have uses.Jakob Stoklund Olesen2011-03-23
| | | | | | Empty ranges may represent undef values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128144 91177308-0d34-0410-b5e6-96231b3b80d8
* Tag cached interference with a user-provided tag instead of the virtual ↵Jakob Stoklund Olesen2011-03-16
| | | | | | | | | register number. The live range of a virtual register may change which invalidates the cached interference information. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127772 91177308-0d34-0410-b5e6-96231b3b80d8
* Spill multiple registers at once.Jakob Stoklund Olesen2011-03-12
| | | | | | | | | | | Live range splitting can create a number of small live ranges containing only a single real use. Spill these small live ranges along with the large range they are connected to with copies. This enables memory operand folding and maximizes the spill to fill distance. Work in progress with known bugs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127529 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the Spiller interface to take a LiveRangeEdit reference.Jakob Stoklund Olesen2011-03-10
| | | | | | | This makes it possible to register delegates and get callbacks when the spiller edits live ranges. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127389 91177308-0d34-0410-b5e6-96231b3b80d8
* Make SpillIs an optional pointer. Avoid creating a bunch of temporary ↵Jakob Stoklund Olesen2011-03-10
| | | | | | SmallVectors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127388 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the RAGreedy register assignment order so large live ranges are ↵Jakob Stoklund Olesen2011-02-22
| | | | | | | | | | | | | | allocated first. This is based on the observation that long live ranges are more difficult to allocate, so there is a better chance of solving the puzzle by handling the big pieces first. The allocator will evict and split long alive ranges when they get in the way. RABasic is still using spill weights for its priority queue, so the interface to the queue has been virtualized. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126259 91177308-0d34-0410-b5e6-96231b3b80d8
* Add VirtRegMap::rewrite() and use it in the new register allocators.Jakob Stoklund Olesen2011-02-18
| | | | | | | | | | The rewriter works almost identically to -rewriter=trivial, except it also eliminates any identity copies. This makes the new register allocators independent of VirtRegRewriter.cpp which will be going away at the same time as RegAllocLinearScan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125967 91177308-0d34-0410-b5e6-96231b3b80d8
* Trim debugging output.Jakob Stoklund Olesen2011-02-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125802 91177308-0d34-0410-b5e6-96231b3b80d8
* Add basic register allocator statistics.Jakob Stoklund Olesen2011-02-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125789 91177308-0d34-0410-b5e6-96231b3b80d8
* Evict a lighter single interference before attempting to split a live range.Jakob Stoklund Olesen2011-02-09
| | | | | | | | | | | | | | Registers are not allocated strictly in spill weight order when live range splitting and spilling has created new shorter intervals with higher spill weights. When one of the new heavy intervals conflicts with a single lighter interval, simply evict the old interval instead of trying to split the heavy one. The lighter interval is a better candidate for splitting, it has a smaller use density. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125151 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass a Banner argument to the machine code verifier both fromJakob Stoklund Olesen2010-12-18
| | | | | | | | createMachineVerifierPass and MachineFunction::verify. The banner is printed before the machine code dump, just like the printer pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122113 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the -verify-regalloc command line option available to base classes asJakob Stoklund Olesen2010-12-17
| | | | | | | | RegAllocBase::VerifyEnabled. Run the machine code verifier in a few interesting places during RegAllocGreedy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122107 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplyfy RegAllocBasic by using getOverlaps instead of getAliasSet.Jakob Stoklund Olesen2010-12-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121801 91177308-0d34-0410-b5e6-96231b3b80d8
* Use TRI::printReg instead of AbstractRegisterDescription when printingJakob Stoklund Olesen2010-12-14
| | | | | | LiveIntervalUnions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121781 91177308-0d34-0410-b5e6-96231b3b80d8
* Add named timer groups for the different stages of register allocation.Jakob Stoklund Olesen2010-12-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121604 91177308-0d34-0410-b5e6-96231b3b80d8
* Move MRI into RegAllocBase. Clean up debug output a bit.Jakob Stoklund Olesen2010-12-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121599 91177308-0d34-0410-b5e6-96231b3b80d8
* Added register reassignment prototype to RAGreedy. It's a simpleAndrew Trick2010-12-09
| | | | | | | | heuristic to reshuffle register assignments when we can't find an available reg. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121388 91177308-0d34-0410-b5e6-96231b3b80d8
* Store (priority,regnum) pairs in the priority queue instead of providing anJakob Stoklund Olesen2010-12-08
| | | | | | | | | | | | | | | | | | | | | | | abstract priority queue interface in subclasses that want to override the priority calculations. Subclasses must provide a getPriority() implementation instead. This approach requires less code as long as priorities are expressable as simple floats, and it avoids the dangers of defining potentially expensive priority comparison functions. It also should speed up priority_queue operations since they no longer have to chase pointers when comparing registers. This is not measurable, though. Preferably, we shouldn't use floats to guide code generation. The use of floats here is derived from the use of floats for spill weights. Spill weights have a dynamic range that doesn't lend itself easily to a fixpoint implementation. When someone invents a stable spill weight representation, it can be reused for allocation priorities. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121294 91177308-0d34-0410-b5e6-96231b3b80d8
* Move RABasic::addMBBLiveIns to the base class, it is generally useful.Jakob Stoklund Olesen2010-12-08
| | | | | | | Minor optimization to the use of IntervalMap iterators. They are fairly heavyweight, so prefer SI.valid() over SI != end(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121217 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch LiveIntervalUnion from std::set to IntervalMap.Jakob Stoklund Olesen2010-12-07
| | | | | | | This speeds up RegAllocBasic by 20%, not counting releaseMemory which becomes way faster. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121201 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify assertion.Jakob Stoklund Olesen2010-12-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121162 91177308-0d34-0410-b5e6-96231b3b80d8
* Coding style. No significant functionality. Abandon linear scan styleAndrew Trick2010-11-30
| | | | | | | | | in favor of the widespread llvm style. Capitalize variables and add newlines for visual parsing. Rename variables for readability. And other cleanup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120490 91177308-0d34-0410-b5e6-96231b3b80d8
* Namespacify.Benjamin Kramer2010-11-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120146 91177308-0d34-0410-b5e6-96231b3b80d8
* RABasic fix. Regalloc is responsible for updating block live ins.Andrew Trick2010-11-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119896 91177308-0d34-0410-b5e6-96231b3b80d8
* Whitespace.Andrew Trick2010-11-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119895 91177308-0d34-0410-b5e6-96231b3b80d8
* Check TRI->getReservedRegs because other allocators do it. Even thoughAndrew Trick2010-11-11
| | | | | | | | | it makes no sense for allocation_order iterators to visit reserved regs. The inline spiller depends on AliasAnalysis. Manage the Query state to avoid uninitialized or stale results. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118800 91177308-0d34-0410-b5e6-96231b3b80d8
* RABasic is nearly functionally complete. There are a few remainingAndrew Trick2010-11-10
| | | | | | | | | | benchmarks hitting an assertion. Adds LiveIntervalUnion::collectInterferingVRegs. Fixes "late spilling" by checking for any unspillable live vregs among all physReg aliases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118701 91177308-0d34-0410-b5e6-96231b3b80d8
* Adds RABasic verification and tracing.Andrew Trick2010-11-09
| | | | | | | (retry now that the windows build is green) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118630 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting r118604. Windows build broke.Andrew Trick2010-11-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118613 91177308-0d34-0410-b5e6-96231b3b80d8
* Adds RABasic verification and tracing.Andrew Trick2010-11-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118604 91177308-0d34-0410-b5e6-96231b3b80d8
* Adds support for spilling previously allocated live intervals toAndrew Trick2010-11-08
| | | | | | | | | | handle cases in which a register is unavailable for spill code. Adds LiveIntervalUnion::extract. While processing interferences on a live virtual register, reuses the same Query object for each physcial reg. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118423 91177308-0d34-0410-b5e6-96231b3b80d8
* Let RegAllocBasic require MachineDominators - they are already available andJakob Stoklund Olesen2010-11-03
| | | | | | splitting needs them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118194 91177308-0d34-0410-b5e6-96231b3b80d8
* Jakob's review of the basic register allocator.Andrew Trick2010-10-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117384 91177308-0d34-0410-b5e6-96231b3b80d8
* This is a prototype of an experimental register allocationAndrew Trick2010-10-22
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117174 91177308-0d34-0410-b5e6-96231b3b80d8