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

202 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
4f3da0eab4 Delete dead code.
llvm-svn: 126801
2011-03-01 23:24:19 +00:00
Jakob Stoklund Olesen
15d9bf0424 Move the value map from LiveIntervalMap to SplitEditor.
The value map is currently not used, all values are 'complex mapped' and
LiveIntervalMap::mapValue is used to dig them out.

This is the first step in a series changes leading to the removal of
LiveIntervalMap. Its data structures can be shared among all the live intervals
created by a split, so it is wasteful to create a copy for each.

llvm-svn: 126800
2011-03-01 23:14:53 +00:00
Jakob Stoklund Olesen
13b552560b Delete dead code.
Local live range splitting is better driven by interference. This code was just
guessing.

llvm-svn: 126799
2011-03-01 23:14:50 +00:00
Jakob Stoklund Olesen
5edc1f287b It is safe to ignore LastSplitPoint when the variable is not live out.
No code will be inserted after the split point anyway.

llvm-svn: 126319
2011-02-23 18:26:31 +00:00
Jakob Stoklund Olesen
508829f1d1 Add SplitKit::isOriginalEndpoint and use it to force live range splitting to terminate.
An original endpoint is an instruction that killed or defined the original live
range before any live ranges were split.

When splitting global live ranges, avoid creating local live ranges without any
original endpoints. We may still create global live ranges without original
endpoints, but such a range won't be split again, and live range splitting still
terminates.

llvm-svn: 126151
2011-02-21 23:09:46 +00:00
Jakob Stoklund Olesen
e2833bf683 Give SplitAnalysis a VRM member to access VirtRegMap::getOriginal().
llvm-svn: 126005
2011-02-19 00:53:42 +00:00
Jakob Stoklund Olesen
45ba3718d4 Missed member rename for naming convention.
llvm-svn: 126003
2011-02-19 00:42:33 +00:00
Jakob Stoklund Olesen
52f108703d Delete unused code for analyzing and splitting around loops.
Loop splitting is better handled by the more generic global region splitting
based on the edge bundle graph.

llvm-svn: 125243
2011-02-09 23:56:18 +00:00
Jakob Stoklund Olesen
2205510f0c Use the LiveBLocks array for SplitEditor::splitSingleBlocks() as well.
This fixes a bug where splitSingleBlocks() could split a live range after a
terminator instruction.

llvm-svn: 125237
2011-02-09 23:30:25 +00:00
Jakob Stoklund Olesen
21624a745c Move calcLiveBlockInfo() and the BlockInfo struct into SplitAnalysis.
No functional changes intended.

llvm-svn: 125231
2011-02-09 22:50:26 +00:00
Jakob Stoklund Olesen
5c13598fd7 Ignore <undef> uses when analyzing and rewriting.
llvm-svn: 125226
2011-02-09 21:52:09 +00:00
Jakob Stoklund Olesen
d5ad17c42b Add SplitEditor::overlapIntv() to create small ranges where both registers are live.
If a live range is used by a terminator instruction, and that live range needs
to leave the block on the stack or in a different register, it can be necessary
to have both sides of the split live at the terminator instruction.

Example:

  %vreg2 = COPY %vreg1
  JMP %vreg1

Becomes after spilling %vreg2:

  SPILL %vreg1
  JMP %vreg1

The spill doesn't kill the register as is normally the case.

llvm-svn: 125102
2011-02-08 18:50:21 +00:00
Jakob Stoklund Olesen
5a0048302f Add assertion.
llvm-svn: 125101
2011-02-08 18:50:18 +00:00
Jakob Stoklund Olesen
bf833680ec Add LiveIntervals::getLastSplitPoint().
A live range cannot be split everywhere in a basic block. A split must go before
the first terminator, and if the variable is live into a landing pad, the split
must happen before the call that can throw.

