LLVM backend for 6502
Go to file
Chris Lattner 50fad70279 Teach LSR to strength reduce IVs that have a loop-invariant but non-constant stride.
For code like this:

void foo(float *a, float *b, int n, int stride_a, int stride_b) {
  int i;
  for (i=0; i<n; i++)
      a[i*stride_a] = b[i*stride_b];
}

we now emit:

.LBB_foo2_2:    ; no_exit
        lfs f0, 0(r4)
        stfs f0, 0(r3)
        addi r7, r7, 1
        add r4, r2, r4
        add r3, r6, r3
        cmpw cr0, r7, r5
        blt .LBB_foo2_2 ; no_exit

instead of:

.LBB_foo_2:     ; no_exit
        mullw r8, r2, r7     ;; multiply!
        slwi r8, r8, 2
        lfsx f0, r4, r8
        mullw r8, r2, r6     ;; multiply!
        slwi r8, r8, 2
        stfsx f0, r3, r8
        addi r2, r2, 1
        cmpw cr0, r2, r5
        blt .LBB_foo_2  ; no_exit

loops with variable strides occur pretty often.  For example, in SPECFP2K
there are 317 variable strides in 177.mesa, 3 in 179.art, 14 in 188.ammp,
56 in 168.wupwise, 36 in 172.mgrid.

Now we can allow indvars to turn functions written like this:

void foo2(float *a, float *b, int n, int stride_a, int stride_b) {
  int i, ai = 0, bi = 0;
  for (i=0; i<n; i++)
    {
      a[ai] = b[bi];
      ai += stride_a;
      bi += stride_b;
    }
}

into code like the above for better analysis.  With this patch, they generate
identical code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22740 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-10 00:45:21 +00:00
autoconf Fix PR608: 2005-07-27 21:58:38 +00:00
docs Update a doc, patch contributed by Jim Laskey! 2005-08-02 19:14:25 +00:00
examples Eliminate all remaining tabs and trailing spaces. 2005-07-27 06:12:32 +00:00
include/llvm add two helper methods 2005-08-09 23:36:18 +00:00
lib Teach LSR to strength reduce IVs that have a loop-invariant but non-constant stride. 2005-08-10 00:45:21 +00:00
projects oops 2005-07-05 16:36:18 +00:00
runtime Remove trailing whitespace 2005-04-21 23:48:37 +00:00
test new testcase 2005-08-10 00:33:01 +00:00
tools If the user interrupts bugpoint, don't extract loops 2005-08-02 23:25:56 +00:00
utils make is the standard name, not gmake 2005-08-02 00:10:52 +00:00
win32 Fix VC++ build problems. 2005-07-30 18:22:27 +00:00
.cvsignore Ignore the configure.out file generated by "make reconfigure" 2005-06-18 23:01:25 +00:00
configure Fix PR608: 2005-07-27 21:58:38 +00:00
CREDITS.TXT Add a note, people are responsible for requesting that they be added to the 2005-08-02 22:10:21 +00:00
LICENSE.TXT Remove extraneous colons after program names for consistency 2005-05-12 21:39:01 +00:00
llvm.spec Onward to LLVM-1.6 and beyond! 2005-05-18 20:23:20 +00:00
llvm.spec.in Onward to LLVM-1.6 and beyond! 2005-05-18 20:23:20 +00:00
Makefile Make sure the tools get built if no build target is specified. 2005-05-29 00:49:24 +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 Two changes: 2005-04-22 17:14:14 +00:00
Makefile.rules No, really, it's an Alpha! And you probably thought it was a PowerPC. 2005-07-22 22:43:40 +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.