1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

56 Commits

Author SHA1 Message Date
Owen Anderson
f2fea95f2f Reapply r110396, with fixes to appease the Linux buildbot gods.
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Devang Patel
14cb55ddfe While emitting DBG_VALUE for registers spilled at the end of a block do not use location of MBB->end(). If a block does not have terminator then incoming iterator points to end().
llvm-svn: 110411
2010-08-06 00:26:18 +00:00
Owen Anderson
aadd8a89ca Revert r110396 to fix buildbots.
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
b9762c07cb Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier.  Clean up APIs related to this change.

llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Devang Patel
cd5912c7bf While spilling live registers at the end of block check whether they are used by DBG_VALUE machine instructions or not. If a spilled register is used by DBG_VALUE machine instruction then insert a new DBG_VALUE machine instruction to encode variable's new location on stack.
llvm-svn: 110235
2010-08-04 18:42:02 +00:00
Jakob Stoklund Olesen
7f337a8e64 Fix a bug in the -regalloc=fast handling of exotic two-address instruction with
multiple defs, like t2LDRSB_POST.

The first def could accidentally steal the physreg that the second, tied def was
required to be allocated to.

Now, the tied use-def is treated more like an early clobber, and the physreg is
reserved before allocating the other defs.

This would never be a problem when the tied def was the only def which is the
usual case.

This fixes MallocBench/gs for thumb2 -O0.

llvm-svn: 109715
2010-07-29 00:52:19 +00:00
Devang Patel
3b57155acd Fix memory leak reported by valgrind.
Do not visit operands of old instruction. Visit all operands of new instruction.

llvm-svn: 108767
2010-07-19 23:25:39 +00:00
Jakob Stoklund Olesen
bcee53a2b8 Remove many calls to TII::isMoveInstr. Targets should be producing COPY anyway.
TII::isMoveInstr is going tobe completely removed.

llvm-svn: 108507
2010-07-16 04:45:42 +00:00
Devang Patel
118d642573 Update DBG_VALUE to refer appropriate stack slot in case of a spill.
llvm-svn: 108023
2010-07-09 21:48:31 +00:00
Jakob Stoklund Olesen
dba28ee3d8 Detect and handle COPY in many places.
This code is transitional, it will soon be possible to eliminate
isExtractSubreg, isInsertSubreg, and isMoveInstr in most places.

llvm-svn: 107547
2010-07-03 00:04:37 +00:00
Jakob Stoklund Olesen
fff50dd31d Fix the handling of partial redefines in the fast register allocator.
A partial redefine needs to be treated like a tied operand, and the register
must be reloaded while processing use operands.

This fixes a bug where partially redefined registers were processed as normal
defs with a reload added. The reload could clobber another use operand if it was
a kill that allowed register reuse.

llvm-svn: 107193
2010-06-29 19:15:30 +00:00
Jakob Stoklund Olesen
2ec7bf335a Add more special treatment for inline asm in RegAllocFast.
When an instruction has tied operands and physreg defines, we must take extra
care that the tied operands conflict with neither physreg defs nor uses.

The special treatment is given to inline asm and instructions with tied operands
/ early clobbers and physreg defines.

This fixes PR7509.

llvm-svn: 107043
2010-06-28 18:34:34 +00:00
Jakob Stoklund Olesen
88e1f2b2b5 Avoid processing early clobbers twice in RegAllocFast.
Early clobbers defining a virtual register were first alocated to a physreg and
then processed as a physreg EC, spilling the virtreg.

This fixes PR7382.

llvm-svn: 105998
2010-06-15 16:20:57 +00:00
Jakob Stoklund Olesen
90af6a44c3 Keep track of the call instructions whose clobber lists were skipped during fast
register allocation.

Process all of the clobber lists at the end of the function, marking the
registers as used in MachineRegisterInfo.

This is necessary in case the calls clobber callee-saved registers (sic).

llvm-svn: 105473
2010-06-04 18:08:29 +00:00
Jakob Stoklund Olesen
f41b1697fe Add support for partial redefs to the fast register allocator.
A partial redef now triggers a reload if required. Also don't add
<imp-def,dead> operands for physical superregisters.

Kill flags are still treated as full register kills, and <imp-use,kill> operands
are added for physical superregisters as before.

llvm-svn: 104167
2010-05-19 21:36:05 +00:00
Jakob Stoklund Olesen
1d0a54cb9d Properly handle multiple definitions of a virtual register in the same
instruction.