llvm-svn: 124894
2011-02-04 19:33:11 +00:00
Jakob Stoklund Olesen
097e61e40f Skip unused values.
llvm-svn: 124842
2011-02-04 00:59:23 +00:00
Jakob Stoklund Olesen
1451898887 Add debug output and asserts to the phi-connecting code.
llvm-svn: 124813
2011-02-03 20:29:39 +00:00
Jakob Stoklund Olesen
eb29913703 Fix coloring bug when mapping values in the middle of a live-through block.
If the found value is not live-through the block, we should only add liveness up
to the requested slot index. When the value is live-through, the whole block
should be colored.

Bug found by SSA verification in the machine code verifier.

llvm-svn: 124812
2011-02-03 20:29:36 +00:00
Jakob Stoklund Olesen
319f2bbf2b Return live range end points from SplitEditor::enter*/leave*.
These end points come from the inserted copies, and can be passed directly to
useIntv. This simplifies the coloring code.

llvm-svn: 124799
2011-02-03 17:04:16 +00:00
Eric Christopher
57e4dada99 Reapply this.
llvm-svn: 124779
2011-02-03 06:18:29 +00:00
Eric Christopher
8082811b65 Temporarily revert 124765 in an attempt to find the cycle breaking bootstrap.
llvm-svn: 124778
2011-02-03 05:40:54 +00:00
Jakob Stoklund Olesen
880fa5b5dc Defer SplitKit value mapping until all defs are available.
The greedy register allocator revealed some problems with the value mapping in
SplitKit. We would sometimes start mapping values before all defs were known,
and that could change a value from a simple 1-1 mapping to a multi-def mapping
that requires ssa update.

The new approach collects all defs and register assignments first without
filling in any live intervals. Only when finish() is called, do we compute
liveness and mapped values. At this time we know with certainty which values map
to multiple values in a split range.

This also has the advantage that we can compute live ranges based on the
remaining uses after rematerializing at split points.

The current implementation has many opportunities for compile time optimization.

llvm-svn: 124765
2011-02-03 00:54:23 +00:00
Jakob Stoklund Olesen
5c0fcc03af Rename member variables to follow the rest of LLVM.
No functional change.

llvm-svn: 124257
2011-01-26 00:50:53 +00:00
Jakob Stoklund Olesen
360b0921ac Add LiveIntervalMap::dumpCache() to print out the cache used by the ssa update algorithm.
llvm-svn: 123925
2011-01-20 17:45:20 +00:00
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
c0ff5356d4 Add RAGreedy methods for splitting live ranges around regions.
Analyze the live range's behavior entering and leaving basic blocks. Compute an
interference pattern for each allocation candidate, and use SpillPlacement to
find an optimal region where that register can be live.

This code is still not enabled.

llvm-svn: 123774
2011-01-18 21:13:27 +00:00
Jakob Stoklund Olesen
abf8941a60 Turn the EdgeBundles class into a stand-alone machine CFG analysis pass.
The analysis will be needed by both the greedy register allocator and the
X86FloatingPoint pass. It only needs to be computed once when the CFG doesn't
change.

This pass is very fast, usually showing up as 0.0% wall time.

llvm-svn: 122832
2011-01-04 21:10:05 +00:00
Jakob Stoklund Olesen
71e527ef4b Include a shadow of the original CFG edges in the edge bundle graph.
llvm-svn: 122444
2010-12-22 22:01:28 +00:00
Jakob Stoklund Olesen
e9eb1be4dd Add EdgeBundles to SplitKit.
Edge bundles is an annotation on the CFG that turns it into a bipartite directed
graph where each basic block is connected to an outgoing and an ingoing bundle.
These bundles are useful for identifying regions of the CFG for live range
splitting.

llvm-svn: 122301
2010-12-21 01:50:21 +00:00
Jakob Stoklund Olesen
a2f2eab8d4 Check that the register is live-in to the loop header before inserting copies in
the loop predecessors.

The register can be live-out from a predecessor without being live-in to the
loop header if there is a critical edge from the predecessor.

