LLVM backend for 6502
Go to file
James Molloy bb96dfcf4f MachineCopyPropagation has special logic for removing COPY instructions. It will remove plain COPYs using eraseFromParent(), but if the COPY has imp-defs/imp-uses it will convert it to a KILL, to keep the imp-def around.
This actually totally breaks and causes the machine verifier to cry in several cases, one of which being:

%RAX<def> = COPY %RCX<kill>
%ECX<def> = COPY %EAX<kill>, %RAX<imp-use,kill>

These subregister copies are together identified as noops, so are both removed. However, the second one as it has an imp-use gets converted into a kill:

%ECX<def> = KILL %EAX<kill>, %RAX<imp-use,kill>

As the original COPY has been removed, the verifier goes into tears at the use of undefined EAX and RAX.

There are several hacky solutions to this hacky problem (which is all to do with imp-use/def weirdnesses), but the least hacky I've come up with is to *always* remove COPYs by converting to KILLs. KILLs are no-ops to the code generator so the generated code doesn't change (which is why they were partially used in the first place), but using them also keeps the def/use and imp-def/imp-use chains alive:

%RAX<def> = KILL %RCX<kill>
%ECX<def> = KILL %EAX<kill>, %RAX<imp-use,kill>

The patch passes all test cases including the ones that check the removal of MOVs in this circumstance, along with an extra test I added to check subregister behaviour (which made the machine verifier fall over before my patch).

The patch also adds some DEBUG() statements because the file hadn't got any.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199797 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-22 09:12:27 +00:00
autoconf Use a heavier hammer when --enable-libcpp is passed to bypass the tests 2014-01-15 21:21:48 +00:00
bindings Makefile.ocaml: Tweak to use --system-libs. 2013-12-20 00:36:59 +00:00
cmake Don't clobber CMAKE_REQUIRED_FLAGS, it ends up being used in 2014-01-21 18:09:19 +00:00
docs Revert my commit in r199620 that added sections about namespaces to the 2014-01-20 10:15:32 +00:00
examples [cleanup] Re-sort the examples #include lines with my sort_includes 2014-01-13 09:58:03 +00:00
include Add unused result attr to the casting templates 2014-01-22 07:28:49 +00:00
lib MachineCopyPropagation has special logic for removing COPY instructions. It will remove plain COPYs using eraseFromParent(), but if the COPY has imp-defs/imp-uses it will convert it to a KILL, to keep the imp-def around. 2014-01-22 09:12:27 +00:00
projects
test MachineCopyPropagation has special logic for removing COPY instructions. It will remove plain COPYs using eraseFromParent(), but if the COPY has imp-defs/imp-uses it will convert it to a KILL, to keep the imp-def around. 2014-01-22 09:12:27 +00:00
tools Whitespace. 2014-01-22 03:12:43 +00:00
unittests [APInt] Fix nearestLogBase2 to return correct answers for very large APInt and APInt with a bitwidth of 1. 2014-01-19 20:33:48 +00:00
utils Use ArrayRef to simplify some code. 2014-01-21 07:20:05 +00:00
.arcconfig
.clang-format
.gitignore
CMakeLists.txt [CMake] Introduce new scheme of LLVM_TOOLS_BINARY_DIR and LLVM_LIBRARY_DIR 2014-01-19 12:52:10 +00:00
CODE_OWNERS.TXT
configure Use a heavier hammer when --enable-libcpp is passed to bypass the tests 2014-01-15 21:21:48 +00:00
CREDITS.TXT Fix documentation typos 2013-12-20 00:33:39 +00:00
LICENSE.TXT Update the copyright credits -- Happy new year 2014! 2014-01-01 08:27:31 +00:00
llvm.spec.in
LLVMBuild.txt
Makefile Fix bad variable syntax in r199413 2014-01-17 00:40:39 +00:00
Makefile.common
Makefile.config.in
Makefile.rules [Mips]Work around MIPS linker issues exposed by commit r198087 until bug 18360 is resolved 2014-01-03 22:18:43 +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.