LLVM backend for 6502
Go to file
Chris Lattner 120fce5540 Be far more careful when splitting a loop header, either to form a preheader
or when splitting loops with a common header into multiple loops.  In particular
the old code would always insert the preheader before the old loop header.  This
is disasterous in cases where the loop hasn't been rotated.  For example, it can
produce code like:

        .. outside the loop...
        jmp LBB1_2      #bb13.outer
LBB1_1: #bb1
        movsd 8(%esp,%esi,8), %xmm1
        mulsd (%edi), %xmm1
        addsd %xmm0, %xmm1
        addl $24, %edi
        incl %esi
        jmp LBB1_3      #bb13
LBB1_2: #bb13.outer
        leal (%edx,%eax,8), %edi
        pxor %xmm1, %xmm1
        xorl %esi, %esi
LBB1_3: #bb13
        movapd %xmm1, %xmm0
        cmpl $4, %esi
        jl LBB1_1       #bb1

Note that the loop body is actually LBB1_1 + LBB1_3, which means that the
loop now contains an uncond branch WITHIN it to jump around the inserted
loop header (LBB1_2).  Doh.

This patch changes the preheader insertion code to insert it in the right
spot, producing this code:

        ... outside the loop, fall into the header ...
LBB1_1: #bb13.outer
        leal (%edx,%eax,8), %esi
        pxor %xmm0, %xmm0
        xorl %edi, %edi
        jmp LBB1_3      #bb13
LBB1_2: #bb1
        movsd 8(%esp,%edi,8), %xmm0
        mulsd (%esi), %xmm0
        addsd %xmm1, %xmm0
        addl $24, %esi
        incl %edi
LBB1_3: #bb13
        movapd %xmm0, %xmm1
        cmpl $4, %edi
        jl LBB1_2       #bb1

Totally crazy, no branch in the loop! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30587 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-23 08:19:21 +00:00
autoconf Add a HAVE_MACH_MACH_H #define to detect the presence of the mach/mach.h 2006-09-14 06:17:21 +00:00
docs Make the LLVM Publications link point to /pubs/ since this has moved to 2006-09-17 23:05:15 +00:00
examples Use llvm-config to determine what to link in 2006-09-04 06:04:03 +00:00
include/llvm remove misleading comment 2006-09-23 06:09:45 +00:00
lib Be far more careful when splitting a loop header, either to form a preheader 2006-09-23 08:19:21 +00:00
projects Fix a race condition in the makefile that broke grawp's tester last night. 2006-08-25 17:15:23 +00:00
runtime Describe and date modifications we made per LGPL requirements. 2006-08-08 14:47:54 +00:00
test Use "%llvmgxx" instead of "llvm-g++". 2006-09-22 07:09:01 +00:00
tools Use abstract class to facilitate dlopen() interface. 2006-09-21 17:22:55 +00:00
utils don't allow 'imm' or specific imms, like '1' on the LHS of a binop. 2006-09-21 20:46:13 +00:00
win32 Keep Visual Studio happy. 2006-05-03 00:28:50 +00:00
Xcode Adding new files. 2006-09-07 22:07:57 +00:00
.cvsignore Ignore stuff built by "make dist". 2006-04-07 15:55:18 +00:00
configure Add a HAVE_MACH_MACH_H #define to detect the presence of the mach/mach.h 2006-09-14 06:17:21 +00:00
CREDITS.TXT The list is sorted by name. 2006-08-29 01:42:47 +00:00
LICENSE.TXT burg is gone 2006-09-11 17:28:11 +00:00
llvm.spec.in Minor technical correction in documentation. 2006-08-21 01:58:57 +00:00
Makefile Document build order dependencies. Make sure that llvm-config is built before 2006-09-04 04:27:07 +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 Make the name of the project consistent with that specified in the 2006-08-07 23:23:39 +00:00
Makefile.rules Fix a build problem 2006-09-04 06:39:52 +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.