llvm-svn: 122123
2010-12-18 01:06:19 +00:00
Jakob Stoklund Olesen
3cfea82733 Fix build.
llvm-svn: 121872
2010-12-15 18:07:48 +00:00
Jakob Stoklund Olesen
308656b955 Detect and enumerate bypass loops.
Bypass loops have the current live range live through, but contain no uses or
defs. Splitting around a bypass loop can free registers for other uses inside
the loop by spilling the split range.

llvm-svn: 121871
2010-12-15 17:49:52 +00:00
Jakob Stoklund Olesen
849388944e Separate SplitAnalysis::getSplitLoops().
This method returns the set of loops with uses that are candidates for
splitting.

llvm-svn: 121870
2010-12-15 17:41:19 +00:00
Jakob Stoklund Olesen
2f72fda7ef No need to add liveness that's already there.
llvm-svn: 118742
2010-11-10 23:56:00 +00:00
Jakob Stoklund Olesen
00c4d94862 Basic rematerialization during splitting.
Whenever splitting wants to insert a copy, it checks if the value can be
rematerialized cheaply instead.

Missing features:
- Delete instructions when all uses have been rematerialized.
- Truncate live ranges to the remaining uses after rematerialization.

llvm-svn: 118702
2010-11-10 19:31:50 +00:00
Jakob Stoklund Olesen
7dc4b810ed Tag debug output as regalloc
llvm-svn: 118193
2010-11-03 20:39:23 +00:00
Jakob Stoklund Olesen
a052004a89 When inserting copies during splitting, always use the parent register as the
source, and let rewrite() clean it up.

This way, kill flags on the inserted copies are fixed as well during rewrite().

We can't just assume that all the copies we insert are going to be kills since
critical edges into loop headers sometimes require both source and dest to be
live out of a block.

llvm-svn: 117980
2010-11-01 23:59:48 +00:00
Jakob Stoklund Olesen
78ba455b51 Update kill flags while rewriting instructions after splitting.
llvm-svn: 117959
2010-11-01 21:51:29 +00:00
Jakob Stoklund Olesen
035667c0d6 Make sure copies are inserted after any exception handling labels at the top of
a basic block.

llvm-svn: 117764
2010-10-30 01:26:16 +00:00
Jakob Stoklund Olesen
1f2fb9a020 Don't transfer unused values to the new intervals formed by splitting.
llvm-svn: 117673
2010-10-29 17:47:49 +00:00
Benjamin Kramer
d84e7a7b91 Silence Release build warnings.
llvm-svn: 117671
2010-10-29 17:40:05 +00:00
Jakob Stoklund Olesen
e577489ba5 Never propagate the idom value out of a block that defines its own value.
llvm-svn: 117669
2010-10-29 17:37:25 +00:00
Jakob Stoklund Olesen
ccbfbefd93 Replace SplitKit SSA update with an iterative algorithm very similar to the one
in SSAUpdaterImpl.h

Verifying live intervals revealed that the old method was completely wrong, and
we need an iterative approach to calculating PHI placemant. Fortunately, we have
MachineDominators available, so we don't have to compute that over and over
like SSAUpdaterImpl.h must.

Live-out values are cached between calls to mapValue() and computed in a greedy
way, so most calls will be working with very small block sets.

Thanks to Bob for explaining how this should work.

llvm-svn: 117599
2010-10-28 20:34:52 +00:00
Jakob Stoklund Olesen
6f4262448e Make MachineDominators available for SplitEditor. We are going to need it for
proper SSA updating.

This doesn't cause MachineDominators to be recomputed since we are already
requiring MachineLoopInfo which uses dominators as well.

llvm-svn: 117598
2010-10-28 20:34:50 +00:00
Jakob Stoklund Olesen
66180b2c06 Handle critical loop predecessors by making both inside and outside registers
live out.

This doesn't prevent us from inserting a loop preheader later on, if that is
better.

