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

145 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
77738dd84e Implement RAGreedy::splitAroundRegion and remove loop splitting.
Region splitting includes loop splitting as a subset, and it is more generic.
The splitting heuristics for variables that are live in more than one block are
now:

1. Try to create a region that covers multiple basic blocks.
2. Try to create a new live range for each block with multiple uses.
3. Spill.

Steps 2 and 3 are similar to what the standard spiller is doing.

llvm-svn: 123853
2011-01-19 22:11:48 +00:00
Jakob Stoklund Olesen
957748e7ac Teach TargetRegisterInfo how to cram stack slot indexes in with the virtual and
physical register numbers.

This makes the hack used in LiveInterval official, and lets LiveInterval be
oblivious of stack slots.

The isPhysicalRegister() and isVirtualRegister() predicates don't know about
this, so when a variable may contain a stack slot, isStackSlot() should always
be tested first.

llvm-svn: 123128
2011-01-09 21:17:37 +00:00
Jakob Stoklund Olesen
ed53ab1635 Replace TargetRegisterInfo::printReg with a PrintReg class that also works without a TRI instance.
Print virtual registers numbered from 0 instead of the arbitrary
FirstVirtualRegister. The first virtual register is printed as %vreg0.
TRI::NoRegister is printed as %noreg.

llvm-svn: 123107
2011-01-09 03:05:53 +00:00
Jakob Stoklund Olesen
86786c46c2 Use IntEqClasses to compute connected components of live intervals.
llvm-svn: 122296
2010-12-21 00:48:17 +00:00
Cameron Zwarich
6f5c1021ba Fix PR8815 by checking for an explicit clobber def tied to a use operand in
ConnectedVNInfoEqClasses::Classify().

llvm-svn: 122202
2010-12-19 22:12:45 +00:00
Jakob Stoklund Olesen
d56c4457a6 Teach ConnectedVNInfoEqClasses::Classify to deal with unused values.
We don't want unused values forming their own equivalence classes, so we lump
them all together in one class, and then merge them with the class of the last
used value.

llvm-svn: 117670
2010-10-29 17:37:29 +00:00
Jakob Stoklund Olesen
b7a4b7a7b0 Fix broken equivalence class calculation. We could probably also use
EquvivalenceClasses.h except it looks like overkill when elements are continuous
integers.

llvm-svn: 117631
2010-10-29 00:40:59 +00:00
Benjamin Kramer
e2a5f1be3b Silence compiler warning.
llvm-svn: 116156
2010-10-09 16:36:44 +00:00
Jakob Stoklund Olesen
9d127e625c Classify value numbers into connected components in linear time.
llvm-svn: 116105
2010-10-08 21:19:28 +00:00
Jakob Stoklund Olesen
1d81101e97 After splitting, the remaining LiveInterval may be fragmented into multiple
connected components. These components should be allocated different virtual
registers because there is no reason for them to be allocated together.

Add the ConnectedVNInfoEqClasses class to calculate the connected components,
and move values to new LiveIntervals.

Use it from SplitKit::rewrite by creating new virtual registers for the
components.

llvm-svn: 116006
2010-10-07 23:34:34 +00:00
Jakob Stoklund Olesen
10ef24812f Tweak VNInfo printing.
llvm-svn: 115650
2010-10-05 18:48:57 +00:00
Jakob Stoklund Olesen
4557c776f3 Add assert for valid slot indexes.
llvm-svn: 115649
2010-10-05 18:48:55 +00:00
Jakob Stoklund Olesen
cf5ec4b4cd When RemoveCopyByCommutingDef is creating additional identity copies, just use
LiveInterval::MergeValueNumberInto instead of trying to extend LiveRanges and
getting it wrong.

This fixed PR8249 where a valno with a multi-segment live range was defined by
an identity copy created by RemoveCopyByCommutingDef. Some of the live
segments disappeared.

