1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

283 Commits

Author SHA1 Message Date
Matthias Braun
d748ed9399 TableGen: Generate more const goodness
llvm-svn: 233857
2015-04-01 22:09:55 +00:00
Matthias Braun
ce2b6491f0 RegAllocGreedy: Allow target to specify register class ordering.
Specify an allocation order with a register class. This is used by register
allocators with a greedy heuristic. This is usefull as it is sometimes
beneficial to color more constrained classes first.

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

llvm-svn: 233743
2015-03-31 19:57:53 +00:00
Matthias Braun
7aa4f3c5ea Do not track subregister liveness when it brings no benefits
Some subregisters are only to indicate different access sizes, while not
providing any way to actually divide the register up into multiple
disjunct parts. Avoid tracking subregister liveness in these cases as it
is not beneficial.

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

llvm-svn: 232695
2015-03-19 00:21:58 +00:00
Eric Christopher
2925153548 Have getRegPressureSetLimit take a MachineFunction so that a
we can inspect the subtarget and function when computing values.

llvm-svn: 231951
2015-03-11 18:34:58 +00:00
Benjamin Kramer
c2a218b9bd TblGen: Remove copy of SmallVector::operator==. NFC intended.
llvm-svn: 230964
2015-03-02 15:24:30 +00:00
Owen Anderson
5897fb359b Switch a std::map to a DenseMap in CodeGenRegisters.
The keys of the map are unique by pointer address, so there's no need
to use the llvm::less comparator. This allows us to use DenseMap
instead, which reduces tblgen time by 20% on my stress test.

llvm-svn: 230769
2015-02-27 17:57:01 +00:00
David Blaikie
87c973c9d7 STLExtras: Provide less/equal functors with templated function call operators, plus a deref'ing functor template utility
Similar to the C++14 void specializations of these templates, useful as
a stop-gap until LLVM switches to '14.

Example use-cases in tblgen because I saw some functors that looked like
they could be simplified/refactored.

Reviewers: dexonsmith

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

llvm-svn: 227828
2015-02-02 18:35:10 +00:00
Owen Anderson
2a38e36679 Replace another std::set in the core of CodeGenRegister, this time with sorted arrays.
The hot path through this region of code does lots of batch inserts into sets. By storing them as sorted arrays, we can defer the sorting to the end of the batch, which is dramatically more efficient. This reduces tblgen runtime by 25% on my worst-case target.

llvm-svn: 227682
2015-01-31 09:13:36 +00:00
Owen Anderson
e0ceaab206 Change more of the guts of CodeGenRegister's RegUnit tracking to be based on bit vectors.
This is a continuation of my prior work to move some of the inner workings for CodeGenRegister to use bit vectors when computing about register units. This is highly beneficial to TableGen runtime on targets with large, dense register files. This patch represents a ~40% runtime reduction over and above my earlier improvement on a stress test of this case.

llvm-svn: 227678
2015-01-31 07:49:41 +00:00
Matthias Braun
154c44f060 Tablegen'erate lanemasks for register units.
Now we can relate lanemasks in a virtual register to register units.

llvm-svn: 223889
2014-12-10 01:12:56 +00:00
Matthias Braun
ab5b739bb2 Add function that translates subregister lane masks to other subregs.
This works like the composeSubRegisterIndices() function but transforms
a subregister lane mask instead of a subregister index.

llvm-svn: 223874
2014-12-10 01:12:00 +00:00
Matthias Braun
b86ee4fb38 Let tablegen compute maximum lanemask for regs/regclasses.
Let tablegen compute the combination of subregister lanemasks for all
subregisters in a register/register class. This is preparation for further
work subregister allocation

llvm-svn: 223873
2014-12-10 01:11:56 +00:00
David Blaikie
2afe696d92 Simplify ownership of RegClasses by using list<CodeGenRegisterClass> instead of vector<CodeGenRegisterClass*>
This complicates a few algorithms due to not having random access, but
not by a huge degree I don't think (open to debate/design
discussion/etc).