This can happen on ARM:

>> %reg1035:5<def>, %reg1035:6<def> = VLD1q16 %reg1028, 0, pred:14, pred:%reg0
Regs: Q0=%reg1032* R0=%reg1028* R1=%reg1029* R2 R3=%reg1031*
Killing last use: %reg1028
Allocating %reg1035 from QPR
Assigning %reg1035 to Q1
<< %D2<def>, %D3<def> = VLD1q16 %R0<kill>, 0, pred:14, pred:%reg0, %Q1<imp-def>

llvm-svn: 104056
2010-05-18 21:10:50 +00:00
Jakob Stoklund Olesen
7182505241 Pull the UsedInInstr.test() calls into calcSpillCost() and remember aliases.
This fixes the miscompilations of MultiSource/Applications/JM/l{en,de}cod.
Clang now successfully self hosts in a debug build with the fast register allocator.

llvm-svn: 103975
2010-05-17 21:02:08 +00:00
Jakob Stoklund Olesen
7fdbac6a38 Remove debug option. Add comment on spill order determinism.
llvm-svn: 103961
2010-05-17 20:01:22 +00:00
Jakob Stoklund Olesen
c07fd51d56 Avoid allocating the same physreg to multiple virtregs in one instruction.
While that approach works wonders for register pressure, it tends to break
everything.

This should unbreak the arm-linux builder and fix a number of miscompilations.

llvm-svn: 103946
2010-05-17 17:18:59 +00:00
Jakob Stoklund Olesen
c97d3f5b78 Minor optimizations. DenseMap::begin() is surprisingly slow on an empty map.
llvm-svn: 103940
2010-05-17 15:30:37 +00:00
Jakob Stoklund Olesen
a9f77dbb8f Extract spill cost calculation to a new method, and use definePhysReg() to clear
out aliases when allocating. Clean up allocVirtReg().

Use calcSpillCost() to allow more aggressive hinting. Now the hint is always
taken unless blocked by a reserved register. This leads to more coalescing,
lower register pressure, and less spilling.

llvm-svn: 103939
2010-05-17 15:30:32 +00:00
Jakob Stoklund Olesen
40545bf117 Only use clairvoyance when defining a register, and then only if it has one use.
This makes allocation independent on the ordering of use-def chains.

llvm-svn: 103935
2010-05-17 04:50:57 +00:00
Jakob Stoklund Olesen
f7bef21e58 Eliminate a hash table probe when killing virtual registers.
llvm-svn: 103934
2010-05-17 03:26:09 +00:00
Jakob Stoklund Olesen
ab401cc7c3 Execute virtreg kills immediately instead of after processing all uses.
This is safe to do because the physreg has been marked UsedInInstr and the kill flag will be set on the last operand using the virtreg if there are more then one.

llvm-svn: 103933
2010-05-17 03:26:06 +00:00
Jakob Stoklund Olesen
f00cf55938 Sprinkle superregister <imp-def> and <imp-kill> operands when dealing with subregister indices.
llvm-svn: 103931
2010-05-17 02:49:21 +00:00
Jakob Stoklund Olesen
f9bfd996b3 Now that we don't keep live registers across calls, there is not reason to go
through the very long list of call-clobbered registers. We just assume all
registers are clobbered.

llvm-svn: 103930
2010-05-17 02:49:18 +00:00
Jakob Stoklund Olesen
39dbedba34 Boldly attempt consistent capitalization. Functional changes unintended.
llvm-svn: 103929
2010-05-17 02:49:15 +00:00
Jakob Stoklund Olesen
cfae258409 Spill and kill all virtual registers across a call.
Debug code doesn't use callee saved registers anyway, and the code is simpler this way. Now spillVirtReg always kills, and the isKill parameter is not needed.

llvm-svn: 103927
2010-05-17 02:07:32 +00:00
Jakob Stoklund Olesen
ef65f26906 Reduce hashtable probes by using DenseMap::insert() for lookup.
llvm-svn: 103926
2010-05-17 02:07:29 +00:00
Jakob Stoklund Olesen
f5593b76bc Make MBB a class member instead of passing it around everywhere.
llvm-svn: 103925
2010-05-17 02:07:22 +00:00
Chandler Carruth
8aee521671 Fix an GCC warning that seems to have actually caught a bug (!!!) in
a condition's grouping. Every other use of Allocatable.test(Hint) groups it the
same way as it is indented, so move the parentheses to agree with that
grouping.

