LLVM backend for 6502
Go to file
Chris Lattner 020f714a93 If an indvar with a variable stride is used by the exit condition, go ahead
and handle it like constant stride vars.  This fixes some bad codegen in
variable stride cases.  For example, it compiles this:

void foo(int k, int i) {
  for (k=i+i; k <= 8192; k+=i)
    flags2[k] = 0;
}

to:

LBB1_1: #bb.preheader
        movl %eax, %ecx
        addl %ecx, %ecx
        movl L_flags2$non_lazy_ptr, %edx
LBB1_2: #bb
        movb $0, (%edx,%ecx)
        addl %eax, %ecx
        cmpl $8192, %ecx
        jle LBB1_2      #bb
LBB1_5: #return
        ret

or (if the array is local and we are in dynamic-nonpic or static mode):

LBB3_2: #bb
        movb $0, _flags2(%ecx)
        addl %eax, %ecx
        cmpl $8192, %ecx
        jle LBB3_2      #bb

and:

        lis r2, ha16(L_flags2$non_lazy_ptr)
        lwz r2, lo16(L_flags2$non_lazy_ptr)(r2)
        slwi r3, r4, 1
LBB1_2: ;bb
        li r5, 0
        add r6, r4, r3
        stbx r5, r2, r3
        cmpwi cr0, r6, 8192
        bgt cr0, LBB1_5 ;return

instead of:

        leal (%eax,%eax,2), %ecx
        movl %eax, %edx
        addl %edx, %edx
        addl L_flags2$non_lazy_ptr, %edx
        xorl %esi, %esi
LBB1_2: #bb
        movb $0, (%edx,%esi)
        movl %eax, %edi
        addl %esi, %edi
        addl %ecx, %esi
        cmpl $8192, %esi
        jg LBB1_5       #return

and:

        lis r2, ha16(L_flags2$non_lazy_ptr)
        lwz r2, lo16(L_flags2$non_lazy_ptr)(r2)
        mulli r3, r4, 3
        slwi r5, r4, 1
        li r6, 0
        add r2, r2, r5
LBB1_2: ;bb
        li r5, 0
        add r7, r3, r6
        stbx r5, r2, r6
        add r6, r4, r6
        cmpwi cr0, r7, 8192
        ble cr0, LBB1_2 ;bb

This speeds up Benchmarks/Shootout/sieve from 8.533s to 6.464s and
implements LoopStrengthReduce/var_stride_used_by_compare.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31809 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-17 06:17:33 +00:00
autoconf Undo removal of the runtime libraries. While this may have been a bit 2006-11-17 03:32:33 +00:00
docs Cleaned up the document. Added "doc_code" divisions for code examples. 2006-11-16 09:31:19 +00:00
examples For PR950: 2006-10-20 07:07:24 +00:00
include/llvm #ifndef NDEBUG the "if (Stream) ..." stuff. 2006-11-17 01:43:48 +00:00
lib If an indvar with a variable stride is used by the exit condition, go ahead 2006-11-17 06:17:33 +00:00
projects For PR950: 2006-11-08 06:47:33 +00:00
runtime Undo removal of the runtime libraries. While this may have been a bit 2006-11-17 03:32:33 +00:00
test New testcase. 2006-11-17 06:09:49 +00:00
tools Minor style fixes from review. 2006-11-11 19:59:25 +00:00
utils Add opcode to TargetInstrDescriptor. 2006-11-17 01:46:27 +00:00
win32 Remove obsolete VS project. 2006-11-05 19:38:20 +00:00
Xcode Try again. 2006-11-05 21:21:20 +00:00
.cvsignore Add llvm.spec, a generated file. 2006-10-18 19:23:56 +00:00
configure Undo removal of the runtime libraries. While this may have been a bit 2006-11-17 03:32:33 +00:00
CREDITS.TXT The list is sorted by name. 2006-08-29 01:42:47 +00:00
LICENSE.TXT burg is gone 2006-09-11 17:28:11 +00:00
llvm.spec.in Minor technical correction in documentation. 2006-08-21 01:58:57 +00:00
Makefile Undo removal of the runtime libraries. While this may have been a bit 2006-11-17 03:32:33 +00:00
Makefile.common Update comments to reflect new variable names. Patch contributed by 2005-02-14 16:02:19 +00:00
Makefile.config.in Undo removal of the runtime libraries. While this may have been a bit 2006-11-17 03:32:33 +00:00
Makefile.rules Undo removal of the runtime libraries. While this may have been a bit 2006-11-17 03:32:33 +00:00
README.txt Make the text of this file a little more useful. 2004-09-02 22:49:27 +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.