Commit Graph

84 Commits

Author SHA1 Message Date
Owen Anderson 4ef4b1a7c1 Fix off-by-one error when updating live intervals.
llvm-svn: 56567
2008-09-24 21:30:38 +00:00
Owen Anderson 4cdc18ad80 Add initial support for inserting last minute copies.
llvm-svn: 56485
2008-09-23 04:37:10 +00:00
Owen Anderson 97364655dc 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.

llvm-svn: 56472
2008-09-22 21:58:58 +00:00
Dan Gohman a79db30d28 Tidy up several unbeseeming casts from pointer to intptr_t.
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Dan Gohman 8de6d22392 Use empty() instead of begin() == end().
llvm-svn: 54780
2008-08-14 18:13:49 +00:00
Owen Anderson ef96ac4f95 Get rid of unused variable.
llvm-svn: 54742
2008-08-13 17:44:52 +00:00
Owen Anderson 65fce4d813 1) Merge entire live intervals instead of parts of them.
2) Conditionalize temporary insertion if we don't need it.

llvm-svn: 54741
2008-08-13 17:25:42 +00:00
Owen Anderson d172c15ab0 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.

llvm-svn: 54483
2008-08-07 18:28:07 +00:00
Owen Anderson 8a8d6f0a78 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.

llvm-svn: 54426
2008-08-06 22:08:58 +00:00
Owen Anderson 987b5057d3 We don't need to try to coalesce input vregs that are the same as the output vreg.
llvm-svn: 54422
2008-08-06 20:29:20 +00:00
Owen Anderson f9fca2f2dc Only trim a live interval if the register is not used after the PHI node.
llvm-svn: 54421
2008-08-06 18:36:17 +00:00
Owen Anderson d9b88a85f2 Oops, we were already checking for dead phis. Handle this the proper way, then.
llvm-svn: 54371
2008-08-05 21:18:51 +00:00
Owen Anderson d4ffa4eb57 We don't need to update live intervals for dead PHIs.
llvm-svn: 54369
2008-08-05 20:51:26 +00:00
Owen Anderson c818c01539 Use existing LiveInterval methods to simplify live interval merging. Thanks to Evan for pointing these out.
llvm-svn: 54225
2008-07-30 18:27:35 +00:00
Owen Anderson 1aebe49ae7 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.

llvm-svn: 54185
2008-07-30 00:21:16 +00:00
Owen Anderson 6b1cc46fee 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.

llvm-svn: 54174
2008-07-29 21:17:08 +00:00
Owen Anderson 54912b3e8d 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!

llvm-svn: 54077
2008-07-25 23:38:08 +00:00
Owen Anderson 0346aba5c2 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.

llvm-svn: 54065
2008-07-25 21:35:43 +00:00
Owen Anderson d9c8711d70 Remove live interval entries for an interval if we're eliminating its only VN.
llvm-svn: 54062
2008-07-25 21:08:41 +00:00
Owen Anderson 79b66966b8 Store the predecessor MBB in the PHIUnion, rather than an index, since the indices will change after renumbering.
llvm-svn: 53985
2008-07-24 17:12:16 +00:00
Owen Anderson 05d1cd99b3 Remove debugging code.
llvm-svn: 52016
2008-06-05 18:43:34 +00:00
Owen Anderson 65dc2b2e06 Use the newly created helper on LiveIntervals.
llvm-svn: 52013
2008-06-05 17:22:53 +00:00
Owen Anderson 3a697779fe Correctly construct live intervals for the copies we inserted into the predecessors of a block containing a PHI.
llvm-svn: 51950
2008-06-04 17:55:58 +00:00
Owen Anderson c777d9e6fe We need to subtract one from this index because live ranges are open at the end.
llvm-svn: 51922
2008-06-04 00:38:56 +00:00
Owen Anderson e785fb639c Preserve the register coallescer, and update live intervals more correctly by triggering a renumbering after phi elimination.
llvm-svn: 51780
2008-05-30 18:38:26 +00:00
Dan Gohman 0479aa5c0b 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.

