Commit Graph

93 Commits

Author SHA1 Message Date
Lang Hames
ffd1326ff8 Improved tracking of value number kills. VN kills are now represented
as an (index,bool) pair. The bool flag records whether the kill is a
PHI kill or not. This code will be used to enable splitting of live
intervals containing PHI-kills.

A slight change to live interval weights introduced an extra spill
into lsr-code-insertion (outside the critical sections). The test 
condition has been updated to reflect this.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75097 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 03:57:02 +00:00
Lang Hames
857c4e01f8 VNInfo cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73634 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 21:01:20 +00:00
Lang Hames
f41538d1b5 Update to in-place spilling framework. Includes live interval scaling and trivial rewriter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72729 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-02 16:53:25 +00:00
Owen Anderson
d55fccde4c Fix a bug in live-in detection that caused lost-copy problems to show up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57424 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 20:39:30 +00:00
Argyrios Kyrtzidis
0304b87cce Fix compilation error on MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 08:11:49 +00:00
Dan Gohman
d735b8019b Switch the MachineOperand accessors back to the short names like
isReg, etc., from isRegister, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:45:36 +00:00
Owen Anderson
8481ee7f52 Use a multimap rather than a map for holding the list of copies to insert, so we don't lose copies when two of them have
the same source.  I don't know what I was thinking when I wrote this originally.
Note: There's probably a more efficient way to do this, but I need to think about it some more, and about what determinism
guarantees need to be present.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56964 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 19:40:33 +00:00
Owen Anderson
05472ee54b Mark merged-in VNInfo's as being PHIKilled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56893 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 23:58:47 +00:00
Owen Anderson
082d351361 We don't need to insert copies for implicit_def's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 18:50:46 +00:00
Owen Anderson
f835f84071 Fix off-by-one error when updating live intervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56567 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 21:30:38 +00:00
Owen Anderson
fae86eddeb Add initial support for inserting last minute copies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56485 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 04:37:10 +00:00
Owen Anderson
e04cec0ecf Significant improvements to the logic for merging live intervals. This code can't
just use LI::MergeValueAsValue, as its behavior in the presence of overlapping ranges
isn't what StrongPHIElimination wants.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56472 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 21:58:58 +00:00
Dan Gohman
ae73dc1448 Tidy up several unbeseeming casts from pointer to intptr_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 17:05:41 +00:00
Dan Gohman
a8c763b307 Use empty() instead of begin() == end().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54780 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 18:13:49 +00:00
Owen Anderson
32767955a4 Get rid of unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54742 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 17:44:52 +00:00
Owen Anderson
27d6681496 1) Merge entire live intervals instead of parts of them.
2) Conditionalize temporary insertion if we don't need it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54741 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 17:25:42 +00:00
Owen Anderson
724acf1c52 Do a dominator walk when scheduling copies, rather than a DFS on the CFG. Also, fix a few problems when creating
live intervals for temporaries created by phi elimination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54483 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 18:28:07 +00:00
Owen Anderson
883771f86a Correct handle cases where two phis are coalesced together, and correct break up the case where two different
phis want to coalesce with the same vreg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54426 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 22:08:58 +00:00
Owen Anderson
9860b71b6a We don't need to try to coalesce input vregs that are the same as the output vreg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54422 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 20:29:20 +00:00
Owen Anderson
9b49120408 Only trim a live interval if the register is not used after the PHI node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54421 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 18:36:17 +00:00
Owen Anderson
71ac0be6bb Oops, we were already checking for dead phis. Handle this the proper way, then.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54371 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 21:18:51 +00:00
Owen Anderson
e7b8205e6e We don't need to update live intervals for dead PHIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 20:51:26 +00:00
Owen Anderson
d723f722b2 Use existing LiveInterval methods to simplify live interval merging. Thanks to Evan for pointing these out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54225 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 18:27:35 +00:00
Owen Anderson
b9fb8d1e69 When merging live intervals, we also need to merge in any live ranges that are inputs to two-address instructions
that themselves define a range we already care about.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54185 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-30 00:21:16 +00:00
Owen Anderson
83ea1f8e19 When merging a PHI operand's live interval into the PHI's live interval, we need to merge over all liveranges in
the operand's interval that share the relevant value number, not just the range that immediately precedes the PHI.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54174 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-29 21:17:08 +00:00
Owen Anderson
a279a896ec Fix the issues originally addressed in r54070. After thinking about it some more, I realized that the right thing to do
is to have StrongPHIElimination use its knowledge of the PHIs before they're erased to update the intervals appropriate.  This is
both simpler and more accurate than the alternative, which was having LIA figure it out when it renumbered things, plus it's just
the right thing to do!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54077 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 23:38:08 +00:00
Owen Anderson
020decc2b4 In order to avoid reprocessing a register more than once, we need to add it
to the handled set so it will get filtered out in future iterations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54065 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 21:35:43 +00:00
Owen Anderson
55c64358d1 Remove live interval entries for an interval if we're eliminating its only VN.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54062 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 21:08:41 +00:00
Owen Anderson
c12417edc9 Store the predecessor MBB in the PHIUnion, rather than an index, since the indices will change after renumbering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53985 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 17:12:16 +00:00
Owen Anderson
417dc2f595 Remove debugging code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52016 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 18:43:34 +00:00
Owen Anderson
a9efb264b0 Use the newly created helper on LiveIntervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52013 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 17:22:53 +00:00
Owen Anderson
38b425020b Correctly construct live intervals for the copies we inserted into the predecessors of a block containing a PHI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51950 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 17:55:58 +00:00
Owen Anderson
3094a4c97a We need to subtract one from this index because live ranges are open at the end.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51922 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 00:38:56 +00:00
Owen Anderson
3947e4d142 Preserve the register coallescer, and update live intervals more correctly by triggering a renumbering after phi elimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51780 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 18:38:26 +00:00
Dan Gohman
6ddba2b933 Change class' public PassInfo variables to by initialized with the
address of the PassInfo directly instead of calling getPassInfo.
This eliminates a bunch of dynamic initializations of static data.

