LLVM backend for 6502
Go to file
Jakob Stoklund Olesen ded2e3b0d0 LowerSubregsInstructionPass::LowerExtract should not extend the live range of registers.
When LowerExtract eliminates an EXTRACT_SUBREG with a kill flag, it moves the
kill flag to the place where the sub-register is killed. This can accidentally
overlap with the use of a sibling sub-register, and we have trouble.

In the test case we have this code:

Live Ins: %R0 %R1 %R2
	%R2L<def> = EXTRACT_SUBREG %R2<kill>, 1
	%R2H<def> = LOAD16fi <fi#-1>, 0, Mem:LD(2,4) [FixedStack-1 + 0]
	%R1L<def> = EXTRACT_SUBREG %R1<kill>, 1
	%R0L<def> = EXTRACT_SUBREG %R0<kill>, 1
	%R0H<def> = ADD16 %R2H<kill>, %R2L<kill>, %AZ<imp-def>, %AN<imp-def>, %AC0<imp-def>, %V<imp-def>, %VS<imp-def>

subreg: CONVERTING: %R2L<def> = EXTRACT_SUBREG %R2<kill>, 1
subreg: eliminated!
subreg: killed here: %R0H<def> = ADD16 %R2H, %R2L, %R2<imp-use,kill>, %AZ<imp-def>, %AN<imp-def>, %AC0<imp-def>, %V<imp-def>, %VS<imp-def>

The kill flag on %R2 is moved to the last instruction, and the live range overlaps with the definition of %R2H:

*** Bad machine code: Redefining a live physical register ***
- function:    f
- basic block:  0x18358c0 (#0)
- instruction: %R2H<def> = LOAD16fi <fi#-1>, 0, Mem:LD(2,4) [FixedStack-1 + 0]
Register R2H was defined but already live.

The fix is to replace EXTRACT_SUBREG with IMPLICIT_DEF instead of eliminating
it completely:

subreg: CONVERTING: %R2L<def> = EXTRACT_SUBREG %R2<kill>, 1
subreg: replace by: %R2L<def> = IMPLICIT_DEF %R2<kill>

Note that these IMPLICIT_DEF instructions survive to the asm output. It is
necessary to fix the stack-color-with-reg test case because of that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78093 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 20:01:11 +00:00
autoconf Build Blackfin target with autoconf and cmake. 2009-08-02 17:32:37 +00:00
bindings Reorder the "Metadata" entry to match the C bindings. 2009-07-21 21:52:57 +00:00
cmake CMake configuration: find mkdtemp, mkstemp, mktemp. 2009-07-27 18:23:41 +00:00
docs Minor www site formating improvements. 2009-08-04 05:24:28 +00:00
examples Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are 2009-07-31 20:28:14 +00:00
include Add some type traits that are used for Clang's statically-checked 2009-08-04 17:04:52 +00:00
lib LowerSubregsInstructionPass::LowerExtract should not extend the live range of registers. 2009-08-04 20:01:11 +00:00
projects remove dead makefile flags. 2009-06-24 05:29:56 +00:00
runtime
test LowerSubregsInstructionPass::LowerExtract should not extend the live range of registers. 2009-08-04 20:01:11 +00:00
tools No really, it's unused. 2009-08-04 04:08:40 +00:00
unittests Remove now empty unit test directory. 2009-08-01 19:07:29 +00:00
utils * Use "svn export" instead of "svn co" and avoid cleaning up .svn dirs 2009-08-04 15:47:18 +00:00
website
win32 Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come. 2009-07-24 23:12:02 +00:00
Xcode Remove the IA-64 backend. 2009-07-24 00:30:09 +00:00
build-for-llvm-top.sh
CMakeLists.txt Build Blackfin target with autoconf and cmake. 2009-08-02 17:32:37 +00:00
configure Build Blackfin target with autoconf and cmake. 2009-08-02 17:32:37 +00:00
CREDITS.TXT Added myself to the blame list. 2009-07-15 13:01:49 +00:00
LICENSE.TXT one fewer license, yay. :) 2009-08-01 22:54:39 +00:00
llvm.spec.in
Makefile Introduce new headers whose inclusion forces linking and 2009-06-16 20:12:29 +00:00
Makefile.common
Makefile.config.in LLVMC can be now compiled w/o dynamic plugin support. 2009-07-04 03:55:25 +00:00
Makefile.rules Makefile rules for generating assembly matcher. 2009-07-13 18:35:35 +00:00
ModuleInfo.txt
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 HTML documentation provided in docs/index.html for further
assistance with LLVM.