Commit Graph

43 Commits

Author SHA1 Message Date
Matthias Braun 34e1be9451 Represent RegUnit liveness with LiveRange instance
Previously LiveInterval has been used, but having a spill weight and
register number is unnecessary for a register unit.

llvm-svn: 192397
2013-10-10 21:29:02 +00:00
Matthias Braun 88dd0abd2d Pass LiveQueryResult by value
This makes the API a bit more natural to use and makes it easier to make
LiveRanges implementation details private.

llvm-svn: 192394
2013-10-10 21:28:52 +00:00
Andrew Trick b6e74712b6 Added -misched-regpressure option.
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.

llvm-svn: 189987
2013-09-04 20:59:59 +00:00
Andrew Trick 3bf33075ce Use LiveRangeQuery for instruction-level liveness queries.
Remove redundant or bug-prone LiveInterval APIs.

llvm-svn: 189685
2013-08-30 17:58:49 +00:00
Andrew Trick 2bc74c2887 mi-sched: update PressureDiffs on-the-fly for liveness.
This removes all expensive pressure tracking logic from the scheduling
critical path of node comparison.

llvm-svn: 189643
2013-08-30 04:36:57 +00:00
Andrew Trick ff60477306 Replace LiveInterval::killedAt with isKilledAtInstr.
Return true for LRGs that end at EarlyClobber or Register slots.

llvm-svn: 189642
2013-08-30 04:31:01 +00:00
Andrew Trick 1a8313458f mi-sched: Precompute a PressureDiff for each instruction, adjust for 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.

llvm-svn: 189640
2013-08-30 03:49:48 +00:00
Andrew Trick e4c1ba762d Rename to RegPressure API parameters RegUnits.
llvm-svn: 189123
2013-08-23 17:48:51 +00:00
Andrew Trick 01bc216482 Simplify RegPressure helpers.
llvm-svn: 189122
2013-08-23 17:48:48 +00:00
Andrew Trick 86a7061e5d Add a convenient PSetIterator for visiting pressure sets affected by a register.
llvm-svn: 189121
2013-08-23 17:48:46 +00:00
Andrew Trick 9c17eab761 MI Sched: Track live-thru registers.
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.

llvm-svn: 187436
2013-07-30 19:59:12 +00:00
Andrew Trick 27e5fea665 MI Sched: track register pressure by importance of the set, not weight of the units.
llvm-svn: 187109
2013-07-25 07:26:32 +00:00
Andrew Trick 736dd9a255 MI-Sched: Adjust regpressure limits for reserved regs.
llvm-svn: 184564
2013-06-21 18:32:58 +00:00
Andrew Trick d31db4b45d MI Sched: fix a typo in RegPressure heuristics.
llvm-svn: 184131
2013-06-17 21:45:09 +00:00
Benjamin Kramer ae526d106a Replace erase loop with std::remove_if.
This avoids unnecessary copies. No functionality change.

llvm-svn: 175367
2013-02-16 17:06:38 +00:00
Andrew Trick d3226eee03 RegPressureTracker::dump(): Remove unnecessary argument.
llvm-svn: 169443
2012-12-05 23:05:22 +00:00
Andrew Trick fda7a8832d RegisterPressureTracker: fix findUseBetween to handle DebugValue
llvm-svn: 169427
2012-12-05 21:37:50 +00:00
Andrew Trick 7bbcad7bcd RegisterPressureTracker: unify virtual registers and physical regunits.
Now that live register units are tracked individually, the code can be simplified.

llvm-svn: 169426
2012-12-05 21:37:47 +00:00
Andrew Trick 7f7cee39ab RegisterPresssureTracker: Track live physical register by unit.
This is much simpler to reason about, more efficient, and
fixes some corner cases involving implicit super-register defs.
Fixed rdar://12797931.

llvm-svn: 169425
2012-12-05 21:37:42 +00:00
Andrew Trick d52ab339cb Added RegisterPressureTracker::dump() for debugging.
llvm-svn: 169359
2012-12-05 06:47:08 +00:00
Chandler Carruth ed0881b2a6 Use the new script to sort the includes of every file under lib.
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. =]

