Commit Graph

31 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen 4d6eafa138 Change the Spiller interface to take a LiveRangeEdit reference.
This makes it possible to register delegates and get callbacks when the spiller
edits live ranges.

llvm-svn: 127389
2011-03-10 01:51:42 +00:00
Jakob Stoklund Olesen c6cc485051 Make SpillIs an optional pointer. Avoid creating a bunch of temporary SmallVectors.
llvm-svn: 127388
2011-03-10 01:21:58 +00:00
Jakob Stoklund Olesen adecb5e82c Force the greedy register allocator to always use the inline spiller.
Soon, RegAllocGreedy will start splitting live ranges, and then deferred
spilling won't work anyway.

llvm-svn: 121591
2010-12-10 22:54:44 +00:00
Andrew Trick 89eb6a8b94 RABasic is nearly functionally complete. There are a few remaining
benchmarks hitting an assertion.
Adds LiveIntervalUnion::collectInterferingVRegs.
Fixes "late spilling" by checking for any unspillable live vregs among
all physReg aliases.

llvm-svn: 118701
2010-11-10 19:18:47 +00:00
Jakob Stoklund Olesen 912db6d9d0 In which I learn how to forward declare template classes.
llvm-svn: 117272
2010-10-25 17:27:30 +00:00
Jakob Stoklund Olesen 27e1f26534 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 0fef9dda8e 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 a58a7e7f9e Spillers may alter MachineLoopInfo when breaking critical edges, so make it
non-const.

llvm-svn: 108734
2010-07-19 18:41:20 +00:00
Jakob Stoklund Olesen bde96ad23e Add support for rematerialization to InlineSpiller.
llvm-svn: 107351
2010-06-30 23:03:52 +00:00
Jakob Stoklund Olesen 2b87d44c5d Don't return a std::vector in the Spiller interface, but take a reference to a
vector instead. This avoids needless copying and allocation.

Add documentation.

llvm-svn: 106788
2010-06-24 20:54:29 +00:00
Lang Hames 1ab2b49e6d 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 c6e434573c Removed references to LiveStacks from Spiller.* . They're no longer needed.
llvm-svn: 89422
2009-11-20 00:53:30 +00:00
Lang Hames 6912be4ad6 Added a new Spiller implementation which wraps LiveIntervals::addIntervalsForSpills.
All spiller calls in RegAllocLinearScan now go through the new Spiller interface.
The "-new-spill-framework" command line option has been removed. To use the trivial in-place spiller you should now pass "-spiller=trivial -rewriter=trivial".
(Note the trivial spiller/rewriter are only meant to serve as examples of the new in-place modification work. Enabling them will yield terrible, though hopefully functional, code).

llvm-svn: 89311
2009-11-19 04:15:33 +00:00
Lang Hames e9e0cd4e27 Fixed the in-place spiller and trivial rewriter, which had been broken by the recent SlotIndexes work.
llvm-svn: 89238
2009-11-18 20:31:20 +00:00
Daniel Dunbar ac0ca9241a Fix some minor MSVC compiler warnings.
llvm-svn: 76356
2009-07-19 01:38:38 +00:00
Daniel Dunbar 65553d4505 Match declaration to definition.
llvm-svn: 75440
2009-07-12 23:50:34 +00:00
Lang Hames 6b2c960cc4 More VNInfo tweaking, plus a little progress on intra-block splitting.
llvm-svn: 73750
2009-06-19 02:17:53 +00:00
Lang Hames 16cab1935e VNInfo cleanup.
llvm-svn: 73634
2009-06-17 21:01:20 +00:00
Lang Hames fc968ef687 Update to in-place spilling framework. Includes live interval scaling and trivial rewriter.
llvm-svn: 72729
2009-06-02 16:53:25 +00:00
Bill Wendling 670da9a22a Forward decls.
llvm-svn: 72114
2009-05-19 17:52:31 +00:00
Bill Wendling a3b8e84a57 Remove 'class' specifier.
llvm-svn: 72113
2009-05-19 17:51:26 +00:00
Bill Wendling a8705a95a6 Fix to compile on VS2008.
llvm-svn: 72112
2009-05-19 17:50:18 +00:00
Lang Hames cf47d0134f New Spiller interface and trivial implementation.
llvm-svn: 72030
2009-05-18 19:03:16 +00:00
Lang Hames ab68cf24bb Renamed Spiller classes (plus uses and related files) to VirtRegRewriter.
llvm-svn: 71057
2009-05-06 02:36:21 +00:00
Evan Cheng 1a99a5f501 It has finally happened. Spiller is now using live interval info.
This fixes a very subtle bug. vr defined by an implicit_def is allowed overlap with any register since it doesn't actually modify anything. However, if it's used as a two-address use, its live range can be extended and it can be spilled. The spiller must take care not to emit a reload for the vn number that's defined by the implicit_def. This is both a correctness and performance issue.

llvm-svn: 69743
2009-04-21 22:46:52 +00:00
Evan Cheng b96a1082a9 Teach spiller to unfold instructions which modref spill slot when a scratch
register is available and when it's profitable.

e.g.
     xorq  %r12<kill>, %r13
     addq  %rax, -184(%rbp)
     addq  %r13, -184(%rbp)
==>
     xorq  %r12<kill>, %r13
     movq  -184(%rbp), %r12
     addq  %rax, %r12
     addq  %r13, %r12
     movq  %r12, -184(%rbp)

Two more instructions, but fewer memory accesses. It can also open up
opportunities for more optimizations.

llvm-svn: 69341
2009-04-17 01:29:40 +00:00
Bill Wendling b8017e02ca Oy! When reverting r68073, I added in experimental code. Sorry...
llvm-svn: 68099
2009-03-31 08:41:31 +00:00
Bill Wendling c4b08e5eb0 Revert r68073. It's causing a failure in the Apple-style builds.
llvm-svn: 68092
2009-03-31 08:26:26 +00:00
Evan Cheng 76f1b47ec9 Spiller may unfold load / mod / store instructions as an optimization when the would be loaded value is available in a register. It needs to check if it's legal to clobber the register. Also, the register can contain values of multiple spill slots, make sure to check all instead of just the one being unfolded.
llvm-svn: 67068
2009-03-17 01:23:09 +00:00
Owen Anderson 36a9937883 Reorganize some #include's.
llvm-svn: 66780
2009-03-12 06:58:19 +00:00
Owen Anderson aabe06d92a Reorganization: Move the Spiller out of VirtRegMap.cpp into its own files. No (intended) functionality change.
llvm-svn: 66720
2009-03-11 22:31:21 +00:00