llvm-svn: 51022
2008-05-13 02:05:11 +00:00
Dan Gohman d78c400b5b 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.

llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Owen Anderson 2412158111 In some situations, we need to check for local interferences between the PHI
node and its inputs.

llvm-svn: 49070
2008-04-02 03:00:13 +00:00
Owen Anderson edfc2eb558 Correctly mark a valno that was previous defined by a PHI node as having an
unknown defining inst after PHI elimination.

llvm-svn: 49069
2008-04-02 02:12:45 +00:00
Owen Anderson 49dd9f16a9 Don't dereference MBB->end().
llvm-svn: 49043
2008-04-01 18:05:08 +00:00
Owen Anderson f28fc71c93 Fix a major bug in the DFS calculation. Thanks for Christopher Lamb for pointing this out.
llvm-svn: 48973
2008-03-31 01:39:20 +00:00
Owen Anderson 8b22873bdd 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.

llvm-svn: 48936
2008-03-29 01:58:47 +00:00
Owen Anderson 5d2d1776e0 Dead PHI instructions need to be handled specially.
llvm-svn: 48811
2008-03-26 03:03:23 +00:00
Owen Anderson 9f129318dc Remove some debugging code.
llvm-svn: 48803
2008-03-25 22:26:43 +00:00
Owen Anderson 1d46d45e35 StrongPHIElimination doesn't support swapping live intervals like the coalescer does.
llvm-svn: 48802
2008-03-25 22:25:27 +00:00
Owen Anderson e2707768a4 Remove #include<iostream>, which I was using for debugging.
llvm-svn: 48739
2008-03-24 20:36:47 +00:00
Owen Anderson 200e57840e 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.

llvm-svn: 48719
2008-03-24 04:11:27 +00:00
Owen Anderson 488e645938 A first attempt at updating live intervals, with code lifted from
the coalescer.  This doesn't really work, but gets us farther than
before.

llvm-svn: 48446
2008-03-17 06:08:26 +00:00
Owen Anderson 944b1c76ab We also need to collect the VN IDs for the PHI instructions for later updating.
llvm-svn: 48278
2008-03-12 04:22:57 +00:00
Owen Anderson 70aaab6dc5 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.

llvm-svn: 48277
2008-03-12 03:13:29 +00:00
Owen Anderson 75d04819a6 Move StrongPHIElimination after live interval analysis. This will make things happier down the road.
llvm-svn: 48138
2008-03-10 07:22:36 +00:00
Gabor Greif 636ab19205 some more spelling changes
llvm-svn: 47996
2008-03-06 10:51:21 +00:00
Evan Cheng 6325446666 Refactor code. Remove duplicated functions that basically do the same thing as
findRegisterUseOperandIdx, findRegisterDefOperandIndx. Fix some naming inconsistencies.

llvm-svn: 47927
2008-03-05 00:59:57 +00:00
Owen Anderson 7fe0bb2b43 Fix an iterator invalidation issue.
llvm-svn: 46263
2008-01-22 23:58:54 +00:00
Owen Anderson 7fb6241733 Clarify a deviation from the original algorithm.
llvm-svn: 46218
2008-01-21 22:03:00 +00:00
Owen Anderson d990b4f646 Improve a few comments.
llvm-svn: 46217
2008-01-21 22:01:01 +00:00
Owen Anderson 4f45cef2f9 Get rid of all uses of LiveVariables::VarInfo::DefInst in favor of the equivalent API from
MachineRegisterInfo.  Once all clients are switched over, the former will be going away.

llvm-svn: 45805
2008-01-10 01:36:43 +00:00
Owen Anderson 51b8e20ccf Add more comments explaining the basics of how the decision of when to rename and when to insert
copies is made.

llvm-svn: 45799
2008-01-10 00:47:01 +00:00
Owen Anderson 8958a78576 Get rid of the isKillInst predicate. LiveVariables already provides this information.
llvm-svn: 45797
2008-01-10 00:33:11 +00:00
Owen Anderson 1c8152ba03 Copies need to be inserted before the first terminator, not at the end of the block.
llvm-svn: 45791
2008-01-10 00:01:41 +00:00