LLVM backend for 6502
Go to file
Chris Lattner 5f2c7b1975 Teach the instruction selector how to transform 'array' GEP computations into X86
scaled indexes.  This allows us to compile GEP's like this:

int* %test([10 x { int, { int } }]* %X, int %Idx) {
        %Idx = cast int %Idx to long
        %X = getelementptr [10 x { int, { int } }]* %X, long 0, long %Idx, ubyte 1, ubyte 0
        ret int* %X
}

Into a single address computation:

test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, DWORD PTR [%ESP + 8]
        lea %EAX, DWORD PTR [%EAX + 8*%ECX + 4]
        ret

Before it generated:
test:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, DWORD PTR [%ESP + 8]
        shl %ECX, 3
        add %EAX, %ECX
        lea %EAX, DWORD PTR [%EAX + 4]
        ret

This is useful for things like int/float/double arrays, as the indexing can be folded into
the loads&stores, reducing register pressure and decreasing the pressure on the decode unit.
With these changes, I expect our performance on 256.bzip2 and gzip to improve a lot.  On
bzip2 for example, we go from this:

10665 asm-printer           - Number of machine instrs printed
   40 ra-local              - Number of loads/stores folded into instructions
 1708 ra-local              - Number of loads added
 1532 ra-local              - Number of stores added
 1354 twoaddressinstruction - Number of instructions added
 1354 twoaddressinstruction - Number of two-address instructions
 2794 x86-peephole          - Number of peephole optimization performed

to this:
9873 asm-printer           - Number of machine instrs printed
  41 ra-local              - Number of loads/stores folded into instructions
1710 ra-local              - Number of loads added
1521 ra-local              - Number of stores added
 789 twoaddressinstruction - Number of instructions added
 789 twoaddressinstruction - Number of two-address instructions
2142 x86-peephole          - Number of peephole optimization performed

... and these types of instructions are often in tight loops.

Linear scan is also helped, but not as much.  It goes from:

8787 asm-printer           - Number of machine instrs printed
2389 liveintervals         - Number of identity moves eliminated after coalescing
2288 liveintervals         - Number of interval joins performed
3522 liveintervals         - Number of intervals after coalescing
5810 liveintervals         - Number of original intervals
 700 spiller               - Number of loads added
 487 spiller               - Number of stores added
 303 spiller               - Number of register spills
1354 twoaddressinstruction - Number of instructions added
1354 twoaddressinstruction - Number of two-address instructions
 363 x86-peephole          - Number of peephole optimization performed

to:

7982 asm-printer           - Number of machine instrs printed
1759 liveintervals         - Number of identity moves eliminated after coalescing
1658 liveintervals         - Number of interval joins performed
3282 liveintervals         - Number of intervals after coalescing
4940 liveintervals         - Number of original intervals
 635 spiller               - Number of loads added
 452 spiller               - Number of stores added
 288 spiller               - Number of register spills
 789 twoaddressinstruction - Number of instructions added
 789 twoaddressinstruction - Number of two-address instructions
 258 x86-peephole          - Number of peephole optimization performed

Though I'm not complaining about the drop in the number of intervals.  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11820 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-25 07:00:55 +00:00
autoconf small portability fix. 2004-02-24 22:58:31 +00:00
docs Fixed minor typos. 2004-02-24 16:13:56 +00:00
examples/ModuleMaker Configure script for ModuleMaker. 2003-11-25 20:02:07 +00:00
include Cygwin defines log2 as a macro. Undef it here IFF it has already been defined, 2004-02-25 01:53:45 +00:00
lib Teach the instruction selector how to transform 'array' GEP computations into X86 2004-02-25 07:00:55 +00:00
projects Remove dependence on the return type of ConstantArray::get 2004-02-15 04:05:58 +00:00
runtime Build an archive for use with Povray. 2004-02-20 21:26:46 +00:00
test New testcase. Switch instructions that go to switch instructions should be 2004-02-24 07:21:09 +00:00
tools Include Config/config.h for SHLIBEXT. 2004-02-23 22:42:51 +00:00
utils Add a label for the bump when we started counting llvm/projects 2004-02-18 20:27:06 +00:00
.cvsignore Ok, try #2, this time I'll not be stupid 2003-08-03 18:33:24 +00:00
configure Added the VTune tests. 2004-02-24 21:43:38 +00:00
CREDITS.TXT Added Stacker to Reid Spencer's list of contributions. 2003-12-17 18:15:04 +00:00
LICENSE.TXT we no longer include boost 2004-02-24 04:02:20 +00:00
llvm.spec RPM spec file for LLVM tools and libraries. 2004-02-10 03:57:51 +00:00
llvm.spec.in RPM spec file for LLVM tools and libraries. 2004-02-10 03:57:51 +00:00
Makefile Should fix pr220 - "make install" doesn't install header files when 2004-02-10 01:10:01 +00:00
Makefile.common Added LLVM copyright notice. 2003-10-21 14:33:46 +00:00
Makefile.config.in Added the POVRAY_ROOT to locate Povray. 2004-02-20 22:30:46 +00:00
Makefile.rules Define DEPRECATED so that it can be used in function and variable 2004-02-13 20:05:44 +00:00
README.txt Merged in RELEASE_1. 2003-10-27 18:02:06 +00:00

                       The LLVM Compiler Infrastructure
                           http://llvm.cs.uiuc.edu

