LLVM backend for 6502
Go to file
Jingyue Wu 6156e562ef Fixed several correctness issues in SeparateConstOffsetFromGEP
Most issues are on mishandling s/zext.

Fixes:

1. When rebuilding new indices, s/zext should be distributed to
sub-expressions. e.g., sext(a +nsw (b +nsw 5)) = sext(a) + sext(b) + 5 but not
sext(a + b) + 5. This also affects the logic of recursively looking for a
constant offset, we need to include s/zext into the context of the searching.

2. Function find should return the bitwidth of the constant offset instead of
always sign-extending it to i64.

3. Stop shortcutting zext'ed GEP indices. LLVM conceptually sign-extends GEP
indices to pointer-size before computing the address. Therefore, gep base,
zext(a + b) != gep base, a + b

Improvements:

1. Add an optimization for splitting sext(a + b): if a + b is proven
non-negative (e.g., used as an index of an inbound GEP) and one of a, b is
non-negative, sext(a + b) = sext(a) + sext(b)

2. Function Distributable checks whether both sext and zext can be distributed
to operands of a binary operator. This helps us split zext(sext(a + b)) to
zext(sext(a) + zext(sext(b)) when a + b does not signed or unsigned overflow.

Refactoring:

Merge some common logic of handling add/sub/or in find.

Testing:

Add many tests in split-gep.ll and split-gep-and-gvn.ll to verify the changes
we made.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210291 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-05 22:07:33 +00:00
autoconf Remove path_tclsh.m4. 2014-06-02 12:54:32 +00:00
bindings
cmake GraphWriter: detect graph viewer programs at runtime 2014-06-02 01:40:04 +00:00
docs Add a new attribute called 'jumptable' that creates jump-instruction tables for functions marked with this attribute. 2014-06-05 19:29:43 +00:00
examples
include Add "-format darwin" to llvm-nm to be like darwin's nm(1) -m output. 2014-06-05 21:21:57 +00:00
lib Fixed several correctness issues in SeparateConstOffsetFromGEP 2014-06-05 22:07:33 +00:00
projects
test Fixed several correctness issues in SeparateConstOffsetFromGEP 2014-06-05 22:07:33 +00:00
tools Add "-format darwin" to llvm-nm to be like darwin's nm(1) -m output. 2014-06-05 21:21:57 +00:00
unittests Make this operator bool() explicit to match the standard library. 2014-06-03 04:42:24 +00:00
utils really fix the windows build. 2014-05-31 03:40:00 +00:00
.arcconfig
.clang-format
.gitignore
CMakeLists.txt AArch64/ARM64: move ARM64 into AArch64's place 2014-05-24 12:50:23 +00:00
CODE_OWNERS.TXT
configure Don't hard-code ld when extracting host linker version, use ${LD} if 2014-05-28 15:12:55 +00:00
CREDITS.TXT Update Credits. 2014-05-29 19:59:58 +00:00
LICENSE.TXT
llvm.spec.in
LLVMBuild.txt
Makefile
Makefile.common
Makefile.config.in
Makefile.rules autoconf: Fix libLLVM-Major-Minor-Patch.so symlink 2014-05-15 19:50:25 +00:00
README.txt

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.