llvm-6502/lib
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
..
Analysis Fine grainify namespacification 2004-05-09 06:22:29 +00:00
Archive Use the true, decoded name of the archive member in getObjectType. 2004-03-31 19:51:00 +00:00
AsmParser Fix a memory leak. We leaked the vector holding the entries in switch tables. 2004-04-17 23:49:15 +00:00
Bytecode Squelch compile-time warning (profile build). 2004-04-28 15:32:09 +00:00
CodeGen Fix a really nasty bug from my changes on Monday to PHIElim. These changes 2004-05-12 21:47:57 +00:00
Debugger "fix" a nasty race condition 2004-01-14 21:18:03 +00:00
ExecutionEngine Generalize the strlen size_t hack, for the benefit of the other external 2004-05-01 06:42:15 +00:00
Linker Don't use invalid HTML in a doxygen comment. 2004-04-15 15:23:45 +00:00
Support Implement the new cl::PositionalEatsArgs flag, refactor code a bit 2004-05-06 22:04:31 +00:00
Target Second half of my fixed-sized-alloca patch. This folds the LEA to compute 2004-05-13 15:12:43 +00:00
Transforms Do not pass in the same argument to the extracted function more than once, and 2004-05-12 16:26:18 +00:00
VMCore Implement the AddPrototypes method 2004-05-09 04:29:57 +00:00
Makefile CBackend is no longer here 2004-02-13 23:29:37 +00:00