LLVM backend for 6502
Go to file
Hal Finkel bebe48dbfe Add a loop rerolling pass
This adds a loop rerolling pass: the opposite of (partial) loop unrolling. The
transformation aims to take loops like this:

for (int i = 0; i < 3200; i += 5) {
  a[i]     += alpha * b[i];
  a[i + 1] += alpha * b[i + 1];
  a[i + 2] += alpha * b[i + 2];
  a[i + 3] += alpha * b[i + 3];
  a[i + 4] += alpha * b[i + 4];
}

and turn them into this:

for (int i = 0; i < 3200; ++i) {
  a[i] += alpha * b[i];
}

and loops like this:

for (int i = 0; i < 500; ++i) {
  x[3*i] = foo(0);
  x[3*i+1] = foo(0);
  x[3*i+2] = foo(0);
}

and turn them into this:

for (int i = 0; i < 1500; ++i) {
  x[i] = foo(0);
}

There are two motivations for this transformation:

  1. Code-size reduction (especially relevant, obviously, when compiling for
code size).

  2. Providing greater choice to the loop vectorizer (and generic unroller) to
choose the unrolling factor (and a better ability to vectorize). The loop
vectorizer can take vector lengths and register pressure into account when
choosing an unrolling factor, for example, and a pre-unrolled loop limits that
choice. This is especially problematic if the manual unrolling was optimized
for a machine different from the current target.

The current implementation is limited to single basic-block loops only. The
rerolling recognition should work regardless of how the loop iterations are
intermixed within the loop body (subject to dependency and side-effect
constraints), but the significant restriction is that the order of the
instructions in each iteration must be identical. This seems sufficient to
capture all current use cases.

This pass is not currently enabled by default at any optimization level.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194939 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-16 23:59:05 +00:00
autoconf [autoconf] Prune "runtime" stuff in configure, corresponding to r191835. 2013-11-11 13:53:52 +00:00
bindings [OCaml] Add Target and TargetMachine bindings to Llvm_target 2013-11-15 02:51:57 +00:00
cmake Revert my CMake patches concerning building with /MT (r194589, r194596) 2013-11-13 20:29:10 +00:00
docs Mention address space related changes in release notes. 2013-11-16 00:36:46 +00:00
examples [weak vtables] Remove a bunch of weak vtables 2013-11-15 22:34:48 +00:00
include Add a loop rerolling pass 2013-11-16 23:59:05 +00:00
lib Add a loop rerolling pass 2013-11-16 23:59:05 +00:00
projects Revert "Revert "Windows: Add support for unicode command lines"" 2013-10-07 01:00:07 +00:00
test Add a loop rerolling pass 2013-11-16 23:59:05 +00:00
tools [weak vtables] Remove a bunch of weak vtables 2013-11-15 22:34:48 +00:00
unittests [weak vtables] Remove a bunch of weak vtables 2013-11-15 22:34:48 +00:00
utils gtest-death-test.cc: Move ~DeathTestFactory() to unbreak cygming build since r194865. 2013-11-16 05:26:49 +00:00
.arcconfig
.clang-format Add a clang-format file so that the tool can automatically detect the 2013-09-02 07:19:04 +00:00
.gitignore
CMakeLists.txt Revert my CMake patches concerning building with /MT (r194589, r194596) 2013-11-13 20:29:10 +00:00
CODE_OWNERS.TXT Update contact information. 2013-11-15 17:35:29 +00:00
configure [autoconf] Prune "runtime" stuff in configure, corresponding to r191835. 2013-11-11 13:53:52 +00:00
CREDITS.TXT Update contact information. 2013-11-15 17:35:29 +00:00
LICENSE.TXT
llvm.spec.in
LLVMBuild.txt Remove the very substantial, largely unmaintained legacy PGO 2013-10-02 15:42:23 +00:00
Makefile Remove the very substantial, largely unmaintained legacy PGO 2013-10-02 15:42:23 +00:00
Makefile.common
Makefile.config.in
Makefile.rules Teach the Makefile build system how to handle SOURCES which include 2013-11-14 23:51:29 +00:00
README.txt Revert "Test commit to check e-mail address. Please discard this." 2013-10-04 10:59:13 +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 documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you're writing a package for LLVM, see docs/Packaging.rst for our
suggestions.