1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

78 Commits

Author SHA1 Message Date
Matthias Braun
3f5b3cdbf1 MachineScheduler: Allow independent scheduling of sub register defs
Note that this is disabled by default and still requires a patch to
handleMove() which is not upstreamed yet.

If the TrackLaneMasks policy/strategy is enabled the MachineScheduler
will build a schedule graph where definitions of independent
subregisters are no longer serialised.

Implementation comments:
- Without lane mask tracking a sub register def also counts as a use
  (except for the first one with the read-undef flag set), with lane
  mask tracking enabled this is no longer the case.
- Pressure Diffs where previously maintained per definition of a
  vreg with the help of the SSA information contained in the
  LiveIntervals.  With lanemask tracking enabled we cannot do this
  anymore and instead change the pressure diffs for all uses of the vreg
  as it becomes live/dead.  For this changed style to work correctly we
  ignore uses of instructions that define the same register again: They
  won't affect register pressure.
- With lanemask tracking we remove all read-undef flags from
  sub register defs when building the graph and re-add them later when
  all vreg lanes have become dead.

Differential Revision: http://reviews.llvm.org/D14969

llvm-svn: 258259
2016-01-20 00:23:32 +00:00
Matthias Braun
895450b36f RegisterPressure: Make liveness tracking subregister aware
Differential Revision: http://reviews.llvm.org/D14968

llvm-svn: 258258
2016-01-20 00:23:26 +00:00
Matthias Braun
b910f14b0f RegisterPressure: Expose RegisterOperands API
Previously the RegisterOperands have only been used internally in
RegisterPressure.cpp. However this datastructure can be useful for other
tasks as well and allows refactoring of PDiff initialisation out of
RPTracker::recede().

This patch:
- Exposes RegisterOperands as public API
- Splits RPTracker::recede() into a part that skips DebugValues and
  maintains the region borders, and the core that changes register
  pressure when given a set of RegisterOperands.
- This allows to move the PDiff initialisation out recede() into a
  method of the PressureDiffs class.
- The upcoming subregister scheduling code will also use
  RegisterOperands to avoid pushing more unrelated functionality into
  recede()/advance().

Differential Revision: http://reviews.llvm.org/D15473

llvm-svn: 257535
2016-01-12 22:57:35 +00:00
Sanjay Patel
4d1db6266a use std::max ; NFCI
llvm-svn: 256889
2016-01-06 00:36:59 +00:00
Matthias Braun
c65dd31462 RegisterPressure: Factor out liveness dead-def detection logic; NFCI
Detecting additional dead-defs without a dead flag that are only visible
through liveness information should be part of the register operand
collection not intertwined with the register pressure update logic.

llvm-svn: 255192
2015-12-10 01:04:15 +00:00
Matthias Braun
0caa941027 RegisterPressure: Use range based for, fix else style; NFC
llvm-svn: 254575
2015-12-03 01:44:45 +00:00
Matthias Braun
2fea00ef75 RegisterPressure: If we do not collect dead defs the list must be empty
llvm-svn: 254372
2015-12-01 04:20:06 +00:00
Matthias Braun
c3639e325e RegisterPressure: Remove support for recede()/advance() at MBB boundaries
Nobody was checking the returnvalue of recede()/advance() so we can
simply replace this code with asserts.

llvm-svn: 254371
2015-12-01 04:20:04 +00:00
Matthias Braun
69a0b24459 RegisterPressure: Split RegisterOperands analysis code from result object; NFC
This is in preparation to expose the RegisterOperands class as
RegisterPressure API.

llvm-svn: 254368
2015-12-01 04:19:56 +00:00
Matthias Braun
3795aef91e RegisterPressure: Improve assert message
llvm-svn: 251885
2015-11-03 01:53:36 +00:00
Matthias Braun
6a0bab40ee RegisterPressure: Slightly nicer pressure diff dumping
llvm-svn: 251884
2015-11-03 01:53:33 +00:00
Matthias Braun
c2e8632c14 Revert "RegisterPressure: allocatable physreg uses are always kills"
This reverts commit r250596.

Reverted for now as the commit triggers assert in the AMDGPU target
pending investigation.

llvm-svn: 250713
2015-10-19 17:44:22 +00:00
Matthias Braun
3b9509b65c RegisterPressure: Unify the sparse sets in LiveRegsSet; NFC
Also do some cleanups comment improvements.

llvm-svn: 250598
2015-10-17 01:03:44 +00:00
Matthias Braun
894abcd9d3 RegisterPressure: allocatable physreg uses are always kills
This property was already used in the code path when no liveness
intervals are present. Unfortunately the code path that uses liveness
intervals tried to query a cached live interval for an allocatable
physreg, those are usually not computed so a conservative default was
used.

This doesn't affect any of the lit testcases. This is a foreclosure to
upcoming changes which should be NFC but without this patch this tidbit
wouldn't be NFC.

llvm-svn: 250596
2015-10-17 00:46:57 +00:00
Matthias Braun
24b9e3b760 RegisterPressure: Remove 0 entries from PressureChange
This should not change behaviour because as far as I can see all code
reading the pressure changes has no effect if the PressureInc is 0.
Removing these entries however does avoid unnecessary computation, and
results in a more stable debug output. I want the stable debug output to
check that some upcoming changes are indeed NFC and identical even at
the debug output level.

llvm-svn: 250595
2015-10-17 00:35:59 +00:00
Matthias Braun
cfaf06e08d RegisterPressure: Hide non-const iterators of PressureDiff
It is too easy to accidentally violate the ordering requirements when
modifying the PressureDiff entries through iterators.

