LLVM backend for 6502
Go to file
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
autoconf Revert 69474 and 69475. They are causing failures during a bootstrap on Darwin. 2009-04-18 21:45:27 +00:00
bindings Fix ocaml bindings; add "available_externally" linkage type. 2009-04-13 07:02:32 +00:00
cmake CMake: Added notes pointing to the LLVM CMake documentation. 2009-04-04 22:52:02 +00:00
docs Make it clearer that llvm-gcc is not needed for 2009-04-18 12:40:19 +00:00
examples silence a warning. 2009-04-15 00:16:05 +00:00
include Make all raw_ostreams support the tell() function. 2009-04-20 07:34:17 +00:00
lib 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
projects Revert r67655 and r67656, as they are breaking the build. I'm 2009-03-25 00:52:11 +00:00
runtime Drop toy GC runtime. 2009-03-02 03:46:48 +00:00
test 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
tools Revert 69474 and 69475. They are causing failures during a bootstrap on Darwin. 2009-04-18 21:45:27 +00:00
unittests Fix pointer casting problem. 2009-04-09 03:10:03 +00:00
utils Add some assertions. 2009-04-19 00:22:35 +00:00
website Prepare for "core" website. 2007-08-03 05:43:35 +00:00
win32 Update hand-crafted VC++ build. 2009-02-02 19:22:02 +00:00
Xcode Remove Stacker.html from Xcode project. 2008-10-14 23:23:59 +00:00
build-for-llvm-top.sh Patch to build llvm with srcdir != objdir from 2009-01-23 08:42:38 +00:00
CMakeLists.txt CMake: Added notes pointing to the LLVM CMake documentation. 2009-04-04 22:52:02 +00:00
configure Revert 69474 and 69475. They are causing failures during a bootstrap on Darwin. 2009-04-18 21:45:27 +00:00
CREDITS.TXT Test commit access to LLVM with some minor narcissism. 2009-04-03 21:41:52 +00:00
LICENSE.TXT Another great year for LLVM! 2009-02-26 15:17:13 +00:00
llvm.spec.in * llvm.spec.in: update blurb 2007-07-13 09:48:29 +00:00
Makefile Remove ccc now. Radar 6737767 2009-04-07 20:29:25 +00:00
Makefile.common Removed trailing whitespace from Makefiles. 2009-01-09 16:44:42 +00:00
Makefile.config.in Add a --enable-profiling option to configure to build Debug+Profile and 2009-04-17 14:49:22 +00:00
Makefile.rules Add a --enable-profiling option to configure to build Debug+Profile and 2009-04-17 14:49:22 +00:00
ModuleInfo.txt Patch to build llvm with srcdir != objdir from 2009-01-23 08:42:38 +00:00
README.txt README.txt: test commit w/blank line appended 2009-03-23 21:00:45 +00:00

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for the Low Level 
Virtual Machine, a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments. 

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the HTML documentation provided in docs/index.html for further
assistance with LLVM.