llvm-svn: 223261
2014-12-03 19:58:45 +00:00
David Blaikie
afd7d9143a Range-for some stuff related to RegClasses, and comment cases where range-for isn't suitable.
llvm-svn: 223260
2014-12-03 19:58:41 +00:00
David Blaikie
f94c9b7b2c Remove indirection of vector<T*> in favor of deque<T>
llvm-svn: 222958
2014-11-29 18:13:39 +00:00
David Blaikie
76b89029d3 Use deque<T> rather than vector<T*> since it provides the same invalidation semantics (at least when removal is not needed) without the extra indirection/ownership complexity
Order matters for this container, it seems (using a forward_list and
replacing the original push_backs with emplace_fronts caused test
failures). I didn't look too deeply into why.

(& in retrospect, I might go back & change some of the forward_lists I
introduced to deques anyway - since most don't require removal, deque is
a more memory-friendly data structure (moderate locality while not
invalidating pointers))

llvm-svn: 222950
2014-11-29 07:04:51 +00:00
David Blaikie
5fe3d4e324 Constify some things in preparation for CodeGenSubRegIndex to be stored by value in their container, removing the indirection
llvm-svn: 222949
2014-11-29 07:04:49 +00:00
Craig Topper
9b0aeb935e Reduce size of some tables in tablegen register info output.
Primarily done by using SequenceToOffsetTable to reduce the register pressure set tables and then sizing the indices into the tables appropriately. Size a few other table entries based on content as well. Reduces X86RegisterInfo.o by ~9k.

llvm-svn: 222621
2014-11-22 18:30:18 +00:00
Craig Topper
b487f2dfc6 Add extra new line and remove some trailing whitespace from tablegen RegisterInfo output file.
llvm-svn: 222508
2014-11-21 05:58:14 +00:00
Craig Topper
65bda63c2e Remove unnecessary extra spaces from tablegen register info output.
llvm-svn: 222411
2014-11-20 05:22:35 +00:00
Craig Topper
ca7045d052 Use array_lengthof instead of sizeof(array)/sizeof(element) in a tablegen output.
llvm-svn: 222410
2014-11-20 05:22:32 +00:00
Craig Topper
5b6e56da60 Move register class name strings to a single array in MCRegisterInfo to reduce static table size and number of relocation entries.
Indices into the table are stored in each MCRegisterClass instead of a pointer. A new method, getRegClassName, is added to MCRegisterInfo and TargetRegisterInfo to lookup the string in the table.

llvm-svn: 222118
2014-11-17 05:50:14 +00:00
Craig Topper
c6ae7d76d7 [C++11] Use 'nullptr' in tablegen output files.
llvm-svn: 207611
2014-04-30 05:53:35 +00:00
Craig Topper
694437e2ef Make consistent use of MCPhysReg instead of uint16_t throughout the tree.
llvm-svn: 205610
2014-04-04 05:16:06 +00:00
Craig Topper
465f748cb7 [C++11] Add 'override' keyword to virtual methods that override their base class.
llvm-svn: 203378
2014-03-09 07:44:38 +00:00
Craig Topper
3ce461ca66 Fix indentation.
llvm-svn: 202344
2014-02-27 03:30:36 +00:00
Benjamin Kramer
b6950f09cc Replace some unnecessary vector copies with references.
llvm-svn: 190770
2013-09-15 22:04:42 +00:00
Benjamin Kramer
4182059208 llvm-tblgen: Stabilize subreg index tables.
Otherwise SequenceToOffsetTable will sort by pointer and becomes non-deterministic.

llvm-svn: 190514
2013-09-11 11:22:26 +00:00
Jakob Stoklund Olesen
af78d7a3df Add an OtherPreserved field to the CalleeSaved TableGen class.
This field specifies registers that are preserved across function calls,
but that should not be included in the generates SaveList array.

This can be used ot generate regmasks for architectures that save
registers through other means, like SPARC's register windows.

llvm-svn: 189084
2013-08-23 02:25:47 +00:00
Aaron Ballman
aedb990ba6 Using a different loop induction variable than the enclosing scope. No functional changes intended.
llvm-svn: 187159
2013-07-25 22:09:31 +00:00
Andrew Trick
a33731be51 RegPressure: Order the "pressure sets" by number of regunits per set.
This lets heuristics easily pick the most important set to follow.