llvm-svn: 117424
2010-10-27 00:39:07 +00:00
Jakob Stoklund Olesen
514eb703b8 Compute critical loop predecessors in the same way as critical loop exits.
Critical edges going into a loop are not as bad as critical exits. We can handle
them by splitting the critical edge, or by having both inside and outside
registers live out of the predecessor.

llvm-svn: 117423
2010-10-27 00:39:05 +00:00
Jakob Stoklund Olesen
bb4b26c42b After splitting, compute connected components of all new registers, not just for
the remainder register.

Example:

bb0:
  x = 1
bb1:
  use(x)
  ...
  x = 2
  jump bb1

When x is isolated in bb1, the inner part breaks into two components, x1 and x2:

bb0:
  x0 = 1
bb1:
  x1 = x0
  use(x1)
  ...
  x2 = 2
  x0 = x2
  jump bb1

llvm-svn: 117408
2010-10-26 22:36:09 +00:00
Jakob Stoklund Olesen
fa777d622d Call RenumberValues for all new registers created during splitting. This is
necessary to get correct hasPHIKill flags.

llvm-svn: 117406
2010-10-26 22:36:05 +00:00
Jakob Stoklund Olesen
0007e9a345 Preserve PHIDef bits in cloned values during splitting.
llvm-svn: 117405
2010-10-26 22:36:02 +00:00
Jakob Stoklund Olesen
68258f467a Be more strict about detecting multi-use blocks for isolation.
When a block has exactly two uses and the register is both live-in and live-out,
don't isolate the block. We would be inserting two copies, so we haven't really
made any progress.

If the live-in and live-out values separate into disconnected components after
splitting, we would be making progress. We can't detect that for now.

llvm-svn: 117169
2010-10-22 22:48:56 +00:00
Jakob Stoklund Olesen
de1439ce2b Be more strict when detecting critical edges before loop splitting.
An exit block with a critical edge must only have predecessors in the loop, or
just before the loop. This guarantees that the inserted copies in the loop
predecessors dominate the exit block.

llvm-svn: 117144
2010-10-22 20:28:23 +00:00
Jakob Stoklund Olesen
967bcbf445 Add print methods
llvm-svn: 117143
2010-10-22 20:28:21 +00:00
Jakob Stoklund Olesen
4794d28044 Don't include the destination interval in the union when computing
Parent - union(Y, ...). Doh.

llvm-svn: 117042
2010-10-21 18:47:08 +00:00
Jakob Stoklund Olesen
b569fb0904 Eliminate curli from SplitEditor. Use the LiveRangeEdit reference instead.
llvm-svn: 116547
2010-10-15 00:34:01 +00:00
Jakob Stoklund Olesen
5d5bcb8ee4 Move stack slot assignments into LiveRangeEdit.
All registers created during splitting or spilling are assigned to the same
stack slot as the parent register.

When splitting or rematting, we may not spill at all. In that case the stack
slot is still assigned, but it will be dead.

llvm-svn: 116546
2010-10-15 00:16:55 +00:00
Jakob Stoklund Olesen
acca65b973 Create a new LiveRangeEdit class to keep track of the new registers created when
splitting or spillling, and to help with rematerialization.

Use LiveRangeEdit in InlineSpiller and SplitKit. This will eventually make it
possible to share remat code between InlineSpiller and SplitKit.

llvm-svn: 116543
2010-10-14 23:49:52 +00:00
Jakob Stoklund Olesen
e0b9dbf91b Only split around a loop if the live range has uses outside the loop periphery.
Before we would also split around a loop if any peripheral block had multiple
uses. This could cause repeated splitting when splitting a different live range
would insert uses into the periphery.

Now -spiller=inline passes the nightly test suite again.

llvm-svn: 116494
2010-10-14 18:26:45 +00:00
Jakob Stoklund Olesen
8c2e951b2b Rename SplitEditor::rewrite to finish() and break it out into a couple of new
functions: computeRemainder and rewrite.

When the remainder breaks up into multiple components, remember to rewrite those
uses as well.