llvm-svn: 169131
2012-12-03 16:50:05 +00:00
Andrew Trick b767d1eba8 misched: Fix RegisterPressureTracker handling of DebugVals.
Assertion failed: (TopRPTracker.getPos() == RegionBegin && "bad initial Top tracker").
rdar://12790302.

llvm-svn: 169072
2012-12-01 01:22:49 +00:00
Andrew Trick e145559b70 misched: handle on-the-fly regpressure queries better for 2-addr
instructions without relying on liveintervals.

llvm-svn: 167526
2012-11-07 07:05:05 +00:00
Jakob Stoklund Olesen f67bf3e0ea Remove RegisterClassInfo::isReserved() and isAllocatable().
Clients can use the equivalent functions in MRI.

llvm-svn: 165990
2012-10-15 22:41:03 +00:00
Manman Ren 19f49ac624 Release build: guard dump functions with
"#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)"

No functional change. Update r163339.

llvm-svn: 163653
2012-09-11 22:23:19 +00:00
Manman Ren 742534c4dc Release build: guard dump functions with "ifndef NDEBUG"
No functional change.

llvm-svn: 163339
2012-09-06 19:06:06 +00:00
Andrew Trick 3e465fb225 misched: When querying RegisterPressureTracker, always save current and max pressure.
llvm-svn: 158340
2012-06-11 23:42:23 +00:00
Andrew Trick d054bd833a misched: regpressure getMaxPressureDelta, revert accidental checkin.
llvm-svn: 158339
2012-06-11 23:42:20 +00:00
Andrew Trick fc8ce08be3 Register pressure: added getPressureAfterInstr.
llvm-svn: 158256
2012-06-09 02:16:58 +00:00
Andrew Trick 05ff4667eb Move RegisterClassInfo.h.
Allow targets to access this API. It's required for RegisterPressure.

llvm-svn: 158102
2012-06-06 20:29:31 +00:00
Andrew Trick 88517f608c Move RegisterPressure.h.
Make it a general utility for use by Targets.

llvm-svn: 158097
2012-06-06 19:47:35 +00:00
Jakob Stoklund Olesen 54038d796c Switch all register list clients to the new MC*Iterator interface.
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).

llvm-svn: 157854
2012-06-01 23:28:30 +00:00
Andrew Trick d5326aea81 regpressure: Added RegisterPressure::dump
llvm-svn: 157423
2012-05-24 22:10:59 +00:00
Andrew Trick b2c172e20a regpressure: physreg livein/out fix
llvm-svn: 157422
2012-05-24 22:10:57 +00:00
Andrew Trick 2202577d80 misched: Added 3-level regpressure back-off.
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.
llvm-svn: 157006
2012-05-17 18:35:10 +00:00
Andrew Trick 47a1feaea0 comment
llvm-svn: 157005
2012-05-17 18:35:07 +00:00
Andrew Trick 1c646ac68b regpressure: Fix getMaxUpwardPressureDelta.
llvm-svn: 157004
2012-05-17 18:35:05 +00:00
Andrew Trick 7d90035b0b whitespace
llvm-svn: 157002
2012-05-17 18:35:00 +00:00
Andrew Trick 4add42f439 misched: Introducing Top and Bottom register pressure trackers during scheduling.
llvm-svn: 156571
2012-05-10 21:06:10 +00:00
Andrew Trick 75812f815c RegPressure: API for speculatively checking instruction pressure.
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.

llvm-svn: 156561
2012-05-10 19:11:52 +00:00
Andrew Trick 1df762abf4 RegPressure: fix array index iteration style.
llvm-svn: 156560
2012-05-10 19:11:49 +00:00
Benjamin Kramer db25381a54 RegisterPressure: ArrayRefize some functions for better readability. No functionality change.
llvm-svn: 155795
2012-04-29 18:52:56 +00:00
Andrew Trick 3cd53a1a52 RegisterPressure: A utility for computing register pressure within a
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.

llvm-svn: 155454
2012-04-24 17:53:35 +00:00