llvm-svn: 187108
2013-07-25 07:26:29 +00:00
Chad Rosier
1ce13129c7 Improve the compression of the tablegen DiffLists by introducing a new sort
algorithm when assigning EnumValues to the synthesized registers.

The current algorithm, LessRecord, uses the StringRef compare_numeric
function.  This function compares strings, while handling embedded numbers.
For example, the R600 backend registers are sorted as follows:

  T1
  T1_W
  T1_X
  T1_XYZW
  T1_Y
  T1_Z
  T2
  T2_W
  T2_X
  T2_XYZW
  T2_Y
  T2_Z

In this example, the 'scaling factor' is dEnum/dN = 6 because T0, T1, T2
have an EnumValue offset of 6 from one another.  However, in other parts
of the register bank, the scaling factors are different:

dEnum/dN = 5:
  KC0_128_W
  KC0_128_X
  KC0_128_XYZW
  KC0_128_Y
  KC0_128_Z
  KC0_129_W
  KC0_129_X
  KC0_129_XYZW
  KC0_129_Y
  KC0_129_Z

The diff lists do not work correctly because different kinds of registers have
different 'scaling factors'.  This new algorithm, LessRecordRegister, tries to
enforce a scaling factor of 1.  For example, the registers are now sorted as
follows:

  T1
  T2
  T3
  ...
  T0_W
  T1_W
  T2_W
  ...
  T0_X
  T1_X
  T2_X
  ...
  KC0_128_W
  KC0_129_W
  KC0_130_W
  ...

For the Mips and R600 I see a 19% and 6% reduction in size, respectively.  I
did see a few small regressions, but the differences were on the order of a
few bytes (e.g., AArch64 was 16 bytes).  I suspect there will be even
greater wins for targets with larger register files.

Patch reviewed by Jakob.
rdar://14006013

llvm-svn: 185094
2013-06-27 19:38:13 +00:00
Jakub Staszak
fe013a66d3 Remove unimplemented definition. Found using [-Wunused-member-function].
llvm-svn: 183426
2013-06-06 17:52:45 +00:00
Ahmed Bougacha
2263547c8f Make SubRegIndex size mandatory, following r183020.
This also makes TableGen able to compute sizes/offsets of synthesized
indices representing tuples.

llvm-svn: 183061
2013-05-31 23:45:26 +00:00
Ahmed Bougacha
5df932894e Add a way to define the bit range covered by a SubRegIndex.
NOTE: If this broke your out-of-tree backend, in *RegisterInfo.td, change
the instances of SubRegIndex that have a comps template arg to use the
ComposedSubRegIndex class instead.

In TableGen land, this adds Size and Offset attributes to SubRegIndex,
and the ComposedSubRegIndex class, for which the Size and Offset are
computed by TableGen. This also adds an accessor in MCRegisterInfo, and
Size/Offsets for the X86 and ARM subreg indices.

llvm-svn: 183020
2013-05-31 17:08:36 +00:00
Chad Rosier
40d29a8a9d Remove the MCRegAliasIterator tables and compute the aliases dynamically.
The size reduction in the RegDiffLists are rather dramatic.  Here are a few
size differences for MCTargetDesc.o files (before and after) in bytes:
R600 - 36160B - 11184B - 69% reduction
ARM - 28480B - 8368B - 71% reduction
Mips - 816B - 576B - 29% reduction

One side effect of dynamically computing the aliases is that the iterator does
not guarantee that the entries are ordered or that duplicates have been removed.
The documentation implies this is a safe assumption and I found no clients that
requires these attributes (i.e., strict ordering and uniqueness).

My local LNT tester results showed no execution-time failures or significant
compile-time regressions (i.e., beyond what I would consider noise) for -O0g,
-O2 and -O3 runs on x86_64 and i386 configurations.
rdar://12906217

llvm-svn: 182783
2013-05-28 18:08:48 +00:00
Jakob Stoklund Olesen
4d48e01000 Add TargetRegisterInfo::getCoveringLanes().
This lane mask provides information about which register lanes
completely cover super-registers. See the block comment before
getCoveringLanes().

llvm-svn: 182034
2013-05-16 18:03:08 +00:00
Jakob Stoklund Olesen
b984ca6d18 Use ArrayRef<MVT::SimpleValueType> when possible.
Not passing vector references around makes it possible to use
SmallVector in most places.