llvm-svn: 116121
2010-10-08 23:42:21 +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
af0fa37509 Print more loop info.
llvm-svn: 115951
2010-10-07 18:47:07 +00:00
Jakob Stoklund Olesen
25e205d66b Print out MBB number when rewriting.
llvm-svn: 115950
2010-10-07 18:47:05 +00:00
Jakob Stoklund Olesen
9f106fa05c Cache interval iterators in SplitEditor::addTruncSimpleRange so we only have to
do one find().

llvm-svn: 115929
2010-10-07 17:56:39 +00:00
Jakob Stoklund Olesen
a8b45e7477 Clean up debug printing.
llvm-svn: 115928
2010-10-07 17:56:35 +00:00
Jakob Stoklund Olesen
21f9209234 Count uses in all nested loops, not just the deepest.
llvm-svn: 115710
2010-10-05 23:10:12 +00:00
Jakob Stoklund Olesen
b196dd974f Remove SplitAnalysis::removeUse. It was only used to make SplitAnalysis
reusable, but that is no longer relevant since a split will always replace the
original.

llvm-svn: 115709
2010-10-05 23:10:09 +00:00
Jakob Stoklund Olesen
f453c743dd dupli always has an interval now.
llvm-svn: 115708
2010-10-05 23:10:04 +00:00
Jakob Stoklund Olesen
592949c742 We can split around loops with multiple exits now.
llvm-svn: 115696
2010-10-05 22:19:35 +00:00
Jakob Stoklund Olesen
8137fd6975 Update SplitEditor API to reflect the fact that the original live interval is
never kept after splitting.

Keeping the original interval made sense when the split region doesn't modify
the register, and the original is spilled. We can get the same effect by
detecting reloaded values when spilling around copies.

llvm-svn: 115695
2010-10-05 22:19:33 +00:00
Jakob Stoklund Olesen
65051fba34 Intervals are half-open.
llvm-svn: 115694
2010-10-05 22:19:29 +00:00
Jakob Stoklund Olesen
5391f55f59 When we find a reaching definition, make sure it is visited from all paths by
erasing it from the visited set. That ensures we create the right phi defs.

llvm-svn: 115666
2010-10-05 20:36:28 +00:00
Jakob Stoklund Olesen
d4b34928be Don't use nextIndex to check for live out of instruction.
Insert copy after defining instruction.

Fix LiveIntervalMap::extendTo to properly handle live segments starting before
the current basic block.

Make sure the open live range is extended to the inserted copy's use slot.

llvm-svn: 115665
2010-10-05 20:36: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
c5ea87bca7 Build the complement interval dupli after the split intervals instead of
creating it before and subtracting split ranges.

This way, the SSA update code in LiveIntervalMap can properly create and use new
phi values in dupli. Now it is possible to create split regions where a value
escapes along two different CFG edges, creating phi values outside the split
region.

This is a work in progress and probably quite broken.

llvm-svn: 114492
2010-09-21 22:32:21 +00:00
Jakob Stoklund Olesen
e37047a62f Use the value mapping provided by LiveIntervalMap. This simplifies the code a
great deal because we don't have to worry about maintaining SSA form.

Unconditionally copy back to dupli when the register is live out of the split
range, even if the live-out value was defined outside the range. Skipping the
back-copy only makes sense when the live range is going to spill outside the
split range, and we don't know that it will. Besides, this was a hack to avoid
SSA update issues.

Clear up some confusion about the end point of a half-open LiveRange. Methinks
LiveRanges need to be closed so both start and end are included in the range.
The low bits of a SlotIndex are symbolic, so a half-open range doesn't really
make sense. This would be a pervasive change, though.

llvm-svn: 114043
2010-09-16 00:01:36 +00:00
Jakob Stoklund Olesen
52d3045d23 Mechanically replace LiveInterval* with LiveIntervalMap for intervals being
edited without actually using LiveIntervalMap functionality.

