llvm-6502/lib
Evan Cheng 206d1856ad Added a linearscan register allocation optimization. When the register allocator spill an interval with multiple uses in the same basic block, it creates a different virtual register for each of the reloads. e.g.
%reg1498<def> = MOV32rm %reg1024, 1, %reg0, 12, %reg0, Mem:LD(4,4) [sunkaddr39 + 0]
        %reg1506<def> = MOV32rm %reg1024, 1, %reg0, 8, %reg0, Mem:LD(4,4) [sunkaddr42 + 0]
        %reg1486<def> = MOV32rr %reg1506
        %reg1486<def> = XOR32rr %reg1486, %reg1498, %EFLAGS<imp-def,dead>
        %reg1510<def> = MOV32rm %reg1024, 1, %reg0, 4, %reg0, Mem:LD(4,4) [sunkaddr45 + 0]

=>

        %reg1498<def> = MOV32rm %reg2036, 1, %reg0, 12, %reg0, Mem:LD(4,4) [sunkaddr39 + 0]
        %reg1506<def> = MOV32rm %reg2037, 1, %reg0, 8, %reg0, Mem:LD(4,4) [sunkaddr42 + 0]
        %reg1486<def> = MOV32rr %reg1506
        %reg1486<def> = XOR32rr %reg1486, %reg1498, %EFLAGS<imp-def,dead>
        %reg1510<def> = MOV32rm %reg2038, 1, %reg0, 4, %reg0, Mem:LD(4,4) [sunkaddr45 + 0]

From linearscan's point of view, each of reg2036, 2037, and 2038 are separate registers, each is "killed" after a single use. The reloaded register is available and it's often clobbered right away. e.g. In thise case reg1498 is allocated EAX while reg2036 is allocated RAX. This means we end up with multiple reloads from the same stack slot in the same basic block.

Now linearscan recognize there are other reloads from same SS in the same BB. So it'll "downgrade" RAX (and its aliases) after reg2036 is allocated until the next reload (reg2037) is done. This greatly increase the likihood reloads from SS are reused.

This speeds up sha1 from OpenSSL by 5.8%. It is also an across the board win for SPEC2000 and 2006.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 08:01:12 +00:00
..
Analysis Add a ScalarEvolution::getCouldNotCompute() function, and use it 2009-04-18 17:58:19 +00:00
Archive Add the private linkage. 2009-01-15 20:18:42 +00:00
AsmParser Fix warning in .ll parser, detect and reject available_externally on function 2009-04-13 07:02:02 +00:00
Bitcode Add a new "available_externally" linkage type. This is intended 2009-04-13 05:44:34 +00:00
CodeGen Added a linearscan register allocation optimization. When the register allocator spill an interval with multiple uses in the same basic block, it creates a different virtual register for each of the reloads. e.g. 2009-04-20 08:01:12 +00:00
CompilerDriver -write-graph now can be used with -o. 2009-03-27 12:57:14 +00:00
Debugger Oops...I committed too much. 2009-03-13 04:39:26 +00:00
ExecutionEngine Use an AssertingVH to detect the case where the Function was deleted but 2009-04-19 18:32:03 +00:00
Linker Add a new "available_externally" linkage type. This is intended 2009-04-13 05:44:34 +00:00
Support Make all raw_ostreams support the tell() function. 2009-04-20 07:34:17 +00:00
System Call CreateProcess with bInheritHandles = TRUE. 2009-04-14 21:31:36 +00:00
Target Fixed a few 64 bit cases in X86InstrInfo::commuteInstruction 2009-04-18 05:16:01 +00:00
Transforms Before trying to introduce/eliminate cast/ext/trunc to make indices type as 2009-04-20 06:05:54 +00:00
VMCore Limit the number of times we're willing to chase pointers. Removes an O(n^2) 2009-04-15 06:23:41 +00:00
Makefile Reorganize llvmc code. 2009-03-02 09:01:14 +00:00