llvm-svn: 115385
2010-10-01 23:52:25 +00:00
Lang Hames
fb22f00975 Removed VNInfo::isDefAccurate(). Def "accuracy" can be checked by testing whether LiveIntervals::getInstructionFromIndex(def) returns NULL.
llvm-svn: 114791
2010-09-25 12:04:16 +00:00
Jakob Stoklund Olesen
cb8f334578 Refix MSVC9 and upper_bound. It actually needs a fully symmetric comparator.
llvm-svn: 114469
2010-09-21 20:16:12 +00:00
Jakob Stoklund Olesen
d09d4a9693 Don't pollute the global namespace.
llvm-svn: 114459
2010-09-21 18:34:17 +00:00
Jakob Stoklund Olesen
375867aa60 MSVC9 does not support upper_bound with an asymmetric comparator.
llvm-svn: 114455
2010-09-21 18:24:30 +00:00
Jakob Stoklund Olesen
03451a0e51 Add LiveInterval::find and use it for most LiveRange searching operations
instead of calling lower_bound or upper_bound directly.

This cleans up the search logic a bit because {lower,upper}_bound compare
LR->start by default, and it is usually simpler to search LR->end.

Funnelling all searches through one function also makes it possible to replace
the search algorithm with something faster than binary search.

llvm-svn: 114448
2010-09-21 17:12:18 +00:00
Jakob Stoklund Olesen
73d2940daa Remove dead method.
llvm-svn: 114447
2010-09-21 17:12:15 +00:00
Jakob Stoklund Olesen
db1636ff8c Remove dead code.
llvm-svn: 113386
2010-09-08 18:50:24 +00:00
Jakob Stoklund Olesen
14f6dc4465 Remove dead code.
Clobber ranges are no longer used when joining physical registers.
Instead, all aliases are checked for interference.

llvm-svn: 113084
2010-09-04 21:09:33 +00:00
Jakob Stoklund Olesen
1337aa8e38 Also recompute HasPHIKill flags in LiveInterval::RenumberValues.
If a phi-def value were removed from the interval, the phi-kill flags are no
longer valid.

llvm-svn: 110949
2010-08-12 20:38:03 +00:00
Jakob Stoklund Olesen
cbb21e8c0e Remove trailing whitespace.
llvm-svn: 110944
2010-08-12 20:01:23 +00:00
Jakob Stoklund Olesen
1ab2fab3af Transpose the calculation of spill weights such that we are calculating one
register at a time. This turns out to be slightly faster than iterating over
instructions, but more importantly, it allows us to compute spill weights for
new registers created after the spill weight pass has run.

Also compute the allocation hint at the same time as the spill weight. This
allows us to use the spill weight as a cost metric for copies, and choose the
most profitable hint if there is more than one possibility.

The new hints provide a very small (< 0.1%) but universal code size improvement.

llvm-svn: 110631
2010-08-10 00:02:26 +00:00
Jakob Stoklund Olesen
a37c7509bf Add LiveInterval::RenumberValues - Garbage collection for VNInfos.
After heavy editing of a live interval, it is much easier to simply renumber the
live values instead of trying to keep track of the unused ones.

llvm-svn: 110463
2010-08-06 18:46:59 +00:00
Oscar Fuentes
4742c01c2a Prefix next' iterator operation with llvm::'.
Fixes potential ambiguity problems on VS 2010.

Patch by nobled!

llvm-svn: 110029
2010-08-02 06:00:15 +00:00
Lang Hames
998b522009 Factored out a bit of common code to mark VNInfos for deletion.
llvm-svn: 109388
2010-07-26 01:49:41 +00:00
Jakob Stoklund Olesen
04bbd415d6 Print VNInfo flags.
llvm-svn: 108277
2010-07-13 21:19:05 +00:00
Jakob Stoklund Olesen
b1bf1bcc9e Add an assertion to make PR7542 fail consistently.
LiveInterval::overlapsFrom dereferences end() if it is called on an empty
interval.

It would be reasonable to just return false - an empty interval doesn't overlap
anything, but I want to know who is doing it first.

llvm-svn: 108264
2010-07-13 19:56:28 +00:00
Jakob Stoklund Olesen
3726c5f775 Fix LiveInterval::overlaps so it doesn't claim touching intervals overlap.
Also, one binary search is enough.

llvm-svn: 108261
2010-07-13 19:42:20 +00:00
Duncan Sands
b955b3bf92 Remove initialized but otherwise unused variables.
llvm-svn: 107127
2010-06-29 11:22:26 +00:00
Jakob Stoklund Olesen
71ad56676d Don't track kills in VNInfo. Use interval ends instead.
The VNInfo.kills vector was almost unused except for all the code keeping it
updated. The few places using it were easily rewritten to check for interval
ends instead.

The two new methods LiveInterval::killedAt and killedInRange are replacements.

This brings us down to 3 independent data structures tracking kills.