llvm-svn: 177235
2013-03-17 17:26:09 +00:00
Jim Grosbach
431f84fb2f MC: Add MCInstrDesc::mayAffectControlFlow() method.
MC disassembler clients (LLDB) are interested in querying if an
instruction may affect control flow other than by virtue of being
an explicit branch instruction. For example, instructions which
write directly to the PC on some architectures.

llvm-svn: 170610
2012-12-19 23:38:53 +00:00
Andrew Trick
67c084b14c 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
193523c593 RegisterPressure API. Add support for physical register units.
At build-time register pressure was always computed in terms of
register units. But the compile-time API was expressed in terms of
register classes because it was intended for virtual registers (and
physical register units weren't yet used anywhere in codegen).

Now that the codegen uses physreg units consistently, prepare for
tracking register pressure also in terms of live units, not live
registers.

llvm-svn: 169360
2012-12-05 06:47:12 +00:00
Jakob Stoklund Olesen
7cbcf348ea Add an MCPhysReg typedef to replace naked uint16_t.
Use this type for arrays of physical registers.

llvm-svn: 168850
2012-11-29 02:39:28 +00:00
Jakob Stoklund Olesen
4498c89d5f Generate a table-driven version of TRI::composeSubRegIndices().
Explicitly allow composition of null sub-register indices, and handle
that common case in an inlinable stub.

Use a compressed table implementation instead of the previous nested
switches which generated pretty bad code.

llvm-svn: 167190
2012-11-01 00:32:10 +00:00
Joerg Sonnenberger
839f6c1a88 Remove exception handling usage from tblgen.
Most places can use PrintFatalError as the unwinding mechanism was not
used for anything other than printing the error. The single exception
was CodeGenDAGPatterns.cpp, where intermediate errors during type
resolution were ignored to simplify incremental platform development.
This use is replaced by an error flag in TreePattern and bailout earlier
in various places if it is set. 

llvm-svn: 166712
2012-10-25 20:33:17 +00:00
Sean Silva
cbe79850e7 tblgen: Use semantically correct RTTI functions.
Also, some minor cleanup.

llvm-svn: 165647
2012-10-10 20:24:47 +00:00
Sean Silva
a6a1c05042 tblgen: Mechanically move dynamic_cast<> to dyn_cast<>.
Some of these dyn_cast<>'s would be better phrased as isa<> or cast<>.
That will happen in a future patch.

There are also two dyn_cast_or_null<>'s slipped in instead of
dyn_cast<>'s, since they were causing crashes with just dyn_cast<>.

llvm-svn: 165646
2012-10-10 20:24:43 +00:00
Craig Topper
f3580aa31e Add 'virtual' keywoards to output file for overridden functions.
llvm-svn: 163999
2012-09-16 16:35:22 +00:00
Jakob Stoklund Olesen
8a149baa44 Add TRI::getSubRegIndexLaneMask().
Sub-register lane masks are bitmasks that can be used to determine if
two sub-registers of a virtual register will overlap. For example, ARM's
ssub0 and ssub1 sub-register indices don't overlap each other, but both
overlap dsub0 and qsub0.

The lane masks will be accurate on most targets, but on targets that use
sub-register indexes in an irregular way, the masks may conservatively
report that two sub-register indices overlap when the eventually
allocated physregs don't.

Irregular register banks also mean that the bits in a lane mask can't be
mapped onto register units, but the concept is similar.

llvm-svn: 163630
2012-09-11 16:34:08 +00:00
Jakob Stoklund Olesen
d2bb5cf28e Clean the sub-reg index composition maps at emission.
Preserve the Composites map in the CodeGenSubRegIndex class so it can be
used to determine which sub-register indices can actually be composed.

llvm-svn: 163629
2012-09-11 16:34:05 +00:00
Jakob Stoklund Olesen
1e7f74aaa8 Add MCRI::getNumSubRegIndices() and start checking SubRegIndex ranges.
Apparently, NumSubRegIndices was completely unused before. Adjust it by
one to include the null subreg index, just like getNumRegs() includes
the null register.

llvm-svn: 163628
2012-09-11 16:34:02 +00:00