LLVM backend for 6502
Go to file
Chris Lattner 9f1b531090 Second half of my fixed-sized-alloca patch. This folds the LEA to compute
the alloca address into common operations like loads/stores.

In a simple testcase like this (which is just designed to excersize the
alloca A, nothing more):

int %test(int %X, bool %C) {
        %A = alloca int
        store int %X, int* %A
        store int* %A, int** %G
        br bool %C, label %T, label %F
T:
        call int %test(int 1, bool false)
        %V = load int* %A
        ret int %V
F:
        call int %test(int 123, bool true)
        %V2 = load int* %A
        ret int %V2
}

We now generate:

test:
        sub %ESP, 12
        mov %EAX, DWORD PTR [%ESP + 16]
        mov %CL, BYTE PTR [%ESP + 20]
***     mov DWORD PTR [%ESP + 8], %EAX
        mov %EAX, OFFSET G
        lea %EDX, DWORD PTR [%ESP + 8]
        mov DWORD PTR [%EAX], %EDX
        test %CL, %CL
        je .LBB2 # PC rel: F
.LBB1:  # T
        mov DWORD PTR [%ESP], 1
        mov DWORD PTR [%ESP + 4], 0
        call test
***     mov %EAX, DWORD PTR [%ESP + 8]
        add %ESP, 12
        ret
.LBB2:  # F
        mov DWORD PTR [%ESP], 123
        mov DWORD PTR [%ESP + 4], 1
        call test
***     mov %EAX, DWORD PTR [%ESP + 8]
        add %ESP, 12
        ret

Instead of:

test:
        sub %ESP, 20
        mov %EAX, DWORD PTR [%ESP + 24]
        mov %CL, BYTE PTR [%ESP + 28]
***     lea %EDX, DWORD PTR [%ESP + 16]
***     mov DWORD PTR [%EDX], %EAX
        mov %EAX, OFFSET G
        mov DWORD PTR [%EAX], %EDX
        test %CL, %CL
***     mov DWORD PTR [%ESP + 12], %EDX
        je .LBB2 # PC rel: F
.LBB1:  # T
        mov DWORD PTR [%ESP], 1
        mov %EAX, 0
        mov DWORD PTR [%ESP + 4], %EAX
        call test
***     mov %EAX, DWORD PTR [%ESP + 12]
***     mov %EAX, DWORD PTR [%EAX]
        add %ESP, 20
        ret
.LBB2:  # F
        mov DWORD PTR [%ESP], 123
        mov %EAX, 1
        mov DWORD PTR [%ESP + 4], %EAX
        call test
***     mov %EAX, DWORD PTR [%ESP + 12]
***     mov %EAX, DWORD PTR [%EAX]
        add %ESP, 20
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13557 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-13 15:12:43 +00:00
autoconf Refactor external benchmark checking stuff into one hairy 2004-04-16 17:13:33 +00:00
docs Reduce line length to about 80 chars. 2004-05-13 03:40:27 +00:00
examples/ModuleMaker Configure script for ModuleMaker. 2003-11-25 20:02:07 +00:00
include Fix a comment. 2004-05-12 21:57:23 +00:00
lib Second half of my fixed-sized-alloca patch. This folds the LEA to compute 2004-05-13 15:12:43 +00:00
projects Use inttypes.h, which exists on all of Linux, Solaris and Darwin. 2004-05-11 16:14:53 +00:00
runtime Share the profile info type enum with the C++ analysis libraries. 2004-05-04 16:51:48 +00:00
test Testcase for PR337, which was reduced by Reid Spencer. 2004-05-10 05:11:24 +00:00
tools Turn the block extractor on by default now that it basically works, eliminating the option. 2004-05-12 19:02:44 +00:00
utils Added `zeroinitializer' keyword. 2004-04-28 19:36:08 +00:00
.cvsignore Ok, try #2, this time I'll not be stupid 2003-08-03 18:33:24 +00:00
configure Regenerated using autoconf-2.57. 2004-04-16 17:13:44 +00:00
CREDITS.TXT Just testing the "Reid has CVS commit access" system 2004-05-06 18:06:18 +00:00
LICENSE.TXT Added obsequi. 2004-05-11 19:29:59 +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 Standardize header comments of top-level Makefiles. 2004-04-24 00:10:56 +00:00
Makefile.common Standardize header comments of top-level Makefiles. 2004-04-24 00:10:56 +00:00
Makefile.config.in Standardize header comments of top-level Makefiles. 2004-04-24 00:10:56 +00:00
Makefile.rules Standardize header comments of top-level Makefiles. 2004-04-24 00:10:56 +00:00
README.txt This file has been superseded by docs/index.html . 2004-05-12 02:48:30 +00:00

This file is a placeholder; see docs/index.html for documentation.