llvm-svn: 106905
2010-06-25 22:53:05 +00:00
Jakob Stoklund Olesen
7e15f420d0 Make sure all eliminated kills are removed from VNInfo lists.
This fixes PR7479 and PR7485. The test cases from those PRs are big, so not
included. However, PR7485 comes from self hosting on FreeBSD, so we will surely
hear about any regression.

llvm-svn: 106811
2010-06-24 23:57:35 +00:00
Jakob Stoklund Olesen
ac7e537231 Add a few VNInfo data structure checks.
llvm-svn: 106627
2010-06-23 15:34:36 +00:00
Benjamin Kramer
4b94ce229d Introduce SpecificBumpPtrAllocator, a wrapper for BumpPtrAllocator which allows
only a single type of object to be allocated. Use it to make VNInfo destruction
typesafe.

llvm-svn: 99919
2010-03-30 20:16:45 +00:00
Daniel Dunbar
c457891855 Fix -Asserts warning.
llvm-svn: 99895
2010-03-30 17:57:42 +00:00
Torok Edwin
df7c52143e Reapply r99881 with some fixes: only call destructor in releaseMemory!
llvm-svn: 99883
2010-03-30 11:17:48 +00:00
Bob Wilson
0ec53edad3 Fix a comment typo.
llvm-svn: 93261
2010-01-12 22:18:56 +00:00
David Greene
5f0560aeb8 Change errs() to dbgs().
llvm-svn: 92528
2010-01-04 22:41:43 +00:00
Lang Hames
a5a7da896e Added a new "splitting" spiller.
When a call is placed to spill an interval this spiller will first try to
break the interval up into its component values. Single value intervals and
intervals which have already been split (or are the result of previous splits)
are spilled by the default spiller.

Splitting intervals as described above may improve the performance of generated
code in some circumstances. This work is experimental however, and it still
miscompiles many benchmarks. It's not recommended for general use yet.

llvm-svn: 90951
2009-12-09 05:39:12 +00:00
Lang Hames
deed780bc6 The Indexes Patch.
This introduces a new pass, SlotIndexes, which is responsible for numbering
instructions for register allocation (and other clients). SlotIndexes numbering
is designed to match the existing scheme, so this patch should not cause any
changes in the generated code.

For consistency, and to avoid naming confusion, LiveIndex has been renamed
SlotIndex.

The processImplicitDefs method of the LiveIntervals analysis has been moved
into its own pass so that it can be run prior to SlotIndexes. This was
necessary to match the existing numbering scheme.

llvm-svn: 85979
2009-11-03 23:52:08 +00:00
Lang Hames
40530eacdb Oops. Renamed remaining MachineInstrIndex references.
llvm-svn: 83255
2009-10-03 04:31:31 +00:00
Lang Hames
f6903a7043 Renamed MachineInstrIndex to LiveIndex.
llvm-svn: 83254
2009-10-03 04:21:37 +00:00
Lang Hames
fc3582b378 Moved some more index operations over to LiveIntervals.
llvm-svn: 81605
2009-09-12 03:34:03 +00:00
Lang Hames
e504e61ab5 Replaces uses of unsigned for indexes in LiveInterval and VNInfo with
a new class, MachineInstrIndex, which hides arithmetic details from
most clients. This is a step towards allowing the register allocator
to update/insert code during allocation.

llvm-svn: 81040
2009-09-04 20:41:11 +00:00
Chris Lattner
6512a3a281 shoot a few more std::ostream print methods in the head.
llvm-svn: 79814
2009-08-23 03:47:42 +00:00
Lang Hames
1503988bb5 Modified VNInfo. The "copy" member is now a union which holds the copy for a register interval, or the defining register for a stack interval. Access is via getCopy/setCopy and getReg/setReg.
llvm-svn: 78620
2009-08-10 23:43:28 +00:00
Daniel Dunbar
da47773d6a More move to raw_ostream.
llvm-svn: 76966
2009-07-24 10:47:20 +00:00
Daniel Dunbar
339c88008f Move more to raw_ostream, provide support for writing MachineBasicBlock,
LiveInterval, etc to raw_ostream.

llvm-svn: 76965
2009-07-24 10:36:58 +00:00
David Greene
d1f9f45b05 Reorder if-else branches as suggested by Bill.
llvm-svn: 76808
2009-07-22 22:32:19 +00:00