Welcome to LLVM!
----------------
This file is intended to do four things:
(1) help you get started using LLVM;
(2) tell you how to get questions about LLVM answered;
(3) tell you where to find documentation for different kinds of questions; and
(4) tell you about three LLVM-related mailing lists.


Getting Started with LLVM
-------------------------

(1) For license information:
    llvm/LICENSE.txt

(2) Installing and compiling LLVM:
    llvm/docs/GettingStarted.html

(3) Learn about features and limitations of this release:
    llvm/docs/ReleaseNotes.html

(4) Learn how to write a pass within the LLVM system:
	llvm/docs/WritingAnLLVMPass.html

(5) Learn how to start a new development project using LLVM, where your
    new source code can live anywhere (outside or inside the LLVM tree),
    while using LLVM header files and libraries:
    llvm/docs/Projects.html


Getting Help with LLVM
----------------------

(1) If you have questions or development problems not answered in the
    documentation, send e-mail to llvmdev@cs.uiuc.edu.  This mailing list is
    monitored by all the people in the LLVM group at Illinois, and you should
    expect prompt first responses.

(2) To report a bug, submit a bug report as described in the document:
    http://llvm.cs.uiuc.edu/docs/HowToSubmitABug.html

(3) We now use Bugzilla to track bugs, so you can check the status of
    previous bugs at:
    http://llvm.cs.uiuc.edu/bugs/query.cgi

LLVM Documentation
------------------

All the documents mentioned below except the design overview tech report
are included as part of the LLVM release (in llvm/docs/*):

LLVM Design Overview:
    LLVM : A Compilation Framework for Lifelong Program Analysis
    and Transformation:
        http://llvm.cs.uiuc.edu/pubs/2003-09-30-LifelongOptimizationTR.html

LLVM User Guides:

    Download and Installation Instructions:
        llvm/docs/GettingStarted.html

    LLVM Command Guide:
        llvm/docs/CommandGuide/index.html

    LLVM Assembly Language:
        llvm/docs/LangRef.html

    LLVM Test Suite Guide:
        llvm/docs/TestingGuide.html

LLVM Programming Documentation:

    LLVM Programmers Manual:
        llvm/docs/ProgrammersManual.html

    Writing an LLVM Pass:
        llvm/docs/WritingAnLLVMPass.html

    Alias Analysis in LLVM:
        llvm/docs/AliasAnalysis.html

    Command Line Library:
        llvm/docs/CommandLine.html

    Coding Standards:
        llvm/docs/CodingStandards.html

Other LLVM Resources:

    Submitting a Bug:
        http://llvm.cs.uiuc.edu/docs/HowToSubmitABug.html

    Open Projects:
        llvm/docs/OpenProjects.html

    Creating a new LLVM Project:
        llvm/docs/Projects.html

Mailing Lists
--------------
There are three mailing lists for providing LLVM users with information:

(1) LLVM Announcements List:
    http://mail.cs.uiuc.edu/mailman/listinfo/llvm-announce

    This is a low volume list that provides important announcements regarding
    LLVM.  It is primarily intended to announce new releases, major updates to
    the software, etc.  This list is highly recommended for anyone that uses
    LLVM.

(2) LLVM Developers List:
    http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev

    This list is for people who want to be included in technical discussions
    of LLVM.  People post to this list when they have questions about writing
    code for or using the LLVM tools.  It is relatively low volume.

(3) LLVM Commits List
    http://mail.cs.uiuc.edu/mailman/listinfo/llvm-commits

    This list contains all commit messages that are made when LLVM developers
    commit code changes to the CVS archive.  It is useful for those who want to
    stay on the bleeding edge of LLVM development. This list is very high
    volume.