llvm-svn: 103869
2010-05-15 10:23:23 +00:00
Jakob Stoklund Olesen
671a452627 Calculate liveness on the fly for local registers.
When working top-down in a basic block, substituting physregs for virtregs, the use-def chains are kept up to date. That means we can recognize a virtreg kill by the use-def chain becoming empty.

This makes the fast allocator independent of incoming kill flags.

llvm-svn: 103866
2010-05-15 06:09:08 +00:00
Jakob Stoklund Olesen
7a16481068 Don't bother spilling before a return
llvm-svn: 103831
2010-05-14 22:40:43 +00:00
Jakob Stoklund Olesen
21bd5b7fbb Track allocatable instead of reserved regs, and never take an unallocatable hint.
llvm-svn: 103828
2010-05-14 22:02:56 +00:00
Jakob Stoklund Olesen
295d11f215 Avoid scanning the long tail of physreg operands on calls
llvm-svn: 103823
2010-05-14 21:55:52 +00:00
Jakob Stoklund Olesen
83d4c31c0b Count coalesced copies
llvm-svn: 103821
2010-05-14 21:55:50 +00:00
Jakob Stoklund Olesen
89a21b1cc3 Allow virtreg redefines when verifying for RegAllocFast
llvm-svn: 103820
2010-05-14 21:55:44 +00:00
Jakob Stoklund Olesen
4715605740 When verifying two-address instructions, check the following:
- Kill is implicit when use and def registers are identical.
- Only virtual registers can differ.

Add a -verify-fast-regalloc to run the verifier before the fast allocator.

llvm-svn: 103797
2010-05-14 20:28:32 +00:00
Jakob Stoklund Olesen
3eac02b22f Simplify the handling of physreg defs and uses in RegAllocFast.
This adds extra security against using clobbered physregs, and it adds kill
markers to physreg uses.

llvm-svn: 103784
2010-05-14 18:03:25 +00:00
Jakob Stoklund Olesen
892983155c Enable opportunistic coalescing
llvm-svn: 103764
2010-05-14 04:30:51 +00:00
Jakob Stoklund Olesen
f913d9f2b8 Trust kill flags from isel and later passes.
llvm-svn: 103748
2010-05-14 00:02:23 +00:00
Jakob Stoklund Olesen
aa38789fd4 Fix an embarrassing runtime regression for RegAllocFast.
This loop is quadratic in the capacity for a DenseMap:

  while(!map.empty())
    map.erase(map.begin());

Instead we now do a normal begin() - end() iteration followed by map.clear().
That also has the nice sideeffect of shrinking the map capacity on demand.

llvm-svn: 103747
2010-05-14 00:02:20 +00:00
Jakob Stoklund Olesen
b698dfd8c7 Clean up RegAllocFast debug output
llvm-svn: 103739
2010-05-13 20:43:17 +00:00
Jakob Stoklund Olesen
d99818256c Take allocation hints from copy instructions to/from physregs.
This causes way more identity copies to be generated, ripe for coalescing.

llvm-svn: 103686
2010-05-13 00:19:43 +00:00
Jakob Stoklund Olesen
69f3ae8789 More asserts around physreg uses
llvm-svn: 103685
2010-05-13 00:19:39 +00:00
Jakob Stoklund Olesen
7d1323d9a5 Make sure to add kill flags to the last use of a virtreg when it is redefined.
The X86 floating point stack pass and others depend on good kill flags.

llvm-svn: 103635
2010-05-12 18:46:03 +00:00
Jakob Stoklund Olesen
b3ca444697 Avoid scoping issues, fix buildbots
llvm-svn: 103530
2010-05-12 00:11:19 +00:00
Daniel Dunbar
5d81e1a0bf Make Clang happy.
llvm-svn: 103528
2010-05-11 23:53:13 +00:00
Jakob Stoklund Olesen
e6eee8913f Store the Dirty bit in the LiveReg structure instead of a bit vector.
llvm-svn: 103522
2010-05-11 23:24:47 +00:00
Jakob Stoklund Olesen
063844f706 Keep track of the last place a live virtreg was used.
This allows us to add accurate kill markers, something the scavenger likes.
Add some more tests from ARM that needed this.

llvm-svn: 103521
2010-05-11 23:24:45 +00:00