1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

95 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
5d66cf0c01 Set an allocation hint when rematting before a COPY.
This almost guarantees that the COPY will be coalesced.

llvm-svn: 125140
2011-02-09 00:25:36 +00:00
Jakob Stoklund Olesen
acdd9ab5ff Avoid folding a load instruction into an instruction that redefines the register.
The target hook doesn't know how to do that. (Neither do I).

llvm-svn: 125108
2011-02-08 19:33:55 +00:00
Jakob Stoklund Olesen
957748e7ac Teach TargetRegisterInfo how to cram stack slot indexes in with the virtual and
physical register numbers.

This makes the hack used in LiveInterval official, and lets LiveInterval be
oblivious of stack slots.

The isPhysicalRegister() and isVirtualRegister() predicates don't know about
this, so when a variable may contain a stack slot, isStackSlot() should always
be tested first.

llvm-svn: 123128
2011-01-09 21:17:37 +00:00
Jakob Stoklund Olesen
bdf06d6c7b Apparently, operandices is not a word.
llvm-svn: 122135
2010-12-18 03:28:32 +00:00
Jakob Stoklund Olesen
e06ded7533 Teach the inline spiller to attempt folding a load instruction into its single
use before rematerializing the load.

This allows us to produce:

    addps	LCPI0_1(%rip), %xmm2

Instead of:

    movaps	LCPI0_1(%rip), %xmm3
    addps	%xmm3, %xmm2

Saving a register and an instruction. The standard spiller already knows how to
do this.

llvm-svn: 122133
2010-12-18 03:04:14 +00:00
Jakob Stoklund Olesen
2879da5e13 Pass a Banner argument to the machine code verifier both from
createMachineVerifierPass and MachineFunction::verify.

The banner is printed before the machine code dump, just like the printer pass.

llvm-svn: 122113
2010-12-18 00:06:56 +00:00
Jakob Stoklund Olesen
cbd4bac09d Rip out live range splitting support from the inline spiller.
The spiller should only spill. The register allocator will drive live range
splitting, it has the needed information about register pressure and
interferences.

llvm-svn: 121590
2010-12-10 22:54:40 +00:00
Jakob Stoklund Olesen
86fba16eb1 When spilling a register defined by an early clobber, make sure that the new
live ranges for the spill register are also defined at the use slot instead of
the normal def slot.

This fixes PR8612 for the inline spiller. A use was being allocated to the same
register as a spilled early clobber def.

This problem exists in all the spillers. A fix for the standard spiller is
forthcoming.

llvm-svn: 119182
2010-11-15 20:55:49 +00:00
Jakob Stoklund Olesen
6a63cbe06d Hook up AliasAnalysis in InlineSpiller. This is used for rematerializing
constant loads.

llvm-svn: 118741
2010-11-10 23:55:56 +00:00
Andrew Trick
9d60f59b55 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
e259b04730 Simplify the LiveRangeEdit::canRematerializeAt() interface a bit.
llvm-svn: 118661
2010-11-10 01:05:12 +00:00
Jakob Stoklund Olesen
aa7acbe740 Disable fancy splitting during spilling unless -extra-spiller-splits is given.
This way, InlineSpiller does the same amount of splitting as the standard
spiller. Splitting should really be guided by the register allocator, and
doesn't belong in the spiller at all.

llvm-svn: 118216
2010-11-04 00:32:32 +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
66012df062 Don't assign new registers created during a split to the same stack slot, but
give them individual stack slots once the are actually spilled.

llvm-svn: 117945
2010-11-01 19:49:57 +00:00
Jakob Stoklund Olesen
4425035bfd Print out register class of spilled register.
llvm-svn: 117761
2010-10-30 01:26:09 +00:00
Jakob Stoklund Olesen
e446520687 Run a verification pass before any splitting to better distribute blame.
llvm-svn: 117629
2010-10-29 00:40:55 +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
35f9c58245 Add a temporary command line option to verify machine code after each spill or
split.

