Commit Graph

33 Commits

Author SHA1 Message Date
David Greene 9f23703919 Change errs() to dbgs().
llvm-svn: 92591
2010-01-05 01:25:55 +00:00
Lang Hames 4c052261de Changed slot index ranges for MachineBasicBlocks to be exclusive of endpoint.
This fixes an in-place update bug where code inserted at the end of basic blocks may not be covered by existing intervals which were live across the entire block. It is also consistent with the way ranges are specified for live intervals.

llvm-svn: 91859
2009-12-22 00:11:50 +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
Chris Lattner a48f44d9ee improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!

llvm-svn: 90365
2009-12-03 00:50:42 +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
Lang Hames 6b7233afc6 Added an API to the SlotIndexes pass to allow new instructions to be inserted into the numbering.
PreAllocSplitting is now using this API to insert code.

llvm-svn: 88725
2009-11-14 00:02:51 +00:00
Lang Hames 05fb9637f6 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 a7780905e7 Oops. Renamed remaining MachineInstrIndex references.
llvm-svn: 83255
2009-10-03 04:31:31 +00:00
Lang Hames 920301ecc5 Renamed MachineInstrIndex to LiveIndex.
llvm-svn: 83254
2009-10-03 04:21:37 +00:00
Lang Hames 3fffe62177 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
Bill Wendling e7baa8e970 Convert DOUT to DEBUG(errs()...).
llvm-svn: 79766
2009-08-22 20:54:03 +00:00
Lang Hames dab7b06de9 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.

llvm-svn: 75097
2009-07-09 03:57:02 +00:00
Lang Hames 6858b7d06a Completed basic intra block split implementation.
llvm-svn: 74114
2009-06-24 20:46:24 +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
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
Dan Gohman 4d62ff1483 When assigning a physical register to a MachineOperand, set
the subreg field to 0, since the subreg field is only used
for virtual register subregs. This doesn't change
current functionality; it just eliminates bogus noise from
debug output.

llvm-svn: 68955
2009-04-13 15:21:32 +00:00
Bob Wilson 51856173c8 Fix pr3954. The register scavenger asserts for inline assembly with
register destinations that are tied to source operands.  The
TargetInstrDescr::findTiedToSrcOperand method silently fails for inline
assembly.  The existing MachineInstr::isRegReDefinedByTwoAddr was very
close to doing what is needed, so this revision makes a few changes to
that method and also renames it to isRegTiedToUseOperand (for consistency
with the very similar isRegTiedToDefOperand and because it handles both
two-address instructions and inline assembly with tied registers).

llvm-svn: 68714
2009-04-09 17:16:43 +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
Bill Wendling 2f52e6488f Balance out quote in debug output.
llvm-svn: 68059
2009-03-30 20:32:22 +00:00
Sanjiv Gupta 83debdf4b4 Fixed build warnings for unused variables.
llvm-svn: 67372
2009-03-20 13:49:20 +00:00
Evan Cheng 1361cbbb0b Added MachineInstr::isRegTiedToDefOperand to check for two-addressness.
llvm-svn: 67335
2009-03-19 20:30:06 +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
Daniel Dunbar f24f26c75a Add newlines at end of file (this can annoy gcov)
llvm-svn: 67000
2009-03-14 01:53:05 +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