llvm-svn: 113816
2010-09-13 23:29:11 +00:00
Jakob Stoklund Olesen
060ad376c4 Allow LiveIntervalMap to be reused by resetting the current live interval.
llvm-svn: 113815
2010-09-13 23:29:09 +00:00
Jakob Stoklund Olesen
0e83d54b2a Let's just declare that it is impossible to construct a std::pair from a null
pointer and work around that.

llvm-svn: 113788
2010-09-13 21:29:45 +00:00
Michael J. Spencer
c17025abdc Fix the msvc 2010 build.
The Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01
implements parts of C++0x based on the draft standard. An old version of
the draft had a bug that makes std::pair<T1*, T2*>(something, 0) fail to
compile. This is because the template<class U, class V> pair(U&& x, V&& y)
constructor is selected, even though it later fails to implicitly convert
U and V to frist_type and second_type.

This has been fixed in n3090, but it seems that Microsoft is not going to
update msvc.

llvm-svn: 111535
2010-08-19 18:16:39 +00:00
Jakob Stoklund Olesen
ef87fb790b Thinking about it, we don't need MachineDominatorTree after all. The DomValue
map discovers the iterated dominance frontier for free.

llvm-svn: 111400
2010-08-18 20:29:53 +00:00
Jakob Stoklund Olesen
a94deec1c0 Revert r111394. It was too aggressive.
We must complete the DFS, otherwise we might miss needed phi-defs, and
prematurely color live ranges with a non-dominating value.

This is not a big deal since we get to color more of the CFG and the next
mapValue call will be faster.

llvm-svn: 111397
2010-08-18 20:06:05 +00:00
Jakob Stoklund Olesen
221c0b3c75 Aggressively prune the DFS when inserting phi-defs.
llvm-svn: 111394
2010-08-18 19:00:11 +00:00
Jakob Stoklund Olesen
b6491ab1f6 Add the LiveIntervalMap class. Don't hook it up yet.
LiveIntervalMap maps values from a parent LiveInterval to a child interval that
is a strict subset. It will create phi-def values as needed to preserve the
VNInfo SSA form in the child interval.

This leads to an algorithm very similar to the one in SSAUpdaterImpl.h, but with
enough differences that the code can't be reused:

- We don't need to manipulate PHI instructions.
- LiveIntervals have kills.
- We have MachineDominatorTree.
- We can use df_iterator.

llvm-svn: 111393
2010-08-18 19:00:08 +00:00
Jakob Stoklund Olesen
44b77ea344 Clean up the Spiller.h interface.
The earliestStart argument is entirely specific to linear scan allocation, and
can be easily calculated by RegAllocLinearScan.

Replace std::vector with SmallVector.

llvm-svn: 111055
2010-08-13 22:56:53 +00:00
Jakob Stoklund Olesen
70604cb116 Implement splitting inside a single block.
When a live range is contained a single block, we can split it around
instruction clusters. The current approach is very primitive, splitting before
and after the largest gap between uses.

llvm-svn: 111043
2010-08-13 21:18:48 +00:00
Jakob Stoklund Olesen
d802c303fd Let LiveInterval::addRange extend existing ranges, it will verify that value
numbers match. The old check could accidentally leave holes in openli.

Also let useIntv add all ranges for the phi-def value inserted by
enterIntvAtEnd. This works as long at the value mapping is established in
enterIntvAtEnd.

llvm-svn: 110995
2010-08-13 01:05:26 +00:00
Jakob Stoklund Olesen
7bac4bf66d Remember to actually update SplitAnalysis statistics now that we have a fancy
function to do it.

llvm-svn: 110994
2010-08-13 01:05:23 +00:00
Jakob Stoklund Olesen
2dc2440b42 Handle an empty dupli.
This can happen if the original interval has been broken into two disconnected
parts. Ideally, we should be able to detect when the graph is disconnected and
create separate intervals, but that code is not implemented yet.

Example:

Two basic blocks are both branching to a loop header. Our interval is defined in
both basic blocks, and live into the loop along both edges.

We decide to split the interval around the loop. The interval is split into an
inside part and an outside part. The outside part now has two disconnected
segments, one in each basic block.

If we later decide to split the outside interval into single blocks, we get one
interval per basic block and an empty dupli for the remainder.

llvm-svn: 110976
2010-08-12 23:02:57 +00:00
Jakob Stoklund Olesen
f8957964f7 Update the SplitAnalysis statistics as uses are moved from curli to the new
split intervals. THis means the analysis can be used for multiple splits as long
as curli doesn't shrink.

llvm-svn: 110975
2010-08-12 23:02:55 +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
d3e41f910a Clean up debug output.
llvm-svn: 110940
2010-08-12 18:50:55 +00:00
Jakob Stoklund Olesen
886eebfa6f Implement single block splitting.
Before spilling a live range, we split it into a separate range for each basic
block where it is used. That way we only get one reload per basic block if the
new smaller ranges can allocate to a register.

This type of splitting is already present in the standard spiller.

llvm-svn: 110934
2010-08-12 17:07:14 +00:00
Jakob Stoklund Olesen
d3f939d7a2 More debug spew
llvm-svn: 110720
2010-08-10 20:45:01 +00:00
Jakob Stoklund Olesen
245a1faf76 Implement register class inflation.
When splitting a live range, the new registers have fewer uses and the
permissible register class may be less constrained. Recompute the register class
constraint from the uses of new registers created for a split. This may let them
be allocated from a larger set, possibly avoiding a spill.

llvm-svn: 110703
2010-08-10 18:37:40 +00:00
Jakob Stoklund Olesen
e51a747336 Recalculate the spill weight and allocation hint for virtual registers created
during live range splitting.

llvm-svn: 110686
2010-08-10 17:07:22 +00:00
Jakob Stoklund Olesen
6944ea9801 Lazily defer duplicating the live interval we are splitting until we know it is
necessary.

Sometimes, live range splitting doesn't shrink the current interval, but simply
changes some instructions to use a new interval. That makes the original more
suitable for spilling. In this case, we don't need to duplicate the original.

llvm-svn: 110481
2010-08-06 22:17:33 +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
Jakob Stoklund Olesen
8426150327 Fix swapped COPY operands.
llvm-svn: 110453
2010-08-06 18:04:17 +00:00
Jakob Stoklund Olesen
ecaa9f6ba4 Checkpoint SplitKit progress.
We are now at a point where we can split around simple single-entry, single-exit
loops, although still with some bugs.

llvm-svn: 110257
2010-08-04 22:08:39 +00:00
Jakob Stoklund Olesen
2b379c4339 Add SplitEditor to SplitKit. This class will be used to edit live intervals and
rewrite instructions for live range splitting.

Still work in progress.

llvm-svn: 109469
2010-07-26 23:44:11 +00:00
Jakob Stoklund Olesen
2e78d6ed2e Change the createSpiller interface to take a MachineFunctionPass argument.
The spillers can pluck the analyses they need from the pass reference.

Switch some never-null pointers to references.

llvm-svn: 108969
2010-07-20 23:50:15 +00:00
Jakob Stoklund Olesen
dcf78c06f8 Implement loop splitting analysis.
Determine which loop exit blocks need a 'pre-exit' block inserted.
Recognize when this would be impossible.

llvm-svn: 108941
2010-07-20 21:46:58 +00:00
Jakob Stoklund Olesen
1101d2ae50 Appease the colonials.
llvm-svn: 108845
2010-07-20 16:12:37 +00:00
Jakob Stoklund Olesen
03e14d78cd Beginning SplitKit - utility classes for live range splitting.
This is a work in progress. So far we have some basic loop analysis to help
determine where it is useful to split a live range around a loop.

The actual loop splitting code from Splitter.cpp is also going to move in here.

llvm-svn: 108842
2010-07-20 15:41:07 +00:00