llvm-svn: 250590
2015-10-17 00:08:48 +00:00
Matthias Braun
77ae40c1ea RegisterPressure: Use range based for, cleanup
llvm-svn: 250579
2015-10-16 23:25:09 +00:00
Matthias Braun
abeceb1d68 RegisterPressure: LiveRegSet tracks register units not physregs
There are always more physical registers and register units so the
previous behaviour was correct but we can do with less memory.

llvm-svn: 248767
2015-09-29 00:20:32 +00:00
Matthias Braun
0bcec09bcb Revert "(HEAD -> master, origin/master, origin/HEAD) RegisterPressure: Move LiveInRegs/LiveOutRegs from RegisterPressure to PressureTracker"
This reverts commit r247943.

Accidental commit, code review was not finished yet.

llvm-svn: 247945
2015-09-17 21:12:24 +00:00
Matthias Braun
dfb016bb79 RegisterPressure: Move LiveInRegs/LiveOutRegs from RegisterPressure to PressureTracker
Differential Revision: http://reviews.llvm.org/D12814

llvm-svn: 247943
2015-09-17 21:10:06 +00:00
Matthias Braun
a06e26ee63 RegisterPressure: Simplify close{Top|Bottom}()
- There are no duplicate registers in LiveRegs list we are copying from
  and so we do not need to sort the registers.
- Simply use SmallVector::apend instead of a loop between begin() and end()
  with push_back().

Differential Revision: http://reviews.llvm.org/D12813

llvm-svn: 247588
2015-09-14 18:24:15 +00:00
Benjamin Kramer
69a3fdb314 Fix some comment typos.
llvm-svn: 244402
2015-08-08 18:27:36 +00:00
Matthias Braun
08e0b80601 RegisterPressure: Add PressureDiff::dump()
Also display the pressure diff in the case of a
getMaxUpwardPressureDelta() verify failure.

llvm-svn: 241759
2015-07-08 23:40:27 +00:00
Fiona Glaser
2f28b93375 RegisterPressure: fix debug prints in case of physical registers
llvm-svn: 238371
2015-05-27 22:51:47 +00:00
Andrew Trick
7604c704ed RegisterPressureTracker: reword stale comments.
llvm-svn: 237544
2015-05-17 23:40:27 +00:00
Benjamin Kramer
d52ec1c0ec Move private classes into anonymous namespaces
NFC.

llvm-svn: 232944
2015-03-23 12:30:58 +00:00
Eric Christopher
45581b7332 Remove unnecessary TargetMachine.h includes.
llvm-svn: 219672
2014-10-14 07:22:08 +00:00
Eric Christopher
67c04e77e5 Have MachineFunction cache a pointer to the subtarget to make lookups
shorter/easier and have the DAG use that to do the same lookup. This
can be used in the future for TargetMachine based caching lookups from
the MachineFunction easily.

Update the MIPS subtarget switching machinery to update this pointer
at the same time it runs.

llvm-svn: 214838
2014-08-05 02:39:49 +00:00
Eric Christopher
99307e99a2 Remove the TargetMachine forwards for TargetSubtargetInfo based
information and update all callers. No functional change.

llvm-svn: 214781
2014-08-04 21:25:23 +00:00
Alp Toker
62b822cb61 Move remaining LLVM_ENABLE_DUMP conditionals out of the headers
This macro is sometimes defined manually but isn't (and doesn't need to be) in
llvm-config.h so shouldn't appear in the headers, likewise NDEBUG.

Instead switch them over to LLVM_DUMP_METHOD on the definitions.

llvm-svn: 212130
2014-07-01 21:19:13 +00:00
Craig Topper
30281a67fb [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr.
llvm-svn: 206142
2014-04-14 00:51:57 +00:00
Owen Anderson
a7267c04e5 Phase 1 of refactoring the MachineRegisterInfo iterators to make them suitable
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.

llvm-svn: 203757
2014-03-13 06:02:25 +00:00
David Blaikie
3070639d19 Fix formatting introduced in r200941
llvm-svn: 201043
2014-02-09 09:49:29 +00:00
Andrew Trick
d55a2c9f7e Track register pressure a bit more carefully (weird corner case).
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.

llvm-svn: 200941
2014-02-06 19:20:41 +00:00
Pedro Artigas
295bb9b63d increase the accuracy of register pressure computation in the presence of dead definitions by using live intervals, if available, to identify dead definitions and proceed accordingly.
llvm-svn: 194286
2013-11-08 22:46:28 +00:00
Matthias Braun
cf84f537f1 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
0fcc48eb53 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
cf575d4815 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
0d5cff0ac7 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
eeff73274d 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
b4ac7bbefa 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
3c849ec211 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
0425a74235 Rename to RegPressure API parameters RegUnits.
llvm-svn: 189123
2013-08-23 17:48:51 +00:00
Andrew Trick
da492502a4 Simplify RegPressure helpers.
llvm-svn: 189122
2013-08-23 17:48:48 +00:00
Andrew Trick
7e77ff64a2 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
bdb01cf4bd 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
ec6d86375b 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
2436517fbd MI-Sched: Adjust regpressure limits for reserved regs.
llvm-svn: 184564
2013-06-21 18:32:58 +00:00
Andrew Trick
94506beb69 MI Sched: fix a typo in RegPressure heuristics.
llvm-svn: 184131
2013-06-17 21:45:09 +00:00
Benjamin Kramer
9422029a3b 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