Also, fold RegisterPassBase into PassInfo, make a bunch of its
data members const, and rearrange some code to initialize data
members in constructors instead of using setter member functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51022 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 02:05:11 +00:00
Dan Gohman
844731a7f1 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 00:00:25 +00:00
Owen Anderson
52b1733df4 In some situations, we need to check for local interferences between the PHI
node and its inputs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49070 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 03:00:13 +00:00
Owen Anderson
59df878391 Correctly mark a valno that was previous defined by a PHI node as having an
unknown defining inst after PHI elimination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 02:12:45 +00:00
Owen Anderson
78216bc9f8 Don't dereference MBB->end().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49043 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 18:05:08 +00:00
Owen Anderson
bc91bd34f1 Fix a major bug in the DFS calculation. Thanks for Christopher Lamb for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 01:39:20 +00:00
Owen Anderson
c7c00361ce Remove some unneeded code for LiveInterval joining, and fix a bug in the Phi elimination algorithm where we were accidentally reasoning about
the source rather than the destination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48936 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-29 01:58:47 +00:00
Owen Anderson
d382f8a32d Dead PHI instructions need to be handled specially.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48811 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 03:03:23 +00:00
Owen Anderson
e4ded8937a Remove some debugging code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48803 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 22:26:43 +00:00
Owen Anderson
403dad6660 StrongPHIElimination doesn't support swapping live intervals like the coalescer does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 22:25:27 +00:00
Owen Anderson
9a31444ee6 Remove #include<iostream>, which I was using for debugging.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48739 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 20:36:47 +00:00
Owen Anderson
e46611e6bc Be sure to remove intervals after we've joined them. Also, remove some duplicated code.
With this pass, StrongPHIElim can compile very simple testcases correctly.  There's still a ways
to go before it's ready for prime time, though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48719 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 04:11:27 +00:00
Owen Anderson
755ebab37d A first attempt at updating live intervals, with code lifted from
the coalescer.  This doesn't really work, but gets us farther than
before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48446 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-17 06:08:26 +00:00
Owen Anderson
dfd07eab24 We also need to collect the VN IDs for the PHI instructions for later updating.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48278 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 04:22:57 +00:00
Owen Anderson
0031671b41 When we're determining what registers to coallesce, track the VNInfo IDs for the definitions that
feed the PHI instructions.  We'll need these IDs in order to update LiveIntervals properly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48277 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 03:13:29 +00:00
Owen Anderson
eb37ecc882 Move StrongPHIElimination after live interval analysis. This will make things happier down the road.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48138 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 07:22:36 +00:00