llvm-svn: 117597
2010-10-28 20:34:47 +00:00
Jakob Stoklund Olesen
b0c10ed95a InlineSpiller can also update LiveStacks.
llvm-svn: 117338
2010-10-26 00:11:35 +00:00
Jakob Stoklund Olesen
9121d7b293 Move some of the InlineSpiller rematerialization code into LiveRangeEdit.
llvm-svn: 116951
2010-10-20 22:00:51 +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
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
Lang Hames
d342ada445 Fixed some tests to avoid LiveIntervals::getInstructionFromIndex(..) overhead where possible. Thanks to Jakob for the suggestions.
llvm-svn: 114798
2010-09-26 03:37:09 +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
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
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
6036d58c40 Avoid editing the current live interval during remat.
The live interval may be used for a spill slot as well, and that spill slot
could be shared by split registers. We cannot shrink it, even if we know the
current register won't need the spill slot in that range.

llvm-svn: 110721
2010-08-10 20:45:07 +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
581c54b1fe Keep the MachiuneFunctionPass pointer around. It is useful for verification.
llvm-svn: 110464
2010-08-06 18:47:06 +00:00
Jakob Stoklund Olesen
dc6e812510 Coalesce stack slot accesses that arise when spilling both sides of a COPY.
This helps avoid silly code:

    %R0<def = LOAD <fi#5>
    STORE <fi#5>, %R0<kill>

llvm-svn: 110266
2010-08-04 22:35:11 +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
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
Jakob Stoklund Olesen
186d86d916 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
ccd252ca08 Change TII::foldMemoryOperand API to require the machine instruction to be
inserted in a MBB, and return an already inserted MI.

This target API change is necessary to allow foldMemoryOperand to call
storeToStackSlot and loadFromStackSlot when folding a COPY to a stack slot
reference in a target independent way.

The foldMemoryOperandImpl hook is going to change in the same way, but I'll wait
until COPY folding is actually implemented. Most targets only fold copies and
won't need to specialize this hook at all.

llvm-svn: 107991
2010-07-09 17:29:08 +00:00
Jakob Stoklund Olesen
6d64b42774 Remove invalid assert
llvm-svn: 107505
2010-07-02 19:54:47 +00:00
Jakob Stoklund Olesen
d969cfd17f Properly handle debug values during inline spilling.
llvm-svn: 107503
2010-07-02 19:54:40 +00:00
Jakob Stoklund Olesen
fc2900126b Rematerialize as much as possible before inserting spills and reloads.
This allows us to recognize the common case where all uses could be
rematerialized, and no stack slot allocation is necessary.

If some values could be fully rematerialized, remove them from the live range
before allocating a stack slot for the rest.

llvm-svn: 107492
2010-07-02 17:44:57 +00:00
Jakob Stoklund Olesen
860a99c62e Add memory operand folding support to InlineSpiller.
llvm-svn: 107355
2010-07-01 00:13:04 +00:00
Jakob Stoklund Olesen
1cd54efaf9 Add support for rematerialization to InlineSpiller.
llvm-svn: 107351
2010-06-30 23:03:52 +00:00
Jakob Stoklund Olesen
38c76cc88a Remember to track spill slot uses in VirtRegMap when inserting loads and stores.
LocalRewriter::runOnMachineFunction uses this information to mark dead spill
slots.

This means that InlineSpiller now also works for functions that spill.

llvm-svn: 107302
2010-06-30 18:19:08 +00:00
Jakob Stoklund Olesen
8918e475af Begin implementation of an inline spiller.
InlineSpiller inserts loads and spills immediately instead of deferring to
VirtRegMap. This is possible now because SlotIndexes allows instructions to be
inserted and renumbered.

This is work in progress, and is mostly a copy of TrivialSpiller so far. It
works very well for functions that don't require spilling.

llvm-svn: 107227
2010-06-29 23:58:39 +00:00