summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegisterPressure.cpp
Commit message (Collapse)AuthorAge
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-14
| | | | | | instead of comparing to nullptr. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206142 91177308-0d34-0410-b5e6-96231b3b80d8
* Phase 1 of refactoring the MachineRegisterInfo iterators to make them suitableOwen Anderson2014-03-13
| | | | | | | | | | | | | | | | | | | | for use with C++11 range-based for-loops. The gist of phase 1 is to remove the skipInstruction() and skipBundle() methods from these iterators, instead splitting each iterator into a version that walks operands, a version that walks instructions, and a version that walks bundles. This has the result of making some "clever" loops in lib/CodeGen more verbose, but also makes their iterator invalidation characteristics much more obvious to the casual reader. (Making them concise again in the future is a good motivating case for a pre-incrementing range adapter!) Phase 2 of this undertaking with consist of removing the getOperand() method, and changing operator*() of the operand-walker to return a MachineOperand&. At that point, it should be possible to add range views for them that work as one might expect. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203757 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix formatting introduced in r200941David Blaikie2014-02-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201043 91177308-0d34-0410-b5e6-96231b3b80d8
* Track register pressure a bit more carefully (weird corner case).Andrew Trick2014-02-06
| | | | | | | | | | | | | | | | This solves a problem where a def machine operand has no uses but has not been marked dead. In this case, the initial RP analysis was being extra precise and determining from LiveIntervals the the register was actually dead. This caused us to omit the register from the RP tracker's block live out. That's all good, but the per-instruction summary still accounted for it as a valid def. This could cause an assertion in the tracker later when we underflow pressure. This is from a bug report on an out-of-tree target. It is not reproducible on well-behaved targets. I'm just making an obvious fix without unit test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200941 91177308-0d34-0410-b5e6-96231b3b80d8
* increase the accuracy of register pressure computation in the presence of ↵Pedro Artigas2013-11-08
| | | | | | dead definitions by using live intervals, if available, to identify dead definitions and proceed accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194286 91177308-0d34-0410-b5e6-96231b3b80d8
* Represent RegUnit liveness with LiveRange instanceMatthias Braun2013-10-10
| | | | | | | Previously LiveInterval has been used, but having a spill weight and register number is unnecessary for a register unit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192397 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass LiveQueryResult by valueMatthias Braun2013-10-10
| | | | | | | This makes the API a bit more natural to use and makes it easier to make LiveRanges implementation details private. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192394 91177308-0d34-0410-b5e6-96231b3b80d8
* Added -misched-regpressure option.Andrew Trick2013-09-04
| | | | | | | | Register pressure tracking is half the complexity of the scheduler. It's useful to be able to turn it off for compile time and performance comparisons. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189987 91177308-0d34-0410-b5e6-96231b3b80d8
* Use LiveRangeQuery for instruction-level liveness queries.Andrew Trick2013-08-30
| | | | | | Remove redundant or bug-prone LiveInterval APIs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189685 91177308-0d34-0410-b5e6-96231b3b80d8
* mi-sched: update PressureDiffs on-the-fly for liveness.Andrew Trick2013-08-30
| | | | | | | This removes all expensive pressure tracking logic from the scheduling critical path of node comparison. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189643 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace LiveInterval::killedAt with isKilledAtInstr.Andrew Trick2013-08-30
| | | | | | Return true for LRGs that end at EarlyClobber or Register slots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189642 91177308-0d34-0410-b5e6-96231b3b80d8
* mi-sched: Precompute a PressureDiff for each instruction, adjust for ↵Andrew Trick2013-08-30
| | | | | | | | | | | | | liveness later. Created SUPressureDiffs array to hold the per node PDiff computed during DAG building. Added a getUpwardPressureDelta API that will soon replace the old one. Compute PressureDelta here from the precomputed PressureDiffs. Updating for liveness will come next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189640 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename to RegPressure API parameters RegUnits.Andrew Trick2013-08-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189123 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify RegPressure helpers.Andrew Trick2013-08-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189122 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a convenient PSetIterator for visiting pressure sets affected by a register.Andrew Trick2013-08-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189121 91177308-0d34-0410-b5e6-96231b3b80d8
* MI Sched: Track live-thru registers.Andrew Trick2013-07-30
| | | | | | | | | | | When registers must be live throughout the scheduling region, increase the limit for the register class. Once we exceed the original limit, they will be spilled, and there's no point further reducing pressure. This isn't a perfect heuristics but avoids a situation where the scheduler could become trapped by trying to achieve the impossible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187436 91177308-0d34-0410-b5e6-96231b3b80d8
* MI Sched: track register pressure by importance of the set, not weight of ↵Andrew Trick2013-07-25
| | | | | | the units. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187109 91177308-0d34-0410-b5e6-96231b3b80d8
* MI-Sched: Adjust regpressure limits for reserved regs.Andrew Trick2013-06-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184564 91177308-0d34-0410-b5e6-96231b3b80d8
* MI Sched: fix a typo in RegPressure heuristics.Andrew Trick2013-06-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184131 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace erase loop with std::remove_if.Benjamin Kramer2013-02-16
| | | | | | This avoids unnecessary copies. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175367 91177308-0d34-0410-b5e6-96231b3b80d8
* RegPressureTracker::dump(): Remove unnecessary argument.Andrew Trick2012-12-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169443 91177308-0d34-0410-b5e6-96231b3b80d8
* RegisterPressureTracker: fix findUseBetween to handle DebugValueAndrew Trick2012-12-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169427 91177308-0d34-0410-b5e6-96231b3b80d8
* RegisterPressureTracker: unify virtual registers and physical regunits.Andrew Trick2012-12-05
| | | | | | Now that live register units are tracked individually, the code can be simplified. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169426 91177308-0d34-0410-b5e6-96231b3b80d8
* RegisterPresssureTracker: Track live physical register by unit.Andrew Trick2012-12-05
| | | | | | | | This is much simpler to reason about, more efficient, and fixes some corner cases involving implicit super-register defs. Fixed rdar://12797931. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169425 91177308-0d34-0410-b5e6-96231b3b80d8
* Added RegisterPressureTracker::dump() for debugging.Andrew Trick2012-12-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169359 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* misched: Fix RegisterPressureTracker handling of DebugVals.Andrew Trick2012-12-01
| | | | | | | Assertion failed: (TopRPTracker.getPos() == RegionBegin && "bad initial Top tracker"). rdar://12790302. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169072 91177308-0d34-0410-b5e6-96231b3b80d8
* misched: handle on-the-fly regpressure queries better for 2-addrAndrew Trick2012-11-07
| | | | | | instructions without relying on liveintervals. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167526 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove RegisterClassInfo::isReserved() and isAllocatable().Jakob Stoklund Olesen2012-10-15
| | | | | | Clients can use the equivalent functions in MRI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165990 91177308-0d34-0410-b5e6-96231b3b80d8
* Release build: guard dump functions withManman Ren2012-09-11
| | | | | | | | | "#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)" No functional change. Update r163339. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163653 91177308-0d34-0410-b5e6-96231b3b80d8
* Release build: guard dump functions with "ifndef NDEBUG"Manman Ren2012-09-06
| | | | | | | No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163339 91177308-0d34-0410-b5e6-96231b3b80d8
* misched: When querying RegisterPressureTracker, always save current and max ↵Andrew Trick2012-06-11
| | | | | | pressure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158340 91177308-0d34-0410-b5e6-96231b3b80d8
* misched: regpressure getMaxPressureDelta, revert accidental checkin.Andrew Trick2012-06-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158339 91177308-0d34-0410-b5e6-96231b3b80d8
* Register pressure: added getPressureAfterInstr.Andrew Trick2012-06-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158256 91177308-0d34-0410-b5e6-96231b3b80d8
* Move RegisterClassInfo.h.Andrew Trick2012-06-06
| | | | | | | Allow targets to access this API. It's required for RegisterPressure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158102 91177308-0d34-0410-b5e6-96231b3b80d8
* Move RegisterPressure.h.Andrew Trick2012-06-06
| | | | | | | Make it a general utility for use by Targets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158097 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch all register list clients to the new MC*Iterator interface.Jakob Stoklund Olesen2012-06-01
| | | | | | | | | | | | | No functional change intended. Sorry for the churn. The iterator classes are supposed to help avoid giant commits like this one in the future. The TableGen-produced register lists are getting quite large, and it may be necessary to change the table representation. This makes it possible to do so without changing all clients (again). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157854 91177308-0d34-0410-b5e6-96231b3b80d8
* regpressure: Added RegisterPressure::dumpAndrew Trick2012-05-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157423 91177308-0d34-0410-b5e6-96231b3b80d8
* regpressure: physreg livein/out fixAndrew Trick2012-05-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157422 91177308-0d34-0410-b5e6-96231b3b80d8
* misched: Added 3-level regpressure back-off.Andrew Trick2012-05-17
| | | | | | | | | | | | | | | | | | | Introduce the basic strategy for register pressure scheduling. 1) Respect target limits at all times. 2) Indentify critical register classes (pressure sets). Track pressure within the scheduled region. Avoid increasing scheduled pressure for critical registers. 3) Avoid exceeding the max pressure of the region prior to scheduling. Added logic for picking between the top and bottom ready Q's based on regpressure heuristics. Status: functional but needs to be asjusted to achieve good results. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157006 91177308-0d34-0410-b5e6-96231b3b80d8
* commentAndrew Trick2012-05-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157005 91177308-0d34-0410-b5e6-96231b3b80d8
* regpressure: Fix getMaxUpwardPressureDelta.Andrew Trick2012-05-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157004 91177308-0d34-0410-b5e6-96231b3b80d8
* whitespaceAndrew Trick2012-05-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157002 91177308-0d34-0410-b5e6-96231b3b80d8
* misched: Introducing Top and Bottom register pressure trackers during ↵Andrew Trick2012-05-10
| | | | | | scheduling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156571 91177308-0d34-0410-b5e6-96231b3b80d8
* RegPressure: API for speculatively checking instruction pressure.Andrew Trick2012-05-10
| | | | | | | | | Added getMaxExcessUpward/DownwardPressure. They somewhat abuse the tracker by speculatively handling an instruction out of order. But it is convenient for now. In the future, we will cache each instruction's pressure contribution to make this efficient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156561 91177308-0d34-0410-b5e6-96231b3b80d8
* RegPressure: fix array index iteration style.Andrew Trick2012-05-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156560 91177308-0d34-0410-b5e6-96231b3b80d8
* RegisterPressure: ArrayRefize some functions for better readability. No ↵Benjamin Kramer2012-04-29
| | | | | | functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155795 91177308-0d34-0410-b5e6-96231b3b80d8
* RegisterPressure: A utility for computing register pressure within aAndrew Trick2012-04-24
MachineInstr sequence. This uses the new target interface for tracking register pressure using pressure sets to model overlapping register classes and subregisters. RegisterPressure results can be tracked incrementally or stored at region boundaries. Global register pressure can be deduced from local RegisterPressure results if desired. This is an early, somewhat untested implementation. I'm working on testing it within the context of a register pressure reducing MachineScheduler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155454 91177308-0d34-0410-b5e6-96231b3b80d8